From 28a09fcc5065b9aff4a5db740f80e903d8f0a44d Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sat, 14 Jul 2001 20:00:27 +0000 Subject: New page headers, cleaned up code, etc. git-svn-id: file:///svn/phpbb/trunk@663 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_forumauth.php | 437 +++++++++++++++++----------------------- 1 file changed, 181 insertions(+), 256 deletions(-) (limited to 'phpBB/admin/admin_forumauth.php') diff --git a/phpBB/admin/admin_forumauth.php b/phpBB/admin/admin_forumauth.php index b845f5143a..6562a3ca4e 100644 --- a/phpBB/admin/admin_forumauth.php +++ b/phpBB/admin/admin_forumauth.php @@ -1,9 +1,32 @@ array(0, 0, 0, 0, 1, 0, 3, 3, 0, 0, 0), - 1 => array(0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3), - 2 => array(0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 1), - 3 => array(1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1), - 4 => array(0, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), - 5 => array(2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), - 6 => array(0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), - 7 => array(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), - 8 => array(0, 0, 3, 0, 0, 0, 3, 3, 3, 3, 3), - 9 => array(0, 0, 3, 1, 0, 0, 3, 3, 3, 3, 3) -);*/ - +// +// Check user permissions +// +if( !$userdata['session_logged_in'] ) +{ + header("Location: ../login.$phpEx?forward_page=/admin"); +} +else if( $userdata['user_level'] != ADMIN ) +{ + message_die(GENERAL_MESSAGE, "You are not authorised to administer this board"); +} +// +// Start program - define vars +// $simple_auth_ary = array( 0 => array(0, 0, 0, 0, 1, 0, 3, 3), 1 => array(0, 0, 0, 0, 3, 3, 3, 3), @@ -49,16 +73,30 @@ $simple_auth_ary = array( $simple_auth_types = array("Public", "Test Restricted", "Registered", "Registered [Hidden]", "Private", "Private [Hidden]", "Moderators", "Moderators [Hidden]", "Moderator Post + All Reply", "Moderator Post + Reg Reply"); - $forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce"); -//, "auth_votecreate", "auth_vote", "auth_attachments" $forum_auth_levels = array("ALL", "REG", "ACL", "MOD", "ADMIN"); $forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); +// Future Stuff +/*$simple_auth_ary = array( + 0 => array(0, 0, 0, 0, 1, 0, 3, 3, 0, 0, 0), + 1 => array(0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3), + 2 => array(0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 1), + 3 => array(1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1), + 4 => array(0, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), + 5 => array(2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), + 6 => array(0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), + 7 => array(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), + 8 => array(0, 0, 3, 0, 0, 0, 3, 3, 3, 3, 3), + 9 => array(0, 0, 3, 1, 0, 0, 3, 3, 3, 3, 3) +);*/ +//, "auth_votecreate", "auth_vote", "auth_attachments" + 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]; + $forum_sql = "AND forum_id = $forum_id"; } else @@ -78,6 +116,8 @@ else if(isset($HTTP_POST_VARS['submit'])) { + $sql = ""; + if(!empty($forum_id)) { $sql = "UPDATE " . FORUMS_TABLE . " SET "; @@ -85,6 +125,7 @@ if(isset($HTTP_POST_VARS['submit'])) 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]; @@ -98,11 +139,10 @@ if(isset($HTTP_POST_VARS['submit'])) } else { - $sql = "UPDATE " . FORUMS_TABLE . " SET "; - for($i = 0; $i < count($forum_auth_fields); $i++) { $value = $HTTP_POST_VARS[$forum_auth_fields[$i]]; + if($forum_auth_fields[$i] != 'auth_view') { if($HTTP_POST_VARS['auth_view'] > $value) @@ -121,11 +161,11 @@ if(isset($HTTP_POST_VARS['submit'])) } - if(strlen($sql)) + if($sql != "") { if(!$db->sql_query($sql)) { - error_die(QUERY_ERROR, "Couldn't update auth table!", __LINE__, __FILE__); + message_die(GENERAL_ERROR, "Couldn't update auth table!", "", __LINE__, __FILE__, $sql); } } @@ -136,9 +176,10 @@ if(isset($HTTP_POST_VARS['submit'])) } } - // -// Start output +// 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 @@ -146,280 +187,164 @@ $sql = "SELECT f.* $forum_sql ORDER BY c.cat_order ASC, f.forum_order ASC"; $f_result = $db->sql_query($sql); + $forum_rows = $db->sql_fetchrowset($f_result); // -// Show data +// Page header // -?> - - - -phpBB - auth testing - - - - -

Forum Authorisation Control

- -set_filenames(array( + "body" => "admin/forum_auth_select_body.tpl") + ); + + $select_list = ""; -?> + $template->assign_vars(array( + "S_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), + "S_FORUMS_SELECT" => $select_list) + ); -
-set_filenames(array( + "body" => "admin/forum_auth_body.tpl") + ); + + $forum_name = $forum_rows[0]['forum_name']; + + reset($simple_auth_ary); + while(list($key, $auth_levels) = each($simple_auth_ary)) { - $forum_name[$i] = "" . $forum_rows[$i]['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 = 1; - for($k = 0; $k < count($auth_levels); $k++) - { - $matched_type = $key; - if($forum_rows[$i][$forum_auth_fields[$k]] != $auth_levels[$k]) - { - $matched = 0; - } - } - if($matched) - break; - } + $matched_type = $key; - // - // If we've got a custom setup - // then we jump into advanced - // mode by default - // - if($adv == -1 && !$matched) - { - $adv = 1; - } - - if($adv <= 0 || empty($forum_id)) - { - - // - // Determine whether the current - // forum auth fields match a preset 'simple' - // type - // - - $simple_auth[$i] = (isset($forum_id)) ? "  " : ""; - - } - - if($adv == 1 || empty($forum_id)) - { - - // - // Output values of individual - // fields - // - - for($j = 0; $j < count($forum_auth_fields); $j++) + if($forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k]) { - $custom_auth[$i][$j] = (isset($forum_id)) ? "  " : ""; + $matched = 0; } - } + if($matched) + break; } -?> - - - - - -".preg_replace("/auth_/", "", $forum_auth_fields[$j])."\n"; - } + $adv = 1; } -?> - -"; - unset($moderators_links); - for($mods = 0; $mods < count($forum_mods['forum_' . $forum_rows[$i]['forum_id'] . '_id']); $mods++) + for($j = 0; $j < count($simple_auth_types); $j++) { - if(isset($moderators_links)) + if($matched_type == $j) { - $moderators_links .= ", "; + $simple_auth .= ""; } - if(!($mods % 2) && $mods != 0) + else { - $moderators_links .= "
"; + $simple_auth .= ""; } - $moderators_links .= "" . $forum_mods['forum_'.$forum_rows[$i]['forum_id'] . '_name'][$mods] . ""; } - echo "\n"; - - if(empty($forum_id)) - { - echo "\n"; + $simple_auth .= " "; - $colspan = 2; - } + $template->assign_block_vars("forum_auth_titles", array( + "CELL_TITLE" => "Simple Mode") + ); + $template->assign_block_vars("forum_auth_data", array( + "S_AUTH_LEVELS_SELECT" => $simple_auth) + ); - if($adv <= 0 || empty($forum_id)) + $s_column_span++; + } + else + { + // + // Output values of individual + // fields + // + for($j = 0; $j < count($forum_auth_fields); $j++) { - echo "\n"; - - $colspan ++; - } + $custom_auth[$j] = " \n"; - - $colspan++; + if($forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k]) + { + $custom_auth[$j] .= ""; + } + else + { + $custom_auth[$j] .= ""; + } } - } + $custom_auth[$j] .= " "; - echo "\n"; + $template->assign_block_vars("forum_auth_titles", array( + "CELL_TITLE" => ucfirst(preg_replace("/auth_/", "", $forum_auth_fields[$j]))) + ); + $template->assign_block_vars("forum_auth_data", array( + "S_AUTH_LEVELS_SELECT" => $custom_auth[$j]) + ); + $s_column_span++; + } } - if(isset($forum_id)) - { + $switch_mode = "admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv="; + $switch_mode .= ($adv <= 0 ) ? "1" : "0"; + $switch_mode_text = ($adv <= 0 ) ? "Advanced Mode" : "Simple Mode"; + $u_switch_mode = '' . $switch_mode_text . ''; - $switch_mode = "admin_forumauth.php?" . POST_FORUM_URL . "=" . $forum_id . "&adv="; - $switch_mode .= ($adv <= 0 ) ? "1" : "0"; - - $switch_mode_text = ($adv <= 0 ) ? "Advanced Mode" : "Simple Mode"; - -?> - - - -'; - } + $template->assign_vars(array( + "FORUM_NAME" => $forum_name, -?> - -
Forum TitleSimple Auth
".$forum_name[$i]."".$simple_auth[$i]."".$custom_auth[$i][$j]."
- - - - - - - - - -
Switch to
  
Return to Forum Auth Index
+ "U_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id"), + "U_SWITCH_MODE" => $u_switch_mode, - $s_column_span, + "S_HIDDEN_FIELDS" => $s_hidden_fields) + ); + +} -?> -
-

User Authorisation Admin

+$template->pparse("body"); -Powered By phpBB 2.0 -
- -Copyright © 2001 phpBB Group, All Rights Reserved -
+include('page_footer_admin.'.$phpEx); - - \ No newline at end of file +?> \ No newline at end of file -- cgit v1.2.1