1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

New page headers, cleaned up code, etc.

git-svn-id: file:///svn/phpbb/trunk@663 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2001-07-14 20:00:27 +00:00
parent 92074fdd8c
commit 28a09fcc50
14 changed files with 1455 additions and 914 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,32 @@
<?php
/***************************************************************************
* admin_forumauth.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
if($setmodules==1)
/***************************************************************************
*
* 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.
*
*
***************************************************************************/
if($setmodules == 1)
{
$filename = basename(__FILE__);
$module['Auth']['forums'] = $filename;
$module['Auth']['Forums'] = $filename;
return;
}
@@ -14,26 +37,27 @@ include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
//$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
//init_userprefs($userdata);
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//
// End session management
//
/*$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)
);*/
//
// 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
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>phpBB - auth testing</title>
<style type="text/css">
<!--
P {font-family:Verdana,serif;font-size:8pt}
$template_header = "admin/page_header.tpl";
include('page_header_admin.'.$phpEx);
H1 {font-family:Arial,Helvetica,sans-serif;font-size:14pt;}
H2 {font-family:Arial,Helvetica,sans-serif;font-size:12pt;}
TH {font-family:Verdana,serif;font-size:8pt}
TD {font-family:Verdana,serif;font-size:8pt}
SELECT.small {width:140px;font-family:"Courier New",courier;font-size:8pt;}
INPUT.text {font-family:"Courier New",courier;font-size:8pt;}
//-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h1>Forum Authorisation Control</h1>
<?php
if(!empty($forum_id))
{
?>
<h2>Forum : <?php echo $forum_rows[0]['forum_name']; ?></h2>
<?php
}
?>
<div align="center"><table cellspacing="1" cellpadding="4" border="0">
<?php
if(empty($forum_id))
{
//
// Output the selection table if no forum id was
// specified
//
$template->set_filenames(array(
"body" => "admin/forum_auth_select_body.tpl")
);
$select_list = "<select name=\"" . POST_FORUM_URL . "\">";
for($i = 0; $i < count($forum_rows); $i++)
{
$forum_name[$i] = "<a href=\"" . append_sid("admin_forumauth.php?" . POST_FORUM_URL . "=" . $forum_rows[$i]['forum_id']) . "\">" . $forum_rows[$i]['forum_name'] . "</a>";
$select_list .= "<option value=\"" . $forum_rows[$i]['forum_id'] . "\">" . $forum_rows[$i]['forum_name'] . "</option>";
}
$select_list .= "</select>";
reset($simple_auth_ary);
while(list($key, $auth_levels) = each($simple_auth_ary))
$template->assign_vars(array(
"S_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx"),
"S_FORUMS_SELECT" => $select_list)
);
}
else
{
//
// Output the authorisation details if an id was
// specified
//
$template->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))
{
$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[0][$forum_auth_fields[$k]] != $auth_levels[$k])
{
$matched_type = $key;
if($forum_rows[$i][$forum_auth_fields[$k]] != $auth_levels[$k])
{
$matched = 0;
}
$matched = 0;
}
}
if($matched)
break;
}
//
// If we didn't get a match above then we
// automatically switch into 'advanced' mode
//
if($adv == -1 && !$matched)
{
$adv = 1;
}
$s_column_span == 0;
if( $adv <= 0 )
{
$simple_auth = "&nbsp;<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>";
}
if($matched)
break;
}
$simple_auth .= "</select>&nbsp;";
$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)
);
$s_column_span++;
}
else
{
//
// If we've got a custom setup
// then we jump into advanced
// mode by default
// Output values of individual
// fields
//
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)) ? "&nbsp;<select name=\"simpleauth\">" : "";
if(!$matched && empty($forum_id))
{
$simple_auth[$i] .= "Custom";
$matched_type = -1;
}
for($j = 0; $j < count($simple_auth_types); $j++)
{
if($matched_type == $j)
{
$simple_auth[$i] .= (isset($forum_id)) ? "<option value=\"$j\" selected>" : "";
$simple_auth[$i] .= $simple_auth_types[$j];
$simple_auth[$i] .= (isset($forum_id)) ? "</option>" : "";
}
else if(isset($forum_id))
{
$simple_auth[$i] .= "<option value=\"$j\">".$simple_auth_types[$j]."</option>";
}
}
$simple_auth[$i] .= (isset($forum_id)) ? "</select>&nbsp;" : "";
}
if($adv == 1 || empty($forum_id))
{
//
// Output values of individual
// fields
//
for($j = 0; $j < count($forum_auth_fields); $j++)
{
$custom_auth[$i][$j] = (isset($forum_id)) ? "&nbsp;<select name=\"".$forum_auth_fields[$j]."\">" : "";
for($k = 0; $k < count($forum_auth_levels); $k++)
{
if($forum_rows[$i][$forum_auth_fields[$j]] == $forum_auth_const[$k])
{
$custom_auth[$i][$j] .= (isset($forum_id)) ? "<option value=\"" . $forum_auth_const[$k] . "\" selected>" : "";
if(empty($forum_id))
{
if($forum_auth_levels[$k] == "ACL" || $forum_auth_levels[$k] == "MOD" || $forum_auth_levels[$k] == "ADMIN")
{
$custom_auth[$i][$j] .= "<a href=\"userauth.php?" . POST_FORUM_URL . "=" . $forum_rows[$i]['forum_id'] . "&auth=" . $forum_auth_fields[$j] . "\">";
}
}
$custom_auth[$i][$j] .= $forum_auth_levels[$k];
if(empty($forum_id))
{
if($forum_auth_levels[$k] == "ACL" || $forum_auth_levels[$k] == "MOD" || $forum_auth_levels[$k] == "ADMIN")
{
$custom_auth[$i][$j] .= "</a>";
}
}
$custom_auth[$i][$j] .= (isset($forum_id)) ? "</option>" : "";
}
else if(isset($forum_id))
{
$custom_auth[$i][$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $forum_auth_levels[$k]."</option>";
}
}
$custom_auth[$i][$j] .= (isset($forum_id)) ? "</select>&nbsp;" : "";
}
}
}
?>
<tr><form method="post" action="admin_forumauth.php">
<?php
if(empty($forum_id))
{
?>
<th bgcolor="#CCCCCC">Forum Title</th>
<?php
}
if($adv <= 0 || empty($forum_id))
{
?>
<th bgcolor="#CCCCCC">Simple Auth</th>
<?php
}
if($adv == 1 || empty($forum_id))
{
for($j = 0; $j < count($forum_auth_fields); $j++)
{
echo "<th bgcolor=\"#CCCCCC\">".preg_replace("/auth_/", "", $forum_auth_fields[$j])."</th>\n";
$custom_auth[$j] = "&nbsp;<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] .= $forum_auth_levels[$k];
$custom_auth[$j] .= "</option>";
}
else
{
$custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $forum_auth_levels[$k] . "</option>";
}
}
$custom_auth[$j] .= "</select>&nbsp;";
$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++;
}
}
?>
</tr>
<?php
$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 = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
for($i = 0; $i < count($forum_rows); $i++)
{
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
unset($moderators_links);
for($mods = 0; $mods < count($forum_mods['forum_' . $forum_rows[$i]['forum_id'] . '_id']); $mods++)
{
if(isset($moderators_links))
{
$moderators_links .= ", ";
}
if(!($mods % 2) && $mods != 0)
{
$moderators_links .= "<br>";
}
$moderators_links .= "<a href=\"".append_sid("../profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $forum_mods['forum_'.$forum_rows[$i]['forum_id'] . '_id'][$mods]) . "\">" . $forum_mods['forum_'.$forum_rows[$i]['forum_id'] . '_name'][$mods] . "</a>";
}
$template->assign_vars(array(
"FORUM_NAME" => $forum_name,
echo "<tr>\n";
"U_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id"),
"U_SWITCH_MODE" => $u_switch_mode,
if(empty($forum_id))
{
echo "<td align=\"center\" bgcolor=\"#DDDDDD\">".$forum_name[$i]."</td>\n";
"S_COLUMN_SPAN" => $s_column_span,
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
$colspan = 2;
}
}
if($adv <= 0 || empty($forum_id))
{
echo "<td align=\"center\" bgcolor=\"#DDDDDD\">".$simple_auth[$i]."</td>\n";
$template->pparse("body");
$colspan ++;
}
include('page_footer_admin.'.$phpEx);
if($adv == 1 || empty($forum_id))
{
for($j = 0; $j < count($custom_auth[$i]); $j++)
{
echo "<td align=\"center\" bgcolor=\"#DDDDDD\">".$custom_auth[$i][$j]."</td>\n";
$colspan++;
}
}
echo "</tr>\n";
}
if(isset($forum_id))
{
$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";
?>
<tr>
<td colspan="<?php echo $colspan; ?>"><table width="100%" cellspacing="0" cellpadding="4" border="0">
<tr>
<td align="center"><a href="<?php echo $switch_mode ?>">Switch to <?php echo $switch_mode_text; ?></a></td>
</tr>
<tr>
<td align="center"><input type="hidden" name="<?php echo POST_FORUM_URL; ?>" value="<?php echo $forum_id; ?>"><input type="submit" name="submit" value="Submit Changes">&nbsp;&nbsp;<input type="reset" value="Reset to Initial"></td>
</tr>
<tr>
<td align="center"><a href="admin_forumauth.php">Return to Forum Auth Index</a></td>
</tr>
</table></td>
</tr>
<?php
}
?>
</form></tr>
</table></div>
<?php
?>
<center>
<p><a href="userauth.php">User Authorisation Admin</a></p>
<font face="Verdana,serif" size="1">Powered By <a href="http://www.phpbb.com/" target="_phpbb">phpBB 2.0</a></font>
<br clear="all">
<font face="Verdana,serif" size="1">
Copyright &copy; 2001 phpBB Group, All Rights Reserved</font>
<br>
</body>
</html>
?>

View File

@@ -1,9 +1,31 @@
<?php
/***************************************************************************
* admin_groupauth.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.
*
*
***************************************************************************/
if($setmodules == 1)
{
$filename = basename(__FILE__);
$module['Auth']['groups'] = $filename;
$module['Auth']['Groups'] = $filename;
return;
}
@@ -20,7 +42,18 @@ init_userprefs($userdata);
//
// End session management
//
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
//
$auth_field_match = array(
"auth_view" => AUTH_VIEW,
"auth_read" => AUTH_READ,
@@ -30,6 +63,15 @@ $auth_field_match = array(
"auth_delete" => AUTH_DELETE,
"auth_sticky" => AUTH_STICKY,
"auth_announce" => AUTH_ANNOUNCE);
$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce");
$forum_auth_key_fields = array("auth_view", "auth_read", "auth_post", "auth_reply");
//
// Future stuff
//
//, "auth_votecreate", "auth_vote", "auth_attachments", "auth_allow_html", "auth_allow_bbcode", "auth_allow_smilies"
//
/* ,
"auth_vote" => AUTH_VOTE,
"auth_votecreate" => AUTH_VOTECREATE,
@@ -39,9 +81,6 @@ $auth_field_match = array(
"auth_allow_bbcode" => AUTH_ALLOW_BBCODE
"auth_allow_smilies" => AUTH_ALLOW_SMILIES
);*/
$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", "auth_allow_html", "auth_allow_bbcode", "auth_allow_smilies"
$forum_auth_key_fields = array("auth_view", "auth_read", "auth_post", "auth_reply");
// ----------
// Start Functions
@@ -370,8 +409,12 @@ else if(empty($HTTP_GET_VARS[POST_GROUPS_URL]))
}
$select_list .= "</select>";
$template_header = "admin/page_header.tpl";
include('page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/ug_auth_select_body.tpl"));
"body" => "admin/ug_auth_select_body.tpl")
);
$template->assign_vars(array(
"L_USER_OR_GROUP" => "Group",
@@ -384,7 +427,7 @@ else if(empty($HTTP_GET_VARS[POST_GROUPS_URL]))
$template->pparse("body");
exit;
include('page_footer_admin.'.$phpEx);
}
@@ -392,6 +435,8 @@ else if(empty($HTTP_GET_VARS[POST_GROUPS_URL]))
//
// Front end
//
$template_header = "admin/page_header.tpl";
include('page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/ug_auth_body.tpl")
@@ -652,6 +697,6 @@ if($adv == -1)
$template->pparse("body");
exit;
include('page_footer_admin.'.$phpEx);
?>

View File

@@ -1,9 +1,31 @@
<?php
/***************************************************************************
* admin_userauth.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.
*
*
***************************************************************************/
if($setmodules == 1)
{
$filename = basename(__FILE__);
$module['Auth']['users'] = $filename;
$module['Auth']['Users'] = $filename;
return;
}
@@ -20,16 +42,37 @@ init_userprefs($userdata);
//
// End session management
//
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
//
$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_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);
$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce");
$forum_auth_key_fields = array("auth_view", "auth_read", "auth_post", "auth_reply");
//
// Future stuff
//
//, "auth_votecreate", "auth_vote", "auth_attachments", "auth_allow_html", "auth_allow_bbcode", "auth_allow_smilies"
//
/* ,
"auth_vote" => AUTH_VOTE,
"auth_votecreate" => AUTH_VOTECREATE,
@@ -39,9 +82,7 @@ $auth_field_match = array(
"auth_allow_bbcode" => AUTH_ALLOW_BBCODE
"auth_allow_smilies" => AUTH_ALLOW_SMILIES
);*/
$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", "auth_allow_html", "auth_allow_bbcode", "auth_allow_smilies"
$forum_auth_key_fields = array("auth_view", "auth_read", "auth_post", "auth_reply");
// ----------
// Start Functions
@@ -238,22 +279,14 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL]))
while(list($chg_forum_id, $value) = @each($change_mod_ary))
{
$a_match = $value;
$auth_exists = FALSE;
for($i = 0; $i < count($u_access); $i++)
{
$forum_id = $u_access[$i]['forum_id'];
if( $forum_id == $chg_forum_id )
if( $u_access[$i]['forum_id'] == $chg_forum_id )
{
if( $u_access[$i]['auth_mod'] == $value && $u_access[$i]['group_single_user'] )
{
$a_match = -1;
}
else if( $u_access[$i]['auth_mod'] && !$value && !$u_access[$i]['group_single_user'] )
if( $u_access[$i]['auth_mod'] && !$value && !$u_access[$i]['group_single_user'] )
{
//
// User is being removed as a moderator but is a moderator
@@ -261,7 +294,8 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL]))
//
$warning_mod[$chg_forum_id] = TRUE;
}
else
if( $u_access[$i]['auth_mod'] != $value && $u_access[$i]['group_single_user'] )
{
if(!$value)
{
@@ -272,21 +306,25 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL]))
$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, auth_mod = " . TRUE;
}
$valid_auth_mod_sql[$chg_forum_id] = $sql . " WHERE forum_id = $chg_forum_id AND group_id = " . $ug_info['group_id'];
$valid_auth_mod[$chg_forum_id] = 1;
}
$auth_exists = TRUE;
$valid_auth_mod_sql[$chg_forum_id] = $sql . " WHERE forum_id = $chg_forum_id AND group_id = " . $ug_info['group_id'];
$valid_auth_mod[$chg_forum_id] = 1;
$auth_exists = TRUE;
}
}
}
if(!$auth_exists && $value)
{
$valid_auth_mod_sql[$chg_forum_id] = "INSERT INTO " . AUTH_ACCESS_TABLE . " (forum_id, group_id, auth_mod) VALUES ($chg_forum_id, " . $ug_info['group_id'] . ", 1)";
$valid_auth_mod[$chg_forum_id] = 0;
$valid_auth_mod[$chg_forum_id] = 1;
}
}
print_r($valid_auth_mod_sql);
//
// Check against priv access table ...
@@ -299,35 +337,22 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL]))
while(list($chg_forum_id, $value) = @each($change_prv_ary))
{
$valid_auth_acl_sql[$chg_forum_id] = "";
$auth_exists = FALSE;
echo "ACL : $chg_forum_id : " . $valid_auth_mod[$chg_forum_id] . "<BR>";
for($i = 0; $i < count($u_access); $i++)
{
if( $u_access[$i]['forum_id'] == $chg_forum_id )
{
//
// If we're updating/inserting a moderator access
// control then we don't need to both with anything here,
// adding (or updating) a user to mod status automatically
// grants access to all forum functions (unless they
// are set at admin status!). Removing moderator permissions
// automatically removes all priviledges, it does mean the
// admin has to re-enable ACL privs but it does prevent
// them accidently leaving a user with access to a forum
// they should be now denied.
//
// echo "<BR>" . $chg_forum_id . " : " . $valid_auth_mod[$chg_forum_id] . "<BR>";
// echo $chg_forum_id . " : " . $valid_auth_mod[$chg_forum_id] . " : " . $u_access[$i]['auth_mod'] . "<BR>";
if( empty($valid_auth_mod[$chg_forum_id]) && !$u_access[$i]['auth_mod'])
if( empty($valid_auth_mod[$chg_forum_id]) && !( $u_access[$i]['auth_mod'] && $u_access[$i]['group_single_user']) )
{
//
// User isn't a moderator so now we have to decide whether the
// the access needs creating, updating or deleting ...
//
for($j = 0; $j < count($forum_access); $j++)
{
@@ -344,47 +369,53 @@ if(isset($HTTP_POST_VARS['submit']) && !empty($HTTP_POST_VARS[POST_USERS_URL]))
if( $u_access[$i][$auth_field] && !$value && !$u_access[$i]['group_single_user'] )
{
//
// User is having ACL access removed from this field
// but retains access via a group they belong too,
// carry out the update but warn the moderator
//
$warning_acl[$chg_forum_id][$auth_field] = TRUE;
}
else if( $u_access[$i][$auth_field] != $value && $u_access[$i]['group_single_user'] )
if( $u_access[$i][$auth_field] != $value && $u_access[$i]['group_single_user'])
{
$update_acl_sql .= ($update_acl_sql != "") ? ", $auth_field = $value" : "$auth_field = $value";
$auth_exists = TRUE;
}
}
}
$valid_auth_acl_sql[$chg_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " SET " . $update_acl_sql ." WHERE forum_id = $chg_forum_id AND group_id = " . $ug_info['group_id'];
if( !empty($update_acl_sql) )
{
$valid_auth_acl_sql[$chg_forum_id] = "UPDATE " . AUTH_ACCESS_TABLE . " SET " . $update_acl_sql ." WHERE forum_id = $chg_forum_id AND group_id = " . $ug_info['group_id'];
}
} // forum_id = forum_access
} // for ... forum_access
} // not_mod
$auth_exists = TRUE;
}
else
{
// $auth_exists = TRUE;
}// not_mod
} // if forum ... chg_forum
} // for ... u_access
if($valid_auth_acl_sql[$chg_forum_id] == "" && !$auth_exists)
echo "forum = $chg_forum_id : " . $auth_exists . " : " . $value . " <BR>";
if($valid_auth_acl_sql[$chg_forum_id] == "" && !$auth_exists && $value && empty($valid_auth_mod[$chg_forum_id]))
{
echo " : HERE ";
for($j = 0; $j < count($forum_access); $j++)
{
if( $chg_forum_id == $forum_access[$j]['forum_id'] && $value)
echo " : HERE2 ";
if( $chg_forum_id == $forum_access[$j]['forum_id'] )
{
echo " : HERE3 ";
$valid_auth_acl_sql_val = "";
$valid_auth_acl_sql_fld = "";
for($k = 0; $k < count($forum_auth_fields); $k++)
{
echo " : HERE4 ";
$auth_field = $forum_auth_fields[$k];
if( $forum_access[$j][$auth_field] == AUTH_ACL )
@@ -463,294 +494,300 @@ else if(empty($HTTP_GET_VARS[POST_USERS_URL]))
}
$select_list .= "</select>";
$template_header = "admin/page_header.tpl";
include('page_header_admin.'.$phpEx);
$template->set_filenames(array(
"body" => "admin/ug_auth_select_body.tpl"));
"body" => "admin/ug_auth_select_body.tpl")
);
$template->assign_vars(array(
"L_USER_OR_GROUP" => "User",
"S_USERAUTH_ACTION" => append_sid("admin_userauth.$phpEx"),
"S_USERS_SELECT" => $select_list,
"U_FORUMAUTH" => append_sid("admin_forumauth.$phpEx"))
"S_USERAUTH_ACTION" => append_sid("admin_userauth.$phpEx"),
"S_USERS_SELECT" => $select_list)
);
$template->pparse("body");
exit;
}
//
// Front end
//
$template->set_filenames(array(
"body" => "admin/ug_auth_body.tpl")
);
$user_id = $HTTP_GET_VARS[POST_USERS_URL];
$sql = "SELECT f.forum_id, f.forum_name, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_announce, f.auth_sticky
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id
ORDER BY c.cat_order ASC, f.forum_order ASC";
$fa_result = $db->sql_query($sql);
$forum_access = $db->sql_fetchrowset($fa_result);
if($adv == -1)
else
{
for($i = 0; $i < count($forum_access); $i++)
{
while(list($forum_id, $forum_row) = each($forum_access))
{
for($j = 0; $j < count($forum_auth_key_fields); $j++)
{
$basic_auth_level[$forum_row['forum_id']] = "public";
//
// Front end
//
$template_header = "admin/page_header.tpl";
include('page_header_admin.'.$phpEx);
if($forum_row[$forum_auth_key_fields[$j]] == AUTH_REG)
{
$basic_auth_level[$forum_row['forum_id']] = "registered";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
else if($forum_row[$forum_auth_key_fields[$j]] == AUTH_ACL)
{
$basic_auth_level[$forum_row['forum_id']] = "private";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
else if($forum_row[$forum_auth_key_fields[$j]] == AUTH_MOD)
{
$basic_auth_level[$forum_row['forum_id']] = "moderator";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
else if($forum_row[$forum_auth_key_fields[$j]] == AUTH_ADMIN)
{
$basic_auth_level[$forum_row['forum_id']] = "admin";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
}
}
}
$template->set_filenames(array(
"body" => "admin/ug_auth_body.tpl")
);
$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 u.user_id = $user_id
AND ug.user_id = u.user_id
AND g.group_id = ug.group_id";
$u_result = $db->sql_query($sql);
$userinf = $db->sql_fetchrowset($u_result);
//
//
//
$user_id = $HTTP_GET_VARS[POST_USERS_URL];
$sql = "SELECT aa.forum_id, aa.auth_view, aa.auth_read, aa.auth_post, aa.auth_reply, aa.auth_edit, aa.auth_delete, aa.auth_mod
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;
$au_result = $db->sql_query($sql);
$sql = "SELECT f.forum_id, f.forum_name, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_announce, f.auth_sticky
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id
ORDER BY c.cat_order ASC, f.forum_order ASC";
$fa_result = $db->sql_query($sql);
$num_u_access = $db->sql_numrows($au_result);
if($num_u_access)
{
while($u_row = $db->sql_fetchrow($au_result))
{
$u_access[$u_row['forum_id']][] = $u_row;
$num_forum_access[$u_row['forum_id']]++;
}
}
$forum_access = $db->sql_fetchrowset($fa_result);
$is_admin = ($userinf[0]['user_level'] == ADMIN && $userinf[0]['user_id'] != ANONYMOUS) ? 1 : 0;
for($i = 0; $i < count($forum_access); $i++)
{
$f_forum_id = $forum_access[$i]['forum_id'];
$is_forum_restricted[$f_forum_id] = 0;
for($j = 0; $j < count($forum_auth_fields); $j++)
{
$key = $forum_auth_fields[$j];
$value = $forum_access[$i][$key];
switch($value)
{
case AUTH_ALL:
$auth_user[$f_forum_id][$key] = 1;
break;
case AUTH_REG:
$auth_user[$f_forum_id][$key] = ($user_id != ANONYMOUS) ? 1 : 0;
break;
case AUTH_ACL:
if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id])
{
$result = a_auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin);
$auth_user[$f_forum_id][$key] = $result['auth'];
}
else
{
$auth_user[$f_forum_id][$key] = 0;
}
break;
case AUTH_MOD:
if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id])
{
$result = a_auth_check_user(AUTH_MOD, $key, $u_access[$f_forum_id], $is_admin);
$auth_user[$f_forum_id][$key] = $result['auth'];
}
else
{
$auth_user[$f_forum_id][$key] = 0;
}
break;
case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin;
break;
default:
$auth_user[$f_forum_id][$key] = 0;
break;
}
}
//
// Is user a moderator?
//
if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id])
{
$result = a_auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], 0);
$auth_user[$f_forum_id]['auth_mod'] = $result['auth'];
}
else
{
$auth_user[$f_forum_id][$key] = 0;
}
}
while(list($forumkey, $user_ary) = each($auth_user))
{
$simple_auth[$forumkey] = 1;
while(list($fieldkey, $value) = each($user_ary))
{
$simple_auth[$forumkey] = $simple_auth[$forumkey] && $value;
}
}
reset($auth_user);
$i = 0;
if($adv == -1)
{
while(list($forumkey, $user_ary) = each($auth_user))
for($i = 0; $i < count($forum_access); $i++)
{
if($basic_auth_level[$forumkey] == "private")
while(list($forum_id, $forum_row) = each($forum_access))
{
$allowed = 1;
for($j = 0; $j < count($basic_auth_level_fields[$forumkey]); $j++)
for($j = 0; $j < count($forum_auth_key_fields); $j++)
{
if(!$auth_user[$forumkey][$basic_auth_level_fields[$forumkey][$j]])
$basic_auth_level[$forum_row['forum_id']] = "public";
if($forum_row[$forum_auth_key_fields[$j]] == AUTH_REG)
{
$allowed = 0;
$basic_auth_level[$forum_row['forum_id']] = "registered";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
else if($forum_row[$forum_auth_key_fields[$j]] == AUTH_ACL)
{
$basic_auth_level[$forum_row['forum_id']] = "private";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
else if($forum_row[$forum_auth_key_fields[$j]] == AUTH_MOD)
{
$basic_auth_level[$forum_row['forum_id']] = "moderator";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
else if($forum_row[$forum_auth_key_fields[$j]] == AUTH_ADMIN)
{
$basic_auth_level[$forum_row['forum_id']] = "admin";
$basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j];
}
}
$optionlist_acl = "<select name=\"private[$forumkey]\">";
if($is_admin || $user_ary['auth_mod'])
}
}
$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 u.user_id = $user_id
AND ug.user_id = u.user_id
AND g.group_id = ug.group_id";
$u_result = $db->sql_query($sql);
$userinf = $db->sql_fetchrowset($u_result);
$sql = "SELECT aa.forum_id, aa.auth_view, aa.auth_read, aa.auth_post, aa.auth_reply, aa.auth_edit, aa.auth_delete, aa.auth_mod
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;
$au_result = $db->sql_query($sql);
$num_u_access = $db->sql_numrows($au_result);
if($num_u_access)
{
while($u_row = $db->sql_fetchrow($au_result))
{
$u_access[$u_row['forum_id']][] = $u_row;
$num_forum_access[$u_row['forum_id']]++;
}
}
$is_admin = ($userinf[0]['user_level'] == ADMIN && $userinf[0]['user_id'] != ANONYMOUS) ? 1 : 0;
for($i = 0; $i < count($forum_access); $i++)
{
$f_forum_id = $forum_access[$i]['forum_id'];
$is_forum_restricted[$f_forum_id] = 0;
for($j = 0; $j < count($forum_auth_fields); $j++)
{
$key = $forum_auth_fields[$j];
$value = $forum_access[$i][$key];
switch($value)
{
$optionlist_acl .= "<option value=\"1\">Allowed Access</option>";
case AUTH_ALL:
$auth_user[$f_forum_id][$key] = 1;
break;
case AUTH_REG:
$auth_user[$f_forum_id][$key] = ($user_id != ANONYMOUS) ? 1 : 0;
break;
case AUTH_ACL:
if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id])
{
$result = a_auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin);
$auth_user[$f_forum_id][$key] = $result['auth'];
}
else
{
$auth_user[$f_forum_id][$key] = 0;
}
break;
case AUTH_MOD:
if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id])
{
$result = a_auth_check_user(AUTH_MOD, $key, $u_access[$f_forum_id], $is_admin);
$auth_user[$f_forum_id][$key] = $result['auth'];
}
else
{
$auth_user[$f_forum_id][$key] = 0;
}
break;
case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin;
break;
default:
$auth_user[$f_forum_id][$key] = 0;
break;
}
else if($allowed)
}
//
// Is user a moderator?
//
if($user_id != ANONYMOUS && $num_forum_access[$f_forum_id])
{
$result = a_auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], 0);
$auth_user[$f_forum_id]['auth_mod'] = $result['auth'];
}
else
{
$auth_user[$f_forum_id][$key] = 0;
}
}
while(list($forumkey, $user_ary) = each($auth_user))
{
$simple_auth[$forumkey] = 1;
while(list($fieldkey, $value) = each($user_ary))
{
$simple_auth[$forumkey] = $simple_auth[$forumkey] && $value;
}
}
reset($auth_user);
$i = 0;
if($adv == -1)
{
while(list($forumkey, $user_ary) = each($auth_user))
{
if($basic_auth_level[$forumkey] == "private")
{
$optionlist_acl .= "<option value=\"1\" selected>Allowed Access</option><option value=\"0\">Disallowed Access</option>";
$allowed = 1;
for($j = 0; $j < count($basic_auth_level_fields[$forumkey]); $j++)
{
if(!$auth_user[$forumkey][$basic_auth_level_fields[$forumkey][$j]])
{
$allowed = 0;
}
}
$optionlist_acl = "<select name=\"private[$forumkey]\">";
if($is_admin || $user_ary['auth_mod'])
{
$optionlist_acl .= "<option value=\"1\">Allowed Access</option>";
}
else if($allowed)
{
$optionlist_acl .= "<option value=\"1\" selected>Allowed Access</option><option value=\"0\">Disallowed Access</option>";
}
else
{
$optionlist_acl .= "<option value=\"1\">Allowed Access</option><option value=\"0\" selected>Disallowed Access</option>";
}
$optionlist_acl .= "</select>";
}
else
{
$optionlist_acl .= "<option value=\"1\">Allowed Access</option><option value=\"0\" selected>Disallowed Access</option>";
$optionlist_acl = "&nbsp;";
}
$optionlist_acl .= "</select>";
}
else
{
$optionlist_acl = "&nbsp;";
}
$optionlist_mod = "<select name=\"moderator[$forumkey]\">";
if($user_ary['auth_mod'])
{
$optionlist_mod .= "<option value=\"1\" selected>Is a Moderator</option><option value=\"0\">Is not a Moderator</option>";
}
else
{
$optionlist_mod .= "<option value=\"1\">Is a Moderator</option><option value=\"0\" selected>Is not a Moderator</option>";
}
$optionlist_mod .= "</select>";
$optionlist_mod = "<select name=\"moderator[$forumkey]\">";
if($user_ary['auth_mod'])
{
$optionlist_mod .= "<option value=\"1\" selected>Is a Moderator</option><option value=\"0\">Is not a Moderator</option>";
}
else
{
$optionlist_mod .= "<option value=\"1\">Is a Moderator</option><option value=\"0\" selected>Is not a Moderator</option>";
}
$optionlist_mod .= "</select>";
$row_class = ($i%2) ? "row2" : "row1";
$row_class = ($i%2) ? "row2" : "row1";
$template->assign_block_vars("forums", array(
"ROW_CLASS" => $row_class,
"FORUM_NAME" => $forum_access[$i]['forum_name'],
$template->assign_block_vars("forums", array(
"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']),
"U_FORUM_AUTH" => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']),
"S_ACL_SELECT" => $optionlist_acl,
"S_MOD_SELECT" => $optionlist_mod)
);
$i++;
"S_ACL_SELECT" => $optionlist_acl,
"S_MOD_SELECT" => $optionlist_mod)
);
$i++;
}
}
}
reset($auth_user);
reset($auth_user);
$t_username .= $userinf[0]['username'];
$s_user_type = ($is_admin) ? '<select name="userlevel"><option value="admin" selected>Administrator</option><option value="user">User</option></select>' : '<select name="userlevel"><option value="admin">Administrator</option><option value="user" selected>User</option></select>';
$t_username .= $userinf[0]['username'];
$s_user_type = ($is_admin) ? '<select name="userlevel"><option value="admin" selected>Administrator</option><option value="user">User</option></select>' : '<select name="userlevel"><option value="admin">Administrator</option><option value="user" selected>User</option></select>';
for($i = 0; $i < count($userinf); $i++)
{
if(!$userinf[$i]['group_single_user'])
{
$group_name[] = $userinf[$i]['group_name'];
$group_id[] = $userinf[$i]['group_id'];
}
}
if(count($group_name))
{
$t_usergroup_list = "";
for($i = 0; $i < count($userinf); $i++)
{
$t_usergroup_list .= "<a href=\"admin_groupauth.$phpEx?" . POST_GROUPS_URL . "=" . $group_id[$i] . "\">" . $group_name[$i] . "</a>";
if($i < count($group_name) - 1)
if(!$userinf[$i]['group_single_user'])
{
$t_usergroup_list .= ", ";
$group_name[] = $userinf[$i]['group_name'];
$group_id[] = $userinf[$i]['group_id'];
}
}
}
else
{
$t_usergroup_list = "None";
}
if(count($group_name))
{
$t_usergroup_list = "";
for($i = 0; $i < count($userinf); $i++)
{
$t_usergroup_list .= "<a href=\"admin_groupauth.$phpEx?" . POST_GROUPS_URL . "=" . $group_id[$i] . "\">" . $group_name[$i] . "</a>";
if($i < count($group_name) - 1)
{
$t_usergroup_list .= ", ";
}
}
}
else
{
$t_usergroup_list = "None";
}
$s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_USERS_URL . "\" value=\"$user_id\">";
$s_hidden_fields .= "<input type=\"hidden\" name=\"curadmin\" value=\"" . $is_admin ."\">";
$s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_USERS_URL . "\" value=\"$user_id\">";
$s_hidden_fields .= "<input type=\"hidden\" name=\"curadmin\" value=\"" . $is_admin ."\">";
$template->assign_vars(array(
"USERNAME" => $t_username,
"USER_GROUP_MEMBERSHIPS" => "This user is a $s_user_type and belongs to the following groups: $t_usergroup_list",
$template->assign_vars(array(
"USERNAME" => $t_username,
"USER_GROUP_MEMBERSHIPS" => "This user is a $s_user_type and belongs to the following groups: $t_usergroup_list",
"L_USER_OR_GROUPNAME" => "Username",
"L_USER_OR_GROUP" => "User",
"L_USER_OR_GROUPNAME" => "Username",
"L_USER_OR_GROUP" => "User",
"U_USER_OR_GROUP" => append_sid("admin_userauth.$phpEx"),
"U_FORUMAUTH" => append_sid("admin_forumauth.$phpEx"),
"U_USER_OR_GROUP" => append_sid("admin_userauth.$phpEx"),
"U_FORUMAUTH" => append_sid("admin_forumauth.$phpEx"),
"S_USER_AUTH_ACTION" => append_sid("admin_userauth.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
"S_USER_AUTH_ACTION" => append_sid("admin_userauth.$phpEx"),
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);
} // if adv == -1
} // if adv == -1
}
$template->pparse("body");
exit;
include('page_footer_admin.'.$phpEx);
?>

View File

@@ -32,34 +32,33 @@ include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//
// End sessionmanagement
// End session management
//
//
// Start Auth check
// Is user logged in? If yes are they an admin?
//
if($userdata['user_level'] != ADMIN)
if( !$userdata['session_logged_in'] )
{
message_die(CRITICAL_MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised'], __LINE__, __FILE__);
header("Location: ../login.$phpEx?forward_page=/admin/");
}
//
// End Auth check
//
if ($pane == 'top')
else if( $userdata['user_level'] != ADMIN )
{
$page_title = $lang['View_topic'] ." - $topic_title";
$pagetype = "viewtopic";
message_die(GENERAL_MESSAGE, "You are not authorised to administer this board");
}
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//
// Generate relevant output
//
if( $HTTP_GET_VARS['pane'] == 'top' )
{
$template_header = "admin/overall_header.tpl";
include('page_header_admin.'.$phpEx);
}
elseif ($pane == 'left')
elseif( $HTTP_GET_VARS['pane'] == 'left' )
{
$pagetype = "noheader";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
print "<BASE TARGET=\"main\">";
$dir = opendir(".");
@@ -73,62 +72,70 @@ elseif ($pane == 'left')
}
}
while( list($cat, $action_array) = each($module) )
{
print "<H3>$cat</H3>\n";
print "<ul>\n";
while( list($action, $file) = each($action_array) )
{
print "<li><a href=\"$file\">$action</a></li>\n";
}
print "</ul>\n";
}
/*
$template->set_filenames(array(
"body" => "admin/navigate.tpl")
);
while( list($cat, $action_array) = each($module) )
{
$template->assign_block_vars("catrow", array(
"CATNAME" => $cat)
);
while( list($action, $file) = each($action_array) )
while( list($action, $file) = each($action_array) )
{
$template->assign_block_vars("catrow.actionrow", array(
"ACTIONNAME" => $action,
"FILE" => $file)
"ACTIONNAME" => $action,
"FILE" => $file)
);
}
}
//var_dump($module);
$template->pparse("body");
*/
$setmodules = 0;
}
elseif ($pane == 'right')
elseif( $HTTP_GET_VARS['pane'] == 'right' )
{
echo "This the right pane ;)";
echo "This a right pane ;)";
}
else
{
//
// Generate frameset
//
$template->set_filenames(array(
"body" => "admin/index_frameset.tpl")
);
$template->assign_vars(array(
"S_FRAME_HEADER" => "index.$phpEx?pane=top",
"S_FRAME_NAV" => "index.$phpEx?pane=left",
"S_FRAME_MAIN" => "index.$phpEx?pane=right",
)
);
$template->pparse("body");
// Generate frameset
?>
<html>
<head>
<title>Admin</title>
</head>
<frameset rows="150,*" border="0" frameborder="0">
<frame src="index.<?php echo $phpEx?>?pane=top" name="top" SCROLLING="NO">
<frameset cols="150,*" border="0" frameborder="0">
<frame src="index.<?php echo $phpEx?>?pane=left" name="nav">
<frame src="index.<?php echo $phpEx?>?pane=right" name="main">
</frameset>
</frameset>
<noframes>
<body bgcolor="#FFFFFF">
Sorry, your browser doesn't seem to support Frames..
</body>
</noframes>
</html>
<?
exit;
}
?>
?>

View File

@@ -0,0 +1,85 @@
<?php
/***************************************************************************
* page_footer_admin.php
* -------------------
* begin : Saturday, Jul 14, 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.
*
*
***************************************************************************/
//
// Show the overall footer.
//
$current_time = time();
$template->set_filenames(array(
"page_footer" => "admin/page_footer.tpl")
);
$template->assign_vars(array(
"PHPBB_VERSION" => "2.0-alpha")
);
$template->pparse("page_footer");
//
// Output page creation time
//
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
$gzip_text = ($board_config['gzip_compress']) ? "GZIP compression enabled" : "GZIP compression disabled";
$debug_mode = (DEBUG) ? " : Debug Mode" : "";
printf("<center><font size=-2>phpBB Created this page in %f seconds : " . $db->num_queries . " queries executed : $gzip_text".$debug_mode."</font></center>", $totaltime);
//
// Close our DB connection.
//
$db->sql_close();
//
// Compress buffered output if required
// and send to browser
//
if($do_gzip_compress)
{
//
// Borrowed from php.net!
//
$gzip_contents = ob_get_contents();
ob_end_clean();
$gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents);
$gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack("V", $gzip_crc);
echo pack("V", $gzip_size);
}
exit;
?>

View File

@@ -0,0 +1,158 @@
<?php
/***************************************************************************
* page_header.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(HEADER_INC, TRUE);
//
// gzip_compression
//
$do_gzip_compress = FALSE;
if($board_config['gzip_compress'])
{
$phpver = phpversion();
if($phpver >= "4.0.4pl1")
{
if(extension_loaded("zlib"))
{
ob_start("ob_gzhandler");
}
}
else if($phpver > "4.0")
{
if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
{
$do_gzip_compress = TRUE;
ob_start();
ob_implicit_flush(0);
header("Content-Encoding: gzip");
}
}
}
if(empty($template_header))
{
$template_header = "admin/page_header.tpl";
}
$template->set_filenames(array(
"header" => $template_header)
);
//
// Do timezone text output
//
if($board_config['default_timezone'] < 0)
{
$s_timezone = $lang['All_times'] . " " .$lang['GMT'] . " - " . (-$board_config['default_timezone']) . " " . $lang['Hours'];
}
else if($board_config['default_timezone'] == 0)
{
$s_timezone = $lang['All_times'] . " " . $lang['GMT'];
}
else
{
$s_timezone = $lang['All_times'] . " " . $lang['GMT'] ." + " . $board_config['default_timezone'] . " " . $lang['Hours'];
}
//
// The following assigns all _common_ variables that may be used at any point
// in a template. Note that all URL's should be wrapped in append_sid, as
// should all S_x_ACTIONS for forms.
//
$template->assign_vars(array(
"SITENAME" => $board_config['sitename'],
"PAGE_TITLE" => $page_title,
"META_INFO" => $meta_tags,
"L_USERNAME" => $lang['Username'],
"L_PASSWORD" => $lang['Password'],
"L_INDEX" => $lang['Forum_Index'],
"L_REGISTER" => $lang['Register'],
"L_PROFILE" => $lang['Profile'],
"L_SEARCH" => $lang['Search'],
"L_PRIVATEMSGS" => $lang['Private_msgs'],
"L_MEMBERLIST" => $lang['Memberlist'],
"L_FAQ" => $lang['FAQ'],
"L_USERGROUPS" => $lang['Usergroups'],
"L_FORUM" => $lang['Forum'],
"L_TOPICS" => $lang['Topics'],
"L_REPLIES" => $lang['Replies'],
"L_VIEWS" => $lang['Views'],
"L_POSTS" => $lang['Posts'],
"L_LASTPOST" => $lang['Last_Post'],
"L_MODERATOR" => $lang['Moderator'],
"L_NONEWPOSTS" => $lang['No_new_posts'],
"L_NEWPOSTS" => $lang['New_posts'],
"L_POSTED" => $lang['Posted'],
"L_JOINED" => $lang['Joined'],
"L_AUTHOR" => $lang['Author'],
"L_MESSAGE" => $lang['Message'],
"L_BY" => $lang['by'],
"U_INDEX" => append_sid("../index.".$phpEx),
"S_TIMEZONE" => $s_timezone,
"S_LOGIN_ACTION" => append_sid("../login.$phpEx"),
"S_JUMPBOX_ACTION" => append_sid("../viewforum.$phpEx"),
"S_CURRENT_TIME" => create_date($board_config['default_dateformat'], time(), $board_config['default_timezone']),
"T_HEAD_STYLESHEET" => $theme['head_stylesheet'],
"T_BODY_BACKGROUND" => $theme['body_background'],
"T_BODY_BGCOLOR" => "#".$theme['body_bgcolor'],
"T_BODY_TEXT" => "#".$theme['body_text'],
"T_BODY_LINK" => "#".$theme['body_link'],
"T_BODY_VLINK" => "#".$theme['body_vlink'],
"T_BODY_ALINK" => "#".$theme['body_alink'],
"T_BODY_HLINK" => "#".$theme['body_hlink'],
"T_TR_COLOR1" => "#".$theme['tr_color1'],
"T_TR_COLOR2" => "#".$theme['tr_color2'],
"T_TR_COLOR3" => "#".$theme['tr_color3'],
"T_TH_COLOR1" => "#".$theme['th_color1'],
"T_TH_COLOR2" => "#".$theme['th_color2'],
"T_TH_COLOR3" => "#".$theme['th_color3'],
"T_TD_COLOR1" => "#".$theme['td_color1'],
"T_TD_COLOR2" => "#".$theme['td_color2'],
"T_TD_COLOR3" => "#".$theme['td_color3'],
"T_FONTFACE1" => $theme['fontface1'],
"T_FONTFACE2" => $theme['fontface2'],
"T_FONTFACE3" => $theme['fontface3'],
"T_FONTSIZE1" => $theme['fontsize1'],
"T_FONTSIZE2" => $theme['fontsize2'],
"T_FONTSIZE3" => $theme['fontsize3'],
"T_FONTCOLOR1" => "#".$theme['fontcolor1'],
"T_FONTCOLOR2" => "#".$theme['fontcolor2'],
"T_FONTCOLOR3" => "#".$theme['fontcolor3'],
"T_IMG1" => $theme['img1'],
"T_IMG2" => $theme['img2'],
"T_IMG3" => $theme['img3'],
"T_IMG4" => $theme['img4'])
);
header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$template->pparse("header");
?>