mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-25 04:38:53 +00:00
- fix some bugs...
git-svn-id: file:///svn/phpbb/trunk@5643 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
59ba11f18f
commit
4962db5f67
22 changed files with 141 additions and 50 deletions
|
@ -301,7 +301,7 @@ class cache extends acm
|
|||
|
||||
foreach ($parsed_items as $key => $parsed_array)
|
||||
{
|
||||
$parsed_array = $this->get('_cfg_' . $key);
|
||||
$parsed_array = $this->get('_cfg_' . $key . '_' . $theme[$key . '_path']);
|
||||
|
||||
if (!$parsed_array)
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ class cache extends acm
|
|||
$parsed_array = parse_cfg_file($filename);
|
||||
$parsed_array['filetime'] = @filemtime($filename);
|
||||
|
||||
$this->put('_cfg_' . $key, $parsed_array);
|
||||
$this->put('_cfg_' . $key . '_' . $theme[$key . '_path'], $parsed_array);
|
||||
}
|
||||
$parsed_items[$key] = $parsed_array;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class acp_forums
|
|||
|
||||
function main($id, $mode)
|
||||
{
|
||||
global $db, $user, $auth, $template;
|
||||
global $db, $user, $auth, $template, $cache;
|
||||
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx, $SID;
|
||||
|
||||
$user->add_lang('acp/forums');
|
||||
|
|
|
@ -809,7 +809,7 @@ class acp_permissions
|
|||
}
|
||||
|
||||
/**
|
||||
* Update foes
|
||||
* Update foes - remove moderators and administrators from foe lists...
|
||||
*/
|
||||
function update_foes()
|
||||
{
|
||||
|
@ -827,7 +827,8 @@ class acp_permissions
|
|||
if (sizeof($perms))
|
||||
{
|
||||
$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
|
||||
WHERE zebra_id IN (' . implode(', ', $perms) . ')';
|
||||
WHERE zebra_id IN (' . implode(', ', $perms) . ')
|
||||
AND foe = 1';
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
unset($perms);
|
||||
|
|
|
@ -452,8 +452,10 @@ class acp_search
|
|||
$sql = 'SELECT MAX(post_id) as max_post_id
|
||||
FROM '. POSTS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
$max_post_id = (int) $db->sql_fetchfield('max_post_id', 0, $result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $db->sql_fetchfield('max_post_id', 0, $result);
|
||||
return $max_post_id;
|
||||
}
|
||||
|
||||
function save_state($state = false)
|
||||
|
|
|
@ -616,15 +616,12 @@ class acp_users
|
|||
// Which updates do we need to do?
|
||||
$update_warning = ($user_row['user_warnings'] != $data['warnings']) ? true : false;
|
||||
$update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false;
|
||||
$update_password = ($user_row['user_password'] != $data['user_password']) ? true : false;
|
||||
$update_password = ($data['user_password'] && $user_row['user_password'] != md5($data['user_password'])) ? true : false;
|
||||
$update_email = ($data['user_email'] != $user_row['user_email']) ? $data['user_email'] : false;
|
||||
|
||||
if (!sizeof($error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'username' => $data['username'],
|
||||
'user_email' => $data['user_email'],
|
||||
'user_email_hash' => crc32(strtolower($data['user_email'])) . strlen($data['user_email'])
|
||||
);
|
||||
$sql_ary = array();
|
||||
|
||||
if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER)
|
||||
{
|
||||
|
@ -639,6 +636,25 @@ class acp_users
|
|||
}
|
||||
}
|
||||
|
||||
if ($update_username !== false)
|
||||
{
|
||||
$sql_ary['username'] = $update_username;
|
||||
|
||||
add_log('admin', 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username);
|
||||
add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username);
|
||||
}
|
||||
|
||||
if ($update_email !== false)
|
||||
{
|
||||
$sql_ary += array(
|
||||
'user_email' => $update_email,
|
||||
'user_email_hash' => crc32(strtolower($update_email)) . strlen($update_email)
|
||||
);
|
||||
|
||||
add_log('admin', 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email);
|
||||
add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email);
|
||||
}
|
||||
|
||||
if ($update_password)
|
||||
{
|
||||
$sql_ary += array(
|
||||
|
@ -647,6 +663,7 @@ class acp_users
|
|||
);
|
||||
|
||||
add_log('admin', 'LOG_USER_NEW_PASSWORD', $user_row['username']);
|
||||
add_log('user', $user_id, 'LOG_USER_NEW_PASSWORD', $user_row['username']);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
|
@ -664,9 +681,6 @@ class acp_users
|
|||
if ($update_username)
|
||||
{
|
||||
user_update_name($user_row['username'], $update_username);
|
||||
|
||||
add_log('admin', 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username);
|
||||
add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username);
|
||||
}
|
||||
|
||||
add_log('admin', 'LOG_USER_USER_UPDATE', $data['username']);
|
||||
|
|
|
@ -106,7 +106,7 @@ class dbal_firebird extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class dbal_mssql extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class dbal_mssql_odbc extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class dbal_mysql extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class dbal_mysql4 extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ class dbal_oracle extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ class dbal_postgres extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class dbal_sqlite extends dbal
|
|||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
$cache->sql_save($query, $this->query_result, $cache_ttl);
|
||||
}
|
||||
else if (strpos($query, 'SELECT') !== false && $this->query_result)
|
||||
else if (strpos($query, 'SELECT') === 0 && $this->query_result)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
}
|
||||
|
|
|
@ -2295,7 +2295,7 @@ function page_footer()
|
|||
$template->assign_vars(array(
|
||||
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
|
||||
|
||||
'U_ACP' => ($auth->acl_get('a_') && $user->data['is_registered']) ? "{$phpbb_root_path}adm/index.$phpEx?sid=" . $user->data['session_id'] : '')
|
||||
'U_ACP' => ($auth->acl_get('a_') && $user->data['is_registered']) ? "{$phpbb_root_path}adm/index.$phpEx?sid=" . $user->session_id : '')
|
||||
);
|
||||
|
||||
// Call cron-type script
|
||||
|
@ -2419,6 +2419,9 @@ function get_backtrace()
|
|||
}
|
||||
}
|
||||
|
||||
$trace['class'] = (!isset($trace['class'])) ? '' : $trace['class'];
|
||||
$trace['type'] = (!isset($trace['type'])) ? '' : $trace['type'];
|
||||
|
||||
$output .= '<br />';
|
||||
$output .= '<b>FILE:</b> ' . htmlspecialchars($trace['file']) . '<br />';
|
||||
$output .= '<b>LINE:</b> ' . $trace['line'] . '<br />';
|
||||
|
|
|
@ -103,7 +103,7 @@ class filespec
|
|||
$this->realname = rawurlencode(str_replace($bad_chars, '_', strtolower($this->realname)));
|
||||
$this->realname = preg_replace("/%(\w{2})/", '_', $this->realname);
|
||||
|
||||
$this->realname = $prefix . $this->realname . '_.' . $this->extension;
|
||||
$this->realname = $prefix . $this->realname . '.' . $this->extension;
|
||||
break;
|
||||
|
||||
case 'unique':
|
||||
|
|
|
@ -321,7 +321,7 @@ class session
|
|||
/* echo "<br />$sql";
|
||||
echo "<br />$user_id :: " . sizeof($this->data) . " :: " . (int) is_array($this->data) . " :: " . $db->sql_numrows();
|
||||
print_r($this->cookie_data);
|
||||
print_r($this->data);*/
|
||||
print_r($this->data);
|
||||
|
||||
if ($this->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
|
@ -345,6 +345,15 @@ class session
|
|||
{
|
||||
$this->data['session_last_visit'] = time();
|
||||
}
|
||||
*/
|
||||
if ($this->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
$this->data['session_last_visit'] = (isset($this->data['session_time']) && $this->data['session_time']) ? $this->data['session_time'] : (($this->data['user_lastvisit']) ? $this->data['user_lastvisit'] : time());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->data['session_last_visit'] = time();
|
||||
}
|
||||
|
||||
// At this stage we should have a filled data array, defined cookie u and k data.
|
||||
// data array should contain recent session info if we're a real user and a recent
|
||||
|
@ -867,6 +876,8 @@ class user extends session
|
|||
// User has wrong style
|
||||
if (!$this->theme && $style == $this->data['user_style'])
|
||||
{
|
||||
echo "HERE";
|
||||
exit;
|
||||
$style = $this->data['user_style'] = $config['default_style'];
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||
|
@ -880,7 +891,7 @@ class user extends session
|
|||
AND t.template_id = s.template_id
|
||||
AND c.theme_id = s.theme_id
|
||||
AND i.imageset_id = s.imageset_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$this->theme = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ function compose_pm($id, $mode, $action)
|
|||
$message_attachment = (isset($post['message_attachement'])) ? $post['message_attachement'] : 0;
|
||||
$message_text = $post['message_text'];
|
||||
$message_subject = $post['message_subject'];
|
||||
$quote_username = $post['quote_username'];
|
||||
$quote_username = (isset($post['quote_username'])) ? $post['quote_username'] : '';
|
||||
|
||||
$message_time = $post['message_time'];
|
||||
$icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0;
|
||||
|
@ -821,7 +821,7 @@ function compose_pm($id, $mode, $action)
|
|||
*/
|
||||
function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_to, $add_bcc)
|
||||
{
|
||||
global $_REQUEST;
|
||||
global $auth;
|
||||
|
||||
// Delete User [TO/BCC]
|
||||
if ($remove_u)
|
||||
|
@ -853,6 +853,9 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_
|
|||
}
|
||||
}
|
||||
|
||||
// User ID's to add...
|
||||
$user_id_ary = array();
|
||||
|
||||
// Build usernames to add
|
||||
$usernames = (isset($_REQUEST['username'])) ? array(request_var('username', '')) : array();
|
||||
$username_list = request_var('username_list', '');
|
||||
|
@ -866,8 +869,31 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_
|
|||
{
|
||||
$user_id_ary = array();
|
||||
user_get_id_name($user_id_ary, $usernames);
|
||||
}
|
||||
|
||||
// Add Friends if specified
|
||||
$friend_list = (is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array();
|
||||
$user_id_ary = array_merge($user_id_ary, $friend_list);
|
||||
|
||||
if (sizeof($user_id_ary))
|
||||
{
|
||||
// We need to check their PM status (do they want to receive PM's?)
|
||||
// Only check if not a moderator or admin, since they are allowed to override this user setting
|
||||
if (!$auth->acl_gets('a_', 'm_'))
|
||||
{
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id IN (' . implode(', ', $user_id_ary) . ')
|
||||
AND user_allow_pm = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$address_list['u'][$row['user_id']] = $type;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($user_id_ary as $user_id)
|
||||
{
|
||||
|
@ -875,18 +901,9 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add Friends if specified
|
||||
$friend_list = (is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array();
|
||||
|
||||
foreach ($friend_list as $user_id)
|
||||
{
|
||||
$address_list['u'][$user_id] = $type;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of private message recipients
|
||||
*/
|
||||
|
|
|
@ -86,9 +86,27 @@ class ucp_profile
|
|||
'user_email' => ($auth->acl_get('u_chgemail')) ? $email : $user->data['user_email'],
|
||||
'user_email_hash' => ($auth->acl_get('u_chgemail')) ? crc32(strtolower($email)) . strlen($email) : $user->data['user_email_hash'],
|
||||
'user_password' => ($auth->acl_get('u_chgpasswd') && $new_password) ? md5($new_password) : $user->data['user_password'],
|
||||
'user_passchg' => time(),
|
||||
'user_passchg' => ($auth->acl_get('u_chgpasswd') && $new_password) ? time() : 0,
|
||||
);
|
||||
|
||||
if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $username != $user->data['username'])
|
||||
{
|
||||
add_log('admin', 'LOG_USER_UPDATE_NAME', $user->data['username'], $username);
|
||||
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $username);
|
||||
}
|
||||
|
||||
if ($auth->acl_get('u_chgpasswd') && $new_password && md5($new_password) != $user->data['user_password'])
|
||||
{
|
||||
add_log('admin', 'LOG_USER_NEW_PASSWORD', $username);
|
||||
add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $username);
|
||||
}
|
||||
|
||||
if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email'])
|
||||
{
|
||||
add_log('admin', 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email);
|
||||
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email);
|
||||
}
|
||||
|
||||
if ($config['email_enable'] && $email != $user->data['user_email'] && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
|
||||
|
|
|
@ -108,6 +108,29 @@ class ucp_zebra
|
|||
unset($perms);
|
||||
}
|
||||
|
||||
// Do not let add users to friends if the user is within the foes list of the to-be-added users
|
||||
if ($mode == 'friends' && sizeof($user_id_ary))
|
||||
{
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . ZEBRA_TABLE . '
|
||||
WHERE user_id IN (' . implode(', ', $user_id_ary) . ')
|
||||
AND zebra_id = ' . $user->data['user_id'] . '
|
||||
AND foe = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$remove_user_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$remove_user_ids[] = $row['user_id'];
|
||||
}
|
||||
|
||||
if (sizeof($remove_user_ids))
|
||||
{
|
||||
$user_id_ary = array_diff($user_id_ary, $remove_user_ids);
|
||||
}
|
||||
unset($remove_user_ids);
|
||||
}
|
||||
|
||||
if (sizeof($user_id_ary))
|
||||
{
|
||||
$sql_mode = ($mode == 'friends') ? 'friend' : 'foe';
|
||||
|
|
|
@ -503,6 +503,7 @@ $lang = array_merge($lang, array(
|
|||
'LOG_USER_MOVE_POSTS' => '<b>Moved user posts</b><br />» posts by "%s" to forum "%s"',
|
||||
'LOG_USER_NEW_PASSWORD' => '<b>Changed user password</b><br />» %s',
|
||||
'LOG_USER_REACTIVATE' => '<b>Forced user account re-activation</b><br />» %s',
|
||||
'LOG_USER_UPDATE_EMAIL' => '<b>User "%s" changed email</b>» from "%s" to "%s"',
|
||||
'LOG_USER_UPDATE_NAME' => '<b>Changed username</b><br />» from "%s" to "%s"',
|
||||
'LOG_USER_USER_UPDATE' => '<b>Updated user details</b><br />» %s',
|
||||
|
||||
|
|
|
@ -214,6 +214,7 @@ $lang = array_merge($lang, array(
|
|||
'NOTIFY_METHOD_EXPLAIN' => 'Method for sending messages sent via this board.',
|
||||
'NOTIFY_METHOD_IM' => 'Jabber only',
|
||||
'NOTIFY_ON_PM' => 'Email me on new private messages',
|
||||
'NOT_ADDED_FRIENDS' => 'Usernames not added to friends list because you are within their foes list.',
|
||||
'NOT_ADDED_FOES' => 'Usernames not added to foes list because of administrator/moderator status.',
|
||||
'NOT_AGREE' => 'I do not agree to these terms',
|
||||
'NOT_ENOUGH_SPACE_FOLDER' => 'The Destination Folder "%s" seems to be full. The requested action has not been taken.',
|
||||
|
|
|
@ -159,7 +159,7 @@ $result = $db->sql_query($sql);
|
|||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$which = (time() - $update_time < $row['online_time']) ? 'online' : 'offline';
|
||||
$which = (time() - $update_time < $row['online_time'] && $row['viewonline']) ? 'online' : 'offline';
|
||||
|
||||
$template->assign_block_vars("friends_{$which}", array(
|
||||
'U_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'],
|
||||
|
|
Loading…
Add table
Reference in a new issue