diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 57 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_ranks.php | 5 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 20 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 4 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_front.php | 2 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_logs.php | 66 |
6 files changed, 99 insertions, 55 deletions
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 3a7318231b..1ad5ea2903 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -899,7 +899,10 @@ class acp_permissions 'PERMISSION' => $user->lang['acl_' . $permission]['lang'], 'PERMISSION_USERNAME' => $userdata['username'], 'FORUM_NAME' => $forum_name, - 'U_BACK' => ($back) ? build_url(array('f', 'back')) . "&f=$back" : '') + + 'S_GLOBAL_TRACE' => ($forum_id) ? false : true, + + 'U_BACK' => ($back) ? build_url(array('f', 'back')) . "&f=$back" : '') ); $template->assign_block_vars('trace', array( @@ -929,6 +932,8 @@ class acp_permissions $db->sql_freeresult($result); $total = ACL_NO; + $add_key = (($forum_id) ? '_LOCAL' : ''); + if (sizeof($groups)) { // Get group auth settings @@ -945,16 +950,16 @@ class acp_permissions switch ($row['auth_setting']) { case ACL_NO: - $information = $user->lang['TRACE_GROUP_NO']; + $information = $user->lang['TRACE_GROUP_NO' . $add_key]; break; case ACL_YES: - $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES'] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER'] : $user->lang['TRACE_GROUP_YES_TOTAL_NO']); + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]); $total = ($total == ACL_NO) ? ACL_YES : $total; break; case ACL_NEVER: - $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES'] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER'] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO']); + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]); $total = ACL_NEVER; break; } @@ -973,24 +978,24 @@ class acp_permissions } } - // Get user specific permission... + // Get user specific permission... globally or for this forum $hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id); $auth_setting = (!sizeof($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission]; switch ($auth_setting) { case ACL_NO: - $information = ($total == ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO'] : $user->lang['TRACE_USER_KEPT']; + $information = ($total == ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : $user->lang['TRACE_USER_KEPT' . $add_key]; $total = ($total == ACL_NO) ? ACL_NEVER : $total; break; case ACL_YES: - $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES'] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_YES_TOTAL_NEVER'] : $user->lang['TRACE_USER_YES_TOTAL_NO']); + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]); $total = ($total == ACL_NO) ? ACL_YES : $total; break; case ACL_NEVER: - $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_NEVER_TOTAL_YES'] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER'] : $user->lang['TRACE_USER_NEVER_TOTAL_NO']); + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]); $total = ACL_NEVER; break; } @@ -1007,8 +1012,7 @@ class acp_permissions 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) ); - // global permission might overwrite local permission - if (($forum_id != 0) && isset($auth->acl_options['global'][$permission])) + if ($forum_id != 0 && isset($auth->acl_options['global'][$permission])) { if ($user_id != $user->data['user_id']) { @@ -1031,17 +1035,21 @@ class acp_permissions $information = $user->lang['TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT']; } - $template->assign_block_vars('trace', array( - 'WHO' => sprintf($user->lang['TRACE_GLOBAL_SETTING'], $userdata['username']), - 'INFORMATION' => sprintf($information, '<a href="' . $this->u_action . "&u=$user_id&f=0&auth=$permission&back=$forum_id\">", '</a>'), + // If there is no auth information we do not need to worry the user by showing non-relevant data. + if ($auth_setting) + { + $template->assign_block_vars('trace', array( + 'WHO' => sprintf($user->lang['TRACE_GLOBAL_SETTING'], $userdata['username']), + 'INFORMATION' => sprintf($information, '<a href="' . $this->u_action . "&u=$user_id&f=0&auth=$permission&back=$forum_id\">", '</a>'), - 'S_SETTING_NO' => false, - 'S_SETTING_YES' => $auth_setting, - 'S_SETTING_NEVER' => !$auth_setting, - 'S_TOTAL_NO' => false, - 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, - 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) - ); + 'S_SETTING_NO' => false, + 'S_SETTING_YES' => $auth_setting, + 'S_SETTING_NEVER' => !$auth_setting, + 'S_TOTAL_NO' => false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) + ); + } } // Take founder status into account, overwriting the default values @@ -1058,7 +1066,16 @@ class acp_permissions 'S_TOTAL_YES' => true, 'S_TOTAL_NEVER' => false) ); + + $total = ACL_YES; } + + // Total value... + $template->assign_vars(array( + 'S_RESULT_NO' => ($total == ACL_NO) ? true : false, + 'S_RESULT_YES' => ($total == ACL_YES) ? true : false, + 'S_RESULT_NEVER' => ($total == ACL_NEVER) ? true : false, + )); } /** diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index e0f6aa9a0b..08270a7221 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -143,11 +143,12 @@ class acp_ranks $db->sql_freeresult($result); $imglist = filelist($phpbb_root_path . $config['ranks_path'], ''); - $edit_img = $filename_list = ''; foreach ($imglist as $path => $img_ary) { + sort($img_ary); + foreach ($img_ary as $img) { $img = $path . $img; @@ -202,7 +203,7 @@ class acp_ranks $sql = 'SELECT * FROM ' . RANKS_TABLE . ' - ORDER BY rank_min ASC, rank_special ASC, rank_title ASC'; + ORDER BY rank_special DESC, rank_min ASC, rank_title ASC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9c5fde9316..f894c2750d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -577,7 +577,7 @@ if (!function_exists('realpath')) $bits = explode('/', $path); // Remove any . in the path, renumber array for the loop below - $bits = array_keys(array_diff($bits, array('.'))); + $bits = array_values(array_diff($bits, array('.'))); // Lets get looping, run over and resolve any .. (up directory) for ($i = 0, $max = sizeof($bits); $i < $max; $i++) @@ -789,6 +789,8 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $tracking_topics['l'] = base_convert(time() - $config['board_startdate'], 10, 36); $user->set_cookie('track', tracking_serialize($tracking_topics), time() + 31536000); + $_COOKIE[$config['cookie_name'] . '_track'] = (STRIP) ? addslashes(tracking_serialize($tracking_topics)) : tracking_serialize($tracking_topics); + unset($tracking_topics); if ($user->data['is_registered']) @@ -882,7 +884,14 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $tracking['f'][$f_id] = base_convert(time() - $config['board_startdate'], 10, 36); } + if (isset($tracking['tf']) && empty($tracking['tf'])) + { + unset($tracking['tf']); + } + $user->set_cookie('track', tracking_serialize($tracking), time() + 31536000); + $_COOKIE[$config['cookie_name'] . '_track'] = (STRIP) ? addslashes(tracking_serialize($tracking)) : tracking_serialize($tracking); + unset($tracking); } @@ -977,6 +986,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $user->set_cookie('track', tracking_serialize($tracking), time() + 31536000); + $_COOKIE[$config['cookie_name'] . '_track'] = (STRIP) ? addslashes(tracking_serialize($tracking)) : tracking_serialize($tracking); } return; @@ -1241,11 +1251,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti } else if ($config['load_anon_lastread'] || $user->data['is_registered']) { - if (!isset($tracking_topics) || !sizeof($tracking_topics)) - { - $tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : ''; - $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); - } + $tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : ''; + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); if (!$user->data['is_registered']) { @@ -1300,6 +1307,7 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti $check_forum = $tracking_topics['tf'][$forum_id]; $unread = false; + while ($row = $db->sql_fetchrow($result)) { if (!in_array(base_convert($row['topic_id'], 10, 36), array_keys($check_forum))) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5e94b0d9e0..64358cbdf4 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -365,14 +365,14 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png') if (!is_dir($rootdir . $dir)) { - return false; + return $matches; } $dh = @opendir($rootdir . $dir); if (!$dh) { - return false; + return $matches; } while (($fname = readdir($dh)) !== false) diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 8bebbc71bd..de607df297 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -227,7 +227,7 @@ function mcp_front_view($id, $mode, $action) // Latest 5 logs if ($module->loaded('logs')) { - $forum_list = get_forum_list(array('m_', 'a_')); + $forum_list = get_forum_list('m_'); if (!empty($forum_list)) { diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index cec097cd8a..514aba5718 100755 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -55,51 +55,69 @@ class mcp_logs $this->tpl_name = 'mcp_logs'; $this->page_title = 'MCP_LOGS'; + $forum_list = get_forum_list('m_'); + $forum_list[] = 0; + $forum_id = $topic_id = 0; + switch ($mode) { case 'front': - $where_sql = ''; break; case 'forum_logs': $forum_id = request_var('f', 0); - $where_sql = " AND forum_id = $forum_id"; + + if (!in_array($forum_id, $forum_list)) + { + trigger_error('NOT_AUTHORISED'); + } + + $forum_list = array($forum_id); break; case 'topic_logs': $topic_id = request_var('t', 0); - $where_sql = " AND topic_id = $topic_id"; + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $forum_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + if (!in_array($forum_id, $forum_list)) + { + trigger_error('NOT_AUTHORISED'); + } + + $forum_list = array($forum_id); break; } // Delete entries if requested and able if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) { - if ($deletemark) + if ($deletemark && sizeof($marked)) { - if (!sizeof($marked)) - { - $where_sql = ''; - } - else - { - $sql_in = array(); - foreach ($marked as $mark) - { - $sql_in[] = $mark; - } - - $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); - unset($sql_in); - } - } + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE log_type = ' . LOG_MOD . ' + AND ' . $db->sql_in_set('forum_id', $forum_list) . ' + AND ' . $db->sql_in_set('log_id', $marked); + $db->sql_query($sql); - if ($where_sql || $deleteall) + add_log('admin', 'LOG_CLEAR_MOD'); + } + else if ($deleteall) { $sql = 'DELETE FROM ' . LOG_TABLE . ' - WHERE log_type = ' . LOG_MOD . " - $where_sql"; + WHERE log_type = ' . LOG_MOD . ' + AND ' . $db->sql_in_set('forum_id', $forum_list); + + if ($mode == 'topic_logs') + { + $sql .= ' AND topic_id = ' . $topic_id; + } $db->sql_query($sql); add_log('admin', 'LOG_CLEAR_MOD'); @@ -121,7 +139,7 @@ class mcp_logs // Grab log data $log_data = array(); $log_count = 0; - view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, $topic_id, 0, $sql_where, $sql_sort); + view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort); $template->assign_vars(array( 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), |