Welcome to Geeklog, Anonymous Sunday, November 24 2024 @ 12:57 pm EST
Geeklog Forums
Add a trackback submission queue
Status: offline
ByteEnable
Forum User
Full Member
Registered: 10/20/03
Posts: 138
Add a field to gl_trackback in database:
`approve`, tinyint(3), UNSIGNED, NULL= Yes, default = 0
diff to /system/lib-trackback.php
--- lib-trackback.php 2006-03-05 03:19:11.000000000 -0600
+++ libtrackback.php 2006-04-07 16:19:04.000000000 -0500
@@ -135,7 +135,7 @@ function TRB_makeTrackbackUrl ($id, $typ
*/
function TRB_filterTitle ($title)
{
- return htmlspecialchars (COM_checkWords (strip_tags (COM_stripslashes ($tit
le))));
+ return COM_checkWords (strip_tags (COM_stripslashes ($title)));
}
/**
@@ -504,7 +504,7 @@ function TRB_renderTrackbackComments ($s
$template->set_var ('permalink_and_title', $link_and_title);
$template->set_var ('trackback_url', $trackback_url);
- $result = DB_query ("SELECT cid,url,title,blog,excerpt,ipaddress,UNIX_TIMES
TAMP(date) AS day FROM {$_TABLES['trackback']} WHERE sid = '$sid' AND type = '$t
ype' ORDER BY date");
+ $result = DB_query ("SELECT cid,url,title,blog,excerpt,ipaddress,UNIX_TIMES
TAMP(date) AS day FROM {$_TABLES['trackback']} WHERE sid = '$sid' AND approve =
1 and type = '$type' ORDER BY date");
$numrows = DB_numRows ($result);
$template->set_var ('trackback_comment_count', $numrows);
@@ -646,7 +646,7 @@ function TRB_detectTrackbackUrl ($url)
$req =& new HTTP_Request ($url);
$req->setMethod (HTTP_REQUEST_METHOD_GET);
$response = $req->sendRequest ();
if (PEAR::isError ($response)) {
@@ -752,4 +752,26 @@ function TRB_sendNotificationEmail ($cid
COM_mail ($_CONF['site_mail'], $mailsubject, $mailbody);
}
+/**
+* Deletes a trackback comment and updates count in stories. Checks if the curre
nt user has proper
+* permissions first.
+*
+* @param int $id ID of the trackback comment to delete
+*
+*/
+function TRB_deleteModeration ($id)
+{
+ global $_TABLES;
+
+ $cid = addslashes ($id);
+ $result = DB_query ("SELECT sid,type FROM {$_TABLES['trackback']} WHERE cid
= '$cid'");
+ list ($sid, $type) = DB_fetchArray ($result);
+ if (TRB_allowDelete ($sid, $type)) {
+ TRB_deleteTrackbackComment ($id);
+ if ($type == 'article') {
+ DB_query ("UPDATE {$_TABLES['stories']} SET trackbacks = trackbacks
- 1 WHERE (sid = '$sid')");
+ }
+ }
+}
?>
Here is a diff patch of geeklog-1.4.0sr2 to /admin/moderation.php
--- moderation.php 2006-03-05 03:19:17.000000000 -0600
+++ mod.php 2006-04-07 16:00:48.000000000 -0500
@@ -38,6 +38,8 @@
require_once ('auth.inc.php');
require_once ($_CONF['path_system'] . 'lib-user.php');
require_once ($_CONF['path_system'] . 'lib-story.php');
+require_once ($_CONF['path_system'] . 'lib-trackback.php');
// Uncomment the line below if you need to debug the HTTP variables being passe
d
// to the script. This will sometimes cause errors but it will allow you to se
e
@@ -79,7 +81,6 @@ function commandcontrol()
global $_CONF, $_TABLES, $LANG01, $LANG29, $_IMAGE_TYPE;
$retval = '';
-
$admin_templates = new Template($_CONF['path_layout'] . 'admin/moderation')
;
$admin_templates->set_file (array ('cc' => 'moderation.thtml',
'ccrow' => 'ccrow.thtml',
@@ -215,12 +216,60 @@ function commandcontrol()
$retval .= userlist ();
}
}
-
+ if ($_CONF['trackback_enabled']) {
+ $retval .= PendingTrackBacks();
+ }
$retval .= PLG_showModerationList();
return $retval;
}
+function PendingTrackBacks()
+{
+ global $_CONF, $_TABLES, $LANG24, $LANG29, $LANG_ADMIN;
+ $retval = '';
+
+ $result = DB_query ("SELECT cid AS id,date,url,ipaddress,title,blog,excerpt
FROM {$_TABLES['trackback']} WHERE (approve = 0)" . COM_getTopicSQL ('AND') . C
OM_getPermSQL ('AND', 0, 3) . " ORDER BY date ASC");
+ $nrows = DB_numRows($result);
+ $data_arr = array();
+
+ for ($i = 0; $i < $nrows; $i++) {
+ $A = DB_fetchArray($result);
+ $A['row'] = $i;
+ $A['title'] = stripslashes($A['title']);
+ $data_arr[$i] = $A;
+ }
+
+ $header_arr = array(
+ array('text' => "Date", 'field' => 'date'),
+ array('text' => "URL", 'field' => 'url'),
+ array('text' => "IP Address", 'field' => 'ipaddress'),
+ array('text' => "Title", 'field' => 'title'),
+ array('text' => "Blog", 'field' => 'blog'),
+ array('text' => "Excerpt", 'field' => 'excerpt'),
+ array('text' => $LANG29[2], 'field' => 'delete'),
+ array('text' => $LANG29[1], 'field' => 'approve'));
+
+ $text_arr = array('has_menu' => false,
+ 'title' => "TrackBack Submissions",
+ 'help_url' => '',
+ 'no_data' => $LANG29[39]);
+
+ $table = ADMIN_simpleList("ADMIN_getListField_moderation", $header_arr, $te
xt_arr, $data_arr, array());
+ if ($nrows > 0) {
+ $retval .= "nn<form action="{$_CONF['site_admin_url']}/moderation.ph
p" method="POST">"
+ .'<input type="hidden" name="count" value="' . $
nrows . '">'
+ .'<input type="hidden" name="type" value="trackb
ack">'
+ .'<input type="hidden" name="mode" value="moderation">'
+ .$table
+ .'<center><input type="submit" value="' . $LANG_ADMIN['subm it'] . '"></center></form>' . LB;
+ } else {
+ $retval .= $table;
+ }
+
+ return $retval;
+}
+
/**
* Diplays items needing moderation
*
@@ -460,6 +509,11 @@ function moderation ($mid, $action, $typ
$submissiontable = $_TABLES['eventsubmission'];
$fields = 'eid,title,description,location,address1,address2,city,state,
zipcode,datestart,timestart,dateend,timeend,url';
break;
+ case 'trackback':
+ $id = 'sid';
+ $table = $_TABLES['trackback'];
+ $fields = 'date,url,ipaddress,title,blog,excerpt';
+ break;
case 'story':
$id = 'sid';
$table = $_TABLES['stories'];
@@ -478,7 +532,7 @@ function moderation ($mid, $action, $typ
for ($i = 0; $i < $count; $i++) {
switch ($action[$i]) {
case 'delete':
- if (!empty ($type) && ($type <> 'story') && ($type <> 'draft')) {
+ if (!empty ($type) && ($type <> 'story') && ($type <> 'draft') && (
$type <> 'trackback') ) {
// There may be some plugin specific processing that needs to
// happen first.
$retval .= PLG_deleteSubmission($type, $mid[$i]);
@@ -487,9 +541,13 @@ function moderation ($mid, $action, $typ
$retval .= COM_errorLog("moderation.php just tried deleting eve
rything in table $submissiontable because it got an empty id. Please report thi
s immediately to your site administrator");
return $retval;
}
+ if ($type == 'trackback') {
+ TRB_deleteModeration ($mid[$i]);
+ }
if ($type == 'draft') {
STORY_deleteStory($mid[$i]);
- } else {
+ }
+ if ($type == 'story') {
DB_delete($submissiontable,"$id",$mid[$i]);
}
break;
@@ -528,6 +586,8 @@ function moderation ($mid, $action, $typ
COM_rdfUpToDateCheck ();
COM_olderStuff ();
+ } else if ($type == 'trackback') {
+ DB_query ("UPDATE {$_TABLES['trackback']} SET approve =
1 WHERE cid = '{$mid[$i]}'");
} else {
// This is called in case this is a plugin. There may be some
// plugin specific processing that needs to happen.
@@ -587,19 +647,17 @@ function moderateusers ($uid, $action, $
}
// MAIN
-
$display = '';
$display .= COM_siteHeader ('menu', $LANG29[34]);
if (isset ($_GET['msg'])) {
$display .= COM_showMessage ($_GET['msg']);
}
-
if (isset ($_POST['mode']) && ($_POST['mode'] == 'moderation')) {
if ($_POST['type'] == 'user') {
$display .= moderateusers ($_POST['id'], $_POST['action'],
COM_applyFilter ($_POST['count'], true));
} else {
- $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
+ $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
}
} else {
$display .= commandcontrol();
@@ -608,5 +666,4 @@ function moderateusers ($uid, $action, $
$display .= COM_siteFooter();
echo $display;
`approve`, tinyint(3), UNSIGNED, NULL= Yes, default = 0
diff to /system/lib-trackback.php
Text Formatted Code
--- lib-trackback.php 2006-03-05 03:19:11.000000000 -0600
+++ libtrackback.php 2006-04-07 16:19:04.000000000 -0500
@@ -135,7 +135,7 @@ function TRB_makeTrackbackUrl ($id, $typ
*/
function TRB_filterTitle ($title)
{
- return htmlspecialchars (COM_checkWords (strip_tags (COM_stripslashes ($tit
le))));
+ return COM_checkWords (strip_tags (COM_stripslashes ($title)));
}
/**
@@ -504,7 +504,7 @@ function TRB_renderTrackbackComments ($s
$template->set_var ('permalink_and_title', $link_and_title);
$template->set_var ('trackback_url', $trackback_url);
- $result = DB_query ("SELECT cid,url,title,blog,excerpt,ipaddress,UNIX_TIMES
TAMP(date) AS day FROM {$_TABLES['trackback']} WHERE sid = '$sid' AND type = '$t
ype' ORDER BY date");
+ $result = DB_query ("SELECT cid,url,title,blog,excerpt,ipaddress,UNIX_TIMES
TAMP(date) AS day FROM {$_TABLES['trackback']} WHERE sid = '$sid' AND approve =
1 and type = '$type' ORDER BY date");
$numrows = DB_numRows ($result);
$template->set_var ('trackback_comment_count', $numrows);
@@ -646,7 +646,7 @@ function TRB_detectTrackbackUrl ($url)
$req =& new HTTP_Request ($url);
$req->setMethod (HTTP_REQUEST_METHOD_GET);
$response = $req->sendRequest ();
if (PEAR::isError ($response)) {
@@ -752,4 +752,26 @@ function TRB_sendNotificationEmail ($cid
COM_mail ($_CONF['site_mail'], $mailsubject, $mailbody);
}
+/**
+* Deletes a trackback comment and updates count in stories. Checks if the curre
nt user has proper
+* permissions first.
+*
+* @param int $id ID of the trackback comment to delete
+*
+*/
+function TRB_deleteModeration ($id)
+{
+ global $_TABLES;
+
+ $cid = addslashes ($id);
+ $result = DB_query ("SELECT sid,type FROM {$_TABLES['trackback']} WHERE cid
= '$cid'");
+ list ($sid, $type) = DB_fetchArray ($result);
+ if (TRB_allowDelete ($sid, $type)) {
+ TRB_deleteTrackbackComment ($id);
+ if ($type == 'article') {
+ DB_query ("UPDATE {$_TABLES['stories']} SET trackbacks = trackbacks
- 1 WHERE (sid = '$sid')");
+ }
+ }
+}
?>
Here is a diff patch of geeklog-1.4.0sr2 to /admin/moderation.php
Text Formatted Code
--- moderation.php 2006-03-05 03:19:17.000000000 -0600
+++ mod.php 2006-04-07 16:00:48.000000000 -0500
@@ -38,6 +38,8 @@
require_once ('auth.inc.php');
require_once ($_CONF['path_system'] . 'lib-user.php');
require_once ($_CONF['path_system'] . 'lib-story.php');
+require_once ($_CONF['path_system'] . 'lib-trackback.php');
// Uncomment the line below if you need to debug the HTTP variables being passe
d
// to the script. This will sometimes cause errors but it will allow you to se
e
@@ -79,7 +81,6 @@ function commandcontrol()
global $_CONF, $_TABLES, $LANG01, $LANG29, $_IMAGE_TYPE;
$retval = '';
-
$admin_templates = new Template($_CONF['path_layout'] . 'admin/moderation')
;
$admin_templates->set_file (array ('cc' => 'moderation.thtml',
'ccrow' => 'ccrow.thtml',
@@ -215,12 +216,60 @@ function commandcontrol()
$retval .= userlist ();
}
}
-
+ if ($_CONF['trackback_enabled']) {
+ $retval .= PendingTrackBacks();
+ }
$retval .= PLG_showModerationList();
return $retval;
}
+function PendingTrackBacks()
+{
+ global $_CONF, $_TABLES, $LANG24, $LANG29, $LANG_ADMIN;
+ $retval = '';
+
+ $result = DB_query ("SELECT cid AS id,date,url,ipaddress,title,blog,excerpt
FROM {$_TABLES['trackback']} WHERE (approve = 0)" . COM_getTopicSQL ('AND') . C
OM_getPermSQL ('AND', 0, 3) . " ORDER BY date ASC");
+ $nrows = DB_numRows($result);
+ $data_arr = array();
+
+ for ($i = 0; $i < $nrows; $i++) {
+ $A = DB_fetchArray($result);
+ $A['row'] = $i;
+ $A['title'] = stripslashes($A['title']);
+ $data_arr[$i] = $A;
+ }
+
+ $header_arr = array(
+ array('text' => "Date", 'field' => 'date'),
+ array('text' => "URL", 'field' => 'url'),
+ array('text' => "IP Address", 'field' => 'ipaddress'),
+ array('text' => "Title", 'field' => 'title'),
+ array('text' => "Blog", 'field' => 'blog'),
+ array('text' => "Excerpt", 'field' => 'excerpt'),
+ array('text' => $LANG29[2], 'field' => 'delete'),
+ array('text' => $LANG29[1], 'field' => 'approve'));
+
+ $text_arr = array('has_menu' => false,
+ 'title' => "TrackBack Submissions",
+ 'help_url' => '',
+ 'no_data' => $LANG29[39]);
+
+ $table = ADMIN_simpleList("ADMIN_getListField_moderation", $header_arr, $te
xt_arr, $data_arr, array());
+ if ($nrows > 0) {
+ $retval .= "nn<form action="{$_CONF['site_admin_url']}/moderation.ph
p" method="POST">"
+ .'<input type="hidden" name="count" value="' . $
nrows . '">'
+ .'<input type="hidden" name="type" value="trackb
ack">'
+ .'<input type="hidden" name="mode" value="moderation">'
+ .$table
+ .'<center><input type="submit" value="' . $LANG_ADMIN['subm it'] . '"></center></form>' . LB;
+ } else {
+ $retval .= $table;
+ }
+
+ return $retval;
+}
+
/**
* Diplays items needing moderation
*
@@ -460,6 +509,11 @@ function moderation ($mid, $action, $typ
$submissiontable = $_TABLES['eventsubmission'];
$fields = 'eid,title,description,location,address1,address2,city,state,
zipcode,datestart,timestart,dateend,timeend,url';
break;
+ case 'trackback':
+ $id = 'sid';
+ $table = $_TABLES['trackback'];
+ $fields = 'date,url,ipaddress,title,blog,excerpt';
+ break;
case 'story':
$id = 'sid';
$table = $_TABLES['stories'];
@@ -478,7 +532,7 @@ function moderation ($mid, $action, $typ
for ($i = 0; $i < $count; $i++) {
switch ($action[$i]) {
case 'delete':
- if (!empty ($type) && ($type <> 'story') && ($type <> 'draft')) {
+ if (!empty ($type) && ($type <> 'story') && ($type <> 'draft') && (
$type <> 'trackback') ) {
// There may be some plugin specific processing that needs to
// happen first.
$retval .= PLG_deleteSubmission($type, $mid[$i]);
@@ -487,9 +541,13 @@ function moderation ($mid, $action, $typ
$retval .= COM_errorLog("moderation.php just tried deleting eve
rything in table $submissiontable because it got an empty id. Please report thi
s immediately to your site administrator");
return $retval;
}
+ if ($type == 'trackback') {
+ TRB_deleteModeration ($mid[$i]);
+ }
if ($type == 'draft') {
STORY_deleteStory($mid[$i]);
- } else {
+ }
+ if ($type == 'story') {
DB_delete($submissiontable,"$id",$mid[$i]);
}
break;
@@ -528,6 +586,8 @@ function moderation ($mid, $action, $typ
COM_rdfUpToDateCheck ();
COM_olderStuff ();
+ } else if ($type == 'trackback') {
+ DB_query ("UPDATE {$_TABLES['trackback']} SET approve =
1 WHERE cid = '{$mid[$i]}'");
} else {
// This is called in case this is a plugin. There may be some
// plugin specific processing that needs to happen.
@@ -587,19 +647,17 @@ function moderateusers ($uid, $action, $
}
// MAIN
-
$display = '';
$display .= COM_siteHeader ('menu', $LANG29[34]);
if (isset ($_GET['msg'])) {
$display .= COM_showMessage ($_GET['msg']);
}
-
if (isset ($_POST['mode']) && ($_POST['mode'] == 'moderation')) {
if ($_POST['type'] == 'user') {
$display .= moderateusers ($_POST['id'], $_POST['action'],
COM_applyFilter ($_POST['count'], true));
} else {
- $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
+ $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
}
} else {
$display .= commandcontrol();
@@ -608,5 +666,4 @@ function moderateusers ($uid, $action, $
$display .= COM_siteFooter();
echo $display;
17
13
Quote
Status: offline
destr0yr
Forum User
Full Member
Registered: 07/06/02
Posts: 324
I'm having some issues applying the diffs. Specifically around line 28:
+++ mod.php 2006-04-07 16:00:48.000000000 -0500
@@ -38,6 +38,8 @@
require_once ('auth.inc.php');
require_once ($_CONF['path_system'] . 'lib-user.php');
require_once ($_CONF['path_system'] . 'lib-story.php');
+require_once ($_CONF['path_system'] . 'lib-trackback.php');
// Uncomment the line below if you need to debug the HTTP variables being passe
d
// to the script. This will sometimes cause errors but it will allow you to se
e
@@ -79,7 +81,6 @@ function commandcontrol()
global $_CONF, $_TABLES, $LANG01, $LANG29, $_IMAGE_TYPE;
$retval = '';
-
$admin_templates = new Template($_CONF['path_layout'] . 'admin/moderation')
;
$admin_templates->set_file (array ('cc' => 'moderation.thtml',
'ccrow' => 'ccrow.thtml',
@@ -215,12 +216,60 @@ function commandcontrol()
$retval .= userlist ();
}
}
-
+ if ($_CONF['trackback_enabled']) {
+ $retval .= PendingTrackBacks();
+ }
$retval .= PLG_showModerationList();
return $retval;
}
+function PendingTrackBacks()
+{
+ global $_CONF, $_TABLES, $LANG24, $LANG29, $LANG_ADMIN;
+ $retval = '';
+
+ $result = DB_query ("SELECT cid AS id,date,url,ipaddress,title,blog,excerpt
FROM {$_TABLES['trackback']} WHERE (approve = 0)" . COM_getTopicSQL ('AND') . C
OM_getPermSQL ('AND', 0, 3) . " ORDER BY date ASC");
+ $nrows = DB_numRows($result);
+ $data_arr = array();
+
+ for ($i = 0; $i < $nrows; $i++) {
+ $A = DB_fetchArray($result);
+ $A['row'] = $i;
+ $A['title'] = stripslashes($A['title']);
+ $data_arr[$i] = $A;
+ }
+
+ $header_arr = array(
+ array('text' => "Date", 'field' => 'date'),
+ array('text' => "URL", 'field' => 'url'),
+ array('text' => "IP Address", 'field' => 'ipaddress'),
+ array('text' => "Title", 'field' => 'title'),
+ array('text' => "Blog", 'field' => 'blog'),
+ array('text' => "Excerpt", 'field' => 'excerpt'),
+ array('text' => $LANG29[2], 'field' => 'delete'),
+ array('text' => $LANG29[1], 'field' => 'approve'));
+
+ $text_arr = array('has_menu' => false,
+ 'title' => "TrackBack Submissions",
+ 'help_url' => '',
+ 'no_data' => $LANG29[39]);
+
+ $table = ADMIN_simpleList("ADMIN_getListField_moderation", $header_arr, $te
xt_arr, $data_arr, array());
+ if ($nrows > 0) {
+ $retval .= "nn<form action="{$_CONF['site_admin_url']}/moderation.ph
p" method="POST">"
+ .'<input type="hidden" name="count" value="' . $
nrows . '">'
+ .'<input type="hidden" name="type" value="trackb
ack">'
+ .'<input type="hidden" name="mode" value="moderation">'
+ .$table
+ .'<center><input type="submit" value="' . $LANG_ADMIN['subm it'] . '"></center></form>' . LB;
+ } else {
+ $retval .= $table;
+ }
+
+ return $retval;
+}
+
/**
* Diplays items needing moderation
*
@@ -460,6 +509,11 @@ function moderation ($mid, $action, $typ
$submissiontable = $_TABLES['eventsubmission'];
$fields = 'eid,title,description,location,address1,address2,city,state,
zipcode,datestart,timestart,dateend,timeend,url';
break;
+ case 'trackback':
+ $id = 'sid';
+ $table = $_TABLES['trackback'];
+ $fields = 'date,url,ipaddress,title,blog,excerpt';
+ break;
case 'story':
$id = 'sid';
$table = $_TABLES['stories'];
@@ -478,7 +532,7 @@ function moderation ($mid, $action, $typ
for ($i = 0; $i < $count; $i++) {
switch ($action[$i]) {
case 'delete':
- if (!empty ($type) && ($type <> 'story') && ($type <> 'draft')) {
+ if (!empty ($type) && ($type <> 'story') && ($type <> 'draft') && (
$type <> 'trackback') ) {
// There may be some plugin specific processing that needs to
// happen first.
$retval .= PLG_deleteSubmission($type, $mid[$i]);
@@ -487,9 +541,13 @@ function moderation ($mid, $action, $typ
$retval .= COM_errorLog("moderation.php just tried deleting eve
rything in table $submissiontable because it got an empty id. Please report thi
s immediately to your site administrator");
return $retval;
}
+ if ($type == 'trackback') {
+ TRB_deleteModeration ($mid[$i]);
+ }
if ($type == 'draft') {
STORY_deleteStory($mid[$i]);
- } else {
+ }
+ if ($type == 'story') {
DB_delete($submissiontable,"$id",$mid[$i]);
}
break;
@@ -528,6 +586,8 @@ function moderation ($mid, $action, $typ
COM_rdfUpToDateCheck ();
COM_olderStuff ();
+ } else if ($type == 'trackback') {
+ DB_query ("UPDATE {$_TABLES['trackback']} SET approve =
1 WHERE cid = '{$mid[$i]}'");
} else {
// This is called in case this is a plugin. There may be some
// plugin specific processing that needs to happen.
@@ -587,19 +647,17 @@ function moderateusers ($uid, $action, $
}
// MAIN
-
$display = '';
$display .= COM_siteHeader ('menu', $LANG29[34]);
if (isset ($_GET['msg'])) {
$display .= COM_showMessage ($_GET['msg']);
}
-
if (isset ($_POST['mode']) && ($_POST['mode'] == 'moderation')) {
if ($_POST['type'] == 'user') {
$display .= moderateusers ($_POST['id'], $_POST['action'],
COM_applyFilter ($_POST['count'], true));
} else {
- $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
+ $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
}
} else {
$display .= commandcontrol();
@@ -608,5 +666,4 @@ function moderateusers ($uid, $action, $
$display .= COM_siteFooter();
echo $display;
Would it be possible to post/upload the phps' (for both files)?
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
Text Formatted Code
moderation.php 2006-03-05 03:19:17.000000000 -0600+++ mod.php 2006-04-07 16:00:48.000000000 -0500
@@ -38,6 +38,8 @@
require_once ('auth.inc.php');
require_once ($_CONF['path_system'] . 'lib-user.php');
require_once ($_CONF['path_system'] . 'lib-story.php');
+require_once ($_CONF['path_system'] . 'lib-trackback.php');
// Uncomment the line below if you need to debug the HTTP variables being passe
d
// to the script. This will sometimes cause errors but it will allow you to se
e
@@ -79,7 +81,6 @@ function commandcontrol()
global $_CONF, $_TABLES, $LANG01, $LANG29, $_IMAGE_TYPE;
$retval = '';
-
$admin_templates = new Template($_CONF['path_layout'] . 'admin/moderation')
;
$admin_templates->set_file (array ('cc' => 'moderation.thtml',
'ccrow' => 'ccrow.thtml',
@@ -215,12 +216,60 @@ function commandcontrol()
$retval .= userlist ();
}
}
-
+ if ($_CONF['trackback_enabled']) {
+ $retval .= PendingTrackBacks();
+ }
$retval .= PLG_showModerationList();
return $retval;
}
+function PendingTrackBacks()
+{
+ global $_CONF, $_TABLES, $LANG24, $LANG29, $LANG_ADMIN;
+ $retval = '';
+
+ $result = DB_query ("SELECT cid AS id,date,url,ipaddress,title,blog,excerpt
FROM {$_TABLES['trackback']} WHERE (approve = 0)" . COM_getTopicSQL ('AND') . C
OM_getPermSQL ('AND', 0, 3) . " ORDER BY date ASC");
+ $nrows = DB_numRows($result);
+ $data_arr = array();
+
+ for ($i = 0; $i < $nrows; $i++) {
+ $A = DB_fetchArray($result);
+ $A['row'] = $i;
+ $A['title'] = stripslashes($A['title']);
+ $data_arr[$i] = $A;
+ }
+
+ $header_arr = array(
+ array('text' => "Date", 'field' => 'date'),
+ array('text' => "URL", 'field' => 'url'),
+ array('text' => "IP Address", 'field' => 'ipaddress'),
+ array('text' => "Title", 'field' => 'title'),
+ array('text' => "Blog", 'field' => 'blog'),
+ array('text' => "Excerpt", 'field' => 'excerpt'),
+ array('text' => $LANG29[2], 'field' => 'delete'),
+ array('text' => $LANG29[1], 'field' => 'approve'));
+
+ $text_arr = array('has_menu' => false,
+ 'title' => "TrackBack Submissions",
+ 'help_url' => '',
+ 'no_data' => $LANG29[39]);
+
+ $table = ADMIN_simpleList("ADMIN_getListField_moderation", $header_arr, $te
xt_arr, $data_arr, array());
+ if ($nrows > 0) {
+ $retval .= "nn<form action="{$_CONF['site_admin_url']}/moderation.ph
p" method="POST">"
+ .'<input type="hidden" name="count" value="' . $
nrows . '">'
+ .'<input type="hidden" name="type" value="trackb
ack">'
+ .'<input type="hidden" name="mode" value="moderation">'
+ .$table
+ .'<center><input type="submit" value="' . $LANG_ADMIN['subm it'] . '"></center></form>' . LB;
+ } else {
+ $retval .= $table;
+ }
+
+ return $retval;
+}
+
/**
* Diplays items needing moderation
*
@@ -460,6 +509,11 @@ function moderation ($mid, $action, $typ
$submissiontable = $_TABLES['eventsubmission'];
$fields = 'eid,title,description,location,address1,address2,city,state,
zipcode,datestart,timestart,dateend,timeend,url';
break;
+ case 'trackback':
+ $id = 'sid';
+ $table = $_TABLES['trackback'];
+ $fields = 'date,url,ipaddress,title,blog,excerpt';
+ break;
case 'story':
$id = 'sid';
$table = $_TABLES['stories'];
@@ -478,7 +532,7 @@ function moderation ($mid, $action, $typ
for ($i = 0; $i < $count; $i++) {
switch ($action[$i]) {
case 'delete':
- if (!empty ($type) && ($type <> 'story') && ($type <> 'draft')) {
+ if (!empty ($type) && ($type <> 'story') && ($type <> 'draft') && (
$type <> 'trackback') ) {
// There may be some plugin specific processing that needs to
// happen first.
$retval .= PLG_deleteSubmission($type, $mid[$i]);
@@ -487,9 +541,13 @@ function moderation ($mid, $action, $typ
$retval .= COM_errorLog("moderation.php just tried deleting eve
rything in table $submissiontable because it got an empty id. Please report thi
s immediately to your site administrator");
return $retval;
}
+ if ($type == 'trackback') {
+ TRB_deleteModeration ($mid[$i]);
+ }
if ($type == 'draft') {
STORY_deleteStory($mid[$i]);
- } else {
+ }
+ if ($type == 'story') {
DB_delete($submissiontable,"$id",$mid[$i]);
}
break;
@@ -528,6 +586,8 @@ function moderation ($mid, $action, $typ
COM_rdfUpToDateCheck ();
COM_olderStuff ();
+ } else if ($type == 'trackback') {
+ DB_query ("UPDATE {$_TABLES['trackback']} SET approve =
1 WHERE cid = '{$mid[$i]}'");
} else {
// This is called in case this is a plugin. There may be some
// plugin specific processing that needs to happen.
@@ -587,19 +647,17 @@ function moderateusers ($uid, $action, $
}
// MAIN
-
$display = '';
$display .= COM_siteHeader ('menu', $LANG29[34]);
if (isset ($_GET['msg'])) {
$display .= COM_showMessage ($_GET['msg']);
}
-
if (isset ($_POST['mode']) && ($_POST['mode'] == 'moderation')) {
if ($_POST['type'] == 'user') {
$display .= moderateusers ($_POST['id'], $_POST['action'],
COM_applyFilter ($_POST['count'], true));
} else {
- $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
+ $display .= moderation ($_POST['id'], $_POST['action'], $_POST['type'],
COM_applyFilter ($_POST['count'], true));
}
} else {
$display .= commandcontrol();
@@ -608,5 +666,4 @@ function moderateusers ($uid, $action, $
$display .= COM_siteFooter();
echo $display;
Would it be possible to post/upload the phps' (for both files)?
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
15
19
Quote
Status: offline
ByteEnable
Forum User
Full Member
Registered: 10/20/03
Posts: 138
Yeah, you can download a zip here:
http://www.linuxelectrons.com/files/trbmod.zip
Byte
P.S. - These files are not standard Geeklog files, they are custom specifically for LinuxElectrons and you may get unexpected results if you just copy over your Geeklog install.
http://www.linuxelectrons.com/files/trbmod.zip
Byte
P.S. - These files are not standard Geeklog files, they are custom specifically for LinuxElectrons and you may get unexpected results if you just copy over your Geeklog install.
11
18
Quote
Status: offline
destr0yr
Forum User
Full Member
Registered: 07/06/02
Posts: 324
Quote by ByteEnable: Yeah, you can download a zip here:
http://www.linuxelectrons.com/files/trbmod.zip
Byte
P.S. - These files are not standard Geeklog files, they are custom specifically for LinuxElectrons and you may get unexpected results if you just copy over your Geeklog install.
http://www.linuxelectrons.com/files/trbmod.zip
Byte
P.S. - These files are not standard Geeklog files, they are custom specifically for LinuxElectrons and you may get unexpected results if you just copy over your Geeklog install.
I'll break out the duct tape and scissors. Thanks.
Is it just me, or is everybody having this issue? I just received 21 new spam related trackbacks. My IP deny and word-filter list is growing quite rapdily...
-- destr0yr
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams
18
16
Quote
andyofne
Anonymous
It's not just you. I've been getting several bogus ad related track backs lately.
14
13
Quote
All times are EST. The time is now 12:57 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content