Thread: [phpbbreloaded-checkins] SF.net SVN: phpbbreloaded: [277] main/trunk
Status: Planning
Brought to you by:
tehphpmaster
From: <teh...@us...> - 2006-12-24 00:32:02
|
Revision: 277 http://svn.sourceforge.net/phpbbreloaded/?rev=277&view=rev Author: tehphpmaster Date: 2006-12-23 16:31:58 -0800 (Sat, 23 Dec 2006) Log Message: ----------- Clean phpBB 2.0.22 files being commited here. phpBB is the base code for phpBB Reloaded and so we will be building phpBB Reloaded based on these core files. Added Paths: ----------- main/trunk/admin/ main/trunk/admin/admin_board.php main/trunk/admin/admin_db_utilities.php main/trunk/admin/admin_disallow.php main/trunk/admin/admin_forum_prune.php main/trunk/admin/admin_forumauth.php main/trunk/admin/admin_forums.php main/trunk/admin/admin_groups.php main/trunk/admin/admin_mass_email.php main/trunk/admin/admin_ranks.php main/trunk/admin/admin_smilies.php main/trunk/admin/admin_styles.php main/trunk/admin/admin_ug_auth.php main/trunk/admin/admin_user_ban.php main/trunk/admin/admin_users.php main/trunk/admin/admin_words.php main/trunk/admin/index.php main/trunk/admin/page_footer_admin.php main/trunk/admin/page_header_admin.php main/trunk/admin/pagestart.php main/trunk/cache/ main/trunk/cache/.htaccess main/trunk/cache/index.htm main/trunk/common.php main/trunk/config.php main/trunk/db/ main/trunk/db/db2.php main/trunk/db/index.htm main/trunk/db/msaccess.php main/trunk/db/mssql-odbc.php main/trunk/db/mssql.php main/trunk/db/mysql.php main/trunk/db/mysql4.php main/trunk/db/postgres7.php main/trunk/extension.inc main/trunk/faq.php main/trunk/groupcp.php main/trunk/images/ main/trunk/images/avatars/ main/trunk/images/avatars/gallery/ main/trunk/images/avatars/gallery/index.htm main/trunk/images/avatars/index.htm main/trunk/images/index.htm main/trunk/images/smiles/ main/trunk/images/smiles/icon_arrow.gif main/trunk/images/smiles/icon_biggrin.gif main/trunk/images/smiles/icon_confused.gif main/trunk/images/smiles/icon_cool.gif main/trunk/images/smiles/icon_cry.gif main/trunk/images/smiles/icon_eek.gif main/trunk/images/smiles/icon_evil.gif main/trunk/images/smiles/icon_exclaim.gif main/trunk/images/smiles/icon_frown.gif main/trunk/images/smiles/icon_idea.gif main/trunk/images/smiles/icon_lol.gif main/trunk/images/smiles/icon_mad.gif main/trunk/images/smiles/icon_mrgreen.gif main/trunk/images/smiles/icon_neutral.gif main/trunk/images/smiles/icon_question.gif main/trunk/images/smiles/icon_razz.gif main/trunk/images/smiles/icon_redface.gif main/trunk/images/smiles/icon_rolleyes.gif main/trunk/images/smiles/icon_sad.gif main/trunk/images/smiles/icon_smile.gif main/trunk/images/smiles/icon_surprised.gif main/trunk/images/smiles/icon_twisted.gif main/trunk/images/smiles/icon_wink.gif main/trunk/images/spacer.gif main/trunk/includes/ main/trunk/includes/auth.php main/trunk/includes/bbcode.php main/trunk/includes/constants.php main/trunk/includes/db.php main/trunk/includes/emailer.php main/trunk/includes/functions.php main/trunk/includes/functions_admin.php main/trunk/includes/functions_post.php main/trunk/includes/functions_search.php main/trunk/includes/functions_selects.php main/trunk/includes/functions_validate.php main/trunk/includes/index.htm main/trunk/includes/page_header.php main/trunk/includes/page_tail.php main/trunk/includes/prune.php main/trunk/includes/sessions.php main/trunk/includes/smtp.php main/trunk/includes/sql_parse.php main/trunk/includes/template.php main/trunk/includes/topic_review.php main/trunk/includes/usercp_activate.php main/trunk/includes/usercp_avatar.php main/trunk/includes/usercp_confirm.php main/trunk/includes/usercp_email.php main/trunk/includes/usercp_register.php main/trunk/includes/usercp_sendpasswd.php main/trunk/includes/usercp_viewprofile.php main/trunk/index.php main/trunk/install/ main/trunk/install/index.htm main/trunk/install/install.php main/trunk/install/schemas/ main/trunk/install/schemas/index.htm main/trunk/install/schemas/ms_access_primer.zip main/trunk/install/schemas/mssql_basic.sql main/trunk/install/schemas/mssql_schema.sql main/trunk/install/schemas/mysql_basic.sql main/trunk/install/schemas/mysql_schema.sql main/trunk/install/schemas/postgres_basic.sql main/trunk/install/schemas/postgres_schema.sql main/trunk/install/update_to_latest.php main/trunk/install/upgrade.php main/trunk/language/ main/trunk/language/index.htm main/trunk/language/lang_english/ main/trunk/language/lang_english/email/ main/trunk/language/lang_english/email/admin_activate.tpl main/trunk/language/lang_english/email/admin_send_email.tpl main/trunk/language/lang_english/email/admin_welcome_activated.tpl main/trunk/language/lang_english/email/admin_welcome_inactive.tpl main/trunk/language/lang_english/email/coppa_welcome_inactive.tpl main/trunk/language/lang_english/email/group_added.tpl main/trunk/language/lang_english/email/group_approved.tpl main/trunk/language/lang_english/email/group_request.tpl main/trunk/language/lang_english/email/index.htm main/trunk/language/lang_english/email/privmsg_notify.tpl main/trunk/language/lang_english/email/profile_send_email.tpl main/trunk/language/lang_english/email/topic_notify.tpl main/trunk/language/lang_english/email/user_activate.tpl main/trunk/language/lang_english/email/user_activate_passwd.tpl main/trunk/language/lang_english/email/user_welcome.tpl main/trunk/language/lang_english/email/user_welcome_inactive.tpl main/trunk/language/lang_english/index.htm main/trunk/language/lang_english/lang_admin.php main/trunk/language/lang_english/lang_bbcode.php main/trunk/language/lang_english/lang_faq.php main/trunk/language/lang_english/lang_main.php main/trunk/language/lang_english/search_stopwords.txt main/trunk/language/lang_english/search_synonyms.txt main/trunk/login.php main/trunk/memberlist.php main/trunk/modcp.php main/trunk/posting.php main/trunk/privmsg.php main/trunk/profile.php main/trunk/search.php main/trunk/templates/ main/trunk/templates/index.htm main/trunk/templates/subSilver/ main/trunk/templates/subSilver/admin/ main/trunk/templates/subSilver/admin/admin_message_body.tpl main/trunk/templates/subSilver/admin/auth_forum_body.tpl main/trunk/templates/subSilver/admin/auth_select_body.tpl main/trunk/templates/subSilver/admin/auth_ug_body.tpl main/trunk/templates/subSilver/admin/board_config_body.tpl main/trunk/templates/subSilver/admin/category_edit_body.tpl main/trunk/templates/subSilver/admin/confirm_body.tpl main/trunk/templates/subSilver/admin/db_utils_backup_body.tpl main/trunk/templates/subSilver/admin/db_utils_restore_body.tpl main/trunk/templates/subSilver/admin/disallow_body.tpl main/trunk/templates/subSilver/admin/forum_admin_body.tpl main/trunk/templates/subSilver/admin/forum_delete_body.tpl main/trunk/templates/subSilver/admin/forum_edit_body.tpl main/trunk/templates/subSilver/admin/forum_prune_body.tpl main/trunk/templates/subSilver/admin/forum_prune_result_body.tpl main/trunk/templates/subSilver/admin/forum_prune_select_body.tpl main/trunk/templates/subSilver/admin/group_edit_body.tpl main/trunk/templates/subSilver/admin/group_select_body.tpl main/trunk/templates/subSilver/admin/index.htm main/trunk/templates/subSilver/admin/index_body.tpl main/trunk/templates/subSilver/admin/index_frameset.tpl main/trunk/templates/subSilver/admin/index_navigate.tpl main/trunk/templates/subSilver/admin/page_footer.tpl main/trunk/templates/subSilver/admin/page_header.tpl main/trunk/templates/subSilver/admin/ranks_edit_body.tpl main/trunk/templates/subSilver/admin/ranks_list_body.tpl main/trunk/templates/subSilver/admin/smile_edit_body.tpl main/trunk/templates/subSilver/admin/smile_import_body.tpl main/trunk/templates/subSilver/admin/smile_list_body.tpl main/trunk/templates/subSilver/admin/styles_addnew_body.tpl main/trunk/templates/subSilver/admin/styles_edit_body.tpl main/trunk/templates/subSilver/admin/styles_exporter.tpl main/trunk/templates/subSilver/admin/styles_list_body.tpl main/trunk/templates/subSilver/admin/user_avatar_gallery.tpl main/trunk/templates/subSilver/admin/user_ban_body.tpl main/trunk/templates/subSilver/admin/user_edit_body.tpl main/trunk/templates/subSilver/admin/user_email_body.tpl main/trunk/templates/subSilver/admin/user_select_body.tpl main/trunk/templates/subSilver/admin/words_edit_body.tpl main/trunk/templates/subSilver/admin/words_list_body.tpl main/trunk/templates/subSilver/agreement.tpl main/trunk/templates/subSilver/bbcode.tpl main/trunk/templates/subSilver/confirm_body.tpl main/trunk/templates/subSilver/error_body.tpl main/trunk/templates/subSilver/faq_body.tpl main/trunk/templates/subSilver/formIE.css main/trunk/templates/subSilver/groupcp_info_body.tpl main/trunk/templates/subSilver/groupcp_pending_info.tpl main/trunk/templates/subSilver/groupcp_user_body.tpl main/trunk/templates/subSilver/images/ main/trunk/templates/subSilver/images/cellpic.gif main/trunk/templates/subSilver/images/cellpic1.gif main/trunk/templates/subSilver/images/cellpic2.jpg main/trunk/templates/subSilver/images/cellpic3.gif main/trunk/templates/subSilver/images/created_by.jpg main/trunk/templates/subSilver/images/folder.gif main/trunk/templates/subSilver/images/folder_announce.gif main/trunk/templates/subSilver/images/folder_announce_new.gif main/trunk/templates/subSilver/images/folder_big.gif main/trunk/templates/subSilver/images/folder_hot.gif main/trunk/templates/subSilver/images/folder_lock.gif main/trunk/templates/subSilver/images/folder_lock_new.gif main/trunk/templates/subSilver/images/folder_locked_big.gif main/trunk/templates/subSilver/images/folder_new.gif main/trunk/templates/subSilver/images/folder_new_big.gif main/trunk/templates/subSilver/images/folder_new_hot.gif main/trunk/templates/subSilver/images/folder_sticky.gif main/trunk/templates/subSilver/images/folder_sticky_new.gif main/trunk/templates/subSilver/images/icon_delete.gif main/trunk/templates/subSilver/images/icon_latest_reply.gif main/trunk/templates/subSilver/images/icon_mini_faq.gif main/trunk/templates/subSilver/images/icon_mini_groups.gif main/trunk/templates/subSilver/images/icon_mini_login.gif main/trunk/templates/subSilver/images/icon_mini_members.gif main/trunk/templates/subSilver/images/icon_mini_message.gif main/trunk/templates/subSilver/images/icon_mini_profile.gif main/trunk/templates/subSilver/images/icon_mini_register.gif main/trunk/templates/subSilver/images/icon_mini_search.gif main/trunk/templates/subSilver/images/icon_minipost.gif main/trunk/templates/subSilver/images/icon_minipost_new.gif main/trunk/templates/subSilver/images/icon_newest_reply.gif main/trunk/templates/subSilver/images/index.htm main/trunk/templates/subSilver/images/lang_english/ main/trunk/templates/subSilver/images/lang_english/icon_aim.gif main/trunk/templates/subSilver/images/lang_english/icon_edit.gif main/trunk/templates/subSilver/images/lang_english/icon_email.gif main/trunk/templates/subSilver/images/lang_english/icon_icq_add.gif main/trunk/templates/subSilver/images/lang_english/icon_ip.gif main/trunk/templates/subSilver/images/lang_english/icon_msnm.gif main/trunk/templates/subSilver/images/lang_english/icon_pm.gif main/trunk/templates/subSilver/images/lang_english/icon_profile.gif main/trunk/templates/subSilver/images/lang_english/icon_quote.gif main/trunk/templates/subSilver/images/lang_english/icon_search.gif main/trunk/templates/subSilver/images/lang_english/icon_www.gif main/trunk/templates/subSilver/images/lang_english/icon_yim.gif main/trunk/templates/subSilver/images/lang_english/msg_newpost.gif main/trunk/templates/subSilver/images/lang_english/post.gif main/trunk/templates/subSilver/images/lang_english/reply-locked.gif main/trunk/templates/subSilver/images/lang_english/reply.gif main/trunk/templates/subSilver/images/logo_phpBB.gif main/trunk/templates/subSilver/images/logo_phpBB_med.gif main/trunk/templates/subSilver/images/msg_inbox.gif main/trunk/templates/subSilver/images/msg_outbox.gif main/trunk/templates/subSilver/images/msg_savebox.gif main/trunk/templates/subSilver/images/msg_sentbox.gif main/trunk/templates/subSilver/images/spacer.gif main/trunk/templates/subSilver/images/topic_delete.gif main/trunk/templates/subSilver/images/topic_lock.gif main/trunk/templates/subSilver/images/topic_move.gif main/trunk/templates/subSilver/images/topic_split.gif main/trunk/templates/subSilver/images/topic_unlock.gif main/trunk/templates/subSilver/images/vote_lcap.gif main/trunk/templates/subSilver/images/vote_rcap.gif main/trunk/templates/subSilver/images/voting_bar.gif main/trunk/templates/subSilver/images/whosonline.gif main/trunk/templates/subSilver/index.htm main/trunk/templates/subSilver/index_body.tpl main/trunk/templates/subSilver/jumpbox.tpl main/trunk/templates/subSilver/login_body.tpl main/trunk/templates/subSilver/memberlist_body.tpl main/trunk/templates/subSilver/message_body.tpl main/trunk/templates/subSilver/modcp_body.tpl main/trunk/templates/subSilver/modcp_move.tpl main/trunk/templates/subSilver/modcp_split.tpl main/trunk/templates/subSilver/modcp_viewip.tpl main/trunk/templates/subSilver/overall_footer.tpl main/trunk/templates/subSilver/overall_header.tpl main/trunk/templates/subSilver/posting_body.tpl main/trunk/templates/subSilver/posting_poll_body.tpl main/trunk/templates/subSilver/posting_preview.tpl main/trunk/templates/subSilver/posting_smilies.tpl main/trunk/templates/subSilver/posting_topic_review.tpl main/trunk/templates/subSilver/privmsgs_body.tpl main/trunk/templates/subSilver/privmsgs_popup.tpl main/trunk/templates/subSilver/privmsgs_preview.tpl main/trunk/templates/subSilver/privmsgs_read_body.tpl main/trunk/templates/subSilver/profile_add_body.tpl main/trunk/templates/subSilver/profile_avatar_gallery.tpl main/trunk/templates/subSilver/profile_send_email.tpl main/trunk/templates/subSilver/profile_send_pass.tpl main/trunk/templates/subSilver/profile_view_body.tpl main/trunk/templates/subSilver/search_body.tpl main/trunk/templates/subSilver/search_results_posts.tpl main/trunk/templates/subSilver/search_results_topics.tpl main/trunk/templates/subSilver/search_username.tpl main/trunk/templates/subSilver/simple_footer.tpl main/trunk/templates/subSilver/simple_header.tpl main/trunk/templates/subSilver/subSilver.cfg main/trunk/templates/subSilver/subSilver.css main/trunk/templates/subSilver/theme_info.cfg main/trunk/templates/subSilver/viewforum_body.tpl main/trunk/templates/subSilver/viewonline_body.tpl main/trunk/templates/subSilver/viewtopic_body.tpl main/trunk/templates/subSilver/viewtopic_poll_ballot.tpl main/trunk/templates/subSilver/viewtopic_poll_result.tpl main/trunk/viewforum.php main/trunk/viewonline.php main/trunk/viewtopic.php Added: main/trunk/admin/admin_board.php =================================================================== --- main/trunk/admin/admin_board.php (rev 0) +++ main/trunk/admin/admin_board.php 2006-12-24 00:31:58 UTC (rev 277) @@ -0,0 +1,366 @@ +<?php +/*************************************************************************** + * admin_board.php + * ------------------- + * begin : Thursday, Jul 12, 2001 + * copyright : (C) 2001 The phpBB Group + * email : su...@ph... + * + * $Id: admin_board.php,v 1.51.2.16 2006/12/16 13:11:24 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') + { + $new['cookie_name'] = str_replace('.', '_', $new['cookie_name']); + } + + // Attempt to prevent a common mistake with this value, + // http:// is the protocol and not part of the server name + if ($config_name == 'server_name') + { + $new['server_name'] = str_replace('http://', '', $new['server_name']); + } + + // Attempt to prevent a mistake with this value. + if ($config_name == 'avatar_path') + { + $new['avatar_path'] = trim($new['avatar_path']); + if (strstr($new['avatar_path'], "\0") || !is_dir($phpbb_root_path . $new['avatar_path']) || !is_writable($phpbb_root_path . $new['avatar_path'])) + { + $new['avatar_path'] = $default_config['avatar_path']; + } + } + + 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_SEARCH_FLOOD_INTERVAL" => $lang['Search_Flood_Interval'], + "L_SEARCH_FLOOD_INTERVAL_EXPLAIN" => $lang['Search_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'], + "SEARCH_FLOOD_INTERVAL" => $new['search_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: main/trunk/admin/admin_db_utilities.php =================================================================== --- main/trunk/admin/admin_db_utilities.php (rev 0) +++ main/trunk/admin/admin_db_utilities.php 2006-12-24 00:31:58 UTC (rev 277) @@ -0,0 +1,1008 @@ +<?php +/*************************************************************************** +* admin_db_utilities.php +* ------------------- +* begin : Thu May 31, 2001 +* copyright : (C) 2001 The phpBB Group +* email : su...@ph... +* +* $Id: admin_db_utilities.php,v 1.42.2.14 2006/02/10 20:35:40 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. +// +@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)) + { + $schema_vals = ''; + $schema_fields = ''; + $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: main/trunk/admin/admin_disallow.php =================================================================== --- main/trunk/admin/admin_disallow.php (rev 0) +++ main/trunk/admin/admin_disallow.php 2006-12-24 00:31:58 UTC (rev 277) @@ -0,0 +1,146 @@ +<?php +/*************************************************************************** + * admin_disallow.php + * ------------------- + * begin : Tuesday, Oct 05, 2001 + * copyright : (C) 2001 The phpBB Group + * email : su...@ph... + * + * $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. + * + ****************************************************... [truncated message content] |
From: <teh...@us...> - 2006-12-26 21:01:16
|
Revision: 279 http://svn.sourceforge.net/phpbbreloaded/?rev=279&view=rev Author: tehphpmaster Date: 2006-12-26 13:01:11 -0800 (Tue, 26 Dec 2006) Log Message: ----------- Big changes on the ACP front. I've started to backport the phpBB3 ACP to phpBB Reloaded. We've done this for a number of reasons, which i will explain more on later. admin/index.php doesn't have a lot of content; it needs rewriting for the new ACP. Things are hardcoded and pretty messy at the moment but that will change as development continues. More details on this later. Modified Paths: -------------- main/trunk/admin/index.php main/trunk/templates/subSilver/admin/index_body.tpl main/trunk/templates/subSilver/admin/index_frameset.tpl main/trunk/templates/subSilver/admin/page_header.tpl Added Paths: ----------- main/trunk/templates/subSilver/images/bg_header.gif main/trunk/templates/subSilver/images/bg_tabs1.gif main/trunk/templates/subSilver/images/bg_tabs2.gif Modified: main/trunk/admin/index.php =================================================================== --- main/trunk/admin/index.php 2006-12-24 06:08:00 UTC (rev 278) +++ main/trunk/admin/index.php 2006-12-26 21:01:11 UTC (rev 279) @@ -30,628 +30,20 @@ require($phpbb_root_path . 'extension.inc'); require('./pagestart.' . $phpEx); -// --------------- -// Begin functions -// -function inarray($needle, $haystack) -{ - for($i = 0; $i < sizeof($haystack); $i++ ) - { - if( $haystack[$i] == $needle ) - { - return true; - } - } - return false; -} -// -// End functions -// ------------- -// -// Generate relevant output -// -if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' ) -{ - $dir = @opendir("."); - - $setmodules = 1; - while( $file = @readdir($dir) ) - { - if( preg_match("/^admin_.*?\." . $phpEx . "$/", $file) ) - { - include('./' . $file); - } - } - - @closedir($dir); - - unset($setmodules); - include('./page_header_admin.'.$phpEx); $template->set_filenames(array( - "body" => "admin/index_navigate.tpl") - ); - - $template->assign_vars(array( - "U_FORUM_INDEX" => append_sid("../index.$phpEx"), - "U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"), - - "L_FORUM_INDEX" => $lang['Main_index'], - "L_ADMIN_INDEX" => $lang['Admin_Index'], - "L_PREVIEW_FORUM" => $lang['Preview_forum']) - ); - - ksort($module); - - while( list($cat, $action_array) = each($module) ) - { - $cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat); - - $template->assign_block_vars("catrow", array( - "ADMIN_CATEGORY" => $cat) - ); - - ksort($action_array); - - $row_count = 0; - while( list($action, $file) = each($action_array) ) - { - $row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action); - - $template->assign_block_vars("catrow.modulerow", array( - "ROW_COLOR" => "#" . $row_color, - "ROW_CLASS" => $row_class, - - "ADMIN_MODULE" => $action, - "U_ADMIN_MODULE" => append_sid($file)) - ); - $row_count++; - } - } - - $template->pparse("body"); - - include('./page_footer_admin.'.$phpEx); -} -elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' ) -{ - - include('./page_header_admin.'.$phpEx); - - $template->set_filenames(array( "body" => "admin/index_body.tpl") ); $template->assign_vars(array( - "L_WELCOME" => $lang['Welcome_phpBB'], - "L_ADMIN_INTRO" => $lang['Admin_intro'], - "L_FORUM_STATS" => $lang['Forum_stats'], - "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], - "L_USERNAME" => $lang['Username'], - "L_LOCATION" => $lang['Location'], - "L_LAST_UPDATE" => $lang['Last_updated'], - "L_IP_ADDRESS" => $lang['IP_Address'], - "L_STATISTIC" => $lang['Statistic'], - "L_VALUE" => $lang['Value'], - "L_NUMBER_POSTS" => $lang['Number_posts'], - "L_POSTS_PER_DAY" => $lang['Posts_per_day'], - "L_NUMBER_TOPICS" => $lang['Number_topics'], - "L_TOPICS_PER_DAY" => $lang['Topics_per_day'], - "L_NUMBER_USERS" => $lang['Number_users'], - "L_USERS_PER_DAY" => $lang['Users_per_day'], - "L_BOARD_STARTED" => $lang['Board_started'], - "L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'], - "L_DB_SIZE" => $lang['Database_size'], - "L_FORUM_LOCATION" => $lang['Forum_Location'], - "L_STARTED" => $lang['Login'], - "L_GZIP_COMPRESSION" => $lang['Gzip_compression']) + ) ); - // - // Get forum statistics - // - $total_posts = get_db_stat('postcount'); - $total_users = get_db_stat('usercount'); - $total_topics = get_db_stat('topiccount'); - $start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']); - - $boarddays = ( time() - $board_config['board_startdate'] ) / 86400; - - $posts_per_day = sprintf("%.2f", $total_posts / $boarddays); - $topics_per_day = sprintf("%.2f", $total_topics / $boarddays); - $users_per_day = sprintf("%.2f", $total_users / $boarddays); - - $avatar_dir_size = 0; - - if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path'])) - { - while( $file = @readdir($avatar_dir) ) - { - if( $file != "." && $file != ".." ) - { - $avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file); - } - } - @closedir($avatar_dir); - - // - // This bit of code translates the avatar directory size into human readable format - // Borrowed the code from the PHP.net annoted manual, origanally written by: - // Jesse (je...@je...) - // - if($avatar_dir_size >= 1048576) - { - $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB"; - } - else if($avatar_dir_size >= 1024) - { - $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB"; - } - else - { - $avatar_dir_size = $avatar_dir_size . " Bytes"; - } - - } - else - { - // Couldn't open Avatar dir. - $avatar_dir_size = $lang['Not_available']; - } - - if($posts_per_day > $total_posts) - { - $posts_per_day = $total_posts; - } - - if($topics_per_day > $total_topics) - { - $topics_per_day = $total_topics; - } - - if($users_per_day > $total_users) - { - $users_per_day = $total_users; - } - - // - // DB size ... MySQL only - // - // This code is heavily influenced by a similar routine - // in phpMyAdmin 2.2.0 - // - if( preg_match("/^mysql/", SQL_LAYER) ) - { - $sql = "SELECT VERSION() AS mysql_version"; - if($result = $db->sql_query($sql)) - { - $row = $db->sql_fetchrow($result); - $version = $row['mysql_version']; - - if( preg_match("/^(3\.23|4\.|5\.)/", $version) ) - { - $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)|(5\.)/", $version) ) ? "`$dbname`" : $dbname; - - $sql = "SHOW TABLE STATUS - FROM " . $db_name; - if($result = $db->sql_query($sql)) - { - $tabledata_ary = $db->sql_fetchrowset($result); - - $dbsize = 0; - for($i = 0; $i < count($tabledata_ary); $i++) - { - if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" ) - { - if( $table_prefix != "" ) - { - if( strstr($tabledata_ary[$i]['Name'], $table_prefix) ) - { - $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; - } - } - else - { - $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; - } - } - } - } // Else we couldn't get the table status. - } - else - { - $dbsize = $lang['Not_available']; - } - } - else - { - $dbsize = $lang['Not_available']; - } - } - else if( preg_match("/^mssql/", SQL_LAYER) ) - { - $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize - FROM sysfiles"; - if( $result = $db->sql_query($sql) ) - { - $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available']; - } - else - { - $dbsize = $lang['Not_available']; - } - } - else - { - $dbsize = $lang['Not_available']; - } - - if ( is_integer($dbsize) ) - { - if( $dbsize >= 1048576 ) - { - $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); - } - else if( $dbsize >= 1024 ) - { - $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); - } - else - { - $dbsize = sprintf("%.2f Bytes", $dbsize); - } - } - - $template->assign_vars(array( - "NUMBER_OF_POSTS" => $total_posts, - "NUMBER_OF_TOPICS" => $total_topics, - "NUMBER_OF_USERS" => $total_users, - "START_DATE" => $start_date, - "POSTS_PER_DAY" => $posts_per_day, - "TOPICS_PER_DAY" => $topics_per_day, - "USERS_PER_DAY" => $users_per_day, - "AVATAR_DIR_SIZE" => $avatar_dir_size, - "DB_SIZE" => $dbsize, - "GZIP_COMPRESSION" => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF']) - ); - // - // End forum statistics - // - - // - // Get users online information. - // - $sql = "SELECT u.user_id, u.username, u.user_session_time, u.user_session_page, s.session_logged_in, s.session_ip, s.session_start - FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s - WHERE s.session_logged_in = " . TRUE . " - AND u.user_id = s.session_user_id - AND u.user_id <> " . ANONYMOUS . " - AND s.session_time >= " . ( time() - 300 ) . " - ORDER BY u.user_session_time DESC"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Couldn't obtain regd user/online information.", "", __LINE__, __FILE__, $sql); - } - $onlinerow_reg = $db->sql_fetchrowset($result); - - $sql = "SELECT session_page, session_logged_in, session_time, session_ip, session_start - FROM " . SESSIONS_TABLE . " - WHERE session_logged_in = 0 - AND session_time >= " . ( time() - 300 ) . " - ORDER BY session_time DESC"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", "", __LINE__, __FILE__, $sql); - } - $onlinerow_guest = $db->sql_fetchrowset($result); - - $sql = "SELECT forum_name, forum_id - FROM " . FORUMS_TABLE; - if($forums_result = $db->sql_query($sql)) - { - while($forumsrow = $db->sql_fetchrow($forums_result)) - { - $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name']; - } - } - else - { - message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql); - } - - $reg_userid_ary = array(); - - if( count($onlinerow_reg) ) - { - $registered_users = 0; - - for($i = 0; $i < count($onlinerow_reg); $i++) - { - if( !inarray($onlinerow_reg[$i]['user_id'], $reg_userid_ary) ) - { - $reg_userid_ary[] = $onlinerow_reg[$i]['user_id']; - - $username = $onlinerow_reg[$i]['username']; - - if( $onlinerow_reg[$i]['user_allow_viewonline'] || $userdata['user_level'] == ADMIN ) - { - $registered_users++; - $hidden = FALSE; - } - else - { - $hidden_users++; - $hidden = TRUE; - } - - if( $onlinerow_reg[$i]['user_session_page'] < 1 ) - { - switch($onlinerow_reg[$i]['user_session_page']) - { - case PAGE_INDEX: - $location = $lang['Forum_index']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_POSTING: - $location = $lang['Posting_message']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_LOGIN: - $location = $lang['Logging_on']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_SEARCH: - $location = $lang['Searching_forums']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_PROFILE: - $location = $lang['Viewing_profile']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_VIEWONLINE: - $location = $lang['Viewing_online']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_VIEWMEMBERS: - $location = $lang['Viewing_member_list']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_PRIVMSGS: - $location = $lang['Viewing_priv_msgs']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_FAQ: - $location = $lang['Viewing_FAQ']; - $location_url = "index.$phpEx?pane=right"; - break; - default: - $location = $lang['Forum_index']; - $location_url = "index.$phpEx?pane=right"; - } - } - else - { - $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_reg[$i]['user_session_page']); - $location = $forum_data[$onlinerow_reg[$i]['user_session_page']]; - } - - $row_color = ( $registered_users % 2 ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( $registered_users % 2 ) ? $theme['td_class1'] : $theme['td_class2']; - - $reg_ip = decode_ip($onlinerow_reg[$i]['session_ip']); - - $template->assign_block_vars("reg_user_row", array( - "ROW_COLOR" => "#" . $row_color, - "ROW_CLASS" => $row_class, - "USERNAME" => $username, - "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['session_start'], $board_config['board_timezone']), - "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['user_session_time'], $board_config['board_timezone']), - "FORUM_LOCATION" => $location, - "IP_ADDRESS" => $reg_ip, - - "U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$reg_ip", - "U_USER_PROFILE" => append_sid("admin_users.$phpEx?mode=edit&" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']), - "U_FORUM_LOCATION" => append_sid($location_url)) - ); - } - } - - } - else - { - $template->assign_vars(array( - "L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing']) - ); - } - - // - // Guest users - // - if( count($onlinerow_guest) ) - { - $guest_users = 0; - - for($i = 0; $i < count($onlinerow_guest); $i++) - { - $guest_userip_ary[] = $onlinerow_guest[$i]['session_ip']; - $guest_users++; - - if( $onlinerow_guest[$i]['session_page'] < 1 ) - { - switch( $onlinerow_guest[$i]['session_page'] ) - { - case PAGE_INDEX: - $location = $lang['Forum_index']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_POSTING: - $location = $lang['Posting_message']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_LOGIN: - $location = $lang['Logging_on']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_SEARCH: - $location = $lang['Searching_forums']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_PROFILE: - $location = $lang['Viewing_profile']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_VIEWONLINE: - $location = $lang['Viewing_online']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_VIEWMEMBERS: - $location = $lang['Viewing_member_list']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_PRIVMSGS: - $location = $lang['Viewing_priv_msgs']; - $location_url = "index.$phpEx?pane=right"; - break; - case PAGE_FAQ: - $location = $lang['Viewing_FAQ']; - $location_url = "index.$phpEx?pane=right"; - break; - default: - $location = $lang['Forum_index']; - $location_url = "index.$phpEx?pane=right"; - } - } - else - { - $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_guest[$i]['session_page']); - $location = $forum_data[$onlinerow_guest[$i]['session_page']]; - } - - $row_color = ( $guest_users % 2 ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( $guest_users % 2 ) ? $theme['td_class1'] : $theme['td_class2']; - - $guest_ip = decode_ip($onlinerow_guest[$i]['session_ip']); - - $template->assign_block_vars("guest_user_row", array( - "ROW_COLOR" => "#" . $row_color, - "ROW_CLASS" => $row_class, - "USERNAME" => $lang['Guest'], - "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_start'], $board_config['board_timezone']), - "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_time'], $board_config['board_timezone']), - "FORUM_LOCATION" => $location, - "IP_ADDRESS" => $guest_ip, - - "U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$guest_ip", - "U_FORUM_LOCATION" => append_sid($location_url)) - ); - } - - } - else - { - $template->assign_vars(array( - "L_NO_GUESTS_BROWSING" => $lang['No_users_browsing']) - ); - } - - // Check for new version - $current_version = explode('.', '2' . $board_config['version']); - $minor_revision = (int) $current_version[2]; - - $errno = 0; - $errstr = $version_info = ''; - - if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr, 10)) - { - @fputs($fsock, "GET /updatecheck/20x.txt HTTP/1.1\r\n"); - @fputs($fsock, "HOST: www.phpbb.com\r\n"); - @fputs($fsock, "Connection: close\r\n\r\n"); - - $get_info = false; - while (!@feof($fsock)) - { - if ($get_info) - { - $version_info .= @fread($fsock, 1024); - } - else - { - if (@fgets($fsock, 1024) == "\r\n") - { - $get_info = true; - } - } - } - @fclose($fsock); - - $version_info = explode("\n", $version_info); - $latest_head_revision = (int) $version_info[0]; - $latest_minor_revision = (int) $version_info[2]; - $latest_version = (int) $version_info[0] . '.' . (int) $version_info[1] . '.' . (int) $version_info[2]; - - if ($latest_head_revision == 2 && $minor_revision == $latest_minor_revision) - { - $version_info = '<p style="color:green">' . $lang['Version_up_to_date'] . '</p>'; - } - else - { - $version_info = '<p style="color:red">' . $lang['Version_not_up_to_date']; - $version_info .= '<br />' . sprintf($lang['Latest_version_info'], $latest_version) . ' ' . sprintf($lang['Current_version_info'], '2' . $board_config['version']) . '</p>'; - } - } - else - { - if ($errstr) - { - $version_info = '<p style="color:red">' . sprintf($lang['Connect_socket_error'], $errstr) . '</p>'; - } - else - { - $version_info = '<p>' . $lang['Socket_functions_disabled'] . '</p>'; - } - } - - $version_info .= '<p>' . $lang['Mailing_list_subscribe_reminder'] . '</p>'; - - - $template->assign_vars(array( - 'VERSION_INFO' => $version_info, - 'L_VERSION_INFORMATION' => $lang['Version_information']) - ); - $template->pparse("body"); include('./page_footer_admin.'.$phpEx); -} -else -{ - // - // Generate frameset - // - $template->set_filenames(array( - "body" => "admin/index_frameset.tpl") - ); - - $template->assign_vars(array( - "S_FRAME_NAV" => append_sid("index.$phpEx?pane=left"), - "S_FRAME_MAIN" => append_sid("index.$phpEx?pane=right")) - ); - - header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"); - header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - - $template->pparse("body"); - - $db->sql_close(); - exit; - -} - ?> \ No newline at end of file Modified: main/trunk/templates/subSilver/admin/index_body.tpl =================================================================== --- main/trunk/templates/subSilver/admin/index_body.tpl 2006-12-24 06:08:00 UTC (rev 278) +++ main/trunk/templates/subSilver/admin/index_body.tpl 2006-12-26 21:01:11 UTC (rev 279) @@ -1,86 +1,70 @@ - -<h1>{L_WELCOME}</h1> - -<p>{L_ADMIN_INTRO}</p> - -<h1>{L_FORUM_STATS}</h1> - -<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> - <tr> - <th width="25%" nowrap="nowrap" height="25" class="thCornerL">{L_STATISTIC}</th> - <th width="25%" height="25" class="thTop">{L_VALUE}</th> - <th width="25%" nowrap="nowrap" height="25" class="thTop">{L_STATISTIC}</th> - <th width="25%" height="25" class="thCornerR">{L_VALUE}</th> - </tr> - <tr> - <td class="row1" nowrap="nowrap">{L_NUMBER_POSTS}:</td> - <td class="row2"><b>{NUMBER_OF_POSTS}</b></td> - <td class="row1" nowrap="nowrap">{L_POSTS_PER_DAY}:</td> - <td class="row2"><b>{POSTS_PER_DAY}</b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap">{L_NUMBER_TOPICS}:</td> - <td class="row2"><b>{NUMBER_OF_TOPICS}</b></td> - <td class="row1" nowrap="nowrap">{L_TOPICS_PER_DAY}:</td> - <td class="row2"><b>{TOPICS_PER_DAY}</b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap">{L_NUMBER_USERS}:</td> - <td class="row2"><b>{NUMBER_OF_USERS}</b></td> - <td class="row1" nowrap="nowrap">{L_USERS_PER_DAY}:</td> - <td class="row2"><b>{USERS_PER_DAY}</b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap">{L_BOARD_STARTED}:</td> - <td class="row2"><b>{START_DATE}</b></td> - <td class="row1" nowrap="nowrap">{L_AVATAR_DIR_SIZE}:</td> - <td class="row2"><b>{AVATAR_DIR_SIZE}</b></td> - </tr> - <tr> - <td class="row1" nowrap="nowrap">{L_DB_SIZE}:</td> - <td class="row2"><b>{DB_SIZE}</b></td> - <td class="row1" nowrap="nowrap">{L_GZIP_COMPRESSION}:</td> - <td class="row2"><b>{GZIP_COMPRESSION}</b></td> - </tr> -</table> - -<h1>{L_VERSION_INFORMATION}</h1> - -{VERSION_INFO} - -<br /> - -<h1>{L_WHO_IS_ONLINE}</h1> - -<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> - <tr> - <th width="20%" class="thCornerL" height="25"> {L_USERNAME} </th> - <th width="20%" height="25" class="thTop"> {L_STARTED} </th> - <th width="20%" class="thTop"> {L_LAST_UPDATE} </th> - <th width="20%" class="thCornerR"> {L_FORUM_LOCATION} </th> - <th width="20%" height="25" class="thCornerR"> {L_IP_ADDRESS} </th> - </tr> - <!-- BEGIN reg_user_row --> - <tr> - <td width="20%" class="{reg_user_row.ROW_CLASS}"> <span class="gen"><a href="{reg_user_row.U_USER_PROFILE}" class="gen">{reg_user_row.USERNAME}</a></span> </td> - <td width="20%" align="center" class="{reg_user_row.ROW_CLASS}"> <span class="gen">{reg_user_row.STARTED}</span> </td> - <td width="20%" align="center" nowrap="nowrap" class="{reg_user_row.ROW_CLASS}"> <span class="gen">{reg_user_row.LASTUPDATE}</span> </td> - <td width="20%" class="{reg_user_row.ROW_CLASS}"> <span class="gen"><a href="{reg_user_row.U_FORUM_LOCATION}" class="gen">{reg_user_row.FORUM_LOCATION}</a></span> </td> - <td width="20%" class="{reg_user_row.ROW_CLASS}"> <span class="gen"><a href="{reg_user_row.U_WHOIS_IP}" class="gen" target="_phpbbwhois">{reg_user_row.IP_ADDRESS}</a></span> </td> - </tr> - <!-- END reg_user_row --> - <tr> - <td colspan="5" height="1" class="row3"><img src="../templates/subSilver/images/spacer.gif" width="1" height="1" alt="."></td> - </tr> - <!-- BEGIN guest_user_row --> - <tr> - <td width="20%" class="{guest_user_row.ROW_CLASS}"> <span class="gen">{guest_user_row.USERNAME}</span> </td> - <td width="20%" align="center" class="{guest_user_row.ROW_CLASS}"> <span class="gen">{guest_user_row.STARTED}</span> </td> - <td width="20%" align="center" nowrap="nowrap" class="{guest_user_row.ROW_CLASS}"> <span class="gen">{guest_user_row.LASTUPDATE}</span> </td> - <td width="20%" class="{guest_user_row.ROW_CLASS}"> <span class="gen"><a href="{guest_user_row.U_FORUM_LOCATION}" class="gen">{guest_user_row.FORUM_LOCATION}</a></span> </td> - <td width="20%" class="{guest_user_row.ROW_CLASS}"> <span class="gen"><a href="{guest_user_row.U_WHOIS_IP}" target="_phpbbwhois">{guest_user_row.IP_ADDRESS}</a></span> </td> - </tr> - <!-- END guest_user_row --> -</table> - -<br /> +<!-- INCLUDE overall_header.html --> + +<a name="maincontent"></a> + + <h1>Welcome to phpBB Reloaded</h1> + + <p>Admin control panel blablahblahblah</p> + + <table cellspacing="1"> + <caption>Forum Statistics</caption> + <col class="col1" /><col class="col2" /><col class="col1" /><col class="col2" /> + <thead> + <tr> + <th>Statistic</th> + <th>Value</th> + <th>Statistic</th> + <th>Value</th> + </tr> + </thead> + <tbody> + <tr> + <td>Number of posts: </td> + <td><b>0</b></td> + <td>Posts per day: </td> + <td><b>0</b></td> + </tr> + <tr> + <td>Number of topics: </td> + <td><b>0</b></td> + <td>Topics per day: </td> + <td><b>0</b></td> + </tr> + <tr> + <td>Number of users: </td> + <td><b>0</b></td> + <td>Users per day: </td> + <td><b>0</b></td> + </tr> + <tr> + <td>Number of files: </td> + <td><b>0</b></td> + <td>Files per day: </td> + <td><b>0</b></td> + </tr> + + + <tr> + <td>Board started: </td> + <td><b>0</b></td> + <td>Avatar directory size: </td> + <td><b>0</b></td> + </tr> + <tr> + <td>Database Size: </td> + <td><b>0</b></td> + <td>Size of posted attachments: </td> + <td><b></b></td> + </tr> + <tr> + <td>Database server: </td> + <td><b>MySQL 4.1.22-community-nt</b></td> + <td>GZip compression: </td> + <td><b>Off/On</b></td> + </tr> + </tbody> + </table> + +<br /> + +<!-- INCLUDE overall_footer.html --> \ No newline at end of file Modified: main/trunk/templates/subSilver/admin/index_frameset.tpl =================================================================== --- main/trunk/templates/subSilver/admin/index_frameset.tpl 2006-12-24 06:08:00 UTC (rev 278) +++ main/trunk/templates/subSilver/admin/index_frameset.tpl 2006-12-26 21:01:11 UTC (rev 279) @@ -1,4 +1,4 @@ -<html dir="{S_CONTENT_DIRECTION}"> +<!--<html dir="{S_CONTENT_DIRECTION}"> <head> <title>phpBB Administration</title> <meta http-equiv="Content-Type" content="text/html;"> @@ -14,4 +14,5 @@ <p>Sorry, your browser doesn't seem to support frames</p> </body> </noframes> -</html> \ No newline at end of file +</html>--> +{S_FRAME_MAIN} \ No newline at end of file Modified: main/trunk/templates/subSilver/admin/page_header.tpl =================================================================== --- main/trunk/templates/subSilver/admin/page_header.tpl 2006-12-24 06:08:00 UTC (rev 278) +++ main/trunk/templates/subSilver/admin/page_header.tpl 2006-12-26 21:01:11 UTC (rev 279) @@ -1,226 +1,147 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html dir="{S_CONTENT_DIRECTION}"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}"> <head> -{META} -<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" /> -<!-- link rel="stylesheet" href="../templates/subSilver/{T_HEAD_STYLESHEET}" type="text/css" --> -<style type="text/css"> -<!-- -/* - The original subSilver Theme for phpBB version 2+ - Created by subBlue design - http://www.subBlue.com +<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" /> +<meta http-equiv="Content-Style-Type" content="text/css" /> +<meta http-equiv="Content-Language" content="{S_USER_LANG}" /> +<meta http-equiv="imagetoolbar" content="no" /> +<!-- IF META -->{META}<!-- ENDIF --> +<title>{PAGE_TITLE}</title> - NOTE: These CSS definitions are stored within the main page body so that you can use the phpBB2 - theme administration centre. When you have finalised your style you could cut the final CSS code - and place it in an external file, deleting this section to save bandwidth. -*/ - - - /* General page style. The scroll bar colours only visible in IE5.5+ */ -body { - background-color: {T_BODY_BGCOLOR}; - scrollbar-face-color: {T_TR_COLOR2}; - scrollbar-highlight-color: {T_TD_COLOR2}; - scrollbar-shadow-color: {T_TR_COLOR2}; - scrollbar-3dlight-color: {T_TR_COLOR3}; - scrollbar-arrow-color: {T_BODY_LINK}; - scrollbar-track-color: {T_TR_COLOR1}; - scrollbar-darkshadow-color: {T_TH_COLOR1}; -} +<link href="./../templates/subSilver/admin/admin.css" rel="stylesheet" type="text/css" media="screen" /> -/* General font families for common tags */ -font,th,td,p { font-family: {T_FONTFACE1} } -p, td { font-size : {T_FONTSIZE2}; color : {T_BODY_TEXT}; } -a:link,a:active,a:visited { color : {T_BODY_LINK}; } -a:hover { text-decoration: underline; color : {T_BODY_HLINK}; } -hr { height: 0px; border: solid {T_TR_COLOR3} 0px; border-top-width: 1px;} -h1,h2 { font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; font-size : 22px; font-weight : bold; text-decoration : none; line-height : 120%; color : #000000;} +<script type="text/javascript"> +<!-- +var jump_page = '{LA_JUMP_PAGE}:'; +var on_page = '{ON_PAGE}'; +var per_page = '{PER_PAGE}'; +var base_url = '{BASE_URL}'; - -/* This is the border line & background colour round the entire page */ -.bodyline { background-color: {T_TD_COLOR2}; border: 1px {T_TH_COLOR1} solid; } - -/* This is the outline round the main forum tables */ -.forumline { background-color: {T_TD_COLOR2}; border: 2px {T_TH_COLOR2} solid; } - - -/* Main table cell colours and backgrounds */ -td.row1 { background-color: {T_TR_COLOR1}; } -td.row2 { background-color: {T_TR_COLOR2}; } -td.row3 { background-color: {T_TR_COLOR3}; } - - -/* - This is for the table cell above the Topics, Post & Last posts on the index.php page - By default this is the fading out gradiated silver background. - However, you could replace this with a bitmap specific for each forum +/** +* Jump to page */ -td.rowpic { - background-color: {T_TD_COLOR2}; - background-image: url(../templates/subSilver/images/{T_TH_CLASS3}); - background-repeat: repeat-y; -} +function jumpto() +{ + var page = prompt(jump_page, on_page); -/* Header cells - the blue and silver gradient backgrounds */ -th { - color: {T_FONTCOLOR3}; font-size: {T_FONTSIZE2}px; font-weight : bold; - background-color: {T_BODY_LINK}; height: 25px; - background-image: url(../templates/subSilver/images/{T_TH_CLASS2}); + if (page !== null && !isNaN(page) && page > 0) + { + document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page); + } } -td.cat,td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom { - background-image: url(../templates/subSilver/images/{T_TH_CLASS1}); - background-color:{T_TR_COLOR3}; border: {T_TH_COLOR3}; border-style: solid; height: 28px; -} - - -/* - Setting additional nice inner borders for the main table cells. - The names indicate which sides the border will be on. - Don't worry if you don't understand this, just ignore it :-) +/** +* Set display of page element +* s[-1,0,1] = hide,toggle display,show */ -td.cat,td.catHead,td.catBottom { - height: 29px; - border-width: 0px 0px 0px 0px; -} -th.thHead,th.thSides,th.thTop,th.thLeft,th.thRight,th.thBottom,th.thCornerL,th.thCornerR { - font-weight: bold; border: {T_TD_COLOR2}; border-style: solid; height: 28px; } -td.row3Right,td.spaceRow { - background-color: {T_TR_COLOR3}; border: {T_TH_COLOR3}; border-style: solid; } +function dE(n, s, type) +{ + if (!type) + { + type = 'block'; + } -th.thHead,td.catHead { font-size: {T_FONTSIZE3}px; border-width: 1px 1px 0px 1px; } -th.thSides,td.catSides,td.spaceRow { border-width: 0px 1px 0px 1px; } -th.thRight,td.catRight,td.row3Right { border-width: 0px 1px 0px 0px; } -th.thLeft,td.catLeft { border-width: 0px 0px 0px 1px; } -th.thBottom,td.catBottom { border-width: 0px 1px 1px 1px; } -th.thTop { border-width: 1px 0px 0px 0px; } -th.thCornerL { border-width: 1px 0px 0px 1px; } -th.thCornerR { border-width: 1px 1px 0px 0px; } - - -/* The largest text used in the index page title and toptic title etc. */ -.maintitle { - font-weight: bold; font-size: 22px; font-family: "{T_FONTFACE2}",{T_FONTFACE1}; - text-decoration: none; line-height : 120%; color : {T_BODY_TEXT}; + var e = document.getElementById(n); + if (!s) + { + s = (e.style.display == '') ? -1 : 1; + } + e.style.display = (s == 1) ? type : 'none'; } +/** +* Mark/unmark checkboxes +* id = ID of parent container, name = name prefix, state = state [true/false] +*/ +function marklist(id, name, state) +{ + var parent = document.getElementById(id); + if (!parent) + { + eval('parent = document.' + id); + } -/* General text */ -.gen { font-size : {T_FONTSIZE3}px; } -.genmed { font-size : {T_FONTSIZE2}px; } -.gensmall { font-size : {T_FONTSIZE1}px; } -.gen,.genmed,.gensmall { color : {T_BODY_TEXT}; } -a.gen,a.genmed,a.gensmall { color: {T_BODY_LINK}; text-decoration: none; } -a.gen:hover,a.genmed:hover,a.gensmall:hover { color: {T_BODY_HLINK}; text-decoration: underline; } + if (!parent) + { + return; + } - -/* The register, login, search etc links at the top of the page */ -.mainmenu { font-size : {T_FONTSIZE2}px; color : {T_BODY_TEXT} } -a.mainmenu { text-decoration: none; color : {T_BODY_LINK}; } -a.mainmenu:hover{ text-decoration: underline; color : {T_BODY_HLINK}; } - - -/* Forum category titles */ -.cattitle { font-weight: bold; font-size: {T_FONTSIZE3}px ; letter-spacing: 1px; color : {T_BODY_LINK}} -a.cattitle { text-decoration: none; color : {T_BODY_LINK}; } -a.cattitle:hover{ text-decoration: underline; } - - -/* Forum title: Text and link to the forums used in: index.php */ -.forumlink { font-weight: bold; font-size: {T_FONTSIZE3}px; color : {T_BODY_LINK}; } -a.forumlink { text-decoration: none; color : {T_BODY_LINK}; } -a.forumlink:hover{ text-decoration: underline; color : {T_BODY_HLINK}; } - - -/* Used for the navigation text, (Page 1,2,3 etc) and the navigation bar when in a forum */ -.nav { font-weight: bold; font-size: {T_FONTSIZE2}px; color : {T_BODY_TEXT};} -a.nav { text-decoration: none; color : {T_BODY_LINK}; } -a.nav:hover { text-decoration: underline; } - - - -/* Name of poster in viewmsg.php and viewtopic.php and other places */ -.name { font-size : {T_FONTSIZE2}px; color : {T_BODY_TEXT};} - -/* Location, number of posts, post date etc */ -.postdetails { font-size : {T_FONTSIZE1}px; color : {T_BODY_TEXT}; } - - -/* The content of the posts (body of text) */ -.postbody { font-size : {T_FONTSIZE3}px; line-height: 18px} -a.postlink:link { text-decoration: none; color : {T_BODY_LINK} } -a.postlink:visited { text-decoration: none; color : {T_BODY_VLINK}; } -a.postlink:hover { text-decoration: underline; color : {T_BODY_HLINK}} - - -/* Quote & Code blocks */ -.code { - font-family: {T_FONTFACE3}; font-size: {T_FONTSIZE2}px; color: {T_FONTCOLOR2}; - background-color: {T_TD_COLOR1}; border: {T_TR_COLOR3}; border-style: solid; - border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px + var rb = parent.getElementsByTagName('input'); + + for (var r = 0; r < rb.length; r++) + { + if (rb[r].name.substr(0, name.length) == name) + { + rb[r].checked = state; + } + } } -.quote { - font-family: {T_FONTFACE1}; font-size: {T_FONTSIZE2}px; color: {T_FONTCOLOR1}; line-height: 125%; - background-color: {T_TD_COLOR1}; border: {T_TR_COLOR3}; border-style: solid; - border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px +/** +* Open trace popup +*/ +function trace(link) +{ + window.open(link.replace(/&/g, '&'), '_trace', 'height=515, resizable=yes, scrollbars=yes, width=680'); + return false; } - -/* Copyright and bottom info */ -.copyright { font-size: {T_FONTSIZE1}px; font-family: {T_FONTFACE1}; color: {T_FONTCOLOR1}; letter-spacing: -1px;} -a.copyright { color: {T_FONTCOLOR1}; text-decoration: none;} -a.copyright:hover { color: {T_BODY_TEXT}; text-decoration: underline;} - - -/* Form elements */ -input,textarea, select { - color : {T_BODY_TEXT}; - font: normal {T_FONTSIZE2}px {T_FONTFACE1}; - border-color : {T_BODY_TEXT}; +/** +* Find a member +*/ +function find_username() +{ + <!-- IF UA_FIND_USERNAME --> + window.open('{UA_FIND_USERNAME}', '_usersearch', 'height=570, resizable=yes, scrollbars=yes, width=760'); + <!-- ENDIF --> + return false; } -/* The text input fields background colour */ -input.post, textarea.post, select { - background-color : {T_TD_COLOR2}; +/** +* Color swatch +*/ +function swatch(field) +{ + <!-- IF UA_SWATCH --> + window.open('{UA_SWATCH}' + field, '_swatch', 'height=150, resizable=yes, scrollbars=no, width=636'); + <!-- ENDIF --> + return false; } -input { text-indent : 2px; } - -/* The buttons used for bbCode styling in message post */ -input.button { - background-color : {T_TR_COLOR1}; - color : {T_BODY_TEXT}; - font-size: {T_FONTSIZE2}px; font-family: {T_FONTFACE1}; -} - -/* The main submit button option */ -input.mainoption { - background-color : {T_TD_COLOR1}; - font-weight : bold; -} - -/* None-bold submit button */ -input.liteoption { - background-color : {T_TD_COLOR1}; - font-weight : normal; -} - -/* This is the line in the posting page which shows the rollover - help line. This is actually a text box, but if set to be the same - colour as the background no one will know ;) -*/ -.helpline { background-color: {T_TR_COLOR2}; border-style: none; } - - -/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */ -@import url("../templates/subSilver/formIE.css"); ---> -</style> -<title>{SITENAME} - {L_PHPBB_ADMIN}</title> +//--> +</script> </head> -<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}"> -<a name="top"></a> +<body> +<div id="wrap"> + <div id="page-header"> + <h1>Administration Panel</h1> + <p><a href="./">Admin Index</a> • <a href="../">Forum Index</a></p> + </div> + + <div id="page-body"> + <div id="tabs"> + <ul> + <li><a href="./index.php"><span>General</span></a></li> + <li><a href="./index.php?i=forums"><span>Forums</span></a></li> + <li><a href="./index.php?i=posting"><span>Posting</span></a></li> + <li><a href="./index.php?i=users"><span>Users and Groups</span></a></li> + <li><a href="./index.php?i=perms"><span>Permissions</span></a></li> + <li><a href="./index.php?i=styles"><span>Styles</span></a></li> + <li><a href="./index.php?i=maint"><span>Maintenance</span></a></li> + <li><a href="./index.php?i=system"><span>System</span></a></li> + </ul> + </div> + + <div class="panel"> + <span class="corners-top"><span></span></span> + <div id="content"> + <div id="menu"> + <p>You are logged in as<br /><strong>tehphpmaster</strong> [ <a href="{U_LOGOUT}">{L_LOGOUT}</a> ]</p> + <ul> + <li><a href="./index.php"><span>General</span></a></li> + </ul> + </div> + + <div id="main"> Added: main/trunk/templates/subSilver/images/bg_header.gif =================================================================== (Binary files differ) Property changes on: main/trunk/templates/subSilver/images/bg_header.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: main/trunk/templates/subSilver/images/bg_tabs1.gif =================================================================== (Binary files differ) Property changes on: main/trunk/templates/subSilver/images/bg_tabs1.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: main/trunk/templates/subSilver/images/bg_tabs2.gif =================================================================== (Binary files differ) Property changes on: main/trunk/templates/subSilver/images/bg_tabs2.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mj...@us...> - 2006-12-31 16:08:17
|
Revision: 282 http://svn.sourceforge.net/phpbbreloaded/?rev=282&view=rev Author: mjnr Date: 2006-12-31 08:08:16 -0800 (Sun, 31 Dec 2006) Log Message: ----------- Added basic functionality to cope with additional (non phpBBreloaded specific) packages. Also started the ball rolling with the first graft of the anti-spam GPL software Bad Behavio(u)r. (Version 2.0.8) Have included a new directory off the root called 'extras'. This should be used to store any externally developed packages / libraries that we wish to release with phpBBreloaded (such as Bad Behavio(u)r). Modified Paths: -------------- main/trunk/common.php Added Paths: ----------- main/trunk/extras/ main/trunk/extras/Bad-Behavior/ main/trunk/extras/Bad-Behavior/bad-behavior/ main/trunk/extras/Bad-Behavior/bad-behavior/admin.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/banned.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/blackhole.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/blacklist.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/common_tests.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/core.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/functions.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/google.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/housekeeping.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/index.html main/trunk/extras/Bad-Behavior/bad-behavior/konqueror.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/lynx.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/movabletype.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/mozilla.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/msie.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/msnbot.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/opera.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/post.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/responses.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/safari.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/screener.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/trackback.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/version.inc.php main/trunk/extras/Bad-Behavior/bad-behavior/whitelist.inc.php main/trunk/extras/Bad-Behavior/bad-behavior-phpBBreloaded.php main/trunk/extras/Bad-Behavior/index.html main/trunk/extras_config.php Modified: main/trunk/common.php =================================================================== --- main/trunk/common.php 2006-12-30 04:58:08 UTC (rev 281) +++ main/trunk/common.php 2006-12-31 16:08:16 UTC (rev 282) @@ -176,6 +176,11 @@ include($phpbb_root_path . 'config.'.$phpEx); +/******************************************************************************* + * Include support for phpBBreloaded extra packages now. + ******************************************************************************/ +include($phpbb_root_path . 'extras_config.'.$phpEx); + if( !defined("PHPBB_INSTALLED") ) { header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx); @@ -189,6 +194,18 @@ include($phpbb_root_path . 'includes/functions.'.$phpEx); include($phpbb_root_path . 'includes/db.'.$phpEx); +/******************************************************************************* + * If specified, include the 'Bad Behaviour' code now... + * http://homelandstupidity.us/software/bad-behavior/ + * I have placed this here as I may want access to the db functions later in + * order to utilise the Bad Behaviour logging. For now it's a simple spam + * blocker! + ******************************************************************************/ +if(defined('BAD_BEHAVIOUR_ROOT')) +{ + include(BAD_BEHAVIOUR_ROOT . 'bad-behavior-phpBBreloaded.'.$phpEx); +} + // We do not need this any longer, unset for safety purposes unset($dbpasswd); Added: main/trunk/extras/Bad-Behavior/bad-behavior/admin.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/admin.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/admin.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,75 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +function bb2_admin_pages() { + if (function_exists('current_user_can')) { + // The new 2.x way + if (current_user_can('manage_options')) { + $bb2_is_admin = true; + } + } else { + // The old 1.x way + global $user_ID; + if (user_can_edit_user($user_ID, 0)) { + $bb2_is_admin = true; + } + } + + if ($bb2_is_admin) { + add_options_page(__("Bad Behavior"), __("Bad Behavior"), 8, 'bb2_options', 'bb2_options'); + } +} + +function bb2_options() +{ + $settings = bb2_read_settings(); + + if ($_POST) { + if ($_POST['display_stats']) { + $settings['display_stats'] = true; + } else { + $settings['display_stats'] = false; + } + if ($_POST['strict']) { + $settings['strict'] = true; + } else { + $settings['strict'] = false; + } + if ($_POST['verbose']) { + $settings['verbose'] = true; + } else { + $settings['verbose'] = false; + } + bb2_write_settings($settings); +?> + <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div> +<?php + } +?> + <div class="wrap"> + <h2><?php _e("Bad Behavior"); ?></h2> + <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> + <p>For more information please visit the <a href="http://www.homelandstupidity.us/software/bad-behavior/">Bad Behavior</a> homepage.</p> + <p>If you find Bad Behavior valuable, please consider making a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=error%40ioerror%2eus&item_name=Bad%20Behavior%20<?php echo BB2_VERSION; ?>%20%28From%20Admin%29&no_shipping=1&cn=Comments%20about%20Bad%20Behavior&tax=0¤cy_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8">financial contribution</a> to further development of Bad Behavior.</p> + + <fieldset class="options"> + <legend><?php _e('Statistics'); ?></legend> + <?php bb2_insert_stats(true); ?> + <p><label><input type="checkbox" name="display_stats" value="true" <?php if ($settings['display_stats']) { ?>checked="checked" <?php } ?>/> <?php _e('Display statistics in blog footer'); ?></label></p> + </fieldset> + + <fieldset class="options"> + <legend><?php _e('Logging'); ?></legend> + <p><label><input type="checkbox" name="verbose" value="true" <?php if ($settings['verbose']) { ?>checked="checked" <?php } ?>/> <?php _e('Verbose HTTP request logging'); ?></label></p> + <legend><?php _e('Strict Mode'); ?></legend> + <p><label><input type="checkbox" name="strict" value="true" <?php if ($settings['strict']) { ?>checked="checked" <?php } ?>/> <?php _e('Strict checking (blocks more spam but may block some people)'); ?></label></p> + </fieldset> + + <p class="submit"><input type="submit" name="submit" value="<?php _e('Update »'); ?>" /></p> + </form> + </div> +<?php +} + +add_action('admin_menu', 'bb2_admin_pages'); + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/banned.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/banned.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/banned.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,48 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Functions called when a request has been denied +// This part can be gawd-awful slow, doesn't matter :) + +require_once(BB2_CORE . "/responses.inc.php"); + +function bb2_display_denial($settings, $key, $previous_key = false) +{ + if (!$previous_key) $previous_key = $key; + if ($key == "e87553e1") { + // FIXME: lookup the real key + } + // Create support key + $ip = explode(".", $_SERVER['REMOTE_ADDR']); + $ip_hex = ""; + foreach ($ip as $octet) { + $ip_hex .= str_pad(dechex($octet), 2, 0, STR_PAD_LEFT); + } + $support_key = implode("-", str_split("$ip_hex$key", 4)); + + // Get response data + $response = bb2_get_response($previous_key); + header("HTTP/1.1 " . $response['response'] . " Bad Behavior"); + header("Status: " . $response['response'] . " Bad Behavior"); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>HTTP Error <?php echo $response['response']; ?></title> +</head> +<body> +<h1>Error <?php echo $response['response']; ?></h1> +<p>We're sorry, but we could not fulfill your request for +<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?> on this server.</p> +<p><?php echo $response['explanation']; ?></p> +<p>Your technical support key is: <strong><?php echo $support_key; ?></strong></p> +<p>You can use this key to <a href="http://www.ioerror.us/bb2-support-key?key=<?php echo $support_key; ?>">fix this problem yourself</a>.</p> +<p>If you are unable to fix the problem yourself, please contact <a href="mailto:<?php echo htmlspecialchars(str_replace("@", "+nospam@nospam.", bb2_email())); ?>"><?php echo htmlspecialchars(str_replace("@", " at ", bb2_email())); ?></a> and be sure to provide the technical support key shown above.</p> +<?php +} + +function bb2_log_denial($settings, $package, $key, $previous_key=false) +{ + bb2_db_query(bb2_insert($settings, $package, $key)); +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/blackhole.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/blackhole.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/blackhole.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,37 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Look up address on various blackhole lists. +// These cannot be used for GET requests under any circumstances! +function bb2_blackhole($package) { + // Only conservative lists + $bb2_blackhole_lists = array( + "sbl-xbl.spamhaus.org", // All around nasties +// "dnsbl.sorbs.net", // Old useless data. +// "list.dsbl.org", // Old useless data. + "dnsbl.ioerror.us", // Bad Behavior Blackhole + ); + + // Things that shouldn't be blocked, from aggregate lists + $bb2_blackhole_exceptions = array( + "sbl-xbl.spamhaus.org" => array("127.0.0.4"), // CBL is problematic + "dnsbl.sorbs.net" => array("127.0.0.10",), // Dynamic IPs only + "list.dsbl.org" => array(), + "dnsbl.ioerror.us" => array(), + ); + + // Check the blackhole lists + $ip = $package['ip']; + $find = implode('.', array_reverse(explode('.', $ip))); + foreach ($bb2_blackhole_lists as $dnsbl) { + $result = gethostbynamel($find . "." . $dnsbl . "."); + if (!empty($result)) { + // Got a match and it isn't on the exception list + $result = @array_diff($result, $bb2_blackhole_exceptions[$dnsbl]); + if (!empty($result)) { + return '136673cd'; + } + } + } + return false; +} +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/blacklist.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/blacklist.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/blacklist.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,106 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +function bb2_blacklist($package) { + + // Blacklisted user agents + // These user agent strings occur at the beginning of the line. + $bb2_spambots_0 = array( + "<sc", // XSS exploit attempts + "8484 Boston Project", // video poker/porn spam + "adwords", // referrer spam + "autoemailspider", // spam harvester + "blogsearchbot-martin", // from honeypot + "Digger", // spam harvester + "ecollector", // spam harvester + "EmailCollector", // spam harvester + "Email Extractor", // spam harvester + "Email Siphon", // spam harvester + "EmailSiphon", // spam harvester + "grub crawler", // misc comment/email spam + "HttpProxy", // misc comment/email spam + "Internet Explorer", // XMLRPC exploits seen + "Jakarta Commons", // custommised spambots + "Java 1.", // definitely a spammer + "Java/1.", // definitely a spammer + "libwww-perl", // spambot scripts + "LWP", // spambot scripts + "Microsoft URL", // spam harvester + "Missigua", // spam harvester + "Movable Type", // customised spambots + "Mozilla ", // malicious software + "Mozilla/4.0(", // from honeypot + "Mozilla/4.0+(", // suspicious harvester + "MSIE", // malicious software + "OmniExplorer", // spam harvester + "PussyCat ", // misc comment spam + "psycheclone", // spam harvester + "Shockwave Flash", // spam harvester + "User Agent: ", // spam harvester + "User-Agent: ", // spam harvester + "Wordpress Hash Grabber",// malicious software + "\"", // malicious software + ); + + // These user agent strings occur anywhere within the line. + $bb2_spambots = array( + "\r", // A really dumb bot + "; Widows ", // misc comment/email spam + "a href=", // referrer spam + "Bad Behavior Test", // Add this to your user-agent to test BB + "compatible ; MSIE", // misc comment/email spam + "compatible-", // misc comment/email spam + "DTS Agent", // misc comment/email spam + "Gecko/25", // revisit this in 500 years + "grub-client", // search engine ignores robots.txt + "hanzoweb", // very badly behaved crawler + "Indy Library", // misc comment/email spam + "larbin@unspecified", // stealth harvesters + "Murzillo compatible", // comment spam bot + ".NET CLR 1)", // free poker, etc. + "POE-Component-Client", // free poker, etc. + "Turing Machine", // www.anonymizer.com abuse + "WISEbot", // spam harvester + "WISEnutbot", // spam harvester + "Windows NT 4.0;)", // wikispam bot + "Windows NT 5.0;)", // wikispam bot + "Windows NT 5.1;)", // wikispam bot + "Windows XP 5", // spam harvester + "\\\\)", // spam harvester + ); + + // These are regular expression matches. + $bb2_spambots_regex = array( + "/^[A-Z]{10}$/", // misc email spam + "/^Mozilla...[05]$/i", // fake user agent/email spam + "/[bcdfghjklmnpqrstvwxz ]{8,}/", +// "/(;\){1,2}$/", // misc spammers/harvesters +// "/MSIE.*Windows XP/", // misc comment spam + ); + + // Do not edit below this line. + + $ua = $package['headers_mixed']['User-Agent']; + + foreach ($bb2_spambots_0 as $spambot) { + $pos = stripos($ua, $spambot); + if ($pos !== FALSE && $pos == 0) { + return "17f4e8c8"; + } + } + + foreach ($bb2_spambots as $spambot) { + if (stripos($ua, $spambot) !== FALSE) { + return "17f4e8c8"; + } + } + + foreach ($bb2_spambots_regex as $spambot) { + if (preg_match($spambot, $ua)) { + return "17f4e8c8"; + } + } + + return FALSE; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/common_tests.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/common_tests.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/common_tests.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,113 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Enforce adherence to protocol version claimed by user-agent. + +function bb2_protocol($settings, $package) +{ + // Is it claiming to be HTTP/1.0? Then it shouldn't do HTTP/1.1 things + // Always run this test; we should never see Expect: + if (array_key_exists('Expect', $package['headers_mixed']) && stripos($package['headers_mixed']['Expect'], "100-continue") !== FALSE) { + return "a0105122"; + } + + // Is it claiming to be HTTP/1.1? Then it shouldn't do HTTP/1.0 things + // Blocks some common corporate proxy servers in strict mode + if ($settings['strict'] && !strcmp($package['server_protocol'], "HTTP/1.1")) { + if (array_key_exists('Pragma', $package['headers_mixed']) && strpos($package['headers_mixed']['Pragma'], "no-cache") !== FALSE && !array_key_exists('Cache-Control', $package['headers_mixed'])) { + return "41feed15"; + } + } + return false; +} + +function bb2_misc_headers($settings, $package) +{ + $ua = $package['headers_mixed']['User-Agent']; + + if (!strcmp($package['request_method'], "POST") && empty($ua)) { + return "f9f2b8b9"; + } + + // Broken spambots send URLs with various invalid characters + if (strpos($package['request_uri'], "#") !== FALSE || strpos($package['headers_mixed']['Referer'], "#") !== FALSE) { + return "dfd9b1ad"; + } + + // Range: field exists and begins with 0 + // Real user-agents do not start ranges at 0 + // NOTE: this blocks the whois.sc bot. No big loss. + if (array_key_exists('Range', $package['headers_mixed']) && strpos($package['headers_mixed']['Range'], "=0-") !== FALSE) { + if (strncmp($ua, "MovableType", 11)) { + return "7ad04a8a"; + } + } + + // Content-Range is a response header, not a request header + if (array_key_exists('Content-Range', $package['headers_mixed'])) { + return '7d12528e'; + } + + // Lowercase via is used by open proxies/referrer spammers + if (array_key_exists('via', $package['headers'])) { + return "9c9e4979"; + } + + // pinappleproxy is used by referrer spammers + if (array_key_exists('Via', $package['headers_mixed'])) { + if (stripos($package['headers_mixed']['Via'], "pinappleproxy") !== FALSE || stripos($package['headers_mixed']['Via'], "PCNETSERVER") !== FALSE || stripos($package['headers_mixed']['Via'], "Invisiware") !== FALSE) { + return "939a6fbb"; + } + } + + // TE: if present must have Connection: TE + // RFC 2616 14.39 + // Blocks Microsoft ISA Server 2004 in strict mode. Contact Microsoft + // to obtain a hotfix. + if ($settings['strict'] && array_key_exists('Te', $package['headers_mixed'])) { + if (!preg_match('/\bTE\b/', $package['headers_mixed']['Connection'])) { + return "582ec5e4"; + } + } + + if (array_key_exists('Connection', $package['headers_mixed'])) { + // Connection: keep-alive and close are mutually exclusive + if (preg_match('/\bKeep-Alive\b/i', $package['headers_mixed']['Connection']) && preg_match('/\bClose\b/i', $package['headers_mixed']['Connection'])) { + return "a52f0448"; + } + // Close shouldn't appear twice + if (preg_match('/\bclose,\s?close\b/i', $package['headers_mixed']['Connection'])) { + return "a52f0448"; + } + // Keey-Alive shouldn't appear twice either + if (preg_match('/\bkeep-alive,\s?keep-alive\b/i', $package['headers_mixed']['Connection'])) { + return "a52f0448"; + } + } + + + // Headers which are not seen from normal user agents; only malicious bots + if (array_key_exists('X-Aaaaaaaaaaaa', $package['headers_mixed']) || array_key_exists('X-Aaaaaaaaaa', $package['headers_mixed'])) { + return "b9cc1d86"; + } + if (array_key_exists('Proxy-Connection', $package['headers_mixed'])) { + return "b7830251"; + } + + if (array_key_exists('Referer', $package['headers_mixed'])) { + // Referer, if it exists, must not be blank + if (empty($package['headers_mixed'])) { + return "69920ee5"; + } + + // Referer, if it exists, must contain a : + // While a relative URL is technically valid in Referer, all known + // legit user-agents send an absolute URL + if (strpos($package['headers_mixed']['Referer'], ":") === FALSE) { + return "45b35e30"; + } + } + + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/core.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/core.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/core.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,203 @@ +<?php if (!defined('BB2_CWD')) die("I said no cheating!"); + +// Bad Behavior entry point is start_bad_behavior(). +// If you're reading this, you are probably lost. +// Go read the bad-behavior-generic.php file. + +define('BB2_CORE', dirname(__FILE__)); +define('BB2_COOKIE', 'bb2_screener_'); + +require_once(BB2_CORE . "/functions.inc.php"); + +// Our log table structure +function bb2_table_structure($name) +{ + // It's not paranoia if they really are out to get you. + $name_escaped = bb2_db_escape($name); + return "CREATE TABLE IF NOT EXISTS `$name_escaped` ( + `id` INT(11) NOT NULL auto_increment, + `ip` TEXT NOT NULL, + `date` DATETIME NOT NULL default '0000-00-00 00:00:00', + `request_method` TEXT NOT NULL, + `request_uri` TEXT NOT NULL, + `server_protocol` TEXT NOT NULL, + `http_headers` TEXT NOT NULL, + `user_agent` TEXT NOT NULL, + `request_entity` TEXT NOT NULL, + `key` TEXT NOT NULL, + INDEX (`ip`(15)), + INDEX (`user_agent`(10)), + PRIMARY KEY (`id`) );"; // TODO: INDEX might need tuning +} + +// Insert a new record +function bb2_insert($settings, $package, $key) +{ + $ip = bb2_db_escape($package['ip']); + $date = bb2_db_date(); + $request_method = bb2_db_escape($package['request_method']); + $request_uri = bb2_db_escape($package['request_uri']); + $server_protocol = bb2_db_escape($package['server_protocol']); + $user_agent = bb2_db_escape($package['user_agent']); + $headers = "$request_method $request_uri $server_protocol\n"; + foreach ($package['headers'] as $h => $v) { + $headers .= bb2_db_escape("$h: $v\n"); + } + $request_entity = ""; + if (!strcasecmp($request_method, "POST")) { + foreach ($package['request_entity'] as $h => $v) { + $request_entity .= bb2_db_escape("$h: $v\n"); + } + } + return "INSERT INTO `" . bb2_db_escape($settings['log_table']) . "` + (`ip`, `date`, `request_method`, `request_uri`, `server_protocol`, `http_headers`, `user_agent`, `request_entity`, `key`) VALUES + ('$ip', '$date', '$request_method', '$request_uri', '$server_protocol', '$headers', '$user_agent', '$request_entity', '$key')"; +} + +// Kill 'em all! +function bb2_banned($settings, $package, $key, $previous_key=false) +{ + // Some spambots hit too hard. Slow them down a bit. + sleep(2); + + require_once(BB2_CORE . "/banned.inc.php"); + bb2_display_denial($settings, $key, $previous_key); + bb2_log_denial($settings, $package, $key, $previous_key); + if (is_callable('bb2_banned_callback')) { + bb2_banned_callback($settings, $package, $key); + } + // Penalize the spammers some more + require_once(BB2_CORE . "/housekeeping.inc.php"); + bb2_housekeeping($settings, $package); + die(); +} + +function bb2_approved($settings, $package) +{ + // Dirk wanted this + if (is_callable('bb2_approved_callback')) { + bb2_approved_callback($settings, $package); + } + + // Decide what to log on approved requests. + if ($settings['verbose'] || empty($package['user_agent'])) { + bb2_db_query(bb2_insert($settings, $package, "00000000")); + } +} + +// Check the results of a particular test; see below for usage +// Returns FALSE if test passed (yes this is backwards) +function bb2_test($settings, $package, $result) +{ + if ($result !== FALSE) + { + bb2_banned($settings, $package, $result); + return TRUE; + } + return FALSE; +} + + +// Let God sort 'em out! +function bb2_start($settings) +{ + // Gather up all the information we need, first of all. + $headers = bb2_load_headers(); + // Postprocess the headers to mixed-case + // FIXME: get the world to stop using PHP as CGI + $headers_mixed = array(); + foreach ($headers as $h => $v) { + $headers_mixed[uc_all($h)] = $v; + } + + // We use these frequently. Keep a copy close at hand. + $ip = $_SERVER['REMOTE_ADDR']; + $request_method = $_SERVER['REQUEST_METHOD']; + $request_uri = $_SERVER['REQUEST_URI']; + $server_protocol = $_SERVER['SERVER_PROTOCOL']; + $user_agent = $_SERVER['HTTP_USER_AGENT']; + + // Reconstruct the HTTP entity, if present. + $request_entity = array(); + if (!strcasecmp($request_method, "POST") || !strcasecmp($request_method, "PUT")) { + foreach ($_POST as $h => $v) { + $request_entity[$h] = $v; + } + } + + $package = array('ip' => $ip, 'headers' => $headers, 'headers_mixed' => $headers_mixed, 'request_method' => $request_method, 'request_uri' => $request_uri, 'server_protocol' => $server_protocol, 'request_entity' => $request_entity, 'user_agent' => $user_agent, 'is_browser' => false); + + // Please proceed to the security checkpoint and have your + // identification and boarding pass ready. + + // First check the whitelist + require_once(BB2_CORE . "/whitelist.inc.php"); + if (!bb2_whitelist($package)) { + // Now check the blacklist + require_once(BB2_CORE . "/blacklist.inc.php"); + bb2_test($settings, $package, bb2_blacklist($package)); + + // Check for common stuff + require_once(BB2_CORE . "/common_tests.inc.php"); + bb2_test($settings, $package, bb2_protocol($settings, $package)); + bb2_test($settings, $package, bb2_misc_headers($settings, $package)); + + // Specific checks + $ua = $headers_mixed['User-Agent']; + // MSIE checks + if (stripos($ua, "MSIE") !== FALSE) { + $package['is_browser'] = true; + if (stripos($ua, "Opera") !== FALSE) { + require_once(BB2_CORE . "/opera.inc.php"); + bb2_test($settings, $package, bb2_opera($package)); + } else { + require_once(BB2_CORE . "/msie.inc.php"); + bb2_test($settings, $package, bb2_msie($package)); + } + } elseif (stripos($ua, "Konqueror") !== FALSE) { + $package['is_browser'] = true; + require_once(BB2_CORE . "/konqueror.inc.php"); + bb2_test($settings, $package, bb2_konqueror($package)); + } elseif (stripos($ua, "Opera") !== FALSE) { + $package['is_browser'] = true; + require_once(BB2_CORE . "/opera.inc.php"); + bb2_test($settings, $package, bb2_opera($package)); + } elseif (stripos($ua, "Safari") !== FALSE) { + $package['is_browser'] = true; + require_once(BB2_CORE . "/safari.inc.php"); + bb2_test($settings, $package, bb2_safari($package)); + } elseif (stripos($ua, "Lynx") !== FALSE) { + $package['is_browser'] = true; + require_once(BB2_CORE . "/lynx.inc.php"); + bb2_test($settings, $package, bb2_lynx($package)); + } elseif (stripos($ua, "MovableType") !== FALSE) { + require_once(BB2_CORE . "/movabletype.inc.php"); + bb2_test($settings, $package, bb2_movabletype($package)); + } elseif (stripos($ua, "msnbot") !== FALSE || stripos($ua, "MS Search") !== FALSE) { + require_once(BB2_CORE . "/msnbot.inc.php"); + bb2_test($settings, $package, bb2_msnbot($package)); + } elseif (stripos($ua, "Googlebot") !== FALSE || stripos($ua, "Mediapartners-Google") !== FALSE) { + require_once(BB2_CORE . "/google.inc.php"); + bb2_test($settings, $package, bb2_google($package)); + } elseif (stripos($ua, "Mozilla") !== FALSE && stripos($ua, "Mozilla" == 0)) { + $package['is_browser'] = true; + require_once(BB2_CORE . "/mozilla.inc.php"); + bb2_test($settings, $package, bb2_mozilla($package)); + } + + // More intensive screening applies to POST requests + if (!strcasecmp('POST', $package['request_method'])) { + require_once(BB2_CORE . "/post.inc.php"); + bb2_test($settings, $package, bb2_post($settings, $package)); + } + } + + // Last chance screening. + require_once(BB2_CORE . "/screener.inc.php"); + bb2_screener($settings, $package); + + // And that's about it. + bb2_approved($settings, $package); + return true; +} +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/functions.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/functions.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/functions.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,69 @@ +<?php if (!defined('BB2_CORE')) die("I said no cheating!"); + +// Miscellaneous helper functions. + +// stripos() needed because stripos is only present on PHP 5 +if (!function_exists('stripos')) { + function stripos($haystack,$needle,$offset = 0) { + return(strpos(strtolower($haystack),strtolower($needle),$offset)); + } +} + +// str_split() needed because str_split is only present on PHP 5 +if (!function_exists('str_split')) { + function str_split($string, $split_length=1) + { + if ($split_length < 1) { + return false; + } + + for ($pos=0, $chunks = array(); $pos < strlen($string); $pos+=$split_length) { + $chunks[] = substr($string, $pos, $split_length); + } + return $chunks; + } +} + +// Convert a string to mixed-case on word boundaries. +function uc_all($string) { + $temp = preg_split('/(\W)/', str_replace("_", "-", $string), -1, PREG_SPLIT_DELIM_CAPTURE); + foreach ($temp as $key=>$word) { + $temp[$key] = ucfirst(strtolower($word)); + } + return join ('', $temp); +} + +// Determine if an IP address resides in a CIDR netblock or netblocks. +function match_cidr($addr, $cidr) { + $output = false; + + if (is_array($cidr)) { + foreach ($cidr as $cidrlet) { + if (match_cidr($addr, $cidrlet)) { + $output = true; + } + } + } else { + list($ip, $mask) = explode('/', $cidr); + $mask = 0xffffffff << (32 - $mask); + $output = ((ip2long($addr) & $mask) == (ip2long($ip) & $mask)); + } + return $output; +} + +// Obtain all the HTTP headers. +// NB: on PHP-CGI we have to fake it out a bit, since we can't get the REAL +// headers. Run PHP as Apache 2.0 module if possible for best results. +function bb2_load_headers() { + if (!is_callable('getallheaders')) { + $headers = array(); + foreach ($_SERVER as $h => $v) + if (ereg('HTTP_(.+)', $h, $hp)) + $headers[str_replace("_", "-", uc_all($hp[1]))] = $v; + } else { + $headers = getallheaders(); + } + return $headers; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/google.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/google.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/google.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,13 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be Googlebot + +function bb2_google($package) +{ + if (match_cidr($package['ip'], "66.249.64.0/19") === FALSE && match_cidr($package['ip'], "64.233.160.0/19") === FALSE) { + return "f1182195"; + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/housekeeping.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/housekeeping.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/housekeeping.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,16 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +function bb2_housekeeping($settings, $package) +{ + // FIXME Yes, the interval's hard coded (again) for now. + $query = "DELETE FROM `" . $settings['log_table'] . "` WHERE `date` < DATE_SUB('" . bb2_db_date() . "', INTERVAL 7 DAY)"; + bb2_db_query($query); + + // Waste a bunch more of the spammer's time, sometimes. + if (rand(1,1000) == 1) { + $query = "OPTIMIZE TABLE `" . $settings['log_table'] . "`"; + bb2_db_query($query); + } +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/index.html =================================================================== Added: main/trunk/extras/Bad-Behavior/bad-behavior/konqueror.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/konqueror.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/konqueror.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,17 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be Konqueror + +function bb2_konqueror($package) +{ + // CafeKelsa is a dev project at Yahoo which indexes job listings for + // Yahoo! HotJobs. It identifies as Konqueror so we skip these checks. + if (stripos($package['headers_mixed']['User-Agent'], "YahooSeeker/CafeKelsa") === FALSE || match_cidr($package['ip'], "209.73.160.0/19") === FALSE) { + if (!array_key_exists('Accept', $package['headers_mixed'])) { + return "17566707"; + } + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/lynx.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/lynx.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/lynx.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,13 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be Lynx + +function bb2_lynx($package) +{ + if (!array_key_exists('Accept', $package['headers_mixed'])) { + return "17566707"; + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/movabletype.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/movabletype.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/movabletype.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,14 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +function bb2_movabletype($package) +{ + // Is it a trackback? + if (strcasecmp($package['request_method'], "POST")) { + if (strcmp($package['headers_mixed']['Range'], "bytes=0-99999")) { + return "7d12528e"; + } + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/mozilla.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/mozilla.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/mozilla.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,19 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be Mozilla + +function bb2_mozilla($package) +{ + // First off, workaround for Google Desktop, until they fix it FIXME + // Google Desktop fixed it, but apparently some old versions are + // still out there. :( + // Always check accept header for Mozilla user agents + if (strpos($package['headers_mixed']['User-Agent'], "Google Desktop") === FALSE) { + if (!array_key_exists('Accept', $package['headers_mixed'])) { + return "17566707"; + } + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/msie.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/msie.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/msie.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,24 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be MSIE + +function bb2_msie($package) +{ + if (!array_key_exists('Accept', $package['headers_mixed'])) { + return "17566707"; + } + + // MSIE does NOT send "Windows ME" or "Windows XP" in the user agent + if (strpos($package['headers_mixed']['User-Agent'], "Windows ME") !== FALSE || strpos($package['headers_mixed']['User-Agent'], "Windows XP") !== FALSE || strpos($package['headers_mixed']['User-Agent'], "Windows 2000") !== FALSE || strpos($package['headers_mixed']['User-Agent'], "Win32") !== FALSE) { + return "a1084bad"; + } + + // MSIE does NOT send Connection: TE + if (preg_match('/\bTE\b/i', $package['headers_mixed']['Connection'])) { + return "2b90f772"; + } + + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/msnbot.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/msnbot.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/msnbot.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,13 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be msnbot + +function bb2_msnbot($package) +{ + if (match_cidr($package['ip'], "207.46.0.0/16") === FALSE && match_cidr($package['ip'], "65.52.0.0/14") === FALSE && match_cidr($package['ip'], "207.68.128.0/18") === FALSE && match_cidr($package['ip'], "207.68.192.0/20") === FALSE && match_cidr($package['ip'], "64.4.0.0/18") === FALSE) { + return "e4de0453"; + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/opera.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/opera.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/opera.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,13 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be Opera + +function bb2_opera($package) +{ + if (!array_key_exists('Accept', $package['headers_mixed'])) { + return "17566707"; + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/post.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/post.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/post.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,68 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// All tests which apply specifically to POST requests +function bb2_post($settings, $package) +{ + // Check blackhole lists for known spam/malicious activity + require_once(BB2_CORE . "/blackhole.inc.php"); + bb2_test($settings, $package, bb2_blackhole($package)); + + // MovableType needs specialized screening + if (stripos($package['headers_mixed']['User-Agent'], "MovableType") !== FALSE) { + if (strcmp($package['headers_mixed']['Range'], "bytes=0-99999")) { + return "7d12528e"; + } + } + + // Trackbacks need special screening + $request_entity = $package['request_entity']; + if (isset($request_entity['title']) && isset($request_entity['url']) && isset($request_entity['blog_name'])) { + require_once(BB2_CORE . "/trackback.inc.php"); + return bb2_trackback($package); + } + + // Catch a few completely broken spambots + foreach ($request_entity as $key => $value) { + $pos = strpos($key, " document.write"); + if ($pos !== FAlSE) { + return "dfd9b1ad"; + } + } + + // Screen by cookie/JavaScript form add + if (isset($_COOKIE[BB2_COOKIE])) { + $screener1 = explode(" ", $_COOKIE[BB2_COOKIE]); + } + if (isset($_POST[BB2_COOKIE])) { + $screener2 = explode(" ", $_POST[BB2_COOKIE]); + } + $screener = max($screener1[0], $screener2[0]); + + if ($screener > 0) { + // Posting too fast? 5 sec + // FIXME: even 5 sec is too intrusive + // if ($screener + 5 > time()) + // return "408d7e72"; + // Posting too slow? 48 hr + if ($screener + 172800 < time()) + return "b40c8ddc"; + + // Screen by IP address + $ip = ip2long($package['ip']); + $ip_screener = ip2long($screener[1]); +// FIXME: This is b0rked, but why? +// if ($ip && $ip_screener && abs($ip_screener - $ip) > 256) +// return "c1fa729b"; + + // Screen for user agent changes + // User connected previously with blank user agent + $q = bb2_db_query("SELECT `ip` FROM " . $settings['log_table'] . " WHERE (`ip` = '" . $package['ip'] . "' OR `ip` = '" . $screener[1] . "') AND `user_agent` != '" . $package['user_agent'] . "' AND `date` > DATE_SUB('" . bb2_db_date() . "', INTERVAL 5 MINUTE)"); + // Damnit, too many ways for this to fail :( + if ($q !== FALSE && $q != NULL && bb2_db_num_rows($q) > 0) + return "799165c2"; + } + + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/responses.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/responses.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/responses.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,44 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Defines the responses which Bad Behavior might return. + +function bb2_get_response($key) { + $bb2_responses = array( + '00000000' => array('response' => 200, 'explanation' => '', 'log' => ''), + '136673cd' => array('response' => 403, 'explanation' => 'Your Internet Protocol address is listed on a blacklist of addresses involved in malicious or illegal activity. See the listing below for more details on specific blacklists and removal procedures.', 'log' => 'IP address found on external blacklist'), + '17566707' => array('response' => 403, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Required header \'Accept\' missing'), + '17f4e8c8' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'User-Agent was found on blacklist'), + '21f11d3f' => array('response' => 403, 'explanation' => 'An invalid request was received. You claimed to be a mobile Web device, but you do not actually appear to be a mobile Web device.', 'log' => 'User-Agent claimed to be AvantGo, claim appears false'), + '2b90f772' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. If you are using the Opera browser, then Opera must appear in your user agent.', 'log' => 'Connection: TE present, not supported by MSIE'), + '408d7e72' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, run anti-virus and anti-spyware software and remove any viruses and spyware from your computer.', 'log' => 'POST comes too quickly after GET'), + '41feed15' => array('response' => 400, 'explanation' => 'An invalid request was received. This may be caused by a malfunctioning proxy server. Bypass the proxy server and connect directly, or contact your proxy server administrator.', 'log' => 'Header \'Pragma\' without \'Cache-Control\' prohibited for HTTP/1.1 requests'), + '45b35e30' => array('response' => 403, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Header \'Referer\' is corrupt'), + '57796684' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, run anti-virus and anti-spyware software and remove any viruses and spyware from your computer.', 'log' => 'Prohibited header \'X-Aaaaaaaaaa\' or \'X-Aaaaaaaaaaaa\' present'), + '582ec5e4' => array('response' => 400, 'explanation' => 'An invalid request was received. If you are using a proxy server, bypass the proxy server or contact your proxy server administrator. This may also be caused by a bug in the Opera web browser.', 'log' => '"Header \'TE\' present but TE not specified in \'Connection\' header'), + '69920ee5' => array('response' => 403, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Header \'Referer\' present but blank'), + '799165c2' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'Rotating user-agents detected'), + '7a06532b' => array('response' => 400, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Required header \'Accept-Encoding\' missing'), + '7ad04a8a' => array('response' => 400, 'explanation' => 'The automated program you are using is not permitted to access this server. Please use a different program or a standard Web browser.', 'log' => 'Prohibited header \'Range\' present'), + '7d12528e' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'Prohibited header \'Range\' or \'Content-Range\' in POST request'), + '939a6fbb' => array('response' => 403, 'explanation' => 'The proxy server you are using is not permitted to access this server. Please bypass the proxy server, or contact your proxy server administrator.', 'log' => 'Banned proxy server in use'), + '9c9e4979' => array('response' => 403, 'explanation' => 'The proxy server you are using is not permitted to access this server. Please bypass the proxy server, or contact your proxy server administrator.', 'log' => 'Prohibited header \'via\' present'), + 'a0105122' => array('response' => 417, 'explanation' => 'Expectation failed. Please retry your request.', 'log' => 'Header \'Expect\' prohibited; resend without Expect'), + 'a1084bad' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'User-Agent claimed to be MSIE, with invalid Windows version'), + 'a52f0448' => array('response' => 400, 'explanation' => 'An invalid request was received. This may be caused by a malfunctioning proxy server or browser privacy software. If you are using a proxy server, bypass the proxy server or contact your proxy server administrator.', 'log' => 'Header \'Connection\' contains invalid values'), + 'b40c8ddc' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, close your browser, run anti-virus and anti-spyware software and remove any viruses and spyware from your computer.', 'log' => 'POST more than two days after GET'), + 'b7830251' => array('response' => 400, 'explanation' => 'Your proxy server sent an invalid request. Please contact the proxy server administrator to have this problem fixed.', 'log' => 'Prohibited header \'Proxy-Connection\' present'), + 'b9cc1d86' => array('response' => 403, 'explanation' => 'The proxy server you are using is not permitted to access this server. Please bypass the proxy server, or contact your proxy server administrator.', 'log' => 'Prohibited header \'X-Aaaaaaaaaa\' or \'X-Aaaaaaaaaaaa\' present'), + 'c1fa729b' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, run anti-virus and anti-spyware software and remove any viruses and spyware from your computer.', 'log' => 'Use of rotating proxy servers detected'), + 'd60b87c7' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, please remove any viruses or spyware from your computer.', 'log' => 'Trackback received via proxy server'), + 'dfd9b1ad' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'Request contained a malicious JavaScript or SQL injection attack'), + 'e4de0453' => array('response' => 403, 'explanation' => 'An invalid request was received. You claimed to be a major search engine, but you do not appear to actually be a major search engine.', 'log' => 'User-Agent claimed to be msnbot, claim appears to be false'), + 'e87553e1' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'I know you and I don\'t like you, dirty spammer.'), + 'f0dcb3fd' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, run anti-virus and anti-spyware software and remove any viruses and spyware from your computer.', 'log' => 'Web browser attempted to send a trackback'), + 'f1182195' => array('response' => 403, 'explanation' => 'An invalid request was received. You claimed to be a major search engine, but you do not appear to actually be a major search engine.', 'log' => 'User-Agent claimed to be Googlebot, claim appears to be false.'), + 'f9f2b8b9' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'A User-Agent is required but none was provided.'), + ); + + if (array_key_exists($key, $bb2_responses)) return $bb2_responses[$key]; + return array('00000000'); +} +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/safari.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/safari.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/safari.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,13 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Analyze user agents claiming to be Safari + +function bb2_safari($package) +{ + if (!array_key_exists('Accept', $package['headers_mixed'])) { + return "17566707"; + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/screener.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/screener.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/screener.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,63 @@ +<?php if (!defined('BB2_CWD')) die("I said no cheating!"); + +// Bad Behavior browser screener + +function bb2_screener_cookie($settings, $package, $cookie_name, $cookie_value) +{ + // FIXME: Set the real cookie + setcookie($cookie_name, $cookie_value, 0, bb2_relative_path()); +} + +function bb2_screener_javascript($settings, $package, $cookie_name, $cookie_value) +{ + global $bb2_javascript; + + // FIXME: do something + $bb2_javascript = "<script type=\"text/javascript\"> +<!-- +function bb2_addLoadEvent(func) { + var oldonload = window.onload; + if (typeof window.onload != 'function') { + window.onload = func; + } else { + window.onload = function() { + oldonload(); + func(); + } + } +} + +bb2_addLoadEvent(function() { + for ( i=0; i < document.forms.length; i++ ) { + if (document.forms[i].method == 'post') { + var myElement = document.createElement('input'); + myElement.setAttribute('type', 'hidden'); + myElement.name = '$cookie_name'; + myElement.value = '$cookie_value'; + document.forms[i].appendChild(myElement); + } + } +}); +// --></script> + "; +} + +function bb2_screener($settings, $package) +{ + $cookie_name = BB2_COOKIE; + + // Set up a simple cookie + $screener = array(time(), $package['ip']); + if (isset($package['headers_mixed']['X-Forwarded-For'])) { + array_push($screener, $package['headers_mixed']['X-Forwarded-For']); + } + if (isset($package['headers_mixed']['Client-Ip'])) { + array_push($screener, $package['headers_mixed']['Client-Ip']); + } + + $cookie_value = implode(" ", $screener); + + bb2_screener_cookie($settings, $package, BB2_COOKIE, $cookie_value); + bb2_screener_javascript($settings, $package, BB2_COOKIE, $cookie_value); +} +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/trackback.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/trackback.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/trackback.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,18 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +// Specialized screening for trackbacks +function bb2_trackback($package) +{ + // Web browsers don't send trackbacks + if ($package['is_browser']) { + return 'f0dcb3fd'; + } + + // Proxy servers don't send trackbacks either + if (array_key_exists('Via', $package['headers_mixed']) || array_key_exists('Max-Forwards', $package['headers_mixed']) || array_key_exists('X-Forwarded-For', $package['headers_mixed']) || array_key_exists('Client-Ip', $package['headers_mixed'])) { + return 'd60b87c7'; + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/version.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/version.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/version.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,3 @@ +<?php if (!defined('BB2_CWD')) die("I said no cheating!"); +define('BB2_VERSION', "2.0.8"); +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior/whitelist.inc.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior/whitelist.inc.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior/whitelist.inc.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,57 @@ +<?php if (!defined('BB2_CORE')) die('I said no cheating!'); + +function bb2_whitelist($package) +{ + // DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! + + // Inappropriate whitelisting WILL expose you to spam, or cause Bad + // Behavior to stop functioning entirely! DO NOT WHITELIST unless you + // are 100% CERTAIN that you should. + + // IP address ranges use the CIDR format. + + // Includes four examples of whitelisting by IP address and netblock. + $bb2_whitelist_ip_ranges = array( + "10.0.0.0/8", + "172.16.0.0/12", + "192.168.0.0/16", +// "127.0.0.1", + "208.54.95.129", + ); + + // DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! + + // Inappropriate whitelisting WILL expose you to spam, or cause Bad + // Behavior to stop functioning entirely! DO NOT WHITELIST unless you + // are 100% CERTAIN that you should. + + // You should not whitelist search engines by user agent. Use the IP + // netblock for the search engine instead. See http://whois.arin.net/ + // to locate the netblocks for an IP. + + // User agents are matched by exact match only. + + // Includes one example of whitelisting by user agent. + // All are commented out. + $bb2_whitelist_user_agents = array( + // "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) It's me, let me in", + ); + + // DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! + + // Do not edit below this line + + if (!empty($bb2_whitelist_ip_ranges)) { + foreach ($bb2_whitelist_ip_ranges as $range) { + if (match_cidr($package['ip'], $range)) return true; + } + } + if (!empty($bb2_whitelist_user_agents)) { + foreach ($bb2_whitelist_user_agents as $user_agent) { + if (!strcmp($package['headers_mixed']['User-Agent'], $user_agent)) return true; + } + } + return false; +} + +?> Added: main/trunk/extras/Bad-Behavior/bad-behavior-phpBBreloaded.php =================================================================== --- main/trunk/extras/Bad-Behavior/bad-behavior-phpBBreloaded.php (rev 0) +++ main/trunk/extras/Bad-Behavior/bad-behavior-phpBBreloaded.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,140 @@ +<?php +/* +Bad Behavior - detects and blocks unwanted Web accesses +Copyright (C) 2005-2006 Michael Hampton + +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. + +As a special exemption, you may link this program with any of the +programs listed below, regardless of the license terms of those +programs, and distribute the resulting program, without including the +source code for such programs: ExpressionEngine + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Please report any problems to badbots AT ioerror DOT us +*/ + +############################################################################### +############################################################################### + +define('BB2_CWD', dirname(__FILE__)); + +// Settings you can adjust for Bad Behavior. +// Most of these are unused in non-database mode. +$bb2_settings_defaults = array( + 'log_table' => 'bad_behavior', + 'display_stats' => true, + 'strict' => false, + 'verbose' => false +); + +// Bad Behavior callback functions. + +// Return current time in the format preferred by your database. +function bb2_db_date() { + return gmdate('Y-m-d H:i:s'); // Example is MySQL format +} + +// Return affected rows from most recent query. +function bb2_db_affected_rows() { + return false; +} + +// Escape a string for database usage +function bb2_db_escape($string) { + // return mysql_real_escape_string($string); + return $string; // No-op when database not in use. +} + +// Return the number of rows in a particular query. +function bb2_db_num_rows($result) { + if ($result !== FALSE) + return count($result); + return 0; +} + +// Run a query and return the results, if any. +// Should return FALSE if an error occurred. +// Bad Behavior will use the return value here in other callbacks. +function bb2_db_query($query) { + return FALSE; +} + +// Return all rows in a particular query. +// Should contain an array of all rows generated by calling mysql_fetch_assoc() +// or equivalent and appending the result of each call to an array. +function bb2_db_rows($result) { + return $result; +} + +// Return emergency contact email address. +function bb2_email() { + // return "ex...@ex..."; // You need to change this. + return "ba...@io..."; // You need to change this. +} + +// retrieve settings from database +// Settings are hard-coded for non-database use +function bb2_read_settings() { + global $bb2_settings_defaults; + return $bb2_settings_defaults; +} + +// write settings to database +function bb2_write_settings($settings) { + return false; +} + +// installation +function bb2_install() { + return false; +} + +// Screener +// Insert this into the <head> section of your HTML through a template call +// or whatever is appropriate. This is optional we'll fall back to cookies +// if you don't use it. +function bb2_insert_head() { + global $bb2_javascript; + echo $bb2_javascript; +} + +// Display stats? This is optional. +function bb2_insert_stats($force = false) { + $settings = bb2_read_settings(); + + if ($force || $settings['display_stats']) { + $blocked = bb2_db_query("SELECT COUNT(*) FROM " . $settings['log_table'] . " WHERE `key` NOT LIKE '00000000'"); + if ($blocked !== FALSE) { + echo sprintf('<p><a href="http://www.homelandstupidity.us/software/bad-behavior/">%1$s</a> %2$s <strong>%3$s</strong> %4$s</p>', __('Bad Behavior'), __('has blocked'), $blocked[0]["COUNT(*)"], __('access attempts in the last 7 days.')); + } + } +} + +// Return the top-level relative path of wherever we are (for cookies) +// You should provide in $url the top-level URL for your site. +function bb2_relative_path() { + //$url = parse_url(get_bloginfo('url')); + //return $url['path'] . '/'; + return '/'; +} + +// Calls inward to Bad Behavor itself. +require_once(BB2_CWD . "/bad-behavior/version.inc.php"); +require_once(BB2_CWD . "/bad-behavior/core.inc.php"); +bb2_install(); // FIXME: see above + +bb2_start(bb2_read_settings()); + +?> Added: main/trunk/extras/Bad-Behavior/index.html =================================================================== Added: main/trunk/extras_config.php =================================================================== --- main/trunk/extras_config.php (rev 0) +++ main/trunk/extras_config.php 2006-12-31 16:08:16 UTC (rev 282) @@ -0,0 +1,68 @@ +<?php +/******************************************************************************* + * extras_config.php + * ------------------- + * begin : Sunday, Dec 31, 2006 + * copyright : (C) 2006 The phpBBreloaded Group + * website : www.phpbbreloaded.org + * + * $Id: extras_config.php,v 1.0 2006/12/30 14:46:59 mjnr 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. + * + ******************************************************************************/ + +/******************************************************************************* + * Use this file to configure the basics for using any phpBBreloaded 'extras', + * such as location, whether to use, etc.. + * + * My suggestion is to only use the 'extras' section/folder to store addins + * that are developed independantly from the phpBBreloaded core. This will give + * us an easy avenu... [truncated message content] |
From: <teh...@us...> - 2007-04-13 22:50:02
|
Revision: 283 http://svn.sourceforge.net/phpbbreloaded/?rev=283&view=rev Author: tehphpmaster Date: 2007-04-13 15:50:02 -0700 (Fri, 13 Apr 2007) Log Message: ----------- Clearing out the trunk... Removed Paths: ------------- main/trunk/admin/ main/trunk/cache/ main/trunk/common.php main/trunk/config.php main/trunk/db/ main/trunk/extension.inc main/trunk/extras/ main/trunk/extras_config.php main/trunk/faq.php main/trunk/groupcp.php main/trunk/images/ main/trunk/includes/ main/trunk/index.php main/trunk/install/ main/trunk/language/ main/trunk/login.php main/trunk/memberlist.php main/trunk/modcp.php main/trunk/posting.php main/trunk/privmsg.php main/trunk/profile.php main/trunk/search.php main/trunk/templates/ main/trunk/viewforum.php main/trunk/viewonline.php main/trunk/viewtopic.php Deleted: main/trunk/common.php =================================================================== --- main/trunk/common.php 2006-12-31 16:08:16 UTC (rev 282) +++ main/trunk/common.php 2007-04-13 22:50:02 UTC (rev 283) @@ -1,253 +0,0 @@ -<?php -/*************************************************************************** - * common.php - * ------------------- - * begin : Saturday, Feb 23, 2001 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: common.php,v 1.74.2.25 2006/05/26 17:46:59 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. - * - ***************************************************************************/ - -if ( !defined('IN_PHPBB') ) -{ - die("Hacking attempt"); -} - -// -error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables -set_magic_quotes_runtime(0); // Disable magic_quotes_runtime - -// The following code (unsetting globals) -// Thanks to Matt Kavanagh and Stefan Esser for providing feedback as well as patch files - -// PHP5 with register_long_arrays off? -if (@phpversion() >= '5.0.0' && (!@ini_get('register_long_arrays') || @ini_get('register_long_arrays') == '0' || strtolower(@ini_get('register_long_arrays')) == 'off')) -{ - $HTTP_POST_VARS = $_POST; - $HTTP_GET_VARS = $_GET; - $HTTP_SERVER_VARS = $_SERVER; - $HTTP_COOKIE_VARS = $_COOKIE; - $HTTP_ENV_VARS = $_ENV; - $HTTP_POST_FILES = $_FILES; - - // _SESSION is the only superglobal which is conditionally set - if (isset($_SESSION)) - { - $HTTP_SESSION_VARS = $_SESSION; - } -} - -// Protect against GLOBALS tricks -if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_POST_FILES['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS']) || isset($HTTP_COOKIE_VARS['GLOBALS'])) -{ - die("Hacking attempt"); -} - -// Protect against HTTP_SESSION_VARS tricks -if (isset($HTTP_SESSION_VARS) && !is_array($HTTP_SESSION_VARS)) -{ - die("Hacking attempt"); -} - -if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on') -{ - // PHP4+ path - $not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path'); - - // Not only will array_merge give a warning if a parameter - // is not an array, it will actually fail. So we check if - // HTTP_SESSION_VARS has been initialised. - if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS)) - { - $HTTP_SESSION_VARS = array(); - } - - // Merge all into one extremely huge array; unset - // this later - $input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES); - - unset($input['input']); - unset($input['not_unset']); - - while (list($var,) = @each($input)) - { - if (in_array($var, $not_unset)) - { - die('Hacking attempt!'); - } - unset($$var); - } - - unset($input); -} - -// -// addslashes to vars if magic_quotes_gpc is off -// this is a security precaution to prevent someone -// trying to break out of a SQL statement. -// -if( !get_magic_quotes_gpc() ) -{ - if( is_array($HTTP_GET_VARS) ) - { - while( list($k, $v) = each($HTTP_GET_VARS) ) - { - if( is_array($HTTP_GET_VARS[$k]) ) - { - while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) - { - $HTTP_GET_VARS[$k][$k2] = addslashes($v2); - } - @reset($HTTP_GET_VARS[$k]); - } - else - { - $HTTP_GET_VARS[$k] = addslashes($v); - } - } - @reset($HTTP_GET_VARS); - } - - if( is_array($HTTP_POST_VARS) ) - { - while( list($k, $v) = each($HTTP_POST_VARS) ) - { - if( is_array($HTTP_POST_VARS[$k]) ) - { - while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) - { - $HTTP_POST_VARS[$k][$k2] = addslashes($v2); - } - @reset($HTTP_POST_VARS[$k]); - } - else - { - $HTTP_POST_VARS[$k] = addslashes($v); - } - } - @reset($HTTP_POST_VARS); - } - - if( is_array($HTTP_COOKIE_VARS) ) - { - while( list($k, $v) = each($HTTP_COOKIE_VARS) ) - { - if( is_array($HTTP_COOKIE_VARS[$k]) ) - { - while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) ) - { - $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); - } - @reset($HTTP_COOKIE_VARS[$k]); - } - else - { - $HTTP_COOKIE_VARS[$k] = addslashes($v); - } - } - @reset($HTTP_COOKIE_VARS); - } -} - -// -// Define some basic configuration arrays this also prevents -// malicious rewriting of language and otherarray values via -// URI params -// -$board_config = array(); -$userdata = array(); -$theme = array(); -$images = array(); -$lang = array(); -$nav_links = array(); -$dss_seeded = false; -$gen_simple_header = FALSE; - -include($phpbb_root_path . 'config.'.$phpEx); - -/******************************************************************************* - * Include support for phpBBreloaded extra packages now. - ******************************************************************************/ -include($phpbb_root_path . 'extras_config.'.$phpEx); - -if( !defined("PHPBB_INSTALLED") ) -{ - header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx); - exit; -} - -include($phpbb_root_path . 'includes/constants.'.$phpEx); -include($phpbb_root_path . 'includes/template.'.$phpEx); -include($phpbb_root_path . 'includes/sessions.'.$phpEx); -include($phpbb_root_path . 'includes/auth.'.$phpEx); -include($phpbb_root_path . 'includes/functions.'.$phpEx); -include($phpbb_root_path . 'includes/db.'.$phpEx); - -/******************************************************************************* - * If specified, include the 'Bad Behaviour' code now... - * http://homelandstupidity.us/software/bad-behavior/ - * I have placed this here as I may want access to the db functions later in - * order to utilise the Bad Behaviour logging. For now it's a simple spam - * blocker! - ******************************************************************************/ -if(defined('BAD_BEHAVIOUR_ROOT')) -{ - include(BAD_BEHAVIOUR_ROOT . 'bad-behavior-phpBBreloaded.'.$phpEx); -} - -// We do not need this any longer, unset for safety purposes -unset($dbpasswd); - -// -// Obtain and encode users IP -// -// I'm removing HTTP_X_FORWARDED_FOR ... this may well cause other problems such as -// private range IP's appearing instead of the guilty routable IP, tough, don't -// even bother complaining ... go scream and shout at the idiots out there who feel -// "clever" is doing harm rather than good ... karma is a great thing ... :) -// -$client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') ); -$user_ip = encode_ip($client_ip); - -// -// Setup forum wide options, if this fails -// then we output a CRITICAL_ERROR since -// basic forum information is not available -// -$sql = "SELECT * - FROM " . CONFIG_TABLE; -if( !($result = $db->sql_query($sql)) ) -{ - message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql); -} - -while ( $row = $db->sql_fetchrow($result) ) -{ - $board_config[$row['config_name']] = $row['config_value']; -} - -if (file_exists('install') || file_exists('contrib')) -{ - message_die(GENERAL_MESSAGE, 'Please_remove_install_contrib'); -} - -// -// Show 'Board is disabled' message if needed. -// -if( $board_config['board_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") ) -{ - message_die(GENERAL_MESSAGE, 'Board_disable', 'Information'); -} - -?> \ No newline at end of file Deleted: main/trunk/config.php =================================================================== Deleted: main/trunk/extension.inc =================================================================== --- main/trunk/extension.inc 2006-12-31 16:08:16 UTC (rev 282) +++ main/trunk/extension.inc 2007-04-13 22:50:02 UTC (rev 283) @@ -1,26 +0,0 @@ -<?php -/*************************************************************************** - * extension.inc - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: extension.inc,v 1.5 2002/04/04 11:52:50 psotfx Exp $ - * - * - ***************************************************************************/ - -if ( !defined('IN_PHPBB') ) -{ - die("Hacking attempt"); -} - -// -// Change this if your extension is not .php! -// -$phpEx = "php"; - -$starttime = 0; - -?> \ No newline at end of file Deleted: main/trunk/extras_config.php =================================================================== --- main/trunk/extras_config.php 2006-12-31 16:08:16 UTC (rev 282) +++ main/trunk/extras_config.php 2007-04-13 22:50:02 UTC (rev 283) @@ -1,68 +0,0 @@ -<?php -/******************************************************************************* - * extras_config.php - * ------------------- - * begin : Sunday, Dec 31, 2006 - * copyright : (C) 2006 The phpBBreloaded Group - * website : www.phpbbreloaded.org - * - * $Id: extras_config.php,v 1.0 2006/12/30 14:46:59 mjnr 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. - * - ******************************************************************************/ - -/******************************************************************************* - * Use this file to configure the basics for using any phpBBreloaded 'extras', - * such as location, whether to use, etc.. - * - * My suggestion is to only use the 'extras' section/folder to store addins - * that are developed independantly from the phpBBreloaded core. This will give - * us an easy avenue into package management in the future for easy upgrades - * to our users as these packages are upgraded indendantly of the main - * phpBBreloaded source. - * - * This file is included from ./common.php so you should not have to - * specifically link to it unless you're doiing something funky. In which case - * make sure you have defined 'IN_PHPBB' first! - * - * MJ 20061231 - ******************************************************************************/ - -if ( !defined('IN_PHPBB') ) -{ - die("Hacking attempt"); -} - -/******************************************************************************* - * Comment out this definition to disable the Bad Behaviour anti spam-bot - * module. Otherwise, use this definition to point to the location of the - * Bad Behaviour root folder. - * NOTE: I can only presume behavior is how they spell it in America. In - * terms of the definitions I will use the British way. In all other aspects - * (the directory structure etc.) I will use the American way. This should - * allow easy package upgrades. - ******************************************************************************/ -define('BAD_BEHAVIOUR_ROOT', $phpbb_root_path . 'extras/Bad-Behavior/'); - -/******************************************************************************* - * Comment out this definition to disable the !!HIGHLY ALPHA!! XML module - * being developed by mjnr <mailto:mj...@us...>. Otherwise use - * this definition to point to the location of the XML root folder. - ******************************************************************************/ -//define('MJS_XML_ROOT', $phpbb_root_path . 'extras/mjsXML/'); - -/******************************************************************************* - * Comment out this definition to disable the !!HIGHLY ALPHA!! package - * management modules. - * TODO: Integrate the package manager into the admin console? - ******************************************************************************/ -//define('PPM_LIB', $phpbb_root_path . 'includes/ppm_lib.'.$phpEx); -?> \ No newline at end of file Deleted: main/trunk/faq.php =================================================================== --- main/trunk/faq.php 2006-12-31 16:08:16 UTC (rev 282) +++ main/trunk/faq.php 2007-04-13 22:50:02 UTC (rev 283) @@ -1,150 +0,0 @@ -<?php -/*************************************************************************** - * faq.php - * ------------------- - * begin : Sunday, Jul 8, 2001 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: faq.php,v 1.14.2.2 2004/07/11 16:46:15 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', true); -$phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.'.$phpEx); - -// -// Start session management -// -$userdata = session_pagestart($user_ip, PAGE_FAQ); -init_userprefs($userdata); -// -// End session management -// - -// Set vars to prevent naughtiness -$faq = array(); - -// -// Load the appropriate faq file -// -if( isset($HTTP_GET_VARS['mode']) ) -{ - switch( $HTTP_GET_VARS['mode'] ) - { - case 'bbcode': - $lang_file = 'lang_bbcode'; - $l_title = $lang['BBCode_guide']; - break; - default: - $lang_file = 'lang_faq'; - $l_title = $lang['FAQ']; - break; - } -} -else -{ - $lang_file = 'lang_faq'; - $l_title = $lang['FAQ']; -} -include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx); - -// -// Pull the array data from the lang pack -// -$j = 0; -$counter = 0; -$counter_2 = 0; -$faq_block = array(); -$faq_block_titles = array(); - -for($i = 0; $i < count($faq); $i++) -{ - if( $faq[$i][0] != '--' ) - { - $faq_block[$j][$counter]['id'] = $counter_2; - $faq_block[$j][$counter]['question'] = $faq[$i][0]; - $faq_block[$j][$counter]['answer'] = $faq[$i][1]; - - $counter++; - $counter_2++; - } - else - { - $j = ( $counter != 0 ) ? $j + 1 : 0; - - $faq_block_titles[$j] = $faq[$i][1]; - - $counter = 0; - } -} - -// -// Lets build a page ... -// -$page_title = $l_title; -include($phpbb_root_path . 'includes/page_header.'.$phpEx); - -$template->set_filenames(array( - 'body' => 'faq_body.tpl') -); -make_jumpbox('viewforum.'.$phpEx); - -$template->assign_vars(array( - 'L_FAQ_TITLE' => $l_title, - 'L_BACK_TO_TOP' => $lang['Back_to_top']) -); - -for($i = 0; $i < count($faq_block); $i++) -{ - if( count($faq_block[$i]) ) - { - $template->assign_block_vars('faq_block', array( - 'BLOCK_TITLE' => $faq_block_titles[$i]) - ); - $template->assign_block_vars('faq_block_link', array( - 'BLOCK_TITLE' => $faq_block_titles[$i]) - ); - - for($j = 0; $j < count($faq_block[$i]); $j++) - { - $row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $template->assign_block_vars('faq_block.faq_row', array( - 'ROW_COLOR' => '#' . $row_color, - 'ROW_CLASS' => $row_class, - 'FAQ_QUESTION' => $faq_block[$i][$j]['question'], - 'FAQ_ANSWER' => $faq_block[$i][$j]['answer'], - - 'U_FAQ_ID' => $faq_block[$i][$j]['id']) - ); - - $template->assign_block_vars('faq_block_link.faq_row_link', array( - 'ROW_COLOR' => '#' . $row_color, - 'ROW_CLASS' => $row_class, - 'FAQ_LINK' => $faq_block[$i][$j]['question'], - - 'U_FAQ_LINK' => '#' . $faq_block[$i][$j]['id']) - ); - } - } -} - -$template->pparse('body'); - -include($phpbb_root_path . 'includes/page_tail.'.$phpEx); - -?> \ No newline at end of file Deleted: main/trunk/groupcp.php =================================================================== --- main/trunk/groupcp.php 2006-12-31 16:08:16 UTC (rev 282) +++ main/trunk/groupcp.php 2007-04-13 22:50:02 UTC (rev 283) @@ -1,1284 +0,0 @@ -<?php -/*************************************************************************** - * groupcp.php - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : su...@ph... - * - * $Id: groupcp.php,v 1.58.2.27 2006/12/16 13:11:24 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', true); -$phpbb_root_path = './'; -include($phpbb_root_path . 'extension.inc'); -include($phpbb_root_path . 'common.'.$phpEx); - -// ------------------------- -// -function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$poster_avatar, &$profile_img, &$profile, &$search_img, &$search, &$pm_img, &$pm, &$email_img, &$email, &$www_img, &$www, &$icq_status_img, &$icq_img, &$icq, &$aim_img, &$aim, &$msn_img, &$msn, &$yim_img, &$yim) -{ - global $lang, $images, $board_config, $phpEx; - - $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' '; - $joined = create_date($date_format, $row['user_regdate'], $board_config['board_timezone']); - $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0; - - $poster_avatar = ''; - if ( $row['user_avatar_type'] && $row['user_id'] != ANONYMOUS && $row['user_allowavatar'] ) - { - switch( $row['user_avatar_type'] ) - { - case USER_AVATAR_UPLOAD: - $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; - break; - case USER_AVATAR_REMOTE: - $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : ''; - break; - case USER_AVATAR_GALLERY: - $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; - break; - } - } - - if ( !empty($row['user_viewemail']) || $group_mod ) - { - $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $row['user_id']) : 'mailto:' . $row['user_email']; - - $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>'; - $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>'; - } - else - { - $email_img = ' '; - $email = ' '; - } - - $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']); - $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>'; - $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>'; - - $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=" . $row['user_id']); - $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>'; - $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; - - $www_img = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : ''; - $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; - - if ( !empty($row['user_icq']) ) - { - $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; - $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>'; - $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>'; - } - else - { - $icq_status_img = ''; - $icq_img = ''; - $icq = ''; - } - - $aim_img = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ''; - $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : ''; - - $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']); - $msn_img = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : ''; - $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : ''; - - $yim_img = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : ''; - $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : ''; - - $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($row['username']) . "&showresults=posts"); - $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $row['username']) . '" title="' . sprintf($lang['Search_user_posts'], $row['username']) . '" border="0" /></a>'; - $search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $row['username']) . '</a>'; - - return; -} -// -// -------------------------- - -// -// Start session management -// -$userdata = session_pagestart($user_ip, PAGE_GROUPCP); -init_userprefs($userdata); -// -// End session management -// - -$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); -$script_name = ( $script_name != '' ) ? $script_name . '/groupcp.'.$phpEx : 'groupcp.'.$phpEx; -$server_name = trim($board_config['server_name']); -$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; -$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; - -$server_url = $server_protocol . $server_name . $server_port . $script_name; - -if ( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_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 = ''; -} - -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 = ''; -} - -$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : 0; -$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : 0; - -$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; -$start = ($start < 0) ? 0 : $start; - -// -// Default var values -// -$is_moderator = FALSE; - -if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) -{ - if ( !$userdata['session_logged_in'] ) - { - redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); - } - - $sql = "SELECT group_moderator - FROM " . GROUPS_TABLE . " - WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); - } - - $row = $db->sql_fetchrow($result); - - if ( $row['group_moderator'] != $userdata['user_id'] && $userdata['user_level'] != ADMIN ) - { - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') - ); - - $message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } - - $sql = "UPDATE " . GROUPS_TABLE . " - SET group_type = " . intval($HTTP_POST_VARS['group_type']) . " - WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); - } - - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') - ); - - $message = $lang['Group_type_updated'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - -} -else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) -{ - // - // First, joining a group - // If the user isn't logged in redirect them to login - // - if ( !$userdata['session_logged_in'] ) - { - redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); - } - - $sql = "SELECT ug.user_id, g.group_type - FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g - WHERE g.group_id = $group_id - AND g.group_type <> " . GROUP_HIDDEN . " - AND ug.group_id = g.group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); - } - - if ( $row = $db->sql_fetchrow($result) ) - { - if ( $row['group_type'] == GROUP_OPEN ) - { - do - { - if ( $userdata['user_id'] == $row['user_id'] ) - { - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') - ); - - $message = $lang['Already_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } - } while ( $row = $db->sql_fetchrow($result) ); - } - else - { - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') - ); - - $message = $lang['This_closed_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } - } - else - { - message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); - } - - $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) - VALUES ($group_id, " . $userdata['user_id'] . ", 1)"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql); - } - - $sql = "SELECT u.user_email, u.username, u.user_lang, g.group_name - FROM ".USERS_TABLE . " u, " . GROUPS_TABLE . " g - WHERE u.user_id = g.group_moderator - AND g.group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Error getting group moderator data", "", __LINE__, __FILE__, $sql); - } - - $moderator = $db->sql_fetchrow($result); - - include($phpbb_root_path . 'includes/emailer.'.$phpEx); - $emailer = new emailer($board_config['smtp_delivery']); - - $emailer->from($board_config['board_email']); - $emailer->replyto($board_config['board_email']); - - $emailer->use_template('group_request', $moderator['user_lang']); - $emailer->email_address($moderator['user_email']); - $emailer->set_subject($lang['Group_request']); - - $emailer->assign_vars(array( - 'SITENAME' => $board_config['sitename'], - 'GROUP_MODERATOR' => $moderator['username'], - 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', - - 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id&validate=true") - ); - $emailer->send(); - $emailer->reset(); - - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') - ); - - $message = $lang['Group_joined'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); -} -else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) && $group_id ) -{ - // - // Second, unsubscribing from a group - // Check for confirmation of unsub. - // - if ( $cancel ) - { - redirect(append_sid("groupcp.$phpEx", true)); - } - elseif ( !$userdata['session_logged_in'] ) - { - redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); - } - - if ( $confirm ) - { - $sql = "DELETE FROM " . USER_GROUP_TABLE . " - WHERE user_id = " . $userdata['user_id'] . " - AND group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not delete group memebership data', '', __LINE__, __FILE__, $sql); - } - - if ( $userdata['user_level'] != ADMIN && $userdata['user_level'] == MOD ) - { - $sql = "SELECT COUNT(auth_mod) AS is_auth_mod - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id = " . $userdata['user_id'] . " - AND aa.group_id = ug.group_id - AND aa.auth_mod = 1"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql); - } - - if ( !($row = $db->sql_fetchrow($result)) || $row['is_auth_mod'] == 0 ) - { - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . USER . " - WHERE user_id = " . $userdata['user_id']; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); - } - } - } - - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') - ); - - $message = $lang['Unsub_success'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } - else - { - $unsub_msg = ( isset($HTTP_POST_VARS['unsub']) ) ? $lang['Confirm_unsub'] : $lang['Confirm_unsub_pending']; - - $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" /><input type="hidden" name="unsub" value="1" />'; - - $page_title = $lang['Group_Control_Panel']; - include($phpbb_root_path . 'includes/page_header.'.$phpEx); - - $template->set_filenames(array( - 'confirm' => 'confirm_body.tpl') - ); - - $template->assign_vars(array( - 'MESSAGE_TITLE' => $lang['Confirm'], - 'MESSAGE_TEXT' => $unsub_msg, - 'L_YES' => $lang['Yes'], - 'L_NO' => $lang['No'], - 'S_CONFIRM_ACTION' => append_sid("groupcp.$phpEx"), - 'S_HIDDEN_FIELDS' => $s_hidden_fields) - ); - - $template->pparse('confirm'); - - include($phpbb_root_path . 'includes/page_tail.'.$phpEx); - } - -} -else if ( $group_id ) -{ - // - // Did the group moderator get here through an email? - // If so, check to see if they are logged in. - // - if ( isset($HTTP_GET_VARS['validate']) ) - { - if ( !$userdata['session_logged_in'] ) - { - redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); - } - } - - // - // For security, get the ID of the group moderator. - // - switch(SQL_LAYER) - { - case 'postgresql': - $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod - FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa - WHERE g.group_id = $group_id - AND aa.group_id = g.group_id - UNION ( - SELECT g.group_moderator, g.group_type, NULL - FROM " . GROUPS_TABLE . " g - WHERE g.group_id = $group_id - AND NOT EXISTS ( - SELECT aa.group_id - FROM " . AUTH_ACCESS_TABLE . " aa - WHERE aa.group_id = g.group_id - ) - ) - ORDER BY aa.auth_mod DESC"; - break; - - case 'oracle': - $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod - FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa - WHERE g.group_id = $group_id - AND aa.group_id (+) = g.group_id - ORDER BY aa.auth_mod DESC"; - break; - - default: - $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod - FROM ( " . GROUPS_TABLE . " g - LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = g.group_id ) - WHERE g.group_id = $group_id - ORDER BY aa.auth_mod DESC"; - break; - } - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not get moderator information', '', __LINE__, __FILE__, $sql); - } - - if ( $group_info = $db->sql_fetchrow($result) ) - { - $group_moderator = $group_info['group_moderator']; - - if ( $group_moderator == $userdata['user_id'] || $userdata['user_level'] == ADMIN ) - { - $is_moderator = TRUE; - } - - // - // Handle Additions, removals, approvals and denials - // - if ( !empty($HTTP_POST_VARS['add']) || !empty($HTTP_POST_VARS['remove']) || isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) - { - if ( !$userdata['session_logged_in'] ) - { - redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); - } - - if ( !$is_moderator ) - { - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') - ); - - $message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } - - if ( isset($HTTP_POST_VARS['add']) ) - { - $username = ( isset($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : ''; - - $sql = "SELECT user_id, user_email, user_lang, user_level - FROM " . USERS_TABLE . " - WHERE username = '" . str_replace("\'", "''", $username) . "'"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, "Could not get user information", $lang['Error'], __LINE__, __FILE__, $sql); - } - - if ( !($row = $db->sql_fetchrow($result)) ) - { - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') - ); - - $message = $lang['Could_not_add_user'] . "<br /><br />" . sprintf($lang['Click_return_group'], "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a>"); - - message_die(GENERAL_MESSAGE, $message); - } - - if ( $row['user_id'] == ANONYMOUS ) - { - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') - ); - - $message = $lang['Could_not_anon_user'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } - - $sql = "SELECT ug.user_id, u.user_level - FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u - WHERE u.user_id = " . $row['user_id'] . " - AND ug.user_id = u.user_id - AND ug.group_id = $group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not get user information', '', __LINE__, __FILE__, $sql); - } - - if ( !($db->sql_fetchrow($result)) ) - { - $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending) - VALUES (" . $row['user_id'] . ", $group_id, 0)"; - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not add user to group', '', __LINE__, __FILE__, $sql); - } - - if ( $row['user_level'] != ADMIN && $row['user_level'] != MOD && $group_info['auth_mod'] ) - { - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . MOD . " - WHERE user_id = " . $row['user_id']; - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); - } - } - - // - // Get the group name - // Email the user and tell them they're in the group - // - $group_sql = "SELECT group_name - FROM " . GROUPS_TABLE . " - WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($group_sql)) ) - { - message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql); - } - - $group_name_row = $db->sql_fetchrow($result); - - $group_name = $group_name_row['group_name']; - - include($phpbb_root_path . 'includes/emailer.'.$phpEx); - $emailer = new emailer($board_config['smtp_delivery']); - - $emailer->from($board_config['board_email']); - $emailer->replyto($board_config['board_email']); - - $emailer->use_template('group_added', $row['user_lang']); - $emailer->email_address($row['user_email']); - $emailer->set_subject($lang['Group_added']); - - $emailer->assign_vars(array( - 'SITENAME' => $board_config['sitename'], - 'GROUP_NAME' => $group_name, - 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', - - 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id") - ); - $emailer->send(); - $emailer->reset(); - } - else - { - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') - ); - - $message = $lang['User_is_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); - - message_die(GENERAL_MESSAGE, $message); - } - } - else - { - if ( ( ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) && isset($HTTP_POST_VARS['pending_members']) ) || ( isset($HTTP_POST_VARS['remove']) && isset($HTTP_POST_VARS['members']) ) ) - { - - $members = ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) ? $HTTP_POST_VARS['pending_members'] : $HTTP_POST_VARS['members']; - - $sql_in = ''; - for($i = 0; $i < count($members); $i++) - { - $sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . intval($members[$i]); - } - - if ( isset($HTTP_POST_VARS['approve']) ) - { - if ( $group_info['auth_mod'] ) - { - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . MOD . " - WHERE user_id IN ($sql_in) - AND user_level NOT IN (" . MOD . ", " . ADMIN . ")"; - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); - } - } - - $sql = "UPDATE " . USER_GROUP_TABLE . " - SET user_pending = 0 - WHERE user_id IN ($sql_in) - AND group_id = $group_id"; - $sql_select = "SELECT user_email - FROM ". USERS_TABLE . " - WHERE user_id IN ($sql_in)"; - } - else if ( isset($HTTP_POST_VARS['deny']) || isset($HTTP_POST_VARS['remove']) ) - { - if ( $group_info['auth_mod'] ) - { - $sql = "SELECT ug.user_id, ug.group_id - FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug - WHERE ug.user_id IN ($sql_in) - AND aa.group_id = ug.group_id - AND aa.auth_mod = 1 - GROUP BY ug.user_id, ug.group_id - ORDER BY ug.user_id, ug.group_id"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql); - } - - if ( $row = $db->sql_fetchrow($result) ) - { - $group_check = array(); - $remove_mod_sql = ''; - - do - { - $group_check[$row['user_id']][] = $row['group_id']; - } - while ( $row = $db->sql_fetchrow($result) ); - - while( list($user_id, $group_list) = @each($group_check) ) - { - if ( count($group_list) == 1 ) - { - $remove_mod_sql .= ( ( $remove_mod_sql != '' ) ? ', ' : '' ) . $user_id; - } - } - - if ( $remove_mod_sql != '' ) - { - $sql = "UPDATE " . USERS_TABLE . " - SET user_level = " . USER . " - WHERE user_id IN ($remove_mod_sql) - AND user_level NOT IN (" . ADMIN . ")"; - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); - } - } - } - } - - $sql = "DELETE FROM " . USER_GROUP_TABLE . " - WHERE user_id IN ($sql_in) - AND group_id = $group_id"; - } - - if ( !$db->sql_query($sql) ) - { - message_die(GENERAL_ERROR, 'Could not update user group table', '', __LINE__, __FILE__, $sql); - } - - // - // Email users when they are approved - // - if ( isset($HTTP_POST_VARS['approve']) ) - { - if ( !($result = $db->sql_query($sql_select)) ) - { - message_die(GENERAL_ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql); - } - - $bcc_list = array(); - while ($row = $db->sql_fetchrow($result)) - { - $bcc_list[] = $row['user_email']; - } - - // - // Get the group name - // - $group_sql = "SELECT group_name - FROM " . GROUPS_TABLE . " - WHERE group_id = $group_id"; - if ( !($result = $db->sql_query($group_sql)) ) - { - message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql); - } - - $group_name_row = $db->sql_fetchrow($result); - $group_name = $group_name_row['group_name']; - - include($phpbb_root_path . 'includes/emailer.'.$phpEx); - $emailer = new emailer($board_config['smtp_delivery']); - - $emailer->from($board_config['board_email']); - $emailer->replyto($board_config['board_email']); - - for ($i = 0; $i < count($bcc_list); $i++) - { - $emailer->bcc($bcc_list[$i]); - } - - $emailer->use_template('group_approved'); - $emailer->set_subject($lang['Group_approved']); - - $emailer->assign_vars(array( - 'SITENAME' => $board_config['sitename'], - 'GROUP_NAME' => $group_name, - 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', - - 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id") - ); - $emailer->send(); - $emailer->reset(); - } - } - } - } - // - // END approve or deny - // - } - else - { - message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); - } - - // - // Get group details - // - $sql = "SELECT * - FROM " . GROUPS_TABLE . " - WHERE group_id = $group_id - AND group_single_user = 0"; - 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']); - } - - // - // Get moderator details for this group - // - $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm - FROM " . USERS_TABLE . " - WHERE user_id = " . $group_info['group_moderator']; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql); - } - - $group_moderator = $db->sql_fetchrow($result); - - // - // Get user information for this group - // - $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, ug.user_pending - FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug - WHERE ug.group_id = $group_id - AND u.user_id = ug.user_id - AND ug.user_pending = 0 - AND ug.user_id <> " . $group_moderator['user_id'] . " - ORDER BY u.username"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql); - } - - $group_members = $db->sql_fetchrowset($result); - $members_count = count($group_members); - $db->sql_freeresult($result); - - $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm - FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u - WHERE ug.group_id = $group_id - AND g.group_id = ug.group_id - AND ug.user_pending = 1 - AND u.user_id = ug.user_id - ORDER BY u.username"; - if ( !($result = $db->sql_query($sql)) ) - { - message_die(GENERAL_ERROR, 'Error getting user pending information', '', __LINE__, __FILE__, $sql); - } - - $modgroup_pending_list = $db->sql_fetchrowset($result); - $modgroup_pending_count = count($modgroup_pending_list); - $db->sql_freeresult($result); - - $is_group_member = 0; - if ( $members_count ) - { - for($i = 0; $i < $members_count; $i++) - { - if ( $group_members[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) - { - $is_group_member = TRUE; - } - } - } - - $is_group_pending_member = 0; - if ( $modgroup_pending_count ) - { - for($i = 0; $i < $modgroup_pending_count; $i++) - { - if ( $modgroup_pending_list[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) - { - $is_group_pending_member = TRUE; - } - } - } - - if ( $userdata['user_level'] == ADMIN ) - { - $is_moderator = TRUE; - } - - if ( $userdata['user_id'] == $group_info['group_moderator'] ) - { - $is_moderator = TRUE; - - $group_details = $lang['Are_group_moderator']; - - $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; - } - else if ( $is_group_member || $is_group_pending_member ) - { - $template->assign_block_vars('switch_unsubscribe_group_input', array()); - - $group_details = ( $is_group_pending_member ) ? $lang['Pending_this_group'] : $lang['Member_this_group']; - - $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; - } - else if ( $userdata['user_id'] == ANONYMOUS ) - { - $group_details = $lang['Login_to_join']; - $s_hidden_fields = ''; - } - else - { - if ( $group_info['group_type'] == GROUP_OPEN ) - { - $template->assign_block_vars('switch_subscribe_group_input', array()); - - $group_details = $lang['This_open_group']; - $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; - } - else if ( $group_info['group_type'] == GROUP_CLOSED ) - { - $group_details = $lang['This_closed_group']; - $s_hidden_fields = ''; - } - else if ( $group_info['group_type'] == GROUP_HIDDEN ) - { - $group_details = $lang['This_hidden_group']; - $s_hidden_fields = ''; - } - } - - $page_title = $lang['Group_Control_Panel']; - include($phpbb_root_path . 'includes/page_header.'.$phpEx); - - // - // Load templates - // - $template->set_filenames(array( - 'info' => 'groupcp_info_body.tpl', - 'pendinginfo' => 'groupcp_pending_info.tpl') - ); - make_jumpbox('viewforum.'.$phpEx); - - // - // Add the moderator - // - $username = $group_moderator['username']; - $user_id = $group_moderator['user_id']; - - generate_user_info($group_moderator, $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim); - - $s_hidden_fields .= ''; - - $template->assign_vars(array( - 'L_GROUP_INFORMATION' => $lang['Group_Information'], - 'L_GROUP_NAME' => $lang['Group_name'], - 'L_GROUP_DESC' => $lang['Group_description'], - 'L_GROUP_TYPE' => $lang['Group_type'], - 'L_GROUP_MEMBERSHIP' => $lang['Group_membership'], - 'L_SUBSCRIBE' => $lang['Subscribe'], - 'L_UNSUBSCRIBE' => $lang['Unsubscribe'], - 'L_JOIN_GROUP' => $lang['Join_group'], - 'L_UNSUBSCRIBE_GROUP' => $lang['Unsubscribe'], - 'L_GROUP_OPEN' => $lang['Group_open'], - 'L_GROUP_CLOSED' => $lang['Group_closed'], - 'L_GROUP_HIDDEN' => $lang['Group_hidden'], - 'L_UPDATE' => $lang['Update'], - 'L_GROUP_MODERATOR' => $lang['Group_Moderator'], - 'L_GROUP_MEMBERS' => $lang['Group_Members'], - 'L_PENDING_MEMBERS' => $lang['Pending_members'], - 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], - 'L_PM' => $lang['Private_Message'], - 'L_EMAIL' => $lang['Email'], - 'L_POSTS' => $lang['Posts'], - 'L_WEBSITE' => $lang['Website'], - 'L_FROM' => $lang['Location'], - 'L_ORDER' => $lang['Order'], - 'L_SORT' => $lang['Sort'], - 'L_SUBMIT' => $lang['Sort'], - 'L_AIM' => $lang['AIM'], - 'L_YIM' => $lang['YIM'], - 'L_MSNM' => $lang['MSNM'], - 'L_ICQ' => $lang['ICQ'], - 'L_SELECT' => $lang['Select'], - 'L_REMOVE_SELECTED' => $lang['Remove_selected'], - 'L_ADD_MEMBER' => $lang['Add_member'], - 'L_FIND_USERNAME' => $lang['Find_username'], - - 'GROUP_NAME' => $group_info['group_name'], - 'GROUP_DESC' => $group_info['group_description'], - 'GROUP_DETAILS' => $group_details, - 'MOD_ROW_COLOR' => '#' . $theme['td_color1'], - 'MOD_ROW_CLASS' => $theme['td_class1'], - 'MOD_USERNAME' => $username, - 'MOD_FROM' => $from, - 'MOD_JOINED' => $joined, - 'MOD_POSTS' => $posts, - 'MOD_AVATAR_IMG' => $poster_avatar, - 'MOD_PROFILE_IMG' => $profile_img, - 'MOD_PROFILE' => $profile, - 'MOD_SEARCH_IMG' => $search_img, - 'MOD_SEARCH' => $search, - 'MOD_PM_IMG' => $pm_img, - 'MOD_PM' => $pm, - 'MOD_EMAIL_IMG' => $email_img, - 'MOD_EMAIL' => $email, - 'MOD_WWW_IMG' => $www_img, - 'MOD_WWW' => $www, - 'MOD_ICQ_STATUS_IMG' => $icq_status_img, - 'MOD_ICQ_IMG' => $icq_img, - 'MOD_ICQ' => $icq, - 'MOD_AIM_IMG' => $aim_img, - 'MOD_AIM' => $aim, - 'MOD_MSN_IMG' => $msn_img, - 'MOD_MSN' => $msn, - 'MOD_YIM_IMG' => $yim_img, - 'MOD_YIM' => $yim, - - 'U_MOD_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"), - 'U_SEARCH_USER' => append_sid("search.$phpEx?mode=searchuser"), - - 'S_GROUP_OPEN_TYPE' => GROUP_OPEN, - 'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED, - 'S_GROUP_HIDDEN_TYPE' => GROUP_HIDDEN, - 'S_GROUP_OPEN_CHECKED' => ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '', - 'S_GROUP_CLOSED_CHECKED' => ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '', - 'S_GROUP_HIDDEN_CHECKED' => ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '', - 'S_HIDDEN_FIELDS' => $s_hidden_fields, - 'S_MODE_SELECT' => $select_sort_mode, - 'S_ORDER_SELECT' => $select_sort_order, - 'S_GROUPCP_ACTION' => append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id")) - ); - - // - // Dump out the remaining users - // - for($i = $start; $i < min($board_config['topics_per_page'] + $start, $members_count); $i++) - { - $username = $group_members[$i]['username']; - $user_id = $group_members[$i]['user_id']; - - generate_user_info($group_members[$i], $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim); - - if ( $group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator ) - { - $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $template->assign_block_vars('member_row', array( - 'ROW_COLOR' => '#' . $row_color, - 'ROW_CLASS' => $row_class, - 'USERNAME' => $username, - 'FROM' => $from, - 'JOINED' => $joined, - 'POSTS' => $posts, - 'USER_ID' => $user_id, - 'AVATAR_IMG' => $poster_avatar, - 'PROFILE_IMG' => $profile_img, - 'PROFILE' => $profile, - 'SEARCH_IMG' => $search_img, - 'SEARCH' => $search, - 'PM_IMG' => $pm_img, - 'PM' => $pm, - 'EMAIL_IMG' => $email_img, - 'EMAIL' => $email, - 'WWW_IMG' => $www_img, - 'WWW' => $www, - 'ICQ_STATUS_IMG' => $icq_status_img, - 'ICQ_IMG' => $icq_img, - 'ICQ' => $icq, - 'AIM_IMG' => $aim_img, - 'AIM' => $aim, - 'MSN_IMG' => $msn_img, - 'MSN' => $msn, - 'YIM_IMG' => $yim_img, - 'YIM' => $yim, - - 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id")) - ); - - if ( $is_moderator ) - { - $template->assign_block_vars('member_row.switch_mod_option', array()); - } - } - } - - if ( !$members_count ) - { - // - // No group members - // - $template->assign_block_vars('switch_no_members', array()); - $template->assign_vars(array( - 'L_NO_MEMBERS' => $lang['No_group_members']) - ); - } - - $current_page = ( !$members_count ) ? 1 : ceil( $members_count / $board_config['topics_per_page'] ); - - $template->assign_vars(array( - 'PAGINATION' => generate_pagination("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id", $members_count, $board_config['topics_per_page'], $start), - 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), $current_page ), - - 'L_GOTO_PAGE' => $lang['Goto_page']) - ); - - if ( $group_info['group_type'] == GROUP_HIDDEN && !$is_group_member && !$is_moderator ) - { - // - // No group members - // - $template->assign_block_vars('switch_hidden_group', array()); - $template->assign_vars(array( - 'L_HIDDEN_MEMBERS' => $lang['Group_hidden_members']) - ); - } - - // - // We've displayed the members who belong to the group, now we - // do that pending memebers... - // - if ( $is_moderator ) - { - // - // Users pending in ONLY THIS GROUP (which is moderated by this user) - // - if ( $modgroup_pending_count ) - { - for($i = 0; $i < $modgroup_pending_count; $i++) - { - $username = $modgroup_pending_list[$i]['username']; - $user_id = $modgroup_pending_list[$i]['user_id']; - - generate_user_info($modgroup_pending_list[$i], $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim); - - $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; - $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - - $user_select = '<input type="checkbox" name="member[]" value="' . $user_id . '">'; - - $template->assign_block_vars('pending_members_row', array( - 'ROW_CLASS' => $row_class, - 'ROW_COLOR' => '#' . $row_color, - 'USERNAME' => $username, - 'FROM' => $from, - 'JOINED' => $joined, - 'POSTS' => $posts, - 'USER_ID' => $user_id, - 'AVATAR_IMG' => $poster_avatar, - 'PROFILE_IMG' => $profile_img, - 'PROFILE' => $profile, - 'SEARCH_IMG' => $search_img, - 'SEARCH' => $search, - 'PM_IMG' => $pm_img, - 'PM' => $pm, - 'EMAIL_IMG' => $email_img, - 'EMAIL' => $email, - 'WWW_IMG' => $www_img, - 'WWW' => $www, - 'ICQ_STATUS_IMG' => $icq_status_img, - 'ICQ_IMG' => $icq_img, - 'ICQ' => $icq, - 'AIM_IMG' => $aim_img, - 'AIM' => $aim, - 'MSN_IMG' => $msn_img, - 'MSN' => $msn, - 'YIM_IMG' => $yim_img, - 'YIM' => $yim, - - 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id")) - ); - } - - $template->assign_block_vars('switch_pending_members', array() ); - - $template->assign_vars(array( - 'L_SELECT' => $lang['Select'], - 'L_APPROVE_SELECTED' => $lang['Approve_selected'], - ... [truncated message content] |
From: <teh...@us...> - 2007-04-15 02:51:17
|
Revision: 286 http://svn.sourceforge.net/phpbbreloaded/?rev=286&view=rev Author: tehphpmaster Date: 2007-04-14 19:51:17 -0700 (Sat, 14 Apr 2007) Log Message: ----------- Well, an install directory would be helpful. This is the default phpBB2 install process, no doubt it'll be changing before we hit 1.0 however. Added Paths: ----------- main/trunk/install/ main/trunk/install/index.htm main/trunk/install/install.php main/trunk/install/schemas/ main/trunk/install/schemas/index.htm main/trunk/install/schemas/ms_access_primer.zip main/trunk/install/schemas/mssql_basic.sql main/trunk/install/schemas/mssql_schema.sql main/trunk/install/schemas/mysql_basic.sql main/trunk/install/schemas/mysql_schema.sql main/trunk/install/schemas/postgres_basic.sql main/trunk/install/schemas/postgres_schema.sql Added: main/trunk/install/index.htm =================================================================== --- main/trunk/install/index.htm (rev 0) +++ main/trunk/install/index.htm 2007-04-15 02:51:17 UTC (rev 286) @@ -0,0 +1,10 @@ +<html> +<head> +<title></title> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> + +<body bgcolor="#FFFFFF" text="#000000"> + +</body> +</html> Added: main/trunk/install/install.php =================================================================== --- main/trunk/install/install.php (rev 0) +++ main/trunk/install/install.php 2007-04-15 02:51:17 UTC (rev 286) @@ -0,0 +1,1049 @@ +<?php +/*************************************************************************** + * install.php + * ------------------- + * begin : Tuesday, Sept 11, 2001 + * copyright : (C) 2001 The phpBB Group + * email : su...@ph... + * + * $Id: install.php,v 1.6.2.14 2005/12/29 11:51:11 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. + * + ***************************************************************************/ + +// --------- +// FUNCTIONS +// +function page_header($text, $form_action = false) +{ + global $phpEx, $lang; + +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['ENCODING']; ?>"> +<meta http-equiv="Content-Style-Type" content="text/css"> +<title><?php echo $lang['Welcome_install'];?></title> +<link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css"> +<style type="text/css"> +<!-- +th { background-image: url('../templates/subSilver/images/cellpic3.gif') } +td.cat { background-image: url('../templates/subSilver/images/cellpic1.gif') } +td.rowpic { background-image: url('../templates/subSilver/images/cellpic2.jpg'); background-repeat: repeat-y } +td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom { background-image: url('../templates/subSilver/images/cellpic1.gif') } + +/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */ +@import url("../templates/subSilver/formIE.css"); +//--> +</style> +</head> +<body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#5584AA"> + +<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> + <tr> + <td class="bodyline" width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td> + <td align="center" width="100%" valign="middle"><span class="maintitle"><?php echo $lang['Welcome_install'];?></span></td> + </tr> + </table></td> + </tr> + <tr> + <td><br /><br /></td> + </tr> + <tr> + <td colspan="2"><table width="90%" border="0" align="center" cellspacing="0" cellpadding="0"> + <tr> + <td><span class="gen"><?php echo $text; ?></span></td> + </tr> + </table></td> + </tr> + <tr> + <td><br /><br /></td> + </tr> + <tr> + <td width="100%"><table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"><form action="<?php echo ($form_action) ? $form_action : 'install.'.$phpEx; ?>" name="install" method="post"> +<?php + +} + +function page_footer() +{ + +?> + </table></form></td> + </tr> + </table></td> + </tr> +</table> + +</body> +</html> +<?php + +} + +function page_common_form($hidden, $submit) +{ + +?> + <tr> + <td class="catBottom" align="center" colspan="2"><?php echo $hidden; ?><input class="mainoption" type="submit" value="<?php echo $submit; ?>" /></td> + </tr> +<?php + +} + +function page_upgrade_form() +{ + global $lang; + +?> + <tr> + <td class="catBottom" align="center" colspan="2"><?php echo $lang['continue_upgrade']; ?></td> + </tr> + <tr> + <td class="catBottom" align="center" colspan="2"><input type="submit" name="upgrade_now" value="<?php echo $lang['upgrade_submit']; ?>" /></td> + </tr> +<?php + +} + +function page_error($error_title, $error) +{ + +?> + <tr> + <th><?php echo $error_title; ?></th> + </tr> + <tr> + <td class="row1" align="center"><span class="gen"><?php echo $error; ?></span></td> + </tr> +<?php + +} + +// Guess an initial language ... borrowed from phpBB 2.2 it's not perfect, +// really it should do a straight match first pass and then try a "fuzzy" +// match on a second pass instead of a straight "fuzzy" match. +function guess_lang() +{ + global $phpbb_root_path, $HTTP_SERVER_VARS; + + // The order here _is_ important, at least for major_minor + // matches. Don't go moving these around without checking with + // me first - psoTFX + $match_lang = array( + 'arabic' => 'ar([_-][a-z]+)?', + 'bulgarian' => 'bg', + 'catalan' => 'ca', + 'czech' => 'cs', + 'danish' => 'da', + 'german' => 'de([_-][a-z]+)?', + 'english' => 'en([_-][a-z]+)?', + 'estonian' => 'et', + 'finnish' => 'fi', + 'french' => 'fr([_-][a-z]+)?', + 'greek' => 'el', + 'spanish_argentina' => 'es[_-]ar', + 'spanish' => 'es([_-][a-z]+)?', + 'gaelic' => 'gd', + 'galego' => 'gl', + 'gujarati' => 'gu', + 'hebrew' => 'he', + 'hindi' => 'hi', + 'croatian' => 'hr', + 'hungarian' => 'hu', + 'icelandic' => 'is', + 'indonesian' => 'id([_-][a-z]+)?', + 'italian' => 'it([_-][a-z]+)?', + 'japanese' => 'ja([_-][a-z]+)?', + 'korean' => 'ko([_-][a-z]+)?', + 'latvian' => 'lv', + 'lithuanian' => 'lt', + 'macedonian' => 'mk', + 'dutch' => 'nl([_-][a-z]+)?', + 'norwegian' => 'no', + 'punjabi' => 'pa', + 'polish' => 'pl', + 'portuguese_brazil' => 'pt[_-]br', + 'portuguese' => 'pt([_-][a-z]+)?', + 'romanian' => 'ro([_-][a-z]+)?', + 'russian' => 'ru([_-][a-z]+)?', + 'slovenian' => 'sl([_-][a-z]+)?', + 'albanian' => 'sq', + 'serbian' => 'sr([_-][a-z]+)?', + 'slovak' => 'sv([_-][a-z]+)?', + 'swedish' => 'sv([_-][a-z]+)?', + 'thai' => 'th([_-][a-z]+)?', + 'turkish' => 'tr([_-][a-z]+)?', + 'ukranian' => 'uk([_-][a-z]+)?', + 'urdu' => 'ur', + 'viatnamese' => 'vi', + 'chinese_traditional_taiwan'=> 'zh[_-]tw', + 'chinese_simplified' => 'zh', + ); + + if (isset($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) + { + $accept_lang_ary = explode(',', $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']); + for ($i = 0; $i < sizeof($accept_lang_ary); $i++) + { + @reset($match_lang); + while (list($lang, $match) = each($match_lang)) + { + if (preg_match('#' . $match . '#i', trim($accept_lang_ary[$i]))) + { + if (file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $lang))) + { + return $lang; + } + } + } + } + } + + return 'english'; + +} +// +// FUNCTIONS +// --------- + +// Begin +error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables +set_magic_quotes_runtime(0); // Disable magic_quotes_runtime + +// PHP5 with register_long_arrays off? +if (!isset($HTTP_POST_VARS) && isset($_POST)) +{ + $HTTP_POST_VARS = $_POST; + $HTTP_GET_VARS = $_GET; + $HTTP_SERVER_VARS = $_SERVER; + $HTTP_COOKIE_VARS = $_COOKIE; + $HTTP_ENV_VARS = $_ENV; + $HTTP_POST_FILES = $_FILES; + + // _SESSION is the only superglobal which is conditionally set + if (isset($_SESSION)) + { + $HTTP_SESSION_VARS = $_SESSION; + } +} + +// Slash data if it isn't slashed +if (!get_magic_quotes_gpc()) +{ + if (is_array($HTTP_GET_VARS)) + { + while (list($k, $v) = each($HTTP_GET_VARS)) + { + if (is_array($HTTP_GET_VARS[$k])) + { + while (list($k2, $v2) = each($HTTP_GET_VARS[$k])) + { + $HTTP_GET_VARS[$k][$k2] = addslashes($v2); + } + @reset($HTTP_GET_VARS[$k]); + } + else + { + $HTTP_GET_VARS[$k] = addslashes($v); + } + } + @reset($HTTP_GET_VARS); + } + + if (is_array($HTTP_POST_VARS)) + { + while (list($k, $v) = each($HTTP_POST_VARS)) + { + if (is_array($HTTP_POST_VARS[$k])) + { + while (list($k2, $v2) = each($HTTP_POST_VARS[$k])) + { + $HTTP_POST_VARS[$k][$k2] = addslashes($v2); + } + @reset($HTTP_POST_VARS[$k]); + } + else + { + $HTTP_POST_VARS[$k] = addslashes($v); + } + } + @reset($HTTP_POST_VARS); + } + + if (is_array($HTTP_COOKIE_VARS)) + { + while (list($k, $v) = each($HTTP_COOKIE_VARS)) + { + if (is_array($HTTP_COOKIE_VARS[$k])) + { + while (list($k2, $v2) = each($HTTP_COOKIE_VARS[$k])) + { + $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); + } + @reset($HTTP_COOKIE_VARS[$k]); + } + else + { + $HTTP_COOKIE_VARS[$k] = addslashes($v); + } + } + @reset($HTTP_COOKIE_VARS); + } +} + +// Begin main prog +define('IN_PHPBB', true); +// Uncomment the following line to completely disable the ftp option... +// define('NO_FTP', true); +$phpbb_root_path = './../'; +include($phpbb_root_path.'extension.inc'); + +// Initialise some basic arrays +$userdata = array(); +$lang = array(); +$error = false; + +// Include some required functions +include($phpbb_root_path.'includes/constants.'.$phpEx); +include($phpbb_root_path.'includes/functions.'.$phpEx); +include($phpbb_root_path.'includes/sessions.'.$phpEx); + +// Define schema info +$available_dbms = array( + 'mysql'=> array( + 'LABEL' => 'MySQL 3.x', + 'SCHEMA' => 'mysql', + 'DELIM' => ';', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_remarks' + ), + 'mysql4' => array( + 'LABEL' => 'MySQL 4.x/5.x', + 'SCHEMA' => 'mysql', + 'DELIM' => ';', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_remarks' + ), + 'postgres' => array( + 'LABEL' => 'PostgreSQL 7.x', + 'SCHEMA' => 'postgres', + 'DELIM' => ';', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_comments' + ), + 'mssql' => array( + 'LABEL' => 'MS SQL Server 7/2000', + 'SCHEMA' => 'mssql', + 'DELIM' => 'GO', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_comments' + ), + 'msaccess' => array( + 'LABEL' => 'MS Access [ ODBC ]', + 'SCHEMA' => '', + 'DELIM' => '', + 'DELIM_BASIC' => ';', + 'COMMENTS' => '' + ), + 'mssql-odbc' => array( + 'LABEL' => 'MS SQL Server [ ODBC ]', + 'SCHEMA' => 'mssql', + 'DELIM' => 'GO', + 'DELIM_BASIC' => ';', + 'COMMENTS' => 'remove_comments' + ) +); + +// Obtain various vars +$confirm = (isset($HTTP_POST_VARS['confirm'])) ? true : false; +$cancel = (isset($HTTP_POST_VARS['cancel'])) ? true : false; + +if (isset($HTTP_POST_VARS['install_step']) || isset($HTTP_GET_VARS['install_step'])) +{ + $install_step = (isset($HTTP_POST_VARS['install_step'])) ? $HTTP_POST_VARS['install_step'] : $HTTP_GET_VARS['install_step']; +} +else +{ + $install_step = ''; +} + +$upgrade = (!empty($HTTP_POST_VARS['upgrade'])) ? $HTTP_POST_VARS['upgrade']: ''; +$upgrade_now = (!empty($HTTP_POST_VARS['upgrade_now'])) ? $HTTP_POST_VARS['upgrade_now']:''; + +$dbms = isset($HTTP_POST_VARS['dbms']) ? $HTTP_POST_VARS['dbms'] : ''; + +$dbhost = (!empty($HTTP_POST_VARS['dbhost'])) ? $HTTP_POST_VARS['dbhost'] : 'localhost'; +$dbuser = (!empty($HTTP_POST_VARS['dbuser'])) ? $HTTP_POST_VARS['dbuser'] : ''; +$dbpasswd = (!empty($HTTP_POST_VARS['dbpasswd'])) ? $HTTP_POST_VARS['dbpasswd'] : ''; +$dbname = (!empty($HTTP_POST_VARS['dbname'])) ? $HTTP_POST_VARS['dbname'] : ''; + +$table_prefix = (!empty($HTTP_POST_VARS['prefix'])) ? $HTTP_POST_VARS['prefix'] : ''; + +$admin_name = (!empty($HTTP_POST_VARS['admin_name'])) ? $HTTP_POST_VARS['admin_name'] : ''; +$admin_pass1 = (!empty($HTTP_POST_VARS['admin_pass1'])) ? $HTTP_POST_VARS['admin_pass1'] : ''; +$admin_pass2 = (!empty($HTTP_POST_VARS['admin_pass2'])) ? $HTTP_POST_VARS['admin_pass2'] : ''; + +$ftp_path = (!empty($HTTP_POST_VARS['ftp_path'])) ? $HTTP_POST_VARS['ftp_path'] : ''; +$ftp_user = (!empty($HTTP_POST_VARS['ftp_user'])) ? $HTTP_POST_VARS['ftp_user'] : ''; +$ftp_pass = (!empty($HTTP_POST_VARS['ftp_pass'])) ? $HTTP_POST_VARS['ftp_pass'] : ''; + +if (isset($HTTP_POST_VARS['lang']) && preg_match('#^[a-z_]+$#', $HTTP_POST_VARS['lang'])) +{ + $language = strip_tags($HTTP_POST_VARS['lang']); +} +else +{ + $language = guess_lang(); +} + +$board_email = (!empty($HTTP_POST_VARS['board_email'])) ? $HTTP_POST_VARS['board_email'] : ''; +$script_path = (!empty($HTTP_POST_VARS['script_path'])) ? $HTTP_POST_VARS['script_path'] : str_replace('install', '', dirname($HTTP_SERVER_VARS['PHP_SELF'])); + +if (!empty($HTTP_POST_VARS['server_name'])) +{ + $server_name = $HTTP_POST_VARS['server_name']; +} +else +{ + // Guess at some basic info used for install.. + if (!empty($HTTP_SERVER_VARS['SERVER_NAME']) || !empty($HTTP_ENV_VARS['SERVER_NAME'])) + { + $server_name = (!empty($HTTP_SERVER_VARS['SERVER_NAME'])) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $HTTP_ENV_VARS['SERVER_NAME']; + } + else if (!empty($HTTP_SERVER_VARS['HTTP_HOST']) || !empty($HTTP_ENV_VARS['HTTP_HOST'])) + { + $server_name = (!empty($HTTP_SERVER_VARS['HTTP_HOST'])) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_ENV_VARS['HTTP_HOST']; + } + else + { + $server_name = ''; + } +} + +if (!empty($HTTP_POST_VARS['server_port'])) +{ + $server_port = $HTTP_POST_VARS['server_port']; +} +else +{ + if (!empty($HTTP_SERVER_VARS['SERVER_PORT']) || !empty($HTTP_ENV_VARS['SERVER_PORT'])) + { + $server_port = (!empty($HTTP_SERVER_VARS['SERVER_PORT'])) ? $HTTP_SERVER_VARS['SERVER_PORT'] : $HTTP_ENV_VARS['SERVER_PORT']; + } + else + { + $server_port = '80'; + } +} + +// Open config.php ... if it exists +if (@file_exists(@phpbb_realpath('config.'.$phpEx))) +{ + include($phpbb_root_path.'config.'.$phpEx); +} + +// Is phpBB already installed? Yes? Redirect to the index +if (defined("PHPBB_INSTALLED")) +{ + redirect('../index.'.$phpEx); +} + +// Import language file, setup template ... +include($phpbb_root_path.'language/lang_' . $language . '/lang_main.'.$phpEx); +include($phpbb_root_path.'language/lang_' . $language . '/lang_admin.'.$phpEx); + +// Ok for the time being I'm commenting this out whilst I'm working on +// better integration of the install with upgrade as per Bart's request +// JLH +if ($upgrade == 1) +{ + // require('upgrade.'.$phpEx); + $install_step = 1; +} + +// What do we need to do? +if (!empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 1 && empty($HTTP_POST_VARS['upgrade_now'])) +{ + header('Content-Type: text/x-delimtext; name="config.' . $phpEx . '"'); + header('Content-disposition: attachment; filename="config.' . $phpEx . '"'); + + // We need to stripslashes no matter what the setting of magic_quotes_gpc is + // because we add slashes at the top if its off, and they are added automaticlly + // if it is on. + echo stripslashes($HTTP_POST_VARS['config_data']); + + exit; +} +else if (!empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 2) +{ + $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars(stripslashes($HTTP_POST_VARS['config_data'])) . '" />'; + $s_hidden_fields .= '<input type="hidden" name="ftp_file" value="1" />'; + + if ($upgrade == 1) + { + $s_hidden_fields .= '<input type="hidden" name="upgrade" value="1" />'; + } + + page_header($lang['ftp_instructs']); + +?> + <tr> + <th colspan="2"><?php echo $lang['ftp_info']; ?></th> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['ftp_path']; ?></span></td> + <td class="row2"><input type="text" name="ftp_dir"></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['ftp_username']; ?></span></td> + <td class="row2"><input type="text" name="ftp_user"></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['ftp_password']; ?></span></td> + <td class="row2"><input type="password" name="ftp_pass"></td> + </tr> +<?php + + page_common_form($s_hidden_fields, $lang['Transfer_config']); + page_footer(); + exit; + +} +else if (!empty($HTTP_POST_VARS['ftp_file'])) +{ + // Try to connect ... + $conn_id = @ftp_connect('localhost'); + $login_result = @ftp_login($conn_id, "$ftp_user", "$ftp_pass"); + + if (!$conn_id || !$login_result) + { + page_header($lang['NoFTP_config']); + + // Error couldn't get connected... Go back to option to send file... + $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars(stripslashes($HTTP_POST_VARS['config_data'])) . '" />'; + $s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />'; + + // If we're upgrading ... + if ($upgrade == 1) + { + $s_hidden_fields .= '<input type="hidden" name="upgrade" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="dbms" value="'.$dmbs.'" />'; + $s_hidden_fields .= '<input type="hidden" name="prefix" value="'.$table_prefix.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbhost" value="'.$dbhost.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbname" value="'.$dbname.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbuser" value="'.$dbuser.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbpasswd" value="'.$dbpasswd.'" />'; + $s_hidden_fields .= '<input type="hidden" name="install_step" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="admin_pass1" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="admin_pass2" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="server_port" value="'.$server_port.'" />'; + $s_hidden_fields .= '<input type="hidden" name="server_name" value="'.$server_name.'" />'; + $s_hidden_fields .= '<input type="hidden" name="script_path" value="'.$script_path.'" />'; + $s_hidden_fields .= '<input type="hidden" name="board_email" value="'.$board_email.'" />'; + + page_upgrade_form(); + } + else + { + page_common_form($s_hidden_fields, $lang['Download_config']); + + } + + page_footer(); + exit; + } + else + { + // Write out a temp file... + $tmpfname = @tempnam('/tmp', 'cfg'); + + @unlink($tmpfname); // unlink for safety on php4.0.3+ + + $fp = @fopen($tmpfname, 'w'); + + @fwrite($fp, stripslashes($HTTP_POST_VARS['config_data'])); + + @fclose($fp); + + // Now ftp it across. + @ftp_chdir($conn_id, $ftp_dir); + + $res = ftp_put($conn_id, 'config.'.$phpEx, $tmpfname, FTP_ASCII); + + @ftp_quit($conn_id); + + unlink($tmpfname); + + if ($upgrade == 1) + { + require('upgrade.'.$phpEx); + exit; + } + + // Ok we are basically done with the install process let's go on + // and let the user configure their board now. We are going to do + // this by calling the admin_board.php from the normal board admin + // section. + $s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />'; + $s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />'; + $s_hidden_fields .= '<input type="hidden" name="redirect" value="../admin/index.'.$phpEx.'" />'; + $s_hidden_fields .= '<input type="hidden" name="submit" value="' . $lang['Login'] . '" />'; + + page_header($lang['Inst_Step_2']); + page_common_form($s_hidden_fields, $lang['Finish_Install']); + page_footer(); + exit(); + } +} +else if ((empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin_pass1) || empty($dbhost))) +{ + // Ok we haven't installed before so lets work our way through the various + // steps of the install process. This could turn out to be quite a lengty + // process. + + // Step 0 gather the pertinant info for database setup... + // Namely dbms, dbhost, dbname, dbuser, and dbpasswd. + $instruction_text = $lang['Inst_Step_0']; + + if (!empty($install_step)) + { + if ((($HTTP_POST_VARS['admin_pass1'] != $HTTP_POST_VARS['admin_pass2'])) || + (empty($HTTP_POST_VARS['admin_pass1']) || empty($dbhost)) && $HTTP_POST_VARS['cur_lang'] == $language) + { + $error = $lang['Password_mismatch']; + } + } + + $dirname = $phpbb_root_path . 'language'; + $dir = opendir($dirname); + + $lang_options = array(); + while ($file = readdir($dir)) + { + if (preg_match('#^lang_#i', $file) && !is_file(@phpbb_realpath($dirname . '/' . $file)) && !is_link(@phpbb_realpath($dirname . '/' . $file))) + { + $filename = trim(str_replace('lang_', '', $file)); + $displayname = preg_replace('/^(.*?)_(.*)$/', '\1 [ \2 ]', $filename); + $displayname = preg_replace('/\[(.*?)_(.*)\]/', '[ \1 - \2 ]', $displayname); + $lang_options[$displayname] = $filename; + } + } + + closedir($dir); + + @asort($lang_options); + @reset($lang_options); + + $lang_select = '<select name="lang" onchange="this.form.submit()">'; + while (list($displayname, $filename) = @each($lang_options)) + { + $selected = ($language == $filename) ? ' selected="selected"' : ''; + $lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>'; + } + $lang_select .= '</select>'; + + $dbms_select = '<select name="dbms" onchange="if(this.form.upgrade.options[this.form.upgrade.selectedIndex].value == 1){ this.selectedIndex = 0;}">'; + while (list($dbms_name, $details) = @each($available_dbms)) + { + $selected = ($dbms_name == $dbms) ? 'selected="selected"' : ''; + $dbms_select .= '<option value="' . $dbms_name . '">' . $details['LABEL'] . '</option>'; + } + $dbms_select .= '</select>'; + + $upgrade_option = '<select name="upgrade"'; + $upgrade_option .= 'onchange="if (this.options[this.selectedIndex].value == 1) { this.form.dbms.selectedIndex = 0; }">'; + $upgrade_option .= '<option value="0">' . $lang['Install'] . '</option>'; + $upgrade_option .= '<option value="1">' . $lang['Upgrade'] . '</option></select>'; + + $s_hidden_fields = '<input type="hidden" name="install_step" value="1" /><input type="hidden" name="cur_lang" value="' . $language . '" />'; + + page_header($instruction_text); + +?> + <tr> + <th colspan="2"><?php echo $lang['Initial_config']; ?></th> + </tr> + <tr> + <td class="row1" align="right" width="30%"><span class="gen"><?php echo $lang['Default_lang']; ?>: </span></td> + <td class="row2"><?php echo $lang_select; ?></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['dbms']; ?>: </span></td> + <td class="row2"><?php echo $dbms_select; ?></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Install_Method']; ?>:</span></td> + <td class="row2"><?php echo $upgrade_option; ?></td> + </tr> + <tr> + <th colspan="2"><?php echo $lang['DB_config']; ?></th> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['DB_Host']; ?>: </span></td> + <td class="row2"><input type="text" name="dbhost" value="<?php echo ($dbhost != '') ? $dbhost : ''; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['DB_Name']; ?>: </span></td> + <td class="row2"><input type="text" name="dbname" value="<?php echo ($dbname != '') ? $dbname : ''; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['DB_Username']; ?>: </span></td> + <td class="row2"><input type="text" name="dbuser" value="<?php echo ($dbuser != '') ? $dbuser : ''; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['DB_Password']; ?>: </span></td> + <td class="row2"><input type="password" name="dbpasswd" value="<?php echo ($dbpasswd != '') ? $dbpasswd : ''; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Table_Prefix']; ?>: </span></td> + <td class="row2"><input type="text" name="prefix" value="<?php echo (!empty($table_prefix)) ? $table_prefix : "phpbb_"; ?>" /></td> + </tr> + <tr> + <th colspan="2"><?php echo $lang['Admin_config']; ?></th> + </tr> +<?php + + if ($error) + { +?> + <tr> + <td class="row1" colspan="2" align="center"><span class="gen" style="color:red"><?php echo $error; ?></span></td> + </tr> +<?php + + } +?> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_email']; ?>: </span></td> + <td class="row2"><input type="text" name="board_email" value="<?php echo ($board_email != '') ? $board_email : ''; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Server_name']; ?>: </span></td> + <td class="row2"><input type="text" name="server_name" value="<?php echo $server_name; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Server_port']; ?>: </span></td> + <td class="row2"><input type="text" name="server_port" value="<?php echo $server_port; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Script_path']; ?>: </span></td> + <td class="row2"><input type="text" name="script_path" value="<?php echo $script_path; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_Username']; ?>: </span></td> + <td class="row2"><input type="text" name="admin_name" value="<?php echo ($admin_name != '') ? $admin_name : ''; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_Password']; ?>: </span></td> + <td class="row2"><input type="password" name="admin_pass1" value="<?php echo ($admin_pass1 != '') ? $admin_pass1 : ''; ?>" /></td> + </tr> + <tr> + <td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_Password_confirm']; ?>: </span></td> + <td class="row2"><input type="password" name="admin_pass2" value="<?php echo ($admin_pass2 != '') ? $admin_pass2 : ''; ?>" /></td> + </tr> +<?php + + page_common_form($s_hidden_fields, $lang['Start_Install']); + page_footer(); + exit; +} +else +{ + // Go ahead and create the DB, then populate it + // + // MS Access is slightly different in that a pre-built, pre- + // populated DB is supplied, all we need do here is update + // the relevant entries + if (isset($dbms)) + { + switch($dbms) + { + case 'msaccess': + case 'mssql-odbc': + $check_exts = 'odbc'; + $check_other = 'odbc'; + break; + + case 'mssql': + $check_exts = 'mssql'; + $check_other = 'sybase'; + break; + + case 'mysql': + case 'mysql4': + $check_exts = 'mysql'; + $check_other = 'mysql'; + break; + + case 'postgres': + $check_exts = 'pgsql'; + $check_other = 'pgsql'; + break; + } + + if (!extension_loaded($check_exts) && !extension_loaded($check_other)) + { + page_header($lang['Install'], ''); + page_error($lang['Installer_Error'], $lang['Install_No_Ext']); + page_footer(); + exit; + } + + include($phpbb_root_path.'includes/db.'.$phpEx); + } + + $dbms_schema = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql'; + $dbms_basic = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_basic.sql'; + + $remove_remarks = $available_dbms[$dbms]['COMMENTS'];; + $delimiter = $available_dbms[$dbms]['DELIM']; + $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; + + if ($install_step == 1) + { + if ($upgrade != 1) + { + if ($dbms != 'msaccess') + { + // Load in the sql parser + include($phpbb_root_path.'includes/sql_parse.'.$phpEx); + + // Ok we have the db info go ahead and read in the relevant schema + // and work on building the table.. probably ought to provide some + // kind of feedback to the user as we are working here in order + // to let them know we are actually doing something. + $sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema)); + $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); + + $sql_query = $remove_remarks($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter); + + for ($i = 0; $i < sizeof($sql_query); $i++) + { + if (trim($sql_query[$i]) != '') + { + if (!($result = $db->sql_query($sql_query[$i]))) + { + $error = $db->sql_error(); + + page_header($lang['Install'], ''); + page_error($lang['Installer_Error'], $lang['Install_db_error'] . '<br />' . $error['message']); + page_footer(); + exit; + } + } + } + + // Ok tables have been built, let's fill in the basic information + $sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic)); + $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); + + $sql_query = $remove_remarks($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter_basic); + + for($i = 0; $i < sizeof($sql_query); $i++) + { + if (trim($sql_query[$i]) != '') + { + if (!($result = $db->sql_query($sql_query[$i]))) + { + $error = $db->sql_error(); + + page_header($lang['Install'], ''); + page_error($lang['Installer_Error'], $lang['Install_db_error'] . '<br />' . $error['message']); + page_footer(); + exit; + } + } + } + } + + // Ok at this point they have entered their admin password, let's go + // ahead and create the admin account with some basic default information + // that they can customize later, and write out the config file. After + // this we are going to pass them over to the admin_forum.php script + // to set up their forum defaults. + $error = ''; + + // Update the default admin user with their information. + $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) + VALUES ('board_startdate', " . time() . ")"; + if (!$db->sql_query($sql)) + { + $error .= "Could not insert board_startdate :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; + } + + $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) + VALUES ('default_lang', '" . str_replace("\'", "''", $language) . "')"; + if (!$db->sql_query($sql)) + { + $error .= "Could not insert default_lang :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; + } + + $update_config = array( + 'board_email' => $board_email, + 'script_path' => $script_path, + 'server_port' => $server_port, + 'server_name' => $server_name, + ); + + while (list($config_name, $config_value) = each($update_config)) + { + $sql = "UPDATE " . $table_prefix . "config + SET config_value = '$config_value' + WHERE config_name = '$config_name'"; + if (!$db->sql_query($sql)) + { + $error .= "Could not insert default_lang :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; + } + } + + $admin_pass_md5 = ($confirm && $userdata['user_level'] == ADMIN) ? $admin_pass1 : md5($admin_pass1); + + $sql = "UPDATE " . $table_prefix . "users + SET username = '" . str_replace("\'", "''", $admin_name) . "', user_password='" . str_replace("\'", "''", $admin_pass_md5) . "', user_lang = '" . str_replace("\'", "''", $language) . "', user_email='" . str_replace("\'", "''", $board_email) . "' + WHERE username = 'Admin'"; + if (!$db->sql_query($sql)) + { + $error .= "Could not update admin info :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; + } + + $sql = "UPDATE " . $table_prefix . "users + SET user_regdate = " . time(); + if (!$db->sql_query($sql)) + { + $error .= "Could not update user_regdate :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />"; + } + + if ($error != '') + { + page_header($lang['Install'], ''); + page_error($lang['Installer_Error'], $lang['Install_db_error'] . '<br /><br />' . $error); + page_footer(); + exit; + } + } + + if (!$upgrade_now) + { + // Write out the config file. + $config_data = '<?php'."\n\n"; + $config_data .= "\n// phpBB 2.x auto-generated config file\n// Do not change anything in this file!\n\n"; + $config_data .= '$dbms = \'' . $dbms . '\';' . "\n\n"; + $config_data .= '$dbhost = \'' . $dbhost . '\';' . "\n"; + $config_data .= '$dbname = \'' . $dbname . '\';' . "\n"; + $config_data .= '$dbuser = \'' . $dbuser . '\';' . "\n"; + $config_data .= '$dbpasswd = \'' . $dbpasswd . '\';' . "\n\n"; + $config_data .= '$table_prefix = \'' . $table_prefix . '\';' . "\n\n"; + $config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n"; + $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! + + @umask(0111); + $no_open = FALSE; + + // Unable to open the file writeable do something here as an attempt + // to get around that... + if (!($fp = @fopen($phpbb_root_path . 'config.'.$phpEx, 'w'))) + { + $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($config_data) . '" />'; + + if (@extension_loaded('ftp') && !defined('NO_FTP')) + { + page_header($lang['Unwriteable_config'] . '<p>' . $lang['ftp_option'] . '</p>'); + +?> + <tr> + <th colspan="2"><?php echo $lang['ftp_choose']; ?></th> + </tr> + <tr> + <td class="row1" align="right" width="50%"><span class="gen"><?php echo $lang['Attempt_ftp']; ?></span></td> + <td class="row2"><input type="radio" name="send_file" value="2"></td> + </tr> + <tr> + <td class="row1" align="right" width="50%"><span class="gen"><?php echo $lang['Send_file']; ?></span></td> + <td class="row2"><input type="radio" name="send_file" value="1"></td> + </tr> +<?php + + } + else + { + page_header($lang['Unwriteable_config']); + $s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />'; + } + + if ($upgrade == 1) + { + $s_hidden_fields .= '<input type="hidden" name="upgrade" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="dbms" value="'.$dbms.'" />'; + $s_hidden_fields .= '<input type="hidden" name="prefix" value="'.$table_prefix.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbhost" value="'.$dbhost.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbname" value="'.$dbname.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbuser" value="'.$dbuser.'" />'; + $s_hidden_fields .= '<input type="hidden" name="dbpasswd" value="'.$dbpasswd.'" />'; + $s_hidden_fields .= '<input type="hidden" name="install_step" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="admin_pass1" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="admin_pass2" value="1" />'; + $s_hidden_fields .= '<input type="hidden" name="server_port" value="'.$server_port.'" />'; + $s_hidden_fields .= '<input type="hidden" name="server_name" value="'.$server_name.'" />'; + $s_hidden_fields .= '<input type="hidden" name="script_path" value="'.$script_path.'" />'; + $s_hidden_fields .= '<input type="hidden" name="board_email" value="'.$board_email.'" />'; + + page_upgrade_form(); + + } + else + { + page_common_form($s_hidden_fields, $lang['Download_config']); + } + + page_footer(); + exit; + } + + $result = @fputs($fp, $config_data, strlen($config_data)); + + @fclose($fp); + $upgrade_now = $lang['upgrade_submit']; + } + + // First off let's check and see if we are supposed to be doing an upgrade. + if ($upgrade == 1 && $upgrade_now == $lang['upgrade_submit']) + { + define('INSTALLING', true); + require('upgrade.'.$phpEx); + exit; + } + + // Ok we are basically done with the install process let's go on + // and let the user configure their board now. We are going to do + // this by calling the admin_board.php from the normal board admin + // section. + $s_hidden_fields = '<input type="hidden" name="username" value="' . $admin_name . '" />'; + $s_hidden_fields .= '<input type="hidden" name="password" value="' . $admin_pass1 . '" />'; + $s_hidden_fields .= '<input type="hidden" name="redirect" value="admin/index.'.$phpEx.'" />'; + $s_hidden_fields .= '<input type="hidden" name="login" value="true" />'; + + page_header($lang['Inst_Step_2'], '../login.'.$phpEx); + page_common_form($s_hidden_fields, $lang['Finish_Install']); + page_footer(); + exit; + } +} + +?> Added: main/trunk/install/schemas/index.htm =================================================================== --- main/trunk/install/schemas/index.htm (rev 0) +++ main/trunk/install/schemas/index.htm 2007-04-15 02:51:17 UTC (rev 286) @@ -0,0 +1,10 @@ +<html> +<head> +<title></title> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> + +<body bgcolor="#FFFFFF" text="#000000"> + +</body> +</html> Added: main/trunk/install/schemas/ms_access_primer.zip =================================================================== (Binary files differ) Property changes on: main/trunk/install/schemas/ms_access_primer.zip ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: main/trunk/install/schemas/mssql_basic.sql =================================================================== --- main/trunk/install/schemas/mssql_basic.sql (rev 0) +++ main/trunk/install/schemas/mssql_basic.sql 2007-04-15 02:51:17 UTC (rev 286) @@ -0,0 +1,254 @@ +/* + + Basic DB data for phpBB2 devel (MSSQL) + + $Id: mssql_basic.sql,v 1.1.2.28 2006/12/16 13:11:27 acydburn Exp $ + +*/ + +BEGIN TRANSACTION; + +/* + -- Config +*/ +INSERT INTO phpbb_config (config_name, config_value) VALUES ('config_id','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename','yourdomain.com'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc','A _little_ text to describe your forum'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_name','phpbb2mysql'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_path','/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_domain',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_secure','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length','3600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_html_tags','b,i,u,pre'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_theme_create','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold','25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_inbox_privmsgs','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sentbox_privmsgs','25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_savebox_privmsgs','50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','you...@yo...'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_autologin_time','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password',''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_flood_interval','15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_min_chars','3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '5'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('login_reset_time', '30'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width','80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height','80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path','images/avatars'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path','images/avatars/gallery'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path','images/smiles'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat','D M d, Y g:i a'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.yourdomain.tld'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.0.22'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('rand_seed', '0'); + +/* + -- Categories +*/ +SET IDENTITY_INSERT phpbb_categories ON; + +INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test category 1', 1); + +SET IDENTITY_INSERT phpbb_categories OFF; + + +/* + -- Forums +*/ +INSERT INTO phpbb_forums (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 1, 'Test Forum 1', 'This is just a test forum, nothing special here.', '', 1, 1, 1, 1, '', 1, '', '', 1, 1, 1, 1, 3, 3, 1, 1, 3); + +/* + -- Users + Default Admin --> username: admin + password: admin (change this or remove it once everything is working!) +*/ +INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( -1, 'Anonymous', 0, 0, '', '', '', '', '', '', '', '', 0, NULL, '', '', '', 0, 0, 1, 1, 1, 0, 1, 1, NULL, '', '', 0, '', '', '', 0, 0); +INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_popup_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( 2, 'Admin', 1, 0, '21232f297a57a5a743894a0e4a801fc3', 'ad...@yo...', '', '', '', '', '', '', 1, 1, '', '', '', 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, '', 'english', 0, 'd M Y h:i a', '', '', 0, 1); + + +/* + -- Ranks +*/ +SET IDENTITY_INSERT phpbb_ranks ON; + +INSERT INTO phpbb_ranks (rank_id, rank_title, rank_min, rank_special, rank_image) VALUES (1, 'Site Admin', -1, 1, ''); + +SET IDENTITY_INSERT phpbb_ranks OFF; + + +/* + -- Groups +*/ +SET IDENTITY_INSERT phpbb_groups ON; + +INSERT INTO phpbb_groups (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES (1, 1, 'Anonymous', 'Personal User', '', 1); +INSERT INTO phpbb_groups (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES (2, 1, 'Admin', 'Personal User', '', 1); + +SET IDENTITY_INSERT phpbb_groups OFF; + +/* + -- User -> Group +*/ +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (1, -1, ''); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending) VALUES (2, 2, ''); + + +/* + -- Demo Topic +*/ +SET IDENTITY_INSERT phpbb_topics ON; + +INSERT INTO phpbb_topics (topic_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, forum_id, topic_status, topic_type, topic_vote, topic_first_post_id, topic_last_post_id, topic_moved_id) VALUES (1, 'Welcome to phpBB 2', 2, '972086460', 0, 0, 1, 0, 0, 0, 1, 1, ''); + +SET IDENTITY_INSERT phpbb_topics OFF; + + +/* + -- Demo Post +*/ +SET IDENTITY_INSERT phpbb_posts ON; + +INSERT INTO phpbb_posts (post_id, topic_id, forum_id, poster_id, post_time, post_username, poster_ip) VALUES (1, 1, 1, 2, 972086460, NULL, '7F000001'); +INSERT INTO phpbb_posts_text (post_id, post_subject, post_text) VALUES (1, NULL, 'This is an example post in your phpBB 2 installation. You may delete this post, this topic and even this forum if you like since everything seems to be working!'); + +SET IDENTITY_INSERT phpbb_posts OFF; + + +/* + -- Themes +*/ +SET IDENTITY_INSERT phpbb_themes ON; + +INSERT INTO phpbb_themes (themes_id, template_name, style_name, head_stylesheet, body_background, body_bgcolor, body_text, body_link, body_vlink, body_alink, body_hlink, tr_color1, tr_color2, tr_color3, tr_class1, tr_class2, tr_class3, th_color1, th_color2, th_color3, th_class1, th_class2, th_class3, td_color1, td_color2, td_color3, td_class1, td_class2, td_class3, fontface1, fontface2, fontface3, fontsize1, fontsize2, fontsize3, fontcolor1, fontcolor2, fontcolor3, span_class1, span_class2, span_class3) VALUES (1, 'subSilver', 'subSilver', 'subSilver.css', '', 'E5E5E5', '000000', '006699', '5493B4', '', 'DD6900', 'EFEFEF', 'DEE3E7', 'D1D7DC', '', '', '', '98AAB1', '006699', 'FFFFFF', 'cellpic1.gif', 'cellpic3.gif', 'cellpic2.jpg', 'FAFAFA', 'FFFFFF', '', 'row1', 'row2', '', 'Verdana, Arial, Helvetica, sans-serif', 'Trebuchet MS', 'Courier, ''Courier New'', sans-serif', 10, 11, 12, '444444', '006600', 'FFA34F', '', '', ''); + +SET IDENTITY_INSERT phpbb_themes OFF; + +INSERT INTO phpbb_themes_name (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name) VALUES (1, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', ''); + + +/* + -- Smilies +*/ +SET IDENTITY_INSERT phpbb_smilies ON; + +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 1, ':D', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 2, ':-D', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 3, ':grin:', 'icon_biggrin.gif', 'Very Happy'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 4, ':)', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 5, ':-)', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 6, ':smile:', 'icon_smile.gif', 'Smile'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 7, ':(', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 8, ':-(', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 9, ':sad:', 'icon_sad.gif', 'Sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 10, ':o', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 11, ':-o', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 12, ':eek:', 'icon_surprised.gif', 'Surprised'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 13, ':shock:', 'icon_eek.gif', 'Shocked'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 14, ':?', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 15, ':-?', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 16, ':???:', 'icon_confused.gif', 'Confused'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 17, '8)', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 18, '8-)', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 19, ':cool:', 'icon_cool.gif', 'Cool'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 20, ':lol:', 'icon_lol.gif', 'Laughing'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 21, ':x', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 22, ':-x', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 23, ':mad:', 'icon_mad.gif', 'Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 24, ':P', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 25, ':-P', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 26, ':razz:', 'icon_razz.gif', 'Razz'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 27, ':oops:', 'icon_redface.gif', 'Embarassed'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 28, ':cry:', 'icon_cry.gif', 'Crying or Very sad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 29, ':evil:', 'icon_evil.gif', 'Evil or Very Mad'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 30, ':twisted:', 'icon_twisted.gif', 'Twisted Evil'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 31, ':roll:', 'icon_rolleyes.gif', 'Rolling Eyes'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 32, ':wink:', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 33, ';)', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 34, ';-)', 'icon_wink.gif', 'Wink'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 35, ':!:', 'icon_exclaim.gif', 'Exclamation'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 36, ':?:', 'icon_question.gif', 'Question'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 37, ':idea:', 'icon_idea.gif', 'Idea'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 38, ':arrow:', 'icon_arrow.gif', 'Arrow'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 39, ':|', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 40, ':-|', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 41, ':neutral:', 'icon_neutral.gif', 'Neutral'); +INSERT INTO phpbb_smilies (smilies_id, code, smile_url, emoticon) VALUES ( 42, ':mrgreen:', 'icon_mrgreen.gif', 'Mr. Green'); + +SET IDENTITY_INSERT phpbb_smilies OFF; + + +/* + -- Search Words +*/ +SET IDENTITY_INSERT phpbb_search_wordlist ON; + +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 1, 'example', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 2, 'post', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 3, 'phpbb', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 4, 'installation', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 5, 'delete', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 6, 'topic', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 7, 'forum', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 8, 'since', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 9, 'everything', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 10, 'seems', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 11, 'working', 0 ); +INSERT INTO phpbb_search_wordlist (word_id, word_text, word_common) VALUES ( 12, 'welcome', 0 ); + +SET IDENTITY_INSERT phpbb_search_wordlist OFF; + + +/* + -- Search Word Matches +*/ +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 1, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 2, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 4, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 5, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 6, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 7, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 8, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 9, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 10, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 11, 1, 0 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 12, 1, 1 ); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES ( 3, 1, 1 ); + +COMMIT; \ No newline at end of file Added: main/trunk/install/schemas/mssql_schema.sql =================================================================== --- main/trunk/install/schemas/mssql_schema.sql (rev 0) +++ main/trunk/install/schemas/mssql_schema.sql 2007-04-15 02:51:17 UTC (rev 286) @@ -0,0 +1,722 @@ +/* + + mssql_schema.sql for phpBB2 (c) 2001, phpBB Group + + $Id: mssql_schema.sql,v 1.1.2.12 2006/02/06 21:32:42 grahamje Exp $ + +*/ + +BEGIN TRANSACTION +GO + +CREATE TABLE [phpbb_auth_access] ( + [group_id] [int] NULL , + [forum_id] [int] NULL , + [auth_view] [smallint] NOT NULL , + [auth_read] [smallint] NOT NULL , + [auth_post] [smallint] NOT NULL , + [auth_reply] [smallint] NOT NULL , + [auth_edit] [smallint] NOT NULL , + [auth_delete] [smallint] NOT NULL , + [auth_sticky] [smallint] NOT NULL , + [auth_announce] [smallint] NOT NULL , + [auth_vote] [smallint] NOT NULL , + [auth_pollcreate] [smallint] NOT NULL , + [auth_attachments] [smallint] NOT NULL , + [auth_mod] [smallint] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_banlist] ( + [ban_id] [int] IDENTITY (1, 1) NOT NULL , + [ban_userid] [int] NULL , + [ban_ip] [char] (8) NULL , + [ban_email] [varchar] (50) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_categories] ( + [cat_id] [int] IDENTITY (1, 1) NOT NULL , + [cat_title] [varchar] (50) NOT NULL , + [cat_order] [int] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_config] ( + [config_name] [varchar] (255) NULL , + [config_value] [varchar] (255) NULL +) ON [PRIMARY] +GO + + +CREATE TABLE [phpbb_confirm] ( + [confirm_id] [char] (32) NOT NULL , + [session_id] [char] (32) NOT NULL , + [code] [char] (6) NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_disallow] ( + [disallow_id] [int] IDENTITY (1, 1) NOT NULL , + [disallow_username] [varchar] (100) NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_forum_prune] ( + [prune_id] [int] IDENTITY (1, 1) NOT NULL , + [forum_id] [int] NOT NULL , + [prune_days] [int] NOT NULL , + [prune_freq] [int] NOT NULL +) ON [PRIMARY] +GO + +CREATE TABLE [phpbb_forums] ( + [forum_id] [int] NOT NULL ,... [truncated message content] |