[geeklog-cvs] geeklog-1.3/public_html comment.php,1.42,1.43

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Sun May 11 14:28:57 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory internal.geeklog.net:/tmp/cvs-serv7071/public_html

Modified Files:
	comment.php 
Log Message:
Plugins will have to handle comments themselves (mostly) from now on.


Index: comment.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/comment.php,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** comment.php	5 May 2003 16:53:37 -0000	1.42
--- comment.php	11 May 2003 18:28:55 -0000	1.43
***************
*** 254,272 ****
      $title = addslashes(strip_tags(COM_checkWords($title)));
  
!     if (!empty($title) && !empty($comment)) {
          COM_updateSpeedlimit ('comment');
!         DB_save($_TABLES['comments'],'sid,uid,comment,date,title,pid,type',"'$sid',$uid,'$comment',now(),'$title',$pid,'$type'");
! 
!         // See if plugin will handle this to update it's records
!         PLG_handlePluginComment($type,$sid,'save');
! 
!         // If we reach here then no plugin issued a COM_refresh() so continue
  
          if ($type == 'poll') {
!             $retval .= COM_refresh("{$_CONF['site_url']}/pollbooth.php?qid=$sid&aid=-1");
!         } else {
!             $comments = DB_count($_TABLES['comments'],'sid',$sid);
              DB_change($_TABLES['stories'],'comments',$comments,'sid',$sid);
!             $retval .= COM_refresh("{$_CONF['site_url']}/article.php?story=$sid");
          }
      } else {
--- 254,276 ----
      $title = addslashes(strip_tags(COM_checkWords($title)));
  
!     if (!empty ($title) && !empty ($comment)) {
          COM_updateSpeedlimit ('comment');
!         DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,type',
!                 "'$sid',$uid,'$comment',now(),'$title',$pid,'$type'");
  
          if ($type == 'poll') {
!             $retval = COM_refresh ($_CONF['site_url']
!                     . "/pollbooth.php?qid=$sid&aid=-1");
!         } elseif ($type == 'article') {
!             $comments = DB_count ($_TABLES['comments'], 'sid', $sid);
              DB_change($_TABLES['stories'],'comments',$comments,'sid',$sid);
!             $retval = COM_refresh ($_CONF['site_url']
!                     . "/article.php?story=$sid");
!         } else { // assume it's a comment handled by a plugin
!             $cid = DB_getItem ($_TABLES['comments'], 'cid', "(type = '$type') AND (pid = '$pid') AND (sid = '$sid') AND (uid = '$uid')");
!             $retval = PLG_handlePluginComment ($type, $cid, 'save');
!             if (empty ($retval)) {
!                 $retval = COM_refresh ($_CONF['site_url'] . '/index.php');
!             }
          }
      } else {
***************
*** 296,324 ****
  
      if (!empty ($sid) && !empty ($cid) && is_numeric ($cid)) {
-         $result = DB_query ("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['stories']} WHERE sid = '{$sid}'");
-         $A = DB_fetchArray ($result);
-         if (SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3) {
-             $pid = DB_getItem ($_TABLES['comments'], 'pid', "cid = '$cid'");
  
!             DB_change ($_TABLES['comments'], 'pid', $pid, 'pid', $cid);
!             DB_delete ($_TABLES['comments'], 'cid', $cid);
  
!             // See if plugin will handle this to update it's records
!             PLG_handlePluginComment($type,$sid,'delete');
  
!             if ($type == 'poll') {
!                 $retval .= COM_refresh ($_CONF['site_url']
!                         . '/pollbooth.php?qid=$sid&aid=-1');
              } else {
!                 $comments = DB_count($_TABLES['comments'],'sid',$sid);
!                 DB_change($_TABLES['stories'],'comments',$comments,'sid',$sid);
!                 $retval .= COM_refresh ($_CONF['site_url']
!                         . '/article.php?story=$sid');
              }
          } else {
!             COM_errorLog ('User ' . $_USER['username'] . ' (IP: ' . $REMOTE_ADDR
!                     . ') tried to illegally delete comment ' . $cid
!                     . ' from ' . $type . ' ' . $sid);
!             $retval .= COM_refresh ($_CONF['site_url'] . '/index.php');
          }
      } else {
--- 300,345 ----
  
      if (!empty ($sid) && !empty ($cid) && is_numeric ($cid)) {
  
!         // only comments of type 'article' and 'poll' are handled by Geeklog
!         if (($type == 'article') || ($type == 'poll')) {
  
!             if ($type == 'article') {
!                 $table = $_TABLES['stories'];
!                 $idname = 'sid';
!             } else {
!                 $table = $_TABLES['pollquestions'];
!                 $idname = 'qid';
!             }
!             $result = DB_query ("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$table} WHERE {$idname} = '{$sid}'");
!             $A = DB_fetchArray ($result);
!             if (SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'],
!                 $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3) {
!                 $pid = DB_getItem ($_TABLES['comments'], 'pid', "cid = '$cid'");
  
!                 DB_change ($_TABLES['comments'], 'pid', $pid, 'pid', $cid);
!                 DB_delete ($_TABLES['comments'], 'cid', $cid);
! 
!                 if ($type == 'poll') {
!                     $retval .= COM_refresh ($_CONF['site_url']
!                             . '/pollbooth.php?qid=' . $sid . '&aid=-1');
!                 } else {
!                     $comments = DB_count ($_TABLES['comments'], 'sid', $sid);
!                     DB_change ($_TABLES['stories'], 'comments', $comments,
!                                'sid', $sid);
!                     $retval .= COM_refresh ($_CONF['site_url']
!                             . '/article.php?story=' . $sid);
!                 }
              } else {
!                 COM_errorLog ('User ' . $_USER['username'] . ' (IP: '
!                         . $REMOTE_ADDR . ') tried to illegally delete comment '
!                         . $cid . ' from ' . $type . ' ' . $sid);
!                 $retval .= COM_refresh ($_CONF['site_url'] . '/index.php');
              }
          } else {
!             // See if plugin will handle this
!             $retval = PLG_handlePluginComment ($type, $cid, 'delete');
!             if (empty ($retval)) {
!                 $retval = COM_refresh ($_CONF['site_url'] . '/index.php');
!             }
          }
      } else {
***************
*** 351,355 ****
      if (!empty($sid)) {
          if (empty ($title)) {
!             $title = DB_getItem ($_TABLES['stories'], 'title', "sid = '{$sid}'");
              $title = str_replace ('$', '$', $title);
          }
--- 372,382 ----
      if (!empty($sid)) {
          if (empty ($title)) {
!             if ($type == 'article') {
!                 $title = DB_getItem ($_TABLES['stories'], 'title',
!                                      "sid = '{$sid}'");
!             } elseif ($type == 'poll') {
!                 $title = DB_getItem ($_TABLES['pollquestions'], 'question',
!                                      "qid = '{$sid}'");
!             }
              $title = str_replace ('$', '$', $title);
          }





More information about the geeklog-cvs mailing list