[phc-internals] svn commit by paul
svn at phpcompiler.org
svn at phpcompiler.org
Sat Jan 28 18:47:51 GMT 2006
replaced phpBB2 tests with the same within a proper directory structure
# Changed
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_board.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_db_utilities.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_disallow.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forum_prune.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forumauth.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forums.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_groups.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_mass_email.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_ranks.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_smilies.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_styles.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_ug_auth.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_user_ban.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_users.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_words.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/index.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/page_footer_admin.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/page_header_admin.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/pagestart.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_board.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_db_utilities.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_disallow.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_forum_prune.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_forumauth.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_forums.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_groups.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_mass_email.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_ranks.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_smilies.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_styles.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_ug_auth.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_user_ban.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_users.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin_words.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/auth.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/bbcode.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/common.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/common.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/config.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/config.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/constants.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/contrib/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/contrib/dbinformer.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/contrib/template_db_cache.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/contrib/template_file_cache.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/db2.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/msaccess.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/mssql-odbc.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/mssql.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/mysql.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/mysql4.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db/postgres7.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/db2.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/dbinformer.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/emailer.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/faq.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/faq.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/functions.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/functions_admin.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/functions_post.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/functions_search.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/functions_selects.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/functions_validate.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/groupcp.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/groupcp.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/images/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/images/avatars/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/auth.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/bbcode.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/constants.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/db.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/emailer.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/functions.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/functions_admin.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/functions_post.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/functions_search.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/functions_selects.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/functions_validate.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/page_header.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/page_tail.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/prune.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/sessions.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/smtp.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/sql_parse.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/template.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/topic_review.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/usercp_activate.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/usercp_avatar.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/usercp_confirm.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/usercp_email.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/usercp_register.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/usercp_sendpasswd.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/includes/usercp_viewprofile.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/index.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/index.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/install/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/install/install.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/install/update_to_latest.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/install/upgrade.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/install.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/lang_admin.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/lang_bbcode.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/lang_faq.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/lang_main.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/language/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/language/lang_english/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/language/lang_english/lang_admin.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/language/lang_english/lang_bbcode.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/language/lang_english/lang_faq.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/language/lang_english/lang_main.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/login.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/login.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/memberlist.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/memberlist.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/modcp.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/modcp.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/msaccess.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/mssql-odbc.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/mssql.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/mysql.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/mysql4.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/page_footer_admin.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/page_header.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/page_header_admin.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/page_tail.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/pagestart.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/postgres7.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/posting.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/posting.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/privmsg.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/privmsg.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/profile.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/profile.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/prune.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/search.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/search.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/sessions.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/smtp.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/sql_parse.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/template.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/template_db_cache.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/template_file_cache.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/templates/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/templates/subSilver/
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/templates/subSilver/images/
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/topic_review.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/update_to_latest.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/upgrade.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/usercp_activate.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/usercp_avatar.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/usercp_confirm.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/usercp_email.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/usercp_register.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/usercp_sendpasswd.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/usercp_viewprofile.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/viewforum.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/viewforum.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/viewonline.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/viewonline.php
D phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/viewtopic.php
A phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/viewtopic.php
# Diff
Added: phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_board.php
===================================================================
--- phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_board.php 2006-01-28 18:43:23 UTC (rev 660)
+++ phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_board.php 2006-01-28 18:47:25 UTC (rev 661)
@@ -0,0 +1,346 @@
+<?php
+/***************************************************************************
+ * admin_board.php
+ * -------------------
+ * begin : Thursday, Jul 12, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support at phpbb.com
+ *
+ * $Id: admin_board.php,v 1.51.2.13 2005/12/29 11:51:11 acydburn Exp $
+ *
+ *
+ ***************************************************************************/
+
+define('IN_PHPBB', 1);
+
+if( !empty($setmodules) )
+{
+ $file = basename(__FILE__);
+ $module['General']['Configuration'] = $file;
+ return;
+}
+
+//
+// Let's set the root dir for phpBB
+//
+$phpbb_root_path = "./../";
+require($phpbb_root_path . 'extension.inc');
+require('./pagestart.' . $phpEx);
+include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
+
+//
+// Pull all config data
+//
+$sql = "SELECT *
+ FROM " . CONFIG_TABLE;
+if(!$result = $db->sql_query($sql))
+{
+ message_die(CRITICAL_ERROR, "Could not query config information in admin_board", "", __LINE__, __FILE__, $sql);
+}
+else
+{
+ while( $row = $db->sql_fetchrow($result) )
+ {
+ $config_name = $row['config_name'];
+ $config_value = $row['config_value'];
+ $default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value;
+
+ $new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];
+
+ if ($config_name == 'cookie_name')
+ {
+ $cookie_name = str_replace('.', '_', $new['cookie_name']);
+ }
+
+ if( isset($HTTP_POST_VARS['submit']) )
+ {
+ $sql = "UPDATE " . CONFIG_TABLE . " SET
+ config_value = '" . str_replace("\'", "''", $new[$config_name]) . "'
+ WHERE config_name = '$config_name'";
+ if( !$db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Failed to update general configuration for $config_name", "", __LINE__, __FILE__, $sql);
+ }
+ }
+ }
+
+ if( isset($HTTP_POST_VARS['submit']) )
+ {
+ $message = $lang['Config_updated'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid("admin_board.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+ }
+}
+
+$style_select = style_select($new['default_style'], 'default_style', "../templates");
+$lang_select = language_select($new['default_lang'], 'default_lang', "language");
+$timezone_select = tz_select($new['board_timezone'], 'board_timezone');
+
+$disable_board_yes = ( $new['board_disable'] ) ? "checked=\"checked\"" : "";
+$disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";
+
+$cookie_secure_yes = ( $new['cookie_secure'] ) ? "checked=\"checked\"" : "";
+$cookie_secure_no = ( !$new['cookie_secure'] ) ? "checked=\"checked\"" : "";
+
+$html_tags = $new['allow_html_tags'];
+
+$override_user_style_yes = ( $new['override_user_style'] ) ? "checked=\"checked\"" : "";
+$override_user_style_no = ( !$new['override_user_style'] ) ? "checked=\"checked\"" : "";
+
+$html_yes = ( $new['allow_html'] ) ? "checked=\"checked\"" : "";
+$html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : "";
+
+$bbcode_yes = ( $new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
+$bbcode_no = ( !$new['allow_bbcode'] ) ? "checked=\"checked\"" : "";
+
+$activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? "checked=\"checked\"" : "";
+$activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : "";
+$activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? "checked=\"checked\"" : "";
+
+$confirm_yes = ($new['enable_confirm']) ? 'checked="checked"' : '';
+$confirm_no = (!$new['enable_confirm']) ? 'checked="checked"' : '';
+
+$allow_autologin_yes = ($new['allow_autologin']) ? 'checked="checked"' : '';
+$allow_autologin_no = (!$new['allow_autologin']) ? 'checked="checked"' : '';
+
+$board_email_form_yes = ( $new['board_email_form'] ) ? "checked=\"checked\"" : "";
+$board_email_form_no = ( !$new['board_email_form'] ) ? "checked=\"checked\"" : "";
+
+$gzip_yes = ( $new['gzip_compress'] ) ? "checked=\"checked\"" : "";
+$gzip_no = ( !$new['gzip_compress'] ) ? "checked=\"checked\"" : "";
+
+$privmsg_on = ( !$new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
+$privmsg_off = ( $new['privmsg_disable'] ) ? "checked=\"checked\"" : "";
+
+$prune_yes = ( $new['prune_enable'] ) ? "checked=\"checked\"" : "";
+$prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : "";
+
+$smile_yes = ( $new['allow_smilies'] ) ? "checked=\"checked\"" : "";
+$smile_no = ( !$new['allow_smilies'] ) ? "checked=\"checked\"" : "";
+
+$sig_yes = ( $new['allow_sig'] ) ? "checked=\"checked\"" : "";
+$sig_no = ( !$new['allow_sig'] ) ? "checked=\"checked\"" : "";
+
+$namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : "";
+$namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";
+
+$avatars_local_yes = ( $new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
+$avatars_local_no = ( !$new['allow_avatar_local'] ) ? "checked=\"checked\"" : "";
+$avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
+$avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? "checked=\"checked\"" : "";
+$avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
+$avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? "checked=\"checked\"" : "";
+
+$smtp_yes = ( $new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
+$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
+
+$template->set_filenames(array(
+ "body" => "admin/board_config_body.tpl")
+);
+
+//
+// Escape any quotes in the site description for proper display in the text
+// box on the admin page
+//
+$new['site_desc'] = str_replace('"', '"', $new['site_desc']);
+$new['sitename'] = str_replace('"', '"', strip_tags($new['sitename']));
+$template->assign_vars(array(
+ "S_CONFIG_ACTION" => append_sid("admin_board.$phpEx"),
+
+ "L_YES" => $lang['Yes'],
+ "L_NO" => $lang['No'],
+ "L_CONFIGURATION_TITLE" => $lang['General_Config'],
+ "L_CONFIGURATION_EXPLAIN" => $lang['Config_explain'],
+ "L_GENERAL_SETTINGS" => $lang['General_settings'],
+ "L_SERVER_NAME" => $lang['Server_name'],
+ "L_SERVER_NAME_EXPLAIN" => $lang['Server_name_explain'],
+ "L_SERVER_PORT" => $lang['Server_port'],
+ "L_SERVER_PORT_EXPLAIN" => $lang['Server_port_explain'],
+ "L_SCRIPT_PATH" => $lang['Script_path'],
+ "L_SCRIPT_PATH_EXPLAIN" => $lang['Script_path_explain'],
+ "L_SITE_NAME" => $lang['Site_name'],
+ "L_SITE_DESCRIPTION" => $lang['Site_desc'],
+ "L_DISABLE_BOARD" => $lang['Board_disable'],
+ "L_DISABLE_BOARD_EXPLAIN" => $lang['Board_disable_explain'],
+ "L_ACCT_ACTIVATION" => $lang['Acct_activation'],
+ "L_NONE" => $lang['Acc_None'],
+ "L_USER" => $lang['Acc_User'],
+ "L_ADMIN" => $lang['Acc_Admin'],
+ "L_VISUAL_CONFIRM" => $lang['Visual_confirm'],
+ "L_VISUAL_CONFIRM_EXPLAIN" => $lang['Visual_confirm_explain'],
+ "L_ALLOW_AUTOLOGIN" => $lang['Allow_autologin'],
+ "L_ALLOW_AUTOLOGIN_EXPLAIN" => $lang['Allow_autologin_explain'],
+ "L_AUTOLOGIN_TIME" => $lang['Autologin_time'],
+ "L_AUTOLOGIN_TIME_EXPLAIN" => $lang['Autologin_time_explain'],
+ "L_COOKIE_SETTINGS" => $lang['Cookie_settings'],
+ "L_COOKIE_SETTINGS_EXPLAIN" => $lang['Cookie_settings_explain'],
+ "L_COOKIE_DOMAIN" => $lang['Cookie_domain'],
+ "L_COOKIE_NAME" => $lang['Cookie_name'],
+ "L_COOKIE_PATH" => $lang['Cookie_path'],
+ "L_COOKIE_SECURE" => $lang['Cookie_secure'],
+ "L_COOKIE_SECURE_EXPLAIN" => $lang['Cookie_secure_explain'],
+ "L_SESSION_LENGTH" => $lang['Session_length'],
+ "L_PRIVATE_MESSAGING" => $lang['Private_Messaging'],
+ "L_INBOX_LIMIT" => $lang['Inbox_limits'],
+ "L_SENTBOX_LIMIT" => $lang['Sentbox_limits'],
+ "L_SAVEBOX_LIMIT" => $lang['Savebox_limits'],
+ "L_DISABLE_PRIVATE_MESSAGING" => $lang['Disable_privmsg'],
+ "L_ENABLED" => $lang['Enabled'],
+ "L_DISABLED" => $lang['Disabled'],
+ "L_ABILITIES_SETTINGS" => $lang['Abilities_settings'],
+ "L_MAX_POLL_OPTIONS" => $lang['Max_poll_options'],
+ "L_FLOOD_INTERVAL" => $lang['Flood_Interval'],
+ "L_FLOOD_INTERVAL_EXPLAIN" => $lang['Flood_Interval_explain'],
+
+ 'L_MAX_LOGIN_ATTEMPTS' => $lang['Max_login_attempts'],
+ 'L_MAX_LOGIN_ATTEMPTS_EXPLAIN' => $lang['Max_login_attempts_explain'],
+ 'L_LOGIN_RESET_TIME' => $lang['Login_reset_time'],
+ 'L_LOGIN_RESET_TIME_EXPLAIN' => $lang['Login_reset_time_explain'],
+ 'MAX_LOGIN_ATTEMPTS' => $new['max_login_attempts'],
+ 'LOGIN_RESET_TIME' => $new['login_reset_time'],
+
+ "L_BOARD_EMAIL_FORM" => $lang['Board_email_form'],
+ "L_BOARD_EMAIL_FORM_EXPLAIN" => $lang['Board_email_form_explain'],
+ "L_TOPICS_PER_PAGE" => $lang['Topics_per_page'],
+ "L_POSTS_PER_PAGE" => $lang['Posts_per_page'],
+ "L_HOT_THRESHOLD" => $lang['Hot_threshold'],
+ "L_DEFAULT_STYLE" => $lang['Default_style'],
+ "L_OVERRIDE_STYLE" => $lang['Override_style'],
+ "L_OVERRIDE_STYLE_EXPLAIN" => $lang['Override_style_explain'],
+ "L_DEFAULT_LANGUAGE" => $lang['Default_language'],
+ "L_DATE_FORMAT" => $lang['Date_format'],
+ "L_SYSTEM_TIMEZONE" => $lang['System_timezone'],
+ "L_ENABLE_GZIP" => $lang['Enable_gzip'],
+ "L_ENABLE_PRUNE" => $lang['Enable_prune'],
+ "L_ALLOW_HTML" => $lang['Allow_HTML'],
+ "L_ALLOW_BBCODE" => $lang['Allow_BBCode'],
+ "L_ALLOWED_TAGS" => $lang['Allowed_tags'],
+ "L_ALLOWED_TAGS_EXPLAIN" => $lang['Allowed_tags_explain'],
+ "L_ALLOW_SMILIES" => $lang['Allow_smilies'],
+ "L_SMILIES_PATH" => $lang['Smilies_path'],
+ "L_SMILIES_PATH_EXPLAIN" => $lang['Smilies_path_explain'],
+ "L_ALLOW_SIG" => $lang['Allow_sig'],
+ "L_MAX_SIG_LENGTH" => $lang['Max_sig_length'],
+ "L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'],
+ "L_ALLOW_NAME_CHANGE" => $lang['Allow_name_change'],
+ "L_AVATAR_SETTINGS" => $lang['Avatar_settings'],
+ "L_ALLOW_LOCAL" => $lang['Allow_local'],
+ "L_ALLOW_REMOTE" => $lang['Allow_remote'],
+ "L_ALLOW_REMOTE_EXPLAIN" => $lang['Allow_remote_explain'],
+ "L_ALLOW_UPLOAD" => $lang['Allow_upload'],
+ "L_MAX_FILESIZE" => $lang['Max_filesize'],
+ "L_MAX_FILESIZE_EXPLAIN" => $lang['Max_filesize_explain'],
+ "L_MAX_AVATAR_SIZE" => $lang['Max_avatar_size'],
+ "L_MAX_AVATAR_SIZE_EXPLAIN" => $lang['Max_avatar_size_explain'],
+ "L_AVATAR_STORAGE_PATH" => $lang['Avatar_storage_path'],
+ "L_AVATAR_STORAGE_PATH_EXPLAIN" => $lang['Avatar_storage_path_explain'],
+ "L_AVATAR_GALLERY_PATH" => $lang['Avatar_gallery_path'],
+ "L_AVATAR_GALLERY_PATH_EXPLAIN" => $lang['Avatar_gallery_path_explain'],
+ "L_COPPA_SETTINGS" => $lang['COPPA_settings'],
+ "L_COPPA_FAX" => $lang['COPPA_fax'],
+ "L_COPPA_MAIL" => $lang['COPPA_mail'],
+ "L_COPPA_MAIL_EXPLAIN" => $lang['COPPA_mail_explain'],
+ "L_EMAIL_SETTINGS" => $lang['Email_settings'],
+ "L_ADMIN_EMAIL" => $lang['Admin_email'],
+ "L_EMAIL_SIG" => $lang['Email_sig'],
+ "L_EMAIL_SIG_EXPLAIN" => $lang['Email_sig_explain'],
+ "L_USE_SMTP" => $lang['Use_SMTP'],
+ "L_USE_SMTP_EXPLAIN" => $lang['Use_SMTP_explain'],
+ "L_SMTP_SERVER" => $lang['SMTP_server'],
+ "L_SMTP_USERNAME" => $lang['SMTP_username'],
+ "L_SMTP_USERNAME_EXPLAIN" => $lang['SMTP_username_explain'],
+ "L_SMTP_PASSWORD" => $lang['SMTP_password'],
+ "L_SMTP_PASSWORD_EXPLAIN" => $lang['SMTP_password_explain'],
+ "L_SUBMIT" => $lang['Submit'],
+ "L_RESET" => $lang['Reset'],
+
+ "SERVER_NAME" => $new['server_name'],
+ "SCRIPT_PATH" => $new['script_path'],
+ "SERVER_PORT" => $new['server_port'],
+ "SITENAME" => $new['sitename'],
+ "SITE_DESCRIPTION" => $new['site_desc'],
+ "S_DISABLE_BOARD_YES" => $disable_board_yes,
+ "S_DISABLE_BOARD_NO" => $disable_board_no,
+ "ACTIVATION_NONE" => USER_ACTIVATION_NONE,
+ "ACTIVATION_NONE_CHECKED" => $activation_none,
+ "ACTIVATION_USER" => USER_ACTIVATION_SELF,
+ "ACTIVATION_USER_CHECKED" => $activation_user,
+ "ACTIVATION_ADMIN" => USER_ACTIVATION_ADMIN,
+ "ACTIVATION_ADMIN_CHECKED" => $activation_admin,
+ "CONFIRM_ENABLE" => $confirm_yes,
+ "CONFIRM_DISABLE" => $confirm_no,
+ 'ALLOW_AUTOLOGIN_YES' => $allow_autologin_yes,
+ 'ALLOW_AUTOLOGIN_NO' => $allow_autologin_no,
+ 'AUTOLOGIN_TIME' => (int) $new['max_autologin_time'],
+ "BOARD_EMAIL_FORM_ENABLE" => $board_email_form_yes,
+ "BOARD_EMAIL_FORM_DISABLE" => $board_email_form_no,
+ "MAX_POLL_OPTIONS" => $new['max_poll_options'],
+ "FLOOD_INTERVAL" => $new['flood_interval'],
+ "TOPICS_PER_PAGE" => $new['topics_per_page'],
+ "POSTS_PER_PAGE" => $new['posts_per_page'],
+ "HOT_TOPIC" => $new['hot_threshold'],
+ "STYLE_SELECT" => $style_select,
+ "OVERRIDE_STYLE_YES" => $override_user_style_yes,
+ "OVERRIDE_STYLE_NO" => $override_user_style_no,
+ "LANG_SELECT" => $lang_select,
+ "L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'],
+ "DEFAULT_DATEFORMAT" => $new['default_dateformat'],
+ "TIMEZONE_SELECT" => $timezone_select,
+ "S_PRIVMSG_ENABLED" => $privmsg_on,
+ "S_PRIVMSG_DISABLED" => $privmsg_off,
+ "INBOX_LIMIT" => $new['max_inbox_privmsgs'],
+ "SENTBOX_LIMIT" => $new['max_sentbox_privmsgs'],
+ "SAVEBOX_LIMIT" => $new['max_savebox_privmsgs'],
+ "COOKIE_DOMAIN" => $new['cookie_domain'],
+ "COOKIE_NAME" => $new['cookie_name'],
+ "COOKIE_PATH" => $new['cookie_path'],
+ "SESSION_LENGTH" => $new['session_length'],
+ "S_COOKIE_SECURE_ENABLED" => $cookie_secure_yes,
+ "S_COOKIE_SECURE_DISABLED" => $cookie_secure_no,
+ "GZIP_YES" => $gzip_yes,
+ "GZIP_NO" => $gzip_no,
+ "PRUNE_YES" => $prune_yes,
+ "PRUNE_NO" => $prune_no,
+ "HTML_TAGS" => $html_tags,
+ "HTML_YES" => $html_yes,
+ "HTML_NO" => $html_no,
+ "BBCODE_YES" => $bbcode_yes,
+ "BBCODE_NO" => $bbcode_no,
+ "SMILE_YES" => $smile_yes,
+ "SMILE_NO" => $smile_no,
+ "SIG_YES" => $sig_yes,
+ "SIG_NO" => $sig_no,
+ "SIG_SIZE" => $new['max_sig_chars'],
+ "NAMECHANGE_YES" => $namechange_yes,
+ "NAMECHANGE_NO" => $namechange_no,
+ "AVATARS_LOCAL_YES" => $avatars_local_yes,
+ "AVATARS_LOCAL_NO" => $avatars_local_no,
+ "AVATARS_REMOTE_YES" => $avatars_remote_yes,
+ "AVATARS_REMOTE_NO" => $avatars_remote_no,
+ "AVATARS_UPLOAD_YES" => $avatars_upload_yes,
+ "AVATARS_UPLOAD_NO" => $avatars_upload_no,
+ "AVATAR_FILESIZE" => $new['avatar_filesize'],
+ "AVATAR_MAX_HEIGHT" => $new['avatar_max_height'],
+ "AVATAR_MAX_WIDTH" => $new['avatar_max_width'],
+ "AVATAR_PATH" => $new['avatar_path'],
+ "AVATAR_GALLERY_PATH" => $new['avatar_gallery_path'],
+ "SMILIES_PATH" => $new['smilies_path'],
+ "INBOX_PRIVMSGS" => $new['max_inbox_privmsgs'],
+ "SENTBOX_PRIVMSGS" => $new['max_sentbox_privmsgs'],
+ "SAVEBOX_PRIVMSGS" => $new['max_savebox_privmsgs'],
+ "EMAIL_FROM" => $new['board_email'],
+ "EMAIL_SIG" => $new['board_email_sig'],
+ "SMTP_YES" => $smtp_yes,
+ "SMTP_NO" => $smtp_no,
+ "SMTP_HOST" => $new['smtp_host'],
+ "SMTP_USERNAME" => $new['smtp_username'],
+ "SMTP_PASSWORD" => $new['smtp_password'],
+ "COPPA_MAIL" => $new['coppa_mail'],
+ "COPPA_FAX" => $new['coppa_fax'])
+);
+
+$template->pparse("body");
+
+include('./page_footer_admin.'.$phpEx);
+
+?>
Added: phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_db_utilities.php
===================================================================
--- phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_db_utilities.php 2006-01-28 18:43:23 UTC (rev 660)
+++ phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_db_utilities.php 2006-01-28 18:47:25 UTC (rev 661)
@@ -0,0 +1,1008 @@
+<?php
+/***************************************************************************
+* admin_db_utilities.php
+* -------------------
+* begin : Thu May 31, 2001
+* copyright : (C) 2001 The phpBB Group
+* email : support at phpbb.com
+*
+* $Id: admin_db_utilities.php,v 1.42.2.12 2005/11/05 21:18:12 grahamje Exp $
+*
+****************************************************************************/
+
+/***************************************************************************
+ *
+ * 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.
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+* We will attempt to create a file based backup of all of the data in the
+* users phpBB database. The resulting file should be able to be imported by
+* the db_restore.php function, or by using the mysql command_line
+*
+* Some functions are adapted from the upgrade_20.php script and others
+* adapted from the unoficial phpMyAdmin 2.2.0.
+***************************************************************************/
+
+define('IN_PHPBB', 1);
+
+if( !empty($setmodules) )
+{
+ $filename = basename(__FILE__);
+ $module['General']['Backup_DB'] = $filename . "?perform=backup";
+
+ $file_uploads = (@phpversion() >= '4.0.0') ? @ini_get('file_uploads') : @get_cfg_var('file_uploads');
+
+ if( (empty($file_uploads) || $file_uploads != 0) && (strtolower($file_uploads) != 'off') && (@phpversion() != '4.0.4pl1') )
+ {
+ $module['General']['Restore_DB'] = $filename . "?perform=restore";
+ }
+
+ return;
+}
+
+//
+// Load default header
+//
+$no_page_header = TRUE;
+$phpbb_root_path = "./../";
+require($phpbb_root_path . 'extension.inc');
+require('./pagestart.' . $phpEx);
+include($phpbb_root_path . 'includes/sql_parse.'.$phpEx);
+
+//
+// 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.
+//
+ at set_time_limit(1200);
+
+// -----------------------
+// The following functions are adapted from phpMyAdmin and upgrade_20.php
+//
+function gzip_PrintFourChars($Val)
+{
+ for ($i = 0; $i < 4; $i ++)
+ {
+ $return .= chr($Val % 256);
+ $Val = floor($Val / 256);
+ }
+ return $return;
+}
+
+
+
+//
+// This function is used for grabbing the sequences for postgres...
+//
+function pg_get_sequences($crlf, $backup_type)
+{
+ 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) )
+ {
+
+ $return_val = "# No Sequences Found $crlf";
+
+ }
+ else
+ {
+ $return_val = "# Sequences $crlf";
+ $i_seq = 0;
+
+ while($i_seq < $num_seq)
+ {
+ $row = $db->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_postgresql($table, $crlf)
+{
+ global $drop, $db;
+
+ $schema_create = "";
+ //
+ // Get a listing of the fields, with their associated types, etc.
+ //
+
+ $field_query = "SELECT a.attnum, a.attname AS field, t.typname 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.atttypid = t.oid
+ ORDER BY a.attnum";
+ $result = $db->sql_query($field_query);
+
+ if(!$result)
+ {
+ message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $field_query);
+ } // end if..
+
+ if ($drop == 1)
+ {
+ $schema_create .= "DROP TABLE $table;$crlf";
+ } // end if
+
+ //
+ // Ok now we actually start building the SQL statements to restore the tables
+ //
+
+ $schema_create .= "CREATE TABLE $table($crlf";
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ //
+ // Get the data from the table
+ //
+ $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'];
+ $def_res = $db->sql_query($sql_get_default);
+
+ if (!$def_res)
+ {
+ unset($row['rowdefault']);
+ }
+ else
+ {
+ $row['rowdefault'] = @pg_result($def_res, 0, 'rowdefault');
+ }
+
+ if ($row['type'] == 'bpchar')
+ {
+ // Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement.
+ $row['type'] = 'char';
+ }
+
+ $schema_create .= ' ' . $row['field'] . ' ' . $row['type'];
+
+ if (eregi('char', $row['type']))
+ {
+ if ($row['lengthvar'] > 0)
+ {
+ $schema_create .= '(' . ($row['lengthvar'] -4) . ')';
+ }
+ }
+
+ if (eregi('numeric', $row['type']))
+ {
+ $schema_create .= '(';
+ $schema_create .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff));
+ $schema_create .= ')';
+ }
+
+ if (!empty($row['rowdefault']))
+ {
+ $schema_create .= ' DEFAULT ' . $row['rowdefault'];
+ }
+
+ if ($row['notnull'] == 't')
+ {
+ $schema_create .= ' NOT NULL';
+ }
+
+ $schema_create .= ",$crlf";
+
+ }
+ //
+ // Get the listing of primary keys.
+ //
+
+ $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 ";
+ $result = $db->sql_query($sql_pri_keys);
+
+ if(!$result)
+ {
+ 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')
+ {
+ if (!empty($primary_key))
+ {
+ $primary_key .= ', ';
+ }
+
+ $primary_key .= $row['column_name'];
+ $primary_key_name = $row['index_name'];
+
+ }
+ 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'] . ', ';
+ }
+ }
+
+ if (!empty($index_rows))
+ {
+ while(list($idx_name, $props) = each($index_rows))
+ {
+ $props['column_names'] = ereg_replace(", $", "" , $props['column_names']);
+ $index_create .= 'CREATE ' . $props['unique'] . " INDEX $idx_name ON $table (" . $props['column_names'] . ");$crlf";
+ }
+ }
+
+ if (!empty($primary_key))
+ {
+ $schema_create .= " CONSTRAINT $primary_key_name PRIMARY KEY ($primary_key),$crlf";
+ }
+
+ //
+ // 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
+ )";
+ $result = $db->sql_query($sql_checks);
+
+ if (!$result)
+ {
+ message_die(GENERAL_ERROR, "Failed in get_table_def (show fields)", "", __LINE__, __FILE__, $sql_checks);
+ }
+
+ //
+ // Add the constraints to the sql file.
+ //
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $schema_create .= ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['rcsrc'] . ",$crlf";
+ }
+
+ $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;
+ }
+
+ //
+ // Ok now we've built all the sql return it to the calling function.
+ //
+ return (stripslashes($schema_create));
+
+}
+
+//
+// This function returns the "CREATE TABLE" syntax for mysql dbms...
+//
+function get_table_def_mysql($table, $crlf)
+{
+ 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.
+ // Then we add the statement to drop the tables....
+ //
+ if ($drop == 1)
+ {
+ $schema_create .= "DROP TABLE IF EXISTS $table;$crlf";
+ }
+
+ $schema_create .= "CREATE TABLE $table($crlf";
+
+ //
+ // Ok lets grab the fields...
+ //
+ $result = $db->sql_query($field_query);
+ if(!$result)
+ {
+ 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)
+ {
+ message_die(GENERAL_ERROR, "FAILED IN get_table_def (show keys)", "", __LINE__, __FILE__, $key_query);
+ }
+
+ 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, ', ') . ')';
+ }
+ elseif (substr($x,0,6) == 'UNIQUE')
+ {
+ $schema_create .= ' UNIQUE ' . substr($x,7) . ' (' . implode($columns, ', ') . ')';
+ }
+ else
+ {
+ $schema_create .= " KEY $x (" . implode($columns, ', ') . ')';
+ }
+ }
+
+ $schema_create .= "$crlf);";
+
+ if(get_magic_quotes_runtime())
+ {
+ return(stripslashes($schema_create));
+ }
+ else
+ {
+ return($schema_create);
+ }
+
+} // End get_table_def_mysql
+
+
+//
+// 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_postgresql($table, $handler)
+{
+ global $db;
+
+ //
+ // Grab all of the data from current table.
+ //
+
+ $result = $db->sql_query("SELECT * FROM $table");
+
+ if (!$result)
+ {
+ message_die(GENERAL_ERROR, "Failed 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);
+ }
+
+ $iRec = 0;
+
+ while($row = $db->sql_fetchrow($result))
+ {
+ unset($schema_vals);
+ unset($schema_fields);
+ unset($schema_insert);
+ //
+ // Build the SQL statement to recreate the data.
+ //
+ for($i = 0; $i < $i_num_fields; $i++)
+ {
+ $strVal = $row[$aryName[$i]];
+ if (eregi("char|text|bool", $aryType[$i]))
+ {
+ $strQuote = "'";
+ $strEmpty = "";
+ $strVal = addslashes($strVal);
+ }
+ elseif (eregi("date|timestamp", $aryType[$i]))
+ {
+ if ($empty($strVal))
+ {
+ $strQuote = "";
+ }
+ else
+ {
+ $strQuote = "'";
+ }
+ }
+ else
+ {
+ $strQuote = "";
+ $strEmpty = "NULL";
+ }
+
+ if (empty($strVal) && $strVal != "0")
+ {
+ $strVal = $strEmpty;
+ }
+
+ $schema_vals .= " $strQuote$strVal$strQuote,";
+ $schema_fields .= " $aryName[$i],";
+
+ }
+
+ $schema_vals = ereg_replace(",$", "", $schema_vals);
+ $schema_vals = ereg_replace("^ ", "", $schema_vals);
+ $schema_fields = ereg_replace(",$", "", $schema_fields);
+ $schema_fields = ereg_replace("^ ", "", $schema_fields);
+
+ //
+ // Take the ordered fields and their associated data and build it
+ // into a valid sql statement to recreate that field in the data.
+ //
+ $schema_insert = "INSERT INTO $table ($schema_fields) VALUES($schema_vals);";
+
+ $handler(trim($schema_insert));
+ }
+
+ return(true);
+
+}// end function get_table_content_postgres...
+
+//
+// This function is for getting the data from a mysql table.
+//
+
+function get_table_content_mysql($table, $handler)
+{
+ global $db;
+
+ // Grab the data from the table.
+ if (!($result = $db->sql_query("SELECT * FROM $table")))
+ {
+ message_die(GENERAL_ERROR, "Failed in get_table_content (select *)", "", __LINE__, __FILE__, "SELECT * FROM $table");
+ }
+
+ // Loop through the resulting rows and build the sql statement.
+ if ($row = $db->sql_fetchrow($result))
+ {
+ $handler("\n#\n# Table Data for $table\n#\n");
+ $field_names = array();
+
+ // Grab the list of field names.
+ $num_fields = $db->sql_numfields($result);
+ $table_list = '(';
+ for ($j = 0; $j < $num_fields; $j++)
+ {
+ $field_names[$j] = $db->sql_fieldname($j, $result);
+ $table_list .= (($j > 0) ? ', ' : '') . $field_names[$j];
+
+ }
+ $table_list .= ')';
+
+ do
+ {
+ // Start building the SQL statement.
+ $schema_insert = "INSERT INTO $table $table_list VALUES(";
+
+ // Loop through the rows and fill in data for each column
+ for ($j = 0; $j < $num_fields; $j++)
+ {
+ $schema_insert .= ($j > 0) ? ', ' : '';
+
+ if(!isset($row[$field_names[$j]]))
+ {
+ //
+ // If there is no data for the column set it to null.
+ // There was a problem here with an extra space causing the
+ // sql file not to reimport if the last column was null in
+ // any table. Should be fixed now :) JLH
+ //
+ $schema_insert .= 'NULL';
+ }
+ elseif ($row[$field_names[$j]] != '')
+ {
+ $schema_insert .= '\'' . addslashes($row[$field_names[$j]]) . '\'';
+ }
+ else
+ {
+ $schema_insert .= '\'\'';
+ }
+ }
+
+ $schema_insert .= ');';
+
+ // Go ahead and send the insert statement to the handler function.
+ $handler(trim($schema_insert));
+
+ }
+ while ($row = $db->sql_fetchrow($result));
+ }
+
+ return(true);
+}
+
+function output_table_content($content)
+{
+ global $tempfile;
+
+ //fwrite($tempfile, $content . "\n");
+ //$backup_sql .= $content . "\n";
+ echo $content ."\n";
+ return;
+}
+//
+// End Functions
+// -------------
+
+
+//
+// Begin program proper
+//
+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':
+
+ $error = false;
+ switch(SQL_LAYER)
+ {
+ case 'oracle':
+ $error = true;
+ break;
+ case 'db2':
+ $error = true;
+ break;
+ case 'msaccess':
+ $error = true;
+ break;
+ case 'mssql':
+ case 'mssql-odbc':
+ $error = true;
+ break;
+ }
+
+ if ($error)
+ {
+ include('./page_header_admin.'.$phpEx);
+
+ $template->set_filenames(array(
+ "body" => "admin/admin_message_body.tpl")
+ );
+
+ $template->assign_vars(array(
+ "MESSAGE_TITLE" => $lang['Information'],
+ "MESSAGE_TEXT" => $lang['Backups_not_supported'])
+ );
+
+ $template->pparse("body");
+
+ include('./page_footer_admin.'.$phpEx);
+ }
+
+ $tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words', 'confirm', 'sessions_keys');
+
+ $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'] : "" );
+
+ $gzipcompress = (!empty($HTTP_POST_VARS['gzipcompress'])) ? $HTTP_POST_VARS['gzipcompress'] : ( (!empty($HTTP_GET_VARS['gzipcompress'])) ? $HTTP_GET_VARS['gzipcompress'] : 0 );
+
+ $drop = (!empty($HTTP_POST_VARS['drop'])) ? intval($HTTP_POST_VARS['drop']) : ( (!empty($HTTP_GET_VARS['drop'])) ? intval($HTTP_GET_VARS['drop']) : 0 );
+
+ if(!empty($additional_tables))
+ {
+ if(ereg(",", $additional_tables))
+ {
+ $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($HTTP_POST_VARS['backupstart']) && !isset($HTTP_GET_VARS['backupstart']))
+ {
+ include('./page_header_admin.'.$phpEx);
+
+ $template->set_filenames(array(
+ "body" => "admin/db_utils_backup_body.tpl")
+ );
+ $s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"backup\" /><input type=\"hidden\" name=\"drop\" value=\"1\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />";
+
+ $template->assign_vars(array(
+ "L_DATABASE_BACKUP" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
+ "L_BACKUP_EXPLAIN" => $lang['Backup_explain'],
+ "L_FULL_BACKUP" => $lang['Full_backup'],
+ "L_STRUCTURE_BACKUP" => $lang['Structure_backup'],
+ "L_DATA_BACKUP" => $lang['Data_backup'],
+ "L_ADDITIONAL_TABLES" => $lang['Additional_tables'],
+ "L_START_BACKUP" => $lang['Start_backup'],
+ "L_BACKUP_OPTIONS" => $lang['Backup_options'],
+ "L_GZIP_COMPRESS" => $lang['Gzip_compress'],
+ "L_NO" => $lang['No'],
+ "L_YES" => $lang['Yes'],
+
+ "S_HIDDEN_FIELDS" => $s_hidden_fields,
+ "S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx"))
+ );
+ $template->pparse("body");
+
+ break;
+
+ }
+ else if( !isset($HTTP_POST_VARS['startdownload']) && !isset($HTTP_GET_VARS['startdownload']) )
+ {
+ if(is_array($additional_tables))
+ {
+ $additional_tables = implode(',', $additional_tables);
+ }
+ $template->set_filenames(array(
+ "body" => "admin/admin_message_body.tpl")
+ );
+
+ $template->assign_vars(array(
+ "META" => '<meta http-equiv="refresh" content="2;url=' . append_sid("admin_db_utilities.$phpEx?perform=backup&additional_tables=" . quotemeta($additional_tables) . "&backup_type=$backup_type&drop=1&backupstart=1&gzipcompress=$gzipcompress&startdownload=1") . '">',
+
+ "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Backup'],
+ "MESSAGE_TEXT" => $lang['Backup_download'])
+ );
+
+ include('./page_header_admin.'.$phpEx);
+
+ $template->pparse("body");
+
+ include('./page_footer_admin.'.$phpEx);
+
+ }
+ header("Pragma: no-cache");
+ $do_gzip_compress = FALSE;
+ if( $gzipcompress )
+ {
+ $phpver = phpversion();
+
+ if($phpver >= "4.0")
+ {
+ if(extension_loaded("zlib"))
+ {
+ $do_gzip_compress = TRUE;
+ }
+ }
+ }
+ if($do_gzip_compress)
+ {
+ @ob_start();
+ @ob_implicit_flush(0);
+ header("Content-Type: application/x-gzip; name=\"phpbb_db_backup.sql.gz\"");
+ header("Content-disposition: attachment; filename=phpbb_db_backup.sql.gz");
+ }
+ else
+ {
+ header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.sql\"");
+ header("Content-disposition: attachment; filename=phpbb_db_backup.sql");
+ }
+
+ //
+ // Build the sql script file...
+ //
+ echo "#\n";
+ echo "# phpBB Backup Script\n";
+ echo "# Dump of tables for $dbname\n";
+ echo "#\n# DATE : " . gmdate("d-m-Y H:i:s", time()) . " GMT\n";
+ echo "#\n";
+
+ if(SQL_LAYER == 'postgresql')
+ {
+ echo "\n" . pg_get_sequences("\n", $backup_type);
+ }
+ for($i = 0; $i < count($tables); $i++)
+ {
+ $table_name = $tables[$i];
+
+ switch (SQL_LAYER)
+ {
+ case 'postgresql':
+ $table_def_function = "get_table_def_postgresql";
+ $table_content_function = "get_table_content_postgresql";
+ break;
+
+ case 'mysql':
+ case 'mysql4':
+ $table_def_function = "get_table_def_mysql";
+ $table_content_function = "get_table_content_mysql";
+ break;
+ }
+
+ if($backup_type != 'data')
+ {
+ echo "#\n# TABLE: " . $table_prefix . $table_name . "\n#\n";
+ echo $table_def_function($table_prefix . $table_name, "\n") . "\n";
+ }
+
+ if($backup_type != 'structure')
+ {
+ $table_content_function($table_prefix . $table_name, "output_table_content");
+ }
+ }
+
+ if($do_gzip_compress)
+ {
+ $Size = ob_get_length();
+ $Crc = crc32(ob_get_contents());
+ $contents = gzcompress(ob_get_contents());
+ ob_end_clean();
+ echo "\x1f\x8b\x08\x00\x00\x00\x00\x00".substr($contents, 0, strlen($contents) - 4).gzip_PrintFourChars($Crc).gzip_PrintFourChars($Size);
+ }
+ exit;
+
+ break;
+
+ case 'restore':
+ if(!isset($HTTP_POST_VARS['restore_start']))
+ {
+ //
+ // Define Template files...
+ //
+ include('./page_header_admin.'.$phpEx);
+
+ $template->set_filenames(array(
+ "body" => "admin/db_utils_restore_body.tpl")
+ );
+
+ $s_hidden_fields = "<input type=\"hidden\" name=\"perform\" value=\"restore\" /><input type=\"hidden\" name=\"perform\" value=\"$perform\" />";
+
+ $template->assign_vars(array(
+ "L_DATABASE_RESTORE" => $lang['Database_Utilities'] . " : " . $lang['Restore'],
+ "L_RESTORE_EXPLAIN" => $lang['Restore_explain'],
+ "L_SELECT_FILE" => $lang['Select_file'],
+ "L_START_RESTORE" => $lang['Start_Restore'],
+
+ "S_DBUTILS_ACTION" => append_sid("admin_db_utilities.$phpEx"),
+ "S_HIDDEN_FIELDS" => $s_hidden_fields)
+ );
+ $template->pparse("body");
+
+ break;
+
+ }
+ else
+ {
+ //
+ // Handle the file upload ....
+ // If no file was uploaded report an error...
+ //
+ $backup_file_name = (!empty($HTTP_POST_FILES['backup_file']['name'])) ? $HTTP_POST_FILES['backup_file']['name'] : "";
+ $backup_file_tmpname = ($HTTP_POST_FILES['backup_file']['tmp_name'] != "none") ? $HTTP_POST_FILES['backup_file']['tmp_name'] : "";
+ $backup_file_type = (!empty($HTTP_POST_FILES['backup_file']['type'])) ? $HTTP_POST_FILES['backup_file']['type'] : "";
+
+ if($backup_file_tmpname == "" || $backup_file_name == "")
+ {
+ message_die(GENERAL_MESSAGE, $lang['Restore_Error_no_file']);
+ }
+ //
+ // If I file was actually uploaded, check to make sure that we
+ // are actually passed the name of an uploaded file, and not
+ // a hackers attempt at getting us to process a local system
+ // file.
+ //
+ if( file_exists(phpbb_realpath($backup_file_tmpname)) )
+ {
+ if( preg_match("/^(text\/[a-zA-Z]+)|(application\/(x\-)?gzip(\-compressed)?)|(application\/octet-stream)$/is", $backup_file_type) )
+ {
+ if( preg_match("/\.gz$/is",$backup_file_name) )
+ {
+ $do_gzip_compress = FALSE;
+ $phpver = phpversion();
+ if($phpver >= "4.0")
+ {
+ if(extension_loaded("zlib"))
+ {
+ $do_gzip_compress = TRUE;
+ }
+ }
+
+ if($do_gzip_compress)
+ {
+ $gz_ptr = gzopen($backup_file_tmpname, 'rb');
+ $sql_query = "";
+ while( !gzeof($gz_ptr) )
+ {
+ $sql_query .= gzgets($gz_ptr, 100000);
+ }
+ }
+ else
+ {
+ message_die(GENERAL_ERROR, $lang['Restore_Error_decompress']);
+ }
+ }
+ else
+ {
+ $sql_query = fread(fopen($backup_file_tmpname, 'r'), filesize($backup_file_tmpname));
+ }
+ //
+ // Comment this line out to see if this fixes the stuff...
+ //
+ //$sql_query = stripslashes($sql_query);
+ }
+ else
+ {
+ message_die(GENERAL_ERROR, $lang['Restore_Error_filename'] ." $backup_file_type $backup_file_name");
+ }
+ }
+ else
+ {
+ message_die(GENERAL_ERROR, $lang['Restore_Error_uploading']);
+ }
+
+ if($sql_query != "")
+ {
+ // Strip out sql comments...
+ $sql_query = remove_remarks($sql_query);
+ $pieces = split_sql_file($sql_query, ";");
+
+ $sql_count = count($pieces);
+ for($i = 0; $i < $sql_count; $i++)
+ {
+ $sql = trim($pieces[$i]);
+
+ if(!empty($sql) and $sql[0] != "#")
+ {
+ if(VERBOSE == 1)
+ {
+ echo "Executing: $sql\n<br>";
+ flush();
+ }
+
+ $result = $db->sql_query($sql);
+
+ if(!$result && ( !(SQL_LAYER == 'postgresql' && eregi("drop table", $sql) ) ) )
+ {
+ message_die(GENERAL_ERROR, "Error importing backup file", "", __LINE__, __FILE__, $sql);
+ }
+ }
+ }
+ }
+
+ include('./page_header_admin.'.$phpEx);
+
+ $template->set_filenames(array(
+ "body" => "admin/admin_message_body.tpl")
+ );
+
+ $message = $lang['Restore_success'];
+
+ $template->assign_vars(array(
+ "MESSAGE_TITLE" => $lang['Database_Utilities'] . " : " . $lang['Restore'],
+ "MESSAGE_TEXT" => $message)
+ );
+
+ $template->pparse("body");
+ break;
+ }
+ break;
+ }
+}
+
+include('./page_footer_admin.'.$phpEx);
+
+?>
Added: phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_disallow.php
===================================================================
--- phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_disallow.php 2006-01-28 18:43:23 UTC (rev 660)
+++ phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_disallow.php 2006-01-28 18:47:25 UTC (rev 661)
@@ -0,0 +1,146 @@
+<?php
+/***************************************************************************
+ * admin_disallow.php
+ * -------------------
+ * begin : Tuesday, Oct 05, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support at phpbb.com
+ *
+ * $Id: admin_disallow.php,v 1.9.2.4 2005/12/18 13:57:50 grahamje Exp $
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ ***************************************************************************/
+
+define('IN_PHPBB', 1);
+
+if( !empty($setmodules) )
+{
+ $filename = basename(__FILE__);
+ $module['Users']['Disallow'] = $filename;
+
+ return;
+}
+
+//
+// Include required files, get $phpEx and check permissions
+//
+$phpbb_root_path = "./../";
+require($phpbb_root_path . 'extension.inc');
+require('./pagestart.' . $phpEx);
+
+if( isset($HTTP_POST_VARS['add_name']) )
+{
+ include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
+
+ $disallowed_user = ( isset($HTTP_POST_VARS['disallowed_user']) ) ? trim($HTTP_POST_VARS['disallowed_user']) : trim($HTTP_GET_VARS['disallowed_user']);
+
+ if ($disallowed_user == '')
+ {
+ message_die(GENERAL_MESSAGE, $lang['Fields_empty']);
+ }
+ if( !validate_username($disallowed_user) )
+ {
+ $message = $lang['Disallowed_already'];
+ }
+ else
+ {
+ $sql = "INSERT INTO " . DISALLOW_TABLE . " (disallow_username)
+ VALUES('" . str_replace("\'", "''", $disallowed_user) . "')";
+ $result = $db->sql_query( $sql );
+ if ( !$result )
+ {
+ message_die(GENERAL_ERROR, "Could not add disallowed user.", "",__LINE__, __FILE__, $sql);
+ }
+ $message = $lang['Disallow_successful'];
+ }
+
+ $message .= "<br /><br />" . sprintf($lang['Click_return_disallowadmin'], "<a href=\"" . append_sid("admin_disallow.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+}
+else if( isset($HTTP_POST_VARS['delete_name']) )
+{
+ $disallowed_id = ( isset($HTTP_POST_VARS['disallowed_id']) ) ? intval( $HTTP_POST_VARS['disallowed_id'] ) : intval( $HTTP_GET_VARS['disallowed_id'] );
+
+ $sql = "DELETE FROM " . DISALLOW_TABLE . "
+ WHERE disallow_id = $disallowed_id";
+ $result = $db->sql_query($sql);
+ if( !$result )
+ {
+ message_die(GENERAL_ERROR, "Couldn't removed disallowed user.", "",__LINE__, __FILE__, $sql);
+ }
+
+ $message .= $lang['Disallowed_deleted'] . "<br /><br />" . sprintf($lang['Click_return_disallowadmin'], "<a href=\"" . append_sid("admin_disallow.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+
+}
+
+//
+// Grab the current list of disallowed usernames...
+//
+$sql = "SELECT *
+ FROM " . DISALLOW_TABLE;
+$result = $db->sql_query($sql);
+if( !$result )
+{
+ message_die(GENERAL_ERROR, "Couldn't get disallowed users.", "", __LINE__, __FILE__, $sql );
+}
+
+$disallowed = $db->sql_fetchrowset($result);
+
+//
+// Ok now generate the info for the template, which will be put out no matter
+// what mode we are in.
+//
+$disallow_select = '<select name="disallowed_id">';
+
+if( trim($disallowed) == "" )
+{
+ $disallow_select .= '<option value="">' . $lang['no_disallowed'] . '</option>';
+}
+else
+{
+ $user = array();
+ for( $i = 0; $i < count($disallowed); $i++ )
+ {
+ $disallow_select .= '<option value="' . $disallowed[$i]['disallow_id'] . '">' . $disallowed[$i]['disallow_username'] . '</option>';
+ }
+}
+
+$disallow_select .= '</select>';
+
+$template->set_filenames(array(
+ "body" => "admin/disallow_body.tpl")
+);
+
+$template->assign_vars(array(
+ "S_DISALLOW_SELECT" => $disallow_select,
+ "S_FORM_ACTION" => append_sid("admin_disallow.$phpEx"),
+
+ "L_INFO" => $output_info,
+ "L_DISALLOW_TITLE" => $lang['Disallow_control'],
+ "L_DISALLOW_EXPLAIN" => $lang['Disallow_explain'],
+ "L_DELETE" => $lang['Delete_disallow'],
+ "L_DELETE_DISALLOW" => $lang['Delete_disallow_title'],
+ "L_DELETE_EXPLAIN" => $lang['Delete_disallow_explain'],
+ "L_ADD" => $lang['Add_disallow'],
+ "L_ADD_DISALLOW" => $lang['Add_disallow_title'],
+ "L_ADD_EXPLAIN" => $lang['Add_disallow_explain'],
+ "L_USERNAME" => $lang['Username'])
+);
+
+$template->pparse("body");
+
+include('./page_footer_admin.'.$phpEx);
+
+?>
\ No newline at end of file
Added: phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forum_prune.php
===================================================================
--- phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forum_prune.php 2006-01-28 18:43:23 UTC (rev 660)
+++ phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forum_prune.php 2006-01-28 18:47:25 UTC (rev 661)
@@ -0,0 +1,199 @@
+<?php
+/***************************************************************************
+* admin_forum_prune.php
+* -------------------
+* begin : Mon Jul 31, 2001
+* copyright : (C) 2001 The phpBB Group
+* email : support at phpbb.com
+*
+* $Id: admin_forum_prune.php,v 1.22.2.3 2002/12/18 14:14:07 psotfx Exp $
+*
+****************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ ***************************************************************************/
+
+define('IN_PHPBB', true);
+
+if ( !empty($setmodules) )
+{
+ $filename = basename(__FILE__);
+ $module['Forums']['Prune'] = $filename;
+
+ return;
+}
+
+//
+// Load default header
+//
+$phpbb_root_path = "./../";
+require($phpbb_root_path . 'extension.inc');
+require('./pagestart.' . $phpEx);
+require($phpbb_root_path . 'includes/prune.'.$phpEx);
+require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+
+//
+// Get the forum ID for pruning
+//
+if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
+{
+ $forum_id = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
+
+ if( $forum_id == -1 )
+ {
+ $forum_sql = '';
+ }
+ else
+ {
+ $forum_id = intval($forum_id);
+ $forum_sql = "AND forum_id = $forum_id";
+ }
+}
+else
+{
+ $forum_id = '';
+ $forum_sql = '';
+}
+//
+// Get a list of forum's or the data for the forum that we are pruning.
+//
+$sql = "SELECT f.*
+ FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
+ WHERE c.cat_id = f.cat_id
+ $forum_sql
+ ORDER BY c.cat_order ASC, f.forum_order ASC";
+if( !($result = $db->sql_query($sql)) )
+{
+ message_die(GENERAL_ERROR, 'Could not obtain list of forums for pruning', '', __LINE__, __FILE__, $sql);
+}
+
+$forum_rows = array();
+while( $row = $db->sql_fetchrow($result) )
+{
+ $forum_rows[] = $row;
+}
+
+//
+// Check for submit to be equal to Prune. If so then proceed with the pruning.
+//
+if( isset($HTTP_POST_VARS['doprune']) )
+{
+ $prunedays = ( isset($HTTP_POST_VARS['prunedays']) ) ? intval($HTTP_POST_VARS['prunedays']) : 0;
+
+ // Convert days to seconds for timestamp functions...
+ $prunedate = time() - ( $prunedays * 86400 );
+
+ $template->set_filenames(array(
+ 'body' => 'admin/forum_prune_result_body.tpl')
+ );
+
+ for($i = 0; $i < count($forum_rows); $i++)
+ {
+ $p_result = prune($forum_rows[$i]['forum_id'], $prunedate);
+ sync('forum', $forum_rows[$i]['forum_id']);
+
+ $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
+ $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
+
+ $template->assign_block_vars('prune_results', array(
+ 'ROW_COLOR' => '#' . $row_color,
+ 'ROW_CLASS' => $row_class,
+ 'FORUM_NAME' => $forum_rows[$i]['forum_name'],
+ 'FORUM_TOPICS' => $p_result['topics'],
+ 'FORUM_POSTS' => $p_result['posts'])
+ );
+ }
+
+ $template->assign_vars(array(
+ 'L_FORUM_PRUNE' => $lang['Forum_Prune'],
+ 'L_FORUM' => $lang['Forum'],
+ 'L_TOPICS_PRUNED' => $lang['Topics_pruned'],
+ 'L_POSTS_PRUNED' => $lang['Posts_pruned'],
+ 'L_PRUNE_RESULT' => $lang['Prune_success'])
+ );
+}
+else
+{
+ //
+ // If they haven't selected a forum for pruning yet then
+ // display a select box to use for pruning.
+ //
+ if( empty($HTTP_POST_VARS[POST_FORUM_URL]) )
+ {
+ //
+ // Output a selection table if no forum id has been specified.
+ //
+ $template->set_filenames(array(
+ 'body' => 'admin/forum_prune_select_body.tpl')
+ );
+
+ $select_list = '<select name="' . POST_FORUM_URL . '">';
+ $select_list .= '<option value="-1">' . $lang['All_Forums'] . '</option>';
+
+ for($i = 0; $i < count($forum_rows); $i++)
+ {
+ $select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
+ }
+ $select_list .= '</select>';
+
+ //
+ // Assign the template variables.
+ //
+ $template->assign_vars(array(
+ 'L_FORUM_PRUNE' => $lang['Forum_Prune'],
+ 'L_SELECT_FORUM' => $lang['Select_a_Forum'],
+ 'L_LOOK_UP' => $lang['Look_up_Forum'],
+
+ 'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"),
+ 'S_FORUMS_SELECT' => $select_list)
+ );
+ }
+ else
+ {
+ $forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
+
+ //
+ // Output the form to retrieve Prune information.
+ //
+ $template->set_filenames(array(
+ 'body' => 'admin/forum_prune_body.tpl')
+ );
+
+ $forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
+
+ $prune_data = $lang['Prune_topics_not_posted'] . " ";
+ $prune_data .= '<input class="post" type="text" name="prunedays" size="4"> ' . $lang['Days'];
+
+ $hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
+
+ //
+ // Assign the template variables.
+ //
+ $template->assign_vars(array(
+ 'FORUM_NAME' => $forum_name,
+
+ 'L_FORUM' => $lang['Forum'],
+ 'L_FORUM_PRUNE' => $lang['Forum_Prune'],
+ 'L_FORUM_PRUNE_EXPLAIN' => $lang['Forum_Prune_explain'],
+ 'L_DO_PRUNE' => $lang['Do_Prune'],
+
+ 'S_FORUMPRUNE_ACTION' => append_sid("admin_forum_prune.$phpEx"),
+ 'S_PRUNE_DATA' => $prune_data,
+ 'S_HIDDEN_VARS' => $hidden_input)
+ );
+ }
+}
+//
+// Actually output the page here.
+//
+$template->pparse('body');
+
+include('./page_footer_admin.'.$phpEx);
+
+?>
\ No newline at end of file
Added: phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forumauth.php
===================================================================
--- phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forumauth.php 2006-01-28 18:43:23 UTC (rev 660)
+++ phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forumauth.php 2006-01-28 18:47:25 UTC (rev 661)
@@ -0,0 +1,328 @@
+<?php
+/***************************************************************************
+ * admin_forumauth.php
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support at phpbb.com
+ *
+ * $Id: admin_forumauth.php,v 1.23.2.5 2004/03/25 15:57:19 acydburn Exp $
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ ***************************************************************************/
+
+define('IN_PHPBB', 1);
+
+if( !empty($setmodules) )
+{
+ $filename = basename(__FILE__);
+ $module['Forums']['Permissions'] = $filename;
+
+ return;
+}
+
+//
+// Load default header
+//
+$no_page_header = TRUE;
+$phpbb_root_path = './../';
+require($phpbb_root_path . 'extension.inc');
+require('./pagestart.' . $phpEx);
+
+//
+// Start program - define vars
+//
+// View Read Post Reply Edit Delete Sticky Announce Vote Poll
+$simple_auth_ary = array(
+ 0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
+ 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
+ 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
+ 3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
+ 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
+ 5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
+ 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
+);
+
+$simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . ' [' . $lang['Hidden'] . ']', $lang['Private'], $lang['Private'] . ' [' . $lang['Hidden'] . ']', $lang['Moderators'], $lang['Moderators'] . ' [' . $lang['Hidden'] . ']');
+
+$forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');
+
+$field_names = array(
+ 'auth_view' => $lang['View'],
+ 'auth_read' => $lang['Read'],
+ 'auth_post' => $lang['Post'],
+ 'auth_reply' => $lang['Reply'],
+ 'auth_edit' => $lang['Edit'],
+ 'auth_delete' => $lang['Delete'],
+ 'auth_sticky' => $lang['Sticky'],
+ 'auth_announce' => $lang['Announce'],
+ 'auth_vote' => $lang['Vote'],
+ 'auth_pollcreate' => $lang['Pollcreate']);
+
+$forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
+$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
+
+if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]))
+{
+ $forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]);
+ $forum_sql = "AND forum_id = $forum_id";
+}
+else
+{
+ unset($forum_id);
+ $forum_sql = '';
+}
+
+if( isset($HTTP_GET_VARS['adv']) )
+{
+ $adv = intval($HTTP_GET_VARS['adv']);
+}
+else
+{
+ unset($adv);
+}
+
+//
+// Start program proper
+//
+if( isset($HTTP_POST_VARS['submit']) )
+{
+ $sql = '';
+
+ if(!empty($forum_id))
+ {
+ if(isset($HTTP_POST_VARS['simpleauth']))
+ {
+ $simple_ary = $simple_auth_ary[intval($HTTP_POST_VARS['simpleauth'])];
+
+ for($i = 0; $i < count($simple_ary); $i++)
+ {
+ $sql .= ( ( $sql != '' ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
+ }
+
+ if (is_array($simple_ary))
+ {
+ $sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
+ }
+ }
+ else
+ {
+ for($i = 0; $i < count($forum_auth_fields); $i++)
+ {
+ $value = intval($HTTP_POST_VARS[$forum_auth_fields[$i]]);
+
+ if ( $forum_auth_fields[$i] == 'auth_vote' )
+ {
+ if ( $HTTP_POST_VARS['auth_vote'] == AUTH_ALL )
+ {
+ $value = AUTH_REG;
+ }
+ }
+
+ $sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
+ }
+
+ $sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
+ }
+
+ if ( $sql != '' )
+ {
+ if ( !$db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, 'Could not update auth table', '', __LINE__, __FILE__, $sql);
+ }
+ }
+
+ $forum_sql = '';
+ $adv = 0;
+ }
+
+ $template->assign_vars(array(
+ 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')
+ );
+ $message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid("admin_forumauth.$phpEx") . '">', "</a>");
+ message_die(GENERAL_MESSAGE, $message);
+
+} // End of submit
+
+//
+// Get required information, either all forums if
+// no id was specified or just the requsted if it
+// was
+//
+$sql = "SELECT f.*
+ FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
+ WHERE c.cat_id = f.cat_id
+ $forum_sql
+ ORDER BY c.cat_order ASC, f.forum_order ASC";
+if ( !($result = $db->sql_query($sql)) )
+{
+ message_die(GENERAL_ERROR, "Couldn't obtain forum list", "", __LINE__, __FILE__, $sql);
+}
+
+$forum_rows = $db->sql_fetchrowset($result);
+$db->sql_freeresult($result);
+
+if( empty($forum_id) )
+{
+ //
+ // Output the selection table if no forum id was
+ // specified
+ //
+ $template->set_filenames(array(
+ 'body' => 'admin/auth_select_body.tpl')
+ );
+
+ $select_list = '<select name="' . POST_FORUM_URL . '">';
+ for($i = 0; $i < count($forum_rows); $i++)
+ {
+ $select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
+ }
+ $select_list .= '</select>';
+
+ $template->assign_vars(array(
+ 'L_AUTH_TITLE' => $lang['Auth_Control_Forum'],
+ 'L_AUTH_EXPLAIN' => $lang['Forum_auth_explain'],
+ 'L_AUTH_SELECT' => $lang['Select_a_Forum'],
+ 'L_LOOK_UP' => $lang['Look_up_Forum'],
+
+ 'S_AUTH_ACTION' => append_sid("admin_forumauth.$phpEx"),
+ 'S_AUTH_SELECT' => $select_list)
+ );
+
+}
+else
+{
+ //
+ // Output the authorisation details if an id was
+ // specified
+ //
+ $template->set_filenames(array(
+ 'body' => 'admin/auth_forum_body.tpl')
+ );
+
+ $forum_name = $forum_rows[0]['forum_name'];
+
+ @reset($simple_auth_ary);
+ while( list($key, $auth_levels) = each($simple_auth_ary))
+ {
+ $matched = 1;
+ for($k = 0; $k < count($auth_levels); $k++)
+ {
+ $matched_type = $key;
+
+ if ( $forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k] )
+ {
+ $matched = 0;
+ }
+ }
+
+ if ( $matched )
+ {
+ break;
+ }
+ }
+
+ //
+ // If we didn't get a match above then we
+ // automatically switch into 'advanced' mode
+ //
+ if ( !isset($adv) && !$matched )
+ {
+ $adv = 1;
+ }
+
+ $s_column_span == 0;
+
+ if ( empty($adv) )
+ {
+ $simple_auth = '<select name="simpleauth">';
+
+ for($j = 0; $j < count($simple_auth_types); $j++)
+ {
+ $selected = ( $matched_type == $j ) ? ' selected="selected"' : '';
+ $simple_auth .= '<option value="' . $j . '"' . $selected . '>' . $simple_auth_types[$j] . '</option>';
+ }
+
+ $simple_auth .= '</select>';
+
+ $template->assign_block_vars('forum_auth_titles', array(
+ 'CELL_TITLE' => $lang['Simple_mode'])
+ );
+ $template->assign_block_vars('forum_auth_data', array(
+ 'S_AUTH_LEVELS_SELECT' => $simple_auth)
+ );
+
+ $s_column_span++;
+ }
+ else
+ {
+ //
+ // Output values of individual
+ // fields
+ //
+ for($j = 0; $j < count($forum_auth_fields); $j++)
+ {
+ $custom_auth[$j] = ' <select name="' . $forum_auth_fields[$j] . '">';
+
+ for($k = 0; $k < count($forum_auth_levels); $k++)
+ {
+ $selected = ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) ? ' selected="selected"' : '';
+ $custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['Forum_' . $forum_auth_levels[$k]] . '</option>';
+ }
+ $custom_auth[$j] .= '</select> ';
+
+ $cell_title = $field_names[$forum_auth_fields[$j]];
+
+ $template->assign_block_vars('forum_auth_titles', array(
+ 'CELL_TITLE' => $cell_title)
+ );
+ $template->assign_block_vars('forum_auth_data', array(
+ 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j])
+ );
+
+ $s_column_span++;
+ }
+ }
+
+ $adv_mode = ( empty($adv) ) ? '1' : '0';
+ $switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode);
+ $switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode'];
+ $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
+
+ $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
+
+ $template->assign_vars(array(
+ 'FORUM_NAME' => $forum_name,
+
+ 'L_FORUM' => $lang['Forum'],
+ 'L_AUTH_TITLE' => $lang['Auth_Control_Forum'],
+ 'L_AUTH_EXPLAIN' => $lang['Forum_auth_explain'],
+ 'L_SUBMIT' => $lang['Submit'],
+ 'L_RESET' => $lang['Reset'],
+
+ 'U_SWITCH_MODE' => $u_switch_mode,
+
+ 'S_FORUMAUTH_ACTION' => append_sid("admin_forumauth.$phpEx"),
+ 'S_COLUMN_SPAN' => $s_column_span,
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields)
+ );
+
+}
+
+include('./page_header_admin.'.$phpEx);
+
+$template->pparse('body');
+
+include('./page_footer_admin.'.$phpEx);
+
+?>
\ No newline at end of file
Added: phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forums.php
===================================================================
--- phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forums.php 2006-01-28 18:43:23 UTC (rev 660)
+++ phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_forums.php 2006-01-28 18:47:25 UTC (rev 661)
@@ -0,0 +1,1028 @@
+<?php
+/***************************************************************************
+ * admin_forums.php
+ * -------------------
+ * begin : Thursday, Jul 12, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support at phpbb.com
+ *
+ * $Id: admin_forums.php,v 1.40.2.12 2005/05/07 22:18:10 acydburn Exp $
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ ***************************************************************************/
+
+define('IN_PHPBB', 1);
+
+if( !empty($setmodules) )
+{
+ $file = basename(__FILE__);
+ $module['Forums']['Manage'] = $file;
+ return;
+}
+
+//
+// Load default header
+//
+$phpbb_root_path = "./../";
+require($phpbb_root_path . 'extension.inc');
+require('./pagestart.' . $phpEx);
+include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+
+$forum_auth_ary = array(
+ "auth_view" => AUTH_ALL,
+ "auth_read" => AUTH_ALL,
+ "auth_post" => AUTH_ALL,
+ "auth_reply" => AUTH_ALL,
+ "auth_edit" => AUTH_REG,
+ "auth_delete" => AUTH_REG,
+ "auth_sticky" => AUTH_MOD,
+ "auth_announce" => AUTH_MOD,
+ "auth_vote" => AUTH_REG,
+ "auth_pollcreate" => AUTH_REG
+);
+
+//
+// Mode setting
+//
+if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
+{
+ $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
+ $mode = htmlspecialchars($mode);
+}
+else
+{
+ $mode = "";
+}
+
+// ------------------
+// Begin function block
+//
+function get_info($mode, $id)
+{
+ global $db;
+
+ switch($mode)
+ {
+ case 'category':
+ $table = CATEGORIES_TABLE;
+ $idfield = 'cat_id';
+ $namefield = 'cat_title';
+ break;
+
+ case 'forum':
+ $table = FORUMS_TABLE;
+ $idfield = 'forum_id';
+ $namefield = 'forum_name';
+ break;
+
+ default:
+ message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
+ break;
+ }
+ $sql = "SELECT count(*) as total
+ FROM $table";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql);
+ }
+ $count = $db->sql_fetchrow($result);
+ $count = $count['total'];
+
+ $sql = "SELECT *
+ FROM $table
+ WHERE $idfield = $id";
+
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql);
+ }
+
+ if( $db->sql_numrows($result) != 1 )
+ {
+ message_die(GENERAL_ERROR, "Forum/Category doesn't exist or multiple forums/categories with ID $id", "", __LINE__, __FILE__);
+ }
+
+ $return = $db->sql_fetchrow($result);
+ $return['number'] = $count;
+ return $return;
+}
+
+function get_list($mode, $id, $select)
+{
+ global $db;
+
+ switch($mode)
+ {
+ case 'category':
+ $table = CATEGORIES_TABLE;
+ $idfield = 'cat_id';
+ $namefield = 'cat_title';
+ break;
+
+ case 'forum':
+ $table = FORUMS_TABLE;
+ $idfield = 'forum_id';
+ $namefield = 'forum_name';
+ break;
+
+ default:
+ message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
+ break;
+ }
+
+ $sql = "SELECT *
+ FROM $table";
+ if( $select == 0 )
+ {
+ $sql .= " WHERE $idfield <> $id";
+ }
+
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
+ }
+
+ $cat_list = "";
+
+ while( $row = $db->sql_fetchrow($result) )
+ {
+ $s = "";
+ if ($row[$idfield] == $id)
+ {
+ $s = " selected=\"selected\"";
+ }
+ $catlist .= "<option value=\"$row[$idfield]\"$s>" . $row[$namefield] . "</option>\n";
+ }
+
+ return($catlist);
+}
+
+function renumber_order($mode, $cat = 0)
+{
+ global $db;
+
+ switch($mode)
+ {
+ case 'category':
+ $table = CATEGORIES_TABLE;
+ $idfield = 'cat_id';
+ $orderfield = 'cat_order';
+ $cat = 0;
+ break;
+
+ case 'forum':
+ $table = FORUMS_TABLE;
+ $idfield = 'forum_id';
+ $orderfield = 'forum_order';
+ $catfield = 'cat_id';
+ break;
+
+ default:
+ message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
+ break;
+ }
+
+ $sql = "SELECT * FROM $table";
+ if( $cat != 0)
+ {
+ $sql .= " WHERE $catfield = $cat";
+ }
+ $sql .= " ORDER BY $orderfield ASC";
+
+
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql);
+ }
+
+ $i = 10;
+ $inc = 10;
+
+ while( $row = $db->sql_fetchrow($result) )
+ {
+ $sql = "UPDATE $table
+ SET $orderfield = $i
+ WHERE $idfield = " . $row[$idfield];
+ if( !$db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql);
+ }
+ $i += 10;
+ }
+
+}
+//
+// End function block
+// ------------------
+
+//
+// Begin program proper
+//
+if( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory']) )
+{
+ $mode = ( isset($HTTP_POST_VARS['addforum']) ) ? "addforum" : "addcat";
+
+ if( $mode == "addforum" )
+ {
+ list($cat_id) = each($HTTP_POST_VARS['addforum']);
+ $cat_id = intval($cat_id);
+ //
+ // stripslashes needs to be run on this because slashes are added when the forum name is posted
+ //
+ $forumname = stripslashes($HTTP_POST_VARS['forumname'][$cat_id]);
+ }
+}
+
+if( !empty($mode) )
+{
+ switch($mode)
+ {
+ case 'addforum':
+ case 'editforum':
+ //
+ // Show form to create/modify a forum
+ //
+ if ($mode == 'editforum')
+ {
+ // $newmode determines if we are going to INSERT or UPDATE after posting?
+
+ $l_title = $lang['Edit_forum'];
+ $newmode = 'modforum';
+ $buttonvalue = $lang['Update'];
+
+ $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
+
+ $row = get_info('forum', $forum_id);
+
+ $cat_id = $row['cat_id'];
+ $forumname = $row['forum_name'];
+ $forumdesc = $row['forum_desc'];
+ $forumstatus = $row['forum_status'];
+
+ //
+ // start forum prune stuff.
+ //
+ if( $row['prune_enable'] )
+ {
+ $prune_enabled = "checked=\"checked\"";
+ $sql = "SELECT *
+ FROM " . PRUNE_TABLE . "
+ WHERE forum_id = $forum_id";
+ if(!$pr_result = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
+ }
+
+ $pr_row = $db->sql_fetchrow($pr_result);
+ }
+ else
+ {
+ $prune_enabled = '';
+ }
+ }
+ else
+ {
+ $l_title = $lang['Create_forum'];
+ $newmode = 'createforum';
+ $buttonvalue = $lang['Create_forum'];
+
+ $forumdesc = '';
+ $forumstatus = FORUM_UNLOCKED;
+ $forum_id = '';
+ $prune_enabled = '';
+ }
+
+ $catlist = get_list('category', $cat_id, TRUE);
+
+ $forumstatus == ( FORUM_LOCKED ) ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\"";
+
+ // These two options ($lang['Status_unlocked'] and $lang['Status_locked']) seem to be missing from
+ // the language files.
+ $lang['Status_unlocked'] = isset($lang['Status_unlocked']) ? $lang['Status_unlocked'] : 'Unlocked';
+ $lang['Status_locked'] = isset($lang['Status_locked']) ? $lang['Status_locked'] : 'Locked';
+
+ $statuslist = "<option value=\"" . FORUM_UNLOCKED . "\" $forumunlocked>" . $lang['Status_unlocked'] . "</option>\n";
+ $statuslist .= "<option value=\"" . FORUM_LOCKED . "\" $forumlocked>" . $lang['Status_locked'] . "</option>\n";
+
+ $template->set_filenames(array(
+ "body" => "admin/forum_edit_body.tpl")
+ );
+
+ $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode .'" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
+
+ $template->assign_vars(array(
+ 'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields,
+ 'S_SUBMIT_VALUE' => $buttonvalue,
+ 'S_CAT_LIST' => $catlist,
+ 'S_STATUS_LIST' => $statuslist,
+ 'S_PRUNE_ENABLED' => $prune_enabled,
+
+ 'L_FORUM_TITLE' => $l_title,
+ 'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'],
+ 'L_FORUM_SETTINGS' => $lang['Forum_settings'],
+ 'L_FORUM_NAME' => $lang['Forum_name'],
+ 'L_CATEGORY' => $lang['Category'],
+ 'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
+ 'L_FORUM_STATUS' => $lang['Forum_status'],
+ 'L_AUTO_PRUNE' => $lang['Forum_pruning'],
+ 'L_ENABLED' => $lang['Enabled'],
+ 'L_PRUNE_DAYS' => $lang['prune_days'],
+ 'L_PRUNE_FREQ' => $lang['prune_freq'],
+ 'L_DAYS' => $lang['Days'],
+
+ 'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
+ 'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
+ 'FORUM_NAME' => $forumname,
+ 'DESCRIPTION' => $forumdesc)
+ );
+ $template->pparse("body");
+ break;
+
+ case 'createforum':
+ //
+ // Create a forum in the DB
+ //
+ if( trim($HTTP_POST_VARS['forumname']) == "" )
+ {
+ message_die(GENERAL_ERROR, "Can't create a forum without a name");
+ }
+
+ $sql = "SELECT MAX(forum_order) AS max_order
+ FROM " . FORUMS_TABLE . "
+ WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
+ }
+ $row = $db->sql_fetchrow($result);
+
+ $max_order = $row['max_order'];
+ $next_order = $max_order + 10;
+
+ $sql = "SELECT MAX(forum_id) AS max_id
+ FROM " . FORUMS_TABLE;
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
+ }
+ $row = $db->sql_fetchrow($result);
+
+ $max_id = $row['max_id'];
+ $next_id = $max_id + 1;
+
+ //
+ // Default permissions of public ::
+ //
+ $field_sql = "";
+ $value_sql = "";
+ while( list($field, $value) = each($forum_auth_ary) )
+ {
+ $field_sql .= ", $field";
+ $value_sql .= ", $value";
+
+ }
+
+ // There is no problem having duplicate forum names so we won't check for it.
+ $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
+ VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
+ }
+
+ if( $HTTP_POST_VARS['prune_enable'] )
+ {
+
+ if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "")
+ {
+ message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
+ }
+
+ $sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq)
+ VALUES('" . $next_id . "', " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't insert row in prune table", "", __LINE__, __FILE__, $sql);
+ }
+ }
+
+ $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+
+ break;
+
+ case 'modforum':
+ // Modify a forum in the DB
+ if( isset($HTTP_POST_VARS['prune_enable']))
+ {
+ if( $HTTP_POST_VARS['prune_enable'] != 1 )
+ {
+ $HTTP_POST_VARS['prune_enable'] = 0;
+ }
+ }
+
+ $sql = "UPDATE " . FORUMS_TABLE . "
+ SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
+ WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
+ }
+
+ if( $HTTP_POST_VARS['prune_enable'] == 1 )
+ {
+ if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" )
+ {
+ message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
+ }
+
+ $sql = "SELECT *
+ FROM " . PRUNE_TABLE . "
+ WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get forum Prune Information","",__LINE__, __FILE__, $sql);
+ }
+
+ if( $db->sql_numrows($result) > 0 )
+ {
+ $sql = "UPDATE " . PRUNE_TABLE . "
+ SET prune_days = " . intval($HTTP_POST_VARS['prune_days']) . ", prune_freq = " . intval($HTTP_POST_VARS['prune_freq']) . "
+ WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
+ }
+ else
+ {
+ $sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq)
+ VALUES(" . intval($HTTP_POST_VARS[POST_FORUM_URL]) . ", " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")";
+ }
+
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't Update Forum Prune Information","",__LINE__, __FILE__, $sql);
+ }
+ }
+
+ $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+
+ break;
+
+ case 'addcat':
+ // Create a category in the DB
+ if( trim($HTTP_POST_VARS['categoryname']) == '')
+ {
+ message_die(GENERAL_ERROR, "Can't create a category without a name");
+ }
+
+ $sql = "SELECT MAX(cat_order) AS max_order
+ FROM " . CATEGORIES_TABLE;
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql);
+ }
+ $row = $db->sql_fetchrow($result);
+
+ $max_order = $row['max_order'];
+ $next_order = $max_order + 10;
+
+ //
+ // There is no problem having duplicate forum names so we won't check for it.
+ //
+ $sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
+ VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order)";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
+ }
+
+ $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+
+ break;
+
+ case 'editcat':
+ //
+ // Show form to edit a category
+ //
+ $newmode = 'modcat';
+ $buttonvalue = $lang['Update'];
+
+ $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);
+
+ $row = get_info('category', $cat_id);
+ $cat_title = $row['cat_title'];
+
+ $template->set_filenames(array(
+ "body" => "admin/category_edit_body.tpl")
+ );
+
+ $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="' . POST_CAT_URL . '" value="' . $cat_id . '" />';
+
+ $template->assign_vars(array(
+ 'CAT_TITLE' => $cat_title,
+
+ 'L_EDIT_CATEGORY' => $lang['Edit_Category'],
+ 'L_EDIT_CATEGORY_EXPLAIN' => $lang['Edit_Category_explain'],
+ 'L_CATEGORY' => $lang['Category'],
+
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields,
+ 'S_SUBMIT_VALUE' => $buttonvalue,
+ 'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"))
+ );
+
+ $template->pparse("body");
+ break;
+
+ case 'modcat':
+ // Modify a category in the DB
+ $sql = "UPDATE " . CATEGORIES_TABLE . "
+ SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
+ WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
+ }
+
+ $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+
+ break;
+
+ case 'deleteforum':
+ // Show form to delete a forum
+ $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
+
+ $select_to = '<select name="to_id">';
+ $select_to .= "<option value=\"-1\"$s>" . $lang['Delete_all_posts'] . "</option>\n";
+ $select_to .= get_list('forum', $forum_id, 0);
+ $select_to .= '</select>';
+
+ $buttonvalue = $lang['Move_and_Delete'];
+
+ $newmode = 'movedelforum';
+
+ $foruminfo = get_info('forum', $forum_id);
+ $name = $foruminfo['forum_name'];
+
+ $template->set_filenames(array(
+ "body" => "admin/forum_delete_body.tpl")
+ );
+
+ $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $forum_id . '" />';
+
+ $template->assign_vars(array(
+ 'NAME' => $name,
+
+ 'L_FORUM_DELETE' => $lang['Forum_delete'],
+ 'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'],
+ 'L_MOVE_CONTENTS' => $lang['Move_contents'],
+ 'L_FORUM_NAME' => $lang['Forum_name'],
+
+ "S_HIDDEN_FIELDS" => $s_hidden_fields,
+ 'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
+ 'S_SELECT_TO' => $select_to,
+ 'S_SUBMIT_VALUE' => $buttonvalue)
+ );
+
+ $template->pparse("body");
+ break;
+
+ case 'movedelforum':
+ //
+ // Move or delete a forum in the DB
+ //
+ $from_id = intval($HTTP_POST_VARS['from_id']);
+ $to_id = intval($HTTP_POST_VARS['to_id']);
+ $delete_old = intval($HTTP_POST_VARS['delete_old']);
+
+ // Either delete or move all posts in a forum
+ if($to_id == -1)
+ {
+ // Delete polls in this forum
+ $sql = "SELECT v.vote_id
+ FROM " . VOTE_DESC_TABLE . " v, " . TOPICS_TABLE . " t
+ WHERE t.forum_id = $from_id
+ AND v.topic_id = t.topic_id";
+ if (!($result = $db->sql_query($sql)))
+ {
+ message_die(GENERAL_ERROR, "Couldn't obtain list of vote ids", "", __LINE__, __FILE__, $sql);
+ }
+
+ if ($row = $db->sql_fetchrow($result))
+ {
+ $vote_ids = '';
+ do
+ {
+ $vote_ids = (($vote_ids != '') ? ', ' : '') . $row['vote_id'];
+ }
+ while ($row = $db->sql_fetchrow($result));
+
+ $sql = "DELETE FROM " . VOTE_DESC_TABLE . "
+ WHERE vote_id IN ($vote_ids)";
+ $db->sql_query($sql);
+
+ $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
+ WHERE vote_id IN ($vote_ids)";
+ $db->sql_query($sql);
+
+ $sql = "DELETE FROM " . VOTE_USERS_TABLE . "
+ WHERE vote_id IN ($vote_ids)";
+ $db->sql_query($sql);
+ }
+ $db->sql_freeresult($result);
+
+ include($phpbb_root_path . "includes/prune.$phpEx");
+ prune($from_id, 0, true); // Delete everything from forum
+ }
+ else
+ {
+ $sql = "SELECT *
+ FROM " . FORUMS_TABLE . "
+ WHERE forum_id IN ($from_id, $to_id)";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql);
+ }
+
+ if($db->sql_numrows($result) != 2)
+ {
+ message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__);
+ }
+ $sql = "UPDATE " . TOPICS_TABLE . "
+ SET forum_id = $to_id
+ WHERE forum_id = $from_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't move topics to other forum", "", __LINE__, __FILE__, $sql);
+ }
+ $sql = "UPDATE " . POSTS_TABLE . "
+ SET forum_id = $to_id
+ WHERE forum_id = $from_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't move posts to other forum", "", __LINE__, __FILE__, $sql);
+ }
+ sync('forum', $to_id);
+ }
+
+ // Alter Mod level if appropriate - 2.0.4
+ $sql = "SELECT ug.user_id
+ FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug
+ WHERE a.forum_id <> $from_id
+ AND a.auth_mod = 1
+ AND ug.group_id = a.group_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
+ }
+
+ if ($row = $db->sql_fetchrow($result))
+ {
+ $user_ids = '';
+ do
+ {
+ $user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
+ }
+ while ($row = $db->sql_fetchrow($result));
+
+ $sql = "SELECT ug.user_id
+ FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug
+ WHERE a.forum_id = $from_id
+ AND a.auth_mod = 1
+ AND ug.group_id = a.group_id
+ AND ug.user_id NOT IN ($user_ids)";
+ if( !$result2 = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
+ }
+
+ if ($row = $db->sql_fetchrow($result2))
+ {
+ $user_ids = '';
+ do
+ {
+ $user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
+ }
+ while ($row = $db->sql_fetchrow($result2));
+
+ $sql = "UPDATE " . USERS_TABLE . "
+ SET user_level = " . USER . "
+ WHERE user_id IN ($user_ids)
+ AND user_level <> " . ADMIN;
+ $db->sql_query($sql);
+ }
+ $db->sql_freeresult($result);
+
+ }
+ $db->sql_freeresult($result2);
+
+ $sql = "DELETE FROM " . FORUMS_TABLE . "
+ WHERE forum_id = $from_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
+ }
+
+ $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
+ WHERE forum_id = $from_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
+ }
+
+ $sql = "DELETE FROM " . PRUNE_TABLE . "
+ WHERE forum_id = $from_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete forum prune information!", "", __LINE__, __FILE__, $sql);
+ }
+
+ $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+
+ break;
+
+ case 'deletecat':
+ //
+ // Show form to delete a category
+ //
+ $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);
+
+ $buttonvalue = $lang['Move_and_Delete'];
+ $newmode = 'movedelcat';
+ $catinfo = get_info('category', $cat_id);
+ $name = $catinfo['cat_title'];
+
+ if ($catinfo['number'] == 1)
+ {
+ $sql = "SELECT count(*) as total
+ FROM ". FORUMS_TABLE;
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get Forum count", "", __LINE__, __FILE__, $sql);
+ }
+ $count = $db->sql_fetchrow($result);
+ $count = $count['total'];
+
+ if ($count > 0)
+ {
+ message_die(GENERAL_ERROR, $lang['Must_delete_forums']);
+ }
+ else
+ {
+ $select_to = $lang['Nowhere_to_move'];
+ }
+ }
+ else
+ {
+ $select_to = '<select name="to_id">';
+ $select_to .= get_list('category', $cat_id, 0);
+ $select_to .= '</select>';
+ }
+
+ $template->set_filenames(array(
+ "body" => "admin/forum_delete_body.tpl")
+ );
+
+ $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $cat_id . '" />';
+
+ $template->assign_vars(array(
+ 'NAME' => $name,
+
+ 'L_FORUM_DELETE' => $lang['Forum_delete'],
+ 'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'],
+ 'L_MOVE_CONTENTS' => $lang['Move_contents'],
+ 'L_FORUM_NAME' => $lang['Forum_name'],
+
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields,
+ 'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
+ 'S_SELECT_TO' => $select_to,
+ 'S_SUBMIT_VALUE' => $buttonvalue)
+ );
+
+ $template->pparse("body");
+ break;
+
+ case 'movedelcat':
+ //
+ // Move or delete a category in the DB
+ //
+ $from_id = intval($HTTP_POST_VARS['from_id']);
+ $to_id = intval($HTTP_POST_VARS['to_id']);
+
+ if (!empty($to_id))
+ {
+ $sql = "SELECT *
+ FROM " . CATEGORIES_TABLE . "
+ WHERE cat_id IN ($from_id, $to_id)";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql);
+ }
+ if($db->sql_numrows($result) != 2)
+ {
+ message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__);
+ }
+
+ $sql = "UPDATE " . FORUMS_TABLE . "
+ SET cat_id = $to_id
+ WHERE cat_id = $from_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql);
+ }
+ }
+
+ $sql = "DELETE FROM " . CATEGORIES_TABLE ."
+ WHERE cat_id = $from_id";
+
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
+ }
+
+ $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
+
+ message_die(GENERAL_MESSAGE, $message);
+
+ break;
+
+ case 'forum_order':
+ //
+ // Change order of forums in the DB
+ //
+ $move = intval($HTTP_GET_VARS['move']);
+ $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
+
+ $forum_info = get_info('forum', $forum_id);
+
+ $cat_id = $forum_info['cat_id'];
+
+ $sql = "UPDATE " . FORUMS_TABLE . "
+ SET forum_order = forum_order + $move
+ WHERE forum_id = $forum_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
+ }
+
+ renumber_order('forum', $forum_info['cat_id']);
+ $show_index = TRUE;
+
+ break;
+
+ case 'cat_order':
+ //
+ // Change order of categories in the DB
+ //
+ $move = intval($HTTP_GET_VARS['move']);
+ $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);
+
+ $sql = "UPDATE " . CATEGORIES_TABLE . "
+ SET cat_order = cat_order + $move
+ WHERE cat_id = $cat_id";
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
+ }
+
+ renumber_order('category');
+ $show_index = TRUE;
+
+ break;
+
+ case 'forum_sync':
+ sync('forum', intval($HTTP_GET_VARS[POST_FORUM_URL]));
+ $show_index = TRUE;
+
+ break;
+
+ default:
+ message_die(GENERAL_MESSAGE, $lang['No_mode']);
+ break;
+ }
+
+ if ($show_index != TRUE)
+ {
+ include('./page_footer_admin.'.$phpEx);
+ exit;
+ }
+}
+
+//
+// Start page proper
+//
+$template->set_filenames(array(
+ "body" => "admin/forum_admin_body.tpl")
+);
+
+$template->assign_vars(array(
+ 'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
+ 'L_FORUM_TITLE' => $lang['Forum_admin'],
+ 'L_FORUM_EXPLAIN' => $lang['Forum_admin_explain'],
+ 'L_CREATE_FORUM' => $lang['Create_forum'],
+ 'L_CREATE_CATEGORY' => $lang['Create_category'],
+ 'L_EDIT' => $lang['Edit'],
+ 'L_DELETE' => $lang['Delete'],
+ 'L_MOVE_UP' => $lang['Move_up'],
+ 'L_MOVE_DOWN' => $lang['Move_down'],
+ 'L_RESYNC' => $lang['Resync'])
+);
+
+$sql = "SELECT cat_id, cat_title, cat_order
+ FROM " . CATEGORIES_TABLE . "
+ ORDER BY cat_order";
+if( !$q_categories = $db->sql_query($sql) )
+{
+ message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
+}
+
+if( $total_categories = $db->sql_numrows($q_categories) )
+{
+ $category_rows = $db->sql_fetchrowset($q_categories);
+
+ $sql = "SELECT *
+ FROM " . FORUMS_TABLE . "
+ ORDER BY cat_id, forum_order";
+ if(!$q_forums = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql);
+ }
+
+ if( $total_forums = $db->sql_numrows($q_forums) )
+ {
+ $forum_rows = $db->sql_fetchrowset($q_forums);
+ }
+
+ //
+ // Okay, let's build the index
+ //
+ $gen_cat = array();
+
+ for($i = 0; $i < $total_categories; $i++)
+ {
+ $cat_id = $category_rows[$i]['cat_id'];
+
+ $template->assign_block_vars("catrow", array(
+ 'S_ADD_FORUM_SUBMIT' => "addforum[$cat_id]",
+ 'S_ADD_FORUM_NAME' => "forumname[$cat_id]",
+
+ 'CAT_ID' => $cat_id,
+ 'CAT_DESC' => $category_rows[$i]['cat_title'],
+
+ 'U_CAT_EDIT' => append_sid("admin_forums.$phpEx?mode=editcat&" . POST_CAT_URL . "=$cat_id"),
+ 'U_CAT_DELETE' => append_sid("admin_forums.$phpEx?mode=deletecat&" . POST_CAT_URL . "=$cat_id"),
+ 'U_CAT_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=cat_order&move=-15&" . POST_CAT_URL . "=$cat_id"),
+ 'U_CAT_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=cat_order&move=15&" . POST_CAT_URL . "=$cat_id"),
+ 'U_VIEWCAT' => append_sid($phpbb_root_path."index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
+ );
+
+ for($j = 0; $j < $total_forums; $j++)
+ {
+ $forum_id = $forum_rows[$j]['forum_id'];
+
+ if ($forum_rows[$j]['cat_id'] == $cat_id)
+ {
+
+ $template->assign_block_vars("catrow.forumrow", array(
+ 'FORUM_NAME' => $forum_rows[$j]['forum_name'],
+ 'FORUM_DESC' => $forum_rows[$j]['forum_desc'],
+ 'ROW_COLOR' => $row_color,
+ 'NUM_TOPICS' => $forum_rows[$j]['forum_topics'],
+ 'NUM_POSTS' => $forum_rows[$j]['forum_posts'],
+
+ 'U_VIEWFORUM' => append_sid($phpbb_root_path."viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"),
+ 'U_FORUM_EDIT' => append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=$forum_id"),
+ 'U_FORUM_DELETE' => append_sid("admin_forums.$phpEx?mode=deleteforum&" . POST_FORUM_URL . "=$forum_id"),
+ 'U_FORUM_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=forum_order&move=-15&" . POST_FORUM_URL . "=$forum_id"),
+ 'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&move=15&" . POST_FORUM_URL . "=$forum_id"),
+ 'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&" . POST_FORUM_URL . "=$forum_id"))
+ );
+
+ }// if ... forumid == catid
+
+ } // for ... forums
+
+ } // for ... categories
+
+}// if ... total_categories
+
+$template->pparse("body");
+
+include('./page_footer_admin.'.$phpEx);
+
+?>
\ No newline at end of file
Added: phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_groups.php
===================================================================
--- phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_groups.php 2006-01-28 18:43:23 UTC (rev 660)
+++ phc/trunk/src/tests/test_subjects/non_interpretable/phpBB2/admin/admin_groups.php 2006-01-28 18:47:25 UTC (rev 661)
@@ -0,0 +1,412 @@
+<?php
+/***************************************************************************
+ * admin_groups.php
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support at phpbb.com
+ *
+ * $Id: admin_groups.php,v 1.25.2.9 2004/03/25 15:57:20 acydburn Exp $
+ *
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ ***************************************************************************/
+
+define('IN_PHPBB', 1);
+
+if ( !empty($setmodules) )
+{
+ $filename = basename(__FILE__);
+ $module['Groups']['Manage'] = $filename;
+
+ return;
+}
+
+//
+// Load default header
+//
+$phpbb_root_path = './../';
+require($phpbb_root_path . 'extension.inc');
+require('./pagestart.' . $phpEx);
+
+if ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) || isset($HTTP_GET_VARS[POST_GROUPS_URL]) )
+{
+ $group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? intval($HTTP_POST_VARS[POST_GROUPS_URL]) : intval($HTTP_GET_VARS[POST_GROUPS_URL]);
+}
+else
+{
+ $group_id = 0;
+}
+
+if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
+{
+ $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
+ $mode = htmlspecialchars($mode);
+}
+else
+{
+ $mode = '';
+}
+
+if ( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
+{
+ //
+ // Ok they are editing a group or creating a new group
+ //
+ $template->set_filenames(array(
+ 'body' => 'admin/group_edit_body.tpl')
+ );
+
+ if ( isset($HTTP_POST_VARS['edit']) )
+ {
+ //
+ // They're editing. Grab the vars.
+ //
+ $sql = "SELECT *
+ FROM " . GROUPS_TABLE . "
+ WHERE group_single_user <> " . TRUE . "
+ AND group_id = $group_id";
+ if ( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
+ }
+
+ if ( !($group_info = $db->sql_fetchrow($result)) )
+ {
+ message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
+ }
+
+ $mode = 'editgroup';
+ $template->assign_block_vars('group_edit', array());
+
+ }
+ else if ( isset($HTTP_POST_VARS['new']) )
+ {
+ $group_info = array (
+ 'group_name' => '',
+ 'group_description' => '',
+ 'group_moderator' => '',
+ 'group_type' => GROUP_OPEN);
+ $group_open = ' checked="checked"';
+
+ $mode = 'newgroup';
+
+ }
+
+ //
+ // Ok, now we know everything about them, let's show the page.
+ //
+ $sql = "SELECT user_id, username
+ FROM " . USERS_TABLE . "
+ WHERE user_id <> " . ANONYMOUS . "
+ ORDER BY username";
+ if ( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
+ }
+
+ while ( $row = $db->sql_fetchrow($result) )
+ {
+ if ( $row['user_id'] == $group_info['group_moderator'] )
+ {
+ $group_moderator = $row['username'];
+ }
+ }
+
+ $group_open = ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '';
+ $group_closed = ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '';
+ $group_hidden = ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '';
+
+ $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />';
+
+ $template->assign_vars(array(
+ 'GROUP_NAME' => $group_info['group_name'],
+ 'GROUP_DESCRIPTION' => $group_info['group_description'],
+ 'GROUP_MODERATO