mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Various changes, and tests ... marking/tracking is not complete ... tinkering, changing, etc. still to be done ... it's just I've made numerous and various changes to different files so a commit really is due
git-svn-id: file:///svn/phpbb/trunk@3953 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
4e43cb5153
commit
5362625eab
18 changed files with 739 additions and 586 deletions
|
@ -98,8 +98,8 @@ define('POST_STICKY', 1);
|
||||||
define('POST_ANNOUNCE', 2);
|
define('POST_ANNOUNCE', 2);
|
||||||
|
|
||||||
// Lastread types
|
// Lastread types
|
||||||
define('LASTREAD_NORMAL', 0); // not used at the moment
|
define('TRACK_NORMAL', 0); // not used at the moment
|
||||||
define('LASTREAD_POSTED', 1);
|
define('TRACK_POSTED', 1);
|
||||||
|
|
||||||
// Private messaging
|
// Private messaging
|
||||||
define('PRIVMSGS_READ_MAIL', 0);
|
define('PRIVMSGS_READ_MAIL', 0);
|
||||||
|
@ -136,11 +136,11 @@ define('DISALLOW_TABLE', $table_prefix.'disallow'); //
|
||||||
define('EXTENSIONS_TABLE', $table_prefix.'extensions');
|
define('EXTENSIONS_TABLE', $table_prefix.'extensions');
|
||||||
define('EXTENSION_GROUPS_TABLE', $table_prefix.'extension_groups');
|
define('EXTENSION_GROUPS_TABLE', $table_prefix.'extension_groups');
|
||||||
define('FORUMS_TABLE', $table_prefix.'forums');
|
define('FORUMS_TABLE', $table_prefix.'forums');
|
||||||
|
define('FORUMS_TRACK_TABLE', $table_prefix.'forums_marking');
|
||||||
define('FORUMS_WATCH_TABLE', $table_prefix.'forums_watch');
|
define('FORUMS_WATCH_TABLE', $table_prefix.'forums_watch');
|
||||||
define('GROUPS_TABLE', $table_prefix.'groups');
|
define('GROUPS_TABLE', $table_prefix.'groups');
|
||||||
define('GROUPS_MODERATOR_TABLE', $table_prefix.'groups_moderator');
|
define('GROUPS_MODERATOR_TABLE', $table_prefix.'groups_moderator');
|
||||||
define('ICONS_TABLE', $table_prefix.'icons');
|
define('ICONS_TABLE', $table_prefix.'icons');
|
||||||
define('TOPICS_TRACK_TABLE', $table_prefix.'topics_marking');
|
|
||||||
define('LOG_ADMIN_TABLE', $table_prefix.'log_admin');
|
define('LOG_ADMIN_TABLE', $table_prefix.'log_admin');
|
||||||
define('LOG_MOD_TABLE', $table_prefix.'log_moderator');
|
define('LOG_MOD_TABLE', $table_prefix.'log_moderator');
|
||||||
define('MODERATOR_TABLE', $table_prefix.'moderator_cache');
|
define('MODERATOR_TABLE', $table_prefix.'moderator_cache');
|
||||||
|
@ -162,7 +162,7 @@ define('STYLES_TPL_TABLE', $table_prefix.'styles_template');
|
||||||
define('STYLES_CSS_TABLE', $table_prefix.'styles_theme');
|
define('STYLES_CSS_TABLE', $table_prefix.'styles_theme');
|
||||||
define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset');
|
define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset');
|
||||||
define('TOPICS_TABLE', $table_prefix.'topics');
|
define('TOPICS_TABLE', $table_prefix.'topics');
|
||||||
define('TOPICS_PREFETCH_TABLE', $table_prefix.'topics_prefetch');
|
define('TOPICS_TRACK_TABLE', $table_prefix.'topics_marking');
|
||||||
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
|
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
|
||||||
define('UCP_MODULES_TABLE', $table_prefix.'ucp_modules');
|
define('UCP_MODULES_TABLE', $table_prefix.'ucp_modules');
|
||||||
define('USER_GROUP_TABLE', $table_prefix.'user_group');
|
define('USER_GROUP_TABLE', $table_prefix.'user_group');
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
if(!defined("SQL_LAYER"))
|
if (!defined("SQL_LAYER"))
|
||||||
{
|
{
|
||||||
|
|
||||||
define("SQL_LAYER","postgresql");
|
define("SQL_LAYER","postgresql");
|
||||||
|
@ -42,33 +42,33 @@ class sql_db
|
||||||
{
|
{
|
||||||
$this->connect_string = "";
|
$this->connect_string = "";
|
||||||
|
|
||||||
if( $sqluser )
|
if ($sqluser)
|
||||||
{
|
{
|
||||||
$this->connect_string .= "user=$sqluser ";
|
$this->connect_string .= "user=$sqluser ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $sqlpassword )
|
if ($sqlpassword)
|
||||||
{
|
{
|
||||||
$this->connect_string .= "password=$sqlpassword ";
|
$this->connect_string .= "password=$sqlpassword ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $sqlserver )
|
if ($sqlserver)
|
||||||
{
|
{
|
||||||
if( ereg(":", $sqlserver) )
|
if (ereg(":", $sqlserver))
|
||||||
{
|
{
|
||||||
list($sqlserver, $sqlport) = split(":", $sqlserver);
|
list($sqlserver, $sqlport) = split(":", $sqlserver);
|
||||||
$this->connect_string .= "host=$sqlserver port=$sqlport ";
|
$this->connect_string .= "host=$sqlserver port=$sqlport ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( $sqlserver != "localhost" )
|
if ($sqlserver != "localhost")
|
||||||
{
|
{
|
||||||
$this->connect_string .= "host=$sqlserver ";
|
$this->connect_string .= "host=$sqlserver ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $database )
|
if ($database)
|
||||||
{
|
{
|
||||||
$this->dbname = $database;
|
$this->dbname = $database;
|
||||||
$this->connect_string .= "dbname=$database";
|
$this->connect_string .= "dbname=$database";
|
||||||
|
@ -76,9 +76,9 @@ class sql_db
|
||||||
|
|
||||||
$this->persistency = $persistency;
|
$this->persistency = $persistency;
|
||||||
|
|
||||||
$this->db_connect_id = ( $this->persistency ) ? pg_pconnect($this->connect_string) : pg_connect($this->connect_string);
|
$this->db_connect_id = ($this->persistency) ? pg_pconnect($this->connect_string) : pg_connect($this->connect_string);
|
||||||
|
|
||||||
return ( $this->db_connect_id ) ? $this->db_connect_id : false;
|
return ($this->db_connect_id) ? $this->db_connect_id : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -86,17 +86,17 @@ class sql_db
|
||||||
//
|
//
|
||||||
function sql_close()
|
function sql_close()
|
||||||
{
|
{
|
||||||
if( $this->db_connect_id )
|
if ($this->db_connect_id)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Commit any remaining transactions
|
// Commit any remaining transactions
|
||||||
//
|
//
|
||||||
if( $this->in_transaction )
|
if ($this->in_transaction)
|
||||||
{
|
{
|
||||||
@pg_exec($this->db_connect_id, "COMMIT");
|
@pg_exec($this->db_connect_id, "COMMIT");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $this->query_result )
|
if ($this->query_result)
|
||||||
{
|
{
|
||||||
@pg_freeresult($this->query_result);
|
@pg_freeresult($this->query_result);
|
||||||
}
|
}
|
||||||
|
@ -118,30 +118,30 @@ class sql_db
|
||||||
// Remove any pre-existing queries
|
// Remove any pre-existing queries
|
||||||
//
|
//
|
||||||
unset($this->query_result);
|
unset($this->query_result);
|
||||||
if( $query != "" )
|
if ($query != "")
|
||||||
{
|
{
|
||||||
$this->num_queries++;
|
$this->num_queries++;
|
||||||
|
|
||||||
$query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $query);
|
$query = preg_replace("/LIMIT ([0-9]+),([ 0-9]+)/", "LIMIT \\2 OFFSET \\1", $query);
|
||||||
|
|
||||||
if( $transaction == BEGIN_TRANSACTION && !$this->in_transaction )
|
if ($transaction == BEGIN_TRANSACTION && !$this->in_transaction)
|
||||||
{
|
{
|
||||||
$this->in_transaction = TRUE;
|
$this->in_transaction = TRUE;
|
||||||
|
|
||||||
if( !@pg_exec($this->db_connect_id, "BEGIN") )
|
if (!@pg_exec($this->db_connect_id, "BEGIN"))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->query_result = @pg_exec($this->db_connect_id, $query);
|
$this->query_result = @pg_exec($this->db_connect_id, $query);
|
||||||
if( $this->query_result )
|
if ($this->query_result)
|
||||||
{
|
{
|
||||||
if( $transaction == END_TRANSACTION )
|
if ($transaction == END_TRANSACTION)
|
||||||
{
|
{
|
||||||
$this->in_transaction = FALSE;
|
$this->in_transaction = FALSE;
|
||||||
|
|
||||||
if( !@pg_exec($this->db_connect_id, "COMMIT") )
|
if (!@pg_exec($this->db_connect_id, "COMMIT"))
|
||||||
{
|
{
|
||||||
@pg_exec($this->db_connect_id, "ROLLBACK");
|
@pg_exec($this->db_connect_id, "ROLLBACK");
|
||||||
return false;
|
return false;
|
||||||
|
@ -158,7 +158,7 @@ class sql_db
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( $this->in_transaction )
|
if ($this->in_transaction)
|
||||||
{
|
{
|
||||||
@pg_exec($this->db_connect_id, "ROLLBACK");
|
@pg_exec($this->db_connect_id, "ROLLBACK");
|
||||||
}
|
}
|
||||||
|
@ -169,11 +169,11 @@ class sql_db
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( $transaction == END_TRANSACTION && $this->in_transaction )
|
if ($transaction == END_TRANSACTION && $this->in_transaction)
|
||||||
{
|
{
|
||||||
$this->in_transaction = FALSE;
|
$this->in_transaction = FALSE;
|
||||||
|
|
||||||
if( !@pg_exec($this->db_connect_id, "COMMIT") )
|
if (!@pg_exec($this->db_connect_id, "COMMIT"))
|
||||||
{
|
{
|
||||||
@pg_exec($this->db_connect_id, "ROLLBACK");
|
@pg_exec($this->db_connect_id, "ROLLBACK");
|
||||||
return false;
|
return false;
|
||||||
|
@ -189,56 +189,56 @@ class sql_db
|
||||||
//
|
//
|
||||||
function sql_numrows($query_id = 0)
|
function sql_numrows($query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( $query_id ) ? @pg_numrows($query_id) : false;
|
return ($query_id) ? @pg_numrows($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_numfields($query_id = 0)
|
function sql_numfields($query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( $query_id ) ? @pg_numfields($query_id) : false;
|
return ($query_id) ? @pg_numfields($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_fieldname($offset, $query_id = 0)
|
function sql_fieldname($offset, $query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( $query_id ) ? @pg_fieldname($query_id, $offset) : false;
|
return ($query_id) ? @pg_fieldname($query_id, $offset) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_fieldtype($offset, $query_id = 0)
|
function sql_fieldtype($offset, $query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( $query_id ) ? @pg_fieldtype($query_id, $offset) : false;
|
return ($query_id) ? @pg_fieldtype($query_id, $offset) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_fetchrow($query_id = 0)
|
function sql_fetchrow($query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($query_id)
|
if ($query_id)
|
||||||
{
|
{
|
||||||
$this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]);
|
$this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]);
|
||||||
|
|
||||||
if( $this->row )
|
if ($this->row)
|
||||||
{
|
{
|
||||||
$this->rownum[$query_id]++;
|
$this->rownum[$query_id]++;
|
||||||
return $this->row;
|
return $this->row;
|
||||||
|
@ -250,18 +250,18 @@ class sql_db
|
||||||
|
|
||||||
function sql_fetchrowset($query_id = 0)
|
function sql_fetchrowset($query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $query_id )
|
if ($query_id)
|
||||||
{
|
{
|
||||||
unset($this->rowset[$query_id]);
|
unset($this->rowset[$query_id]);
|
||||||
unset($this->row[$query_id]);
|
unset($this->row[$query_id]);
|
||||||
$this->rownum[$query_id] = 0;
|
$this->rownum[$query_id] = 0;
|
||||||
|
|
||||||
while( $this->rowset = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC) )
|
while($this->rowset = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC))
|
||||||
{
|
{
|
||||||
$result[] = $this->rowset;
|
$result[] = $this->rowset;
|
||||||
$this->rownum[$query_id]++;
|
$this->rownum[$query_id]++;
|
||||||
|
@ -275,51 +275,25 @@ class sql_db
|
||||||
|
|
||||||
function sql_fetchfield($field, $row_offset=-1, $query_id = 0)
|
function sql_fetchfield($field, $row_offset=-1, $query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $query_id )
|
|
||||||
{
|
|
||||||
if( $row_offset != -1 )
|
|
||||||
{
|
|
||||||
$this->row = @pg_fetch_array($query_id, $row_offset, PGSQL_ASSOC);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( $this->rownum[$query_id] )
|
|
||||||
{
|
|
||||||
$this->row = @pg_fetch_array($query_id, $this->rownum[$query_id]-1, PGSQL_ASSOC);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->row = @pg_fetch_array($query_id, $this->rownum[$query_id], PGSQL_ASSOC);
|
|
||||||
|
|
||||||
if( $this->row )
|
|
||||||
{
|
|
||||||
$this->rownum[$query_id]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->row[$field];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_rowseek($offset, $query_id = 0)
|
function sql_rowseek($offset, $query_id = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$query_id)
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $query_id )
|
if ($query_id)
|
||||||
{
|
{
|
||||||
if( $offset > -1 )
|
if ($offset > -1)
|
||||||
{
|
{
|
||||||
$this->rownum[$query_id] = $offset;
|
$this->rownum[$query_id] = $offset;
|
||||||
return true;
|
return true;
|
||||||
|
@ -337,20 +311,20 @@ class sql_db
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
|
|
||||||
if($query_id && $this->last_query_text[$query_id] != "")
|
if ($query_id && $this->last_query_text[$query_id] != "")
|
||||||
{
|
{
|
||||||
if( preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->last_query_text[$query_id], $tablename) )
|
if (preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->last_query_text[$query_id], $tablename))
|
||||||
{
|
{
|
||||||
$query = "SELECT currval('" . $tablename[1] . "_id_seq') AS last_value";
|
$query = "SELECT currval('" . $tablename[1] . "_id_seq') AS last_value";
|
||||||
$temp_q_id = @pg_exec($this->db_connect_id, $query);
|
$temp_q_id = @pg_exec($this->db_connect_id, $query);
|
||||||
if( !$temp_q_id )
|
if (!$temp_q_id)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_result = @pg_fetch_array($temp_q_id, 0, PGSQL_ASSOC);
|
$temp_result = @pg_fetch_array($temp_q_id, 0, PGSQL_ASSOC);
|
||||||
|
|
||||||
return ( $temp_result ) ? $temp_result['last_value'] : false;
|
return ($temp_result) ? $temp_result['last_value'] : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,27 +333,27 @@ class sql_db
|
||||||
|
|
||||||
function sql_affectedrows($query_id = 0)
|
function sql_affectedrows($query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( $query_id ) ? @pg_cmdtuples($query_id) : false;
|
return ($query_id) ? @pg_cmdtuples($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_freeresult($query_id = 0)
|
function sql_freeresult($query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( $query_id ) ? @pg_freeresult($query_id) : false;
|
return ($query_id) ? @pg_freeresult($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sql_error($query_id = 0)
|
function sql_error($query_id = 0)
|
||||||
{
|
{
|
||||||
if( !$query_id )
|
if (!$query_id)
|
||||||
{
|
{
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,122 +528,158 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $post_id = 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default tracking type
|
||||||
|
$type = TRACK_NORMAL;
|
||||||
|
$current_time = time();
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'mark':
|
case 'mark':
|
||||||
|
if ($config['load_db_lastread'])
|
||||||
|
{
|
||||||
// Mark one forum as read.
|
// Mark one forum as read.
|
||||||
// Do this by inserting a record with -$forum_id in the 'forum_id' field.
|
// Do this by inserting a record with -$forum_id in the 'forum_id' field.
|
||||||
$sql = "SELECT forum_id
|
|
||||||
FROM " . TOPICS_TRACK_TABLE . "
|
|
||||||
WHERE user_id = " . $user->data['user_id'] . "
|
|
||||||
AND forum_id = -$forum_id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if ($db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
// User has marked this topic as read before: Update the record
|
// User has marked this topic as read before: Update the record
|
||||||
$sql = "UPDATE " . TOPICS_TRACK_TABLE . "
|
$db->sql_return_on_error = true;
|
||||||
SET mark_time = " . time() . "
|
|
||||||
|
$sql = 'UPDATE ' . FORUMS_TRACK_TABLE . "
|
||||||
|
SET mark_time = $current_time
|
||||||
WHERE user_id = " . $user->data['user_id'] . "
|
WHERE user_id = " . $user->data['user_id'] . "
|
||||||
AND forum_id = -$forum_id";
|
AND forum_id = $forum_id";
|
||||||
$db->sql_query($sql);
|
if (!$db->sql_query($sql) || !$db->sql_affectedrows())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// User is marking this forum for the first time.
|
// User is marking this forum for the first time.
|
||||||
// Insert dummy topic_id to satisfy PRIMARY KEY (user_id, topic_id)
|
// Insert dummy topic_id to satisfy PRIMARY KEY (user_id, topic_id)
|
||||||
// dummy id = -forum_id
|
// dummy id = -forum_id
|
||||||
$sql = "INSERT INTO " . TOPICS_TRACK_TABLE . "
|
$sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . ' (user_id, forum_id, mark_time)
|
||||||
(user_id, forum_id, topic_id, mark_time)
|
VALUES (' . $user->data['user_id'] . ", $forum_id, $current_time)";
|
||||||
VALUES
|
|
||||||
(" . $user->data['user_id'] . ", -$forum_id, -$forum_id, " . time() . ")";
|
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db->sql_return_on_error = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tracking_forums = (isset($_COOKIE[$config['cookie_name'] . '_f'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_f']) : array();
|
||||||
|
$tracking_forums[$forum_id] = time();
|
||||||
|
|
||||||
|
setcookie($config['cookie_name'] . '_f', serialize($tracking_forums), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
||||||
|
unset($tracking_forums);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'markall':
|
case 'markall':
|
||||||
// Mark all forums as read.
|
// Mark all forums as read
|
||||||
|
|
||||||
|
if ($config['load_db_lastread'])
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . FORUMS_TRACK_TABLE . '
|
||||||
|
SET mark_time = ' . $current_time . '
|
||||||
|
WHERE user_id = ' . $user->data['user_id'];
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tracking_forums = array();
|
||||||
|
}
|
||||||
|
|
||||||
// Select all forum_id's that are not yet in the lastread table
|
// Select all forum_id's that are not yet in the lastread table
|
||||||
$sql = "SELECT f.forum_id
|
switch (SQL_LAYER)
|
||||||
FROM " . FORUMS_TABLE . " f
|
{
|
||||||
LEFT JOIN (" . TOPICS_TRACK_TABLE . " lr ON (
|
case 'oracle':
|
||||||
lr.user_id = " . $user->data['user_id'] . "
|
break;
|
||||||
AND f.forum_id = -lr.forum_id))
|
|
||||||
WHERE lr.forum_id IS NULL";
|
default:
|
||||||
|
$sql = ($config['load_db_lastread']) ? 'SELECT f.forum_id FROM (' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)) WHERE ft.forum_id IS NULL' : 'SELECT forum_id FROM ' . FORUMS_TABLE;
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$db->sql_return_on_error = true;
|
||||||
if ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
// Some forum_id's are missing. We are not taking into account
|
|
||||||
// the auth data, even forums the user can't see are marked as read.
|
|
||||||
$sql = "INSERT INTO " . TOPICS_TRACK_TABLE . "
|
|
||||||
(user_id, forum_id, topic_id, lastread_time)
|
|
||||||
VALUES";
|
|
||||||
$forum_insert = array();
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// Insert dummy topic_id to satisfy PRIMARY KEY
|
if ($config['load_db_lastread'])
|
||||||
// dummy id = -forum_id
|
{
|
||||||
$forum_insert[] = "(" . $user->data['user_id'] . ", -".$row['forum_id'].", -".$row['forum_id'].", " . time() . ")";
|
$sql = '';
|
||||||
|
// Some forum_id's are missing. We are not taking into account
|
||||||
|
// the auth data, even forums the user can't see are marked as read.
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'mysql':
|
||||||
|
case 'mysql4':
|
||||||
|
$sql .= (($sql != '') ? ', ' : '') . '(' . $user->data['user_id'] . ', ' . $row['forum_id'] . ", $current_time)";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'mssql':
|
||||||
|
$sql = (($sql != '') ? ' UNION ALL ' : '') . ' SELECT ' . $user->data['user_id'] . ', ' . $row['forum_id'] . ", $current_time";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . ' (user_id, forum_id, mark_time)
|
||||||
|
VALUES (' . $user->data['user_id'] . ', ' . $row['forum_id'] . ", $current_time)";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
$sql = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sql != '')
|
||||||
|
{
|
||||||
|
$sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . ' (user_id, forum_id, mark_time)
|
||||||
|
VALUES ' . $sql;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tracking_forums[$row['forum_id']] = $current_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while ($row = $db->sql_fetchrow($result));
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$forum_insert = implode(",\n", $forum_insert);
|
$db->sql_return_on_error = false;
|
||||||
$sql .= $forum_insert;
|
|
||||||
|
|
||||||
$db->sql_query($sql);
|
if (!$config['load_db_lastread'])
|
||||||
|
{
|
||||||
|
setcookie($config['cookie_name'] . '_f', serialize($tracking_forums), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
||||||
|
unset($tracking_forums);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark all forums as read
|
|
||||||
$sql = "UPDATE " . TOPICS_TRACK_TABLE . "
|
|
||||||
SET mark_time = " . time() . "
|
|
||||||
WHERE user_id = " . $user->data['user_id'] . "
|
|
||||||
AND forum_id < 0";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'post':
|
case 'post':
|
||||||
// Mark a topic as read and mark it as a topic where the user has made a post.
|
// Mark a topic as read and mark it as a topic where the user has made a post.
|
||||||
$type = 1;
|
$type = TRACK_POSTED;
|
||||||
|
|
||||||
case 'topic':
|
case 'topic':
|
||||||
// Mark a topic as read.
|
// Mark a topic as read
|
||||||
|
if ($config['load_db_lastread'] || ($config['load_db_track'] && $type == TRACK_POSTED))
|
||||||
// Type:
|
{
|
||||||
// 0 = Normal topic
|
$sql = 'UPDATE ' . TOPICS_TRACK_TABLE . "
|
||||||
// 1 = user made a post in this topic
|
SET mark_type = $type, mark_time = " . time() . "
|
||||||
$type_update = (isset($type) && $type = 1) ? 'mark_type = 1,' : '';
|
|
||||||
$sql = "UPDATE " . TOPICS_TRACK_TABLE . "
|
|
||||||
SET $type_update forum_id = $forum_id, mark_time = " . time() . "
|
|
||||||
WHERE topic_id = $topic_id
|
WHERE topic_id = $topic_id
|
||||||
AND user_id = " . $user->data['user_id'];
|
AND user_id = " . $user->data['user_id'];
|
||||||
$result = $db->sql_query($sql);
|
if (!$db->sql_query($sql) || !$db->sql_affectedrows())
|
||||||
|
|
||||||
if (!$db->sql_affectedrows($result))
|
|
||||||
{
|
{
|
||||||
// Couldn't update. Row probably doesn't exist. Insert one.
|
$sql = 'INSERT INTO ' . TOPICS_TRACK_TABLE . ' (user_id, topic_id, mark_type, mark_time)
|
||||||
if(isset($type) && $type = 1)
|
VALUES (' . $user->data['user_id'] . ", $topic_id, $type, " . time() . ")";
|
||||||
{
|
|
||||||
$type_name = 'mark_type, ';
|
|
||||||
$type_value = '1, ';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$type_name = '';
|
|
||||||
$type_value = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . TOPICS_TRACK_TABLE . "
|
|
||||||
(user_id, topic_id, forum_id, $type_name mark_time)
|
|
||||||
VALUES
|
|
||||||
(" . $user->data['user_id'] . ", $topic_id, $forum_id, $type_value " . time() . ")";
|
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$config['load_db_lastread'])
|
||||||
|
{
|
||||||
|
$tracking = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array();
|
||||||
|
$tracking[$topic_id] = $current_time;
|
||||||
|
|
||||||
|
setcookie($config['cookie_name'] . '_t', serialize($tracking), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
||||||
|
unset($tracking);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Pagination routine, generates page number sequence
|
// Pagination routine, generates page number sequence
|
||||||
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
|
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
|
||||||
{
|
{
|
||||||
|
@ -848,6 +884,16 @@ function redirect($url)
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Meta refresh assignment
|
||||||
|
function meta_refresh($time, $url)
|
||||||
|
{
|
||||||
|
global $template;
|
||||||
|
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '">')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Generate login box or verify password
|
// Generate login box or verify password
|
||||||
function login_box($s_action, $s_hidden_fields = '', $login_explain = '')
|
function login_box($s_action, $s_hidden_fields = '', $login_explain = '')
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
function display_forums($root_data = '', $display_moderators = TRUE)
|
function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
{
|
{
|
||||||
global $db, $template, $auth, $user;
|
global $config, $db, $template, $auth, $user;
|
||||||
global $config, $phpEx, $SID, $forum_moderators;
|
global $phpEx, $SID, $forum_moderators;
|
||||||
|
|
||||||
$visible_forums = 0;
|
$visible_forums = 0;
|
||||||
|
|
||||||
|
@ -38,20 +38,25 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
|
|
||||||
if ($config['load_db_lastread'] && $user->data['user_id'] != ANONYMOUS)
|
if ($config['load_db_lastread'] && $user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
$lastread_select = ", lr.lastread_time ";
|
switch (SQL_LAYER)
|
||||||
/* $sql_lastread = 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . '
|
{
|
||||||
AND ft.forum_id = f.forum_id)';*/
|
case 'oracle':
|
||||||
$sql_lastread = 'LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . $user->data['user_id'] . '
|
break;
|
||||||
AND tt.forum_id IN (f.forum_id, -f.forum_id)
|
|
||||||
AND tt.lastread_time >= f.forum_last_post_time)';
|
default:
|
||||||
$sql_where .= ' GROUP BY f.forum_id';
|
$sql_lastread = 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . '
|
||||||
|
AND ft.forum_id = f.forum_id)';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$lastread_select = ', ft.mark_time ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$lastread_select = '';
|
$lastread_select = '';
|
||||||
$sql_lastread = '';
|
$sql_lastread = '';
|
||||||
|
|
||||||
// Cookie based tracking
|
$tracking_forums = (isset($_COOKIE[$config['cookie_name'] . '_f'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_f']) : array();
|
||||||
|
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT f.* $lastread_select
|
$sql = "SELECT f.* $lastread_select
|
||||||
|
@ -82,57 +87,101 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$auth->acl_get('f_list', $row['forum_id']))
|
$forum_id = $row['forum_id'];
|
||||||
|
|
||||||
|
if (!$auth->acl_get('f_list', $forum_id))
|
||||||
{
|
{
|
||||||
// if the user does not have permissions to list this forum, skip everything until next branch
|
// if the user does not have permissions to list this forum, skip everything until next branch
|
||||||
|
|
||||||
$right_id = $row['right_id'];
|
$right_id = $row['right_id'];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['parent_id'] == $root_data['forum_id'])
|
if ($row['parent_id'] == $root_data['forum_id'] || $row['parent_id'] == $branch_root_id)
|
||||||
{
|
{
|
||||||
// Direct child
|
// Direct child
|
||||||
$forum_rows[] = $row;
|
$parent_id = $forum_id;
|
||||||
$parent_id = $row['forum_id'];
|
$forum_rows[$forum_id] = $row;
|
||||||
$forum_ids[] = $row['forum_id'];
|
$forum_ids[] = $forum_id;
|
||||||
|
|
||||||
if (!$row['forum_postable'])
|
if (!$row['forum_postable'] && $row['parent_id'] == $root_data['forum_id'])
|
||||||
{
|
{
|
||||||
$branch_root_id = $row['forum_id'];
|
$branch_root_id = $forum_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($row['parent_id'] == $branch_root_id)
|
|
||||||
{
|
|
||||||
// Forum directly under a category
|
|
||||||
$forum_rows[] = $row;
|
|
||||||
$parent_id = $row['forum_id'];
|
|
||||||
$forum_ids[] = $row['forum_id'];
|
|
||||||
}
|
|
||||||
elseif ($row['forum_postable'])
|
elseif ($row['forum_postable'])
|
||||||
{
|
{
|
||||||
if ($row['display_on_index'])
|
if ($row['display_on_index'])
|
||||||
{
|
{
|
||||||
$subforums[$parent_id][$row['forum_id']]['forum_name'] = $row['forum_name'];
|
$subforums[$parent_id][$forum_id] = $row['forum_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (!empty($forum_unread[$forum_id]))
|
||||||
|
{
|
||||||
|
$forum_unread[$parent_id] = true;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isset($forum_unread[$parent_id]))
|
||||||
|
{
|
||||||
|
$forum_unread[$parent_id] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$subforums[$parent_id][$row['forum_id']]['unread_count'] = $row['unread_count'];
|
$check_time = (!$config['load_db_lastread']) ? $tracking_forums[$forum_id] : $row['mark_time'];
|
||||||
$subforums[$parent_id][$row['forum_id']]['forum_last_post_time'] = $row['forum_last_post_time'];
|
if ($check_time < $row['forum_last_post_time'] && $user->data['user_id'] != ANONYMOUS)
|
||||||
|
{
|
||||||
|
$forum_unread[$parent_id] = true;
|
||||||
|
}
|
||||||
|
|
||||||
$subforums[$parent_id][$row['forum_id']]['forum_id'] = $row['forum_id'];
|
|
||||||
$subforums[$parent_id][$row['forum_id']]['forum_last_post_id'] = $row['forum_last_post_id'];
|
// Show most recent last post info on parent if we're a subforum
|
||||||
$subforums[$parent_id][$row['forum_id']]['forum_last_post_time'] = $row['forum_last_post_time'];
|
if (isset($forum_rows[$parent_id]) && $row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time'])
|
||||||
$subforums[$parent_id][$row['forum_id']]['forum_last_poster_name'] = $row['forum_last_poster_name'];
|
{
|
||||||
$subforums[$parent_id][$row['forum_id']]['forum_last_poster_id'] = $row['forum_last_poster_id'];
|
$forum_rows[$parent_id]['forum_last_post_id'] = $row['forum_last_post_id'];
|
||||||
|
$forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time'];
|
||||||
|
$forum_rows[$parent_id]['forum_last_poster_id'] = $row['forum_last_poster_id'];
|
||||||
|
$forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name'];
|
||||||
|
$forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$forum_rows[$forum_id]['forum_id_last_post'] = $row['forum_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult();
|
$db->sql_freeresult();
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($config['load_db_lastread'])
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$forum_unread = array();
|
||||||
|
$sql = "SELECT forum_id, topic_id, topic_last_post_time
|
||||||
|
FROM " . TOPICS_TABLE . "
|
||||||
|
WHERE topic_last_post_time > " . ((sizeof($tracking_forums)) ? min($tracking_forums) : time() - 86400) . "
|
||||||
|
$sql_forum_track;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
if (($tracking_forums[$row['forum_id']] > $tracking_topics[$row['topic_id']] &&
|
||||||
|
$row['topic_last_post_time'] > $tracking_forums[$row['forum_id']]) ||
|
||||||
|
($tracking_topics[$row['topic_id']] > $tracking_forums[$row['forum_id']] &&
|
||||||
|
$row['topic_last_post_time'] > $tracking_topics[$row['topic_id']]))
|
||||||
|
{
|
||||||
|
$forum_unread[$row['forum_id']] = $row['topic_last_post_time'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ($display_moderators)
|
if ($display_moderators)
|
||||||
{
|
{
|
||||||
get_moderators($forum_moderators, $forum_ids);
|
get_moderators($forum_moderators, $forum_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$root_id = $root_data['forum_id'];
|
$root_id = $root_data['forum_id'];
|
||||||
foreach ($forum_rows as $row)
|
foreach ($forum_rows as $row)
|
||||||
{
|
{
|
||||||
|
@ -161,40 +210,23 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
}
|
}
|
||||||
|
|
||||||
$visible_forums++;
|
$visible_forums++;
|
||||||
|
|
||||||
$forum_id = $row['forum_id'];
|
$forum_id = $row['forum_id'];
|
||||||
|
|
||||||
//
|
|
||||||
$unread_topics = ($user->data['user_id'] != ANONYMOUS && $row['unread_count'] < $row['forum_last_post_time']) ? 1 : 0;
|
|
||||||
|
|
||||||
//
|
// Generate list of subforums if we need to
|
||||||
if (isset($subforums[$forum_id]))
|
if (isset($subforums[$forum_id]))
|
||||||
{
|
{
|
||||||
|
|
||||||
$alist = array();
|
$alist = array();
|
||||||
foreach ($subforums[$forum_id] as $sub_forum_id => $subforum_row)
|
foreach ($subforums[$forum_id] as $sub_forum_id => $subforum_name)
|
||||||
{
|
{
|
||||||
$unread_topics += ($user->data['user_id'] != ANONYMOUS && $subforum_row['unread_count'] < $subforum_row['forum_last_post_time']) ? 1 : 0;
|
if (!empty($subforum_name))
|
||||||
|
|
||||||
if (!empty($subforum_row['forum_name']))
|
|
||||||
{
|
{
|
||||||
$alist[$sub_forum_id] = $subforum_row['forum_name'];
|
$alist[$sub_forum_id] = $subforum_name;
|
||||||
}
|
|
||||||
|
|
||||||
if ($subforum_row['forum_last_post_time'] > $row['forum_last_post_time'])
|
|
||||||
{
|
|
||||||
$row['forum_last_post_time'] = $subforum_row['forum_last_post_time'];
|
|
||||||
$row['forum_last_post_id'] = $subforum_row['forum_last_post_id'];
|
|
||||||
$row['forum_last_poster_name'] = $subforum_row['forum_last_poster_name'];
|
|
||||||
$row['forum_last_poster_id'] = $subforum_row['forum_last_poster_id'];
|
|
||||||
$row['forum_id_last_post'] = $subforum_row['forum_id'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof($alist))
|
if (sizeof($alist))
|
||||||
{
|
{
|
||||||
@natsort($alist);
|
|
||||||
|
|
||||||
$links = array();
|
$links = array();
|
||||||
foreach ($alist as $subforum_id => $subforum_name)
|
foreach ($alist as $subforum_id => $subforum_name)
|
||||||
{
|
{
|
||||||
|
@ -205,18 +237,18 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
$l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': ';
|
$l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$folder_image = ($unread_topics) ? 'sub_forum_new' : 'sub_forum';
|
$folder_image = ($forum_unread[$forum_id]) ? 'sub_forum_new' : 'sub_forum';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$folder_image = ($unread_topics) ? 'forum_new' : 'forum';
|
$folder_image = ($forum_unread[$forum_id]) ? 'forum_new' : 'forum';
|
||||||
$row['forum_id_last_post'] = $row['forum_id'];
|
|
||||||
|
|
||||||
$subforums_list = '';
|
$subforums_list = '';
|
||||||
$l_subforums = '';
|
$l_subforums = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
// Which folder should we display?
|
||||||
if ($row['forum_status'] == ITEM_LOCKED)
|
if ($row['forum_status'] == ITEM_LOCKED)
|
||||||
{
|
{
|
||||||
$folder_image = 'forum_locked';
|
$folder_image = 'forum_locked';
|
||||||
|
@ -224,10 +256,11 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$folder_alt = ($unread_topics) ? 'NEW_POSTS' : 'NO_NEW_POSTS';
|
$folder_alt = ($forum_unread[$forum_id]) ? 'NEW_POSTS' : 'NO_NEW_POSTS';
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
// Create last post link information, if appropriate
|
||||||
if ($row['forum_last_post_id'])
|
if ($row['forum_last_post_id'])
|
||||||
{
|
{
|
||||||
$last_post_time = $user->format_date($row['forum_last_post_time']);
|
$last_post_time = $user->format_date($row['forum_last_post_time']);
|
||||||
|
@ -242,7 +275,8 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
$last_post_time = $last_poster = $last_poster_url = $last_post_url = '';
|
$last_post_time = $last_poster = $last_poster_url = $last_post_url = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
// Output moderator listing ... if applicable
|
||||||
$l_moderator = $moderators_list = '';
|
$l_moderator = $moderators_list = '';
|
||||||
if ($display_moderators && !empty($forum_moderators[$forum_id]))
|
if ($display_moderators && !empty($forum_moderators[$forum_id]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,16 +36,14 @@ $auth->acl($user->data);
|
||||||
// Handle marking posts
|
// Handle marking posts
|
||||||
if ($mark_read == 'forums')
|
if ($mark_read == 'forums')
|
||||||
{
|
{
|
||||||
if ($userdata['user_id'])
|
if ($userdata['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
markread('markall');
|
markread('markall');
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
meta_refresh(3, "index.$phpEx$SID");
|
||||||
'META' => '<meta http-equiv="refresh" content="3;url=' . "index.$phpEx$SID" . '">')
|
|
||||||
);
|
|
||||||
|
|
||||||
$message = $user->lang['Forums_marked_read'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a> ');
|
$message = $user->lang['FORUMS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a> ');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,19 @@ CREATE TABLE phpbb_forums (
|
||||||
KEY forum_last_post_id (forum_last_post_id)
|
KEY forum_last_post_id (forum_last_post_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Table structure for table 'phpbb_forums_marking'
|
||||||
|
#
|
||||||
|
CREATE TABLE phpbb_forums_marking (
|
||||||
|
user_id mediumint(9) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
|
forum_id mediumint(9) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
|
mark_time int(11) DEFAULT '0' NOT NULL,
|
||||||
|
PRIMARY KEY (user_id, forum_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Table structure for table 'phpbb_forums_watch'
|
# Table structure for table 'phpbb_forums_watch'
|
||||||
|
@ -744,7 +757,6 @@ CREATE TABLE phpbb_topics (
|
||||||
#
|
#
|
||||||
CREATE TABLE phpbb_topics_marking (
|
CREATE TABLE phpbb_topics_marking (
|
||||||
user_id mediumint(9) UNSIGNED DEFAULT '0' NOT NULL,
|
user_id mediumint(9) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
forum_id mediumint(9) UNSIGNED DEFAULT '0' NOT NULL,
|
|
||||||
topic_id mediumint(9) UNSIGNED DEFAULT '0' NOT NULL,
|
topic_id mediumint(9) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
mark_type tinyint(4) DEFAULT '0' NOT NULL,
|
mark_type tinyint(4) DEFAULT '0' NOT NULL,
|
||||||
mark_time int(11) DEFAULT '0' NOT NULL,
|
mark_time int(11) DEFAULT '0' NOT NULL,
|
||||||
|
|
|
@ -71,6 +71,7 @@ $lang = array(
|
||||||
|
|
||||||
'GO' => 'Go',
|
'GO' => 'Go',
|
||||||
'JUMP_TO' => 'Jump to',
|
'JUMP_TO' => 'Jump to',
|
||||||
|
'SEARCH_FOR' => 'Search for',
|
||||||
'SUBMIT' => 'Submit',
|
'SUBMIT' => 'Submit',
|
||||||
'RESET' => 'Reset',
|
'RESET' => 'Reset',
|
||||||
'CANCEL' => 'Cancel',
|
'CANCEL' => 'Cancel',
|
||||||
|
@ -107,6 +108,7 @@ $lang = array(
|
||||||
'REPLY_WITH_QUOTE' => 'Reply with quote',
|
'REPLY_WITH_QUOTE' => 'Reply with quote',
|
||||||
|
|
||||||
|
|
||||||
|
'RETURN_INDEX' => 'Click %sHere%s to return to the index',
|
||||||
'RETURN_TOPIC' => 'Click %sHere%s to return to the topic',
|
'RETURN_TOPIC' => 'Click %sHere%s to return to the topic',
|
||||||
'RETURN_FORUM' => 'Click %sHere%s to return to the forum',
|
'RETURN_FORUM' => 'Click %sHere%s to return to the forum',
|
||||||
'RETURN_LOGIN' => 'Click %sHere%s to try again',
|
'RETURN_LOGIN' => 'Click %sHere%s to try again',
|
||||||
|
@ -115,7 +117,7 @@ $lang = array(
|
||||||
'VIEW_MESSAGE' => 'Click %sHere%s to view your message',
|
'VIEW_MESSAGE' => 'Click %sHere%s to view your message',
|
||||||
|
|
||||||
|
|
||||||
'Information' => 'Information',
|
'INFORMATION' => 'Information',
|
||||||
|
|
||||||
|
|
||||||
'BOARD_DISABLE' => 'Sorry but this board is currently unavailable',
|
'BOARD_DISABLE' => 'Sorry but this board is currently unavailable',
|
||||||
|
@ -227,21 +229,23 @@ $lang = array(
|
||||||
|
|
||||||
'Private_Message' => 'Private Message',
|
'Private_Message' => 'Private Message',
|
||||||
'Private_Messages' => 'Private Messages',
|
'Private_Messages' => 'Private Messages',
|
||||||
'WHO_IS_ONLINE' => 'Who is Online',
|
|
||||||
'MARK_FORUMS_READ' => 'Mark all forums read',
|
|
||||||
'Forums_marked_read' => 'All forums have been marked read',
|
|
||||||
'View_forum' => 'View Forum',
|
'View_forum' => 'View Forum',
|
||||||
|
|
||||||
|
'WHO_IS_ONLINE' => 'Who is Online',
|
||||||
'DISPLAY_TOPICS' => 'Display topics from previous',
|
'DISPLAY_TOPICS' => 'Display topics from previous',
|
||||||
'ALL_TOPICS' => 'All Topics',
|
'ALL_TOPICS' => 'All Topics',
|
||||||
|
|
||||||
'VIEW_TOPIC_ANNOUNCEMENT'=> '<b>Announcement:</b>',
|
'VIEW_TOPIC_ANNOUNCEMENT'=> 'Announcement:',
|
||||||
'VIEW_TOPIC_STICKY' => '<b>Sticky:</b>',
|
'VIEW_TOPIC_STICKY' => 'Sticky:',
|
||||||
'VIEW_TOPIC_MOVED' => '<b>Moved:</b>',
|
'VIEW_TOPIC_MOVED' => 'Moved:',
|
||||||
'VIEW_TOPIC_POLL' => '<b>Poll:</b>',
|
'VIEW_TOPIC_POLL' => 'Poll:',
|
||||||
'VIEW_TOPIC_LOCKED' => '<b>Locked:</b>',
|
'VIEW_TOPIC_LOCKED' => 'Locked:',
|
||||||
|
|
||||||
|
'MARK_FORUMS_READ' => 'Mark all forums read',
|
||||||
|
'FORUMS_MARKED' => 'All forums have been marked read',
|
||||||
|
|
||||||
'MARK_TOPICS_READ' => 'Mark all topics read',
|
'MARK_TOPICS_READ' => 'Mark all topics read',
|
||||||
'Topics_marked_read' => 'The topics for this forum have now been marked read',
|
'TOPICS_MARKED' => 'The topics for this forum have now been marked read',
|
||||||
|
|
||||||
|
|
||||||
'RULES_POST_CAN' => 'You <b>can</b> post new topics in this forum',
|
'RULES_POST_CAN' => 'You <b>can</b> post new topics in this forum',
|
||||||
|
@ -273,7 +277,7 @@ $lang = array(
|
||||||
'NO_POST' => 'The requested post does not exist.',
|
'NO_POST' => 'The requested post does not exist.',
|
||||||
'NO_USER' => 'The requested user does not exist.',
|
'NO_USER' => 'The requested user does not exist.',
|
||||||
'NO_GROUP' => 'The requested usergroup does not exist.',
|
'NO_GROUP' => 'The requested usergroup does not exist.',
|
||||||
|
'NO_UNREAD_POSTS' => 'There are no new unread posts for this topic.',
|
||||||
|
|
||||||
'LOGIN_VIEWFORUM' => 'The board administrator requires you to be registered and logged in to view this forum.',
|
'LOGIN_VIEWFORUM' => 'The board administrator requires you to be registered and logged in to view this forum.',
|
||||||
'STOP_WATCHING_FORUM' => 'Stop watching this forum',
|
'STOP_WATCHING_FORUM' => 'Stop watching this forum',
|
||||||
|
@ -291,6 +295,7 @@ $lang = array(
|
||||||
'EMAIL_TOPIC' => 'Email to friend',
|
'EMAIL_TOPIC' => 'Email to friend',
|
||||||
'VIEW_NEXT_TOPIC' => 'View next topic',
|
'VIEW_NEXT_TOPIC' => 'View next topic',
|
||||||
'VIEW_PREVIOUS_TOPIC' => 'View previous topic',
|
'VIEW_PREVIOUS_TOPIC' => 'View previous topic',
|
||||||
|
'VIEW_UNREAD_POST' => 'View first unread topic',
|
||||||
|
|
||||||
'NO_NEWER_TOPICS' => 'There are no newer topics in this forum',
|
'NO_NEWER_TOPICS' => 'There are no newer topics in this forum',
|
||||||
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
|
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
|
||||||
|
@ -310,16 +315,14 @@ $lang = array(
|
||||||
'VIEW_IP' => 'IP',
|
'VIEW_IP' => 'IP',
|
||||||
'DELETE_POST' => 'Delete',
|
'DELETE_POST' => 'Delete',
|
||||||
'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
|
'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
|
||||||
'REPORT_TO_ADMIN' => 'Report this post',
|
'REPORT_POST' => 'Report this post',
|
||||||
'EDITED_TIME_TOTAL' => 'Last edited by %1$s on %2$s, edited %3$d time in total',
|
'EDITED_TIME_TOTAL' => 'Last edited by %1$s on %2$s, edited %3$d time in total',
|
||||||
'EDITED_TIMES_TOTAL' => 'Last edited by %1$s on %2$s, edited %3$d times in total',
|
'EDITED_TIMES_TOTAL' => 'Last edited by %1$s on %2$s, edited %3$d times in total',
|
||||||
|
|
||||||
'POST_BEEN_REPORTED' => 'This post has been reported',
|
'POST_REPORTED' => 'Click to view reports',
|
||||||
'POST_NOT_BEEN_APPROVED' => 'This post has not been approved',
|
'POST_NOT_APPROVED' => 'Click to approve post',
|
||||||
'TOPIC_BEEN_REPORTED' => 'This topic has been reported',
|
'TOPIC_REPORTED' => 'This topic has been reported',
|
||||||
'TOPIC_NOT_BEEN_APPROVED' => 'This topic has not been approved',
|
'TOPIC_NOT_APPROVED'=> 'This topic has not been approved',
|
||||||
'APPROVE_POST' => 'Approve this post',
|
|
||||||
'READ_REPORTS' => 'Read post reports',
|
|
||||||
|
|
||||||
'WROTE' => 'wrote',
|
'WROTE' => 'wrote',
|
||||||
'QUOTE' => 'Quote',
|
'QUOTE' => 'Quote',
|
||||||
|
@ -353,6 +356,8 @@ $lang = array(
|
||||||
'TOTAL_VOTES' => 'Total Votes',
|
'TOTAL_VOTES' => 'Total Votes',
|
||||||
'VIEW_RESULTS' => 'View Results',
|
'VIEW_RESULTS' => 'View Results',
|
||||||
'POLL_VOTED_OPTION' => 'You voted for this option',
|
'POLL_VOTED_OPTION' => 'You voted for this option',
|
||||||
|
'POLL_RUN_TILL' => 'Poll runs till %s', // %s = date/time
|
||||||
|
'VOTE_SUBMITTED' => 'Your vote has been cast',
|
||||||
|
|
||||||
'VIEW_TOPIC_POST' => '1 Post',
|
'VIEW_TOPIC_POST' => '1 Post',
|
||||||
'VIEW_TOPIC_POSTS' => '%d Posts',
|
'VIEW_TOPIC_POSTS' => '%d Posts',
|
||||||
|
@ -444,7 +449,6 @@ $lang = array(
|
||||||
'POST_STORED_MOD' => 'Your message has been saved but requires approval',
|
'POST_STORED_MOD' => 'Your message has been saved but requires approval',
|
||||||
'DELETED' => 'Your message has been deleted successfully',
|
'DELETED' => 'Your message has been deleted successfully',
|
||||||
'Poll_delete' => 'Your poll has been deleted successfully',
|
'Poll_delete' => 'Your poll has been deleted successfully',
|
||||||
'Vote_cast' => 'Your vote has been cast',
|
|
||||||
'BBCODE_B_HELP' => 'Bold text: [b]text[/b] (alt+b)',
|
'BBCODE_B_HELP' => 'Bold text: [b]text[/b] (alt+b)',
|
||||||
'BBCODE_I_HELP' => 'Italic text: [i]text[/i] (alt+i)',
|
'BBCODE_I_HELP' => 'Italic text: [i]text[/i] (alt+i)',
|
||||||
'BBCODE_U_HELP' => 'Underline text: [u]text[/u] (alt+u)',
|
'BBCODE_U_HELP' => 'Underline text: [u]text[/u] (alt+u)',
|
||||||
|
@ -825,7 +829,6 @@ $lang = array(
|
||||||
'No_search_match' => 'No topics or posts met your search criteria',
|
'No_search_match' => 'No topics or posts met your search criteria',
|
||||||
'Found_search_match' => 'Search found %d match',
|
'Found_search_match' => 'Search found %d match',
|
||||||
'Found_search_matches' => 'Search found %d matches',
|
'Found_search_matches' => 'Search found %d matches',
|
||||||
'No_new_posts_last_visit' => 'No new posts since your last visit',
|
|
||||||
|
|
||||||
'Sorry_auth_announce' => 'Sorry but only %s can post announcements in this forum',
|
'Sorry_auth_announce' => 'Sorry but only %s can post announcements in this forum',
|
||||||
'Sorry_auth_sticky' => 'Sorry but only %s can post sticky messages in this forum',
|
'Sorry_auth_sticky' => 'Sorry but only %s can post sticky messages in this forum',
|
||||||
|
@ -1155,25 +1158,27 @@ $lang = array_merge($lang, array(
|
||||||
|
|
||||||
//----- post reporting
|
//----- post reporting
|
||||||
'REASON' => 'Reason',
|
'REASON' => 'Reason',
|
||||||
'ADDITIONAL_INFOS' => 'Additional infos',
|
'MORE_INFO' => 'Further information',
|
||||||
'CAN_BE_LEFT_BLANK' => '(can be left blank)',
|
'CAN_LEAVE_BLANK' => 'This can be left blank.',
|
||||||
|
|
||||||
'POST_NOT_EXIST' => 'The post you requested does not exist',
|
'POST_NOT_EXIST' => 'The post you requested does not exist',
|
||||||
|
|
||||||
'REPORT_TO_ADMIN_EXPLAIN' => 'Using this form you can report the selected post to forum admins',
|
'REPORT_POST_EXPLAIN' => 'Use this form to report the selected post to the forum moderators and board administrators. Reporting should generally be used only if the post breaks forum rules.',
|
||||||
'EMPTY_REPORT' => 'You must enter a description when selecting this reason',
|
'EMPTY_REPORT' => 'You must enter a description when selecting this reason',
|
||||||
|
|
||||||
'REPORT_NOTIFY' => 'Notify me when this report is reviewed',
|
'REPORT_NOTIFY' => 'Notify me',
|
||||||
|
'REPORT_NOTIFY_EXPLAIN' => 'Informs you when report is read.',
|
||||||
|
|
||||||
'POST_REPORTED_SUCCESS' => 'This post has been successfully reported',
|
'POST_REPORTED_SUCCESS' => 'This post has been successfully reported',
|
||||||
|
|
||||||
'report_reasons' => array(
|
'REPORT_REASONS' => array(
|
||||||
'title' => array(
|
'TITLE' => array(
|
||||||
'warez' => 'Warez',
|
'WAREZ' => 'Warez',
|
||||||
'other' => 'Other'
|
'OTHER' => 'Other'
|
||||||
),
|
),
|
||||||
'description' => array(
|
'DESCRIPTION' => array(
|
||||||
'warez' => 'The post contains links to illegal or pirated software',
|
'WAREZ' => 'The post contains links to illegal or pirated software',
|
||||||
'other' => 'The reported post does not fit into any other category, please use the description field'
|
'OTHER' => 'The reported post does not fit into any other category, please use the description field'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
|
@ -33,17 +33,26 @@ $auth->acl($user->data);
|
||||||
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
|
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
|
||||||
$user_id = (isset($_GET['u'])) ? intval($_GET['u']) : ANONYMOUS;
|
$user_id = (isset($_GET['u'])) ? intval($_GET['u']) : ANONYMOUS;
|
||||||
|
|
||||||
// Can this user view profiles/memberslist?
|
|
||||||
if (!$auth->acl_gets('u_viewprofile', 'a_'))
|
switch ($mode)
|
||||||
{
|
{
|
||||||
|
case 'email':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Can this user view profiles/memberslist?
|
||||||
|
if (!$auth->acl_gets('u_viewprofile', 'a_'))
|
||||||
|
{
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['NO_VIEW_USERS']);
|
trigger_error($user->lang['NO_VIEW_USERS']);
|
||||||
}
|
}
|
||||||
|
|
||||||
login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])));
|
login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0;
|
$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0;
|
||||||
$form = (!empty($_GET['form'])) ? htmlspecialchars($_GET['form']) : 0;
|
$form = (!empty($_GET['form'])) ? htmlspecialchars($_GET['form']) : 0;
|
||||||
$field = (isset($_GET['field'])) ? htmlspecialchars($_GET['field']) : 'username';
|
$field = (isset($_GET['field'])) ? htmlspecialchars($_GET['field']) : 'username';
|
||||||
|
@ -517,7 +526,7 @@ switch ($mode)
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Do the SQL thang
|
// Do the SQL thang
|
||||||
$sql = "SELECT username, user_id, user_colour, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_website, user_email, user_sig, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit
|
$sql = "SELECT username, user_id, user_colour, user_viewemail, user_posts, user_regdate, user_rank, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar, user_lastvisit
|
||||||
FROM " . USERS_TABLE . "
|
FROM " . USERS_TABLE . "
|
||||||
WHERE user_id <> " . ANONYMOUS . "
|
WHERE user_id <> " . ANONYMOUS . "
|
||||||
$where_sql
|
$where_sql
|
||||||
|
|
144
phpBB/report.php
144
phpBB/report.php
|
@ -28,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
|
||||||
$user->start();
|
$user->start();
|
||||||
$user->setup();
|
$user->setup();
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
// End session management
|
|
||||||
|
|
||||||
// var definitions
|
// var definitions
|
||||||
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 0;
|
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 0;
|
||||||
|
@ -36,38 +36,6 @@ $reason_id = (!empty($_REQUEST['reason_id'])) ? intval($_REQUEST['reason_id']) :
|
||||||
$notify = (!empty($_REQUEST['notify']) && $user->data['user_id'] != ANONYMOUS) ? TRUE : FALSE;
|
$notify = (!empty($_REQUEST['notify']) && $user->data['user_id'] != ANONYMOUS) ? TRUE : FALSE;
|
||||||
$description = (!empty($_REQUEST['description'])) ? stripslashes($_REQUEST['description']) : '';
|
$description = (!empty($_REQUEST['description'])) ? stripslashes($_REQUEST['description']) : '';
|
||||||
|
|
||||||
// Start output of page
|
|
||||||
$page_title = $user->lang['REPORT_TO_ADMIN'];
|
|
||||||
include($phpbb_root_path . 'includes/page_header.' . $phpEx);
|
|
||||||
|
|
||||||
$sql = 'SELECT f.*, t.*, p.*
|
|
||||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
|
||||||
WHERE p.post_id = $post_id
|
|
||||||
AND p.topic_id = t.topic_id
|
|
||||||
AND p.forum_id = f.forum_id";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
if (!$row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
trigger_error('POST_NOT_EXIST');
|
|
||||||
}
|
|
||||||
|
|
||||||
$forum_id = $row['forum_id'];
|
|
||||||
$topic_id = $row['topic_id'];
|
|
||||||
|
|
||||||
// Checking permissions
|
|
||||||
if (!$auth->acl_get('f_list', $forum_id))
|
|
||||||
{
|
|
||||||
trigger_error('POST_NOT_EXIST');
|
|
||||||
}
|
|
||||||
if (!$auth->acl_get('f_read', $forum_id))
|
|
||||||
{
|
|
||||||
trigger_error('USER_CANNOT_READ');
|
|
||||||
}
|
|
||||||
if (!$auth->acl_get('f_report', $forum_id))
|
|
||||||
{
|
|
||||||
trigger_error('USER_CANNOT_REPORT');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Has the report been cancelled?
|
// Has the report been cancelled?
|
||||||
if (isset($_POST['cancel']))
|
if (isset($_POST['cancel']))
|
||||||
|
@ -75,15 +43,49 @@ if (isset($_POST['cancel']))
|
||||||
redirect("viewtopic.$phpEx$SID&p=$post_id#$post_id");
|
redirect("viewtopic.$phpEx$SID&p=$post_id#$post_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Grab all relevant data
|
||||||
|
$sql = 'SELECT f.*, t.*, p.*
|
||||||
|
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
||||||
|
WHERE p.post_id = $post_id
|
||||||
|
AND p.topic_id = t.topic_id
|
||||||
|
AND p.forum_id = f.forum_id";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
if (!($forum_data = $db->sql_fetchrow($result)))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['POST_NOT_EXIST']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$forum_id = $forum_data['forum_id'];
|
||||||
|
$topic_id = $forum_data['topic_id'];
|
||||||
|
|
||||||
|
|
||||||
|
// Check required permissions
|
||||||
|
$acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT');
|
||||||
|
foreach ($acl_check_ary as $acl => $error)
|
||||||
|
{
|
||||||
|
if (!$auth->acl_get($acl, $forum_id))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang[$error]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($acl_check_ary);
|
||||||
|
|
||||||
|
|
||||||
// Has the report been confirmed?
|
// Has the report been confirmed?
|
||||||
if (!empty($_POST['reason_id']))
|
if (!empty($_POST['reason_id']))
|
||||||
{
|
{
|
||||||
$result = $db->sql_query('SELECT reason_name FROM ' . REASONS_TABLE . " WHERE reason_id = $reason_id");
|
$sql = 'SELECT reason_name
|
||||||
$row = $db->sql_fetchrow($result);
|
FROM ' . REASONS_TABLE . "
|
||||||
if (!$row || (!$description && $row['reason_name'] == 'other'))
|
WHERE reason_id = $reason_id";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
if (!($row = $db->sql_fetchrow($result)) || (!$description && $row['reason_name'] == 'other'))
|
||||||
{
|
{
|
||||||
trigger_error('EMPTY_REPORT');
|
trigger_error('EMPTY_REPORT');
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sql_ary = array(
|
$sql_ary = array(
|
||||||
'reason_id' => (int) $reason_id,
|
'reason_id' => (int) $reason_id,
|
||||||
|
@ -94,61 +96,69 @@ if (!empty($_POST['reason_id']))
|
||||||
'report_text' => (string) $description
|
'report_text' => (string) $description
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . REPORTS_TABLE . $db->sql_build_array('INSERT', $sql_ary);
|
$sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' .
|
||||||
|
$db->sql_build_array('INSERT', $sql_ary);
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
if (!$row['post_reported'])
|
if (!$row['post_reported'])
|
||||||
{
|
{
|
||||||
$db->sql_query('UPDATE ' . POSTS_TABLE . ' SET post_reported = 1 WHERE post_id = ' . $post_id);
|
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||||
}
|
SET post_reported = 1
|
||||||
if (!$row['topic_reported'])
|
WHERE post_id = ' . $post_id;
|
||||||
{
|
$db->sql_query($sql);
|
||||||
$db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 1 WHERE topic_id = ' . $topic_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_error($user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&p=$post_id#$post_id\">", '</a>'));
|
if (!$row['topic_reported'])
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||||
|
SET topic_reported = 1
|
||||||
|
WHERE topic_id = ' . $topic_id;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_refresh(3, "viewtopic.$phpEx$SID&p=$post_id#$post_id");
|
||||||
|
|
||||||
|
$message = $user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&p=$post_id#$post_id\">", '</a>');
|
||||||
|
trigger_error($message);
|
||||||
|
|
||||||
// TODO: warn moderators or something ;)
|
// TODO: warn moderators or something ;)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Generate the form
|
// Generate the form
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . REASONS_TABLE . '
|
||||||
|
ORDER BY reason_priority ASC';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
generate_forum_nav($row);
|
|
||||||
|
|
||||||
$result = $db->sql_query('SELECT * FROM ' . REASONS_TABLE . ' ORDER BY reason_priority ASC');
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if (!empty($user->lang['report_reasons']['title'][$row['reason_name']]))
|
$row['reason_name'] = strtoupper($row['reason_name']);
|
||||||
{
|
|
||||||
$reason_name = $user->lang['report_reasons']['title'][$row['reason_name']];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$reason_name = ucwords(str_replace('_', ' ', $row['reason_name']));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($user->lang['report_reasons']['description'][$row['reason_name']]))
|
$reason_name = (!empty($user->lang['REPORT_REASONS']['TITLE'][$row['reason_name']])) ? $user->lang['REPORT_REASONS']['TITLE'][$row['reason_name']] : ucwords(str_replace('_', ' ', $row['reason_name']));
|
||||||
{
|
|
||||||
$reason_description = $user->lang['report_reasons']['description'][$row['reason_name']];
|
$reason_description = (!empty($user->lang['REPORT_REASONS']['DESCRIPTION'][$row['reason_name']])) ? $user->lang['REPORT_REASONS']['DESCRIPTION'][$row['reason_name']] : $row['reason_description'];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$reason_description = $row['reason_description'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('reason', array(
|
$template->assign_block_vars('reason', array(
|
||||||
'ID' => $row['reason_id'],
|
'ID' => $row['reason_id'],
|
||||||
'NAME' => htmlspecialchars($reason_name),
|
'NAME' => htmlspecialchars($reason_name),
|
||||||
'DESCRIPTION' => htmlspecialchars($reason_description)
|
'DESCRIPTION' => htmlspecialchars($reason_description))
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_var('S_CAN_NOTIFY', ($user->data['user_id'] == ANONYMOUS) ? FALSE : TRUE);
|
$template->assign_var('S_CAN_NOTIFY', ($user->data['user_id'] == ANONYMOUS) ? FALSE : TRUE);
|
||||||
|
|
||||||
|
|
||||||
|
// Start output of page
|
||||||
|
$page_title = $user->lang['REPORT_TO_ADMIN'];
|
||||||
|
include($phpbb_root_path . 'includes/page_header.' . $phpEx);
|
||||||
|
|
||||||
|
generate_forum_nav($forum_data);
|
||||||
|
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
'body' => 'report.html'
|
'body' => 'report_body.html')
|
||||||
));
|
);
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
|
include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -35,7 +35,7 @@
|
||||||
</table><span class="gensmall"><!-- IF forumrow.MODERATORS --><b>{forumrow.L_MODERATOR_STR}:</b> {forumrow.MODERATORS}<br /><!-- ENDIF --><!-- IF forumrow.SUBFORUMS --><br /><b>{forumrow.L_SUBFORUM_STR}</b> {forumrow.SUBFORUMS}<!-- ENDIF --></span></td>
|
</table><span class="gensmall"><!-- IF forumrow.MODERATORS --><b>{forumrow.L_MODERATOR_STR}:</b> {forumrow.MODERATORS}<br /><!-- ENDIF --><!-- IF forumrow.SUBFORUMS --><br /><b>{forumrow.L_SUBFORUM_STR}</b> {forumrow.SUBFORUMS}<!-- ENDIF --></span></td>
|
||||||
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.TOPICS}</span></td>
|
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.TOPICS}</span></td>
|
||||||
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.POSTS}</span></td>
|
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.POSTS}</span></td>
|
||||||
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="gensmall"><!-- IF forumrow.LAST_POST_TIME -->{forumrow.LAST_POST_TIME}<br /><!-- IF forumrow.U_LAST_POSTER --><a href="{forumrow.U_LAST_POSTER}">{forumrow.LAST_POSTER}</a><!-- ELSE -->{forumrow.LAST_POSTER}<!-- ENDIF --><a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_IMG}</a><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></span></td>
|
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="gensmall"><!-- IF forumrow.LAST_POST_TIME -->{forumrow.LAST_POST_TIME}<br /><!-- IF forumrow.U_LAST_POSTER --><a href="{forumrow.U_LAST_POSTER}">{forumrow.LAST_POSTER}</a><!-- ELSE -->{forumrow.LAST_POSTER}<!-- ENDIF --> <a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_IMG}</a><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
<!-- INCLUDE overall_header.html -->
|
|
||||||
|
|
||||||
<form action="{S_POST_ACTION}" name="main" method="post">
|
|
||||||
|
|
||||||
{ERROR_BOX}
|
|
||||||
|
|
||||||
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<td class="nav" width="100%" align="left" valign="middle"> <a href="{U_INDEX}">{L_INDEX}</a><!-- BEGIN navlinks --> -> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<table border="0" cellpadding="3" cellspacing="1" width="100%" class="tablebg">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2" height="25">{L_REPORT_TO_ADMIN}</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row2" colspan="2" align="center"><span class="gen"> {L_REPORT_TO_ADMIN_EXPLAIN} </span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="row1" width="22%"><span class="gen"><b>{L_REASON}</b></span></td>
|
|
||||||
<td class="row2" width="78%"><select name="reason_id"><!-- BEGIN reason --><option value="{reason.ID}">{reason.DESCRIPTION}</option><!-- END reason --></select></td>
|
|
||||||
</tr>
|
|
||||||
<!-- IF S_CAN_NOTIFY -->
|
|
||||||
<tr>
|
|
||||||
<td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span></td>
|
|
||||||
<td class="row2"><table cellspacing="0" cellpadding="1" border="0">
|
|
||||||
<tr valign="middle">
|
|
||||||
<td><input type="checkbox" name="notify" /></td>
|
|
||||||
<td><span class="gen">{L_REPORT_NOTIFY}</span></td>
|
|
||||||
</tr>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<tr>
|
|
||||||
<td class="row1" valign="top"><span class="gen"><b>{L_ADDITIONAL_INFOS}</b></span><br /><span class="gensmall">{L_CAN_BE_LEFT_BLANK}</span></td>
|
|
||||||
<td class="row2"><span class="gen"><textarea name="description" rows="25" cols="40" wrap="virtual" style="width:500px" class="post">{MESSAGE}</textarea></span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="cat" colspan="2" align="center" height="28"><input type="submit" name="submit" class="mainoption" value="{L_REPORT_TO_ADMIN}" /> <input type="submit" name="cancel" class="liteoption" value="{L_CANCEL}"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
|
|
||||||
<tr>
|
|
||||||
<td align="right" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td>
|
|
||||||
</tr>
|
|
||||||
</table></form>
|
|
||||||
|
|
||||||
<table width="100%" cellspacing="2" border="0" align="center">
|
|
||||||
<tr>
|
|
||||||
<td valign="top" align="right">{JUMPBOX}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<!-- INCLUDE overall_footer.html -->
|
|
51
phpBB/templates/subSilver/report_body.html
Normal file
51
phpBB/templates/subSilver/report_body.html
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<!-- INCLUDE overall_header.html -->
|
||||||
|
|
||||||
|
<form action="{S_POST_ACTION}" name="main" method="post">
|
||||||
|
|
||||||
|
{ERROR_BOX}
|
||||||
|
|
||||||
|
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
|
||||||
|
<tr>
|
||||||
|
<td class="nav" width="100%" align="left" valign="middle"><a href="{U_INDEX}">{L_INDEX}</a><!-- BEGIN navlinks --> -> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table border="0" cellpadding="3" cellspacing="1" width="100%" class="tablebg">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">{L_REPORT_POST}</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="row3" colspan="2"><span class="gensmall">{L_REPORT_POST_EXPLAIN}</span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="row1" width="22%"><b class="gen">{L_REASON}:</b></td>
|
||||||
|
<td class="row2" width="78%"><select name="reason_id"><!-- BEGIN reason --><option value="{reason.ID}">{reason.DESCRIPTION}</option><!-- END reason --></select></td>
|
||||||
|
</tr>
|
||||||
|
<!-- IF S_CAN_NOTIFY -->
|
||||||
|
<tr>
|
||||||
|
<td class="row1"><span class="gen"><b>{L_REPORT_NOTIFY}:</b></span><br /><span class="gensmall">{L_REPORT_NOTIFY_EXPLAIN}</span></td>
|
||||||
|
<td class="row2"><span class="gen"><input type="radio" name="notify" value="1" />{L_YES} <input type="radio" name="notify" value="0" checked="checked" />{L_NO}</span></td>
|
||||||
|
</tr>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<tr>
|
||||||
|
<td class="row1" valign="top"><span class="gen"><b>{L_MORE_INFO}:</b></span><br /><span class="gensmall">{L_CAN_LEAVE_BLANK}</span></td>
|
||||||
|
<td class="row2"><textarea class="post" style="width:500px" name="description" rows="25" cols="40" class="post">{MESSAGE}</textarea></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="cat" colspan="2" align="center" height="28"><input type="submit" name="submit" class="mainoption" value="{L_SUBMIT}" /> <input type="submit" name="cancel" class="liteoption" value="{L_CANCEL}"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
|
||||||
|
<tr>
|
||||||
|
<td align="right" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td>
|
||||||
|
</tr>
|
||||||
|
</table></form>
|
||||||
|
|
||||||
|
<table width="100%" cellspacing="2" border="0" align="center">
|
||||||
|
<tr>
|
||||||
|
<td valign="top" align="right">{JUMPBOX}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- INCLUDE overall_footer.html -->
|
|
@ -139,6 +139,7 @@
|
||||||
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><!-- IF S_DISPLAY_SEARCHBOX --><!-- INCLUDE searchbox.html --><!-- ENDIF --></td>
|
||||||
<td align="right"><!-- INCLUDE jumpbox.html --></td>
|
<td align="right"><!-- INCLUDE jumpbox.html --></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</table><span class="gensmall"><!-- IF forumrow.MODERATORS --><b>{forumrow.L_MODERATOR_STR}:</b> {forumrow.MODERATORS}<br /><!-- ENDIF --><!-- IF forumrow.SUBFORUMS --><br /><b>{forumrow.L_SUBFORUM_STR}</b> {forumrow.SUBFORUMS}<!-- ENDIF --></span></td>
|
</table><span class="gensmall"><!-- IF forumrow.MODERATORS --><b>{forumrow.L_MODERATOR_STR}:</b> {forumrow.MODERATORS}<br /><!-- ENDIF --><!-- IF forumrow.SUBFORUMS --><br /><b>{forumrow.L_SUBFORUM_STR}</b> {forumrow.SUBFORUMS}<!-- ENDIF --></span></td>
|
||||||
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.TOPICS}</span></td>
|
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.TOPICS}</span></td>
|
||||||
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.POSTS}</span></td>
|
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.POSTS}</span></td>
|
||||||
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{forumrow.LAST_POST}</span></td>
|
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><!-- IF forumrow.LAST_POST_TIME --><span class="gensmall">{forumrow.LAST_POST_TIME}<br /><!-- IF forumrow.U_LAST_POSTER --><a href="{forumrow.U_LAST_POSTER}">{forumrow.LAST_POSTER}</a><!-- ELSE -->{forumrow.LAST_POSTER}<!-- ENDIF --> <a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_IMG}</a></span><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- END forumrow -->
|
<!-- END forumrow -->
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
<!-- ELSEIF postrow.S_WRONG_ENCODING -->
|
<!-- ELSEIF postrow.S_WRONG_ENCODING -->
|
||||||
<td colspan="2" height="25" align="center"><span class="gensmall">{postrow.L_IGNORE_POST}</span></td>
|
<td colspan="2" height="25" align="center"><span class="gensmall">{postrow.L_IGNORE_POST}</span></td>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
<td rowspan="2" width="150" align="left" valign="top"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
|
<td rowspan="2" width="150" align="left" valign="top"><a name="{postrow.U_POST_ID}"></a><b class="name">{postrow.POSTER_NAME}</b><span class="postdetails"><br />{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{L_JOINED}: {postrow.POSTER_JOINED}<!-- IF postrow.POSTER_POSTS --><br />{L_POSTS}: {postrow.POSTER_POSTS}<!-- ENDIF --><!-- IF postrow.POSTER_FROM --><br />{L_LOCATION}: {postrow.POSTER_FROM}<!-- ENDIF --></span></td>
|
||||||
<td width="100%" height="28"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
<td width="100%" height="28"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td>{postrow.POST_ICON} </td>
|
<td>{postrow.POST_ICON} </td>
|
||||||
|
@ -106,35 +106,27 @@
|
||||||
<tr class="row2">
|
<tr class="row2">
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<td><table width="100%" cellspacing="0" cellpadding="5" border="0">
|
<td><table width="100%" cellspacing="0" cellpadding="5" border="0">
|
||||||
<!-- IF postrow.S_POST_UNAPPROVED -->
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
<td height="120" valign="top"><table width="100%" cellspacing="0" cellpadding="2">
|
||||||
<tr align="left" valign="middle">
|
|
||||||
<td>{UNAPPROVED_IMG}</td>
|
|
||||||
<td class="gensmall" width="100%"> {L_POST_NOT_BEEN_APPROVED} [ <a href="{postrow.U_MCP_APPROVE}">{L_APPROVE_POST}</a> ]</td>
|
|
||||||
</tr>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- IF postrow.S_POST_REPORTED -->
|
|
||||||
<tr>
|
|
||||||
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
||||||
<tr align="left" valign="middle">
|
|
||||||
<td>{REPORTED_IMG}</td>
|
|
||||||
<td class="gensmall" width="100%"> {L_POST_BEEN_REPORTED} [ <a href="{postrow.U_MCP_REPORT}">{L_READ_REPORTS}</a> ]</td>
|
|
||||||
</tr>
|
|
||||||
</table></td>
|
|
||||||
</tr>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<tr>
|
|
||||||
<td height="100" valign="top"><table width="100%" cellspacing="0" cellpadding="2">
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="postbody">{postrow.MESSAGE}</span><!-- IF postrow.S_HAS_ATTACHMENTS --><!-- INCLUDE viewtopic_attach_body.html --><!-- ENDIF --><!-- IF postrow.SIGNATURE --><span class="postbody"><br />_________________<br />{postrow.SIGNATURE}</span><!-- ENDIF --><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
|
<td><span class="postbody">{postrow.MESSAGE}</span><!-- IF postrow.S_HAS_ATTACHMENTS --><!-- INCLUDE viewtopic_attach_body.html --><!-- ENDIF --><!-- IF postrow.SIGNATURE --><span class="postbody"><br />_________________<br />{postrow.SIGNATURE}</span><!-- ENDIF --><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right" valign="bottom"><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><span class="gensmall"><b>{L_POSTED}:</b> {postrow.POST_DATE}</td>
|
<td><table width="100%" cellspacing="0" cellpadding="0" border="0" >
|
||||||
|
<tr valign="middle">
|
||||||
|
<!-- IF postrow.S_POST_UNAPPROVED -->
|
||||||
|
<td width="5">{UNAPPROVED_IMG}</td>
|
||||||
|
<td class="gensmall" nowrap="nowrap"> <b><a style="color:green" href="{postrow.U_MCP_APPROVE}">{L_POST_NOT_APPROVED}</a></b> </td>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- IF postrow.S_POST_REPORTED -->
|
||||||
|
<td width="5">{REPORTED_IMG}</td>
|
||||||
|
<td class="gensmall" nowrap="nowrap"> <b><a style="color:red" href="{postrow.U_MCP_REPORT}">{L_POST_REPORTED}</a></b> </td>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<td align="right" nowrap="nowrap"><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><span class="gensmall"><b>{L_POSTED}:</b> {postrow.POST_DATE}</td>
|
||||||
|
</tr>
|
||||||
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -193,6 +185,7 @@
|
||||||
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><!-- IF S_DISPLAY_SEARCHBOX --><!-- INCLUDE searchbox.html --><!-- ENDIF --></td>
|
||||||
<td align="right"><!-- INCLUDE jumpbox.html --></td>
|
<td align="right"><!-- INCLUDE jumpbox.html --></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -36,8 +36,8 @@ $sort_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : 'd';
|
||||||
|
|
||||||
|
|
||||||
// Start session
|
// Start session
|
||||||
//$user->fetch_data(array());
|
|
||||||
$user->start();
|
$user->start();
|
||||||
|
$auth->acl($user->data);
|
||||||
|
|
||||||
|
|
||||||
// Check if the user has actually sent a forum ID with his/her request
|
// Check if the user has actually sent a forum ID with his/her request
|
||||||
|
@ -60,34 +60,35 @@ else
|
||||||
switch (SQL_LAYER)
|
switch (SQL_LAYER)
|
||||||
{
|
{
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
//TODO
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* $sql = 'SELECT f.*, fw.notify_status, ft.topic_count, ft.mark_time
|
if ($config['load_db_lastread'])
|
||||||
FROM ((' . FORUMS_TABLE . ' f
|
{
|
||||||
|
$sql_lastread = 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . '
|
||||||
|
AND ft.forum_id = f.forum_id)';
|
||||||
|
$lastread_select = ', ft.mark_time ';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql_lastread = '';
|
||||||
|
$lastread_select = '';
|
||||||
|
$sql_where = '';
|
||||||
|
|
||||||
|
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array();
|
||||||
|
$tracking_forums = (isset($_COOKIE[$config['cookie_name'] . '_f'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_f']) : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT f.*, fw.notify_status $lastread_select
|
||||||
|
FROM ((" . FORUMS_TABLE . ' f
|
||||||
LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON (fw.forum_id = f.forum_id
|
LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON (fw.forum_id = f.forum_id
|
||||||
AND fw.user_id = ' . $user->data['user_id'] . '))
|
AND fw.user_id = ' . $user->data['user_id'] . "))
|
||||||
LEFT JOIN " . FORUMS_TRACK_TABLE . " ft ON (ft.forum_id = f.forum_id
|
$sql_lastread)
|
||||||
AND ft.user_id = ' . $user->data['user_id'] . '))
|
WHERE f.forum_id = $forum_id";
|
||||||
WHERE f.forum_id = ' . $forum_id;*/
|
|
||||||
$sql = 'SELECT f.*, fw.notify_status
|
|
||||||
FROM (' . FORUMS_TABLE . ' f
|
|
||||||
LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON fw.forum_id = f.forum_id
|
|
||||||
AND fw.user_id = ' . $user->data['user_id'] . ')
|
|
||||||
WHERE f.forum_id = ' . $forum_id;
|
|
||||||
// UNION if necessary?
|
|
||||||
/* $sql = "SELECT *
|
|
||||||
FROM " . FORUMS_TABLE . "
|
|
||||||
WHERE forum_id = $forum_id
|
|
||||||
UNION
|
|
||||||
SELECT notify_status, NULL, NULL, ...
|
|
||||||
FROM " . FORUMS_WATCH_TABLE . "
|
|
||||||
WHERE forum_id = $forum_id
|
|
||||||
AND user_id = " . $user->data['user_id'];*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
if (!$forum_data = $db->sql_fetchrow($result))
|
if (!$forum_data = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
trigger_error('NO_FORUM');
|
trigger_error('NO_FORUM');
|
||||||
|
@ -97,7 +98,6 @@ $db->sql_freeresult($result);
|
||||||
|
|
||||||
// Configure style, language, etc.
|
// Configure style, language, etc.
|
||||||
$user->setup(false, $forum_data['forum_style']);
|
$user->setup(false, $forum_data['forum_style']);
|
||||||
$auth->acl($user->data, $forum_id);
|
|
||||||
|
|
||||||
|
|
||||||
// Permissions check
|
// Permissions check
|
||||||
|
@ -140,17 +140,15 @@ if ($forum_data['forum_postable'])
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
markread('mark', $forum_id);
|
markread('mark', $forum_id);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'META' => '<meta http-equiv="refresh" content="3;url=' . "viewforum.$phpEx$SID&f=$forum_id" . '">')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta_refresh(3, "viewforum.$phpEx$SID&f=$forum_id");
|
||||||
|
|
||||||
$message = $user->lang['TOPICS_MARKED_READ'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . "viewforum.$phpEx$SID&f=$forum_id" . '">', '</a> ');
|
$message = $user->lang['TOPICS_MARKED_READ'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . "viewforum.$phpEx$SID&f=$forum_id" . '">', '</a> ');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Do the forum Prune - cron type job ...
|
// Do the forum Prune - cron type job ...
|
||||||
if ($config['prune_enable'] && $auth->acl_get('a_'))
|
if ($config['prune_enable'] && $auth->acl_get('a_'))
|
||||||
{
|
{
|
||||||
|
@ -160,7 +158,7 @@ if ($forum_data['forum_postable'])
|
||||||
auto_prune($forum_id, $forum_data['prune_days'], $forum_data['prune_freq']);
|
auto_prune($forum_id, $forum_data['prune_days'], $forum_data['prune_freq']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Forum rules, subscription info and word censors
|
// Forum rules, subscription info and word censors
|
||||||
$s_watching_forum = $s_watching_forum_img = '';
|
$s_watching_forum = $s_watching_forum_img = '';
|
||||||
|
@ -173,11 +171,12 @@ if ($forum_data['forum_postable'])
|
||||||
$censors = array();
|
$censors = array();
|
||||||
obtain_word_list($censors);
|
obtain_word_list($censors);
|
||||||
|
|
||||||
|
|
||||||
// Topic ordering options
|
// Topic ordering options
|
||||||
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||||
|
|
||||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
||||||
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.poll_last_vote', 't.topic_last_post_time'), 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
|
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
|
||||||
|
|
||||||
$s_limit_days = $s_sort_key = $s_sort_dir = '';
|
$s_limit_days = $s_sort_key = $s_sort_dir = '';
|
||||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir);
|
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir);
|
||||||
|
@ -190,14 +189,13 @@ if ($forum_data['forum_postable'])
|
||||||
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
||||||
FROM ' . TOPICS_TABLE . "
|
FROM ' . TOPICS_TABLE . "
|
||||||
WHERE forum_id = $forum_id
|
WHERE forum_id = $forum_id
|
||||||
AND (topic_last_post_time >= $min_post_time
|
AND (topic_last_post_time >= $min_post_time)
|
||||||
OR poll_last_vote >= $min_post_time)
|
|
||||||
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1');
|
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1');
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$start = 0;
|
$start = 0;
|
||||||
$topics_count = ($row = $db->sql_fetchrow($result)) ? $row['num_topics'] : 0;
|
$topics_count = ($row = $db->sql_fetchrow($result)) ? $row['num_topics'] : 0;
|
||||||
$sql_limit_time = "AND (t.topic_last_post_time >= $min_post_time OR t.poll_last_vote >= $min_post_time)";
|
$sql_limit_time = "AND t.topic_last_post_time >= $min_post_time";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -214,8 +212,8 @@ if ($forum_data['forum_postable'])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the sort order
|
// Select the sort order
|
||||||
$sql_sort_dir = ($sort_dir == 'd') ? 'DESC' : 'ASC';
|
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
||||||
$sql_sort_order = ((is_array($sort_by_sql[$sort_key])) ? implode(" $sql_sort_dir, ", $sort_by_sql[$sort_key]) : $sort_by_sql[$sort_key]) . " $sql_sort_dir";
|
|
||||||
|
|
||||||
// Basic pagewide vars
|
// Basic pagewide vars
|
||||||
$post_alt = (intval($forum_data['forum_status']) == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'POST_NEW_TOPIC';
|
$post_alt = (intval($forum_data['forum_status']) == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'POST_NEW_TOPIC';
|
||||||
|
@ -224,7 +222,7 @@ if ($forum_data['forum_postable'])
|
||||||
'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $topics_count, $config['topics_per_page'], $start),
|
'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $topics_count, $config['topics_per_page'], $start),
|
||||||
'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start),
|
'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start),
|
||||||
'TOTAL_TOPICS' => ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count),
|
'TOTAL_TOPICS' => ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count),
|
||||||
'MOD_CP' => ($auth->acl_gets('m_', $forum_id)) ? sprintf($user->lang['MCP'], '<a href="mcp.' . $phpEx . '?sid=' . $user->session_id . '&f=' . $forum_id . '">', '</a>') : '',
|
'MOD_CP' => ($auth->acl_gets('m_', $forum_id)) ? sprintf($user->lang['MCP'], "<a href=\"mcp.$phpEx?sid=$user->session_id&f=$forum_id\">", '</a>') : '',
|
||||||
'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '',
|
'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '',
|
||||||
|
|
||||||
'POST_IMG' => (intval($forum_data['forum_status']) == ITEM_LOCKED) ? $user->img('btn_locked', $post_alt) : $user->img('btn_post', $post_alt),
|
'POST_IMG' => (intval($forum_data['forum_status']) == ITEM_LOCKED) ? $user->img('btn_locked', $post_alt) : $user->img('btn_post', $post_alt),
|
||||||
|
@ -247,16 +245,15 @@ if ($forum_data['forum_postable'])
|
||||||
'S_IS_POSTABLE' => TRUE,
|
'S_IS_POSTABLE' => TRUE,
|
||||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||||
'S_SELECT_SORT_DAYS'=> $s_limit_days,
|
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||||
'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false,
|
'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false,
|
||||||
'S_WATCH_FORUM' => $s_watching_forum,
|
'S_WATCH_FORUM' => $s_watching_forum,
|
||||||
'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . "&start=$start",
|
'S_FORUM_ACTION' => "viewforum.$phpExx$SIDx&f=$forum_id&start=$start",
|
||||||
|
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('f_search', $forum_id)) ? true : false,
|
||||||
|
'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&f=$forum_id",
|
||||||
|
|
||||||
'S_SHOW_SEARCHBOX' => ($auth->acl_gets('f_search', 'm_', 'a_', $forum_id)) ? true : false,
|
'U_POST_NEW_TOPIC' => "posting.$phpEx$SID&mode=post&f=$forum_id",
|
||||||
'S_SEARCHBOX_ACTION'=> "search.$phpEx$SID&f=$forum_id",
|
'U_MARK_READ' => "viewforum.$phpEx$SID&f=$forum_id&mark=topics")
|
||||||
|
|
||||||
'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&mode=post&f=' . $forum_id,
|
|
||||||
'U_MARK_READ' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '&mark=topics')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -269,9 +266,9 @@ if ($forum_data['forum_postable'])
|
||||||
$total_topics = 0;
|
$total_topics = 0;
|
||||||
$row_ary = array();
|
$row_ary = array();
|
||||||
|
|
||||||
$sql_approved = ($auth->acl_gets('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
|
$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
|
||||||
$sql_tracking = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? 'LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')' : '';
|
$sql_tracking = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? 'LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')' : '';
|
||||||
$sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? ', tt.mark_type' : '';
|
$sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? ', tt.mark_type, tt.mark_time' : '';
|
||||||
|
|
||||||
$sql = "SELECT t.* $sql_select
|
$sql = "SELECT t.* $sql_select
|
||||||
FROM (" . TOPICS_TABLE . " t
|
FROM (" . TOPICS_TABLE . " t
|
||||||
|
@ -362,30 +359,33 @@ if ($forum_data['forum_postable'])
|
||||||
$folder_new = 'folder_locked_new';
|
$folder_new = 'folder_locked_new';
|
||||||
}
|
}
|
||||||
|
|
||||||
$unread_topic = true;
|
|
||||||
|
|
||||||
if ($user->data['user_id'] != ANONYMOUS &&
|
$unread_topic = ($user->data['user_id'] != ANONYMOUS) ? true : false;
|
||||||
($row['topic_last_post_time'] <= $row['lastread_time'] ||
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
$row['topic_last_post_time'] < (time() - $config['lastread']))
|
{
|
||||||
)
|
$topic_check = (!$config['load_db_lastread']) ? $tracking_topics[$topic_id] : $row['mark_time'];
|
||||||
|
$forum_check = (!$config['load_db_lastread']) ? $tracking_forums[$forum_id] : $forum_data['mark_time'];
|
||||||
|
|
||||||
|
if ($topic_check > $row['topic_last_post_time'] || $forum_check > $row['topic_last_post_time'])
|
||||||
{
|
{
|
||||||
$unread_topic = false;
|
$unread_topic = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$newest_post_img = ($unread_topic) ? '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&view=newest">' . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : '';
|
$newest_post_img = ($unread_topic) ? "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=unread\">" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : '';
|
||||||
$folder_img = ($unread_topic) ? $folder_new : $folder;
|
$folder_img = ($unread_topic) ? $folder_new : $folder;
|
||||||
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
|
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
|
||||||
|
|
||||||
|
|
||||||
if (($config['load_db_lastread'] || $config['load_db_track']) && $row['mark_type'])
|
if (!empty($row['mark_type']))
|
||||||
{
|
{
|
||||||
$folder_img .= '_posted';
|
$folder_img .= '_posted';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (intval($row['poll_start']))
|
if (!empty($row['poll_start']))
|
||||||
{
|
{
|
||||||
$topic_type .= $user->lang['VIEW_TOPIC_POLL'];
|
$topic_type .= $user->lang['VIEW_TOPIC_POLL'];
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ if ($forum_data['forum_postable'])
|
||||||
$times = 1;
|
$times = 1;
|
||||||
for($j = 0; $j < $replies + 1; $j += intval($config['posts_per_page']))
|
for($j = 0; $j < $replies + 1; $j += intval($config['posts_per_page']))
|
||||||
{
|
{
|
||||||
$goto_page .= '<a href="viewtopic.' . $phpEx . $SID . '&t=' . $topic_id . '&start=' . $j . '">' . $times . '</a>';
|
$goto_page .= "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$j\">$times</a>";
|
||||||
if ($times == 1 && $total_pages > 4)
|
if ($times == 1 && $total_pages > 4)
|
||||||
{
|
{
|
||||||
$goto_page .= ' ... ';
|
$goto_page .= ' ... ';
|
||||||
|
@ -424,9 +424,9 @@ if ($forum_data['forum_postable'])
|
||||||
|
|
||||||
|
|
||||||
// Generate all the URIs ...
|
// Generate all the URIs ...
|
||||||
$view_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id;
|
$view_topic_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id";
|
||||||
|
|
||||||
$last_post_img = '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
|
$last_post_img = "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
|
||||||
|
|
||||||
$topic_author = ($row['topic_poster'] != ANONYMOUS) ? "<a href=\"memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['topic_poster'] . '">' : '';
|
$topic_author = ($row['topic_poster'] != ANONYMOUS) ? "<a href=\"memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['topic_poster'] . '">' : '';
|
||||||
$topic_author .= ($row['topic_poster'] != ANONYMOUS) ? $row['topic_first_poster_name'] : (($row['topic_first_poster_name'] != '') ? $row['topic_first_poster_name'] : $user->lang['GUEST']);
|
$topic_author .= ($row['topic_poster'] != ANONYMOUS) ? $row['topic_first_poster_name'] : (($row['topic_first_poster_name'] != '') ? $row['topic_first_poster_name'] : $user->lang['GUEST']);
|
||||||
|
@ -476,14 +476,41 @@ if ($forum_data['forum_postable'])
|
||||||
|
|
||||||
$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE) ? 1 : 0;
|
$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE) ? 1 : 0;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
if ($config['load_db_lastread'])
|
||||||
{
|
{
|
||||||
// $mark_topics isn't set as of now
|
if ($row['mark_time'] > $row['topic_last_post_time'] && !isset($update_forum))
|
||||||
//setcookie($config['cookie_name'] . '_t', serialize($mark_topics), 0, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
{
|
||||||
|
$update_forum = true;
|
||||||
|
}
|
||||||
|
else if ((isset($row['mark_time']) && $row['topic_last_post_time'] > $row['mark_time']) || (empty($row['mark_time']) && $row['topic_last_post_time'] > $forum_data['mark_time']))
|
||||||
|
{
|
||||||
|
$update_forum = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($tracking_topics[$topic_id] > $row['topic_last_post_time'] && !isset($update_forum))
|
||||||
|
{
|
||||||
|
$update_forum = true;
|
||||||
|
}
|
||||||
|
else if ((isset($tracking_topics[$topic_id]) && $row['topic_last_post_time'] > $tracking_topics[$topic_id]) || (!isset($tracking_topics[$topic_id]) && $row['topic_last_post_time'] > $tracking_forums[$forum_id]))
|
||||||
|
{
|
||||||
|
$update_forum = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This is rather a fudge but it's the best I can think of without requiring information
|
||||||
|
// 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 ($user->data['user_id'] != ANONYMOUS && $update_forum)
|
||||||
|
{
|
||||||
|
markread('mark', $forum_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
||||||
if (!$row['user_allow_viewonline'] || !$row['session_allow_viewonline'])
|
if (!$row['user_allow_viewonline'] || !$row['session_allow_viewonline'])
|
||||||
{
|
{
|
||||||
$view_online = ($auth->acl_gets('u_viewonline', 'a_')) ? true : false;
|
$view_online = ($auth->acl_gets('u_viewonline')) ? true : false;
|
||||||
$hidden_users++;
|
$hidden_users++;
|
||||||
|
|
||||||
$username = '<i>' . $username . '</i>';
|
$username = '<i>' . $username . '</i>';
|
||||||
|
|
|
@ -24,6 +24,12 @@ $phpbb_root_path = './';
|
||||||
include($phpbb_root_path . 'extension.inc');
|
include($phpbb_root_path . 'extension.inc');
|
||||||
include($phpbb_root_path . 'common.'.$phpEx);
|
include($phpbb_root_path . 'common.'.$phpEx);
|
||||||
|
|
||||||
|
|
||||||
|
// Start session management
|
||||||
|
$user->start();
|
||||||
|
$auth->acl($user->data);
|
||||||
|
|
||||||
|
|
||||||
// Initial var setup
|
// Initial var setup
|
||||||
$forum_id = (isset($_GET['f'])) ? max(intval($_GET['f']), 0) : 0;
|
$forum_id = (isset($_GET['f'])) ? max(intval($_GET['f']), 0) : 0;
|
||||||
$topic_id = (isset($_GET['t'])) ? max(intval($_GET['t']), 0) : 0;
|
$topic_id = (isset($_GET['t'])) ? max(intval($_GET['t']), 0) : 0;
|
||||||
|
@ -49,32 +55,49 @@ if (empty($topic_id) && empty($post_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Start session management
|
|
||||||
$user->start();
|
|
||||||
|
|
||||||
// Configure style, language, etc.
|
|
||||||
$auth->acl($user->data);
|
|
||||||
|
|
||||||
// Find topic id if user requested a newer or older topic
|
// Find topic id if user requested a newer or older topic
|
||||||
if (isset($_GET['view']) && empty($post_id))
|
if (isset($_GET['view']) && empty($post_id))
|
||||||
{
|
{
|
||||||
if ($_GET['view'] == 'newest')
|
if ($_GET['view'] == 'unread')
|
||||||
{
|
{
|
||||||
if ($user->session_id)
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
|
if ($config['load_db_lastread'])
|
||||||
|
{
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'oracle':
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$sql_lastread = 'LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . $user->data['user_id'] . '
|
||||||
|
AND tt.topic_id = p.topic_id)';
|
||||||
|
$sql_unread_time = ' tt.mark_time OR tt.mark_time IS NULL';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array();
|
||||||
|
$sql_unread_time = (!empty($tracking_topics[$topic_id])) ? $tracking_topics[$topic_id] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT p.post_id
|
$sql = "SELECT p.post_id
|
||||||
FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u
|
FROM (" . POSTS_TABLE . " p
|
||||||
WHERE s.session_id = '$user->session_id'
|
$sql_lastread)
|
||||||
AND u.user_id = s.session_user_id
|
WHERE p.topic_id = $topic_id
|
||||||
AND p.topic_id = $topic_id
|
|
||||||
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1') . "
|
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1') . "
|
||||||
AND p.post_time >= u.user_lastvisit
|
AND (p.post_time >= $sql_unread_time)
|
||||||
ORDER BY p.post_time ASC";
|
ORDER BY p.post_time ASC";
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
|
||||||
if (!($row = $db->sql_fetchrow($result)))
|
if (!($row = $db->sql_fetchrow($result)))
|
||||||
{
|
{
|
||||||
trigger_error('No_new_posts_last_visit');
|
// Setup user environment so we can process lang string
|
||||||
|
$user->setup();
|
||||||
|
|
||||||
|
meta_refresh(3, "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id");
|
||||||
|
$message = $user->lang['NO_UNREAD_POSTS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id\">", '</a>');
|
||||||
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect("viewtopic.$phpEx$SID&p=" . $row['post_id'] . "#" . $row['post_id']);
|
redirect("viewtopic.$phpEx$SID&p=" . $row['post_id'] . "#" . $row['post_id']);
|
||||||
|
@ -154,7 +177,6 @@ if ($user->data['user_id'] != ANONYMOUS)
|
||||||
// is done so navigation, forum name, etc. remain consistent with where
|
// is done so navigation, forum name, etc. remain consistent with where
|
||||||
// user clicked to view a global topic
|
// user clicked to view a global topic
|
||||||
|
|
||||||
// Note: I can't remember if it was suggested but we could create a virtual forum for globals with forum_id = 0 (altough MySQL would not like it much because of the auto_increment phpbb_forum.forum_id field =\)
|
|
||||||
// Note2: after much inspection, having to find a valid forum_id when making return_to_topic links for global announcements in mcp is a pain. The easiest solution is to let admins choose under what forum topics should be seen when forum_id is not specified (preferably a public forum)
|
// Note2: after much inspection, having to find a valid forum_id when making return_to_topic links for global announcements in mcp is a pain. The easiest solution is to let admins choose under what forum topics should be seen when forum_id is not specified (preferably a public forum)
|
||||||
if (!$forum_id)
|
if (!$forum_id)
|
||||||
{
|
{
|
||||||
|
@ -177,7 +199,8 @@ if (!$topic_data = $db->sql_fetchrow($result))
|
||||||
extract($topic_data);
|
extract($topic_data);
|
||||||
|
|
||||||
|
|
||||||
$user->setup();
|
// Setup look and feel
|
||||||
|
$user->setup(false, $forum_style);
|
||||||
|
|
||||||
|
|
||||||
// Start auth check
|
// Start auth check
|
||||||
|
@ -350,28 +373,10 @@ $reply_img = ($forum_status == ITEM_LOCKED || $topic_status == ITEM_LOCKED) ? $u
|
||||||
$post_img = ($forum_status == ITEM_LOCKED) ? $user->img('post_locked', $user->lang['FORUM_LOCKED']) : $user->img('btn_post', $user->lang['POST_NEW_TOPIC']);
|
$post_img = ($forum_status == ITEM_LOCKED) ? $user->img('post_locked', $user->lang['FORUM_LOCKED']) : $user->img('btn_post', $user->lang['POST_NEW_TOPIC']);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Set a cookie for this topic
|
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
|
||||||
{
|
|
||||||
$mark_topics = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_t'])) : array();
|
|
||||||
|
|
||||||
$mark_topics[$forum_id][$topic_id] = 0;
|
|
||||||
setcookie($config['cookie_name'] . '_t', serialize($mark_topics), 0, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Grab censored words
|
// Grab censored words
|
||||||
$censors = array();
|
$censors = array();
|
||||||
obtain_word_list($censors);
|
obtain_word_list($censors);
|
||||||
|
|
||||||
// Replace naughty words in title
|
|
||||||
if (sizeof($censors))
|
|
||||||
{
|
|
||||||
$topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Navigation links
|
// Navigation links
|
||||||
generate_forum_nav($topic_data);
|
generate_forum_nav($topic_data);
|
||||||
|
@ -385,6 +390,12 @@ get_moderators($forum_moderators, $forum_id);
|
||||||
// This is only used for print view so ...
|
// This is only used for print view so ...
|
||||||
$server_path = (!isset($_GET['view'])) ? '' : (($config['cookie_secure']) ? 'https://' : 'http://') . trim($config['server_name']) . (($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/') . trim($config['script_path']) . '/';
|
$server_path = (!isset($_GET['view'])) ? '' : (($config['cookie_secure']) ? 'https://' : 'http://') . trim($config['server_name']) . (($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/') . trim($config['script_path']) . '/';
|
||||||
|
|
||||||
|
// Replace naughty words in title
|
||||||
|
if (sizeof($censors))
|
||||||
|
{
|
||||||
|
$topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title);
|
||||||
|
}
|
||||||
|
|
||||||
// Send vars to template
|
// Send vars to template
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'FORUM_ID' => $forum_id,
|
'FORUM_ID' => $forum_id,
|
||||||
|
@ -395,7 +406,7 @@ $template->assign_vars(array(
|
||||||
'PAGINATION' => (isset($_GET['view']) && $_GET['view'] == 'print') ? '' : $pagination,
|
'PAGINATION' => (isset($_GET['view']) && $_GET['view'] == 'print') ? '' : $pagination,
|
||||||
'PAGE_NUMBER' => (isset($_GET['view']) && $_GET['view'] == 'print') ? '' : on_page($total_posts, $config['posts_per_page'], $start),
|
'PAGE_NUMBER' => (isset($_GET['view']) && $_GET['view'] == 'print') ? '' : on_page($total_posts, $config['posts_per_page'], $start),
|
||||||
'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts),
|
'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts),
|
||||||
'MCP' => ($auth->acl_get('m_', $forum_id)) ? sprintf($user->lang['MCP'], "<a href=\"mcp.$phpEx?sid=" . $user->session_id . "&t=$topic_id&start=$start&st=$sort_days&sk=$sort_key&sd=$sort_dir&posts_per_page=" . $config['posts_per_page'] . '">', '</a>') : '',
|
'MCP' => ($auth->acl_get('m_', $forum_id)) ? sprintf($user->lang['MCP'], "<a href=\"mcp.$phpEx?sid=" . $user->session_id . "&f=$forum_id&t=$topic_id&start=$start&st=$sort_days&sk=$sort_key&sd=$sort_dir&posts_per_page=" . $config['posts_per_page'] . '">', '</a>') : '',
|
||||||
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '',
|
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '',
|
||||||
|
|
||||||
'POST_IMG' => $post_img,
|
'POST_IMG' => $post_img,
|
||||||
|
@ -409,23 +420,23 @@ $template->assign_vars(array(
|
||||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||||
'S_TOPIC_ACTION' => "viewtopic.$phpEx$SID&t=" . $topic_id . "&start=$start",
|
'S_TOPIC_ACTION' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start",
|
||||||
'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="mode">' . $topic_mod . '</select>' : '',
|
'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="mode">' . $topic_mod . '</select>' : '',
|
||||||
'S_MOD_ACTION' => "mcp.$phpEx?sid=" . $user->session_id . "&t=$topic_id&quickmod=1",
|
'S_MOD_ACTION' => "mcp.$phpEx?sid=" . $user->session_id . "&t=$topic_id&quickmod=1",
|
||||||
|
|
||||||
'S_WATCH_TOPIC' => $s_watching_topic,
|
'S_WATCH_TOPIC' => $s_watching_topic,
|
||||||
'S_SHOW_SEARCHBOX' => ($auth->acl_get('f_search', $forum_id)) ? true : false,
|
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('f_search', $forum_id)) ? true : false,
|
||||||
'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&f=$forum_id",
|
'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&f=$forum_id",
|
||||||
|
|
||||||
'U_TOPIC' => $server_path . 'viewtopic.' . $phpEx . '?t=' . $topic_id,
|
'U_TOPIC' => $server_path . "viewtopic.$phpEx?f=$forum_id&t=$topic_id",
|
||||||
'U_FORUM' => $server_path,
|
'U_FORUM' => $server_path,
|
||||||
|
|
||||||
'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&t=$topic_id&start=$start&st=$sort_days&sk=$sort_key&sd=$sort_dir&hilit=$highlight",
|
'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start&st=$sort_days&sk=$sort_key&sd=$sort_dir&hilit=$highlight",
|
||||||
'U_VIEW_FORUM' => $view_forum_url,
|
'U_VIEW_FORUM' => $view_forum_url,
|
||||||
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
|
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
|
||||||
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
|
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
|
||||||
'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir&view=print",
|
'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir&view=print",
|
||||||
'U_EMAIL_TOPIC' => "viewtopic.$phpEx$SID&t=$topic_id&view=email",
|
'U_EMAIL_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=email",
|
||||||
|
|
||||||
'U_POST_NEW_TOPIC' => $new_topic_url,
|
'U_POST_NEW_TOPIC' => $new_topic_url,
|
||||||
'U_POST_REPLY_TOPIC' => $reply_topic_url)
|
'U_POST_REPLY_TOPIC' => $reply_topic_url)
|
||||||
|
@ -447,6 +458,8 @@ if (!empty($poll_start))
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
|
{
|
||||||
$sql = "SELECT poll_option_id
|
$sql = "SELECT poll_option_id
|
||||||
FROM " . POLL_VOTES_TABLE . "
|
FROM " . POLL_VOTES_TABLE . "
|
||||||
WHERE topic_id = $topic_id
|
WHERE topic_id = $topic_id
|
||||||
|
@ -463,42 +476,71 @@ if (!empty($poll_start))
|
||||||
while ($row = $db->sql_fetchrow($result));
|
while ($row = $db->sql_fetchrow($result));
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
if (isset($_POST['castvote']))
|
else
|
||||||
{
|
{
|
||||||
if (sizeof($voted_id) == $poll_max_options && !$auth->acl_get('f_votechg', $forum_id))
|
// Cookie based guest tracking ... I don't like this but hum ho
|
||||||
|
// it's oft requested. This relies on "nice" users who don't feel
|
||||||
|
// the need to delete cookies to mess with results. We could get
|
||||||
|
// a little more clever by time limiting based on ip's but ultimately
|
||||||
|
// it can be overcome without great difficulty.
|
||||||
|
if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]))
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['ALREADY_VOTED']);
|
$voted_id = explode(',', $_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$s_can_vote = (((!sizeof($voted_id) && $auth->acl_get('f_vote', $forum_id)) || $auth->acl_get('f_votechg', $forum_id)) &&
|
||||||
|
($poll_length != 0 && $poll_start + $poll_length > time()) &&
|
||||||
|
$topic_status != ITEM_LOCKED &&
|
||||||
|
$forum_status != ITEM_LOCKED) ? true : false;
|
||||||
|
$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($voted_id)) || $_GET['vote'] = 'viewresult') ? true : false;
|
||||||
|
|
||||||
|
if (isset($_POST['castvote']) && $s_can_vote)
|
||||||
|
{
|
||||||
$voted_id = array_map('intval', $_POST['vote_id']);
|
$voted_id = array_map('intval', $_POST['vote_id']);
|
||||||
|
|
||||||
if (!sizeof($voted_id) || sizeof($voted_id) > $poll_max_options)
|
if (!sizeof($voted_id) || sizeof($voted_id) > $poll_max_options)
|
||||||
{
|
{
|
||||||
$message = (!sizeof($option_voted)) ? 'NO_VOTE_OPTION' : 'TOO_MANY_VOTE_OPTIONS';
|
meta_refresh(5, "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id");
|
||||||
trigger_error($user->lang[$message]);
|
|
||||||
|
$message = (!sizeof($voted_id)) ? 'NO_VOTE_OPTION' : 'TOO_MANY_VOTE_OPTIONS';
|
||||||
|
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id\">", '</a>');
|
||||||
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($voted_id as $option)
|
foreach ($voted_id as $option)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO ' . POLL_VOTES_TABLE . " (topic_id, poll_option_id, vote_user_id, vote_user_ip)
|
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . "
|
||||||
VALUES ($topic_id, $option, " . $user->data['user_id'] . ", '$user->ip')";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$sql = "UPDATE " . POLL_OPTIONS_TABLE . "
|
|
||||||
SET poll_option_total = poll_option_total + 1
|
SET poll_option_total = poll_option_total + 1
|
||||||
WHERE poll_option_id = $option
|
WHERE poll_option_id = $option
|
||||||
AND topic_id = $topic_id";
|
AND topic_id = $topic_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "UPDATE " . TOPICS_TABLE . "
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
SET poll_last_vote = " . time() . "
|
{
|
||||||
WHERE topic_id = $topic_id";
|
$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')";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$display_results = (sizeof($voted_id) || ($poll_length != 0 && $poll_start + $poll_length < time()) || $_GET['vote'] == 'viewresult' || !$auth->acl_get('f_vote', $forum_id) || $topic_status == ITEM_LOCKED || $forum_status == ITEM_LOCKED) ? true : false;
|
if ($user->data['user_id'] == ANONYMOUS)
|
||||||
|
{
|
||||||
|
setcookie($config['cookie_name'] . '_poll_' . $topic_id, implode(',', $voted_id), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||||
|
SET poll_last_vote = ' . time() . ', topic_last_post_time = ' . time() . "
|
||||||
|
WHERE topic_id = $topic_id";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
|
||||||
|
meta_refresh(5, "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id");
|
||||||
|
|
||||||
|
$message = $user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id\">", '</a>');
|
||||||
|
trigger_error($message);
|
||||||
|
}
|
||||||
|
|
||||||
$poll_total = 0;
|
$poll_total = 0;
|
||||||
foreach ($poll_info as $poll_option)
|
foreach ($poll_info as $poll_option)
|
||||||
|
@ -516,7 +558,7 @@ if (!empty($poll_start))
|
||||||
'POLL_OPTION_ID' => $poll_option['poll_option_id'],
|
'POLL_OPTION_ID' => $poll_option['poll_option_id'],
|
||||||
'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'],
|
'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'],
|
||||||
'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
|
'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
|
||||||
'POLL_OPTION_PERCENT' => $vote_percent,
|
'POLL_OPTION_PERCENT' => $option_pct_txt,
|
||||||
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * $user->theme['poll_length']), true),
|
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * $user->theme['poll_length']), true),
|
||||||
'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $voted_id)) ? true : false)
|
'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $voted_id)) ? true : false)
|
||||||
);
|
);
|
||||||
|
@ -529,9 +571,11 @@ if (!empty($poll_start))
|
||||||
'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
|
'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
|
||||||
|
|
||||||
'L_MAX_VOTES' => ($poll_max_options == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $poll_max_options),
|
'L_MAX_VOTES' => ($poll_max_options == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $poll_max_options),
|
||||||
|
'L_POLL_LENGTH' => ($poll_length) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($poll_length + $poll_start)) : '',
|
||||||
|
|
||||||
'S_HAS_POLL_OPTIONS'=> !$display_results,
|
'S_HAS_POLL' => true,
|
||||||
'S_HAS_POLL_DISPLAY'=> $display_results,
|
'S_CAN_VOTE' => $s_can_vote,
|
||||||
|
'S_DISPLAY_RESULTS' => $s_display_results,
|
||||||
'S_IS_MULTI_CHOICE' => ($poll_max_options > 1) ? true : false,
|
'S_IS_MULTI_CHOICE' => ($poll_max_options > 1) ? true : false,
|
||||||
'S_POLL_ACTION' => "viewtopic.$phpEx$SID&t=$topic_id&sk=$sort_key&sd=$sort_dir",
|
'S_POLL_ACTION' => "viewtopic.$phpEx$SID&t=$topic_id&sk=$sort_key&sd=$sort_dir",
|
||||||
|
|
||||||
|
@ -612,6 +656,11 @@ do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Define the global bbcode bitfield, will be used to load bbcodes
|
||||||
|
$bbcode_bitfield |= $row['bbcode_bitfield'];
|
||||||
|
|
||||||
|
|
||||||
// Cache various user specific data ... so we don't have to recompute
|
// Cache various user specific data ... so we don't have to recompute
|
||||||
// this each time the same user appears on this page
|
// this each time the same user appears on this page
|
||||||
if (!isset($user_cache[$poster_id]))
|
if (!isset($user_cache[$poster_id]))
|
||||||
|
@ -648,15 +697,18 @@ do
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$user_sig = ($row['user_sig'] && $config['allow_sig']) ? $row['user_sig'] : '';
|
$user_sig = '';
|
||||||
if ($user_sig)
|
if ($row['enable_sig'] && $row['user_sig'] && $config['allow_sig'])
|
||||||
{
|
{
|
||||||
|
$user_sig = $row['user_sig'];
|
||||||
|
$bbcode_bitfield |= $row['user_sig_bbcode_bitfield'];
|
||||||
|
|
||||||
// if (!$auth->acl_get('f_html', $forum_id))
|
// if (!$auth->acl_get('f_html', $forum_id))
|
||||||
// {
|
// {
|
||||||
// $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig);
|
// $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$user_sig = (empty($row['user_allowsmile']) || empty($config['enable_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $user_sig) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $user_sig);
|
$user_sig = ($row['user_allowsmile'] || $config['enable_smilies']) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $user_sig) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $user_sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile_url = "memberlist.$phpEx$SID&mode=viewprofile&u=$poster_id";
|
$profile_url = "memberlist.$phpEx$SID&mode=viewprofile&u=$poster_id";
|
||||||
|
@ -664,15 +716,17 @@ do
|
||||||
$aim_url = "memberlist.$phpEx$SID&mode=contact&action=aim&u=$poster_id";
|
$aim_url = "memberlist.$phpEx$SID&mode=contact&action=aim&u=$poster_id";
|
||||||
$msn_url = "memberlist.$phpEx$SID&mode=contact&action=msnm&u=$poster_id";
|
$msn_url = "memberlist.$phpEx$SID&mode=contact&action=msnm&u=$poster_id";
|
||||||
$yim_url = 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg';
|
$yim_url = 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg';
|
||||||
$search_url = 'search.' . $phpEx . $SID . '&search_author=' . urlencode($row['username']) .'"&showresults=posts';
|
$search_url = "search.$phpEx$SID&search_author=" . urlencode($row['username']) .'&showresults=posts';
|
||||||
|
|
||||||
$user_cache[$poster_id] = array(
|
$user_cache[$poster_id] = array(
|
||||||
'joined' => $user->lang['JOINED'] . ': ' . $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']),
|
'joined' => $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']),
|
||||||
'posts' => $user->lang['POSTS'] . ': ' . $row['user_posts'],
|
'posts' => (!empty($row['user_posts'])) ? $row['user_posts'] : '',
|
||||||
'from' => ($row['user_from']) ? $user->lang['LOCATION'] . ': ' . $row['user_from'] : '',
|
'from' => (!empty($row['user_from'])) ? $row['user_from'] : '',
|
||||||
|
|
||||||
'sig' => $user_sig,
|
'sig' => $user_sig,
|
||||||
'sig_bbcode_uid'=> $row['user_sig_bbcode_uid'],
|
'sig_bbcode_uid' => (!empty($row['user_sig_bbcode_uid'])) ? $row['user_sig_bbcode_uid'] : '',
|
||||||
'sig_bbcode_bitfield' => $row['user_sig_bbcode_bitfield'],
|
'sig_bbcode_bitfield' => (!empty($row['user_sig_bbcode_bitfield'])) ? $row['user_sig_bbcode_bitfield'] : '',
|
||||||
|
|
||||||
'avatar' => '',
|
'avatar' => '',
|
||||||
|
|
||||||
'profile_img' => '<a href="' . $profile_url . '">' . $user->img('btn_profile', $user->lang['READ_PROFILE']) . '</a>',
|
'profile_img' => '<a href="' . $profile_url . '">' . $user->img('btn_profile', $user->lang['READ_PROFILE']) . '</a>',
|
||||||
|
@ -755,13 +809,6 @@ do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the global bbcode bitfield, will be used to load bbcodes
|
|
||||||
$bbcode_bitfield |= $row['bbcode_bitfield'];
|
|
||||||
if ($row['enable_sig'])
|
|
||||||
{
|
|
||||||
$bbcode_bitfield |= $row['user_sig_bbcode_bitfield'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
while ($row = $db->sql_fetchrow($result));
|
while ($row = $db->sql_fetchrow($result));
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -876,11 +923,11 @@ foreach ($rowset as $key => $row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// End signature parsing, only if needed
|
// End signature parsing, only if needed
|
||||||
if ($row['enable_sig'] && $user_cache[$poster_id]['sig'] && empty($user_cache['sig_parsed']))
|
if ($user_cache[$poster_id]['sig'] && empty($user_cache['sig_parsed']))
|
||||||
{
|
{
|
||||||
if ($user_cache[$poster_id]['sig_bbcode_bitfield'])
|
if ($user_cache[$poster_id]['sig_bbcode_bitfield'])
|
||||||
{
|
{
|
||||||
$bbcode->bbcode_second_pass(&$user_cache[$poster_id]['sig'], $row['sig_bbcode_uid'], $row['sig_bbcode_bitfield']);
|
$bbcode->bbcode_second_pass(&$user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($censors))
|
if (count($censors))
|
||||||
|
@ -888,7 +935,7 @@ foreach ($rowset as $key => $row)
|
||||||
$user_cache[$poster_id]['sig'] = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $user_cache[$poster_id]['sig'] . '<'), 1, -1));
|
$user_cache[$poster_id]['sig'] = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $user_cache[$poster_id]['sig'] . '<'), 1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_cache[$poster_id]['sig'] = str_replace("\n", "<br />", $user_cache[$poster_id]['user_sig']);
|
$user_cache[$poster_id]['sig'] = str_replace("\n", '<br />', $user_cache[$poster_id]['sig']);
|
||||||
$user_cache[$poster_id]['sig_parsed'] = TRUE;
|
$user_cache[$poster_id]['sig_parsed'] = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1015,7 +1062,7 @@ foreach ($rowset as $key => $row)
|
||||||
'POST_DATE' => $user->format_date($row['post_time']),
|
'POST_DATE' => $user->format_date($row['post_time']),
|
||||||
'POST_SUBJECT' => $row['post_subject'],
|
'POST_SUBJECT' => $row['post_subject'],
|
||||||
'MESSAGE' => $message,
|
'MESSAGE' => $message,
|
||||||
'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '',
|
'SIGNATURE' => $user_cache[$poster_id]['sig'],
|
||||||
'EDITED_MESSAGE'=> $l_edited_by,
|
'EDITED_MESSAGE'=> $l_edited_by,
|
||||||
|
|
||||||
'RATING' => $rating,
|
'RATING' => $rating,
|
||||||
|
@ -1282,9 +1329,6 @@ unset($rowset);
|
||||||
unset($user_cache);
|
unset($user_cache);
|
||||||
|
|
||||||
|
|
||||||
// Mark topics read
|
|
||||||
markread('topic', $forum_id, $topic_id, $topic_data['topic_last_post_id']);
|
|
||||||
|
|
||||||
// Udate the attachment download counts
|
// Udate the attachment download counts
|
||||||
if (count($update_count))
|
if (count($update_count))
|
||||||
{
|
{
|
||||||
|
@ -1319,12 +1363,17 @@ $nav_links['up'] = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Mark topics read
|
||||||
|
markread('topic', $forum_id, $topic_id, $topic_data['topic_last_post_id']);
|
||||||
|
|
||||||
|
|
||||||
// Change encoding if appropriate
|
// Change encoding if appropriate
|
||||||
if ($force_encoding != '')
|
if ($force_encoding != '')
|
||||||
{
|
{
|
||||||
$user->lang['ENCODING'] = $force_encoding;
|
$user->lang['ENCODING'] = $force_encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Output the page
|
// Output the page
|
||||||
$page_title = $user->lang['View_topic'] .' - ' . $topic_title;
|
$page_title = $user->lang['View_topic'] .' - ' . $topic_title;
|
||||||
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
||||||
|
|
Loading…
Add table
Reference in a new issue