[geeklog-cvs] geeklog: More consistent use of COM_isAnonUser()
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jan 3 16:15:07 EST 2010
changeset 7580:b93f6dca49e4
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/b93f6dca49e4
user: Dirk Haun <dirk at haun-online.de>
date: Sat Jan 02 23:02:15 2010 +0100
description:
More consistent use of COM_isAnonUser()
diffstat:
public_html/article.php | 4 ++--
public_html/comment.php | 8 ++++----
public_html/directory.php | 6 +++---
public_html/index.php | 8 ++++----
public_html/lib-common.php | 20 +++++++++-----------
public_html/stats.php | 4 ++--
public_html/submit.php | 16 ++++++++--------
public_html/users.php | 4 ++--
public_html/usersettings.php | 6 +++---
9 files changed, 37 insertions(+), 39 deletions(-)
diffs (truncated from 318 to 300 lines):
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/article.php
--- a/public_html/article.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/article.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Shows articles in various formats. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Jason Whittenburg - jwhitten AT securitygeeks DOT com |
@@ -284,7 +284,7 @@
$story_template->set_var('story_id', $story->getSid());
$story_template->set_var('story_title', $pagetitle);
$story_options = array ();
- if (($_CONF['hideemailicon'] == 0) && (!empty ($_USER['username']) ||
+ if (($_CONF['hideemailicon'] == 0) && (!COM_isAnonUser() ||
(($_CONF['loginrequired'] == 0) &&
($_CONF['emailstoryloginrequired'] == 0)))) {
$emailUrl = $_CONF['site_url'] . '/profiles.php?sid=' . $story->getSid()
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/comment.php
--- a/public_html/comment.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/comment.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Let user comment on a story or 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 |
@@ -204,11 +204,11 @@
$format = COM_applyFilter( $_REQUEST['format'] );
}
if ( $format != 'threaded' && $format != 'nested' && $format != 'flat' ) {
- if ( $_USER['uid'] > 1 ) {
+ if (COM_isAnonUser()) {
+ $format = $_CONF['comment_mode'];
+ } else {
$format = DB_getItem( $_TABLES['usercomment'], 'commentmode',
"uid = {$_USER['uid']}" );
- } else {
- $format = $_CONF['comment_mode'];
}
}
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/directory.php
--- a/public_html/directory.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/directory.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Directory of all the stories on a Geeklog site. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2004-2009 by the following authors: |
+// | Copyright (C) 2004-2010 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
@@ -44,8 +44,8 @@
$display = '';
-if (empty ($_USER['username']) && (($_CONF['loginrequired'] == 1) ||
- ($_CONF['directoryloginrequired'] == 1))) {
+if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) ||
+ ($_CONF['directoryloginrequired'] == 1))) {
$display = COM_siteHeader ('menu', $LANG_DIR['title']);
$display .= COM_startBlock ($LANG_LOGIN[1], '',
COM_getBlockTemplate ('_msg_block', 'header'));
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/index.php
--- a/public_html/index.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/index.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Geeklog homepage. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
+// | Copyright (C) 2000-2010 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony at tonybibbs.com |
// | Mark Limburg - mlimburg at users.sourceforge.net |
@@ -207,11 +207,11 @@
}
}
-if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
+if (COM_isAnonUser()) {
+ $U['maxstories'] = 0;
+} else {
$result = DB_query("SELECT maxstories,tids,aids FROM {$_TABLES['userindex']} WHERE uid = '{$_USER['uid']}'");
$U = DB_fetchArray($result);
-} else {
- $U['maxstories'] = 0;
}
$maxstories = 0;
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/lib-common.php
--- a/public_html/lib-common.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/lib-common.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Geeklog common library. |
// +---------------------------------------------------------------------------+
-// | 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 |
@@ -578,7 +578,7 @@
*/
function COM_renderMenu( &$header, $plugin_menu )
{
- global $_CONF, $_USER, $LANG01, $topic;
+ global $_CONF, $LANG01, $topic;
if( empty( $_CONF['menu_elements'] ))
{
@@ -2313,7 +2313,7 @@
*/
function COM_userMenu( $help='', $title='', $position='' )
{
- global $_TABLES, $_USER, $_CONF, $LANG01, $LANG04, $_BLOCK_TEMPLATE;
+ global $_TABLES, $_CONF, $LANG01, $LANG04, $_BLOCK_TEMPLATE;
$retval = '';
@@ -2493,13 +2493,12 @@
*/
function COM_adminMenu( $help = '', $title = '', $position = '' )
{
- global $_TABLES, $_USER, $_CONF, $LANG01, $LANG_ADMIN, $_BLOCK_TEMPLATE,
+ global $_TABLES, $_CONF, $LANG01, $LANG_ADMIN, $_BLOCK_TEMPLATE,
$_DB_dbms, $config;
$retval = '';
- if( empty( $_USER['username'] ))
- {
+ if (COM_isAnonUser()) {
return $retval;
}
@@ -3616,7 +3615,7 @@
*/
function COM_formatBlock( $A, $noboxes = false )
{
- global $_CONF, $_TABLES, $_USER, $LANG21;
+ global $_CONF, $_TABLES, $LANG21;
$retval = '';
@@ -4227,7 +4226,7 @@
function COM_whatsNewBlock( $help = '', $title = '', $position = '' )
{
- global $_CONF, $_TABLES, $_USER, $LANG01, $LANG_WHATSNEW, $page, $newstories;
+ global $_CONF, $_TABLES, $LANG01, $LANG_WHATSNEW, $page, $newstories;
$retval = COM_startBlock( $title, $help,
COM_getBlockTemplate( 'whats_new_block', 'header', $position ));
@@ -4795,8 +4794,7 @@
{
global $_TABLES, $_USER, $_CONF;
- if( empty( $_USER ))
- {
+ if (COM_isAnonUser()) {
return;
}
@@ -4817,7 +4815,7 @@
function phpblock_whosonline()
{
- global $_CONF, $_TABLES, $_USER, $LANG01, $_IMAGE_TYPE;
+ global $_CONF, $_TABLES, $LANG01, $_IMAGE_TYPE;
$retval = '';
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/stats.php
--- a/public_html/stats.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/stats.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Geeklog system statistics page. |
// +---------------------------------------------------------------------------+
-// | 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 |
@@ -37,7 +37,7 @@
$display = '';
-if (empty ($_USER['username']) &&
+if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_CONF['statsloginrequired'] == 1))) {
$display = COM_siteHeader ('menu', $LANG_LOGIN[1]);
$display .= COM_startBlock ($LANG_LOGIN[1], '',
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/submit.php
--- a/public_html/submit.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/submit.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Let users submit stories and plugin stuff. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2008 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 |
@@ -53,9 +53,9 @@
* @return string HTML for submission form
*
*/
-function submissionform($type='story', $mode = '', $topic = '')
+function submissionform($type = 'story', $mode = '', $topic = '')
{
- global $_CONF, $_TABLES, $_USER, $LANG12, $LANG_LOGIN;
+ global $_CONF, $_TABLES, $LANG12, $LANG_LOGIN;
$retval = '';
@@ -71,7 +71,7 @@
. $LANG12[31]
. COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
} else {
- if (empty ($_USER['username']) &&
+ if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_CONF['submitloginrequired'] == 1))) {
$retval .= COM_startBlock ($LANG_LOGIN[1], '',
COM_getBlockTemplate ('_msg_block', 'header'));
@@ -163,7 +163,7 @@
$storyform->set_var ('layout_url', $_CONF['layout_url']);
$storyform->set_var ('lang_username', $LANG12[27]);
- if (!empty($_USER['username'])) {
+ if (! COM_isAnonUser()) {
$storyform->set_var('story_username', $_USER['username']);
$storyform->set_var('author', COM_getDisplayName ());
$storyform->set_var('status_url', $_CONF['site_url']
@@ -280,7 +280,7 @@
*/
function savestory ($A)
{
- global $_CONF, $_TABLES, $_USER;
+ global $_CONF, $_TABLES;
$retval = '';
@@ -330,7 +330,7 @@
*/
function savesubmission($type, $A)
{
- global $_CONF, $_TABLES, $_USER, $LANG12;
+ global $_CONF, $_TABLES, $LANG12;
$retval = COM_siteHeader ();
@@ -403,7 +403,7 @@
}
if (($mode == $LANG12[8]) && !empty ($LANG12[8])) { // submit
- if (empty ($_USER['username']) &&
+ if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_CONF['submitloginrequired'] == 1))) {
$display = COM_refresh ($_CONF['site_url'] . '/index.php');
} else {
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/users.php
--- a/public_html/users.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/users.php Sat Jan 02 23:02:15 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | User authentication module. |
// +---------------------------------------------------------------------------+
-// | 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 |
@@ -71,7 +71,7 @@
$LANG01, $LANG04, $LANG09, $LANG28, $LANG_LOGIN, $LANG_ADMIN;
$retval = '';
- if (empty($_USER['username']) &&
+ if (COM_isAnonUser() &&
(($_CONF['loginrequired'] == 1) || ($_CONF['profileloginrequired'] == 1))) {
$retval .= COM_siteHeader('menu', $LANG_LOGIN[1]);
$retval .= COM_startBlock($LANG_LOGIN[1], '',
diff -r 21c4ffae4200 -r b93f6dca49e4 public_html/usersettings.php
--- a/public_html/usersettings.php Sat Jan 02 20:56:41 2010 +0100
+++ b/public_html/usersettings.php Sat Jan 02 23:02:15 2010 +0100
@@ -1071,11 +1071,11 @@
*/
function userprofile ($user, $msg = 0)
{
- global $_CONF, $_TABLES, $_USER, $LANG01, $LANG04, $LANG09, $LANG_LOGIN;
More information about the geeklog-cvs
mailing list