4 include($strRel . 'config.php');
5 include($DIR_LIBS . 'PLUGINADMIN.php');
6 include('template.php');
9 // Send out Content-type
10 sendContentType('application/xhtml+xml', 'admin-trackback', _CHARSET);
12 $oPluginAdmin = new PluginAdmin('TrackBack');
14 if (!($member->isLoggedIn() && $member->isAdmin()))
16 $oPluginAdmin->start();
17 echo '<p>' . _ERROR_DISALLOWED . '</p>';
23 $action = requestVar('action');
24 $aActionsNotToCheck = array(
27 if (!in_array($action, $aActionsNotToCheck)) {
28 if (!$manager->checkTicket()) doError(_ERROR_BADTICKET);
30 $oPluginAdmin->start();
32 //modify start+++++++++
33 $plug =& $oPluginAdmin->plugin;
34 $tableVersion = $plug->checkTableVersion();
36 // include language file for this plugin
37 $language = ereg_replace( '[\\|/]', '', getLanguageName());
38 if (file_exists($plug->getDirectory().'language/'.$language.'.php'))
39 include_once($plug->getDirectory().'language/'.$language.'.php');
41 include_once($plug->getDirectory().'language/'.'english.php');
44 $mTemplate = new Trackback_Template();
45 $mTemplate->set ('CONF', $CONF);
46 $mTemplate->set ('plugid', $plug->getID());
47 $mTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL());
48 $mTemplate->template('templates/menu.html');
49 echo $mTemplate->fetch();
51 $oTemplate = new Trackback_Template();
52 $oTemplate->set ('CONF', $CONF);
53 $oTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL());
54 $oTemplate->set ('ticket', $manager->_generateTicket());
55 \r $ajaxEnabled = ($oPluginAdmin->plugin->getOption('ajaxEnabled') == 'yes') ? true : false;
56 $oTemplate->set ('ajaxEnabled', $ajaxEnabled);
60 //modify start+++++++++
63 CREATE TABLE IF NOT EXISTS
64 ".sql_table('plugin_tb_lookup')."
70 PRIMARY KEY (`link` (100))
73 echo $q = "ALTER TABLE ".sql_table('plugin_tb')."
74 ADD `block` TINYINT( 4 ) NOT NULL AFTER `url` ,
75 ADD `spam` TINYINT( 4 ) NOT NULL AFTER `block` ,
76 ADD `link` TINYINT( 4 ) NOT NULL AFTER `spam` ,
77 CHANGE `url` `url` TEXT NOT NULL,
78 CHANGE `title` `title` TEXT NOT NULL,
79 CHANGE `excerpt` `excerpt` TEXT NOT NULL,
80 CHANGE `blog_name` `blog_name` TEXT NOT NULL,
82 ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;";
83 $res = @mysql_query($q);
85 echo 'Could not alter table: ' . mysql_error();
88 $oTemplate->template('templates/updatetablefinished.html');
90 @mysql_query('ALTER TABLE `' . sql_table('plugin_tb') . '` ADD INDEX `tb_id_block_timestamp_idx` ( `tb_id`, `block`, `timestamp` DESC )');
95 $tb = intRequestVar('tb');
99 ".sql_table('plugin_tb')."
106 $action = requestVar('next');
108 case 'blocked_clear':
109 $res = mysql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1");
110 $action = requestVar('next');
113 case 'blocked_spamclear':
114 $res = mysql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1 and spam = 1");
115 $action = requestVar('next');
119 $tb = intRequestVar('tb');
121 $res = mysql_query ("
123 ".sql_table('plugin_tb')."
130 $action = requestVar('next');
134 $tb = intRequestVar('tb');
136 $res = mysql_query ("
138 ".sql_table('plugin_tb')."
143 $action = requestVar('next');
147 $title = requestVar('title');
148 $url = requestVar('url');
149 $excerpt = requestVar('excerpt');
150 $blog_name = requestVar('blog_name');
151 $ping_url = requestVar('ping_url');
153 // No charset conversion needs to be done here, because
154 // the charset used to receive the info is used to send
158 $error = $oPluginAdmin->plugin->sendPing(0, $title, $url, $excerpt, $blog_name, $ping_url);
161 echo '<b>TrackBack Error:' . $error . '</b>';
165 $action = requestVar('next');
168 $id = intRequestVar('id');
170 $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
172 @ include($strRel . 'fancyurls.config.php');
175 $itemData = $manager->getItem($id, 0, 0);
177 if(is_array($itemData)){
178 $blog =& $manager->getBlog($itemData['blogid']);
179 $CONF['ItemURL'] = ($usePathInfo)? preg_replace('/\/$/', '', $blog->getURL()): $blog->getURL();
180 $itemData['url'] = createItemLink($id);
181 $itemData['excerpt'] = shorten(strip_tags($itemData['body'].$itemData['more']), 250, '...');
182 $itemData['blogname'] = $blog->getName();
185 $itemData['url'] = $CONF['IndexURL'];
186 $itemData['blogname'] = $CONF['SiteName'];
188 $oTemplate->set('item', $itemData);
190 $oTemplate->template('templates/ping.html');
198 $oTemplate->template('help.html');
202 $oTemplate->template('templates/ping.html');
207 $rres = mysql_query ("
211 ".sql_table('plugin_tb')." AS t,
212 ".sql_table('item')." AS i
214 t.tb_id = i.inumber AND
215 t.block = " . (( $action == 'all') ? 0 : 1) );
217 if ($row = mysql_fetch_array($rres))
218 $count = $row['count'];
221 $oTemplate->set('count', $count);
224 if( $action == 'all')
225 $oTemplate->template('templates/all_ajax.html');
227 $oTemplate->template('templates/blocked_ajax.html');
228 } else {
\r $start = intRequestVar('start') ? intRequestVar('start') : 0;
229 $amount = intRequestVar('amount') ? intRequestVar('amount') : 25;
231 $rres = mysql_query ("
234 i.inumber AS story_id,
237 t.blog_name AS blog_name,
238 t.excerpt AS excerpt,
240 UNIX_TIMESTAMP(t.timestamp) AS timestamp,
244 ".sql_table('plugin_tb')." AS t,
245 ".sql_table('item')." AS i
247 t.tb_id = i.inumber AND
248 t.block = " . (( $action == 'all') ? 0 : 1) ."
252 ".$start.",".$amount);
256 while ($rrow = mysql_fetch_array($rres)){
257 $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50);
258 $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']);
259 $rrow['title'] = htmlspecialchars($rrow['title']);
261 $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50);
262 $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']);
263 $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']);
265 $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800);
266 $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']);
267 $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']);
269 $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES);
270 $rrow['timestamp'] = htmlspecialchars($rrow['timestamp'], ENT_QUOTES);
272 $blog = & $manager->getBlog(getBlogIDFromItemID($item['itemid']));
273 $rrow['story_url'] = $oPluginAdmin->plugin->_createItemLink($rrow['story_id'], $blog);
274 $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES);
279 $oTemplate->set('amount', $amount);
280 $oTemplate->set('start', $start);
281 $oTemplate->set('items', $items);
283 if( $action == 'all')
284 $oTemplate->template('templates/all.html');
286 $oTemplate->template('templates/blocked.html');
291 $id = requestVar('id');
292 $start = intRequestVar('start') ? intRequestVar('start') : 0;
293 $amount = intRequestVar('amount') ? intRequestVar('amount') : 25;
295 $ires = mysql_query ("
300 ".sql_table('item')."
305 if ($irow = mysql_fetch_array($ires))
308 $story['title'] = $irow['ititle'];
310 $rres = mysql_query ("
314 ".sql_table('plugin_tb')." AS t
316 t.tb_id = '".$id."' AND
320 if ($row = mysql_fetch_array($rres))
321 $count = $row['count'];
325 $rres = mysql_query ("
329 t.blog_name AS blog_name,
330 t.excerpt AS excerpt,
332 UNIX_TIMESTAMP(t.timestamp) AS timestamp
334 ".sql_table('plugin_tb')." AS t
336 t.tb_id = '".$id."' AND
341 ".$start.",".$amount."
346 while ($rrow = mysql_fetch_array($rres))
348 $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50);
349 $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']);
350 $rrow['title'] = htmlspecialchars($rrow['title']);
351 // $rrow['title'] = _CHARSET == 'UTF-8' ? $rrow['title'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['title']);
353 $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50);
354 $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']);
355 $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']);
356 // $rrow['blog_name'] = _CHARSET == 'UTF-8' ? $rrow['blog_name'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['blog_name']);
358 $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800);
359 $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']);
360 $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']);
361 // $rrow['excerpt'] = _CHARSET == 'UTF-8' ? $rrow['excerpt'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['excerpt']);
363 $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES);
364 $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES);
368 $oTemplate->set ('amount', $amount);
369 $oTemplate->set ('count', $count);
370 $oTemplate->set ('start', $start);
371 $oTemplate->set ('items', $items);
372 $oTemplate->set ('story', $story);
373 $oTemplate->template('templates/list.html');
380 $bres = mysql_query ("
386 ".sql_table('blog')."
393 while ($brow = mysql_fetch_array($bres))
395 $ires = mysql_query ("
397 i.inumber AS inumber,
401 ".sql_table('item')." AS i,
402 ".sql_table('plugin_tb')." AS t
404 i.iblog = ".$brow['bnumber']." AND
405 t.tb_id = i.inumber AND
415 while ($irow = mysql_fetch_array($ires))
420 $brow['items'] = $items;
424 $oTemplate->set ('blogs', $blogs);
425 $oTemplate->template('templates/index.html');
429 //modify start+++++++++
431 $oTemplate->template('templates/updatetable.html');
433 //modify end+++++++++
437 // Create the admin area page
438 echo $oTemplate->fetch();
440 echo '<div align="right">Powered by <a href="http://www.famfamfam.com/lab/icons/silk/">Silk icon</a></div>';
441 $oPluginAdmin->end();