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);
31 //$oPluginAdmin->start();
32 $oPluginAdmin->admin->pagehead();
34 //modify start+++++++++
35 $plug =& $oPluginAdmin->plugin;
36 $tableVersion = $plug->checkTableVersion();
38 // include language file for this plugin
39 $language = ereg_replace( '[\\|/]', '', getLanguageName());
40 if (file_exists($plug->getDirectory().'language/'.$language.'.php'))
41 include_once($plug->getDirectory().'language/'.$language.'.php');
43 include_once($plug->getDirectory().'language/'.'english.php');
46 $mTemplate = new Trackback_Template();
47 $mTemplate->set ('CONF', $CONF);
48 $mTemplate->set ('plugid', $plug->getID());
49 $mTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL());
50 $mTemplate->template('templates/menu.html');
51 echo $mTemplate->fetch();
53 $oTemplate = new Trackback_Template();
54 $oTemplate->set ('CONF', $CONF);
55 $oTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL());
56 $oTemplate->set ('ticket', $manager->_generateTicket());
57 \r $ajaxEnabled = ($oPluginAdmin->plugin->getOption('ajaxEnabled') == 'yes') ? true : false;
58 $oTemplate->set ('ajaxEnabled', $ajaxEnabled);
62 //modify start+++++++++
65 CREATE TABLE IF NOT EXISTS
66 ".sql_table('plugin_tb_lookup')."
72 PRIMARY KEY (`link` (100))
75 echo $q = "ALTER TABLE ".sql_table('plugin_tb')."
76 ADD `block` TINYINT( 4 ) NOT NULL AFTER `url` ,
77 ADD `spam` TINYINT( 4 ) NOT NULL AFTER `block` ,
78 ADD `link` TINYINT( 4 ) NOT NULL AFTER `spam` ,
79 CHANGE `url` `url` TEXT NOT NULL,
80 CHANGE `title` `title` TEXT NOT NULL,
81 CHANGE `excerpt` `excerpt` TEXT NOT NULL,
82 CHANGE `blog_name` `blog_name` TEXT NOT NULL,
84 ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;";
85 $res = @sql_query($q);
87 echo 'Could not alter table: ' . mysql_error();
90 $oTemplate->template('templates/updatetablefinished.html');
92 @sql_query('ALTER TABLE `' . sql_table('plugin_tb') . '` ADD INDEX `tb_id_block_timestamp_idx` ( `tb_id`, `block`, `timestamp` DESC )');
97 $tb = intRequestVar('tb');
101 ".sql_table('plugin_tb')."
108 $action = requestVar('next');
110 case 'blocked_clear':
111 $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1");
112 $action = requestVar('next');
115 case 'blocked_spamclear':
116 $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1 and spam = 1");
117 $action = requestVar('next');
121 $tb = intRequestVar('tb');
125 ".sql_table('plugin_tb')."
132 $action = requestVar('next');
136 $tb = intRequestVar('tb');
140 ".sql_table('plugin_tb')."
145 $action = requestVar('next');
149 $title = requestVar('title');
150 $url = requestVar('url');
151 $excerpt = requestVar('excerpt');
152 $blog_name = requestVar('blog_name');
153 $ping_url = requestVar('ping_url');
155 // No charset conversion needs to be done here, because
156 // the charset used to receive the info is used to send
160 $error = $oPluginAdmin->plugin->sendPing(0, $title, $url, $excerpt, $blog_name, $ping_url);
163 echo '<b>TrackBack Error:' . $error . '</b>';
167 $action = requestVar('next');
170 $id = intRequestVar('id');
172 $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
174 @ include($strRel . 'fancyurls.config.php');
177 $itemData = $manager->getItem($id, 0, 0);
179 if(is_array($itemData)){
180 $blog =& $manager->getBlog($itemData['blogid']);
181 $CONF['ItemURL'] = ($usePathInfo)? preg_replace('/\/$/', '', $blog->getURL()): $blog->getURL();
182 $itemData['url'] = createItemLink($id);
183 $itemData['excerpt'] = shorten(strip_tags($itemData['body'].$itemData['more']), 250, '...');
184 $itemData['blogname'] = $blog->getName();
187 $itemData['url'] = $CONF['IndexURL'];
188 $itemData['blogname'] = $CONF['SiteName'];
190 $oTemplate->set('item', $itemData);
192 $oTemplate->template('templates/ping.html');
200 $oTemplate->template('help.html');
204 $oTemplate->template('templates/ping.html');
213 ".sql_table('plugin_tb')." AS t,
214 ".sql_table('item')." AS i
216 t.tb_id = i.inumber AND
217 t.block = " . (( $action == 'all') ? 0 : 1) );
219 if ($row = mysql_fetch_array($rres))
220 $count = $row['count'];
223 $oTemplate->set('count', $count);
226 if( $action == 'all')
227 $oTemplate->template('templates/all_ajax.html');
229 $oTemplate->template('templates/blocked_ajax.html');
230 } else {
\r $start = intRequestVar('start') ? intRequestVar('start') : 0;
231 $amount = intRequestVar('amount') ? intRequestVar('amount') : 25;
236 i.inumber AS story_id,
239 t.blog_name AS blog_name,
240 t.excerpt AS excerpt,
242 UNIX_TIMESTAMP(t.timestamp) AS timestamp,
246 ".sql_table('plugin_tb')." AS t,
247 ".sql_table('item')." AS i
249 t.tb_id = i.inumber AND
250 t.block = " . (( $action == 'all') ? 0 : 1) ."
254 ".$start.",".$amount);
258 while ($rrow = mysql_fetch_array($rres)){
259 $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50);
260 $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']);
261 $rrow['title'] = htmlspecialchars($rrow['title']);
263 $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50);
264 $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']);
265 $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']);
267 $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800);
268 $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']);
269 $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']);
271 $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES);
272 $rrow['timestamp'] = htmlspecialchars($rrow['timestamp'], ENT_QUOTES);
274 $blog = & $manager->getBlog(getBlogIDFromItemID($item['itemid']));
275 $rrow['story_url'] = $oPluginAdmin->plugin->_createItemLink($rrow['story_id'], $blog);
276 $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES);
281 $oTemplate->set('amount', $amount);
282 $oTemplate->set('start', $start);
283 $oTemplate->set('items', $items);
285 if( $action == 'all')
286 $oTemplate->template('templates/all.html');
288 $oTemplate->template('templates/blocked.html');
293 $id = requestVar('id');
294 $start = intRequestVar('start') ? intRequestVar('start') : 0;
295 $amount = intRequestVar('amount') ? intRequestVar('amount') : 25;
302 ".sql_table('item')."
307 if ($irow = mysql_fetch_array($ires))
310 $story['title'] = $irow['ititle'];
316 ".sql_table('plugin_tb')." AS t
318 t.tb_id = '".$id."' AND
322 if ($row = mysql_fetch_array($rres))
323 $count = $row['count'];
331 t.blog_name AS blog_name,
332 t.excerpt AS excerpt,
334 UNIX_TIMESTAMP(t.timestamp) AS timestamp
336 ".sql_table('plugin_tb')." AS t
338 t.tb_id = '".$id."' AND
343 ".$start.",".$amount."
348 while ($rrow = mysql_fetch_array($rres))
350 $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50);
351 $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']);
352 $rrow['title'] = htmlspecialchars($rrow['title']);
353 // $rrow['title'] = _CHARSET == 'UTF-8' ? $rrow['title'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['title']);
355 $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50);
356 $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']);
357 $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']);
358 // $rrow['blog_name'] = _CHARSET == 'UTF-8' ? $rrow['blog_name'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['blog_name']);
360 $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800);
361 $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']);
362 $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']);
363 // $rrow['excerpt'] = _CHARSET == 'UTF-8' ? $rrow['excerpt'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['excerpt']);
365 $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES);
366 $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES);
370 $oTemplate->set ('amount', $amount);
371 $oTemplate->set ('count', $count);
372 $oTemplate->set ('start', $start);
373 $oTemplate->set ('items', $items);
374 $oTemplate->set ('story', $story);
375 $oTemplate->template('templates/list.html');
388 ".sql_table('blog')."
395 while ($brow = mysql_fetch_array($bres))
399 i.inumber AS inumber,
403 ".sql_table('item')." AS i,
404 ".sql_table('plugin_tb')." AS t
406 i.iblog = ".$brow['bnumber']." AND
407 t.tb_id = i.inumber AND
417 while ($irow = mysql_fetch_array($ires))
422 $brow['items'] = $items;
426 $oTemplate->set ('blogs', $blogs);
427 $oTemplate->template('templates/index.html');
431 //modify start+++++++++
433 $oTemplate->template('templates/updatetable.html');
435 //modify end+++++++++
439 // Create the admin area page
440 echo $oTemplate->fetch();
442 echo '<div align="right">Powered by <a href="http://www.famfamfam.com/lab/icons/silk/">Silk icon</a></div>';
443 $oPluginAdmin->end();