[geeklog-cvs] geeklog: More consistent use of COM_isAnonUser(), part 2
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jan 3 16:15:08 EST 2010
changeset 7581:e5d93d65e4bb
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e5d93d65e4bb
user: Dirk Haun <dirk at haun-online.de>
date: Sun Jan 03 10:09:38 2010 +0100
description:
More consistent use of COM_isAnonUser(), part 2
diffstat:
plugins/calendar/functions.inc | 10 +++++-----
plugins/staticpages/functions.inc | 6 +++---
public_html/calendar/event.php | 14 +++++++-------
public_html/calendar/index.php | 13 ++++++-------
public_html/links/index.php | 10 +++++-----
public_html/polls/index.php | 9 ++++-----
system/classes/search.class.php | 12 ++++++------
system/lib-comment.php | 18 +++++++++---------
system/lib-story.php | 8 ++++----
system/lib-user.php | 4 ++--
10 files changed, 51 insertions(+), 53 deletions(-)
diffs (truncated from 452 to 300 lines):
diff -r b93f6dca49e4 -r e5d93d65e4bb plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc Sat Jan 02 23:02:15 2010 +0100
+++ b/plugins/calendar/functions.inc Sun Jan 03 10:09:38 2010 +0100
@@ -10,7 +10,7 @@
// | API method and 2) implements all the common code needed by the Calendar |
// | plugin's PHP files. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Tom Willett - twillett AT users DOT sourceforge DOT net |
@@ -129,7 +129,7 @@
}
$eventSql .= 'ORDER BY datestart,timestart';
- if(( $_CA_CONF['personalcalendars'] == 1 ) && !empty( $_USER['uid'] )) {
+ if (($_CA_CONF['personalcalendars'] == 1) && !COM_isAnonUser()) {
$personaleventsql = 'SELECT eid,title,url,datestart,dateend,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon '
. "FROM {$_TABLES['personal_events']} ";
if($_DB_dbms == 'mssql') {
@@ -149,7 +149,7 @@
$oldDate1 = 'no_day'; // Invalid Date!
$oldDate2 = 'last_d'; // Invalid Date!
- if( $_CA_CONF['personalcalendars'] == 1 AND !empty( $_USER['uid'] )) {
+ if (($_CA_CONF['personalcalendars'] == 1) AND !COM_isAnonUser()) {
$iterations = 2;
} else {
$iterations = 1;
@@ -367,7 +367,7 @@
*/
function plugin_moderationapprove_calendar($id)
{
- global $_CA_CONF, $_GROUPS, $_TABLES, $_USER;
+ global $_CA_CONF, $_GROUPS, $_TABLES;
// The eventsubmission table only keeps track of the submitter's uid,
// but not of grous and permissions. So set those to sensible defaults.
@@ -668,7 +668,7 @@
*/
function plugin_submit_calendar($mode = 'master')
{
- global $_CONF, $_USER, $_CA_CONF, $LANG_CAL_1;
+ global $_CONF, $_CA_CONF, $LANG_CAL_1;
if (isset($_POST['calendar_type'])) {
$mode = $_POST['calendar_type'];
diff -r b93f6dca49e4 -r e5d93d65e4bb plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc Sat Jan 02 23:02:15 2010 +0100
+++ b/plugins/staticpages/functions.inc Sun Jan 03 10:09:38 2010 +0100
@@ -10,7 +10,7 @@
// | API method and 2) implements all the common code needed by the Static |
// | Pages' PHP files. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Tom Willett - twillett AT users DOT sourceforge DOT net |
@@ -172,7 +172,7 @@
*/
function plugin_savecomment_staticpages($title, $comment, $id, $pid, $postmode)
{
- global $_CONF, $_TABLES, $LANG03, $_USER;
+ global $_CONF, $_TABLES, $LANG03;
$retval = '';
@@ -444,7 +444,7 @@
if ($A['sp_format'] <> 'blankpage') {
if (!isset($_USER['noboxes'])) {
- if (empty($_USER['uid']) || ($_USER['uid'] == 1)) {
+ if (COM_isAnonUser()) {
$_USER['noboxes'] = 0;
} else {
$_USER['noboxes'] = DB_getItem($_TABLES['userindex'],
diff -r b93f6dca49e4 -r e5d93d65e4bb public_html/calendar/event.php
--- a/public_html/calendar/event.php Sat Jan 02 23:02:15 2010 +0100
+++ b/public_html/calendar/event.php Sun Jan 03 10:09:38 2010 +0100
@@ -2,13 +2,13 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Calendar Plugin 1.0 |
+// | Calendar Plugin 1.1 |
// +---------------------------------------------------------------------------+
// | event.php |
// | |
// | Shows details of an event or events |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
@@ -141,7 +141,7 @@
{
global $_CONF, $_TABLES, $_USER;
- if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
+ if (! COM_isAnonUser()) {
// Try to delete the event first in case it has already been added
DB_query ("DELETE FROM {$_TABLES['personal_events']} WHERE uid={$_USER['uid']} AND eid='$eid'");
@@ -390,7 +390,7 @@
case $LANG_CAL_1[45]: // save edited personal event
if (!empty($LANG_CAL_1[45]) && ($_CA_CONF['personalcalendars'] == 1) &&
- (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) &&
+ !COM_isAnonUser() &&
(isset ($_POST['calendar_type']) &&
($_POST['calendar_type'] == 'personal')) && SEC_checkToken()) {
$display = plugin_savesubmission_calendar ($_POST);
@@ -403,7 +403,7 @@
case $LANG_CAL_1[51]:
if (($_CA_CONF['personalcalendars'] == 1) && SEC_checkToken()) {
$eid = COM_applyFilter ($_REQUEST['eid']);
- if (!empty ($eid) && (isset ($_USER['uid']) && ($_USER['uid'] > 1))) {
+ if (!empty($eid) && !COM_isAnonUser()) {
DB_query ("DELETE FROM {$_TABLES['personal_events']} WHERE uid={$_USER['uid']} AND eid='$eid'");
$display .= COM_refresh ($_CONF['site_url']
. '/calendar/index.php?mode=personal&msg=26');
@@ -418,7 +418,7 @@
case 'edit':
if ($_CA_CONF['personalcalendars'] == 1) {
$eid = COM_applyFilter ($_GET['eid']);
- if (!empty ($eid) && (isset ($_USER['uid']) && ($_USER['uid'] > 1))) {
+ if (!empty($eid) && !COM_isAnonUser()) {
$result = DB_query ("SELECT * FROM {$_TABLES['personal_events']} WHERE (eid = '$eid') AND (uid = {$_USER['uid']})");
if (DB_numRows ($result) == 1) {
$A = DB_fetchArray ($result);
@@ -453,7 +453,7 @@
}
if (!empty ($eid)) {
if (($mode == 'personal') && ($_CA_CONF['personalcalendars'] == 1) &&
- (isset ($_USER['uid']) && ($_USER['uid'] > 1))) {
+ !COM_isAnonUser()) {
$datesql = "SELECT * FROM {$_TABLES['personal_events']} "
. "WHERE (eid = '$eid') AND (uid = {$_USER['uid']})";
$pagetitle = $LANG_CAL_2[28] . ' ' . COM_getDisplayName();
diff -r b93f6dca49e4 -r e5d93d65e4bb public_html/calendar/index.php
--- a/public_html/calendar/index.php Sat Jan 02 23:02:15 2010 +0100
+++ b/public_html/calendar/index.php Sun Jan 03 10:09:38 2010 +0100
@@ -2,13 +2,13 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Calendar Plugin 1.0 |
+// | Calendar Plugin 1.1 |
// +---------------------------------------------------------------------------+
// | index.php |
// | |
// | Geeklog calendar plugin |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
@@ -43,7 +43,7 @@
$display = '';
-if (empty ($_USER['username']) &&
+if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_CA_CONF['calendarloginrequired'] == 1))) {
$display .= COM_siteHeader('');
$display .= COM_startBlock ($LANG_LOGIN[1], '',
@@ -533,7 +533,7 @@
);
} else {
$cal_templates->set_var('calendar_title', '[' . $_CONF['site_name'] . ' ' . $LANG_CAL_2[29]);
- if (!empty($_USER['uid']) AND $_CA_CONF['personalcalendars'] == 1) {
+ if (!COM_isAnonUser() AND $_CA_CONF['personalcalendars'] == 1) {
$cal_templates->set_var('calendar_toggle', '| '
. COM_createLink($LANG_CAL_2[12], $_CONF['site_url']
. "/calendar/index.php?mode=personal&view=day&month=$month&day=$day&year=$year") . ']'
@@ -650,7 +650,7 @@
);
} else {
$cal_templates->set_var('calendar_title', '[' . $_CONF['site_name'] . ' ' . $LANG_CAL_2[29]);
- if (!empty($_USER['uid']) AND $_CA_CONF['personalcalendars'] == 1) {
+ if (!COM_isAnonUser() AND $_CA_CONF['personalcalendars'] == 1) {
$cal_templates->set_var('calendar_toggle', '| '
. COM_createLink($LANG_CAL_2[12], $_CONF['site_url']
. "/calendar/index.php?mode=personal&view=week&month=$month&day=$day&year=$year") . ']'
@@ -1048,8 +1048,7 @@
$cal_templates->set_var('lang_mastercal', $LANG_CAL_2[25] . $LANG_CAL_2[11]);
$cal_templates->parse('master_calendar_option','mastercal',true);
} else {
- if (isset ($_USER['uid']) && ($_USER['uid'] > 1) &&
- ($_CA_CONF['personalcalendars'] == 1)) {
+ if (!COM_isAnonUser() && ($_CA_CONF['personalcalendars'] == 1)) {
$cal_templates->set_var('lang_mycalendar', $LANG_CAL_2[12]);
$cal_templates->parse('personal_calendar_option','personalcal',true);
} else {
diff -r b93f6dca49e4 -r e5d93d65e4bb public_html/links/index.php
--- a/public_html/links/index.php Sat Jan 02 23:02:15 2010 +0100
+++ b/public_html/links/index.php Sun Jan 03 10:09:38 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | This is the main page for the Geeklog Links Plugin |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
@@ -42,7 +42,7 @@
* @filesource
* @version 2.1
* @since GL 1.4.0
- * @copyright Copyright © 2005-2009
+ * @copyright Copyright © 2005-2010
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* @author Tony Bibbs, tony AT tonybibbs DOT com
* @author Mark Limburg, mlimburg AT users DOT sourceforge DOT net
@@ -347,7 +347,7 @@
*/
function prepare_link_item($A, &$template)
{
- global $_CONF, $_USER, $_LI_CONF, $LANG_ADMIN, $LANG_LINKS, $LANG_DIRECTION,
+ global $_CONF, $_LI_CONF, $LANG_ADMIN, $LANG_LINKS, $LANG_DIRECTION,
$_IMAGE_TYPE;
$url = COM_buildUrl($_CONF['site_url']
@@ -417,7 +417,7 @@
}
$message = array();
-if (($mode == 'report') && (isset($_USER['uid']) && ($_USER['uid'] > 1))) {
+if (($mode == 'report') && !COM_isAnonUser()) {
if (isset ($_GET['lid'])) {
$lid = COM_applyFilter($_GET['lid']);
}
@@ -437,7 +437,7 @@
}
}
-if (empty ($_USER['username']) &&
+if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_LI_CONF['linksloginrequired'] == 1))) {
$display .= COM_siteHeader ('menu', $LANG_LINKS[114]);
$display .= COM_startBlock ($LANG_LOGIN[1], '',
diff -r b93f6dca49e4 -r e5d93d65e4bb public_html/polls/index.php
--- a/public_html/polls/index.php Sat Jan 02 23:02:15 2010 +0100
+++ b/public_html/polls/index.php Sun Jan 03 10:09:38 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Display poll results and past polls. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
@@ -58,14 +58,13 @@
* @return string HTML for poll listing
*
*/
-function polllist ()
+function polllist()
{
- global $_CONF, $_TABLES, $_USER, $_PO_CONF,
- $LANG25, $LANG_LOGIN, $LANG_POLLS;
+ global $_CONF, $_TABLES, $_PO_CONF, $LANG25, $LANG_LOGIN, $LANG_POLLS;
$retval = '';
- if (empty ($_USER['username']) && (($_CONF['loginrequired'] == 1) ||
+ if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
($_PO_CONF['pollsloginrequired'] == 1))) {
$retval = COM_startBlock ($LANG_LOGIN[1], '',
COM_getBlockTemplate ('_msg_block', 'header'));
diff -r b93f6dca49e4 -r e5d93d65e4bb system/classes/search.class.php
--- a/system/classes/search.class.php Sat Jan 02 23:02:15 2010 +0100
+++ b/system/classes/search.class.php Sun Jan 03 10:09:38 2010 +0100
@@ -2,13 +2,13 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.6.1 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | search.class.php |
// | |
// | Geeklog search class. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT geeklog DOT net |
// | Dirk Haun - dirk AT haun-online DOT de |
@@ -156,9 +156,9 @@
*/
function _isSearchAllowed()
{
- global $_USER, $_CONF;
More information about the geeklog-cvs
mailing list