[geeklog-cvs] geeklog-1.3/public_html comment.php,1.60,1.61 lib-common.php,1.323,1.324
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Sat May 15 14:41:34 EDT 2004
- Previous message (by thread): [geeklog-cvs] geeklog-1.3/public_html/layout/Yahoo/comment reportcomment.thtml,NONE,1.1
- Next message (by thread): [geeklog-cvs] geeklog-1.3/language english.php,1.114,1.115 english_utf-8.php,1.3,1.4 german.php,1.99,1.100 german_formal.php,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv6182/public_html
Modified Files:
comment.php lib-common.php
Log Message:
Registered users can now report abusive comment posts to the site admin.
Index: comment.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/comment.php,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** comment.php 9 May 2004 11:27:07 -0000 1.60
--- comment.php 15 May 2004 18:41:32 -0000 1.61
***************
*** 370,374 ****
$author = DB_getItem ($_TABLES['users'], 'username', "uid = $uid");
! if ($uid <= 1) {
// add IP address for anonymous posters
$author .= ' (' . $ipaddress . ')';
--- 370,374 ----
$author = DB_getItem ($_TABLES['users'], 'username', "uid = $uid");
! if (($uid <= 1) && !empty ($ipaddress)) {
// add IP address for anonymous posters
$author .= ' (' . $ipaddress . ')';
***************
*** 387,391 ****
. '...';
}
! $mailbody .= $comment .= "\n\n";
}
--- 387,391 ----
. '...';
}
! $mailbody .= $comment . "\n\n";
}
***************
*** 486,489 ****
--- 486,639 ----
}
+ function report_abusive_comment ($cid, $type)
+ {
+ global $_CONF, $_TABLES, $_USER, $LANG03, $LANG12, $LANG_LOGIN;
+
+ $retval = '';
+
+ if (empty ($_USER['username'])) {
+ $retval .= COM_startBlock ($LANG_LOGIN[1], '',
+ COM_getBlockTemplate ('_msg_block', 'header'));
+ $loginreq = new Template ($_CONF['path_layout'] . 'submit');
+ $loginreq->set_file ('loginreq', 'submitloginrequired.thtml');
+ $loginreq->set_var ('login_message', $LANG_LOGIN[2]);
+ $loginreq->set_var ('site_url', $_CONF['site_url']);
+ $loginreq->set_var ('lang_login', $LANG_LOGIN[3]);
+ $loginreq->set_var ('lang_newuser', $LANG_LOGIN[4]);
+ $loginreq->parse ('errormsg', 'loginreq');
+ $retval .= $loginreq->finish ($loginreq->get_var ('errormsg'));
+ $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+
+ return $retval;
+ }
+
+ COM_clearSpeedlimit ($_CONF['speedlimit'], 'mail');
+ $last = COM_checkSpeedlimit ('mail');
+ if ($last > 0) {
+ $retval .= COM_startBlock ($LANG12[26], '',
+ COM_getBlockTemplate ('_msg_block', 'header'))
+ . $LANG12[30] . $last . $LANG12[31]
+ . COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+
+ return $retval;
+ }
+
+ $start = new Template ($_CONF['path_layout'] . 'comment');
+ $start->set_file (array ('report' => 'reportcomment.thtml'));
+ $start->set_var ('site_url', $_CONF['site_url']);
+ $start->set_var ('layout_url', $_CONF['layout_url']);
+ $start->set_var ('lang_report_this', $LANG03[25]);
+ $start->set_var ('lang_send_report', $LANG03[10]);
+ $start->set_var ('cid', $cid);
+ $start->set_var ('type', $type);
+
+ $result = DB_query ("SELECT uid,sid,pid,title,comment,UNIX_TIMESTAMP(date) AS nice_date FROM {$_TABLES['comments']} WHERE cid = $cid AND type = '$type'");
+ $A = DB_fetchArray ($result);
+
+ $result = DB_query ("SELECT username,fullname,photo FROM {$_TABLES['users']} WHERE uid = {$A['uid']}");
+ $B = DB_fetchArray ($result);
+
+ // prepare data for comment preview
+ $A['cid'] = $cid;
+ $A['type'] = $type;
+ $A['username'] = $B['username'];
+ $A['fullname'] = $B['fullname'];
+ $A['photo'] = $B['photo'];
+ $A['indent'] = 0;
+ $A['pindent'] = 0;
+
+ $thecomment = COM_getComment ($A, 'flat', $type, 'ASC', false, true);
+ $start->set_var ('comment', $thecomment);
+ $retval .= COM_startBlock ($LANG03[15])
+ . $start->finish ($start->parse ('output', 'report'))
+ . COM_endBlock ();
+
+ return $retval;
+ }
+
+ function send_report ($cid, $type)
+ {
+ global $_CONF, $_TABLES, $_USER, $LANG03, $LANG08, $LANG_LOGIN;
+
+ if (empty ($_USER['username'])) {
+ $retval = COM_siteHeader ('menu');
+ $retval .= COM_startBlock ($LANG_LOGIN[1], '',
+ COM_getBlockTemplate ('_msg_block', 'header'));
+ $loginreq = new Template ($_CONF['path_layout'] . 'submit');
+ $loginreq->set_file ('loginreq', 'submitloginrequired.thtml');
+ $loginreq->set_var ('login_message', $LANG_LOGIN[2]);
+ $loginreq->set_var ('site_url', $_CONF['site_url']);
+ $loginreq->set_var ('lang_login', $LANG_LOGIN[3]);
+ $loginreq->set_var ('lang_newuser', $LANG_LOGIN[4]);
+ $loginreq->parse ('errormsg', 'loginreq');
+ $retval .= $loginreq->finish ($loginreq->get_var ('errormsg'));
+ $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+ $retval .= COM_siteFooter ();
+
+ return $retval;
+ }
+
+ COM_clearSpeedlimit ($_CONF['speedlimit'], 'mail');
+ if (COM_checkSpeedlimit ('mail') > 0) {
+ return COM_refresh ($_CONF['site_url'] . '/index.php');
+ }
+
+ $username = DB_getItem ($_TABLES['users'], 'username',
+ "uid = {$_USER['uid']}");
+ $result = DB_query ("SELECT uid,title,comment,sid,ipaddress FROM {$_TABLES['comments']} WHERE cid = $cid AND type = '$type'");
+ $A = DB_fetchArray ($result);
+
+ $title = stripslashes ($A['title']);
+ $comment = stripslashes ($A['comment']);
+
+ // strip HTML if posted in HTML mode
+ if (preg_match ('/<.*>/', $comment) != 0) {
+ $comment = strip_tags ($comment);
+ }
+
+ $author = DB_getItem ($_TABLES['users'], 'username', "uid = {$A['uid']}");
+ if (($A['uid'] <= 1) && !empty ($A['ipaddress'])) {
+ // add IP address for anonymous posters
+ $author .= ' (' . $A['ipaddress'] . ')';
+ }
+
+ $mailbody = sprintf ($LANG03[26], $username);
+ $mailbody .= "\n\n"
+ . "$LANG03[16]: $title\n"
+ . "$LANG03[5]: $author\n";
+
+ if (($type != 'article') && ($type != 'poll')) {
+ $mailbody .= "$LANG09[5]: $type\n";
+ }
+
+ if ($_CONF['emailstorieslength'] > 0) {
+ if ($_CONF['emailstorieslength'] > 1) {
+ $comment = substr ($comment, 0, $_CONF['emailstorieslength'])
+ . '...';
+ }
+ $mailbody .= $comment . "\n\n";
+ }
+
+ if ($type == 'article') {
+ $mailbody .= $LANG08[33] . ' <' . $_CONF['site_url']
+ . '/article.php?story=' . $A['sid'] . "#comments>\n\n";
+ } else if ($type == 'poll') {
+ $mailbody .= $LANG08[33] . ' <' . $_CONF['site_url']
+ . '/pollbooth.php?qid=' . $A['sid'] . "&aid=-1>\n\n";
+ }
+
+ $mailbody .= "\n------------------------------\n";
+ $mailbody .= "\n$LANG08[34]\n";
+ $mailbody .= "\n------------------------------\n";
+
+ $mailsubject = $_CONF['site_name'] . ' ' . $LANG03[27];
+
+ COM_mail ($_CONF['site_mail'], $mailsubject, $mailbody);
+ COM_updateSpeedlimit ('mail');
+
+ return COM_refresh ($_CONF['site_url'] . '/index.php?msg=27');
+ }
+
+
// MAIN
switch ($mode) {
***************
*** 543,546 ****
--- 693,706 ----
}
break;
+ case 'report':
+ $display = COM_siteHeader ('menu')
+ . report_abusive_comment (COM_applyFilter ($HTTP_GET_VARS['cid']),
+ COM_applyFilter ($HTTP_GET_VARS['type']))
+ . COM_siteFooter ();
+ break;
+ case 'sendreport':
+ $display = send_report (COM_applyFilter ($HTTP_POST_VARS['cid']),
+ COM_applyFilter ($HTTP_POST_VARS['type']));
+ break;
default:
if (isset ($HTTP_POST_VARS['sid'])) {
Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.323
retrieving revision 1.324
diff -C2 -d -r1.323 -r1.324
*** lib-common.php 15 May 2004 16:11:26 -0000 1.323
--- lib-common.php 15 May 2004 18:41:32 -0000 1.324
***************
*** 2861,2864 ****
--- 2861,2872 ----
$template->set_var( 'delete_option', $deloption );
}
+ else if( !empty( $_USER['username'] ))
+ {
+ $reportthis = ' | <a href="' . $_CONF['site_url']
+ . '/comment.php?mode=report&cid=' . $A['cid']
+ . '&type=' . $type . '" title="' . $LANG01[110]
+ . '">' . $LANG01[109] . '</a> ';
+ $template->set_var( 'delete_option', $reportthis );
+ }
else
{
- Previous message (by thread): [geeklog-cvs] geeklog-1.3/public_html/layout/Yahoo/comment reportcomment.thtml,NONE,1.1
- Next message (by thread): [geeklog-cvs] geeklog-1.3/language english.php,1.114,1.115 english_utf-8.php,1.3,1.4 german.php,1.99,1.100 german_formal.php,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the geeklog-cvs
mailing list