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 @@ 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() + } + return (stripslashes($schema_create)); + +} + +// // 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\n"; - $db_links = '
Return to admin'; + // + // 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 = "

Database backups are not currently supported for your Database system (" . $db_type . ")

\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) - { - $tables[] = trim($table_name); - } - } else + if(ereg(",", $additional_tables)) { - $tables[] = trim($table_name); + $additional_tables = split(",", $additional_tables); + + for($i = 0; $i < count($additional_tables); $i++) + { + $tables[] = trim($additional_tables[$i]); + } + + } + else + { + $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 = "

This will perform a backup of all phpBB2 related tables.


\n"; $db_message .= "

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.
\n"; $db_message .= "Otherwise just select the form of backup you want to perform and click the Start Backup button below.


\n\n"; $db_links = "
\n"; $db_links .= "\n"; - $db_links .= "\n"; - $db_links .= "\n"; + $db_links .= "\n"; + $db_links .= "\n"; $db_links .= "\n"; $db_links .= "\n"; $db_links .= "
Additional Tables:
Full Backup:
Additional Tables:
Full Backup:
Table Structure Only:
Table Data Only:
\n"; $db_links .= ""; - $db_links .= "

\n"; + $db_links .= "

\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; + } + else if( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) ) + { + // + // Page header + // + $template->assign_vars(array( + "META" => "") + ); + + $template_header = "admin/page_header.tpl"; + include('page_header_admin.'.$phpEx); + + $db_message = "

Your backup file will start downloading soon


\n"; + + $template->assign_vars(array( + "U_DB_MESSAGE" => $db_message, + "U_DB_LINKS" => $db_links) + ); + + $template->pparse("body"); + + 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 = "

This will perform a full restore of a previously Backed up phpBB database


\n"; $db_message .= "

WARNING: This will overwrite any existing data
\n"; $db_links = "

\n"; @@ -654,91 +868,101 @@ if(isset($perform)) $db_links .= "Backup File:\n"; $db_links .= "\n"; $db_links .= "

\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 - { - message_die(GENERAL_ERROR, 'Trouble Accessing uploaded file...'); - exit; + $sql_query = stripslashes($sql_query); } + else + { + 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
"; } + $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 = "

The Database has been successfully restored..

\n"; $db_message .= "


Your board should be back to the state it was when the backup was made.

\n"; - $db_links = 'Go back to the Admin'; + $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 = "

Your backup file should be downloading now


\n"; - $db_links = "Click Here to return to the Database Utilities
\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 = "

These Utilties will help you to backup or restore your phpBB database


\n"; - $db_links = "\n"; - $db_links .= "\n"; - $db_links .= "

Database Utilities

Backup Database
Restore Database
\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 @@ array(0, 0, 0, 0, 1, 0, 3, 3, 0, 0, 0), - 1 => array(0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3), - 2 => array(0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 1), - 3 => array(1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1), - 4 => array(0, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), - 5 => array(2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), - 6 => array(0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), - 7 => array(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), - 8 => array(0, 0, 3, 0, 0, 0, 3, 3, 3, 3, 3), - 9 => array(0, 0, 3, 1, 0, 0, 3, 3, 3, 3, 3) -);*/ - +// +// Check user permissions +// +if( !$userdata['session_logged_in'] ) +{ + header("Location: ../login.$phpEx?forward_page=/admin"); +} +else if( $userdata['user_level'] != ADMIN ) +{ + message_die(GENERAL_MESSAGE, "You are not authorised to administer this board"); +} +// +// Start program - define vars +// $simple_auth_ary = array( 0 => array(0, 0, 0, 0, 1, 0, 3, 3), 1 => array(0, 0, 0, 0, 3, 3, 3, 3), @@ -49,16 +73,30 @@ $simple_auth_ary = array( $simple_auth_types = array("Public", "Test Restricted", "Registered", "Registered [Hidden]", "Private", "Private [Hidden]", "Moderators", "Moderators [Hidden]", "Moderator Post + All Reply", "Moderator Post + Reg Reply"); - $forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce"); -//, "auth_votecreate", "auth_vote", "auth_attachments" $forum_auth_levels = array("ALL", "REG", "ACL", "MOD", "ADMIN"); $forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); +// Future Stuff +/*$simple_auth_ary = array( + 0 => array(0, 0, 0, 0, 1, 0, 3, 3, 0, 0, 0), + 1 => array(0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3), + 2 => array(0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 1), + 3 => array(1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1), + 4 => array(0, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), + 5 => array(2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2), + 6 => array(0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), + 7 => array(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), + 8 => array(0, 0, 3, 0, 0, 0, 3, 3, 3, 3, 3), + 9 => array(0, 0, 3, 1, 0, 0, 3, 3, 3, 3, 3) +);*/ +//, "auth_votecreate", "auth_vote", "auth_attachments" + if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL])) { $forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL]; + $forum_sql = "AND forum_id = $forum_id"; } else @@ -78,6 +116,8 @@ else if(isset($HTTP_POST_VARS['submit'])) { + $sql = ""; + if(!empty($forum_id)) { $sql = "UPDATE " . FORUMS_TABLE . " SET "; @@ -85,6 +125,7 @@ if(isset($HTTP_POST_VARS['submit'])) if(isset($HTTP_POST_VARS['simpleauth'])) { $simple_ary = $simple_auth_ary[$HTTP_POST_VARS['simpleauth']]; + for($i = 0; $i < count($simple_ary); $i++) { $sql .= $forum_auth_fields[$i] . " = " . $simple_ary[$i]; @@ -98,11 +139,10 @@ if(isset($HTTP_POST_VARS['submit'])) } else { - $sql = "UPDATE " . FORUMS_TABLE . " SET "; - for($i = 0; $i < count($forum_auth_fields); $i++) { $value = $HTTP_POST_VARS[$forum_auth_fields[$i]]; + if($forum_auth_fields[$i] != 'auth_view') { if($HTTP_POST_VARS['auth_view'] > $value) @@ -121,11 +161,11 @@ if(isset($HTTP_POST_VARS['submit'])) } - if(strlen($sql)) + if($sql != "") { if(!$db->sql_query($sql)) { - error_die(QUERY_ERROR, "Couldn't update auth table!", __LINE__, __FILE__); + message_die(GENERAL_ERROR, "Couldn't update auth table!", "", __LINE__, __FILE__, $sql); } } @@ -136,9 +176,10 @@ if(isset($HTTP_POST_VARS['submit'])) } } - // -// Start output +// Get required information, either all forums if +// no id was specified or just the requsted if it +// was // $sql = "SELECT f.* FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c @@ -146,280 +187,164 @@ $sql = "SELECT f.* $forum_sql ORDER BY c.cat_order ASC, f.forum_order ASC"; $f_result = $db->sql_query($sql); + $forum_rows = $db->sql_fetchrowset($f_result); // -// Show data +// Page header // -?> - - - -phpBB - auth testing - - - - -

Forum Authorisation Control

- - -

Forum :

- - -
-set_filenames(array( + "body" => "admin/forum_auth_select_body.tpl") + ); + $select_list = ""; - 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 = "  "; + + $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)) ? "  " : ""; - - } - - 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)) ? "  " : ""; - } - - } - } - -?> - - - - - -".preg_replace("/auth_/", "", $forum_auth_fields[$j])."\n"; + $custom_auth[$j] = "  "; + + $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++; } } -?> - -' . $switch_mode_text . ''; - for($i = 0; $i < count($forum_rows); $i++) - { + $s_hidden_fields = ''; - 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 .= "
"; - } - $moderators_links .= "" . $forum_mods['forum_'.$forum_rows[$i]['forum_id'] . '_name'][$mods] . ""; - } + $template->assign_vars(array( + "FORUM_NAME" => $forum_name, - echo "\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 "\n"; + "S_COLUMN_SPAN" => $s_column_span, + "S_HIDDEN_FIELDS" => $s_hidden_fields) + ); - $colspan = 2; - } +} - if($adv <= 0 || empty($forum_id)) - { - echo "\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 "\n"; - - $colspan++; - } - } - - echo "\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"; - -?> - - - - - -
Forum TitleSimple Auth
".$forum_name[$i]."".$simple_auth[$i]."".$custom_auth[$i][$j]."
- - - - - - - - - -
Switch to
  
Return to Forum Auth Index
- - -
-

User Authorisation Admin

- -Powered By phpBB 2.0 -
- -Copyright © 2001 phpBB Group, All Rights Reserved -
- - - \ 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 @@ 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 .= ""; + $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 @@ 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] . "
"; + 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 "
" . $chg_forum_id . " : " . $valid_auth_mod[$chg_forum_id] . "
"; -// echo $chg_forum_id . " : " . $valid_auth_mod[$chg_forum_id] . " : " . $u_access[$i]['auth_mod'] . "
"; - 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 . "
"; + + 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 .= ""; + $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 = ""; + if($is_admin || $user_ary['auth_mod']) + { + $optionlist_acl .= ""; + } + else if($allowed) + { + $optionlist_acl .= ""; + } + else + { + $optionlist_acl .= ""; + } + $optionlist_acl .= ""; } else { - $optionlist_acl .= ""; + $optionlist_acl = " "; } - $optionlist_acl .= ""; - } - else - { - $optionlist_acl = " "; - } - $optionlist_mod = ""; + $optionlist_mod = ""; - $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) ? '' : ''; + $t_username .= $userinf[0]['username']; + $s_user_type = ($is_admin) ? '' : ''; - 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 .= "" . $group_name[$i] . ""; - 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 .= "" . $group_name[$i] . ""; + if($i < count($group_name) - 1) + { + $t_usergroup_list .= ", "; + } + } + } + else + { + $t_usergroup_list = "None"; + } - $s_hidden_fields = ""; - $s_hidden_fields .= ""; + $s_hidden_fields = ""; + $s_hidden_fields .= ""; - $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/"); } -// -// 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 ""; $dir = opendir("."); @@ -73,62 +72,70 @@ elseif ($pane == 'left') } } + while( list($cat, $action_array) = each($module) ) + { + print "

$cat

\n"; + print "
    \n"; + + while( list($action, $file) = each($action_array) ) + { + print "
  • $action
  • \n"; + } + + print "
\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 - -?> - - -Admin - - - - - - - - - - - <body bgcolor="#FFFFFF"> - Sorry, your browser doesn't seem to support Frames.. -</body> - - - +?> \ 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 @@ +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("
phpBB Created this page in %f seconds : " . $db->num_queries . " queries executed : $gzip_text".$debug_mode."
", $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 @@ += "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 diff --git a/phpBB/templates/PSO/admin/forum_auth_body.tpl b/phpBB/templates/PSO/admin/forum_auth_body.tpl new file mode 100644 index 0000000000..b1a957378b --- /dev/null +++ b/phpBB/templates/PSO/admin/forum_auth_body.tpl @@ -0,0 +1,30 @@ +

Forum Authorisation Control

+ +

Here you can control individual authorisation levels for each forum. You can either choose a simple setting which has pre-defined levels for each discrete authorisation type, or you can set each type via the advanced settings.

+ +

Forum: {FORUM_NAME}

+ +
+ + + + + + + + + + + + + +
{forum_auth_titles.CELL_TITLE}
{forum_auth_data.S_AUTH_LEVELS_SELECT}
+ + + + + + +
{U_SWITCH_MODE}
{S_HIDDEN_FIELDS}  
+ +
diff --git a/phpBB/templates/PSO/admin/forum_auth_select_body.tpl b/phpBB/templates/PSO/admin/forum_auth_select_body.tpl new file mode 100644 index 0000000000..919c394dfb --- /dev/null +++ b/phpBB/templates/PSO/admin/forum_auth_select_body.tpl @@ -0,0 +1,13 @@ + +

Forum Authorisation Control

+ + + + + + + + +
Select a Forum
{S_FORUMS_SELECT}   
+ +
diff --git a/phpBB/templates/PSO/admin/overall_header.tpl b/phpBB/templates/PSO/admin/overall_header.tpl new file mode 100644 index 0000000000..d1a380b212 --- /dev/null +++ b/phpBB/templates/PSO/admin/overall_header.tpl @@ -0,0 +1,39 @@ + + + + +phpBB - {SITENAME} + + + + +
+ + + +
+ + + +
+ + + + +
phpBB2 : AdministrationGoto phpBB.com
+ + + \ No newline at end of file diff --git a/phpBB/templates/PSO/admin/page_footer.tpl b/phpBB/templates/PSO/admin/page_footer.tpl new file mode 100644 index 0000000000..803fc1ad5f --- /dev/null +++ b/phpBB/templates/PSO/admin/page_footer.tpl @@ -0,0 +1,27 @@ + + +
+Powered By phpBB 2.0 - alpha +
+This bulletin board software is copyright © 2001 phpBB Group, All Rights Reserved +
+ +
+ + + \ No newline at end of file diff --git a/phpBB/templates/PSO/admin/page_header.tpl b/phpBB/templates/PSO/admin/page_header.tpl new file mode 100644 index 0000000000..d15e8ae759 --- /dev/null +++ b/phpBB/templates/PSO/admin/page_header.tpl @@ -0,0 +1,37 @@ + + + +{META} + +phpBB - {SITENAME} + + + diff --git a/phpBB/templates/PSO/admin/ug_auth_body.tpl b/phpBB/templates/PSO/admin/ug_auth_body.tpl index 725308abc0..02c03bf67d 100644 --- a/phpBB/templates/PSO/admin/ug_auth_body.tpl +++ b/phpBB/templates/PSO/admin/ug_auth_body.tpl @@ -1,41 +1,3 @@ - - - -phpBB - auth testing - - - -

{L_USER_OR_GROUP} Authorisation Control

@@ -45,7 +7,7 @@ function open_new_window(strURL){

{USER_GROUP_MEMBERSHIPS}

-

Access to Forums

+

Access to Forums

Remember that there are two possible places for controlling access to forums, user and group auth control. Removing access rights from a user will not affect any rights granted via group membership. You will be warned if you remove access rights from a user (or group) but access is still granted via membership of a group (or via individual user rights)

@@ -69,19 +31,3 @@ function open_new_window(strURL){ - -
- -

{L_USER_OR_GROUP} Authorisation Admin

-

Forum Authorisation Admin

- -Powered By phpBB 2.0 - -
- - -Copyright © 2001 phpBB Group, All Rights Reserved -
- - - \ No newline at end of file diff --git a/phpBB/templates/PSO/admin/ug_auth_select_body.tpl b/phpBB/templates/PSO/admin/ug_auth_select_body.tpl index 30850a834f..a4254ee79d 100644 --- a/phpBB/templates/PSO/admin/ug_auth_select_body.tpl +++ b/phpBB/templates/PSO/admin/ug_auth_select_body.tpl @@ -1,45 +1,13 @@ - - - -phpBB - auth testing - - -

{L_USER_OR_GROUP} Authorisation Control

- + - +
Select a {L_USER_OR_GROUP}Select a {L_USER_OR_GROUP}
{S_USERS_SELECT}   {S_USERS_SELECT}   
-
-

Forum Authorisation Admin

- -Powered By phpBB 2.0
- -Copyright © 2001 phpBB Group, All Rights Reserved -
- - -