4 include($strRel . 'config.php');
5 include($DIR_LIBS . 'PLUGINADMIN.php');
6 include('template.php');
9 $oPluginAdmin = new PluginAdmin('TrackBack');
11 if ( !$member->isLoggedIn() )
13 $oPluginAdmin->start();
14 echo '<p>' . _ERROR_DISALLOWED . '</p>';
20 $action = requestVar('action');
21 $aActionsNotToCheck = array(
25 if (!in_array($action, $aActionsNotToCheck)) {
26 if (!$manager->checkTicket()) doError(_ERROR_BADTICKET);
29 $oPluginAdmin->start();
31 //modify start+++++++++
32 $plug =& $oPluginAdmin->plugin;
33 $tableVersion = $plug->checkTableVersion();
35 // include language file for this plugin
36 $language = ereg_replace( '[\\|/]', '', getLanguageName());
37 if (file_exists($plug->getDirectory().'language/'.$language.'.php'))
38 include_once($plug->getDirectory().'language/'.$language.'.php');
40 include_once($plug->getDirectory().'language/'.'english.php');
43 $mTemplate = new Trackback_Template();
44 $mTemplate->set ('CONF', $CONF);
45 $mTemplate->set ('plugid', $plug->getID());
46 $mTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL());
47 $mTemplate->template('templates/menu.html');
48 echo $mTemplate->fetch();
50 $oTemplate = new Trackback_Template();
51 $oTemplate->set ('CONF', $CONF);
52 $oTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL());
53 $oTemplate->set ('ticket', $manager->_generateTicket());
54 $ajaxEnabled = ($oPluginAdmin->plugin->getOption('ajaxEnabled') == 'yes') ? true : false;
55 $oTemplate->set ('ajaxEnabled', $ajaxEnabled);
58 if( ! $member->isAdmin() ){
60 $res = sql_query('SELECT tblog FROM '.sql_table('team').' WHERE tadmin = 1 AND tmember = '.$member->getID() );
62 while ($row = mysql_fetch_array($res)){
63 $adminBlog[] = $row[0];
66 $whereClause = ' i.iblog in (' . implode(', ', $adminBlog) . ') ';
69 $whereClause = ' AND ( i.iauthor = '.$member->getID().' OR ' . $whereClause . ' )';
71 $whereClause = ' AND i.iauthor = '.$member->getID();
73 //echo "<p>Debug: $whereClause<p>";
75 $requiredAdminRights = array(
80 if (in_array($action, $requiredAdminRights)) {
81 if( ! $member->isAdmin() ){
82 echo '<p>' . _ERROR_DISALLOWED . '</p>';
83 echo '<p>Reason: ' . __LINE__ . '</p>';
89 $requiredItemEditRights = array(
94 if (in_array($action, $requiredItemEditRights)) {
95 if( ! $member->isAdmin() ){
96 $tb = intRequestVar('tb');
97 $query = 'SELECT i.inumber FROM ' . sql_table('plugin_tb') . ' t, ' . sql_table('item') . ' i WHERE t.tb_id = i.inumber AND t.id = '. $tb . $whereClause ;
98 $res = sql_query($query);
99 if( ! @mysql_num_rows($res) ){
100 echo '<p>' . _ERROR_DISALLOWED . '</p>';
101 echo '<p>Reason: ' . __LINE__ . '</p>';
102 $oPluginAdmin->end();
110 //modify start+++++++++
113 CREATE TABLE IF NOT EXISTS
114 ".sql_table('plugin_tb_lookup')."
116 `link` TEXT NOT NULL,
120 PRIMARY KEY (`link` (100))
123 echo $q = "ALTER TABLE ".sql_table('plugin_tb')."
124 ADD `block` TINYINT( 4 ) NOT NULL AFTER `url` ,
125 ADD `spam` TINYINT( 4 ) NOT NULL AFTER `block` ,
126 ADD `link` TINYINT( 4 ) NOT NULL AFTER `spam` ,
127 CHANGE `url` `url` TEXT NOT NULL,
128 CHANGE `title` `title` TEXT NOT NULL,
129 CHANGE `excerpt` `excerpt` TEXT NOT NULL,
130 CHANGE `blog_name` `blog_name` TEXT NOT NULL,
132 ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;";
133 $res = @sql_query($q);
135 echo 'Could not alter table: ' . mysql_error();
138 $oTemplate->template('templates/updatetablefinished.html');
140 @sql_query('ALTER TABLE `' . sql_table('plugin_tb') . '` ADD INDEX `tb_id_block_timestamp_idx` ( `tb_id`, `block`, `timestamp` DESC )');
142 //modify end+++++++++
145 $tb = intRequestVar('tb');
149 ".sql_table('plugin_tb')."
156 $action = requestVar('next');
159 case 'blocked_clear':
160 $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1");
161 $action = requestVar('next');
164 case 'blocked_spamclear':
165 $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1 and spam = 1");
166 $action = requestVar('next');
170 $tb = intRequestVar('tb');
174 ".sql_table('plugin_tb')."
181 $action = requestVar('next');
185 $tb = intRequestVar('tb');
189 ".sql_table('plugin_tb')."
194 $action = requestVar('next');
198 $title = requestVar('title');
199 $url = requestVar('url');
200 $excerpt = requestVar('excerpt');
201 $blog_name = requestVar('blog_name');
202 $ping_url = requestVar('ping_url');
204 // No charset conversion needs to be done here, because
205 // the charset used to receive the info is used to send
209 $error = $oPluginAdmin->plugin->sendPing(0, $title, $url, $excerpt, $blog_name, $ping_url);
212 echo '<b>TrackBack Error:' . $error . '</b>';
216 $action = requestVar('next');
220 $id = intRequestVar('id');
222 $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
224 @ include($strRel . 'fancyurls.config.php');
227 $itemData = $manager->getItem($id, 0, 0);
229 if(is_array($itemData)){
230 $blog =& $manager->getBlog($itemData['blogid']);
231 $CONF['ItemURL'] = ($usePathInfo)? preg_replace('/\/$/', '', $blog->getURL()): $blog->getURL();
232 $itemData['url'] = createItemLink($id);
233 $itemData['excerpt'] = shorten(strip_tags($itemData['body'].$itemData['more']), 250, '...');
234 $itemData['blogname'] = $blog->getName();
237 $itemData['url'] = $CONF['IndexURL'];
238 $itemData['blogname'] = $CONF['SiteName'];
240 $oTemplate->set('item', $itemData);
242 $oTemplate->template('templates/ping.html');
250 $oTemplate->template('help.html');
254 $oTemplate->template('templates/ping.html');
263 ".sql_table('plugin_tb')." AS t,
264 ".sql_table('item')." AS i
266 t.tb_id = i.inumber AND
267 t.block = " . (( $action == 'all') ? 0 : 1) . $whereClause );
269 if ($row = mysql_fetch_array($rres))
270 $count = $row['count'];
273 $oTemplate->set('count', $count);
276 if( $action == 'all')
277 $oTemplate->template('templates/all_ajax.html');
279 $oTemplate->template('templates/blocked_ajax.html');
281 $start = intRequestVar('start') ? intRequestVar('start') : 0;
282 $amount = intRequestVar('amount') ? intRequestVar('amount') : 25;
287 i.inumber AS story_id,
290 t.blog_name AS blog_name,
291 t.excerpt AS excerpt,
293 UNIX_TIMESTAMP(t.timestamp) AS timestamp,
297 ".sql_table('plugin_tb')." AS t,
298 ".sql_table('item')." AS i
300 t.tb_id = i.inumber AND
301 t.block = " . (( $action == 'all') ? 0 : 1) . $whereClause ."
305 ".$start.",".$amount);
309 while ($rrow = mysql_fetch_array($rres)){
310 $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50);
311 $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']);
312 $rrow['title'] = htmlspecialchars($rrow['title']);
314 $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50);
315 $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']);
316 $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']);
318 $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800);
319 $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']);
320 $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']);
322 $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES);
323 $rrow['timestamp'] = htmlspecialchars($rrow['timestamp'], ENT_QUOTES);
325 $blog = & $manager->getBlog(getBlogIDFromItemID($item['itemid']));
326 $rrow['story_url'] = $oPluginAdmin->plugin->_createItemLink($rrow['story_id'], $blog);
327 $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES);
332 $oTemplate->set('amount', $amount);
333 $oTemplate->set('start', $start);
334 $oTemplate->set('items', $items);
336 if( $action == 'all')
337 $oTemplate->template('templates/all.html');
339 $oTemplate->template('templates/blocked.html');
344 $id = requestVar('id');
345 $start = intRequestVar('start') ? intRequestVar('start') : 0;
346 $amount = intRequestVar('amount') ? intRequestVar('amount') : 25;
353 ".sql_table('item')." i
355 i.inumber = '".$id."'
358 if ($irow = mysql_fetch_array($ires))
361 $story['title'] = $irow['ititle'];
367 ".sql_table('plugin_tb')." AS t
369 t.tb_id = '".$id."' AND
373 if ($row = mysql_fetch_array($rres))
374 $count = $row['count'];
382 t.blog_name AS blog_name,
383 t.excerpt AS excerpt,
385 UNIX_TIMESTAMP(t.timestamp) AS timestamp
387 ".sql_table('plugin_tb')." AS t
389 t.tb_id = '".$id."' AND
394 ".$start.",".$amount."
399 while ($rrow = mysql_fetch_array($rres))
401 $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50);
402 $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']);
403 $rrow['title'] = htmlspecialchars($rrow['title']);
404 // $rrow['title'] = _CHARSET == 'UTF-8' ? $rrow['title'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['title']);
406 $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50);
407 $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']);
408 $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']);
409 // $rrow['blog_name'] = _CHARSET == 'UTF-8' ? $rrow['blog_name'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['blog_name']);
411 $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800);
412 $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']);
413 $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']);
414 // $rrow['excerpt'] = _CHARSET == 'UTF-8' ? $rrow['excerpt'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['excerpt']);
416 $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES);
417 $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES);
421 $oTemplate->set ('amount', $amount);
422 $oTemplate->set ('count', $count);
423 $oTemplate->set ('start', $start);
424 $oTemplate->set ('items', $items);
425 $oTemplate->set ('story', $story);
426 $oTemplate->template('templates/list.html');
439 ".sql_table('blog')."
446 while ($brow = mysql_fetch_array($bres))
448 if( !$member->isTeamMember($brow['bnumber']) ) continue;
451 i.inumber AS inumber,
455 ".sql_table('item')." AS i,
456 ".sql_table('plugin_tb')." AS t
458 i.iblog = ".$brow['bnumber']." AND
459 t.tb_id = i.inumber AND
460 t.block = 0 ".$whereClause."
469 while ($irow = mysql_fetch_array($ires))
474 $brow['items'] = $items;
478 $oTemplate->set ('blogs', $blogs);
479 $oTemplate->template('templates/index.html');
483 //modify start+++++++++
485 $oTemplate->template('templates/updatetable.html');
487 //modify end+++++++++
491 // Create the admin area page
492 echo $oTemplate->fetch();
494 echo '<div align="right">Powered by <a href="http://www.famfamfam.com/lab/icons/silk/">Silk icon</a></div>';
495 $oPluginAdmin->end();