More updates and fixes ... still not fixed error in admin_users

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3085 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-11-24 22:59:45 +00:00
parent 31b80c4278
commit b202750e4b
5 changed files with 93 additions and 3 deletions

View file

@ -302,9 +302,11 @@ if( !empty($mode) )
$forumstatus == ( FORUM_LOCKED ) ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\""; $forumstatus == ( FORUM_LOCKED ) ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\"";
$statuslist = "<option value=\"" . FORUM_UNLOCKED . "\" $forumunlocked>" . $lang['Status_unlocked'] . "</option>\n"; $statuslist = "<option value=\"" . FORUM_UNLOCKED . "\" $forumunlocked>" . $lang['Status_unlocked'] . "</option>\n";
$statuslist .= "<option value=\"" . FORUM_LOCKED . "\" $forumlocked>" . $lang['Status_locked'] . "</option>\n"; $statuslist .= "<option value=\"" . FORUM_LOCKED . "\" $forumlocked>" . $lang['Status_locked'] . "</option>\n";
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/forum_edit_body.tpl") "body" => "admin/forum_edit_body.tpl")
); );
@ -604,6 +606,40 @@ if( !empty($mode) )
// Either delete or move all posts in a forum // Either delete or move all posts in a forum
if($to_id == -1) if($to_id == -1)
{ {
// Delete polls in this forum
$sql = "SELECT v.vote_id
FROM " . VOTE_DESC_TABLE . " v, " . TOPICS_TABLE . " t
WHERE t.forum_id = $forum_id
AND v.topic_id = t.topic_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, "Couldn't obtain list of vote ids", "", __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$vote_ids = '';
do
{
$vote_ids = (($vote_ids != '') ? ', ' : '') . $row['vote_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id IN ($vote_ids)";
$db->sql_query($sql);
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id IN ($vote_ids)";
$db->sql_query($sql);
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "
WHERE vote_id IN ($vote_ids)";
$db->sql_query($sql);
}
$db->sql_freeresult($result);
include($phpbb_root_path . "includes/prune.$phpEx"); include($phpbb_root_path . "includes/prune.$phpEx");
prune($from_id, 0); // Delete everything from forum prune($from_id, 0); // Delete everything from forum
} }
@ -616,6 +652,7 @@ if( !empty($mode) )
{ {
message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql);
} }
if($db->sql_numrows($result) != 2) if($db->sql_numrows($result) != 2)
{ {
message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__);
@ -637,6 +674,58 @@ if( !empty($mode) )
sync('forum', $to_id); sync('forum', $to_id);
} }
// Alter Mod level if appropriate - 2.0.4
$sql = "SELECT ug.user_id
FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug
WHERE a.forum_id <> $forum_id
AND a.auth_mod = 1
AND ug.group_id = a.group_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$user_ids = '';
do
{
$user_ids = (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = "SELECT ug.user_id
FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug
WHERE a.forum_id = $forum_id
AND a.auth_mod = 1
AND ug.group_id = a.group_id
AND ug.user_id NOT IN ($user_ids)";
if( !$result2 = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result2))
{
$user_ids = '';
do
{
$user_ids = (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
}
while ($row = $db->sql_fetchrow($result2));
$sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . USER . "
WHERE user_id IN ($user_ids)
AND user_level <> " . ADMIN;
$db->sql_query($sql);
}
$db->sql_freeresult($result);
}
$db->sql_freeresult($result2);
$sql = "DELETE FROM " . FORUMS_TABLE . " $sql = "DELETE FROM " . FORUMS_TABLE . "
WHERE forum_id = $from_id"; WHERE forum_id = $from_id";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )

View file

@ -717,7 +717,7 @@ else if ( $group_id )
$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\nBcc: " . $email_addresses . "\n"; $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\nBcc: " . $email_addresses . "\n";
$emailer->use_template('group_approved'); $emailer->use_template('group_approved');
$emailer->email_address($userdata['user_email']); $emailer->email_address(' ');//$userdata['user_email']
$emailer->set_subject();//$lang['Group_approved'] $emailer->set_subject();//$lang['Group_approved']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);

View file

@ -88,7 +88,7 @@ class emailer
$template_lang = $board_config['default_lang']; $template_lang = $board_config['default_lang'];
} }
$this->tpl_file = realpath($phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl'); $this->tpl_file = @realpath($phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl');
if ( !file_exists($this->tpl_file) ) if ( !file_exists($this->tpl_file) )
{ {

View file

@ -326,7 +326,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
{ {
if ( !empty($option_text) ) if ( !empty($option_text) )
{ {
$option_text = str_replace("\'", "''", $option_text); $option_text = str_replace("\'", "''", htmlspecialchars($option_text));
$poll_result = ( $mode == "editpost" && isset($old_poll_result[$option_id]) ) ? $old_poll_result[$option_id] : 0; $poll_result = ( $mode == "editpost" && isset($old_poll_result[$option_id]) ) ? $old_poll_result[$option_id] : 0;
$sql = ( $mode != "editpost" || !isset($old_poll_result[$option_id]) ) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id"; $sql = ( $mode != "editpost" || !isset($old_poll_result[$option_id]) ) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";

View file

@ -1013,6 +1013,7 @@ switch( $mode )
$template->set_filenames(array( $template->set_filenames(array(
'body' => 'modcp_body.tpl') 'body' => 'modcp_body.tpl')
); );
make_jumpbox('modcp.'.$phpEx);
// //
// Define censored word matches // Define censored word matches