[geeklog-cvs] geeklog: Minor improvement: Don't search through the personal ca...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Jun 15 06:53:19 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1f0d602ba92b
changeset: 7121:1f0d602ba92b
user:      Dirk Haun <dirk at haun-online.de>
date:      Mon Jun 15 12:53:08 2009 +0200
description:
Minor improvement: Don't search through the personal calendar for anonymous users

diffstat:

 plugins/calendar/functions.inc |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (35 lines):

diff -r 1eac383649c6 -r 1f0d602ba92b plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc	Sun Jun 14 15:42:23 2009 +0100
+++ b/plugins/calendar/functions.inc	Mon Jun 15 12:53:08 2009 +0200
@@ -1610,13 +1610,19 @@
     // Make sure the query is SQL safe
     $query = trim(addslashes($query));
 
+    if (COM_isAnonUser()) {
+        $uid = 1;
+    } else {
+        $uid = $_USER['uid'];
+    }
+
     $sql_e = "SELECT eid AS id, title, description, UNIX_TIMESTAMP(datestart) AS date, owner_id AS uid, hits, ";
     $sql_e .= "CONCAT('/calendar/event.php?eid=',eid) AS url ";
     $sql_e .= "FROM {$_TABLES['events']} WHERE 1=1 ";
 
     $sql_p = "SELECT eid AS id, title, description, UNIX_TIMESTAMP(datestart) AS date, owner_id AS uid, ";
     $sql_p .= "CONCAT('/calendar/event.php?mode=personal&eid=',eid) AS url ";
-    $sql_p .= "FROM {$_TABLES['personal_events']} WHERE  (uid = {$_USER['uid']}) ";
+    $sql_p .= "FROM {$_TABLES['personal_events']} WHERE (uid = $uid) ";
 
     $sql = COM_getPermSQL('AND') . ' ';
 
@@ -1644,6 +1650,10 @@
     $search_e->setFTSQL($ftsql_tmp);
     $search_e->setRank(2);
 
+    if (COM_isAnonUser()) {
+        return $search_e;
+    }
+
     // Search personal events
     $search_p = new SearchCriteria('calendar', array($LANG_CAL_1[16],$LANG_CAL_1[23]));
     $columns = array('title' => 'title', 'location', 'description');



More information about the geeklog-cvs mailing list