[geeklog-cvs] geeklog-1.3/public_html comment.php,1.72,1.73 lib-common.php,1.359,1.360 pollbooth.php,1.29,1.30 users.php,1.84,1.85

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Sun Aug 15 08:06:12 EDT 2004


Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv19064/public_html

Modified Files:
	comment.php lib-common.php pollbooth.php users.php 
Log Message:
Replaced $REMOTE_ADDR with $HTTP_SERVER_VARS['REMOTE_ADDR']


Index: comment.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/comment.php,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** comment.php	9 Aug 2004 18:36:29 -0000	1.72
--- comment.php	15 Aug 2004 12:06:05 -0000	1.73
***************
*** 246,250 ****
  function savecomment ($uid, $title, $comment, $sid, $pid, $type, $postmode) 
  {
!     global $_CONF, $_TABLES, $_USER, $LANG03, $REMOTE_ADDR;
  
      $retval = '';
--- 246,250 ----
  function savecomment ($uid, $title, $comment, $sid, $pid, $type, $postmode) 
  {
!     global $_CONF, $_TABLES, $_USER, $LANG03, $HTTP_SERVER_VARS;
  
      $retval = '';
***************
*** 276,279 ****
--- 276,291 ----
      }
  
+     $commentcode = 0;
+     if ($type == 'article') {
+         $commentcode = DB_getItem ($_TABLES['stories'], 'commentcode',
+                                    "sid = '$sid'");
+     } else if ($type == 'poll') {
+         $commentcode = DB_getItem ($_TABLES['pollquestions'], 'commentcode',
+                                    "qid = '$sid'");
+     }
+     if ($commentcode < 0) {
+         return COM_refresh ($_CONF['site_url'] . '/index.php');
+     }
+ 
      // Clean 'em up a bit!
      if ($postmode == 'html') {
***************
*** 319,327 ****
                     . "WHERE sid = '$sid' AND rht >= $rht");
              DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress',
!                     "'$sid',$uid,'$comment',now(),'$title',$pid,$rht,$rht+1,$indent+1,'$type','$REMOTE_ADDR'");
          } else {
              $rht = DB_getItem($_TABLES['comments'], 'MAX(rht)');
              DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress',
!                     "'$sid',$uid,'$comment',now(),'$title',$pid,$rht+1,$rht+2,0,'$type','$REMOTE_ADDR'");
          }
          DB_query('UNLOCK TABLES');
--- 331,339 ----
                     . "WHERE sid = '$sid' AND rht >= $rht");
              DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress',
!                     "'$sid',$uid,'$comment',now(),'$title',$pid,$rht,$rht+1,$indent+1,'$type','{$HTTP_SERVER_VARS['REMOTE_ADDR']}'");
          } else {
              $rht = DB_getItem($_TABLES['comments'], 'MAX(rht)');
              DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress',
!                     "'$sid',$uid,'$comment',now(),'$title',$pid,$rht+1,$rht+2,0,'$type','{$HTTP_SERVER_VARS['REMOTE_ADDR']}'");
          }
          DB_query('UNLOCK TABLES');
***************
*** 330,334 ****
                  in_array ('comment', $_CONF['notification'])) {
              $cid = DB_insertId();
!             sendNotification ($title, $comment, $uid, $REMOTE_ADDR, $type, $cid);
          }
  
--- 342,347 ----
                  in_array ('comment', $_CONF['notification'])) {
              $cid = DB_insertId();
!             sendNotification ($title, $comment, $uid,
!                               $HTTP_SERVER_VARS['REMOTE_ADDR'], $type, $cid);
          }
  
***************
*** 426,430 ****
  function deletecomment ($cid, $sid, $type) 
  {
!     global $_CONF, $_TABLES, $_USER, $REMOTE_ADDR;
  
      $retval = '';
--- 439,443 ----
  function deletecomment ($cid, $sid, $type) 
  {
!     global $_CONF, $_TABLES, $_USER, $HTTP_SERVER_VARS;
  
      $retval = '';
***************
*** 476,480 ****
              } 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');
--- 489,494 ----
              } else {
                  COM_errorLog ('User ' . $_USER['username'] . ' (IP: '
!                         . $HTTP_SERVER_VARS['REMOTE_ADDR']
!                         . ') tried to illegally delete comment '
                          . $cid . ' from ' . $type . ' ' . $sid);
                  $retval .= COM_refresh ($_CONF['site_url'] . '/index.php');

Index: users.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/users.php,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -d -r1.84 -r1.85
*** users.php	14 Aug 2004 15:52:17 -0000	1.84
--- users.php	15 Aug 2004 12:06:07 -0000	1.85
***************
*** 840,844 ****
          $userdata = SESS_getUserData($loginname);
          $_USER=$userdata;
!         $sessid = SESS_newSession($_USER['uid'], $REMOTE_ADDR, $_CONF['session_cookie_timeout'], $_CONF['cookie_ip']);
          SESS_setSessionCookie($sessid, $_CONF['session_cookie_timeout'], $_CONF['cookie_session'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']);
  
--- 840,844 ----
          $userdata = SESS_getUserData($loginname);
          $_USER=$userdata;
!         $sessid = SESS_newSession($_USER['uid'], $HTTP_SERVER_VARS['REMOTE_ADDR'], $_CONF['session_cookie_timeout'], $_CONF['cookie_ip']);
          SESS_setSessionCookie($sessid, $_CONF['session_cookie_timeout'], $_CONF['cookie_session'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']);
  

Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.359
retrieving revision 1.360
diff -C2 -d -r1.359 -r1.360
*** lib-common.php	13 Aug 2004 15:41:58 -0000	1.359
--- lib-common.php	15 Aug 2004 12:06:06 -0000	1.360
***************
*** 305,309 ****
  {
      // The following code handles anonymous users so they show up properly
!     DB_query( "DELETE FROM {$_TABLES['sessions']} WHERE remote_ip = '$REMOTE_ADDR' AND uid = 1" );
  
      $tries = 0;
--- 305,309 ----
  {
      // The following code handles anonymous users so they show up properly
!     DB_query( "DELETE FROM {$_TABLES['sessions']} WHERE remote_ip = '{$HTTP_SERVER_VARS['REMOTE_ADDR']}' AND uid = 1" );
  
      $tries = 0;
***************
*** 316,320 ****
  
          // Insert anonymous user session
!         $result = DB_query( "INSERT INTO {$_TABLES['sessions']} (sess_id, start_time, remote_ip, uid) VALUES ($sess_id, $curtime, '$REMOTE_ADDR', 1)", 1 );
          $tries++;
      }
--- 316,320 ----
  
          // Insert anonymous user session
!         $result = DB_query( "INSERT INTO {$_TABLES['sessions']} (sess_id, start_time, remote_ip, uid) VALUES ($sess_id, $curtime, '{$HTTP_SERVER_VARS['REMOTE_ADDR']}', 1)", 1 );
          $tries++;
      }
***************
*** 1735,1739 ****
  function COM_accessLog( $logentry )
  {
!     global $_CONF, $_USER, $LANG01, $REMOTE_ADDR;
  
      $retval = '';
--- 1735,1739 ----
  function COM_accessLog( $logentry )
  {
!     global $_CONF, $_USER, $LANG01, $HTTP_SERVER_VARS;
  
      $retval = '';
***************
*** 1749,1757 ****
      if( isset( $_USER['uid'] ))
      {
!         $byuser = $_USER['uid'] . '@' . $REMOTE_ADDR;
      }
      else
      {
!         $byuser = 'anon@' . $REMOTE_ADDR;
      }
  
--- 1749,1757 ----
      if( isset( $_USER['uid'] ))
      {
!         $byuser = $_USER['uid'] . '@' . $HTTP_SERVER_VARS['REMOTE_ADDR'];
      }
      else
      {
!         $byuser = 'anon@' . $HTTP_SERVER_VARS['REMOTE_ADDR'];
      }
  
***************
*** 1775,1779 ****
  function COM_pollVote( $qid )
  {
!     global $_CONF, $_TABLES, $HTTP_COOKIE_VARS, $REMOTE_ADDR, $LANG01;
  
      $retval = '';
--- 1775,1779 ----
  function COM_pollVote( $qid )
  {
!     global $_CONF, $_TABLES, $LANG01, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS;
  
      $retval = '';
***************
*** 1789,1793 ****
      $nquestion = DB_numRows( $question );
      $fields = array( 'ipaddress', 'qid' );
!     $values = array( $REMOTE_ADDR, $qid );
      $id = DB_count( $_TABLES['pollvoters'], $fields, $values );
  
--- 1789,1793 ----
      $nquestion = DB_numRows( $question );
      $fields = array( 'ipaddress', 'qid' );
!     $values = array( $HTTP_SERVER_VARS['REMOTE_ADDR'], $qid );
      $id = DB_count( $_TABLES['pollvoters'], $fields, $values );
  
***************
*** 1874,1878 ****
  function COM_showPoll( $size, $qid='' )
  {
!     global $_TABLES, $HTTP_COOKIE_VARS, $REMOTE_ADDR, $_CONF;
  
      $retval = '';
--- 1874,1878 ----
  function COM_showPoll( $size, $qid='' )
  {
!     global $_CONF, $_TABLES, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS;
  
      $retval = '';
***************
*** 1883,1887 ****
      {
          $pcount = DB_count( $_TABLES['pollvoters'], array( 'ipaddress', 'qid' ),
!                             array( $REMOTE_ADDR, $qid ));
  
          if( empty( $HTTP_COOKIE_VARS[$qid]) && $pcount == 0 )
--- 1883,1887 ----
      {
          $pcount = DB_count( $_TABLES['pollvoters'], array( 'ipaddress', 'qid' ),
!                             array( $HTTP_SERVER_VARS['REMOTE_ADDR'], $qid ));
  
          if( empty( $HTTP_COOKIE_VARS[$qid]) && $pcount == 0 )
***************
*** 1906,1910 ****
                  $qid = $Q['qid'];
                  $id = array( 'ipaddress', 'qid' );
!                 $value = array( $REMOTE_ADDR, $qid );
                  $pcount = DB_count( $_TABLES['pollvoters'], $id, $value );
  
--- 1906,1910 ----
                  $qid = $Q['qid'];
                  $id = array( 'ipaddress', 'qid' );
!                 $value = array( $HTTP_SERVER_VARS['REMOTE_ADDR'], $qid );
                  $pcount = DB_count( $_TABLES['pollvoters'], $id, $value );
  
***************
*** 5325,5334 ****
  function COM_checkSpeedlimit ($type = 'submit')
  {
!     global $_TABLES, $REMOTE_ADDR;
  
      $last = 0;
  
      $date = DB_getItem ($_TABLES['speedlimit'], 'date',
!                         "(type = '$type') AND (ipaddress = '$REMOTE_ADDR')");
      if (!empty ($date)) {
          $last = time () - $date;
--- 5325,5334 ----
  function COM_checkSpeedlimit ($type = 'submit')
  {
!     global $_TABLES, $HTTP_SERVER_VARS;
  
      $last = 0;
  
      $date = DB_getItem ($_TABLES['speedlimit'], 'date',
!                         "(type = '$type') AND (ipaddress = '{$HTTP_SERVER_VARS['REMOTE_ADDR']}')");
      if (!empty ($date)) {
          $last = time () - $date;
***************
*** 5350,5357 ****
  function COM_updateSpeedlimit ($type = 'submit')
  {
!     global $_TABLES, $REMOTE_ADDR;
  
      DB_save ($_TABLES['speedlimit'], 'ipaddress,date,type',
!              "'$REMOTE_ADDR',unix_timestamp(),'$type'");
  }
  
--- 5350,5357 ----
  function COM_updateSpeedlimit ($type = 'submit')
  {
!     global $_TABLES, $HTTP_SERVER_VARS;
  
      DB_save ($_TABLES['speedlimit'], 'ipaddress,date,type',
!              "'{$HTTP_SERVER_VARS['REMOTE_ADDR']}',unix_timestamp(),'$type'");
  }
  

Index: pollbooth.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/pollbooth.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** pollbooth.php	14 Aug 2004 09:04:14 -0000	1.29
--- pollbooth.php	15 Aug 2004 12:06:07 -0000	1.30
***************
*** 53,60 ****
  function pollsave($qid = '', $aid = 0) 
  {
!     global $_TABLES, $LANG07, $REMOTE_ADDR;
  
      $pcount = DB_count ($_TABLES['pollvoters'], array ('ipaddress', 'qid' ),
!                         array ($REMOTE_ADDR, $qid));
      if ($pcount > 0) {
          exit;
--- 53,60 ----
  function pollsave($qid = '', $aid = 0) 
  {
!     global $_TABLES, $LANG07, $HTTP_SERVER_VARS;
  
      $pcount = DB_count ($_TABLES['pollvoters'], array ('ipaddress', 'qid' ),
!                         array ($HTTP_SERVER_VARS['REMOTE_ADDR'], $qid));
      if ($pcount > 0) {
          exit;
***************
*** 69,73 ****
      DB_change($_TABLES['pollanswers'],'votes',"votes + 1",$id,$value, '', true);
      // This always does an insert so no need to provide key_field and key_value args
!     DB_save($_TABLES['pollvoters'],'ipaddress,date,qid',"'$REMOTE_ADDR'," . time() . ",'$qid'");
      $retval .= COM_startBlock ($LANG07[1], '',
                         COM_getBlockTemplate ('_msg_block', 'header'))
--- 69,73 ----
      DB_change($_TABLES['pollanswers'],'votes',"votes + 1",$id,$value, '', true);
      // This always does an insert so no need to provide key_field and key_value args
!     DB_save($_TABLES['pollvoters'],'ipaddress,date,qid',"'{$HTTP_SERVER_VARS['REMOTE_ADDR']}'," . time() . ",'$qid'");
      $retval .= COM_startBlock ($LANG07[1], '',
                         COM_getBlockTemplate ('_msg_block', 'header'))




More information about the geeklog-cvs mailing list