Cache moderator names? Output moderators for all forums in viewforum. Alter a few things in templates

git-svn-id: file:///svn/phpbb/trunk@3061 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-11-18 21:04:45 +00:00
parent ce40939e60
commit 6e910ca116
11 changed files with 287 additions and 212 deletions

View file

@ -104,6 +104,8 @@ if (isset($_POST['update']))
$auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']);
}
cache_moderators();
trigger_error('Permissions updated successfully');
}
else if (isset($_POST['delete']))
@ -135,6 +137,8 @@ else if (isset($_POST['delete']))
$auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids);
}
cache_moderators();
trigger_error('Permissions updated successfully');
}

View file

@ -105,44 +105,11 @@ function get_moderators(&$forum_moderators, $forum_id = false)
$forum_moderators[$row['forum_id']][] = (!empty($row['user_id'])) ? '<a href="profile.' . $phpEx . $SID . '&amp;mode=viewprofile&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>' : '<a href="groupcp.' . $phpEx . $SID . '&amp;g=' . $row['group_id'] . '">' . $row['groupname'] . '</a>';
}
$db->sql_freeresult($result);
/*
$sql = "SELECT a.forum_id, u.user_id, u.username
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_USERS_TABLE . " a, " . USERS_TABLE . " u
WHERE a.auth_option_id = o.auth_option_id
AND a.user_id = u.user_id
AND o.auth_value = 'm_'
AND a.auth_allow_deny = 1
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_moderators[$row['forum_id']][] = '<a href="profile.' . $phpEx . $SID . '&amp;mode=viewprofile&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>';
}
$db->sql_freeresult($result);
$sql = "SELECT a.forum_id, g.group_name, g.group_id
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_GROUPS_TABLE . " a, " . GROUPS_TABLE . " g
WHERE a.auth_option_id = o.auth_option_id
AND a.group_id = g.group_id
AND o.auth_value = 'm_'
AND a.auth_allow_deny = 1
AND g.group_type <> " . GROUP_HIDDEN . "
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_moderators[$row['forum_id']][] = '<a href="groupcp.' . $phpEx . $SID . '&amp;g=' . $row['group_id'] . '">' . $row['group_name'] . '</a>';
}
$db->sql_freeresult($result);
*/
return;
}
//
// User authorisation levels output
//
function get_forum_rules($mode, &$rules, &$forum_id)
{
global $SID, $auth, $user;

View file

@ -454,6 +454,110 @@ function config_cache_write($match, $data)
return;
}
// Cache moderators, called whenever permissions are
// changed via admin_permissions. Changes of username
// and group names must be carried through for the
// moderators table
function cache_moderators($forum_id = false)
{
global $db;
if (!empty($forum_id) && is_array($forum_id))
{
$forum_sql = 'AND forum_id IN (' . implode(', ', $forum_id) . ')';
}
else
{
$forum_sql = ($forum_id) ? 'AND forum_id = ' . $forum_id : '';
}
// Clear table
$db->sql_query('TRUNCATE ' . MODERATOR_TABLE);
// Holding array
$m_sql = array();
$user_id_sql = '';
$sql = "SELECT a.forum_id, u.user_id, u.username
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_USERS_TABLE . " a, " . USERS_TABLE . " u
WHERE o.auth_value = 'm_'
AND a.auth_option_id = o.auth_option_id
AND a.auth_allow_deny = 1
AND u.user_id = a.user_id
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$m_sql['f_' . $row['forum_id'] . '_u_' . $row['user_id']] = $row['forum_id'] . ', ' . $row['user_id'] . ', \'' . $row['username'] . '\', NULL, NULL';
$user_id_sql .= (($user_id_sql) ? ', ' : '') . $row['user_id'];
}
$db->sql_freeresult($result);
// Remove users who have group memberships with DENY moderator permissions
if ($user_id_sql)
{
$sql = "SELECT a.forum_id, ug.user_id
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_GROUPS_TABLE . " a, " . USER_GROUP_TABLE . " ug
WHERE o.auth_value = 'm_'
AND a.auth_option_id = o.auth_option_id
AND a.auth_allow_deny = 0
AND a.group_id = ug.group_id
AND ug.user_id IN ($user_id_sql)
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
unset($m_sql['f_' . $row['forum_id'] . '_u_' . $row['user_id']]);
}
$db->sql_freeresult($result);
}
$sql = "SELECT a.forum_id, g.group_name, g.group_id
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_GROUPS_TABLE . " a, " . GROUPS_TABLE . " g
WHERE o.auth_value = 'm_'
AND a.auth_option_id = o.auth_option_id
AND a.auth_allow_deny = 1
AND g.group_id = a.group_id
AND g.group_type NOT IN (" . GROUP_HIDDEN . ", " . GROUP_SPECIAL . ")
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$m_sql['f_' . $row['forum_id'] . '_g_' . $row['group_id']] = $row['forum_id'] . ', NULL, NULL, ' . $row['group_id'] . ', \'' . $row['group_name'] . '\'';
}
$db->sql_freeresult($result);
if (sizeof($m_sql))
{
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname) VALUES ' . implode(', ', preg_replace('#^(.*)$#', '(\1)', $m_sql));
$result = $db->sql_query($sql);
$db->sql_freeresult($result);
break;
case 'mssql':
$sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname)
VALUES ' . implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \1', $m_sql));
$result = $db->sql_query($sql);
$db->sql_freeresult($result);
break;
default:
foreach ($m_sql as $k => $sql)
{
$result = $db->sql_query('INSERT INTO ' . MODERATOR_TABLE . " (forum_id, user_id, username, group_id, groupname) VALUES ($sql)");
$db->sql_freeresult($result);
}
}
}
}
// Extension of auth class for changing permissions
class auth_admin extends auth
{

View file

@ -21,7 +21,7 @@
function display_forums($root_data=array(), $display_moderators=TRUE)
{
global $db, $template, $auth, $user, $phpEx, $SID;
global $db, $template, $auth, $user, $phpEx, $SID, $forum_moderators;
$where_sql = ($root_data['forum_id']) ? ' WHERE left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'] : '';
@ -29,7 +29,8 @@ function display_forums($root_data=array(), $display_moderators=TRUE)
$result = $db->sql_query($sql);
$branch_root_id = $root_data['forum_id'];
$forum_rows = $subforums = $forum_ids = $forum_moderators = array();
$forum_rows = $subforums = $forum_moderators = array();
$forum_ids = array($root_data['forum_id']);
while ($row = $db->sql_fetchrow($result))
{
@ -60,26 +61,19 @@ function display_forums($root_data=array(), $display_moderators=TRUE)
// Direct child
$forum_rows[] = $row;
$parent_id = $row['forum_id'];
$forum_ids[] = $row['forum_id'];
if (!$row['forum_postable'])
{
$branch_root_id = $row['forum_id'];
}
else
{
$forum_ids[] = $row['forum_id'];
}
}
elseif ($row['parent_id'] == $branch_root_id)
{
// Forum directly under a category
$forum_rows[] = $row;
$parent_id = $row['forum_id'];
if ($row['forum_postable'])
{
$forum_ids[] = $row['forum_id'];
}
$forum_ids[] = $row['forum_id'];
}
elseif ($row['forum_postable'])
{

View file

@ -21,7 +21,7 @@
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
if (!defined('IN_PHPBB'))
{
die('Hacking attempt');
exit;
@ -78,7 +78,7 @@ if ($mode == 'register' && !isset($_POST['agreed']) && !isset($_GET['agreed']) &
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
$coppa = ( empty($_POST['coppa']) && empty($_GET['coppa']) ) ? 0 : TRUE;
$coppa = (empty($_POST['coppa']) && empty($_GET['coppa'])) ? 0 : TRUE;
//
// Check and initialize some variables if needed
@ -95,7 +95,7 @@ if (isset($_POST['submit']) || $mode == 'register')
foreach ($strip_var_list as $var => $param)
{
if ( !empty($_POST[$param]) )
if (!empty($_POST[$param]))
{
$$var = trim(strip_tags($_POST[$param]));
}
@ -105,7 +105,7 @@ if (isset($_POST['submit']) || $mode == 'register')
foreach ($strip_var_list as $var => $param)
{
if ( !empty($_POST[$param]) )
if (!empty($_POST[$param]))
{
$$var = trim($_POST[$param]);
}
@ -119,34 +119,34 @@ if (isset($_POST['submit']) || $mode == 'register')
// empty strings if they fail.
validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
$viewemail = ( isset($_POST['viewemail']) ) ? ( ($_POST['viewemail']) ? TRUE : 0 ) : 0;
$allowviewonline = ( isset($_POST['hideonline']) ) ? ( ($_POST['hideonline']) ? 0 : TRUE ) : TRUE;
$notifyreply = ( isset($_POST['notifyreply']) ) ? ( ($_POST['notifyreply']) ? TRUE : 0 ) : 0;
$notifypm = ( isset($_POST['notifypm']) ) ? ( ($_POST['notifypm']) ? TRUE : 0 ) : TRUE;
$popuppm = ( isset($_POST['popup_pm']) ) ? ( ($_POST['popup_pm']) ? TRUE : 0 ) : TRUE;
$viewemail = (isset($_POST['viewemail'])) ? (($_POST['viewemail']) ? TRUE : 0) : 0;
$allowviewonline = (isset($_POST['hideonline'])) ? (($_POST['hideonline']) ? 0 : TRUE) : TRUE;
$notifyreply = (isset($_POST['notifyreply'])) ? (($_POST['notifyreply']) ? TRUE : 0) : 0;
$notifypm = (isset($_POST['notifypm'])) ? (($_POST['notifypm']) ? TRUE : 0) : TRUE;
$popuppm = (isset($_POST['popup_pm'])) ? (($_POST['popup_pm']) ? TRUE : 0) : TRUE;
if ( $mode == 'register' )
if ($mode == 'register')
{
$attachsig = ( isset($_POST['attachsig']) ) ? ( ($_POST['attachsig']) ? TRUE : 0 ) : $config['allow_sig'];
$attachsig = (isset($_POST['attachsig'])) ? (($_POST['attachsig']) ? TRUE : 0) : $config['allow_sig'];
$allowhtml = ( isset($_POST['allowhtml']) ) ? ( ($_POST['allowhtml']) ? TRUE : 0 ) : $config['allow_html'];
$allowbbcode = ( isset($_POST['allowbbcode']) ) ? ( ($_POST['allowbbcode']) ? TRUE : 0 ) : $config['allow_bbcode'];
$allowsmilies = ( isset($_POST['allowsmilies']) ) ? ( ($_POST['allowsmilies']) ? TRUE : 0 ) : $config['allow_smilies'];
$allowhtml = (isset($_POST['allowhtml'])) ? (($_POST['allowhtml']) ? TRUE : 0) : $config['allow_html'];
$allowbbcode = (isset($_POST['allowbbcode'])) ? (($_POST['allowbbcode']) ? TRUE : 0) : $config['allow_bbcode'];
$allowsmilies = (isset($_POST['allowsmilies'])) ? (($_POST['allowsmilies']) ? TRUE : 0) : $config['allow_smilies'];
}
else
{
$attachsig = ( isset($_POST['attachsig']) ) ? ( ($_POST['attachsig']) ? TRUE : 0 ) : 0;
$attachsig = (isset($_POST['attachsig'])) ? (($_POST['attachsig']) ? TRUE : 0) : 0;
$allowhtml = ( isset($_POST['allowhtml']) ) ? ( ($_POST['allowhtml']) ? TRUE : 0 ) : $user->data['user_allowhtml'];
$allowbbcode = ( isset($_POST['allowbbcode']) ) ? ( ($_POST['allowbbcode']) ? TRUE : 0 ) : $user->data['user_allowbbcode'];
$allowsmilies = ( isset($_POST['allowsmilies']) ) ? ( ($_POST['allowsmilies']) ? TRUE : 0 ) : $user->data['user_allowsmiles'];
$allowhtml = (isset($_POST['allowhtml'])) ? (($_POST['allowhtml']) ? TRUE : 0) : $user->data['user_allowhtml'];
$allowbbcode = (isset($_POST['allowbbcode'])) ? (($_POST['allowbbcode']) ? TRUE : 0) : $user->data['user_allowbbcode'];
$allowsmilies = (isset($_POST['allowsmilies'])) ? (($_POST['allowsmilies']) ? TRUE : 0) : $user->data['user_allowsmiles'];
}
$user_style = ( isset($_POST['style']) ) ? intval($_POST['style']) : $config['default_style'];
$user_style = (isset($_POST['style'])) ? intval($_POST['style']) : $config['default_style'];
if ( !empty($_POST['language']) )
if (!empty($_POST['language']))
{
if ( preg_match('/^[a-z_]+$/i', $_POST['language']) )
if (preg_match('/^[a-z_]+$/i', $_POST['language']))
{
$user_lang = $_POST['language'];
}
@ -161,8 +161,8 @@ if (isset($_POST['submit']) || $mode == 'register')
$user_lang = $config['default_lang'];
}
$user_timezone = ( isset($_POST['timezone']) ) ? doubleval($_POST['timezone']) : $config['board_timezone'];
$user_dateformat = ( !empty($_POST['dateformat']) ) ? trim($_POST['dateformat']) : $config['default_dateformat'];
$user_timezone = (isset($_POST['timezone'])) ? doubleval($_POST['timezone']) : $config['board_timezone'];
$user_dateformat = (!empty($_POST['dateformat'])) ? trim($_POST['dateformat']) : $config['default_dateformat'];
}
@ -172,40 +172,40 @@ if (isset($_POST['submit']) || $mode == 'register')
if (isset($_POST['submit']))
{
$passwd_sql = '';
if ( $mode == 'editprofile' )
if ($mode == 'editprofile')
{
if ( $user_id != $user->data['user_id'] )
if ($user_id != $user->data['user_id'])
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Wrong_Profile'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Wrong_Profile'];
}
}
else if ( $mode == 'register' )
else if ($mode == 'register')
{
if ( empty($username) || empty($password) || empty($password_confirm) || empty($email) )
if (empty($username) || empty($password) || empty($password_confirm) || empty($email))
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Fields_empty'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Fields_empty'];
}
}
$passwd_sql = '';
if ( !empty($password) && !empty($password_confirm) )
if (!empty($password) && !empty($password_confirm))
{
if ( $password != $password_confirm )
if ($password != $password_confirm)
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Password_mismatch'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Password_mismatch'];
}
else if ( strlen($password) > 32 )
else if (strlen($password) > 32)
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Password_long'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Password_long'];
}
else
{
if ( $mode == 'editprofile' )
if ($mode == 'editprofile')
{
$sql = "SELECT user_password
FROM " . USERS_TABLE . "
@ -214,24 +214,24 @@ if (isset($_POST['submit']))
$row = $db->sql_fetchrow($result);
if ( $row['user_password'] != md5($password_current) )
if ($row['user_password'] != md5($password_current))
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Current_password_mismatch'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Current_password_mismatch'];
}
}
if ( !$error )
if (!$error)
{
$password = md5($password);
$passwd_sql = "user_password = '$password', ";
}
}
}
else if ( ( empty($password) && !empty($password_confirm) ) || ( !empty($password) && empty($password_confirm) ) )
else if ((empty($password) && !empty($password_confirm)) || (!empty($password) && empty($password_confirm)))
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Password_mismatch'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Password_mismatch'];
}
else
{
@ -241,17 +241,17 @@ if (isset($_POST['submit']))
//
// Do a ban check on this email address
//
if ( $email != $user->data['user_email'] || $mode == 'register' )
if ($email != $user->data['user_email'] || $mode == 'register')
{
if (($result = validate_email($email)) != false)
{
$email = $user->data['user_email'];
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result;
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $result;
}
if ( $mode == 'editprofile' )
if ($mode == 'editprofile')
{
$sql = "SELECT user_password
FROM " . USERS_TABLE . "
@ -260,30 +260,30 @@ if (isset($_POST['submit']))
$row = $db->sql_fetchrow($result);
if ( $row['user_password'] != md5($password_current) )
if ($row['user_password'] != md5($password_current))
{
$email = $user->data['user_email'];
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Current_password_mismatch'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Current_password_mismatch'];
}
}
}
$username_sql = '';
if ( $config['allow_namechange'] || $mode == 'register' )
if ($config['allow_namechange'] || $mode == 'register')
{
if ( empty($username) )
if (empty($username))
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Username_disallowed'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Username_disallowed'];
}
else if ( $username != $user->data['username'] || $mode == 'register' )
else if ($username != $user->data['username'] || $mode == 'register')
{
if (($result = validate_username($username)) != false)
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result;
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $result;
}
else
{
@ -299,33 +299,33 @@ if (isset($_POST['submit']))
}
}
if ( $signature != '' )
if ($signature != '')
{
if ( strlen($signature) > $config['max_sig_chars'] )
if (strlen($signature) > $config['max_sig_chars'])
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $user->lang['Signature_too_long'];
$error_msg .= ((isset($error_msg)) ? '<br />' : '') . $user->lang['Signature_too_long'];
}
if ( $signature_bbcode_uid == '' )
if ($signature_bbcode_uid == '')
{
// $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
// $signature_bbcode_uid = ($allowbbcode) ? make_bbcode_uid() : '';
}
// $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
}
if ( !$error )
if (!$error)
{
if ( ( ( $mode == 'editprofile' && $auth->acl_get('a_') && $email != $current_email ) || ( $mode == 'register' || $coppa ) ) && ( $config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN ) )
if ((($mode == 'editprofile' && $auth->acl_get('a_') && $email != $current_email) || ($mode == 'register' || $coppa)) && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))
{
$user_actkey = gen_rand_string(true);
$key_len = 54 - (strlen($server_url));
$key_len = ( $key_len > 6 ) ? $key_len : 6;
$key_len = ($key_len > 6) ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
$user_active = 0;
if ( $user->data['user_id'] != ANONYMOUS )
if ($user->data['user_id'] != ANONYMOUS)
{
$user->destroy();
}
@ -378,12 +378,18 @@ if (isset($_POST['submit']))
if ($config['newest_user_id'] == $user_id)
{
$sql = 'UPDATE ' . CONFIG_TABLE . "
SET config_value = '" . sql_quote($username) . "'
WHERE config_name = 'newest_username'";
SET config_value = '" . sql_quote($username) . "'
WHERE config_name = 'newest_username'";
$db->sql_query($sql);
}
if ( !$user_active )
// Update moderator cache table as appropriate
$sql = 'UPDATE ' . CONFIG_TABLE . "
SET username = '" . sql_quote($username) . "'
WHERE user_id = $user_id";
$db->sql_query($sql);
if (!$user_active)
{
//
// The users account has been deactivated, send them an email with a new activation key
@ -429,7 +435,7 @@ if (isset($_POST['submit']))
$user_id = $db->sql_nextid();
// Place into appropriate group, either REGISTERED or INACTIVE depending on config
$group_name = ( $config['require_activation'] == USER_ACTIVATION_NONE ) ? 'REGISTERED' : 'INACTIVE';
$group_name = ($config['require_activation'] == USER_ACTIVATION_NONE) ? 'REGISTERED' : 'INACTIVE';
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending) SELECT $user_id, group_id, 0 FROM " . GROUPS_TABLE . " WHERE group_name = '$group_name'";
$result = $db->sql_query($sql);
@ -452,17 +458,17 @@ if (isset($_POST['submit']))
$db->sql_transaction('commit');
if ( $coppa )
if ($coppa)
{
$message = $user->lang['COPPA'];
$email_template = 'coppa_welcome_inactive';
}
else if ( $config['require_activation'] == USER_ACTIVATION_SELF )
else if ($config['require_activation'] == USER_ACTIVATION_SELF)
{
$message = $user->lang['Account_inactive'];
$email_template = 'user_welcome_inactive';
}
else if ( $config['require_activation'] == USER_ACTIVATION_ADMIN )
else if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
$message = $user->lang['Account_inactive_admin'];
$email_template = 'admin_welcome_inactive';
@ -523,7 +529,7 @@ if (isset($_POST['submit']))
$emailer->send();
$emailer->reset();
if ( $config['require_activation'] == USER_ACTIVATION_ADMIN )
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
$emailer->use_template("admin_activate", stripslashes($user_lang));
$emailer->email_address($config['board_email']);
@ -548,7 +554,7 @@ if (isset($_POST['submit']))
} // End of submit
if ( $error )
if ($error)
{
//
// If an error occured we need to stripslashes on returned data
@ -572,7 +578,7 @@ if ( $error )
$user_lang = stripslashes($user_lang);
$user_dateformat = stripslashes($user_dateformat);
}
else if ( $mode == 'editprofile' )
else if ($mode == 'editprofile')
{
$user_id = $user->data['user_id'];
$username = htmlspecialchars($user->data['username']);
@ -590,7 +596,7 @@ else if ( $mode == 'editprofile' )
$occupation = htmlspecialchars($user->data['user_occ']);
$interests = htmlspecialchars($user->data['user_interests']);
$signature_bbcode_uid = $user->data['user_sig_bbcode_uid'];
$signature = ( $signature_bbcode_uid != '' ) ? preg_replace("/\:(([a-z0-9]:)?)$signature_bbcode_uid/si", '', $user->data['user_sig']) : $user->data['user_sig'];
$signature = ($signature_bbcode_uid != '') ? preg_replace("/\:(([a-z0-9]:)?)$signature_bbcode_uid/si", '', $user->data['user_sig']) : $user->data['user_sig'];
$viewemail = $user->data['user_viewemail'];
$notifypm = $user->data['user_notify_pm'];
@ -612,9 +618,9 @@ else if ( $mode == 'editprofile' )
// Default pages
//
if ( $mode == 'editprofile' )
if ($mode == 'editprofile')
{
if ( $user_id != $user->data['user_id'] )
if ($user_id != $user->data['user_id'])
{
$error = TRUE;
$error_msg = $user->lang['Wrong_Profile'];
@ -622,12 +628,12 @@ if ( $mode == 'editprofile' )
}
if ( !isset($coppa) )
if (!isset($coppa))
{
$coppa = FALSE;
}
if ( !isset($user_template) )
if (!isset($user_template))
{
$selected_template = $config['system_template'];
}
@ -635,7 +641,7 @@ if ( $mode == 'editprofile' )
$signature = preg_replace('/\:[0-9a-z\:]*?\]/si', ']', $signature);
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
if( $mode == 'editprofile' )
if($mode == 'editprofile')
{
$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $user->data['user_id'] . '" />';
//
@ -645,14 +651,14 @@ if ( $mode == 'editprofile' )
$s_hidden_fields .= '<input type="hidden" name="current_email" value="' . $user->data['user_email'] . '" />';
}
if ( !empty($user_avatar_local) )
if (!empty($user_avatar_local))
{
$s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" />';
}
$html_status = ( $user->data['user_allowhtml'] && $config['allow_html'] ) ? $user->lang['HTML_is_ON'] : $user->lang['HTML_is_OFF'];
$bbcode_status = ( $user->data['user_allowbbcode'] && $config['allow_bbcode'] ) ? $user->lang['BBCode_is_ON'] : $user->lang['BBCode_is_OFF'];
$smilies_status = ( $user->data['user_allowsmile'] && $config['allow_smilies'] ) ? $user->lang['Smilies_are_ON'] : $user->lang['Smilies_are_OFF'];
$html_status = ($user->data['user_allowhtml'] && $config['allow_html']) ? $user->lang['HTML_is_ON'] : $user->lang['HTML_is_OFF'];
$bbcode_status = ($user->data['user_allowbbcode'] && $config['allow_bbcode'] ) ? $user->lang['BBCode_is_ON'] : $user->lang['BBCode_is_OFF'];
$smilies_status = ($user->data['user_allowsmile'] && $config['allow_smilies'] ) ? $user->lang['Smilies_are_ON'] : $user->lang['Smilies_are_OFF'];
//
// Let's do an overall check for settings/versions which would prevent
@ -672,24 +678,24 @@ if ( $mode == 'editprofile' )
'LOCATION' => $location,
'WEBSITE' => $website,
'SIGNATURE' => str_replace('<br />', "\n", $signature),
'VIEW_EMAIL_YES' => ( $viewemail ) ? 'checked="checked"' : '',
'VIEW_EMAIL_NO' => ( !$viewemail ) ? 'checked="checked"' : '',
'HIDE_USER_YES' => ( !$allowviewonline ) ? 'checked="checked"' : '',
'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',
'NOTIFY_PM_YES' => ( $notifypm ) ? 'checked="checked"' : '',
'NOTIFY_PM_NO' => ( !$notifypm ) ? 'checked="checked"' : '',
'POPUP_PM_YES' => ( $popuppm ) ? 'checked="checked"' : '',
'POPUP_PM_NO' => ( !$popuppm ) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_BBCODE_YES' => ( $allowbbcode ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_BBCODE_NO' => ( !$allowbbcode ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_HTML_YES' => ( $allowhtml ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_HTML_NO' => ( !$allowhtml ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_SMILIES_YES' => ( $allowsmilies ) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
'VIEW_EMAIL_YES' => ($viewemail) ? 'checked="checked"' : '',
'VIEW_EMAIL_NO' => (!$viewemail) ? 'checked="checked"' : '',
'HIDE_USER_YES' => (!$allowviewonline) ? 'checked="checked"' : '',
'HIDE_USER_NO' => ($allowviewonline) ? 'checked="checked"' : '',
'NOTIFY_PM_YES' => ($notifypm) ? 'checked="checked"' : '',
'NOTIFY_PM_NO' => (!$notifypm) ? 'checked="checked"' : '',
'POPUP_PM_YES' => ($popuppm) ? 'checked="checked"' : '',
'POPUP_PM_NO' => (!$popuppm) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_YES' => ($attachsig) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_NO' => (!$attachsig) ? 'checked="checked"' : '',
'NOTIFY_REPLY_YES' => ($notifyreply) ? 'checked="checked"' : '',
'NOTIFY_REPLY_NO' => (!$notifyreply) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_BBCODE_YES' => ($allowbbcode) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_BBCODE_NO' => (!$allowbbcode) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_HTML_YES' => ($allowhtml) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_HTML_NO' => (!$allowhtml) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_SMILIES_YES' => ($allowsmilies) ? 'checked="checked"' : '',
'ALWAYS_ALLOW_SMILIES_NO' => (!$allowsmilies) ? 'checked="checked"' : '',
'LANGUAGE_SELECT' => language_select($user_lang, 'language'),
'STYLE_SELECT' => style_select($user_style, 'style'),
'TIMEZONE_SELECT' => tz_select($user_timezone, 'timezone'),
@ -699,11 +705,11 @@ if ( $mode == 'editprofile' )
'SMILIES_STATUS' => $smilies_status,
'L_CURRENT_PASSWORD' => $user->lang['Current_password'],
'L_NEW_PASSWORD' => ( $mode == 'register' ) ? $user->lang['Password'] : $user->lang['New_password'],
'L_NEW_PASSWORD' => ($mode == 'register') ? $user->lang['Password'] : $user->lang['New_password'],
'L_CONFIRM_PASSWORD' => $user->lang['Confirm_password'],
'L_CONFIRM_PASSWORD_EXPLAIN' => ( $mode == 'editprofile' ) ? $user->lang['Confirm_password_explain'] : '',
'L_PASSWORD_IF_CHANGED' => ( $mode == 'editprofile' ) ? $user->lang['password_if_changed'] : '',
'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $user->lang['password_confirm_if_changed'] : '',
'L_CONFIRM_PASSWORD_EXPLAIN' => ($mode == 'editprofile') ? $user->lang['Confirm_password_explain'] : '',
'L_PASSWORD_IF_CHANGED' => ($mode == 'editprofile') ? $user->lang['password_if_changed'] : '',
'L_PASSWORD_CONFIRM_IF_CHANGED' => ($mode == 'editprofile') ? $user->lang['password_confirm_if_changed'] : '',
'L_SUBMIT' => $user->lang['Submit'],
'L_RESET' => $user->lang['Reset'],
'L_ICQ_NUMBER' => $user->lang['ICQ'],
@ -742,7 +748,7 @@ if ( $mode == 'editprofile' )
'L_PROFILE_INFO_NOTICE' => $user->lang['Profile_info_warn'],
'L_EMAIL_ADDRESS' => $user->lang['Email_address'],
'S_PROFILE_EDIT' => ( $mode == 'editprofile' ) ? true : false,
'S_PROFILE_EDIT' => ($mode == 'editprofile') ? true : false,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FORM_ENCTYPE' => $form_enctype,
'S_PROFILE_ACTION' => "profile.$phpEx$SID")

View file

@ -621,7 +621,7 @@ switch ($mode)
break;
case 'edit':
$page_title = $user->lang['Edit_Post'];
$page_title = $user->lang['EDIT_POST'];
$s_action .= '&amp;p=' . intval($post_id);
break;
}

View file

@ -152,7 +152,7 @@ function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function unixSafeColours()
function colorPalette()
{
var r = 0, g = 0, b = 0;
var numberList = new Array(6);
@ -171,7 +171,7 @@ function unixSafeColours()
{
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '">');
document.write('<a href="javascript:bbfontstyle(\'[color=#' + color + ']\', \'[/color]\');"><img src="images/spacer.gif" width="10" height="6" border="0" alt="#' + color + '" title="#' + color + '" /></a>');
document.write('<a href="javascript:bbfontstyle(\'[color=#' + color + ']\', \'[/color]\');" onmouseover="helpline(\'s\');"><img src="images/spacer.gif" width="10" height="6" border="0" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>');
}
document.writeln('</tr>');

View file

@ -38,7 +38,7 @@ function checkForm()
<form action="{S_POST_ACTION}" method="post" name="post" onsubmit="return checkForm(this)"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td colspan="2" align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- IF TOPIC_TITLE --> :: <a class="maintitle" href="{U_VIEWTOPIC}">{TOPIC_TITLE}</a><!-- ENDIF --><br /><span class="gensmall"> [ <a href="{U_VIEW_MODERATORS}">{L_VIEW_MODERATORS}</a> ]<br /><br /><b>{LOGGED_IN_USER_LIST}</b></span></td>
<td colspan="2" align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}" title="{FORUM_DESC}">{FORUM_NAME}</a><!-- IF TOPIC_TITLE --> :: <a class="maintitle" href="{U_VIEWTOPIC}">{TOPIC_TITLE}</a><!-- ENDIF --><br /><span class="gensmall">{L_MODERATORS}: <b>{MODERATORS}</b><br /><br /><b>{LOGGED_IN_USER_LIST}</b></span></td>
</tr>
<tr>
<td class="nav" width="100%" align="left" valign="middle"><span class="nav"><a class="nav" href="{U_INDEX}">{L_INDEX}</a>
@ -63,7 +63,7 @@ function checkForm()
<!-- IF S_DELETE_ALLOWED -->
<tr>
<td class="row1"><span class="gen"><b>{L_DELETE_POST}</b></span></td>
<td class="row2"><input type="checkbox" name="delete" /> <span class="gensmall">[ {L_DELETE_WARN} ]</span></td>
<td class="row2"><input type="checkbox" name="delete" /> <span class="gensmall">[ {L_DELETE_POST_WARN} ]</span></td>
</tr>
<!-- ENDIF -->
<!-- IF S_DISPLAY_USERNAME -->
@ -83,7 +83,7 @@ function checkForm()
<td class="row1"><span class="gen"><b>{L_TOPIC_ICON}</b></span></td>
<td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td valign="middle"><span class="gensmall"><input type="radio" name="icon" value="1" checked="checked" /><span class="genmed">{L_NONE}</span>&nbsp;<!-- BEGIN topic_icon --><input type="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /> <!-- END topic_icon --></td>
<td><input type="radio" name="icon" value="1" checked="checked" /><span class="genmed">{L_NONE}</span> <!-- BEGIN topic_icon --><input type="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /> <!-- END topic_icon --></td>
</tr>
</table></td>
</tr>
@ -102,7 +102,7 @@ function checkForm()
</tr>
<!-- IF S_SHOW_EMOTICON_LINK -->
<tr>
<td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=350,resizable=yes,scrollbars=yes,WIDTH=300');return false;" target="_phpbbsmilies">{L_MORE_SMILIES}</a></td>
<td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=350,resizable=yes,scrollbars=yes,WIDTH=300');return false;" target="_phpbbsmilies">{L_MORE_EMOTICONS}</a></td>
</tr>
<!-- ENDIF -->
</table></td>
@ -128,27 +128,25 @@ function checkForm()
<option value="18" class="genmed">{L_FONT_LARGE}</option>
<option value="24" class="genmed">{L_FONT_HUGE}</option>
</select></span></td>
<td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onmouseover="helpline('a')">{L_BBCODE_CLOSE_TAGS}</a></span></td>
</tr>
</table></td>
<td rowspan="3" width="100%" align="center" valign="middle"><table cellspacing="5" cellpadding="0" border="0">
<tr>
<td><span class="genmed">{L_FONT_COLOR}</span></td>
</tr>
<tr>
<td bgcolor="black"><script language="javascript" type="text/javascript"><!--
unixSafeColours()
//--></script></td>
<td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onmouseover="helpline('a')">{L_CLOSE_TAGS}</a></span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="9" width="450"><input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" /></td>
<td align="center"><span class="genmed">{L_FONT_COLOR}</span></td>
</tr>
<tr>
<td colspan="9"><textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea></td>
<td width="100%" align="center" valign="top"><table cellspacing="0" cellpadding="0" border="0">
<tr>
<td bgcolor="black"><script language="javascript" type="text/javascript"><!--
colorPalette()
//--></script></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
@ -196,13 +194,13 @@ function checkForm()
<!-- IF S_SIG_ALLOWED -->
<tr>
<td><input type="checkbox" name="attach_sig" {S_SIGNATURE_CHECKED} /></td>
<td><span class="gen">{L_ATTACH_SIGNATURE}</span></td>
<td><span class="gen">{L_ATTACH_SIG}</span></td>
</tr>
<!-- ENDIF -->
<!-- IF S_NOTIFY_ALLOWED -->
<tr>
<td><input type="checkbox" name="notify" {S_NOTIFY_CHECKED} /></td>
<td><span class="gen">{L_NOTIFY_ON_REPLY}</span></td>
<td><span class="gen">{L_NOTIFY_REPLY}</span></td>
</tr>
<!-- ENDIF -->
<!-- IF S_TYPE_TOGGLE -->
@ -215,7 +213,7 @@ function checkForm()
</tr>
<!-- IF S_SHOW_POLL_BOX -->
<tr>
<th class="thHead" colspan="2">{L_ADD_A_POLL}</th>
<th class="thHead" colspan="2">{L_ADD_POLL}</th>
</tr>
<tr>
<td class="row1" colspan="2"><span class="gensmall">{L_ADD_POLL_EXPLAIN}</span></td>
@ -229,8 +227,8 @@ function checkForm()
<td class="row2"><span class="genmed"><textarea name="poll_option_text" rows="5" cols="35" wrap="virtual" style="width:450px" class="post">{POLL_OPTIONS}</textarea></td>
</tr>
<tr>
<td class="row1"><span class="gen"><b>{L_POLL_LENGTH}</b></span></td>
<td class="row2"><span class="genmed"><input type="text" name="poll_length" size="3" maxlength="3" class="post" value="{POLL_LENGTH}" /></span>&nbsp;<span class="gen"><b>{L_DAYS}</b></span> <span class="gensmall">{L_POLL_LENGTH_EXPLAIN}</span></td>
<td class="row1"><span class="gen"><b>{L_POLL_FOR}</b></span></td>
<td class="row2"><span class="genmed"><input type="text" name="poll_length" size="3" maxlength="3" class="post" value="{POLL_LENGTH}" /></span>&nbsp;<span class="gen"><b>{L_DAYS}</b></span> <span class="gensmall">{L_POLL_FOR_EXPLAIN}</span></td>
</tr>
<!-- IF S_POLL_DELETE -->
<tr>
@ -248,7 +246,7 @@ function checkForm()
</tr>
<tr>
<td class="row1"><span class="gen"><b>{L_FILE_NAME}</b></span></td>
<td class="row1"><span class="gen"><b>{L_FILENAME}</b></span></td>
<td class="row2"><input type="file" name="fileupload" size="50" maxlength="{FILESIZE}" value="{FILENAME}" class="post"></td>
</tr>
<tr>

View file

@ -2,16 +2,11 @@
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td colspan="2" align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}" title="{FORUM_DESC}">{FORUM_NAME}</a> <br /><span class="gensmall">
<!-- IF S_IS_POSTABLE -->{MOD_CP}<br /><!-- ENDIF -->
<br /><b>{LOGGED_IN_USER_LIST}</b></span></td>
<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
<td colspan="2" align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}" title="{FORUM_DESC}">{FORUM_NAME}</a> <br /><span class="gensmall"><!-- IF S_IS_POSTABLE --><b>{L_MODERATORS}: {MODERATORS}</b><!-- ENDIF --><br /><br /><b>{LOGGED_IN_USER_LIST}</b></span></td>
<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><!-- IF S_IS_POSTABLE -->{MOD_CP}<br /><!-- ENDIF --><br /><b>{PAGINATION}</b></span></td>
</tr>
<!-- IF S_HAS_SUBFORUM -->
<!-- INCLUDE viewforum_subforum.html -->
<br />
<!-- ENDIF -->
<!-- IF S_HAS_SUBFORUM --><!-- INCLUDE viewforum_subforum.html --><br /><!-- ENDIF -->
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>

View file

@ -139,6 +139,26 @@ $template->assign_vars(array(
'FORUM_DESC' => strip_tags($forum_data['forum_desc'])
));
// Moderators
$forum_moderators = array();
// Do we have subforums? if so, let's include this harmless file
if ($forum_data['left_id'] != $forum_data['right_id'] - 1)
{
$template->assign_vars(array(
'S_HAS_SUBFORUM' => TRUE,
'L_SUBFORUM' => (count($forum_rows) == 1) ? $user->lang['Subforum'] : $user->lang['Subforums']
));
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
display_forums($forum_data);
}
else
{
get_moderators($forum_moderators, $forum_id);
}
// Output forum listing if it is postable
if ($forum_data['forum_postable'])
{
// Topic read tracking cookie info
@ -200,9 +220,7 @@ if ($forum_data['forum_postable'])
$sort_days = (!empty($_POST['sort_days'])) ? intval($_POST['sort_days']) : intval($_GET['sort_days']);
$min_topic_time = time() - ( $sort_days * 86400 );
//
// ref type on as rows as topics ... also not great
//
$sql = "SELECT COUNT(topic_id) AS forum_topics
FROM " . TOPICS_TABLE . "
WHERE forum_id = $forum_id
@ -254,7 +272,8 @@ if ($forum_data['forum_postable'])
'POST_IMG' => (intval($forum_data['forum_status']) == ITEM_LOCKED) ? $user->img('post_locked', $post_alt) : $user->img('post_new', $post_alt),
'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&amp;f=$forum_id&amp;topicdays=$topic_days", $topics_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], (floor( $start / $config['topics_per_page'] ) + 1), ceil( $topics_count / $config['topics_per_page'] )),
'MOD_CP' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? sprintf($user->lang['MCP'], '<a href="modcp.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>') : '',
'MOD_CP' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? sprintf($user->lang['MCP'], '<a href="modcp.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>') : '',
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : $user->lang['None'],
'FOLDER_IMG' => $user->img('folder', 'No_new_posts'),
'FOLDER_NEW_IMG' => $user->img('folder_new', 'New_posts'),
@ -529,18 +548,6 @@ $nav_links['up'] = array(
'title' => sprintf($user->lang['Forum_Index'], $config['sitename'])
);
// Do we have subforums? if so, let's include this harmless file
if ($forum_data['left_id'] != $forum_data['right_id'] - 1)
{
$template->assign_vars(array(
'S_HAS_SUBFORUM' => TRUE,
'L_SUBFORUM' => (count($forum_rows) == 1) ? $user->lang['Subforum'] : $user->lang['Subforums']
));
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
display_forums($forum_data);
}
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(

View file

@ -26,9 +26,9 @@ include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
// Start initial var setup
$topic_id = ( isset($_GET['t']) ) ? intval($_GET['t']) : 0;
$post_id = ( isset($_GET['p'])) ? intval($_GET['p']) : 0;
$start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0;
$topic_id = (isset($_GET['t'])) ? intval($_GET['t']) : 0;
$post_id = (isset($_GET['p'])) ? intval($_GET['p']) : 0;
$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0;
if (empty($topic_id) && empty($post_id))
{
@ -76,8 +76,8 @@ if (isset($_GET['view']) && empty($post_id))
}
else if ($_GET['view'] == 'next' || $_GET['view'] == 'previous')
{
$sql_condition = ( $_GET['view'] == 'next' ) ? '>' : '<';
$sql_ordering = ( $_GET['view'] == 'next' ) ? 'ASC' : 'DESC';
$sql_condition = ($_GET['view'] == 'next') ? '>' : '<';
$sql_ordering = ($_GET['view'] == 'next') ? 'ASC' : 'DESC';
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t, " . TOPICS_TABLE . " t2
@ -112,7 +112,7 @@ if ($user->data['user_id'] != ANONYMOUS)
$rating = ($row = $db->sql_fetchrow($result)) ? $row['rating'] : '';
if ( empty($_POST['rating_value']) && $rating != '')
if (empty($_POST['rating_value']) && $rating != '')
{
}
else
@ -175,8 +175,8 @@ if (!$auth->acl_gets('f_read', 'm_', 'a_', intval($forum_id)))
{
if ($user->data['user_id'] == ANONYMOUS)
{
$redirect = ( isset($post_id) ) ? "p=$post_id" : "t=$topic_id";
$redirect .= ( isset($start) ) ? "&start=$start" : '';
$redirect = (isset($post_id)) ? "p=$post_id" : "t=$topic_id";
$redirect .= (isset($start)) ? "&start=$start" : '';
redirect('login.' . $phpEx . $SID . '&redirect=viewtopic.' . $phpEx . '&' . $redirect);
}
@ -203,7 +203,7 @@ if (isset($_POST['sort']))
if (!empty($_POST['sort_days']))
{
$sort_days = (!empty($_POST['sort_days'])) ? intval($_POST['sort_days']) : intval($_GET['sort_days']);
$min_post_time = time() - ( $sort_days * 86400 );
$min_post_time = time() - ($sort_days * 86400);
$sql = "SELECT COUNT(post_id) AS num_posts
FROM " . POSTS_TABLE . "
@ -213,7 +213,7 @@ if (isset($_POST['sort']))
$result = $db->sql_query($sql);
$start = 0;
$topic_replies = ( $row = $db->sql_fetchrow($result) ) ? $row['num_posts'] : 0;
$topic_replies = ($row = $db->sql_fetchrow($result)) ? $row['num_posts'] : 0;
$limit_posts_time = "AND p.post_time >= $min_post_time ";
}
else
@ -368,7 +368,7 @@ $template->assign_vars(array(
'TOPIC_ID' => $topic_id,
'TOPIC_TITLE' => $topic_title,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $config['posts_per_page'] ) + 1 ), ceil( $topic_replies / $config['posts_per_page'] )),
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], (floor($start / $config['posts_per_page']) + 1), ceil($topic_replies / $config['posts_per_page'])),
'MOD_CP' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? sprintf($user->lang['MCP'], '<a href="modcp.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>') : '',
'POST_IMG' => $post_img,
@ -460,7 +460,7 @@ if (!empty($poll_start))
foreach ($poll_info as $poll_option)
{
$poll_option['poll_option_text'] = (sizeof($orig_word)) ? preg_replace($orig_word, $replacement_word, $poll_option['poll_option_text']) : $poll_option['poll_option_text'];
$option_pct = ( $poll_total > 0 ) ? $poll_option['poll_option_total'] / $poll_total : 0;
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
$option_pct_txt = sprintf("%.1d%%", ($option_pct * 100));
$template->assign_block_vars('poll_option', array(
@ -548,9 +548,9 @@ if ($row = $db->sql_fetchrow($result))
}
// Generate ranks, set them to empty string initially.
if (!isset($poster_details[$poster_id]['rank_title']) )
if (!isset($poster_details[$poster_id]['rank_title']))
{
if ($row['user_rank'] )
if ($row['user_rank'])
{
for($j = 0; $j < count($ranksrow); $j++)
{
@ -604,8 +604,8 @@ if ($row = $db->sql_fetchrow($result))
$poster_details[$poster_id]['email'] = '';
}
$poster_details[$poster_id]['www_img'] = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->img('icon_www', $user->lang['Visit_website']) . '</a>' : '';
$poster_details[$poster_id]['www'] = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->lang['Visit_website'] . '</a>' : '';
$poster_details[$poster_id]['www_img'] = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->img('icon_www', $user->lang['Visit_website']) . '</a>' : '';
$poster_details[$poster_id]['www'] = ($row['user_website']) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $user->lang['Visit_website'] . '</a>' : '';
if (!empty($row['user_icq']))
{
@ -723,7 +723,7 @@ if ($row = $db->sql_fetchrow($result))
// Parse message for admin-defined/templated BBCode if reqd
if ($bbcode_uid != '')
{
// $message = ( $auth->acl_get('f_bbcode', $forum_id) ) ? bbencode_second_pass($message, $bbcode_uid, $auth->acl_get('f_img', $forum_id)) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
// $message = ($auth->acl_get('f_bbcode', $forum_id)) ? bbencode_second_pass($message, $bbcode_uid, $auth->acl_get('f_img', $forum_id)) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
}
// If we allow users to disable display of emoticons