From eb5b9bfb0718eb4d960ff2555d6084263750d874 Mon Sep 17 00:00:00 2001 From: uid29890 Date: Thu, 5 Jul 2001 00:47:03 +0000 Subject: Started on moderator control panel code. Main layout is started, no functionality yet git-svn-id: file:///svn/phpbb/trunk@561 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/db/oracle.php | 34 ++++++++ phpBB/language/lang_english.php | 14 +++- phpBB/modcp.php | 182 ++++++++++++++++++++++++++++++++++++++++ phpBB/topicadmin.php | 27 ------ phpBB/viewforum.php | 6 +- phpBB/viewtopic.php | 11 +-- 6 files changed, 238 insertions(+), 36 deletions(-) create mode 100644 phpBB/modcp.php delete mode 100644 phpBB/topicadmin.php diff --git a/phpBB/db/oracle.php b/phpBB/db/oracle.php index c26001efc7..42664ca45d 100644 --- a/phpBB/db/oracle.php +++ b/phpBB/db/oracle.php @@ -320,6 +320,40 @@ class sql_db return false; } } + function sql_nextid($query_id = 0) + { + if(!$query_id) + { + $query_id = $this->query_result; + } + if($query_id && $this->last_query_text[$query_id] != "") + { + if( eregi("^(INSERT{1}|^INSERT INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename)) + { + $query = "SELECT ".$tablename[2]."_id_seq.currval FROM DUAL"; + $stmt = OCIParse($this->db_connect_id, $query); + OCIExecute($stmt); + $temp_result = @OCIFetchInto($stmt, $temp_result, OCI_ASSOC); + if($temp_result) + { + return $temp_result['CURRVAL']; + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + function sql_nextid() { if($this->db_connect_id) diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 1ada24f22b..ae5460a082 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -341,7 +341,6 @@ Thank you for registering. $lang['COPPA'] = "Your account has been created but has to be approved, please check your email for details."; $lang['Welcome_COPPA'] = "Your account has been created, however in complance with the COPPA act you must print out this page and have you parent or guardian mail it to:
" . $lang['Mailing_address'] . "
Or fax it to:
" . $lang['Fax_info'] . "
Once this information has been received your account will be activated by the administrator and you will receive an email notification."; - // // Memberslist // @@ -419,9 +418,18 @@ $lang['A_critical_error'] = "A Critical Error Occured"; $lang['Error_login'] = "Login Failed
You have specified an incorrect/inactive username or invalid password, please go back and try again"; +$lang['Not_Moderator'] = "You are not a moderator of this forum"; +$lang['Not_Authorised'] = "Not Authorised"; - - +// +// Moderator Control Panel +// +$lang['ModCp_Explain'] = "Using the form below you can preform mass operations on this forum. You can lock, unlock, move, or delete any number of topics"; +$lang['Select'] = "Select"; +$lang['Delete'] = "Delete"; +$lang['Move'] = "Move"; +$lang['Lock'] = "Lock"; +$lang['Unlock'] = "Unlock"; // // Old format ... _DON'T_add_any_ new entries here!! diff --git a/phpBB/modcp.php b/phpBB/modcp.php new file mode 100644 index 0000000000..13f606a233 --- /dev/null +++ b/phpBB/modcp.php @@ -0,0 +1,182 @@ +sql_query($sql)) + { + message_die(GENERAL_MESSAGE, $lang['Topic_post_not_exist'], "", __LINE__, __FILE__, $sql); + } + $topic_row = $db->sql_fetchrowset($result); + $forum_topics = $topic_row[0]['forum_topics']; + $forum_id = $topic_row[0]['forum_id']; +} +else +{ + $sql = "SELECT forum_topics FROM ".FORUMS_TABLE." WHERE forum_id = ".$forum_id; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_MESSAGE, $lang['Topic_post_not_exist'], "", __LINE__, __FILE__, $sql); + } + $topic_row = $db->sql_fetchrowset($result); + $forum_topics = $topic_row[0]['forum_topics']; +} + +$is_mod = 0; + +// +// Start session management +// +$userdata = session_pagestart($user_ip, $forum_id, $session_length); +init_userprefs($userdata); +// +// End session management +// + + +// +// Start auth check +// +$is_auth = auth(AUTH_ALL, $forum_id, $userdata); + + +if($is_auth['auth_mod'] || $userdata['user_level'] == ADMIN) +{ + $is_mod = TRUE; +} +else +{ + $is_mod = FALSE; +} +// +// End Auth Check +// + +if(!$is_mod) +{ + message_die(CRITICAL_MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised'], __LINE__, __FILE__); +} + +include('includes/page_header.'.$phpEx); + +switch($mode) +{ + case 'delete': + + + break; + case 'move': + + + break; + case 'lock': + + + break; + case 'unlock': + + break; + default: + $template->set_filenames(array("body" => "modcp_body.tpl")); + $template->assign_vars(array("L_MOD_EXPLAIN" => $lang['ModCp_Explain'], + "L_SELECT" => $lang['Select'], + "L_DELETE" => $lang['Delete'], + "L_MOVE" => $lang['Move'], + "L_LOCK" => $lang['Lock'], + "L_UNLOCK" => $lang['Unlock'], + "S_MODCP_URL" => append_sid("modcp.$phpEx") )); + if(!$start) + { + $start = 0; + } + + $sql = "SELECT t.topic_title, t.topic_id, t.topic_replies, u.username, u.user_id, p.post_time + FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p + WHERE t.forum_id = $forum_id + AND t.topic_poster = u.user_id + AND p.post_id = t.topic_last_post_id + AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " + ORDER BY t.topic_type DESC, p.post_time DESC + LIMIT $start, ".$board_config['topics_per_page']; + + if(!$t_result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql); + } + $total_topics = $db->sql_numrows($t_result); + $topics = $db->sql_fetchrowset($t_result); + + for($x = 0; $x < $total_topics; $x++) + { + $topic_id = $topics[$x]['topic_id']; + $topic_title = stripslashes($topics[$x]['topic_title']); + $s_topic_url = append_sid("viewtopic.$phpEx?".POST_TOPIC_URL."=$topic_id"); + $topic_replies = $topics[$x]['topic_replies']; + $last_post_time = create_date($board_config['default_dateformat'], $topics[$x]['post_time'], $board_config['default_timezone']); + + + $template->assign_block_vars("topicrow", array( + "S_TOPIC_URL" => $s_topic_url, + "TOPIC_TITLE" => $topic_title, + "REPLIES" => $topic_replies, + "LAST_POST" => $last_post_time, + "TOPIC_ID" => $topic_id)); + } + + $pagination = generate_pagination("modcp.$phpEx?".POST_FORUM_URL."=$forum_id", $forum_topics, $board_config['topics_per_page'], $start); + $template->assign_vars(array("PAGINATION" => $pagination, + "FORUM_ID" => $forum_id, + "POST_FORUM_URL" => POST_FORUM_URL, + "ON_PAGE" => (floor($start/$board_config['topics_per_page'])+1), + "TOTAL_PAGES" => ceil($forum_topics/$board_config['topics_per_page']), + "L_OF" => $lang['of'], + "L_PAGE" => $lang['Page'], + "L_GOTO_PAGE" => $lang['Goto_page'])); + $template->pparse("body"); + break; +} + +include('includes/page_tail.'.$phpEx); + +?> diff --git a/phpBB/topicadmin.php b/phpBB/topicadmin.php deleted file mode 100644 index b4278d1182..0000000000 --- a/phpBB/topicadmin.php +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index e1efd7b52c..08853925ff 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -410,7 +410,11 @@ if($total_topics) $s_auth_can .= "You " . (($is_auth['auth_reply']) ? "can" : "cannot") . " reply to posts in this forum
"; $s_auth_can .= "You " . (($is_auth['auth_edit']) ? "can" : "cannot") . " edit your posts in this forum
"; $s_auth_can .= "You " . (($is_auth['auth_delete']) ? "can" : "cannot") . " delete your posts in this forum
"; - + if($is_auth['auth_mod'] || $userdata['user_level'] == ADMIN) + { + $s_auth_can .= "You can moderate this forum
"; + } + $template->assign_vars(array( "PAGINATION" => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&postdays=$post_days", $topics_count, $board_config['topics_per_page'], $start), "ON_PAGE" => ( floor( $start / $board_config['topics_per_page'] ) + 1 ), diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cccd881a9d..5ccc14fa8e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -537,20 +537,21 @@ $s_auth_can .= "You " . (($is_auth['auth_reply']) ? "can" : "cannotcan" : "cannot") . " edit your posts in this forum
"; $s_auth_can .= "You " . (($is_auth['auth_delete']) ? "can" : "cannot") . " delete your posts in this forum
"; -if($is_auth['auth_mod']) +if($is_auth['auth_mod'] || $userdata['user_level'] == ADMIN) { - $topic_mod = "  "; + $topic_mod = "  "; - $topic_mod .= "  "; + $topic_mod .= "  "; if($forum_row[0]['topic_status'] == UNLOCKED) { - $topic_mod .= "  "; + $topic_mod .= "  "; } else { - $topic_mod .= "  "; + $topic_mod .= "  "; } + $s_auth_can .= "You can moderate this forum
"; } $pagination = generate_pagination("viewtopic.$phpEx?".POST_TOPIC_URL."=$topic_id", $total_replies, $board_config['posts_per_page'], $start); -- cgit v1.2.1