From cf465cda3f92bbd93b7cd5fe9c1a69e199c245c0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 6 Nov 2004 14:24:34 +0000 Subject: [PATCH] - minor fixes git-svn-id: file:///svn/phpbb/trunk@5024 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 6 ++-- phpBB/mcp.php | 80 ++++++++++++++++++++++---------------------- phpBB/memberlist.php | 1 + phpBB/viewtopic.php | 2 +- 4 files changed, 45 insertions(+), 44 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index efcb6eeb68..09da9b7753 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -111,7 +111,7 @@ define('POST_ANNOUNCE', 2); define('POST_GLOBAL', 3); // Lastread types -define('TRACK_NORMAL', 0); // not used at the moment +define('TRACK_NORMAL', 0); define('TRACK_POSTED', 1); // Notify methods @@ -250,7 +250,7 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); // Grab global variables, re-cache if necessary if ($config = $cache->get('config')) { - $sql = 'SELECT * + $sql = 'SELECT config_name, config_value FROM ' . CONFIG_TABLE . ' WHERE is_dynamic = 1'; $result = $db->sql_query($sql); @@ -264,7 +264,7 @@ else { $config = $cached_config = array(); - $sql = 'SELECT * + $sql = 'SELECT config_name, config_value, is_dynamic FROM ' . CONFIG_TABLE; $result = $db->sql_query($sql); diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 30cc361536..303b21b021 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -34,46 +34,6 @@ class module global $template, $auth, $db, $user, $config; global $phpbb_root_path, $phpEx; - if ($post_id) - { - // We determine the topic and forum id here, to make sure the moderator really has moderative rights on this post - $sql = 'SELECT topic_id, forum_id - FROM ' . POSTS_TABLE . " - WHERE post_id = $post_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $topic_id = (int) $row['topic_id']; - $forum_id = (int) $row['forum_id']; - } - - if ($topic_id && !$forum_id) - { - $sql = 'SELECT forum_id - FROM ' . TOPICS_TABLE . " - WHERE topic_id = $topic_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $forum_id = (int) $row['forum_id']; - } - - // If we do not have a forum id and the user is not a super moderator (global options are set to false, even if the user is able to moderator at least one forum - if (!$forum_id && !$auth->acl_get('m_')) - { - $forum_list = get_forum_list('m_'); - - if (!sizeof($forum_list)) - { - trigger_error('MODULE_NOT_EXIST'); - } - - // We do not check all forums, only the first one should be sufficiant. - $forum_id = $forum_list[0]; - } - $sql = 'SELECT module_id, module_title, module_filename, module_subs, module_acl FROM ' . MODULES_TABLE . " WHERE module_type = '{$module_type}' @@ -399,6 +359,46 @@ if (!$quickmod) $topic_id = request_var('t', 0); $forum_id = request_var('f', 0); + if ($post_id) + { + // We determine the topic and forum id here, to make sure the moderator really has moderative rights on this post + $sql = 'SELECT topic_id, forum_id + FROM ' . POSTS_TABLE . " + WHERE post_id = $post_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $topic_id = (int) $row['topic_id']; + $forum_id = (int) $row['forum_id']; + } + + if ($topic_id && !$forum_id) + { + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . " + WHERE topic_id = $topic_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_id = (int) $row['forum_id']; + } + + // If we do not have a forum id and the user is not a super moderator (global options are set to false, even if the user is able to moderator at least one forum + if (!$forum_id && !$auth->acl_get('m_')) + { + $forum_list = get_forum_list('m_'); + + if (!sizeof($forum_list)) + { + trigger_error('MODULE_NOT_EXIST'); + } + + // We do not check all forums, only the first one should be sufficiant. + $forum_id = $forum_list[0]; + } + // Instantiate module system and generate list of available modules $mcp->create('mcp', "mcp.$phpEx$SID", $post_id, $topic_id, $forum_id, $module, $mode); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 8e903d33a6..b77be7e212 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -427,6 +427,7 @@ switch ($mode) 'S_CUSTOM_FIELDS' => (sizeof($profile_fields)) ? true : false, 'U_ADD_FRIEND' => "ucp.$phpEx$SID&i=zebra&add=" . urlencode($member['username']), + 'U_ADD_FOE' => "ucp.$phpEx$SID&i=zebra&mode=foes&add=" . urlencode($member['username']), 'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&f=$active_f_id", 'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&t=$active_t_id",) ); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f7e46467b8..60683da22c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1306,7 +1306,7 @@ unset($user_cache); // Update topic view and if necessary attachment view counters ... but only // if this is the first 'page view' -if (!preg_match("#&t=$topic_id#", $user->data['session_page'])) +if (isset($user->data['session_page']) && !preg_match("#&t=$topic_id#", $user->data['session_page'])) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . "