[geeklog-cvs] geeklog: Clean up $_USER['uid'] handling

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Wed Jul 29 05:51:45 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/a88b92761fb9
changeset: 7196:a88b92761fb9
user:      Dirk Haun <dirk at haun-online.de>
date:      Wed Jul 29 11:13:39 2009 +0200
description:
Clean up $_USER['uid'] handling

diffstat:

 system/classes/story.class.php |  33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diffs (81 lines):

diff -r 80dd75e48446 -r a88b92761fb9 system/classes/story.class.php
--- a/system/classes/story.class.php	Wed Jul 29 10:58:19 2009 +0200
+++ b/system/classes/story.class.php	Wed Jul 29 11:13:39 2009 +0200
@@ -449,7 +449,11 @@
                 $this->_show_topic_icon = 1;
             }
 
-            $this->_uid = $_USER['uid'];
+            if (COM_isAnonUser()) {
+                $this->_uid = 1;
+            } else {
+                $this->_uid = $_USER['uid'];
+            }
             $this->_date = time();
             $this->_expire = time();
             $this->_commentcode = $_CONF['comment_code'];
@@ -479,7 +483,11 @@
 
             $this->_statuscode = 0;
             $this->_featured = 0;
-            $this->_owner_id = $_USER['uid'];
+            if (COM_isAnonUser()) {
+                $this->_owner_id = 1;
+            } else {
+                $this->_owner_id = $_USER['uid'];
+            }
 
             if (isset($_GROUPS['Story Admin'])) {
                 $this->_group_id = $_GROUPS['Story Admin'];
@@ -792,10 +800,10 @@
     {
         global $_USER, $_CONF, $_TABLES;
 
-        if (isset($_USER['uid']) && ($_USER['uid'] > 1)) {
+        if (COM_isAnonUser()) {
+            $this->_uid = 1;
+        } else {
             $this->_uid = $_USER['uid'];
-        } else {
-            $this->_uid = 1;
         }
 
         $this->_postmode = $_CONF['postmode'];
@@ -845,6 +853,9 @@
         $this->_postmode = COM_applyFilter($array['postmode']);
         $this->_sid = COM_applyFilter($array['sid']);
         $this->_uid = COM_applyFilter($array['uid'], true);
+        if ($this->_uid < 1) {
+            $this->_uid = 1;
+        }
         $this->_unixdate = COM_applyFilter($array['date'], true);
 
         if (!isset($array['bodytext'])) {
@@ -895,10 +906,10 @@
         global $_USER, $_CONF, $_TABLES;
         $this->_sid = COM_makeSid();
 
-        if (isset($_USER['uid']) && ($_USER['uid'] > 1)) {
+        if (COM_isAnonUser()) {
+            $this->_uid = 1;
+        } else {
             $this->_uid = $_USER['uid'];
-        } else {
-            $this->_uid = 1;
         }
 
         $tmptid = addslashes(COM_sanitizeID($this->_tid));
@@ -949,10 +960,10 @@
             $this->_trackbackcode = $_CONF['trackback_code'];
             $this->_statuscode = 0;
             $this->_show_topic_icon = $_CONF['show_topic_icon'];
-            if (isset($_USER['uid'])) {
+            if (COM_isAnonUser()) {
+                $this->_owner_id = 1;
+            } else {
                 $this->_owner_id = $_USER['uid'];
-            } else {
-                $this->_owner_id = 1;
             }
             $this->_group_id = $T['group_id'];
             $this->_perm_owner = $T['perm_owner'];



More information about the geeklog-cvs mailing list