diff options
Diffstat (limited to 'phpBB/admin')
-rw-r--r-- | phpBB/admin/admin_forum_prune.php | 198 | ||||
-rw-r--r-- | phpBB/admin/admin_forumauth.php | 351 | ||||
-rw-r--r-- | phpBB/admin/admin_mass_email.php | 204 | ||||
-rw-r--r-- | phpBB/admin/admin_ug_auth.php | 941 |
4 files changed, 0 insertions, 1694 deletions
diff --git a/phpBB/admin/admin_forum_prune.php b/phpBB/admin/admin_forum_prune.php deleted file mode 100644 index 6315d9b2da..0000000000 --- a/phpBB/admin/admin_forum_prune.php +++ /dev/null @@ -1,198 +0,0 @@ -<?php -/*************************************************************************** -* admin_forum_prune.php -* ------------------- -* begin : Mon Jul 31, 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. - * - ***************************************************************************/ - -define('IN_PHPBB', true); - -if ( !empty($setmodules) ) -{ - $filename = basename(__FILE__); - $module['Forums']['Prune'] = $filename; - - return; -} - -// -// Load default header -// -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); -require($phpbb_root_path . 'includes/prune.'.$phpEx); -require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); - -// -// Get the forum ID for pruning -// -if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) ) -{ - $forum_id = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL]; - - if( $forum_id == -1 ) - { - $forum_sql = ''; - } - else - { - $forum_id = intval($forum_id); - $forum_sql = "AND forum_id = $forum_id"; - } -} -else -{ - $forum_id = ''; - $forum_sql = ''; -} -// -// Get a list of forum's or the data for the forum that we are pruning. -// -$sql = "SELECT f.* - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id - $forum_sql - ORDER BY c.cat_order ASC, f.forum_order ASC"; -if( !($result = $db->sql_query($sql)) ) -{ - message_die(GENERAL_ERROR, 'Could not obtain list of forums for pruning', '', __LINE__, __FILE__, $sql); -} - -$forum_rows = array(); -while( $row = $db->sql_fetchrow($result) ) -{ - $forum_rows[] = $row; -} - -// -// Check for submit to be equal to Prune. If so then proceed with the pruning. -// -if( isset($HTTP_POST_VARS['doprune']) ) -{ - $prunedays = ( isset($HTTP_POST_VARS['prunedays']) ) ? intval($HTTP_POST_VARS['prunedays']) : 0; - - // Convert days to seconds for timestamp functions... - $prunedate = time() - ( $prunedays * 86400 ); - - $template->set_filenames(array( - 'body' => 'admin/forum_prune_result_body.tpl') - ); - - for($i = 0; $i < count($forum_rows); $i++) - { - $p_result = prune($forum_rows[$i]['forum_id'], $prunedate); - sync('forum', $forum_rows[$i]['forum_id']); - - $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $template->assign_block_vars('prune_results', array( - 'ROW_COLOR' => '#' . $row_color, - 'ROW_CLASS' => $row_class, - 'FORUM_NAME' => $forum_rows[$i]['forum_name'], - 'FORUM_TOPICS' => $p_result['topics'], - 'FORUM_POSTS' => $p_result['posts']) - ); - } - - $template->assign_vars(array( - 'L_FORUM_PRUNE' => $lang['Forum_Prune'], - 'L_FORUM' => $lang['Forum'], - 'L_TOPICS_PRUNED' => $lang['Topics_pruned'], - 'L_POSTS_PRUNED' => $lang['Posts_pruned'], - 'L_PRUNE_RESULT' => $lang['Prune_success']) - ); -} -else -{ - // - // If they haven't selected a forum for pruning yet then - // display a select box to use for pruning. - // - if( empty($HTTP_POST_VARS[POST_FORUM_URL]) ) - { - // - // Output a selection table if no forum id has been specified. - // - $template->set_filenames(array( - 'body' => 'admin/forum_prune_select_body.tpl') - ); - - $select_list = '<select name="' . POST_FORUM_URL . '">'; - $select_list .= '<option value="-1">' . $lang['All_Forums'] . '</option>'; - - for($i = 0; $i < count($forum_rows); $i++) - { - $select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>'; - } - $select_list .= '</select>'; - - // - // Assign the template variables. - // - $template->assign_vars(array( - 'L_FORUM_PRUNE' => $lang['Forum_Prune'], - 'L_SELECT_FORUM' => $lang['Select_a_Forum'], - 'L_LOOK_UP' => $lang['Look_up_Forum'], - - 'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"), - 'S_FORUMS_SELECT' => $select_list) - ); - } - else - { - $forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]); - - // - // Output the form to retrieve Prune information. - // - $template->set_filenames(array( - 'body' => 'admin/forum_prune_body.tpl') - ); - - $forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name']; - - $prune_data = $lang['Prune_topics_not_posted'] . " "; - $prune_data .= '<input type="text" name="prunedays" size="4"> ' . $lang['Days']; - - $hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">'; - - // - // Assign the template variables. - // - $template->assign_vars(array( - 'FORUM_NAME' => $forum_name, - - 'L_FORUM_PRUNE' => $lang['Forum_Prune'], - 'L_FORUM_PRUNE_EXPLAIN' => $lang['Forum_Prune_explain'], - 'L_DO_PRUNE' => $lang['Do_Prune'], - - 'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"), - 'S_PRUNE_DATA' => $prune_data, - 'S_HIDDEN_VARS' => $hidden_input) - ); - } -} -// -// Actually output the page here. -// -$template->pparse('body'); - -include('page_footer_admin.'.$phpEx); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_forumauth.php b/phpBB/admin/admin_forumauth.php deleted file mode 100644 index e6edc49eb2..0000000000 --- a/phpBB/admin/admin_forumauth.php +++ /dev/null @@ -1,351 +0,0 @@ -<?php -/*************************************************************************** - * admin_forumauth.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. - * - ***************************************************************************/ - -define('IN_PHPBB', 1); - -if( !empty($setmodules) ) -{ - $filename = basename(__FILE__); - $module['Forums']['Permissions'] = $filename; - - return; -} - -// -// Load default header -// -$no_page_header = TRUE; -$phpbb_root_path = "../"; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// -// Start program - define vars -// -// View Read Post Reply Edit Delete Sticky Announce Vote Poll -$simple_auth_ary = array( - 0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), - 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), - 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), - 3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL), - 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL), - 5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), - 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), -); - -$simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . " [" . $lang['Hidden'] . "]", $lang['Private'], $lang['Private'] . " [" . $lang['Hidden'] . "]", $lang['Moderators'], $lang['Moderators'] . " [" . $lang['Hidden'] . "]"); - -$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce", "auth_vote", "auth_pollcreate"); - -$field_names = array( - "auth_view" => $lang['View'], - "auth_read" => $lang['Read'], - "auth_post" => $lang['Post'], - "auth_reply" => $lang['Reply'], - "auth_edit" => $lang['Edit'], - "auth_delete" => $lang['Delete'], - "auth_sticky" => $lang['Sticky'], - "auth_announce" => $lang['Announce'], - "auth_vote" => $lang['Vote'], - "auth_pollcreate" => $lang['Pollcreate']); - -$forum_auth_levels = array("ALL", "REG", "PRIVATE", "MOD", "ADMIN"); -$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); - -if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL])) -{ - $forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]); - $forum_sql = "AND forum_id = $forum_id"; -} -else -{ - unset($forum_id); - $forum_sql = ""; -} - -if( isset($HTTP_GET_VARS['adv']) ) -{ - $adv = intval($HTTP_GET_VARS['adv']); -} -else -{ - unset($adv); -} - -// -// Start program proper -// -if( isset($HTTP_POST_VARS['submit']) ) -{ - $sql = ""; - - if(!empty($forum_id)) - { - $sql = "UPDATE " . FORUMS_TABLE . " SET "; - - if(isset($HTTP_POST_VARS['simpleauth'])) - { - $simple_ary = $simple_auth_ary[$HTTP_POST_VARS['simpleauth']]; - - for($i = 0; $i < count($simple_ary); $i++) - { - $sql .= $forum_auth_fields[$i] . " = " . $simple_ary[$i]; - if($i < count($simple_ary) - 1) - { - $sql .= ", "; - } - } - - $sql .= " WHERE forum_id = $forum_id"; - } - else - { - for($i = 0; $i < count($forum_auth_fields); $i++) - { - $value = $HTTP_POST_VARS[$forum_auth_fields[$i]]; - - if($forum_auth_fields[$i] == 'auth_vote') - { - if( $HTTP_POST_VARS['auth_vote'] == AUTH_ALL ) - { - $value = AUTH_REG; - } - } - - $sql .= $forum_auth_fields[$i] . " = " . $value; - if($i < count($forum_auth_fields) - 1) - { - $sql .= ", "; - } - } - - $sql .= " WHERE forum_id = $forum_id"; - - } - - if($sql != "") - { - if(!$db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Couldn't update auth table!", "", __LINE__, __FILE__, $sql); - } - } - - $forum_sql = ""; - $adv = 0; - } - - $template->assign_vars(array( - "META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">') - ); - $message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid("admin_forumauth.$phpEx") . '">', "</a>"); - message_die(GENERAL_MESSAGE, $message); - -} // End of submit - -// -// Get required information, either all forums if -// no id was specified or just the requsted if it -// was -// -$sql = "SELECT f.* - FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c - WHERE c.cat_id = f.cat_id - $forum_sql - ORDER BY c.cat_order ASC, f.forum_order ASC"; -if ( !($result = $db->sql_query($sql)) ) -{ - message_die(GENERAL_ERROR, "Couldn't obtain forum list", "", __LINE__, __FILE__, $sql); -} - -$forum_rows = $db->sql_fetchrowset($result); -$db->sql_freeresult($result); - -if( empty($forum_id) ) -{ - // - // Output the selection table if no forum id was - // specified - // - $template->set_filenames(array( - "body" => "admin/auth_select_body.tpl") - ); - - $select_list = '<select name="' . POST_FORUM_URL . '">'; - for($i = 0; $i < count($forum_rows); $i++) - { - $select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>'; - } - $select_list .= '</select>'; - - $template->assign_vars(array( - "L_AUTH_TITLE" => $lang['Auth_Control_Forum'], - "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], - "L_AUTH_SELECT" => $lang['Select_a_Forum'], - "L_LOOK_UP" => $lang['Look_up_Forum'], - - "S_AUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), - "S_AUTH_SELECT" => $select_list) - ); - -} -else -{ - // - // Output the authorisation details if an id was - // specified - // - $template->set_filenames(array( - "body" => "admin/auth_forum_body.tpl") - ); - - $forum_name = $forum_rows[0]['forum_name']; - - @reset($simple_auth_ary); - while( list($key, $auth_levels) = each($simple_auth_ary)) - { - $matched = 1; - for($k = 0; $k < count($auth_levels); $k++) - { - $matched_type = $key; - - if ( $forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k] ) - { - $matched = 0; - } - } - - if ( $matched ) - { - break; - } - } - - // - // If we didn't get a match above then we - // automatically switch into 'advanced' mode - // - if(!isset($adv) && !$matched) - { - $adv = 1; - } - - $s_column_span == 0; - - if( empty($adv) ) - { - $simple_auth = "<select name=\"simpleauth\">"; - - for($j = 0; $j < count($simple_auth_types); $j++) - { - if($matched_type == $j) - { - $simple_auth .= "<option value=\"$j\" selected>"; - $simple_auth .= $simple_auth_types[$j]; - $simple_auth .= "</option>"; - } - else - { - $simple_auth .= "<option value=\"$j\">" . $simple_auth_types[$j] . "</option>"; - } - } - - $simple_auth .= "</select>"; - - $template->assign_block_vars("forum_auth_titles", array( - "CELL_TITLE" => $lang['Simple_mode']) - ); - $template->assign_block_vars("forum_auth_data", array( - "S_AUTH_LEVELS_SELECT" => $simple_auth) - ); - - $s_column_span++; - } - else - { - // - // Output values of individual - // fields - // - for($j = 0; $j < count($forum_auth_fields); $j++) - { - $custom_auth[$j] = " <select name=\"" . $forum_auth_fields[$j] . "\">"; - - for($k = 0; $k < count($forum_auth_levels); $k++) - { - if ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) - { - $custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\" selected>"; - $custom_auth[$j] .= $lang['Forum_' . $forum_auth_levels[$k]]; - $custom_auth[$j] .= "</option>"; - } - else - { - $custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $lang['Forum_' . $forum_auth_levels[$k]] . "</option>"; - } - } - $custom_auth[$j] .= "</select> "; - - $cell_title = $field_names[$forum_auth_fields[$j]]; - - $template->assign_block_vars("forum_auth_titles", array( - "CELL_TITLE" => $cell_title) - ); - $template->assign_block_vars("forum_auth_data", array( - "S_AUTH_LEVELS_SELECT" => $custom_auth[$j]) - ); - - $s_column_span++; - } - } - - $adv_mode = (empty($adv)) ? "1" : "0"; - $switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode); - $switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode']; - $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; - - $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">'; - - $template->assign_vars(array( - "FORUM_NAME" => $forum_name, - - "L_AUTH_TITLE" => $lang['Auth_Control_Forum'], - "L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], - "L_SUBMIT" => $lang['Submit'], - "L_RESET" => $lang['Reset'], - - "U_SWITCH_MODE" => $u_switch_mode, - - "S_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), - "S_COLUMN_SPAN" => $s_column_span, - "S_HIDDEN_FIELDS" => $s_hidden_fields) - ); - -} - -include('page_header_admin.'.$phpEx); - -$template->pparse("body"); - -include('page_footer_admin.'.$phpEx); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_mass_email.php b/phpBB/admin/admin_mass_email.php deleted file mode 100644 index c91335d0a1..0000000000 --- a/phpBB/admin/admin_mass_email.php +++ /dev/null @@ -1,204 +0,0 @@ -<?php -/*************************************************************************** -* admin_mass_email.php -* ------------------- -* begin : Thu May 31, 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. - * - ***************************************************************************/ - -define('IN_PHPBB', 1); - -if( !empty($setmodules) ) -{ - $filename = basename(__FILE__); - $module['General']['Mass_Email'] = $filename; - - return; -} - -// -// Load default header -// -$no_page_header = TRUE; -$phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -// -// Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't -// allowed. -// -@set_time_limit(1200); - -$message = ''; -$subject = ''; - -// -// Do the job ... -// -if( isset($HTTP_POST_VARS['submit']) ) -{ - $group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]); - - if( $group_id != -1 ) - { - $sql = "SELECT u.user_email - FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug - WHERE ug.group_id = $group_id - AND ug.user_pending <> " . TRUE . " - AND u.user_id = ug.user_id"; - } - else - { - $sql = "SELECT user_email - FROM " . USERS_TABLE; - } - if( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql); - } - - - - - - if( !$db->sql_numrows($result) ) - { - // - // Output a relevant GENERAL_MESSAGE about users/group - // not existing - // - } - - $email_list = $db->sql_fetchrowset($g_result); - - - - - - $subject = stripslashes($HTTP_POST_VARS['subject']); - $message = stripslashes($HTTP_POST_VARS['message']); - - // - // Error checking needs to go here ... if no subject and/or - // no message then skip over the send and return to the form - // - $error = FALSE; - - if( !$error ) - { - include($phpbb_root_path . 'includes/emailer.'.$phpEx); - // - // Let's do some checking to make sure that mass mail functions - // are working in win32 versions of php. - // - if( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) - { - // We are running on windows, force delivery to use - // our smtp functions since php's are broken by default - $board_config['smtp_delivery'] = 1; - $board_config['smtp_host'] = get_cfg_var('SMTP'); - } - $emailer = new emailer($board_config['smtp_delivery']); - - $email_headers = 'From: ' . $board_config['board_email'] . "\n"; - - $bcc_list = ''; - for($i = 0; $i < count($email_list); $i++) - { - $bcc_list .= ( ( $bcc_list != '' ) ? ', ' : '' ) . $email_list[$i]['user_email']; - } - $email_headers .= "Bcc: $bcc_list\n"; - - $email_headers .= 'Return-Path: ' . $userdata['board_email'] . "\n"; - $email_headers .= 'X-AntiAbuse: Board servername - ' . $server_name . "\n"; - $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n"; - $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n"; - $email_headers .= 'X-AntiAbuse: User IP - ' . $user_ip . "\r\n"; - - $emailer->use_template('admin_send_email'); - $emailer->email_address($board_config['board_email']); - $emailer->set_subject($subject); - $emailer->extra_headers($email_headers); - - $emailer->assign_vars(array( - 'SITENAME' => $board_config['sitename'], - 'BOARD_EMAIL' => $board_config['board_email'], - 'MESSAGE' => $message) - ); - $emailer->send(); - $emailer->reset(); - - $message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } -} - -// -// Initial selection -// - -$sql = "SELECT group_id, group_name - FROM ".GROUPS_TABLE . " - WHERE group_single_user <> 1"; -if ( !($result = $db->sql_query($sql)) ) -{ - message_die(GENERAL_ERROR, 'Could not obtain list of groups', '', __LINE__, __FILE__, $sql); -} - -$select_list = '<select name = "' . POST_GROUPS_URL . '"><option value = "-1">' . $lang['All_users'] . '</option>'; -if ( $row = $db->sql_fetchrow($result) ) -{ - do - { - $select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; - } - while ( $row = $db->sql_fetchrow($result) ); -} -$select_list .= '</select>'; - -// -// Generate page -// -include('page_header_admin.'.$phpEx); - -$template->set_filenames(array( - 'body' => 'admin/user_email_body.tpl') -); - -$template->assign_vars(array( - 'MESSAGE' => $message, - 'SUBJECT' => $subject, - - 'L_EMAIL_TITLE' => $lang['Email'], - 'L_EMAIL_EXPLAIN' => $lang['Mass_email_explain'], - 'L_COMPOSE' => $lang['Compose'], - 'L_RECIPIENTS' => $lang['Recipients'], - 'L_EMAIL_SUBJECT' => $lang['Subject'], - 'L_EMAIL_MSG' => $lang['Message'], - 'L_EMAIL' => $lang['Email'], - 'L_NOTICE' => $notice, - - 'S_USER_ACTION' => append_sid('admin_mass_email.'.$phpEx), - 'S_GROUP_SELECT' => $select_list) -); - -$template->pparse('body'); - -include('page_footer_admin.'.$phpEx); - -?>
\ No newline at end of file diff --git a/phpBB/admin/admin_ug_auth.php b/phpBB/admin/admin_ug_auth.php deleted file mode 100644 index 6b81bc4e2d..0000000000 --- a/phpBB/admin/admin_ug_auth.php +++ /dev/null @@ -1,941 +0,0 @@ -<?php -/*************************************************************************** - * admin_ug_auth.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. - * - ***************************************************************************/ - -define('IN_PHPBB', 1); - -if( !empty($setmodules) ) -{ - $filename = basename(__FILE__); - $module['Users']['Permissions'] = $filename . "?mode=user"; - $module['Groups']['Permissions'] = $filename . "?mode=group"; - - return; -} - -// -// Load default header -// -$no_page_header = TRUE; - -$phpbb_root_path = "../"; -require($phpbb_root_path . 'extension.inc'); -require('pagestart.' . $phpEx); - -$params = array('mode' => 'mode', 'user_id' => POST_USERS_URL, 'group_id' => POST_GROUPS_URL, 'adv' => 'adv'); - -while( list($var, $param) = @each($params) ) -{ - if ( !empty($HTTP_POST_VARS[$param]) || !empty($HTTP_GET_VARS[$param]) ) - { - $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? $HTTP_POST_VARS[$param] : $HTTP_GET_VARS[$param]; - } - else - { - $$var = ""; - } -} - -// -// Start program - define vars -// -$forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate'); - -$auth_field_match = array( - 'auth_view' => AUTH_VIEW, - 'auth_read' => AUTH_READ, - 'auth_post' => AUTH_POST, - 'auth_reply' => AUTH_REPLY, - 'auth_edit' => AUTH_EDIT, - 'auth_delete' => AUTH_DELETE, - 'auth_sticky' => AUTH_STICKY, - 'auth_announce' => AUTH_ANNOUNCE, - 'auth_vote' => AUTH_VOTE, - 'auth_pollcreate' => AUTH_POLLCREATE); - -$field_names = array( - 'auth_view' => $lang['View'], - 'auth_read' => $lang['Read'], - 'auth_post' => $lang['Post'], - 'auth_reply' => $lang['Reply'], - 'auth_edit' => $lang['Edit'], - 'auth_delete' => $lang['Delete'], - 'auth_sticky' => $lang['Sticky'], - 'auth_announce' => $lang['Announce'], - 'auth_vote' => $lang['Vote'], - 'auth_pollcreate' => $lang['Pollcreate']); - -// --------------- -// Start Functions -// -function check_auth($type, $key, $u_access, $is_admin) -{ - $auth_user = 0; - - if( count($u_access) ) - { - for($j = 0; $j < count($u_access); $j++) - { - $result = 0; - switch($type) - { - case AUTH_ACL: - $result = $u_access[$j][$key]; - - case AUTH_MOD: - $result = $result || $u_access[$j]['auth_mod']; - - case AUTH_ADMIN: - $result = $result || $is_admin; - break; - } - - $auth_user = $auth_user || $result; - } - } - else - { - $auth_user = $is_admin; - } - - return $auth_user; -} -// -// End Functions -// ------------- - -if ( isset($HTTP_POST_VARS['submit']) && ( ( $mode == 'user' && $user_id ) || ( $mode == 'group' && $group_id ) ) ) -{ - $user_level = ''; - if ( $mode == 'user' ) - { - // - // Get group_id for this user_id - // - $sql = "SELECT g.group_id, u.user_level - FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u, " . GROUPS_TABLE . " g - WHERE u.user_id = $user_id - AND ug.user_id = u.user_id - AND g.group_id = ug.group_id - AND g.group_single_user = " . TRUE; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not select info from user/user_group table', '', __LINE__, __FILE__, $sql); - } - - $row = $db->sql_fetchrow($result); - - $group_id = $row['group_id']; - $user_level = $row['user_level']; - - $db->sql_freeresult($result); - } - - // - // Carry out requests - // - if ( $mode == 'user' && $HTTP_POST_VARS['userlevel'] == 'admin' && $user_level != ADMIN ) - { - // - // Make user an admin (if already user) - // - if ( $userdata['user_id'] != $user_id ) - { - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . ADMIN . " - WHERE user_id = $user_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); - } - - $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . " - WHERE group_id = $group_id - AND auth_mod = 0"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't delete auth access info", "", __LINE__, __FILE__, $sql); - } - - // - // Delete any entries in auth_access, they are not required if user is becoming an - // admin - // - $sql = "UPDATE " . AUTH_ACCESS_TABLE . " - SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 - WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't update auth access", "", __LINE__, __FILE__, $sql); - } - } - - $message = $lang['Auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_userauth'], '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); - message_die(GENERAL_MESSAGE, $message); - } - else - { - if ( $mode == 'user' && $HTTP_POST_VARS['userlevel'] == 'user' && $user_level == ADMIN ) - { - // - // Make admin a user (if already admin) ... ignore if you're trying - // to change yourself from an admin to user! - // - if ( $userdata['user_id'] != $user_id ) - { - $sql = "UPDATE " . AUTH_ACCESS_TABLE . " - SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 - WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not update auth access', '', __LINE__, __FILE__, $sql); - } - - // - // Update users level, reset to USER - // - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . USER . " - WHERE user_id = $user_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); - } - } - - $message = $lang['Auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_userauth'], '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); - } - else - { - - $change_mod_list = ( isset($HTTP_POST_VARS['moderator']) ) ? $HTTP_POST_VARS['moderator'] : false; - - if ( empty($adv) ) - { - $change_acl_list = ( isset($HTTP_POST_VARS['private']) ) ? $HTTP_POST_VARS['private'] : false; - } - else - { - $change_acl_list = array(); - for($j = 0; $j < count($forum_auth_fields); $j++) - { - $auth_field = $forum_auth_fields[$j]; - - while( list($forum_id, $value) = @each($HTTP_POST_VARS['private_' . $auth_field]) ) - { - $change_acl_list[$forum_id][$auth_field] = $value; - } - } - } - - $sql = "SELECT * - FROM " . FORUMS_TABLE . " f - ORDER BY forum_order"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql); - } - - $forum_access = array(); - while( $row = $db->sql_fetchrow($result) ) - { - $forum_access[] = $row; - } - $db->sql_freeresult($result); - - $sql = ( $mode == 'user' ) ? "SELECT aa.* FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g WHERE ug.user_id = $user_id AND g.group_id = ug.group_id AND aa.group_id = ug.group_id AND g.group_single_user = " . TRUE : "SELECT * FROM " . AUTH_ACCESS_TABLE . " WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql); - } - - $auth_access = array(); - while( $row = $db->sql_fetchrow($result) ) - { - $auth_access[$row['forum_id']] = $row; - } - $db->sql_freeresult($result); - - $forum_auth_action = array(); - $update_acl_status = array(); - $update_mod_status = array(); - - for($i = 0; $i < count($forum_access); $i++) - { - $forum_id = $forum_access[$i]['forum_id']; - - if ( - ( isset($auth_access[$forum_id]['auth_mod']) && $change_mod_list[$forum_id]['auth_mod'] != $auth_access[$forum_id]['auth_mod'] ) || - ( !isset($auth_access[$forum_id]['auth_mod']) && !empty($change_mod_list[$forum_id]['auth_mod']) ) - ) - { - $update_mod_status[$forum_id] = $change_mod_list[$forum_id]['auth_mod']; - - if ( !$update_mod_status[$forum_id] ) - { - $forum_auth_action[$forum_id] = 'delete'; - } - else if ( !isset($auth_access[$forum_id]['auth_mod']) ) - { - $forum_auth_action[$forum_id] = 'insert'; - } - else - { - $forum_auth_action[$forum_id] = 'update'; - } - } - - for($j = 0; $j < count($forum_auth_fields); $j++) - { - $auth_field = $forum_auth_fields[$j]; - - if( $forum_access[$i][$auth_field] == AUTH_ACL && isset($change_acl_list[$forum_id][$auth_field]) ) - { - if ( ( empty($auth_access[$forum_id]['auth_mod']) && - ( isset($auth_access[$forum_id][$auth_field]) && $change_acl_list[$forum_id][$auth_field] != $auth_access[$forum_id][$auth_field] ) || - ( !isset($auth_access[$forum_id][$auth_field]) && !empty($change_acl_list[$forum_id][$auth_field]) ) ) || - !empty($update_mod_status[$forum_id]) - ) - { - $update_acl_status[$forum_id][$auth_field] = ( !empty($update_mod_status[$forum_id]) ) ? 0 : $change_acl_list[$forum_id][$auth_field]; - - if ( isset($auth_access[$forum_id][$auth_field]) && empty($update_acl_status[$forum_id][$auth_field]) && $forum_auth_action[$forum_id] != 'insert' && $forum_auth_action[$forum_id] != 'update' ) - { - $forum_auth_action[$forum_id] = 'delete'; - } - else if ( !isset($auth_access[$forum_id][$auth_field]) && !( $forum_auth_action[$forum_id] == 'delete' && empty($update_acl_status[$forum_id][$auth_field]) ) ) - { - $forum_auth_action[$forum_id] = 'insert'; - } - else if ( isset($auth_access[$forum_id][$auth_field]) && !empty($update_acl_status[$forum_id][$auth_field]) ) - { - $forum_auth_action[$forum_id] = 'update'; - } - } - else if ( ( empty($auth_access[$forum_id]['auth_mod']) && - ( isset($auth_access[$forum_id][$auth_field]) && $change_acl_list[$forum_id][$auth_field] == $auth_access[$forum_id][$auth_field] ) ) && $forum_auth_action[$forum_id] == 'delete' ) - { - $forum_auth_action[$forum_id] = 'update'; - } - } - } - } - - // - // Checks complete, make updates to DB - // - $delete_sql = ''; - while( list($forum_id, $action) = @each($forum_auth_action) ) - { - if ( $action == 'delete' ) - { - $delete_sql .= ( ( $delete_sql != '' ) ? ', ' : '' ) . $forum_id; - } - else - { - if ( $action == 'insert' ) - { - $sql_field = ''; - $sql_value = ''; - while ( list($auth_type, $value) = @each($update_acl_status[$forum_id]) ) - { - $sql_field .= ( ( $sql_field != '' ) ? ', ' : '' ) . $auth_type; - $sql_value .= ( ( $sql_value != '' ) ? ', ' : '' ) . $value; - } - $sql_field .= ( ( $sql_field != '' ) ? ', ' : '' ) . 'auth_mod'; - $sql_value .= ( ( $sql_value != '' ) ? ', ' : '' ) . ( ( !isset($update_mod_status[$forum_id]) ) ? 0 : $update_mod_status[$forum_id]); - - $sql = "INSERT INTO " . AUTH_ACCESS_TABLE . " (forum_id, group_id, $sql_field) - VALUES ($forum_id, $group_id, $sql_value)"; - } - else - { - $sql_values = ''; - while ( list($auth_type, $value) = @each($update_acl_status[$forum_id]) ) - { - $sql_values .= ( ( $sql_values != '' ) ? ', ' : '' ) . $auth_type . ' = ' . $value; - } - $sql_values .= ( ( $sql_values != '' ) ? ', ' : '' ) . 'auth_mod = ' . ( ( !isset($update_mod_status[$forum_id]) ) ? 0 : $update_mod_status[$forum_id]); - - $sql = "UPDATE " . AUTH_ACCESS_TABLE . " - SET $sql_values - WHERE group_id = $group_id - AND forum_id = $forum_id"; - } - if( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't update private forum permissions", "", __LINE__, __FILE__, $sql); - } - } - } - - if ( $delete_sql != '' ) - { - $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . " - WHERE group_id = $group_id - AND forum_id IN ($delete_sql)"; - if( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't delete permission entries", "", __LINE__, __FILE__, $sql); - } - } - - $l_auth_return = ( $mode == 'user' ) ? $lang['Click_return_userauth'] : $lang['Click_return_groupauth']; - $message = $lang['Auth_updated'] . '<br /><br />' . sprintf($l_auth_return, '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); - } - - // - // Update user level to mod for appropriate users - // - $sql = "SELECT u.user_id - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u - WHERE ug.group_id = aa.group_id - AND u.user_id = ug.user_id - AND u.user_level NOT IN (" . MOD . ", " . ADMIN . ") - GROUP BY u.user_id - HAVING SUM(aa.auth_mod) > 0"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql); - } - - $set_mod = ''; - while( $row = $db->sql_fetchrow($result) ) - { - $set_mod .= ( ( $set_mod != '' ) ? ', ' : '' ) . $row['user_id']; - } - $db->sql_freeresult($result); - - // - // Update user level to user for appropriate users - // - switch ( SQL_LAYER ) - { - case 'postgresql': - $sql = "SELECT u.user_id - FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa - WHERE ug.user_id = u.user_id - AND aa.group_id = ug.group_id - AND u.user_level NOT IN (" . USER . ", " . ADMIN . ") - GROUP BY u.user_id - HAVING SUM(aa.auth_mod) = 0 - UNION ( - SELECT u.user_id - FROM " . USERS_TABLE . " u - WHERE NOT EXISTS ( - SELECT aa.auth_mod - FROM " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa - WHERE ug.user_id = u.user_id - AND aa.group_id = ug.group_id - ) - AND u.user_level NOT IN (" . USER . ", " . ADMIN . ") - GROUP BY u.user_id - )"; - break; - case 'oracle': - $sql = "SELECT u.user_id - FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa - WHERE ug.user_id = u.user_id(+) - AND aa.group_id = ug.group_id(+) - AND u.user_level NOT IN (" . USER . ", " . ADMIN . ") - GROUP BY u.user_id - HAVING SUM(aa.auth_mod) = 0"; - break; - default: - $sql = "SELECT u.user_id - FROM ( ( " . USERS_TABLE . " u - LEFT JOIN " . USER_GROUP_TABLE . " ug ON ug.user_id = u.user_id ) - LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = ug.group_id ) - WHERE u.user_level NOT IN (" . USER . ", " . ADMIN . ") - GROUP BY u.user_id - HAVING SUM(aa.auth_mod) = 0"; - break; - } - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql); - } - - $unset_mod = ""; - while( $row = $db->sql_fetchrow($result) ) - { - $unset_mod .= ( ( $unset_mod != '' ) ? ', ' : '' ) . $row['user_id']; - } - $db->sql_freeresult($result); - - if ( $set_mod != '' ) - { - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . MOD . " - WHERE user_id IN ($set_mod)"; - if( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't update user level", "", __LINE__, __FILE__, $sql); - } - } - - if ( $unset_mod != '' ) - { - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . USER . " - WHERE user_id IN ($unset_mod)"; - if( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't update user level", "", __LINE__, __FILE__, $sql); - } - } - - message_die(GENERAL_MESSAGE, $message); - } -} -else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id ) ) || ( $mode == 'group' && $group_id ) ) -{ - if ( isset($HTTP_POST_VARS['username']) ) - { - $this_userdata = get_userdata($HTTP_POST_VARS['username']); - if ( !is_array($this_userdata) ) - { - message_die(GENERAL_MESSAGE, $lang['No_such_user']); - } - $user_id = $this_userdata['user_id']; - } - - // - // Front end - // - $sql = "SELECT * - FROM " . FORUMS_TABLE . " f - ORDER BY forum_order"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql); - } - - $forum_access = array(); - while( $row = $db->sql_fetchrow($result) ) - { - $forum_access[] = $row; - } - $db->sql_freeresult($result); - - if( empty($adv) ) - { - for($i = 0; $i < count($forum_access); $i++) - { - $forum_id = $forum_access[$i]['forum_id']; - - $forum_auth_level[$forum_id] = AUTH_ALL; - - for($j = 0; $j < count($forum_auth_fields); $j++) - { - $forum_access[$i][$forum_auth_fields[$j]] . ' :: '; - if ( $forum_access[$i][$forum_auth_fields[$j]] == AUTH_ACL ) - { - $forum_auth_level[$forum_id] = AUTH_ACL; - $forum_auth_level_fields[$forum_id][] = $forum_auth_fields[$j]; - } - } - } - } - - $sql = "SELECT u.user_id, u.username, u.user_level, g.group_id, g.group_name, g.group_single_user FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug WHERE "; - $sql .= ( $mode == 'user' ) ? "u.user_id = $user_id AND ug.user_id = u.user_id AND g.group_id = ug.group_id" : "g.group_id = $group_id AND ug.group_id = g.group_id AND u.user_id = ug.user_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't obtain user/group information", "", __LINE__, __FILE__, $sql); - } - $ug_info = array(); - while( $row = $db->sql_fetchrow($result) ) - { - $ug_info[] = $row; - } - $db->sql_freeresult($result); - - $sql = ( $mode == 'user' ) ? "SELECT aa.*, g.group_single_user FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g WHERE ug.user_id = $user_id AND g.group_id = ug.group_id AND aa.group_id = ug.group_id AND g.group_single_user = 1" : "SELECT * FROM " . AUTH_ACCESS_TABLE . " WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't obtain user/group permissions", "", __LINE__, __FILE__, $sql); - } - - $auth_access = array(); - $auth_access_count = array(); - while( $row = $db->sql_fetchrow($result) ) - { - $auth_access[$row['forum_id']][] = $row; - $auth_access_count[$row['forum_id']]++; - } - $db->sql_freeresult($result); - - $is_admin = ( $mode == 'user' ) ? ( ( $ug_info[0]['user_level'] == ADMIN && $ug_info[0]['user_id'] != ANONYMOUS ) ? 1 : 0 ) : 0; - - for($i = 0; $i < count($forum_access); $i++) - { - $forum_id = $forum_access[$i]['forum_id']; - - unset($prev_acl_setting); - for($j = 0; $j < count($forum_auth_fields); $j++) - { - $key = $forum_auth_fields[$j]; - $value = $forum_access[$i][$key]; - - switch( $value ) - { - case AUTH_ALL: - case AUTH_REG: - $auth_ug[$forum_id][$key] = 1; - break; - - case AUTH_ACL: - $auth_ug[$forum_id][$key] = ( !empty($auth_access_count[$forum_id]) ) ? check_auth(AUTH_ACL, $key, $auth_access[$forum_id], $is_admin) : 0; - $auth_field_acl[$forum_id][$key] = $auth_ug[$forum_id][$key]; - - if ( isset($prev_acl_setting) ) - { - if ( $prev_acl_setting != $auth_ug[$forum_id][$key] && empty($adv) ) - { - $adv = 1; - } - } - - $prev_acl_setting = $auth_ug[$forum_id][$key]; - - break; - - case AUTH_MOD: - $auth_ug[$forum_id][$key] = ( !empty($auth_access_count[$forum_id]) ) ? check_auth(AUTH_MOD, $key, $auth_access[$forum_id], $is_admin) : 0; - break; - - case AUTH_ADMIN: - $auth_ug[$forum_id][$key] = $is_admin; - break; - - default: - $auth_ug[$forum_id][$key] = 0; - break; - } - } - - // - // Is user a moderator? - // - $auth_ug[$forum_id]['auth_mod'] = ( !empty($auth_access_count[$forum_id]) ) ? check_auth(AUTH_MOD, 'auth_mod', $auth_access[$forum_id], 0) : 0; - } - - $i = 0; - @reset($auth_ug); - while( list($forum_id, $user_ary) = @each($auth_ug) ) - { - if ( empty($adv) ) - { - if ( $forum_auth_level[$forum_id] == AUTH_ACL ) - { - $allowed = 1; - - for($j = 0; $j < count($forum_auth_level_fields[$forum_id]); $j++) - { - if ( !$auth_ug[$forum_id][$forum_auth_level_fields[$forum_id][$j]] ) - { - $allowed = 0; - } - } - - $optionlist_acl = '<select name="private[' . $forum_id . ']">'; - - if ( $is_admin || $user_ary['auth_mod'] ) - { - $optionlist_acl .= '<option value="1">' . $lang['Allowed_Access'] . '</option>'; - } - else if ( $allowed ) - { - $optionlist_acl .= '<option value="1" selected="selected">' . $lang['Allowed_Access'] . '</option><option value="0">'. $lang['Disallowed_Access'] . '</option>'; - } - else - { - $optionlist_acl .= '<option value="1">' . $lang['Allowed_Access'] . '</option><option value="0" selected="selected">' . $lang['Disallowed_Access'] . '</option>'; - } - - $optionlist_acl .= '</select>'; - } - else - { - $optionlist_acl = ' '; - } - } - else - { - for($j = 0; $j < count($forum_access); $j++) - { - if ( $forum_access[$j]['forum_id'] == $forum_id ) - { - for($k = 0; $k < count($forum_auth_fields); $k++) - { - $field_name = $forum_auth_fields[$k]; - - if( $forum_access[$j][$field_name] == AUTH_ACL ) - { - $optionlist_acl_adv[$forum_id][$k] = '<select name="private_' . $field_name . '[' . $forum_id . ']">'; - - if( isset($auth_field_acl[$forum_id][$field_name]) && !($is_admin || $user_ary['auth_mod']) ) - { - if( !$auth_field_acl[$forum_id][$field_name] ) - { - $optionlist_acl_adv[$forum_id][$k] .= '<option value="1">' . $lang['ON'] . '</option><option value="0" selected="selected">' . $lang['OFF'] . '</option>'; - } - else - { - $optionlist_acl_adv[$forum_id][$k] .= '<option value="1" selected="selected">' . $lang['ON'] . '</option><option value="0">' . $lang['OFF'] . '</option>'; - } - } - else - { - if( $is_admin || $user_ary['auth_mod'] ) - { - $optionlist_acl_adv[$forum_id][$k] .= '<option value="1">' . $lang['ON'] . '</option>'; - } - else - { - $optionlist_acl_adv[$forum_id][$k] .= '<option value="1">' . $lang['ON'] . '</option><option value="0" selected="selected">' . $lang['OFF'] . '</option>'; - } - } - - $optionlist_acl_adv[$forum_id][$k] .= '</select>'; - - } - } - } - } - } - - $optionlist_mod = '<select name="moderator[' . $forum_id . ']">'; - $optionlist_mod .= ( $user_ary['auth_mod'] ) ? '<option value="1" selected="selected">' . $lang['Is_Moderator'] . '</option><option value="0">' . $lang['Not_Moderator'] . '</option>' : '<option value="1">' . $lang['Is_Moderator'] . '</option><option value="0" selected="selected">' . $lang['Not_Moderator'] . '</option>'; - $optionlist_mod .= '</select>'; - - $row_class = ( !( $i % 2 ) ) ? 'row2' : 'row1'; - $row_color = ( !( $i % 2 ) ) ? $theme['td_color1'] : $theme['td_color2']; - - $template->assign_block_vars('forums', array( - 'ROW_COLOR' => '#' . $row_color, - 'ROW_CLASS' => $row_class, - 'FORUM_NAME' => $forum_access[$i]['forum_name'], - - 'U_FORUM_AUTH' => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']), - - 'S_MOD_SELECT' => $optionlist_mod) - ); - - if( !$adv ) - { - $template->assign_block_vars('forums.aclvalues', array( - 'S_ACL_SELECT' => $optionlist_acl) - ); - } - else - { - for($j = 0; $j < count($forum_auth_fields); $j++) - { - $template->assign_block_vars('forums.aclvalues', array( - 'S_ACL_SELECT' => $optionlist_acl_adv[$forum_id][$j]) - ); - } - } - - $i++; - } - @reset($auth_user); - - if ( $mode == 'user' ) - { - $t_username = $ug_info[0]['username']; - $s_user_type = ( $is_admin ) ? '<select name="userlevel"><option value="admin" selected="selected">' . $lang['Auth_Admin'] . '</option><option value="user">' . $lang['Auth_User'] . '</option></select>' : '<select name="userlevel"><option value="admin">' . $lang['Auth_Admin'] . '</option><option value="user" selected="selected">' . $lang['Auth_User'] . '</option></select>'; - } - else - { - $t_groupname = $ug_info[0]['group_name']; - } - - $name = array(); - $id = array(); - for($i = 0; $i < count($ug_info); $i++) - { - if( ( $mode == 'user' && !$ug_info[$i]['group_single_user'] ) || $mode == 'group' ) - { - $name[] = ( $mode == 'user' ) ? $ug_info[$i]['group_name'] : $ug_info[$i]['username']; - $id[] = ( $mode == 'user' ) ? intval($ug_info[$i]['group_id']) : intval($ug_info[$i]['user_id']); - } - } - - if( count($name) ) - { - $t_usergroup_list = ''; - for($i = 0; $i < count($ug_info); $i++) - { - $t_usergroup_list .= ( ( $t_usergroup_list != '' ) ? ', ' : '' ) . '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode&" . POST_GROUPS_URL . "=" . $id[$i]) . '">' . $name[$i] . '</a>'; - } - } - else - { - $t_usergroup_list = $lang['None']; - } - - $s_column_span = 2; // Two columns always present - if( !$adv ) - { - $template->assign_block_vars('acltype', array( - 'L_UG_ACL_TYPE' => $lang['Simple_Permission']) - ); - $s_column_span++; - } - else - { - for($i = 0; $i < count($forum_auth_fields); $i++) - { - $cell_title = $field_names[$forum_auth_fields[$i]]; - - $template->assign_block_vars('acltype', array( - 'L_UG_ACL_TYPE' => $cell_title) - ); - $s_column_span++; - } - } - - // - // Dump in the page header ... - // - include('page_header_admin.'.$phpEx); - - $template->set_filenames(array( - "body" => 'admin/auth_ug_body.tpl') - ); - - $adv_switch = ( empty($adv) ) ? 1 : 0; - $u_ug_switch = ( $mode == 'user' ) ? POST_USERS_URL . "=" . $user_id : POST_GROUPS_URL . "=" . $group_id; - $switch_mode = append_sid("admin_ug_auth.$phpEx?mode=$mode&" . $u_ug_switch . "&adv=$adv_switch"); - $switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode']; - $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; - - $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="adv" value="' . $adv . '" />'; - $s_hidden_fields .= ( $mode == 'user' ) ? '<input type="hidden" name="' . POST_USERS_URL . '" value="' . $user_id . '" />' : '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; - - if ( $mode == 'user' ) - { - $template->assign_block_vars('switch_user_auth', array()); - - $template->assign_vars(array( - 'USERNAME' => $t_username, - 'USER_LEVEL' => $lang['User_Level'] . " : " . $s_user_type, - 'USER_GROUP_MEMBERSHIPS' => $lang['Group_memberships'] . ' : ' . $t_usergroup_list) - ); - } - else - { - $template->assign_block_vars("switch_group_auth", array()); - - $template->assign_vars(array( - 'USERNAME' => $t_groupname, - 'GROUP_MEMBERSHIP' => $lang['Usergroup_members'] . ' : ' . $t_usergroup_list) - ); - } - - $template->assign_vars(array( - 'L_USER_OR_GROUPNAME' => ( $mode == 'user' ) ? $lang['Username'] : $lang['Group_name'], - 'L_USER_OR_GROUP' => ( $mode == 'user' ) ? $lang['User'] : $lang['Group'], - - 'L_AUTH_TITLE' => ( $mode == 'user' ) ? $lang['Auth_Control_User'] : $lang['Auth_Control_Group'], - 'L_AUTH_EXPLAIN' => ( $mode == 'user' ) ? $lang['User_auth_explain'] : $lang['Group_auth_explain'], - 'L_MODERATOR_STATUS' => $lang['Moderator_status'], - 'L_PERMISSIONS' => $lang['Permissions'], - 'L_SUBMIT' => $lang['Submit'], - 'L_RESET' => $lang['Reset'], - - 'U_USER_OR_GROUP' => append_sid("admin_ug_auth.$phpEx"), - 'U_SWITCH_MODE' => $u_switch_mode, - - 'S_COLUMN_SPAN' => $s_column_span, - 'S_AUTH_ACTION' => append_sid("admin_ug_auth.$phpEx"), - 'S_HIDDEN_FIELDS' => $s_hidden_fields) - ); -} -else -{ - // - // Select a user/group - // - include('page_header_admin.'.$phpEx); - - $template->set_filenames(array( - 'body' => ( $mode == 'user' ) ? 'admin/user_select_body.tpl' : 'admin/auth_select_body.tpl') - ); - - if ( $mode == 'user' ) - { - $template->assign_vars(array( - 'L_FIND_USERNAME' => $lang['Find_username'], - - 'U_SEARCH_USER' => append_sid("../search.$phpEx?mode=searchuser")) - ); - } - else - { - $sql = "SELECT group_id, group_name - FROM " . GROUPS_TABLE . " - WHERE group_single_user <> " . TRUE; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Couldn't get group list", "", __LINE__, __FILE__, $sql); - } - - if ( $row = $db->sql_fetchrow($result) ) - { - $select_list = '<select name="' . POST_GROUPS_URL . '">'; - do - { - $select_list .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; - } - while ( $row = $db->sql_fetchrow($result) ); - $select_list .= '</select>'; - } - - $template->assign_vars(array( - 'S_AUTH_SELECT' => $select_list) - ); - } - - $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />'; - - $l_type = ( $mode == 'user' ) ? "USER" : "AUTH"; - - $template->assign_vars(array( - 'L_' . $l_type . '_TITLE' => ( $mode == 'user' ) ? $lang['Auth_Control_User'] : $lang['Auth_Control_Group'], - 'L_' . $l_type . '_EXPLAIN' => ( $mode == 'user' ) ? $lang['User_auth_explain'] : $lang['Group_auth_explain'], - 'L_' . $l_type . '_SELECT' => ( $mode == 'user' ) ? $lang['Select_a_User'] : $lang['Select_a_Group'], - 'L_LOOK_UP' => ( $mode == 'user' ) ? $lang['Look_up_User'] : $lang['Look_up_Group'], - - 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_' . $l_type . '_ACTION' => append_sid("admin_ug_auth.$phpEx")) - ); - -} - -$template->pparse('body'); - -include('page_footer_admin.'.$phpEx); - -?> |