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
This commit is contained in:
uid29890 2001-07-05 00:47:03 +00:00
parent 14c6a0a4af
commit eb5b9bfb07
6 changed files with 238 additions and 36 deletions

View file

@ -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)

View file

@ -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: <br>" . $lang['Mailing_address'] . "<br>Or fax it to: <br>" . $lang['Fax_info'] . "<br> 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<br>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!!

182
phpBB/modcp.php Normal file
View file

@ -0,0 +1,182 @@
<?php
/***************************************************************************
*
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/
/**
* Moderator Control Panel
*
* From this 'Control Panel' the moderator of a forum will be able to do
* mass topic operations (locking/unlocking/moving/deleteing), and it will
* provide an interface to do quick locking/unlocking/moving/deleting of
* topics via the moderator operations buttons on all of the viewtopic pages.
*/
include('extension.inc');
include('common.'.$phpEx);
$pagetype = "modcp";
$page_title = "Modertator Control Panel";
$forum_id = ($HTTP_POST_VARS[POST_FORUM_URL]) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
$topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL];
if(empty($forum_id))
{
$sql = "SELECT forum_id, forum_topics FROM ".TOPICS_TABLE." WHERE topic_id = ".$topic_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'];
$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);
?>

View file

@ -1,27 +0,0 @@
<?php
/***************************************************************************
*
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/
?>

View file

@ -410,7 +410,11 @@ if($total_topics)
$s_auth_can .= "You " . (($is_auth['auth_reply']) ? "<b>can</b>" : "<b>cannot</b>") . " reply to posts in this forum<br>";
$s_auth_can .= "You " . (($is_auth['auth_edit']) ? "<b>can</b>" : "<b>cannot</b>") . " edit your posts in this forum<br>";
$s_auth_can .= "You " . (($is_auth['auth_delete']) ? "<b>can</b>" : "<b>cannot</b>") . " delete your posts in this forum<br>";
if($is_auth['auth_mod'] || $userdata['user_level'] == ADMIN)
{
$s_auth_can .= "You <b>can</b> <a href=\"" . append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id") . "\">moderate this forum</a><br>";
}
$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 ),

View file

@ -537,20 +537,21 @@ $s_auth_can .= "You " . (($is_auth['auth_reply']) ? "<b>can</b>" : "<b>cannot</b
$s_auth_can .= "You " . (($is_auth['auth_edit']) ? "<b>can</b>" : "<b>cannot</b>") . " edit your posts in this forum<br>";
$s_auth_can .= "You " . (($is_auth['auth_delete']) ? "<b>can</b>" : "<b>cannot</b>") . " delete your posts in this forum<br>";
if($is_auth['auth_mod'])
if($is_auth['auth_mod'] || $userdata['user_level'] == ADMIN)
{
$topic_mod = "<a href=\"topicadmin.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=delete\"><img src=\"images/topic_delete.gif\" border=\"0\"></a>&nbsp;&nbsp;";
$topic_mod = "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=delete") . "\"><img src=\"images/topic_delete.gif\" border=\"0\"></a>&nbsp;&nbsp;";
$topic_mod .= "<a href=\"topicadmin.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move\"><img src=\"images/topic_move.gif\" border=\"0\"></a>&nbsp;&nbsp;";
$topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move"). "\"><img src=\"images/topic_move.gif\" border=\"0\"></a>&nbsp;&nbsp;";
if($forum_row[0]['topic_status'] == UNLOCKED)
{
$topic_mod .= "<a href=\"topicadmin.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock\"><img src=\"images/topic_lock.gif\" border=\"0\"></a>&nbsp;&nbsp;";
$topic_mod .= "<a href=\"" . append_sid("modecp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock") . "\"><img src=\"images/topic_lock.gif\" border=\"0\"></a>&nbsp;&nbsp;";
}
else
{
$topic_mod .= "<a href=\"topicadmin.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unlock\"><img src=\"images/topic_unlock.gif\" border=\"0\"></a>&nbsp;&nbsp;";
$topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unlock") . "\"><img src=\"images/topic_unlock.gif\" border=\"0\"></a>&nbsp;&nbsp;";
}
$s_auth_can .= "You <b>can</b> <a href=\"" . append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id") . "\">moderate this forum</a><br>";
}
$pagination = generate_pagination("viewtopic.$phpEx?".POST_TOPIC_URL."=$topic_id", $total_replies, $board_config['posts_per_page'], $start);