diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-07-14 20:00:27 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-07-14 20:00:27 +0000 |
commit | 28a09fcc5065b9aff4a5db740f80e903d8f0a44d (patch) | |
tree | 6d593802892bee57fc8836554b70c264f8d3dacf /phpBB/admin | |
parent | 92074fdd8c86a53bc438df766798f29c7f5db39a (diff) | |
download | forums-28a09fcc5065b9aff4a5db740f80e903d8f0a44d.tar forums-28a09fcc5065b9aff4a5db740f80e903d8f0a44d.tar.gz forums-28a09fcc5065b9aff4a5db740f80e903d8f0a44d.tar.bz2 forums-28a09fcc5065b9aff4a5db740f80e903d8f0a44d.tar.xz forums-28a09fcc5065b9aff4a5db740f80e903d8f0a44d.zip |
New page headers, cleaned up code, etc.
git-svn-id: file:///svn/phpbb/trunk@663 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/admin')
-rw-r--r-- | phpBB/admin/admin_db_utilities.php | 614 | ||||
-rw-r--r-- | phpBB/admin/admin_forumauth.php | 437 | ||||
-rw-r--r-- | phpBB/admin/admin_groupauth.php | 59 | ||||
-rw-r--r-- | phpBB/admin/admin_userauth.php | 583 | ||||
-rw-r--r-- | phpBB/admin/index.php | 99 | ||||
-rw-r--r-- | phpBB/admin/page_footer_admin.php | 85 | ||||
-rw-r--r-- | phpBB/admin/page_header_admin.php | 158 |
7 files changed, 1258 insertions, 777 deletions
diff --git a/phpBB/admin/admin_db_utilities.php b/phpBB/admin/admin_db_utilities.php index aca8a7a18f..3c0dc9274d 100644 --- a/phpBB/admin/admin_db_utilities.php +++ b/phpBB/admin/admin_db_utilities.php @@ -1,13 +1,12 @@ <?php /*************************************************************************** -* db_utilities.php - description +* admin_db_utilities.php * ------------------- * begin : Thu May 31, 2001 * copyright : (C) 2001 The phpBB Group * email : support@phpbb.com * * $Id$ - * ****************************************************************************/ @@ -32,7 +31,8 @@ if($setmodules == 1) { $filename = basename(__FILE__); - $module['General']['backup'] = $filename; + $module['General']['Backup_DB'] = $filename . "?perform=backup"; + $module['General']['Restore_DB'] = $filename . "?perform=restore"; return; } @@ -41,9 +41,6 @@ $phpbb_root_path = "./../"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); -// Set VERBOSE to 1 for debugging info.. -define("VERBOSE", "0"); - // // Start session management // @@ -53,157 +50,205 @@ init_userprefs($userdata); // End sessionmanagement // +// +// 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"); +} + // // Define Template files... -// +// $template->set_filenames(array( - "body" => "admin/db_utilities.tpl") + "body" => "admin/db_utilities_body.tpl") ); - -// define a constant for the dbms so that we don't have to redeclare it -// global for each function.... -define('DBMS', "$dbms"); + +// +// Set VERBOSE to 1 for debugging info.. +// +define("VERBOSE", 0); + +// // Increase maximum execution time, but don't complain about it if it isn't // allowed. +// @set_time_limit(600); - +// // The following functions are adapted from phpMyAdmin and upgrade_20.php // // // This function is used for grabbing the sequences for postgres... -function pg_get_sequences($db, $crlf, $backup_type) +// +function pg_get_sequences($crlf, $backup_type) { - $get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' "; - $get_seq_sql .="AND relkind = 'S' ORDER BY relname"; + global $db; + + $get_seq_sql = "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' + AND relkind = 'S' ORDER BY relname"; + $seq = $db->sql_query($get_seq_sql); - if(!$num_seq = $db->sql_numrows($seq)) { + + if( !$num_seq = $db->sql_numrows($seq) ) + { + $return_val = "# No Sequences Found $crlf"; - } // End if... + + } else { $return_val = "# Sequences $crlf"; $i_seq = 0; + while($i_seq < $num_seq) { $row = sql_fetchrow($seq); $sequence = $row['relname']; + $get_props_sql = "SELECT * FROM $sequence"; $seq_props = $db->sql_query($get_props_sql); + if($db->sql_numrows($seq_props) > 0) { $row1 = $db->sql_fetchrow($seq_props); + if($backup_type == 'structure') { $row['last_value'] = 1; } + $return_val .= "CREATE SEQUENCE $sequence start " . $row['last_value'] . ' increment ' . $row['increment_by'] . ' maxvalue ' . $row['max_value'] . ' minvalue ' . $row['min_value'] . ' cache ' . $row['cache_value'] . "; $crlf"; + } // End if numrows > 0 + if(($row['last_value'] > 1) && ($backup_type != 'structure')) { $return_val .= "SELECT NEXTVALE('$sequence'); $crlf"; unset($row['last_value']); } + $i_seq++; + } // End while.. + } // End else... + return $returnval; + } // End function... +// // The following functions will return the "CREATE TABLE syntax for the // varying DBMS's - +// // This function returns, will return the table def's for postgres... -function get_table_def_postgres($db, $table, $crlf) +// +function get_table_def_postgres($table, $crlf) { - global $drop; + global $drop, $db; + $schema_create = ""; - $field_query = " - SELECT a.attnum, - a.attname AS field, - t.typename as type, - a.attlen AS length, - a.atttypmod as lengthvar, - a.attnotnull as notnull - FROM - pg_class c, - pg_attribute a, - pg_type t - WHERE - c.relname = '$table' - AND a.attnum > 0 - AND a.attrelid = c.oid - AND a.attypid = t.oid - ORDER BY a.attnum"; + + $field_query = "SELECT a.attnum, a.attname AS field, t.typename as type, a.attlen AS length, a.atttypmod as lengthvar, a.attnotnull as notnull + FROM pg_class c, pg_attribute a, pg_type t + WHERE c.relname = '$table' + AND a.attnum > 0 + AND a.attrelid = c.oid + AND a.attypid = t.oid + ORDER BY a.attnum"; $result = $db->sql_query($field_query); + if(!$result) { $error = $db->sql_error(); message_die(GENERAL_ERROR, 'Failed in get_table_def (show fields) : ' . $error['message']); } // end if.. + if ($drop == 1) { $schema_create .= "DROP TABLE $table;$crlf"; } // end if + $schema_create .= "CREATE TABLE $table($crlf"; + while ($row = $db->sql_fetchrow($result)) { $sql_get_default = "SELECT d.adsrc AS rowdefault - FROM pg_attrdef d, pg_class c - WHERE (c.relname = '$table') AND (c.oid = d.adrelid) AND d.adnum = " . $row['attnum']; + FROM pg_attrdef d, pg_class c + WHERE (c.relname = '$table') + AND (c.oid = d.adrelid) + AND d.adnum = " . $row['attnum']; $def_res = $db->sql_query($sql_get_default); + if (!$def_res) { unset($row['rowdefault']); - } // end if + } else { $row['rowdefault'] = @pg_result($def_res, 0, 'rowdefault'); - } // end else + } + if ($row['type'] == 'bpchar') { // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement. $row['type'] = 'char'; - } // end if + } + $schema_create .= ' ' . $row['field'] . ' ' . $row['type']; + if (eregi('char', $row['type'])) { if ($row['lengthvar'] > 0) { $schema_create .= '(' . ($row['lengthvar'] -4) . ')'; - } // end if($row['lenghvar']... - } // end if(eregi('char'... + } + } + if (eregi('numeric', $row['type'])) { $schema_create .= '('; $schema_create .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff)); $schema_create .= ')'; - } // end if(eregi('numeric' ... + } + if (!empty($row['rowdefault'])) { $schema_create .= ' DEFAULT ' . $row['rowdefault']; - } // end if(!empty... + } + if ($row['notnull'] == 't') { $schema_create .= ' NOT NULL'; - } // end if($row['notnul'] ... + } + $schema_create .= ", $crlf"; - } //end while loop - $sql_pri_keys = " - SELECT ic.relname AS index_name, bc.relname AS tab_name, ta.attname AS column_name, - i.indisunique AS unique_key, i.indisprimary AS primary_key + + } + + $sql_pri_keys = "SELECT ic.relname AS index_name, bc.relname AS tab_name, ta.attname AS column_name, i.indisunique AS unique_key, i.indisprimary AS primary_key FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia - WHERE (bc.oid = i.indrelid) AND (ic.oid = i.indexrelid) AND (ia.attrelid = i.indexrelid) AND - (ta.attrelid = bc.oid) AND (bc.relname = '$table') AND (ta.attrelid = i.indrelid) AND - (ta.attnum = i.indkey[ia.attnum-1]) - ORDER BY - index_name, tab_name, column_name "; + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (ia.attrelid = i.indexrelid) + AND (ta.attrelid = bc.oid) + AND (bc.relname = '$table') + AND (ta.attrelid = i.indrelid) + AND (ta.attnum = i.indkey[ia.attnum-1]) + ORDER BY index_name, tab_name, column_name "; $result = $db->sql_query($sql_pri_keys); + if(!$result) { - $error = $db->sql_error(); - message_die(GENERAL_ERROR, 'Failed in get_table_def (show fields) : ' . $error['message']); - } // end if.. + message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_pri_keys); + } + while ( $row = $db->sql_fetchrow($result)) { if ($row['primary_key'] == 't') @@ -211,79 +256,95 @@ function get_table_def_postgres($db, $table, $crlf) if (!empty($primary_key)) { $primary_key .= ', '; - } // end if(!empty... + } + $primary_key .= $row['column_name']; $primary_key_name = $row['index_name']; - } // end if($row['primary_key'] ... + + } else { + // // We have to store this all this info because it is possible to have a multi-column key... // we can loop through it again and build the statement + // $index_rows[$row['index_name']]['table'] = $table; $index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? ' UNIQUE ' : ''; $index_rows[$row['index_name']]['column_names'] .= $row['column_name'] . ', '; - } // end else.. - } // end while loop + } + } + if (!empty($index_rows)) { while(list($idx_name, $props) = each($index_rows)) { $props['column_names'] = ereg_replace(", $", "" , $props['column_name']); $index_create .= 'CREATE ' . $props['unique'] . " INDEX $idx_name ON $table (" . $props['column_names'] . ");$crlf"; - } // end while loop - } // end if(!empty($index_rows)) + } + } + if (!empty($primary_key)) { $schema_create .= " CONSTRAINT $primary_key_name PRIMARY KEY ($primary_key),$crlf"; - } // end if(!empty($primary_key)) .. + } + + // // Generate constraint clauses for CHECK constraints - $sql_checks = " - SELECT - rcname as index_name, - rcsrc - FROM - pg_relcheck, - pg_class bc - WHERE - rcrelid = bc.oid - and bc.relname = '$table' - and not exists - (select * from pg_relcheck as c, pg_inherits as i - where i.inhrelid = pg_relcheck.rcrelid - and c.rcname = pg_relcheck.rcname - and c.rcsrc = pg_relcheck.rcsrc - and c.rcrelid = i.inhparent) - "; + // + $sql_checks = "SELECT rcname as index_name, rcsrc + FROM pg_relcheck, pg_class bc + WHERE rcrelid = bc.oid + AND bc.relname = '$table' + AND NOT EXISTS ( + SELECT * + FROM pg_relcheck as c, pg_inherits as i + WHERE i.inhrelid = pg_relcheck.rcrelid + AND c.rcname = pg_relcheck.rcname + AND c.rcsrc = pg_relcheck.rcsrc + AND c.rcrelid = i.inhparent + )"; $result = $db->sql_query($sql_checks); + if (!$result) { $error = $db->sql_error(); message_die(GENERAL_ERROR, 'Failed in get_table_def (show fields) : ' . $error['message']); - } // end if(!$result)... + } + while ($row = $db->sql_fetchrow($result)) { $schema_create .= ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['rcsrc'] . ",$crlf"; - } // end while loop + } + $schema_create = ereg_replace(',' . $crlf . '$', '', $schema_create); $index_create = ereg_replace(',' . $crlf . '$', '', $index_create); $schema_create .= "$crlf);$crlf"; + if (!empty($index_create)) { $schema_create .= $index_create; - } // end if(!empty($index_create))... + } + return (stripslashes($schema_create)); -} // end function get_table_def_postgres() +} + +// // This function returns the "CREATE TABLE" syntax for mysql dbms... -function get_table_def_mysql($db, $table, $crlf) +// +function get_table_def_mysql($table, $crlf) { - global $drop; + global $drop, $db; + $schema_create = ""; $field_query = "SHOW FIELDS FROM $table"; $key_query = "SHOW KEYS FROM $table"; -// If the user has selected to drop existing tables when doing a restore. + + // + // If the user has selected to drop existing tables when doing a restore. // Then we add the statement to drop the tables.... + // if ($drop == 1) { $schema_create .= "DROP TABLE IF EXISTS $table;$crlf"; @@ -291,55 +352,71 @@ function get_table_def_mysql($db, $table, $crlf) $schema_create .= "CREATE TABLE $table($crlf"; + // // Ok lets grab the fields... + // $result = $db->sql_query($field_query); if(!result) { - $error = $db->sql_error(); - message_die(GENERAL_ERROR, 'Failed in get_table_def (show fields) : ' . $error['message']); + message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $field_query); } + while ($row = $db->sql_fetchrow($result)) { $schema_create .= ' ' . $row['Field'] . ' ' . $row['Type']; + if(!empty($row['Default'])) { $schema_create .= ' DEFAULT \'' . $row['Default'] . '\''; } + if($row['Null'] != "YES") { $schema_create .= ' NOT NULL'; } + if($row['Extra'] != "") { $schema_create .= ' ' . $row['Extra']; } + $schema_create .= ",$crlf"; } + // // Drop the last ',$crlf' off ;) + // $schema_create = ereg_replace(',' . $crlf . '$', "", $schema_create); + // // Get any Indexed fields from the database... + // $result = $db->sql_query($key_query); if(!$result) { - $error = $db->sql_error(); - message_die(GENERAL_ERROR, 'FAILED IN get_table_def (show keys) : ' . $error['message']); + message_die(GENERAL_ERROR, "FAILED IN get_table_def (show keys)", "", __LINE__, __FILE__, $key_query); } - while($row = $db->sql_fetchrow($result)) { + + while($row = $db->sql_fetchrow($result)) + { $kname = $row['Key_name']; + if(($kname != 'PRIMARY') && ($row['Non_unique'] == 0)) { $kname = "UNIQUE|$kname"; } + if(!is_array($index[$kname])) { $index[$kname] = array(); } + $index[$kname][] = $row['Column_name']; } + while(list($x, $columns) = @each($index)) { $schema_create .= ", $crlf"; + if($x == 'PRIMARY') { $schema_create .= ' PRIMARY KEY (' . implode($columns, ', ') . ')'; @@ -353,7 +430,9 @@ function get_table_def_mysql($db, $table, $crlf) $schema_create .= " KEY $x (" . implode($columns, ', ') . ')'; } } + $schema_create .= "$crlf);"; + if(get_magic_quotes_runtime()) { return(stripslashes($schema_create)); @@ -366,38 +445,46 @@ function get_table_def_mysql($db, $table, $crlf) } // End get_table_def_mysql -// This fuction will return a tables create definition to be used as an sql +// +// This fuction will return a tables create definition to be used as an sql // statement. - +// // // The following functions Get the data from the tables and format it as a // series of INSERT statements, for each different DBMS... // After every row a custom callback function $handler gets called. // $handler must accept one parameter ($sql_insert); // - +// // Here is the function for postgres... - -function get_table_content_postgres($db, $table, $handler) +// +function get_table_content_postgres($table, $handler) { + global $db; + $result = $db->sql_query("SELECT * FROM $table"); + if (!$result) { - $error = $db->sql_error(); - message_die(GENERAL_ERROR, 'Faild in get_table_content (select *): ' . $error['message']); - } // end if(!$result)... + message_die(GENERAL_ERROR, "Faild in get_table_content (select *)", "", __LINE__, __FILE__, "SELECT * FROM $table"); + } + $i_num_fields = $db->sql_numfields($result); + for ($i = 0; $i < $i_num_fields; $i++) { $aryType[] = $db->sql_fieldtype($i, $result); $aryName[] = $db->sql_fieldname($i, $result); - } // end for loop... + } + $iRec = 0; + while($row = $db->fetchrow($result)) { unset($schema_vals); unset($schema_fields); unset($schema_insert); + for($i = 0; $i < $i_num_fields; $i++) { $strVal = $row[$aryName[$i]]; @@ -406,7 +493,7 @@ function get_table_content_postgres($db, $table, $handler) $strQuote = "'"; $strEmpty = ""; $strVal = addslashes($strVal); - } // end if.. + } elseif (eregi("date|timestamp", $aryType[$i])) { if ($empty($strVal)) @@ -417,38 +504,49 @@ function get_table_content_postgres($db, $table, $handler) { $strQuote = "'"; } - } // end elseif ... + } else { $strQuote = ""; $strEmpty = "NULL"; - } // end else... + } + if (empty($strVal) && $strVal != "0") { $strVal = $strEmpty; } + $schema_vals .= " $strQuote$strVal$strQuote,"; $schema_fields .= " $aryName[$i],"; - } // end for loop .. + + } + $schema_vals = ereg_replace(",$", "", $schema_vals); $schema_vals = ereg_replace("^ ", "", $schema_vals); $schema_fields = ereg_replace(",$", "", $schema_fields); $schema_fields = ereg_replace("^ ", "", $schema_fields); + $schema_insert = "INSERT INTO $table ($schema_fields) VALUES($schema_vals);"; + $handler(trim($schema_insert)); - } // end while loop + } + return(true); + }// end function get_table_content_postgres... -function get_table_content_mysql($db, $table, $handler) +function get_table_content_mysql($table, $handler) { + global $db; + $result = $db->sql_query("SELECT * FROM $table"); - if(!$result) + + if (!$result) { - $error = $db->sql_error(); - message_die(GENERAL_ERROR, 'Failed in get_table_content (select *): ' . $error['message']); + message_die(GENERAL_ERROR, "Faild in get_table_content (select *)", "", __LINE__, __FILE__, "SELECT * FROM $table"); } + if($db->sql_numrows($result) > 0) { $schema_insert = "\n#\n# Table Data for $table\n#\n"; @@ -457,19 +555,24 @@ function get_table_content_mysql($db, $table, $handler) { $schema_insert = ""; } + $handler($schema_insert); + while ($row = $db->sql_fetchrow($result)) { $table_list = '('; $num_fields = $db->sql_numfields($result); + for ($j = 0; $j < $num_fields; $j++) { $table_list .= $db->sql_fieldname($j, $result) . ', '; } + $table_list = ereg_replace(', $', '', $table_list); $table_list .= ')'; $schema_insert = "INSERT INTO $table $table_list VALUES("; + for ($j = 0; $j < $num_fields; $j++) { if(!isset($row[$j])) @@ -485,9 +588,11 @@ function get_table_content_mysql($db, $table, $handler) $schema_insert .= '\'\','; } } + $schema_insert = ereg_replace(',$', '', $schema_insert); $schema_insert .= ');'; $handler(trim($schema_insert)); + } return(true); } @@ -495,39 +600,56 @@ function get_table_content_mysql($db, $table, $handler) function output_table_content($content) { global $backup_sql; + $backup_sql .= $content . "\n"; + return; } + // // remove_remarks will strip the sql comment lines out of an uploaded sql file // -function remove_remarks($sql) { - $i = 0; - while($i < strlen($sql)) { - if($sql[$i] == "#" and ($sql[$i-1] == "\n" or $i==0)) { - $j=1; - while($sql[$i+$j] != "\n") $j++; - $sql = substr($sql,0,$i) . substr($sql,$i+$j); - } - $i++; - } +function remove_remarks($sql) +{ + $i = 0; + + while($i < strlen($sql)) + { + if( $sql[$i] == "#" && ( $sql[$i-1] == "\n" || $i==0 ) ) + { + $j = 1; + + while( $sql[$i + $j] != "\n" ) + { + $j++; + } + $sql = substr($sql,0,$i) . substr($sql,$i+$j); + } + $i++; + } + return($sql); + } + // // split_sql_file will split an uploaded sql file into single sql statements. // -function split_sql_file($sql, $delimiter) { +function split_sql_file($sql, $delimiter) +{ $sql = trim($sql); $char = ""; $last_char = ""; $ret = array(); $in_string = true; - for($i=0; $i<strlen($sql); $i++) + for($i = 0; $i < strlen($sql); $i++) { $char = $sql[$i]; + // // if delimiter found, add the parsed part to the returned array + // if($char == $delimiter && !$in_string) { $ret[] = substr($sql, 0, $i); @@ -535,10 +657,12 @@ function split_sql_file($sql, $delimiter) { $i = 0; $last_char = ""; } + if($last_char == $in_string && $char == ")") { $in_string = false; } + if($char == $in_string && $last_char != "\\") { $in_string = false; @@ -547,106 +671,196 @@ function split_sql_file($sql, $delimiter) { { $in_string = $char; } + $last_char = $char; } + if (!empty($sql)) { $ret[] = $sql; } + return($ret); } - // // End Functions +// ------------- + +// +// Begin program proper // -if(isset($perform)) +if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) ) { + $perform = (isset($HTTP_POST_VARS['perform'])) ? $HTTP_POST_VARS['perform'] : $HTTP_GET_VARS['perform']; + switch($perform) { case 'backup': - if((DBMS == 'oracle') || (DBMS == 'odbc') || (DBMS == 'mssql')) + if( SQL_LAYER == 'oracle' || SQL_LAYER == 'odbc' || SQL_LAYER == 'mssql' ) { - $db_message = '<h2>Database backups are not currently supported for '; - $db_message .= 'your Database system (' . DBMS . ")</h2>\n"; - $db_links = '<br><a href="' . append_sid("index.$phpEx") . '">Return to admin</a>'; + // + // Page header + // + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + + switch(SQL_LAYER) + { + case 'oracle': + $db_type = "Oracle"; + break; + case 'ofbc': + $db_type = "ODBC"; + break; + case 'mssql': + $db_type = "MSSQL"; + break; + } + + $db_message = "<h2>Database backups are not currently supported for your Database system (" . $db_type . ")</h2>\n"; + $template->assign_vars(array( "U_DB_MESSAGE" => $db_message, - "U_DB_LINKS" => $db_links - )); + "U_DB_LINKS" => $db_links) + ); $template->pparse("body"); - exit; + + break; } - $tables = array('auth_access', 'auth_forums', 'banlist', 'categories', 'config', 'disallow', 'forum_access', 'forum_mods', 'forums', 'groups', 'posts', 'posts_text', 'privmsgs', 'ranks', 'session', 'session_keys', 'smilies', 'themes', 'themes_name', 'topics', 'user_group', 'users', 'words'); - if(!isset($additional_tables) && !empty($additional_tables)) + + $tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'session', 'smilies', 'themes', 'themes_name', 'topics', 'user_group', 'users', 'words'); + + $additional_tables = (isset($HTTP_POST_VARS['additional_tables'])) ? $HTTP_POST_VARS['additional_tables'] : ( (isset($HTTP_GET_VARS['additional_tables'])) ? $HTTP_GET_VARS['additional_tables'] : "" ); + $backup_type = (isset($HTTP_POST_VARS['backup_type'])) ? $HTTP_POST_VARS['backup_type'] : ( (isset($HTTP_GET_VARS['backup_type'])) ? $HTTP_GET_VARS['backup_type'] : "" ); + + if(!empty($additional_tables)) { - if(ereg(',', $additional_tables)) { - $additional_tables = split(',', $additional_tables); - foreach($additional_tables as $table_name) + if(ereg(",", $additional_tables)) + { + $additional_tables = split(",", $additional_tables); + + for($i = 0; $i < count($additional_tables); $i++) { - $tables[] = trim($table_name); + $tables[] = trim($additional_tables[$i]); } - } else + + } + else { - $tables[] = trim($table_name); + $tables[] = trim($additional_tables); } } - if(!isset($backupstart)) + + if( !isset($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart'])) { + // + // Page header + // + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + $db_message = "<H2>This will perform a backup of all phpBB2 related tables.</H2><BR>\n"; $db_message .= "<P>If you have any additional custom tables in the same database with phpBB that you would like to back up as well please enter their names seperated by commas in the Additional Tables textbox below.<BR>\n"; $db_message .= "Otherwise just select the form of backup you want to perform and click the Start Backup button below.</P><BR>\n\n"; $db_links = "<FORM METHOD=\"post\" ACTION=\"". append_sid($PHP_SELF) . "\">\n"; $db_links .= "<TABLE BORDER=0>\n"; - $db_links .= "<TR><TD>Additional Tables:</TD><TD><INPUT TYPE=\"text\" NAME=\"more_tables\"></TD></TR>\n"; - $db_links .= "<TR><TD>Full Backup:</TD><TD><INPUT TYPE=\"radio\" NAME=\"backup_type\" VALUE=\"full\" SELECTED></TD></TR>\n"; + $db_links .= "<TR><TD>Additional Tables:</TD><TD><INPUT TYPE=\"text\" NAME=\"additional_tables\"></TD></TR>\n"; + $db_links .= "<TR><TD>Full Backup:</TD><TD><INPUT TYPE=\"radio\" NAME=\"backup_type\" VALUE=\"full\" checked></TD></TR>\n"; $db_links .= "<TR><TD>Table Structure Only:</TD><TD><INPUT TYPE=\"radio\" NAME=\"backup_type\" VALUE=\"structure\"></TD></TR>\n"; $db_links .= "<TR><TD>Table Data Only:</TD><TD><INPUT TYPE=\"radio\" NAME=\"backup_type\" VALUE=\"data\"></TD></TR>\n"; $db_links .= "</TABLE><INPUT TYPE=\"hidden\" NAME=\"perform\" VALUE=\"backup\">\n"; $db_links .= "<INPUT TYPE=\"hidden\" NAME=\"drop\" VALUE=\"1\">"; - $db_links .= "<INPUT TYPE=\"submit\" NAME=\"backupstart\" VALUE=\"Start Backup\" ONCLICK=\"setTimeout('document.location=\'" . append_sid("$PHP_SELF?backup_done=1") . "\'', 2000);\"></FORM></P>\n"; + $db_links .= "<INPUT TYPE=\"submit\" NAME=\"backupstart\" VALUE=\"Start Backup\"></FORM></P>\n"; + + $template->assign_vars(array( + "U_DB_MESSAGE" => $db_message, + "U_DB_LINKS" => $db_links) + ); + $template->pparse("body"); + + break; + + } + else if( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) ) + { + // + // Page header + // + $template->assign_vars(array( + "META" => "<meta http-equiv=\"refresh\" content=\"0;url=admin_db_utilities.$phpEx?perform=backup&additional_tables=".quotemeta($additional_tables)."&backup_type=$backup_type&drop=1&backupstart=1&startdownload=1\">") + ); + + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + + $db_message = "<H2>Your backup file will start downloading soon</H2><br>\n"; + $template->assign_vars(array( "U_DB_MESSAGE" => $db_message, - "U_DB_LINKS" => $db_links - )); + "U_DB_LINKS" => $db_links) + ); + $template->pparse("body"); - exit; + + include('page_footer_admin.'.$phpEx); + } + + // // Build the sql script file... + // $backup_sql = "#\n"; $backup_sql .= "# phpBB Backup Script\n"; $backup_sql .= "# Dump of tables for $dbname\n"; $backup_sql .= "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n"; $backup_sql .= "#\n"; - if($dbms == 'postgres') + + if(SQL_LAYER == 'postgres') { - $backup_sql = "\n" . pg_get_sequences($db, "\n", $backup_type); + $backup_sql = "\n" . pg_get_sequences("\n", $backup_type); } + for($i = 0; $i < count($tables); $i++) { $table_name = $tables[$i]; - $table_def_function = "get_table_def_" . DBMS; - $table_content_function = "get_table_content_" . DBMS; + $table_def_function = "get_table_def_" . SQL_LAYER; + $table_content_function = "get_table_content_" . SQL_LAYER; + if($backup_type != 'data') { $backup_sql .= "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n"; - $backup_sql .= $table_def_function($db, $table_prefix . $table_name, "\n") . "\n"; + $backup_sql .= $table_def_function($table_prefix . $table_name, "\n") . "\n"; } + if($backup_type != 'structure') { - $table_content_function($db, $table_prefix . $table_name, "output_table_content"); + $table_content_function($table_prefix . $table_name, "output_table_content"); } } + + // // move forward with sending the file across... + // header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.sql\""); header("Content-disposition: attachment; filename=phpbb_db_backup.sql"); header("Pragma: no-cache"); - echo $backup_sql; + + echo $backup_sql; + exit; + break; + case 'restore': if(!isset($restore_start)) { + // + // Page header + // + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + $db_message = "<H2>This will perform a full restore of a previously Backed up phpBB database</H2><BR>\n"; $db_message .= "<P><b>WARNING: This will overwrite any existing data</b><br>\n"; $db_links = "<FORM ENCTYPE=\"multipart/form-data\" METHOD=\"post\" ACTION=\"" . append_sid($PHP_SELF) . "\">\n"; @@ -654,91 +868,101 @@ if(isset($perform)) $db_links .= "Backup File:<INPUT TYPE=\"file\" NAME=\"backup_file\">\n"; $db_links .= "<INPUT TYPE=\"submit\" NAME=\"restore_start\" VALUE=\"Start Restore\">\n"; $db_links .= "</FORM></P>\n"; + $template->assign_vars(array( "U_DB_MESSAGE" => $db_message, - "U_DB_LINKS" => $db_links - )); + "U_DB_LINKS" => $db_links) + ); $template->pparse("body"); - exit; - } else + + break; + + } + else { // Handle the file upload .... if($backup_file == "none") { - message_die(GENERAL_ERROR, 'Backup file upload failed...'); - exit; + message_die(GENERAL_ERROR, "Backup file upload failed"); } + if(ereg("^php[0-9A-Za-z_.-]+$", basename($backup_file))) { $sql_query = fread(fopen($backup_file, 'r'), filesize($backup_file)); - if(get_magic_quotes_runtime() == 1) - { - $sql_query = stripslashes($sql_query); - } - } else + $sql_query = stripslashes($sql_query); + } + else { - message_die(GENERAL_ERROR, 'Trouble Accessing uploaded file...'); - exit; + message_die(GENERAL_ERROR, "Trouble Accessing uploaded file"); } + $sql_query = trim($sql_query); + if($sql_query != "") { // Strip out sql comments... $sql_query = remove_remarks($sql_query); $pieces = split_sql_file($sql_query, ";"); + for($i = 0; $i < count($pieces); $i++) { $sql = trim($pieces[$i]); + if(!empty($sql) and $sql[0] != "#") { if(VERBOSE == 1) { echo "Executing: $sql\n<br>"; } + $result = $db->sql_query($sql); - if(!$result && (!(DBMS == 'postgres' && eregi("drop table", $sql)))) + + if(!$result && ( !(SQL_LAYER == 'postgres' && eregi("drop table", $sql) ) ) ) { - $error = $db->sql_error(); - message_die(GENERAL_ERROR, 'Error importing backup file : ' . $error['message'] . "\n$sql"); + message_die(GENERAL_ERROR, "Error importing backup file", "", __LINE__, __FILE__, $sql); } } } } + + // + // Page header + // + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + $db_message = "<CENTER><H2>The Database has been successfully restored..</H2>\n"; $db_message .= "<P><BR>Your board should be back to the state it was when the backup was made.<BR></P>\n"; - $db_links = '<A HREF="' . append_sid("index.$phpEx") . '">Go back to the Admin</A>'; + $template->assign_vars(array( "U_DB_MESSAGE" => $db_message, - "U_DB_LINKS" => $db_links - )); + "U_DB_LINKS" => $db_links) + ); + $template->pparse("body"); - exit; + break; } break; } } -elseif (isset($backup_done)) -{ - $db_message = "<H2>Your backup file should be downloading now</H2><br>\n"; - $db_links = "<A HREF=\"" . append_sid($PHP_SELF) . "\">Click Here to return to the Database Utilities</A><br>\n"; - $template->assign_vars(array( - "U_DB_MESSAGE" => $db_message, - "U_DB_LINKS" => $db_links - )); - $template->pparse("body"); - exit; -} else { + // + // Page header + // + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + $db_message = "<h2>These Utilties will help you to backup or restore your phpBB database</h2><br>\n"; - $db_links = "<TABLE ALIGN=\"center\"><TR><TD ALIGN=\"CENTER\"><H2>Database Utilities</H2></TD></TR>\n"; - $db_links .= "<TR><TD><A HREF=\"" . append_sid("$PHP_SELF?perform=backup") . "\">Backup Database</A></TD></TR>\n"; - $db_links .= "<TR><TD><A HREF=\"" . append_sid("$PHP_SELF?perform=restore") . "\">Restore Database</A></TD></TR></TABLE>\n"; + $template->assign_vars(array( "U_DB_MESSAGE" => $db_message, - "U_DB_LINKS" => $db_links - )); + "U_DB_LINKS" => $db_links) + ); + $template->pparse("body"); - exit; } -?> + +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 index b845f5143a..6562a3ca4e 100644 --- a/phpBB/admin/admin_forumauth.php +++ b/phpBB/admin/admin_forumauth.php @@ -1,9 +1,32 @@ <?php - -if($setmodules==1) +/*************************************************************************** + * 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. + * + * + ***************************************************************************/ + +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} - - 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 +$template_header = "admin/page_header.tpl"; +include('page_header_admin.'.$phpEx); - if(!empty($forum_id)) +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++) { - -?> -<h2>Forum : <?php echo $forum_rows[0]['forum_name']; ?></h2> -<?php - + $select_list .= "<option value=\"" . $forum_rows[$i]['forum_id'] . "\">" . $forum_rows[$i]['forum_name'] . "</option>"; } + $select_list .= "</select>"; -?> + $template->assign_vars(array( + "S_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), + "S_FORUMS_SELECT" => $select_list) + ); -<div align="center"><table cellspacing="1" cellpadding="4" border="0"> -<?php - - for($i = 0; $i < count($forum_rows); $i++) +} +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)) { - $forum_name[$i] = "<a href=\"" . append_sid("admin_forumauth.php?" . POST_FORUM_URL . "=" . $forum_rows[$i]['forum_id']) . "\">" . $forum_rows[$i]['forum_name'] . "</a>"; - - 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)) ? " <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> " : ""; - - } - - 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)) ? " <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> " : ""; + $matched = 0; } - } + if($matched) + break; } -?> - <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)) + // + // If we didn't get a match above then we + // automatically switch into 'advanced' mode + // + if($adv == -1 && !$matched) { - for($j = 0; $j < count($forum_auth_fields); $j++) - { - echo "<th bgcolor=\"#CCCCCC\">".preg_replace("/auth_/", "", $forum_auth_fields[$j])."</th>\n"; - } + $adv = 1; } -?> - </tr> -<?php + $s_column_span == 0; - for($i = 0; $i < count($forum_rows); $i++) + if( $adv <= 0 ) { + $simple_auth = " <select name=\"simpleauth\">"; - 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 .= "<option value=\"$j\" selected>"; + $simple_auth .= $simple_auth_types[$j]; + $simple_auth .= "</option>"; } - if(!($mods % 2) && $mods != 0) + else { - $moderators_links .= "<br>"; + $simple_auth .= "<option value=\"$j\">" . $simple_auth_types[$j] . "</option>"; } - $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>"; } - echo "<tr>\n"; - - if(empty($forum_id)) - { - echo "<td align=\"center\" bgcolor=\"#DDDDDD\">".$forum_name[$i]."</td>\n"; + $simple_auth .= "</select> "; - $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 "<td align=\"center\" bgcolor=\"#DDDDDD\">".$simple_auth[$i]."</td>\n"; - - $colspan ++; - } + $custom_auth[$j] = " <select name=\"" . $forum_auth_fields[$j] . "\">"; - if($adv == 1 || empty($forum_id)) - { - for($j = 0; $j < count($custom_auth[$i]); $j++) + for($k = 0; $k < count($forum_auth_levels); $k++) { - echo "<td align=\"center\" bgcolor=\"#DDDDDD\">".$custom_auth[$i][$j]."</td>\n"; - - $colspan++; + 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> "; - echo "</tr>\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 = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; - $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"> <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 + $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">'; - } + $template->assign_vars(array( + "FORUM_NAME" => $forum_name, -?> - </form></tr> -</table></div> + "U_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id"), + "U_SWITCH_MODE" => $u_switch_mode, -<?php + "S_COLUMN_SPAN" => $s_column_span, + "S_HIDDEN_FIELDS" => $s_hidden_fields) + ); + +} -?> -<center> -<p><a href="userauth.php">User Authorisation Admin</a></p> +$template->pparse("body"); -<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 © 2001 phpBB Group, All Rights Reserved</font> -<br> +include('page_footer_admin.'.$phpEx); -</body> -</html>
\ No newline at end of file +?>
\ No newline at end of file diff --git a/phpBB/admin/admin_groupauth.php b/phpBB/admin/admin_groupauth.php index e69aa3f637..aeea3f4cb3 100644 --- a/phpBB/admin/admin_groupauth.php +++ b/phpBB/admin/admin_groupauth.php @@ -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); ?>
\ No newline at end of file diff --git a/phpBB/admin/admin_userauth.php b/phpBB/admin/admin_userauth.php index fc4db47f13..147c15fc66 100644 --- a/phpBB/admin/admin_userauth.php +++ b/phpBB/admin/admin_userauth.php @@ -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; + $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; - } +else +{ + // + // Front end + // + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + $template->set_filenames(array( + "body" => "admin/ug_auth_body.tpl") + ); -// -// Front end -// - -$template->set_filenames(array( - "body" => "admin/ug_auth_body.tpl") -); - -$user_id = $HTTP_GET_VARS[POST_USERS_URL]; + // + // + // + $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); + $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); + $forum_access = $db->sql_fetchrowset($fa_result); -if($adv == -1) -{ - for($i = 0; $i < count($forum_access); $i++) + if($adv == -1) { - while(list($forum_id, $forum_row) = each($forum_access)) + for($i = 0; $i < count($forum_access); $i++) { - for($j = 0; $j < count($forum_auth_key_fields); $j++) + while(list($forum_id, $forum_row) = each($forum_access)) { - $basic_auth_level[$forum_row['forum_id']] = "public"; - - 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) + for($j = 0; $j < count($forum_auth_key_fields); $j++) { - $basic_auth_level[$forum_row['forum_id']] = "admin"; - $basic_auth_level_fields[$forum_row['forum_id']][] = $forum_auth_fields[$j]; + $basic_auth_level[$forum_row['forum_id']] = "public"; + + 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]; + } } } } - } - $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 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)) + $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) { - $u_access[$u_row['forum_id']][] = $u_row; - $num_forum_access[$u_row['forum_id']]++; + 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; + $is_admin = ($userinf[0]['user_level'] == ADMIN && $userinf[0]['user_id'] != ANONYMOUS) ? 1 : 0; - for($j = 0; $j < count($forum_auth_fields); $j++) + for($i = 0; $i < count($forum_access); $i++) { - $key = $forum_auth_fields[$j]; - $value = $forum_access[$i][$key]; + $f_forum_id = $forum_access[$i]['forum_id']; + $is_forum_restricted[$f_forum_id] = 0; - switch($value) + for($j = 0; $j < count($forum_auth_fields); $j++) { - case AUTH_ALL: - $auth_user[$f_forum_id][$key] = 1; - break; + $key = $forum_auth_fields[$j]; + $value = $forum_access[$i][$key]; - case AUTH_REG: - $auth_user[$f_forum_id][$key] = ($user_id != ANONYMOUS) ? 1 : 0; - break; + switch($value) + { + case AUTH_ALL: + $auth_user[$f_forum_id][$key] = 1; + 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_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_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; + case AUTH_ADMIN: + $auth_user[$f_forum_id][$key] = $is_admin; + break; - default: - $auth_user[$f_forum_id][$key] = 0; - 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; } } - // - // 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)) + while(list($forumkey, $user_ary) = each($auth_user)) { - $simple_auth[$forumkey] = $simple_auth[$forumkey] && $value; + $simple_auth[$forumkey] = 1; + while(list($fieldkey, $value) = each($user_ary)) + { + $simple_auth[$forumkey] = $simple_auth[$forumkey] && $value; + } } - } - reset($auth_user); + reset($auth_user); - $i = 0; - if($adv == -1) - { - while(list($forumkey, $user_ary) = each($auth_user)) + $i = 0; + if($adv == -1) { - if($basic_auth_level[$forumkey] == "private") + while(list($forumkey, $user_ary) = each($auth_user)) { - $allowed = 1; - for($j = 0; $j < count($basic_auth_level_fields[$forumkey]); $j++) + if($basic_auth_level[$forumkey] == "private") { - if(!$auth_user[$forumkey][$basic_auth_level_fields[$forumkey][$j]]) + $allowed = 1; + for($j = 0; $j < count($basic_auth_level_fields[$forumkey]); $j++) { - $allowed = 0; + 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>"; } - $optionlist_acl = "<select name=\"private[$forumkey]\">"; - if($is_admin || $user_ary['auth_mod']) + else { - $optionlist_acl .= "<option value=\"1\">Allowed Access</option>"; + $optionlist_acl = " "; } - else if($allowed) + + $optionlist_mod = "<select name=\"moderator[$forumkey]\">"; + if($user_ary['auth_mod']) { - $optionlist_acl .= "<option value=\"1\" selected>Allowed Access</option><option value=\"0\">Disallowed Access</option>"; + $optionlist_mod .= "<option value=\"1\" selected>Is a Moderator</option><option value=\"0\">Is not a Moderator</option>"; } else { - $optionlist_acl .= "<option value=\"1\">Allowed Access</option><option value=\"0\" selected>Disallowed Access</option>"; + $optionlist_mod .= "<option value=\"1\">Is a Moderator</option><option value=\"0\" selected>Is not a Moderator</option>"; } - $optionlist_acl .= "</select>"; - } - else - { - $optionlist_acl = " "; - } - - $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>"; - $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']) + for($i = 0; $i < count($userinf); $i++) { - $group_name[] = $userinf[$i]['group_name']; - $group_id[] = $userinf[$i]['group_id']; + 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++) + if(count($group_name)) { - $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 = ""; + for($i = 0; $i < count($userinf); $i++) { - $t_usergroup_list .= ", "; + $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"; - } + 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); ?>
\ No newline at end of file diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index 764205166f..6bdca81832 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -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/"); } +else if( $userdata['user_level'] != ADMIN ) +{ + message_die(GENERAL_MESSAGE, "You are not authorised to administer this board"); +} + // -// End Auth check +// Generate relevant output // - - - -if ($pane == 'top') +if( $HTTP_GET_VARS['pane'] == 'top' ) { - $page_title = $lang['View_topic'] ." - $topic_title"; - $pagetype = "viewtopic"; - include($phpbb_root_path . 'includes/page_header.'.$phpEx); + $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; } -?> +?>
\ No newline at end of file diff --git a/phpBB/admin/page_footer_admin.php b/phpBB/admin/page_footer_admin.php new file mode 100644 index 0000000000..6473c7b7f6 --- /dev/null +++ b/phpBB/admin/page_footer_admin.php @@ -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; + +?>
\ No newline at end of file diff --git a/phpBB/admin/page_header_admin.php b/phpBB/admin/page_header_admin.php new file mode 100644 index 0000000000..336af4ac08 --- /dev/null +++ b/phpBB/admin/page_header_admin.php @@ -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"); + +?>
\ No newline at end of file |