mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
- added updated coding guidelines
- introduced is_registered and is_bot flags for correct determinition of guest/registered/bot users - changed bot code to act on useragent || ip git-svn-id: file:///svn/phpbb/trunk@5117 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
c947835317
commit
557d09bb72
@ -27,8 +27,13 @@ $user->setup('admin');
|
||||
// End session management
|
||||
|
||||
// Did user forget to login? Give 'em a chance to here ...
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
if ($user->data['is_bot'])
|
||||
{
|
||||
redirect("../index.$phpEx$SID");
|
||||
}
|
||||
|
||||
login_box('', $user->lang['LOGIN_ADMIN'], $user->lang['LOGIN_ADMIN_SUCCESS'], true);
|
||||
}
|
||||
|
||||
|
1043
phpBB/docs/coding-guidelines.html
Normal file
1043
phpBB/docs/coding-guidelines.html
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,26 +0,0 @@
|
||||
CODING GUIDELINES : Initials by psoTFX (July 2001)
|
||||
-----------------
|
||||
|
||||
* The coding style is defined in the codingstandards.html file, all attempts should be made to follow it as closely as possible
|
||||
|
||||
* All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL, MSSQL (7.0 and 2000), PostgreSQL (7.0+), Oracle8, ODBC (generalised if possible, otherwise MS Access, DB2))
|
||||
|
||||
* All SQL commands should utilise the DataBase Abstraction Layer (DBAL)
|
||||
|
||||
* All URL's (and form actions) _must_ be wrapped in append_sid, this ensures the session_id is propagated when cookies aren't available
|
||||
|
||||
* The minimum amount of data should be passed via GET or POST, checking should occur within individual scripts (to prevent spoofing of information)
|
||||
|
||||
* The auth function should be used for all authorisation checking
|
||||
|
||||
* Sessions should be initiated on each page, as near the top as possible using the session_pagestart function (userdata should be obtained by calling the init_userprefs immediately after session initialisation)
|
||||
|
||||
* Login checks should be forwarded to the login page (supplying a page to forward onto once check is complete if required)
|
||||
|
||||
* All template variables should be named appropriately (using underscores for spaces), language entries should be prefixed with L_, system data with S_, urls with U_, all other variables should be presented 'as is'.
|
||||
|
||||
* Functions used by more than page should be placed in functions.php, functions specific to one page should be placed on that page (at the top to maintain compatibility with PHP3) surrounded by comments indicating the start and end of the function block
|
||||
|
||||
* All messages/errors should be output by the message_die function using the appropriate message type (see function for details)
|
||||
|
||||
* No attempt should be made to remove any copyright information (either contained within the source or displayed interactively when the source is run/compiled), neither should the copyright information be altered in any way (it may be added to)
|
@ -1,327 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!-- saved from url=(0044) -->
|
||||
<HTML><HEAD><TITLE>phpBB Coding Standard Guidelines</TITLE>
|
||||
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
|
||||
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
|
||||
<BODY aLink=#cccccc bgColor=#ffffff link=#0000ff text=#000000
|
||||
vLink=#0000ff><FONT face=verdana,arial,tahoma size=-1><A name=top></A>
|
||||
<H2>phpBB Coding Standard Guidelines</H2>Comments or suggestions? email <A
|
||||
href="mailto:nate@phpbb.com">nate@phpbb.com</A><BR><BR><A
|
||||
href="#editor">Editor
|
||||
Settings</A><BR><A
|
||||
href="#naming">Naming
|
||||
Conventions</A><BR><A
|
||||
href="#layout">Code Layout</A><BR><A
|
||||
href="#general">General
|
||||
Guidelines</A><BR><BR><BR><A name=editor></A><A
|
||||
href="#top">top</A>
|
||||
<H3>Editor Settings</H3>
|
||||
<P><B>Tabs vs Spaces:</B> In order to make this as simple as possible, we will
|
||||
be using tabs, not spaces. Feel free to set how many spaces your editor uses
|
||||
when it <B>displays</B> tabs, but make sure that when you <B>save</B> the file,
|
||||
it's saving tabs and not spaces. This way, we can each have the code be
|
||||
displayed the way we like it, without breaking the layout of the actual files.
|
||||
</P>
|
||||
<P><B>Linefeeds:</B> Ensure that your editor is saving files in the UNIX format.
|
||||
This means lines are terminated with a newline, not with a CR/LF combo as they
|
||||
are on Win32, or whatever the Mac uses. Any decent Win32 editor should be able
|
||||
to do this, but it might not always be the default. Know your editor. If you
|
||||
want advice on Windows text editors, just ask one of the developers. Some of
|
||||
them do their editing on Win32. </P><BR><BR><A name=naming></A><A
|
||||
href="#top">top</A>
|
||||
<H3>Naming Conventions</H3>
|
||||
<P>We will not be using any form of hungarian notation in our naming
|
||||
conventions. Many of us believe that hungarian naming is one of the primary code
|
||||
obfuscation techniques currently in use. </P>
|
||||
<P><B>Variable Names:</B> Variable names should be in all lowercase, with words
|
||||
separated by an underscore. <BR><BR> Example: <CODE><FONT
|
||||
size=+1>$current_user</FONT></CODE> is right, but <CODE><FONT
|
||||
size=+1>$currentuser</FONT></CODE> and <CODE><FONT
|
||||
size=+1>$currentUser</FONT></CODE> are not. <BR><BR>Names should be descriptive,
|
||||
but concise. We don't want huge sentences as our variable names, but typing an
|
||||
extra couple of characters is always better than wondering what exactly a
|
||||
certain variable is for. </P>
|
||||
<P><B>Loop Indices:</B> The <I>only</I> situation where a one-character variable
|
||||
name is allowed is when it's the index for some looping construct. In this case,
|
||||
the index of the outer loop should always be $i. If there's a loop inside that
|
||||
loop, its index should be $j, followed by $k, and so on. If the loop is being
|
||||
indexed by some already-existing variable with a meaningful name, this guideline
|
||||
does not apply. <BR><BR> Example: <PRE><FONT size=+1>
|
||||
for ($i = 0; $i < $outer_size; $i++)
|
||||
{
|
||||
for ($j = 0; $j < $inner_size; $j++)
|
||||
{
|
||||
foo($i, $j);
|
||||
}
|
||||
} </FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Function Names:</B> Functions should also be named descriptively. We're
|
||||
not programming in C here, we don't want to write functions called things like
|
||||
"stristr()". Again, all lower-case names with words separated by a single
|
||||
underscore character. Function names should preferably have a verb in them
|
||||
somewhere. Good function names are <CODE><FONT
|
||||
size=+1>print_login_status()</FONT></CODE>, <CODE><FONT
|
||||
size=+1>get_user_data()</FONT></CODE>, etc.. </P>
|
||||
<P><B>Function Arguments:</B> Arguments are subject to the same guidelines as
|
||||
variable names. We don't want a bunch of functions like: <CODE><FONT
|
||||
size=+1>do_stuff($a, $b, $c)</FONT></CODE>. In most cases, we'd like to be able
|
||||
to tell how to use a function by just looking at its declaration. </P>
|
||||
<P><B>Summary:</B> The basic philosophy here is to not hurt code clarity for the
|
||||
sake of laziness. This has to be balanced by a little bit of common sense,
|
||||
though; <CODE><FONT size=+1>print_login_status_for_a_given_user()</FONT></CODE>
|
||||
goes too far, for example -- that function would be better named <CODE><FONT
|
||||
size=+1>print_user_login_status()</FONT></CODE> , or just <CODE><FONT
|
||||
size=+1>print_login_status()</FONT></CODE>. </P><BR><BR><A name=layout></A><A
|
||||
href="#top">top</A>
|
||||
<H3>Code Layout</H3>
|
||||
<P><B>Standard header for new files:</B> Here a template of the header that must
|
||||
be included at the start of all phpBB files: <PRE><FONT size=+1>
|
||||
/***************************************************************************
|
||||
filename.php
|
||||
-------------------
|
||||
begin : Sat June 17 2000
|
||||
copyright : (C) 2000 The phpBB Group
|
||||
email : support@phpBB.com
|
||||
|
||||
$Id$
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Always include the braces:</B> This is another case of being too lazy to
|
||||
type 2 extra characters causing problems with code clarity. Even if the body of
|
||||
some construct is only one line long, do <I>not</I> drop the braces. Just don't.
|
||||
<BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* These are all wrong. */
|
||||
if (condition) do_stuff();
|
||||
if (condition)
|
||||
do_stuff();
|
||||
while (condition)
|
||||
do_stuff();
|
||||
for ($i = 0; $i < size; $i++)
|
||||
do_stuff($i);
|
||||
|
||||
/* These are right. */
|
||||
if (condition)
|
||||
{
|
||||
do_stuff();
|
||||
}
|
||||
while (condition)
|
||||
{
|
||||
do_stuff();
|
||||
}
|
||||
for ($i = 0; $i < size; $i++)
|
||||
{
|
||||
do_stuff();
|
||||
}
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Where to put the braces:</B> This one is a bit of a holy war, but we're
|
||||
going to use a style that can be summed up in one sentence: Braces always go on
|
||||
their own line. The closing brace should also always be at the same column as
|
||||
the corresponding opening brace. <BR><BR> Examples:<PRE><FONT size=+1>
|
||||
if (condition)
|
||||
{
|
||||
while (condition2)
|
||||
{
|
||||
...
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $size; $i++)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
while (condition)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
function do_stuff()
|
||||
{
|
||||
...
|
||||
}
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Use spaces between tokens:</B> This is another simple, easy step that
|
||||
helps keep code readable without much effort. Whenever you write an assignment,
|
||||
expression, etc.. Always leave <I>one</I> space between the tokens. Basically,
|
||||
write code as if it was English. Put spaces between variable names and
|
||||
operators. Don't put spaces just after an opening bracket or before a closing
|
||||
bracket. Don't put spaces just before a comma or a semicolon. This is best shown
|
||||
with a few examples. <BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* Each pair shows the wrong way followed by the right way. */
|
||||
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
if($i<7) ...
|
||||
if ($i < 7) ...
|
||||
|
||||
if ( ($i < 7)&&($j > 8) ) ...
|
||||
if (($i < 7) && ($j > 8)) ...
|
||||
|
||||
do_stuff( $i, "foo", $b );
|
||||
do_stuff($i, "foo", $b);
|
||||
|
||||
for($i=0; $i<$size; $i++) ...
|
||||
for($i = 0; $i < $size; $i++) ...
|
||||
|
||||
$i=($j < $size)?0:1;
|
||||
$i = ($j < $size) ? 0 : 1;
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Operator precedence:</B> Do you know the exact precedence of all the
|
||||
operators in PHP? Neither do I. Don't guess. Always make it obvious by using
|
||||
brackets to force the precedence of an equation so you know what it does.
|
||||
<BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* what's the result? who knows. */
|
||||
$bool = ($i < 7 && $j > 8 || $k == 4);
|
||||
|
||||
/* now you can be certain what I'm doing here. */
|
||||
$bool = (($i < 7) && (($j < 8) || ($k == 4)))
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>SQL code layout:</B> Since we'll all be using different editor settings,
|
||||
don't try to do anything complex like aligning columns in SQL code. Do, however,
|
||||
break statements onto their own lines. Here's a sample of how SQL code should
|
||||
look. Note where the lines break, the capitalization, and the use of brackets.
|
||||
<BR><BR> Examples:<PRE><FONT size=+1>
|
||||
SELECT field1 AS something, field2, field3
|
||||
FROM table a, table b
|
||||
WHERE (this = that) AND (this2 = that2)
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>SQL insert statements:</B> SQL INSERT statements can be written in two
|
||||
different ways. Either you specify explicitly the columns being inserted, or
|
||||
you rely on knowing the order of the columns in the database and do not
|
||||
specify them. We want to use the former approach, where it is explicitly
|
||||
stated whcih columns are being inserted. This means our application-level code
|
||||
will not depend on the order of the fields in the database, and will not be broken
|
||||
if we add additional fields (unless they're specified as NOT NULL, of course).
|
||||
<BR><BR> Examples:<PRE><FONT size=+1>
|
||||
# This is not what we want.
|
||||
INSERT INTO mytable
|
||||
VALUES ('something', 1, 'else')
|
||||
|
||||
# This is correct.
|
||||
INSERT INTO mytable (column1, column2, column3)
|
||||
VALUES ('something', 1, 'else')
|
||||
</FONT></PRE>
|
||||
<P></P><BR><BR><A name=general></A><A
|
||||
href="#top">top</A>
|
||||
<H3>General Guidelines</H3>
|
||||
<P><B>Quoting strings:</B> There are two different ways to quote strings in PHP
|
||||
- either with single quotes or with double quotes. The main difference is that
|
||||
the parser does variable interpolation in double-quoted strings, but not in
|
||||
single quoted strings. Because of this, you should <I>always</I> use single
|
||||
quotes <I>unless</I> you specifically need variable interpolation to be done on
|
||||
that string. This way, we can save the parser the trouble of parsing a bunch of
|
||||
strings where no interpolation needs to be done. Also, if you are using a string
|
||||
variable as part of a function call, you do not need to enclose that variable in
|
||||
quotes. Again, this will just make unnecessary work for the parser. Note,
|
||||
however, that nearly all of the escape sequences that exist for double-quoted
|
||||
strings will not work with single-quoted strings. Be careful, and feel free to
|
||||
break this guideline if it's making your code harder to read.
|
||||
<BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* wrong */
|
||||
$str = "This is a really long string with no variables for the parser to find.";
|
||||
do_stuff("$str");
|
||||
|
||||
/* right */
|
||||
$str = 'This is a really long string with no variables for the parser to find.';
|
||||
do_stuff($str);
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Associative array keys:</B> In PHP, it's legal to use a literal string as
|
||||
a key to an associative array without quoting that string. We don't want to do
|
||||
this -- the string should always be quoted to avoid confusion. Note that this is
|
||||
only when we're using a literal, not when we're using a variable.
|
||||
<BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* wrong */
|
||||
$foo = $assoc_array[blah];
|
||||
|
||||
/* right */
|
||||
$foo = $assoc_array['blah'];
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Comments:</B> Each function should be preceded by a comment that tells a
|
||||
programmer everything they need to know to use that function. The meaning of
|
||||
every parameter, the expected input, and the output are required as a minimal
|
||||
comment. The function's behaviour in error conditions (and what those error
|
||||
conditions are) should also be present. Nobody should have to look at the actual
|
||||
source of a function in order to be able to call it with confidence in their own
|
||||
code. <BR><BR>In addition, commenting any tricky, obscure, or otherwise
|
||||
not-immediately-obvious code is clearly something we should be doing. Especially
|
||||
important to document are any assumptions your code makes, or preconditions for
|
||||
its proper operation. Any one of the developers should be able to look at any
|
||||
part of the application and figure out what's going on in a reasonable amount of
|
||||
time. </P>
|
||||
<P><B>Magic numbers:</B> Don't use them. Use named constants for any literal
|
||||
value other than obvious special cases. Basically, it's OK to check if an array
|
||||
has 0 elements by using the literal 0. It's not OK to assign some special
|
||||
meaning to a number and then use it everywhere as a literal. This hurts
|
||||
readability AND maintainability. Included in this guideline is that we should be
|
||||
using the constants TRUE and FALSE in place of the literals 1 and 0 -- even
|
||||
though they have the same values, it's more obvious what the actual logic is
|
||||
when you use the named constants. </P>
|
||||
<P><B>Shortcut operators:</B> The only shortcut operators that cause readability
|
||||
problems are the shortcut increment ($i++) and decrement ($j--) operators. These
|
||||
operators should not be used as part of an expression. They can, however, be
|
||||
used on their own line. Using them in expressions is just not worth the
|
||||
headaches when debugging. <BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* wrong */
|
||||
$array[++$i] = $j;
|
||||
$array[$i++] = $k;
|
||||
|
||||
|
||||
/* right */
|
||||
$i++;
|
||||
$array[$i] = $j;
|
||||
|
||||
$array[$i] = $k;
|
||||
$i++;
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Inline conditionals:</B> Inline conditionals should only be used to do
|
||||
very simple things. Preferably, they will only be used to do assignments, and
|
||||
not for function calls or anything complex at all. They can be harmful to
|
||||
readability if used incorrectly, so don't fall in love with saving typing by
|
||||
using them. <BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* Bad place to use them */
|
||||
(($i < $size) && ($j > $size)) ? do_stuff($foo) : do_stuff($bar);
|
||||
|
||||
|
||||
/* OK place to use them */
|
||||
$min = ($i < $j) ? $i : $j;
|
||||
</FONT></PRE>
|
||||
<P></P>
|
||||
<P><B>Don't use uninitialized variables.</B> for phpBB 2, we intend to use a
|
||||
higher level of run-time error reporting. This will mean that the use of an
|
||||
uninitialized variable will be reported as an error. This will come up most
|
||||
often when checking which HTML form variables were passed. These errors can be
|
||||
avoided by using the built-in isset() function to check whether a variable has
|
||||
been set. <BR><BR> Examples:<PRE><FONT size=+1>
|
||||
/* Old way */
|
||||
if ($forum) ...
|
||||
|
||||
|
||||
/* New way */
|
||||
if (isset($forum)) ...
|
||||
</FONT></PRE>
|
||||
<P></P><BR><BR><A href="#top">Return
|
||||
to top</A> </FONT></BODY></HTML>
|
BIN
phpBB/docs/header_bg.jpg
Normal file
BIN
phpBB/docs/header_bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 385 B |
BIN
phpBB/docs/header_left.jpg
Normal file
BIN
phpBB/docs/header_left.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
@ -87,13 +87,14 @@ class acm
|
||||
}
|
||||
$this->var_expires = array();
|
||||
|
||||
if (count($delete))
|
||||
if (sizeof($delete))
|
||||
{
|
||||
$sql = 'DELETE FROM ' . CACHE_TABLE . "
|
||||
WHERE var_name IN ('" . implode("', '", $delete) . "')";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
if (count($insert))
|
||||
|
||||
if (sizeof($insert))
|
||||
{
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ class acm
|
||||
|
||||
// Remove extra spaces and tabs
|
||||
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
||||
$query_id = 'Cache id #' . count($this->sql_rowset);
|
||||
$query_id = 'Cache id #' . sizeof($this->sql_rowset);
|
||||
|
||||
if (!file_exists($this->cache_dir . 'sql_' . md5($query) . ".$phpEx"))
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ function login_ldap(&$username, &$password)
|
||||
$search = @ldap_search($ldap, $config['ldap_base_dn'], $config['ldap_uid'] . '=' . $username, array($config['ldap_uid']));
|
||||
$result = @ldap_get_entries($ldap, $search);
|
||||
|
||||
if (is_array($result) && count($result) > 1)
|
||||
if (is_array($result) && sizeof($result) > 1)
|
||||
{
|
||||
if (@ldap_bind($ldap, $result[0]['dn'], $password))
|
||||
{
|
||||
|
@ -558,7 +558,7 @@ class sql_db
|
||||
{
|
||||
while ($row = $this->sql_fetchrow($result))
|
||||
{
|
||||
if (!$html_table && count($row))
|
||||
if (!$html_table && sizeof($row))
|
||||
{
|
||||
$html_table = TRUE;
|
||||
$html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
|
||||
|
@ -454,7 +454,7 @@ class sql_db
|
||||
{
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{
|
||||
if (!$html_table && count($row))
|
||||
if (!$html_table && sizeof($row))
|
||||
{
|
||||
$html_table = TRUE;
|
||||
$html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
|
||||
|
@ -148,7 +148,7 @@ class sql_db
|
||||
{
|
||||
while ($row = @sqlite_fetch_array($result, @sqlite_ASSOC))
|
||||
{
|
||||
if (!$html_table && count($row))
|
||||
if (!$html_table && sizeof($row))
|
||||
{
|
||||
$html_table = TRUE;
|
||||
$this->sql_report .= "<table width=100% border=1 cellpadding=2 cellspacing=1>\n";
|
||||
|
@ -110,7 +110,7 @@ function gen_rand_string($num_chars)
|
||||
list($usec, $sec) = explode(' ', microtime());
|
||||
mt_srand($sec * $usec);
|
||||
|
||||
$max_chars = count($chars) - 1;
|
||||
$max_chars = sizeof($chars) - 1;
|
||||
$rand_str = '';
|
||||
for ($i = 0; $i < $num_chars; $i++)
|
||||
{
|
||||
@ -505,7 +505,7 @@ function tz_select($default = '')
|
||||
global $sys_timezone, $user;
|
||||
|
||||
$tz_select = '';
|
||||
foreach ($user->lang['tz'] as $offset => $zone)
|
||||
foreach ($user->lang['tz']['zones'] as $offset => $zone)
|
||||
{
|
||||
if (is_numeric($offset))
|
||||
{
|
||||
@ -631,7 +631,7 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
|
||||
{
|
||||
global $config, $db, $user;
|
||||
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1804,7 +1804,7 @@ function page_header($page_title = '')
|
||||
$s_privmsg_new = false;
|
||||
|
||||
// Obtain number of new private messages if user is logged in
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
if ($user->data['user_new_privmsg'])
|
||||
{
|
||||
@ -1842,7 +1842,7 @@ function page_header($page_title = '')
|
||||
|
||||
// Which timezone?
|
||||
$tz = ($user->data['user_id'] != ANONYMOUS) ? strval(doubleval($user->data['user_timezone'])) : strval(doubleval($config['board_timezone']));
|
||||
|
||||
|
||||
// The following assigns all _common_ variables that may be used at any point
|
||||
// in a template.
|
||||
$template->assign_vars(array(
|
||||
@ -1889,10 +1889,10 @@ function page_header($page_title = '')
|
||||
'S_CONTENT_ENCODING' => $user->lang['ENCODING'],
|
||||
'S_CONTENT_DIR_LEFT' => $user->lang['LEFT'],
|
||||
'S_CONTENT_DIR_RIGHT' => $user->lang['RIGHT'],
|
||||
'S_TIMEZONE' => ($user->data['user_dst'] || ($user->data['user_id'] == ANONYMOUS && $config['board_dst'])) ? sprintf($user->lang['ALL_TIMES'], (($tz >= 0) ? '+' . $tz : $tz), $user->lang['tz']['dst']) : sprintf($user->lang['ALL_TIMES'], (($tz >= 0) ? '+' . $tz : $tz), ''),
|
||||
'S_DISPLAY_ONLINE_LIST' => (!empty($config['load_online'])) ? 1 : 0,
|
||||
'S_DISPLAY_SEARCH' => (!empty($config['load_search'])) ? 1 : 0,
|
||||
'S_DISPLAY_PM' => (!empty($config['allow_privmsg'])) ? 1 : 0,
|
||||
'S_TIMEZONE' => ($user->data['user_dst'] || ($user->data['user_id'] == ANONYMOUS && $config['board_dst'])) ? sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], $user->lang['tz']['dst']) : sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], ''),
|
||||
'S_DISPLAY_ONLINE_LIST' => ($config['load_online']) ? 1 : 0,
|
||||
'S_DISPLAY_SEARCH' => ($config['load_search']) ? 1 : 0,
|
||||
'S_DISPLAY_PM' => ($config['allow_privmsg'] && $user->data['is_registered']) ? 1 : 0,
|
||||
'S_DISPLAY_MEMBERLIST' => (isset($auth)) ? $auth->acl_get('u_viewprofile') : 0,
|
||||
'S_NEW_PM' => ($s_privmsg_new) ? 1 : 0,
|
||||
|
||||
@ -1957,7 +1957,7 @@ function page_footer()
|
||||
$template->assign_vars(array(
|
||||
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
|
||||
|
||||
'U_ACP' => ($auth->acl_get('a_') && $user->data['user_id'] != ANONYMOUS) ? "adm/index.$phpEx?sid=" . $user->data['session_id'] : '')
|
||||
'U_ACP' => ($auth->acl_get('a_') && $user->data['is_registered']) ? "adm/index.$phpEx?sid=" . $user->data['session_id'] : '')
|
||||
);
|
||||
|
||||
$template->display('body');
|
||||
|
@ -34,7 +34,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
// Display list of active topics for this category?
|
||||
$show_active = (isset($root_data['forum_flags']) && $root_data['forum_flags'] & 16) ? true : false;
|
||||
|
||||
if ($config['load_db_lastread'] && $user->data['user_id'] != ANONYMOUS)
|
||||
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
||||
{
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
@ -65,7 +65,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
$forum_ids = array($root_data['forum_id']);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($mark_read == 'forums' && $user->data['user_id'] != ANONYMOUS)
|
||||
if ($mark_read == 'forums' && $user->data['is_registered'])
|
||||
{
|
||||
if ($auth->acl_get('f_list', $row['forum_id']))
|
||||
{
|
||||
@ -157,7 +157,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
|
||||
$mark_time_forum = ($config['load_db_lastread']) ? $row['mark_time'] : ((isset($tracking_topics[$forum_id][0])) ? base_convert($tracking_topics[$forum_id][0], 36, 10) + $config['board_startdate'] : 0);
|
||||
|
||||
if ($mark_time_forum < $row['forum_last_post_time'] && $user->data['user_id'] != ANONYMOUS)
|
||||
if ($mark_time_forum < $row['forum_last_post_time'] && $user->data['is_registered'])
|
||||
{
|
||||
$forum_unread[$parent_id] = true;
|
||||
}
|
||||
@ -240,7 +240,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
}
|
||||
$subforums_list = implode(', ', $links);
|
||||
|
||||
$l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': ';
|
||||
$l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': ';
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
$l_moderator = $moderators_list = '';
|
||||
if ($display_moderators && !empty($forum_moderators[$forum_id]))
|
||||
{
|
||||
$l_moderator = (count($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS'];
|
||||
$l_moderator = (sizeof($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS'];
|
||||
$moderators_list = implode(', ', $forum_moderators[$forum_id]);
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ function topic_status(&$topic_row, $replies, $mark_time_topic, $mark_time_forum,
|
||||
$folder_new = 'folder_locked_new';
|
||||
}
|
||||
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$unread_topic = $new_votes = true;
|
||||
|
||||
|
@ -389,7 +389,7 @@ class jabber
|
||||
{
|
||||
$temp = $this->_split_incoming($incoming);
|
||||
|
||||
for ($a = 0; $a < count($temp); $a++)
|
||||
for ($a = 0, $size = sizeof($temp); $a < $size; $a++)
|
||||
{
|
||||
$this->packet_queue[] = $this->xmlize($temp[$a]);
|
||||
}
|
||||
@ -957,7 +957,7 @@ class make_xml extends jabber
|
||||
|
||||
$temp = @explode('/', $string);
|
||||
|
||||
for ($a = 0; $a < count($temp); $a++)
|
||||
for ($a = 0, $size = sizeof($temp); $a < $size; $a++)
|
||||
{
|
||||
$temp[$a] = preg_replace('#^[@]{1}([a-z0-9_]*)$#i', '["@"]["\1"]', $temp[$a]);
|
||||
$temp[$a] = preg_replace('#^([a-z0-9_]*)\(([0-9]*)\)$/i', '["\1"][\2]', $temp[$a]);
|
||||
@ -1001,7 +1001,7 @@ class make_xml extends jabber
|
||||
}
|
||||
elseif (is_array($value))
|
||||
{
|
||||
for ($a = 0; $a < count($value); $a++)
|
||||
for ($a = 0, $size = sizeof($value); $a < $size; $a++)
|
||||
{
|
||||
$text .= "<$key";
|
||||
|
||||
|
@ -473,7 +473,7 @@ class queue
|
||||
@set_time_limit(60);
|
||||
|
||||
$package_size = $data_ary['package_size'];
|
||||
$num_items = (count($data_ary['data']) < $package_size) ? count($data_ary['data']) : $package_size;
|
||||
$num_items = (sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size;
|
||||
|
||||
switch ($object)
|
||||
{
|
||||
@ -552,7 +552,7 @@ class queue
|
||||
}
|
||||
|
||||
// No more data for this object? Unset it
|
||||
if (!count($this->queue_data[$object]['data']))
|
||||
if (!sizeof($this->queue_data[$object]['data']))
|
||||
{
|
||||
unset($this->queue_data[$object]);
|
||||
}
|
||||
@ -602,10 +602,14 @@ class queue
|
||||
|
||||
foreach ($this->queue_data as $object => $data_ary)
|
||||
{
|
||||
if (count($this->data[$object]))
|
||||
if (isset($this->data[$object]) && sizeof($this->data[$object]))
|
||||
{
|
||||
$this->data[$object]['data'] = array_merge($data_ary['data'], $this->data[$object]['data']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->data[$object]['data'] = $data_ary['data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -868,7 +868,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . "
|
||||
AND w.user_id NOT IN ($sql_ignore_users)
|
||||
AND w.notify_status = 0
|
||||
AND u.user_id = w.user_id";
|
||||
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
||||
AND u.user_id = w.user_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
@ -900,7 +901,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
WHERE fw.forum_id = $forum_id
|
||||
AND fw.user_id NOT IN ($sql_ignore_users)
|
||||
AND fw.notify_status = 0
|
||||
AND u.user_id = fw.user_id";
|
||||
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
||||
AND u.user_id = fw.user_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
|
@ -133,7 +133,7 @@ function mcp_topic_view($id, $mode, $action, $url)
|
||||
'MESSAGE' => $message,
|
||||
'POST_ID' => $row['post_id'],
|
||||
|
||||
'POST_ICON_IMG' => ($row['post_time'] > $user->data['user_lastvisit'] && $user->data['user_id'] != ANONYMOUS) ? $user->img('icon_post_new', $user->lang['NEW_POST']) : $user->img('icon_post', $user->lang['POST']),
|
||||
'POST_ICON_IMG' => ($row['post_time'] > $user->data['user_lastvisit'] && $user->data['is_registered']) ? $user->img('icon_post_new', $user->lang['NEW_POST']) : $user->img('icon_post', $user->lang['POST']),
|
||||
|
||||
'S_CHECKBOX' => $s_checkbox,
|
||||
'S_POST_REPORTED' => ($row['post_reported']) ? true : false,
|
||||
|
@ -110,6 +110,9 @@ class session
|
||||
WHERE session_id = '" . $db->sql_escape($this->session_id) . "'";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$this->data['is_registered'] = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false;
|
||||
$this->data['is_bot'] = (!$this->data['is_registered'] && $this->data['user_id'] != ANONYMOUS) ? true : false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -135,7 +138,7 @@ class session
|
||||
$bot = false;
|
||||
|
||||
// Pull bot information from DB and loop through it
|
||||
$sql = 'SELECT user_id, bot_agent, bot_ip
|
||||
$sql = 'SELECT user_id, bot_agent, bot_ip
|
||||
FROM ' . BOTS_TABLE . '
|
||||
WHERE bot_active = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
@ -146,8 +149,8 @@ class session
|
||||
{
|
||||
$bot = $row['user_id'];
|
||||
}
|
||||
|
||||
if ($row['bot_ip'] && (!$row['bot_agent'] || $bot))
|
||||
|
||||
if ($row['bot_ip'] && (!$row['bot_agent'] || !$bot))
|
||||
{
|
||||
foreach (explode(',', $row['bot_ip']) as $bot_ip)
|
||||
{
|
||||
@ -276,6 +279,8 @@ class session
|
||||
|
||||
// Is there an existing session? If so, grab last visit time from that
|
||||
$this->data['session_last_visit'] = ($this->data['session_time']) ? $this->data['session_time'] : (($this->data['user_lastvisit']) ? $this->data['user_lastvisit'] : time());
|
||||
$this->data['is_registered'] = (!$bot && $user_id != ANONYMOUS) ? true : false;
|
||||
$this->data['is_bot'] = ($bot) ? true : false;
|
||||
|
||||
// Create or update the session
|
||||
$db->sql_return_on_error(true);
|
||||
@ -358,9 +363,18 @@ class session
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Reset some basic data immediately
|
||||
$this->session_id = $this->data['username'] = $this->data['user_permissions'] = '';
|
||||
$this->data['user_id'] = ANONYMOUS;
|
||||
$this->data['session_admin'] = 0;
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id = ' . ANONYMOUS;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$this->data = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$this->session_id = $this->data['session_id'] = '';
|
||||
$this->data['session_time'] = $this->data['session_admin'] = 0;
|
||||
|
||||
// Trigger EVENT_END_SESSION
|
||||
|
||||
|
@ -763,7 +763,7 @@ class template
|
||||
|
||||
$new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
|
||||
|
||||
array_splice($tokens, $is_arg_start, count($tokens), $new_tokens);
|
||||
array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
|
||||
|
||||
$i = $is_arg_start;
|
||||
|
||||
|
@ -441,7 +441,7 @@ class ucp_main extends module
|
||||
|
||||
if ($config['load_db_lastread'])
|
||||
{
|
||||
$mark_time_topic = ($user->data['user_id'] != ANONYMOUS) ? $row['mark_time'] : 0;
|
||||
$mark_time_topic = ($user->data['is_registered']) ? $row['mark_time'] : 0;
|
||||
$mark_time_forum = $row['forum_mark_time'];
|
||||
}
|
||||
else
|
||||
|
@ -45,7 +45,7 @@ class ucp_pm extends module
|
||||
{
|
||||
global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $SID, $config;
|
||||
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
trigger_error('NO_MESSAGE');
|
||||
}
|
||||
@ -89,7 +89,7 @@ class ucp_pm extends module
|
||||
case 'popup':
|
||||
|
||||
$l_new_message = '';
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
if ($user->data['user_new_privmsg'])
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ $lang += array(
|
||||
'ALL_FORUMS' => 'All Forums',
|
||||
'ALL_MESSAGES' => 'All Messages',
|
||||
'ALL_POSTS' => 'All Posts',
|
||||
'ALL_TIMES' => 'All times are GMT%1$s %2$s',
|
||||
'ALL_TIMES' => 'All times are %1$s %2$s',
|
||||
'ALL_TOPICS' => 'All Topics',
|
||||
'AND' => 'And',
|
||||
'ARE_WATCHING_FORUM' => 'You have subscribed to receive updates on this forum',
|
||||
@ -484,38 +484,72 @@ $lang += array(
|
||||
),
|
||||
|
||||
'tz' => array(
|
||||
'-12' => '[GMT-12] Eniwetok, Kwaialein',
|
||||
'-11' => '[GMT-11] Midway Island, Samoa',
|
||||
'-10' => '[GMT-10] Hawaii, Honolulu',
|
||||
'-9' => '[GMT-9] Alaska',
|
||||
'-8' => '[GMT-8] Anchorage, Los Angeles, San Francisco, Seattle',
|
||||
'-7' => '[GMT-7] Denver, Edmonton, Phoenix, Salt Lake City, Santa Fe',
|
||||
'-6' => '[GMT-6] Chicago, Guatamala, Mexico City, Saskatchewan East',
|
||||
'-5' => '[GMT-5] Bogota, Kingston, Lima, New York',
|
||||
'-4' => '[GMT-4] Caracas, Labrador, La Paz, Maritimes, Santiago',
|
||||
'-3.5' => '[GMT-3.5] Standard Time [Canada], Newfoundland',
|
||||
'-3' => '[GMT-3] Brazilia, Buenos Aires, Georgetown, Rio de Janero',
|
||||
'-2' => '[GMT-2] Mid-Atlantic',
|
||||
'-1' => '[GMT-1] Azores, Cape Verde Is.',
|
||||
'0' => '[GMT] Dublin, Edinburgh, Iceland, Lisbon, London, Casablanca',
|
||||
'1' => '[GMT+1] Amsterdam, Berlin, Bern, Brussells, Madrid, Paris, Rome, Oslo, Vienna',
|
||||
'2' => '[GMT+2] Athens, Bucharest, Harare, Helsinki, Israel, Istanbul',
|
||||
'3' => '[GMT+3] Ankara, Baghdad, Bahrain, Beruit, Kuwait, Moscow, Nairobi, Riyadh',
|
||||
'3.5' => '[GMT+3.5] Iran',
|
||||
'4' => '[GMT+4] Abu Dhabi, Kabul, Muscat, Tbilisi, Volgograd',
|
||||
'4.5' => '[GMT+4.5] Afghanistan',
|
||||
'5' => '[GMT+5] Calcutta, Madras, New Dehli',
|
||||
'5.5' => '[GMT+5.5] India',
|
||||
'6' => '[GMT+6] Almaty, Dhakar, Kathmandu',
|
||||
'6.5' => '[GMT+6.5] Rangoon',
|
||||
'7' => '[GMT+7] Bangkok, Hanoi, Jakarta, Phnom Penh',
|
||||
'8' => '[GMT+8] Beijing, Hong Kong, Kuala Lumpar, Manila, Perth, Singapore, Taipei',
|
||||
'9' => '[GMT+9] Osaka, Sapporo, Seoul, Tokyo, Yakutsk',
|
||||
'9.5' => '[GMT+9.5] Adelaide, Darwin',
|
||||
'10' => '[GMT+10) Brisbane, Canberra, Guam, Hobart, Melbourne, Port Moresby, Sydney',
|
||||
'11' => '[GMT+11] Magadan, New Caledonia, Solomon Is.',
|
||||
'12' => '[GMT+12] Auckland, Fiji, Kamchatka, Marshall Is., Suva, Wellington',
|
||||
'dst' => '[DST]'
|
||||
'-12' => 'GMT - 12 Hours',
|
||||
'-11' => 'GMT - 11 Hours',
|
||||
'-10' => 'GMT - 10 Hours',
|
||||
'-9' => 'GMT - 9 Hours',
|
||||
'-8' => 'GMT - 8 Hours',
|
||||
'-7' => 'GMT - 7 Hours',
|
||||
'-6' => 'GMT - 6 Hours',
|
||||
'-5' => 'GMT - 5 Hours',
|
||||
'-4' => 'GMT - 4 Hours',
|
||||
'-3.5' => 'GMT - 3.5 Hours',
|
||||
'-3' => 'GMT - 3 Hours',
|
||||
'-2' => 'GMT - 2 Hours',
|
||||
'-1' => 'GMT - 1 Hour',
|
||||
'0' => 'GMT',
|
||||
'1' => 'GMT + 1 Hour',
|
||||
'2' => 'GMT + 2 Hours',
|
||||
'3' => 'GMT + 3 Hours',
|
||||
'3.5' => 'GMT + 3.5 Hours',
|
||||
'4' => 'GMT + 4 Hours',
|
||||
'4.5' => 'GMT + 4.5 Hours',
|
||||
'5' => 'GMT + 5 Hours',
|
||||
'5.5' => 'GMT + 5.5 Hours',
|
||||
'6' => 'GMT + 6 Hours',
|
||||
'6.5' => 'GMT + 6.5 Hours',
|
||||
'7' => 'GMT + 7 Hours',
|
||||
'8' => 'GMT + 8 Hours',
|
||||
'9' => 'GMT + 9 Hours',
|
||||
'9.5' => 'GMT + 9.5 Hours',
|
||||
'10' => 'GMT + 10 Hours',
|
||||
'11' => 'GMT + 11 Hours',
|
||||
'12' => 'GMT + 12 Hours',
|
||||
'dst' => '[ DST ]',
|
||||
|
||||
'zones' => array(
|
||||
'-12' => '[GMT-12] Eniwetok, Kwaialein',
|
||||
'-11' => '[GMT-11] Midway Island, Samoa',
|
||||
'-10' => '[GMT-10] Hawaii, Honolulu',
|
||||
'-9' => '[GMT-9] Alaska',
|
||||
'-8' => '[GMT-8] Anchorage, Los Angeles, San Francisco, Seattle',
|
||||
'-7' => '[GMT-7] Denver, Edmonton, Phoenix, Salt Lake City, Santa Fe',
|
||||
'-6' => '[GMT-6] Chicago, Guatamala, Mexico City, Saskatchewan East',
|
||||
'-5' => '[GMT-5] Bogota, Kingston, Lima, New York',
|
||||
'-4' => '[GMT-4] Caracas, Labrador, La Paz, Maritimes, Santiago',
|
||||
'-3.5' => '[GMT-3.5] Standard Time [Canada], Newfoundland',
|
||||
'-3' => '[GMT-3] Brazilia, Buenos Aires, Georgetown, Rio de Janero',
|
||||
'-2' => '[GMT-2] Mid-Atlantic',
|
||||
'-1' => '[GMT-1] Azores, Cape Verde Is.',
|
||||
'0' => '[GMT] Dublin, Edinburgh, Iceland, Lisbon, London, Casablanca',
|
||||
'1' => '[GMT+1] Amsterdam, Berlin, Bern, Brussells, Madrid, Paris, Rome, Oslo, Vienna',
|
||||
'2' => '[GMT+2] Athens, Bucharest, Harare, Helsinki, Israel, Istanbul',
|
||||
'3' => '[GMT+3] Ankara, Baghdad, Bahrain, Beruit, Kuwait, Moscow, Nairobi, Riyadh',
|
||||
'3.5' => '[GMT+3.5] Iran',
|
||||
'4' => '[GMT+4] Abu Dhabi, Kabul, Muscat, Tbilisi, Volgograd',
|
||||
'4.5' => '[GMT+4.5] Afghanistan',
|
||||
'5' => '[GMT+5] Calcutta, Madras, New Dehli',
|
||||
'5.5' => '[GMT+5.5] India',
|
||||
'6' => '[GMT+6] Almaty, Dhakar, Kathmandu',
|
||||
'6.5' => '[GMT+6.5] Rangoon',
|
||||
'7' => '[GMT+7] Bangkok, Hanoi, Jakarta, Phnom Penh',
|
||||
'8' => '[GMT+8] Beijing, Hong Kong, Kuala Lumpar, Manila, Perth, Singapore, Taipei',
|
||||
'9' => '[GMT+9] Osaka, Sapporo, Seoul, Tokyo, Yakutsk',
|
||||
'9.5' => '[GMT+9.5] Adelaide, Darwin',
|
||||
'10' => '[GMT+10] Brisbane, Canberra, Guam, Hobart, Melbourne, Port Moresby, Sydney',
|
||||
'11' => '[GMT+11] Magadan, New Caledonia, Solomon Is.',
|
||||
'12' => '[GMT+12] Auckland, Fiji, Kamchatka, Marshall Is., Suva, Wellington'
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -314,14 +314,14 @@ if ($mode == 'approve' || $mode == 'disapprove')
|
||||
}
|
||||
|
||||
// Only Moderators can go beyond this point
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
login_box('', $user->lang['LOGIN_EXPLAIN_MCP']);
|
||||
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
if ($user->data['is_bot'])
|
||||
{
|
||||
redirect("index.$phpEx$SID");
|
||||
}
|
||||
|
||||
login_box('', $user->lang['LOGIN_EXPLAIN_MCP']);
|
||||
}
|
||||
|
||||
$quickmod = (isset($_REQUEST['quickmod'])) ? true : false;
|
||||
|
@ -245,7 +245,7 @@ if ($sql)
|
||||
$enable_magic_url = $drafts = false;
|
||||
|
||||
// User own some drafts?
|
||||
if ($user->data['user_id'] != ANONYMOUS && $auth->acl_get('u_savedrafts') && $mode != 'delete')
|
||||
if ($user->data['is_registered'] && $auth->acl_get('u_savedrafts') && $mode != 'delete')
|
||||
{
|
||||
$sql = 'SELECT draft_id
|
||||
FROM ' . DRAFTS_TABLE . '
|
||||
@ -265,7 +265,7 @@ if ($sql)
|
||||
}
|
||||
|
||||
// Notify user checkbox
|
||||
if ($mode != 'post' && $user->data['user_id'] != ANONYMOUS)
|
||||
if ($mode != 'post' && $user->data['is_registered'])
|
||||
{
|
||||
$sql = 'SELECT topic_id
|
||||
FROM ' . TOPICS_WATCH_TABLE . '
|
||||
@ -282,7 +282,7 @@ else
|
||||
|
||||
if (!$auth->acl_get('f_' . $mode, $forum_id) && $forum_type == FORUM_POST)
|
||||
{
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
trigger_error('USER_CANNOT_' . strtoupper($mode));
|
||||
}
|
||||
@ -328,7 +328,7 @@ if ($mode == 'edit')
|
||||
|
||||
|
||||
// Delete triggered ?
|
||||
if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['user_id'] != ANONYMOUS && $auth->acl_get('f_delete', $forum_id) && $post_id == $topic_last_post_id) || $auth->acl_get('m_delete', $forum_id)))
|
||||
if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $topic_last_post_id) || $auth->acl_get('m_delete', $forum_id)))
|
||||
{
|
||||
$s_hidden_fields = '<input type="hidden" name="p" value="' . $post_id . '" /><input type="hidden" name="f" value="' . $forum_id . '" /><input type="hidden" name="mode" value="delete" />';
|
||||
|
||||
@ -434,7 +434,7 @@ else if ($mode == 'bump')
|
||||
}
|
||||
|
||||
// Save Draft
|
||||
if ($save && $user->data['user_id'] != ANONYMOUS && $auth->acl_get('u_savedrafts'))
|
||||
if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts'))
|
||||
{
|
||||
$subject = request_var('subject', '', true);
|
||||
$subject = (!$subject && $mode != 'post') ? $topic_title : $subject;
|
||||
@ -467,7 +467,7 @@ if ($save && $user->data['user_id'] != ANONYMOUS && $auth->acl_get('u_savedrafts
|
||||
}
|
||||
|
||||
// Load Draft
|
||||
if ($draft_id && $user->data['user_id'] != ANONYMOUS && $auth->acl_get('u_savedrafts'))
|
||||
if ($draft_id && $user->data['is_registered'] && $auth->acl_get('u_savedrafts'))
|
||||
{
|
||||
$sql = 'SELECT draft_subject, draft_message
|
||||
FROM ' . DRAFTS_TABLE . "
|
||||
@ -517,7 +517,7 @@ if ($submit || $preview || $refresh)
|
||||
$enable_bbcode = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true;
|
||||
$enable_smilies = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true;
|
||||
$enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1;
|
||||
$enable_sig = (!$config['allow_sig']) ? false : ((isset($_POST['attach_sig']) && $user->data['user_id'] != ANONYMOUS) ? true : false);
|
||||
$enable_sig = (!$config['allow_sig']) ? false : ((isset($_POST['attach_sig']) && $user->data['is_registered']) ? true : false);
|
||||
|
||||
$notify = (isset($_POST['notify']));
|
||||
$topic_lock = (isset($_POST['lock_topic']));
|
||||
@ -620,7 +620,7 @@ if ($submit || $preview || $refresh)
|
||||
// Flood check
|
||||
$last_post_time = 0;
|
||||
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$last_post_time = $user->data['user_lastpost_time'];
|
||||
}
|
||||
@ -648,7 +648,7 @@ if ($submit || $preview || $refresh)
|
||||
}
|
||||
|
||||
// Validate username
|
||||
if (($username && $user->data['user_id'] == ANONYMOUS) || ($mode == 'edit' && $post_username))
|
||||
if (($username && !$user->data['is_registered']) || ($mode == 'edit' && $post_username))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
||||
@ -765,7 +765,7 @@ if ($submit || $preview || $refresh)
|
||||
{
|
||||
// Lock/Unlock Topic
|
||||
$change_topic_status = $topic_status;
|
||||
$perm_lock_unlock = ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['user_id'] != ANONYMOUS && $user->data['user_id'] == $topic_poster));
|
||||
$perm_lock_unlock = ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_poster));
|
||||
|
||||
if ($topic_status == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock)
|
||||
{
|
||||
@ -784,7 +784,7 @@ if ($submit || $preview || $refresh)
|
||||
AND topic_moved_id = 0";
|
||||
$db->sql_query($sql);
|
||||
|
||||
$user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['user_id'] != ANONYMOUS && $user->data['user_id'] == $topic_poster) ? 'USER_' : '';
|
||||
$user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_poster) ? 'USER_' : '';
|
||||
|
||||
add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), $topic_title);
|
||||
}
|
||||
@ -1005,7 +1005,7 @@ $bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : (($config['allow_
|
||||
$smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : (($config['allow_smilies']) ? !$user->optionget('smilies') : 1);
|
||||
$urls_checked = (isset($enable_urls)) ? !$enable_urls : 0;
|
||||
$sig_checked = $enable_sig;
|
||||
$notify_checked = (isset($notify)) ? $notify : ((!$notify_set) ? (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_notify'] : 0) : 1);
|
||||
$notify_checked = (isset($notify)) ? $notify : ((!$notify_set) ? (($user->data['is_registered']) ? $user->data['user_notify'] : 0) : 1);
|
||||
$lock_topic_checked = (isset($topic_lock)) ? $topic_lock : (($topic_status == ITEM_LOCKED) ? 1 : 0);
|
||||
$lock_post_checked = (isset($post_lock)) ? $post_lock : $post_edit_locked;
|
||||
|
||||
@ -1090,7 +1090,7 @@ $template->assign_vars(array(
|
||||
'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']),
|
||||
'S_EDIT_POST' => ($mode == 'edit'),
|
||||
'S_EDIT_REASON' => ($mode == 'edit' && $user->data['user_id'] != $poster_id),
|
||||
'S_DISPLAY_USERNAME' => ($user->data['user_id'] == ANONYMOUS || ($mode == 'edit' && $post_username)),
|
||||
'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_username)),
|
||||
'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
|
||||
'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $topic_last_post_id && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
|
||||
'S_HTML_ALLOWED' => $html_status,
|
||||
@ -1099,18 +1099,18 @@ $template->assign_vars(array(
|
||||
'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '',
|
||||
'S_SMILIES_ALLOWED' => $smilies_status,
|
||||
'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '',
|
||||
'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id) && $config['allow_sig'] && $user->data['user_id'] != ANONYMOUS),
|
||||
'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id) && $config['allow_sig'] && $user->data['is_registered']),
|
||||
'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '',
|
||||
'S_NOTIFY_ALLOWED' => ($user->data['user_id'] != ANONYMOUS),
|
||||
'S_NOTIFY_ALLOWED' => ($user->data['is_registered']),
|
||||
'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '',
|
||||
'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['user_id'] != ANONYMOUS && $user->data['user_id'] == $topic_poster))),
|
||||
'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_poster))),
|
||||
'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '',
|
||||
'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)),
|
||||
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',
|
||||
'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '',
|
||||
'S_TYPE_TOGGLE' => $topic_type_toggle,
|
||||
'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $user->data['user_id'] != ANONYMOUS),
|
||||
'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $user->data['user_id'] != ANONYMOUS && $drafts),
|
||||
'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered']),
|
||||
'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $drafts),
|
||||
'S_FORM_ENCTYPE' => $form_enctype,
|
||||
|
||||
'S_POST_ACTION' => $s_action,
|
||||
@ -1355,7 +1355,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
'enable_smilies' => $data['enable_smilies'],
|
||||
'enable_magic_url' => $data['enable_urls'],
|
||||
'enable_sig' => $data['enable_sig'],
|
||||
'post_username' => ($user->data['user_id'] == ANONYMOUS) ? stripslashes($username) : '',
|
||||
'post_username' => (!$user->data['is_registered']) ? stripslashes($username) : '',
|
||||
'post_subject' => $subject,
|
||||
'post_text' => $data['message'],
|
||||
'post_checksum' => $data['message_md5'],
|
||||
@ -1437,7 +1437,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
'icon_id' => $data['icon_id'],
|
||||
'topic_approved' => ($auth->acl_get('f_moderate', $data['forum_id']) && !$auth->acl_get('m_approve')) ? 0 : 1,
|
||||
'topic_title' => $subject,
|
||||
'topic_first_poster_name' => ($user->data['user_id'] == ANONYMOUS && $username) ? stripslashes($username) : $user->data['username'],
|
||||
'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? stripslashes($username) : $user->data['username'],
|
||||
'topic_type' => $topic_type,
|
||||
'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0,
|
||||
'topic_attachment' => (isset($data['filename_data']) && sizeof($data['filename_data'])) ? 1 : 0
|
||||
@ -1537,7 +1537,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
'topic_last_post_id' => $data['post_id'],
|
||||
'topic_last_post_time' => $current_time,
|
||||
'topic_last_poster_id' => (int) $user->data['user_id'],
|
||||
'topic_last_poster_name'=> ($user->data['user_id'] == ANONYMOUS && $username) ? stripslashes($username) : $user->data['username']
|
||||
'topic_last_poster_name'=> (!$user->data['is_registered'] && $username) ? stripslashes($username) : $user->data['username']
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ $user->setup('mcp');
|
||||
$id = request_var('p', request_var('pm', 0));
|
||||
$report_post = (request_var('p', 0)) ? true : false;
|
||||
$reason_id = request_var('reason_id', 0);
|
||||
$user_notify = (!empty($_REQUEST['notify']) && $user->data['user_id'] != ANONYMOUS) ? true : false;
|
||||
$user_notify = (!empty($_REQUEST['notify']) && $user->data['is_registered']) ? true : false;
|
||||
$report_text = request_var('report_text', '');
|
||||
|
||||
if (!$id)
|
||||
@ -100,7 +100,7 @@ $result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
// A report exists, extract $row if we're going to display the form
|
||||
if ($reason_id)
|
||||
@ -295,7 +295,7 @@ $template->assign_vars(array(
|
||||
'S_REPORT_ACTION' => "{$phpbb_root_path}report.$phpEx$SID&$u_report" . (($report_id) ? "&report_id=$report_id" : ''),
|
||||
|
||||
'S_NOTIFY' => (!empty($user_notify)) ? true : false,
|
||||
'S_CAN_NOTIFY' => ($user->data['user_id'] == ANONYMOUS) ? false : true,
|
||||
'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false,
|
||||
'S_REPORT_POST' => $report_post)
|
||||
);
|
||||
|
||||
|
@ -248,7 +248,7 @@ switch ($mode)
|
||||
break;
|
||||
|
||||
case 'register':
|
||||
if ($user->data['user_id'] != ANONYMOUS || isset($_REQUEST['not_agreed']))
|
||||
if ($user->data['is_registered'] || isset($_REQUEST['not_agreed']))
|
||||
{
|
||||
redirect("index.$phpEx$SID");
|
||||
}
|
||||
@ -263,7 +263,7 @@ switch ($mode)
|
||||
break;
|
||||
|
||||
case 'login':
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
redirect("index.$phpEx$SID");
|
||||
}
|
||||
@ -322,9 +322,9 @@ switch ($mode)
|
||||
|
||||
|
||||
// Only registered users can go beyond this point
|
||||
if ($user->data['user_id'] == ANONYMOUS || $user->data['user_type'] == USER_INACTIVE || $user->data['user_type'] == USER_IGNORE)
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_bot'])
|
||||
{
|
||||
redirect("index.$phpEx$SID");
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ if (!$forum_id)
|
||||
}
|
||||
|
||||
// Grab appropriate forum data
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
if (!$user->data['is_registered'])
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
@ -85,7 +85,7 @@ if (!($forum_data = $db->sql_fetchrow($result)))
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($user->data['user_id'] == ANONYMOUS && $config['load_db_lastread'])
|
||||
if (!$user->data['is_registered'] && $config['load_db_lastread'])
|
||||
{
|
||||
$forum_data['mark_time'] = 0;
|
||||
}
|
||||
@ -117,7 +117,7 @@ if ($forum_data['forum_password'])
|
||||
}
|
||||
|
||||
// Redirect to login upon emailed notification links
|
||||
if (isset($_GET['e']) && $user->data['user_id'] == ANONYMOUS)
|
||||
if (isset($_GET['e']) && !$user->data['is_registered'])
|
||||
{
|
||||
login_box('', $user->lang['LOGIN_NOTIFY_FORUM']);
|
||||
}
|
||||
@ -158,7 +158,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
|
||||
// Handle marking posts
|
||||
if ($mark_read == 'topics')
|
||||
{
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
markread('mark', $forum_id);
|
||||
}
|
||||
@ -307,11 +307,11 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql_from = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? '(' . TOPICS_TABLE . ' t LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . '))' : TOPICS_TABLE . ' t ';
|
||||
$sql_from = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['is_registered']) ? '(' . TOPICS_TABLE . ' t LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . '))' : TOPICS_TABLE . ' t ';
|
||||
}
|
||||
|
||||
$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
|
||||
$sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? ', tt.mark_type, tt.mark_time' : '';
|
||||
$sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['is_registered']) ? ', tt.mark_type, tt.mark_time' : '';
|
||||
|
||||
if ($forum_data['forum_type'] == FORUM_POST)
|
||||
{
|
||||
@ -397,7 +397,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
|
||||
|
||||
if ($config['load_db_lastread'])
|
||||
{
|
||||
$mark_time_topic = ($user->data['user_id'] != ANONYMOUS) ? $row['mark_time'] : 0;
|
||||
$mark_time_topic = ($user->data['is_registered']) ? $row['mark_time'] : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -480,7 +480,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
|
||||
// on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find
|
||||
// any it updates the forum last read cookie. This requires that the user visit the forum
|
||||
// after reading a topic
|
||||
if ($forum_data['forum_type'] == FORUM_POST && $user->data['user_id'] != ANONYMOUS && count($topic_list) && $mark_forum_read)
|
||||
if ($forum_data['forum_type'] == FORUM_POST && $user->data['is_registered'] && sizeof($topic_list) && $mark_forum_read)
|
||||
{
|
||||
markread('mark', $forum_id);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ while ($row = $db->sql_fetchrow($result))
|
||||
'FORUM_LOCATION'=> $location,
|
||||
'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '',
|
||||
|
||||
'U_USER_PROFILE' => ($row['user_type'] != USER_IGNORE && $row['user_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'] : '',
|
||||
'U_USER_PROFILE' => (($row['user_type'] == USER_NORMAL || $row['user_type'] == USER_FOUNDER) && $row['user_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'] : '',
|
||||
'U_USER_IP' => "{$phpbb_root_path}viewonline.$phpEx$SID" . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&s=' . $row['session_id'] : '') . "&mode=lookup&sg=$show_guests&start=$start&sk=$sort_key&sd=$sort_dir",
|
||||
'U_WHOIS' => "{$phpbb_root_path}viewonline.$phpEx$SID&mode=whois&s=" . $row['session_id'],
|
||||
'U_FORUM_LOCATION' => $phpbb_root_path . $location_url,
|
||||
|
@ -49,7 +49,7 @@ if ($view && !$post_id)
|
||||
{
|
||||
if ($view == 'unread')
|
||||
{
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
if ($config['load_db_lastread'])
|
||||
{
|
||||
@ -152,7 +152,7 @@ else
|
||||
$extra_fields = (!$post_id) ? '' : ', COUNT(p2.post_id) AS prev_posts';
|
||||
$order_sql = (!$post_id) ? '' : 'GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password ORDER BY p.post_id ASC';
|
||||
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
@ -199,7 +199,7 @@ extract($topic_data);
|
||||
$topic_replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_replies_real : $topic_replies;
|
||||
unset($topic_replies_real);
|
||||
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
if ($config['load_db_lastread'])
|
||||
{
|
||||
@ -351,13 +351,13 @@ $viewtopic_url = "{$phpbb_root_path}viewtopic.$phpEx$SID&f=$forum_id&t=$
|
||||
// Are we watching this topic?
|
||||
$s_watching_topic = $s_watching_topic_img = array();
|
||||
$s_watching_topic['link'] = $s_watching_topic['title'] = '';
|
||||
if ($config['email_enable'] && $config['allow_topic_notify'] && $user->data['user_id'] != ANONYMOUS)
|
||||
if ($config['email_enable'] && $config['allow_topic_notify'] && $user->data['is_registered'])
|
||||
{
|
||||
watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $user->data['user_id'], $topic_id, $notify_status, $start);
|
||||
}
|
||||
|
||||
// Bookmarks
|
||||
if ($config['allow_bookmarks'] && $user->data['user_id'] != ANONYMOUS && request_var('bookmark', 0))
|
||||
if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0))
|
||||
{
|
||||
if (!$bookmarked)
|
||||
{
|
||||
@ -417,7 +417,7 @@ gen_forum_auth_level('topic', $forum_id);
|
||||
|
||||
// Quick mod tools
|
||||
$topic_mod = '';
|
||||
$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['user_id'] != ANONYMOUS && $user->data['user_id'] == $topic_poster)) ? (($topic_status == ITEM_UNLOCKED) ? '<option value="lock">' . $user->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . $user->lang['UNLOCK_TOPIC'] . '</option>') : '';
|
||||
$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_poster)) ? (($topic_status == ITEM_UNLOCKED) ? '<option value="lock">' . $user->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . $user->lang['UNLOCK_TOPIC'] . '</option>') : '';
|
||||
$topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '<option value="delete_topic">' . $user->lang['DELETE_TOPIC'] . '</option>' : '';
|
||||
$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '<option value="move">' . $user->lang['MOVE_TOPIC'] . '</option>' : '';
|
||||
$topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '<option value="split">' . $user->lang['SPLIT_TOPIC'] . '</option>' : '';
|
||||
@ -504,8 +504,8 @@ $template->assign_vars(array(
|
||||
'U_WATCH_TOPIC' => $s_watching_topic['link'],
|
||||
'L_WATCH_TOPIC' => $s_watching_topic['title'],
|
||||
|
||||
'U_BOOKMARK_TOPIC' => ($user->data['user_id'] != ANONYMOUS && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1' : '',
|
||||
'L_BOOKMARK_TOPIC' => ($user->data['user_id'] != ANONYMOUS && $config['allow_bookmarks'] && $bookmarked) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'],
|
||||
'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1' : '',
|
||||
'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $bookmarked) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'],
|
||||
|
||||
'U_POST_NEW_TOPIC' => "posting.$phpEx$SID&mode=post&f=$forum_id",
|
||||
'U_POST_REPLY_TOPIC' => "posting.$phpEx$SID&mode=reply&f=$forum_id&t=$topic_id",
|
||||
@ -531,7 +531,7 @@ if (!empty($poll_start))
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$cur_voted_id = array();
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$sql = 'SELECT poll_option_id
|
||||
FROM ' . POLL_VOTES_TABLE . '
|
||||
@ -587,7 +587,7 @@ if (!empty($poll_start))
|
||||
AND topic_id = $topic_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$sql = 'INSERT INTO ' . POLL_VOTES_TABLE . " (topic_id, poll_option_id, vote_user_id, vote_user_ip)
|
||||
VALUES ($topic_id, $option, " . $user->data['user_id'] . ", '$user->ip')";
|
||||
@ -605,7 +605,7 @@ if (!empty($poll_start))
|
||||
AND topic_id = $topic_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['is_registered'])
|
||||
{
|
||||
$sql = 'DELETE FROM ' . POLL_VOTES_TABLE . "
|
||||
WHERE topic_id = $topic_id
|
||||
@ -616,7 +616,7 @@ if (!empty($poll_start))
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->data['user_id'] == ANONYMOUS)
|
||||
if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot'])
|
||||
{
|
||||
$user->set_cookie('poll_' . $topic_id, implode(',', $voted_id), time() + 31536000);
|
||||
}
|
||||
@ -1251,7 +1251,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||
'EDIT_REASON' => $row['post_edit_reason'],
|
||||
'BUMPED_MESSAGE'=> $l_bumped_by,
|
||||
|
||||
'MINI_POST_IMG' => ($user->data['user_id'] != ANONYMOUS && $row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? $user->img('icon_post_new', 'NEW_POST') : $user->img('icon_post', 'POST'),
|
||||
'MINI_POST_IMG' => ($user->data['is_registered'] && $row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? $user->img('icon_post_new', 'NEW_POST') : $user->img('icon_post', 'POST'),
|
||||
'POST_ICON_IMG' => (!empty($row['icon_id'])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||
'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'],
|
||||
'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('btn_online', 'ONLINE') : $user->img('btn_offline', 'OFFLINE')),
|
||||
@ -1286,7 +1286,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_', $forum_id)) ? TRUE : FALSE,
|
||||
'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'],
|
||||
'S_FRIEND' => ($row['friend']) ? true : false,
|
||||
'S_UNREAD_POST' => ($user->data['user_id'] != ANONYMOUS && $row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? true : false,
|
||||
'S_UNREAD_POST' => ($user->data['is_registered'] && $row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? true : false,
|
||||
'S_FIRST_UNREAD' => ($unread_post_id == $row['post_id']) ? true : false,
|
||||
'S_CUSTOM_FIELDS' => (sizeof($cp_row)) ? true : false
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user