diff options
-rw-r--r-- | phpBB/admin/admin_board.php | 164 | ||||
-rw-r--r-- | phpBB/admin/admin_index.php | 3 | ||||
-rw-r--r-- | phpBB/common.php | 1 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 144 | ||||
-rw-r--r-- | phpBB/profile.php | 151 |
5 files changed, 301 insertions, 162 deletions
diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php index 5c5783d3ef..36f3dbc2cd 100644 --- a/phpBB/admin/admin_board.php +++ b/phpBB/admin/admin_board.php @@ -22,22 +22,170 @@ * ***************************************************************************/ -if($setmodules==1) +if($setmodules == 1) { $file = basename(__FILE__); - $module['General']['config'] = $file; - //$module['users']['edit'] = $file.'?mode=edit'; - //$module['users']['delete'] = $file.'?mode=delete'; - + $module['General']['config'] = "$file?mode=config"; return; } -print "Got past the \$setmodules check<br>\n"; -print "Requested action was: $mode<br>\n"; - $phpbb_root_path = "./../"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); +// +// Start session management +// +$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); +init_userprefs($userdata); +// +// End session management +// + +// +// Check user permissions +// +if( !$userdata['session_logged_in'] ) +{ + header("Location: ../login.$phpEx?forward_page=/admin"); +} +else if( $userdata['user_level'] != ADMIN ) +{ + message_die(GENERAL_MESSAGE, "You are not authorised to administer this board"); +} +$template_header = "admin/page_header.tpl"; +include('page_header_admin.'.$phpEx); + +$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode']; + +switch($mode) +{ + case 'config': + $sitename = ($HTTP_POST_VARS['sitename']) ? $HTTP_POST_VARS['sitename'] : $board_config['sitename']; + $require_activation = ($HTTP_POST_VARS['require_activation']) ? $HTTP_POST_VARS['require_activation'] : $board_config['require_activation']; + $flood_interval = ($HTTP_POST_VARS['flood_interval']) ? $HTTP_POST_VARS['flood_interval'] : $board_config['flood_interval']; + $topics_per_page = ($HTTP_POST_VARS['topics_per_page']) ? $HTTP_POST_VARS['topics_per_page'] : $board_config['topics_per_page']; + $posts_per_page = ($HTTP_POST_VARS['posts_per_page']) ? $HTTP_POST_VARS['posts_per_page'] : $board_config['posts_per_page']; + $hot_topic = ($HTTP_POST_VARS['hot_topic']) ? $HTTP_POST_VARS['hot_topic'] : $board_config['hot_threshold']; + $selected_template = ($HTTP_POST_VARS['template']) ? $HTTP_POST_VARS['template'] : $board_config['default_template']; + $template_select = template_select($selected_template, "../templates"); + $theme = ($HTTP_POST_VARS['theme']) ? $HTTP_POST_VARS['theme'] : $board_config['default_theme']; + $theme_select = theme_select($theme); + $language = ($HTTP_POST_VARS['language']) ? $HTTP_POST_VARS['language'] : $board_config['default_lang']; + $lang_select = language_select($language, "../language"); + $timezone = ($HTTP_POST_VARS['timezone']) ? $HTTP_POST_VARS['timezone'] : $board_config['default_timezone']; + $timezone_select = tz_select($timezone); + $date_format = ($HTTP_POST_VARS['date_format']) ? $HTTP_POST_VARS['date_format'] : $board_config['default_dateformat']; + $gzip = ($HTTP_POST_VARS['gzip']) ? $HTTP_POST_VARS['gzip'] : $board_config['gzip_compress']; + $allow_html = ($HTTP_POST_VARS['allow_html']) ? $HTTP_POST_VARS['allow_html'] : $board_config['allow_html']; + $allow_bbcode = ($HTTP_POST_VARS['allow_bbcode']) ? $HTTP_POST_VARS['allow_bbcode'] : $board_config['allow_bbcode']; + $allow_smile = ($HTTP_POST_VARS['allow_smile']) ? $HTTP_POST_VARS['allow_smile'] : $board_config['allow_smilies']; + $allow_sig = ($HTTP_POST_VARS['allow_sig']) ? $HTTP_POST_VARS['allow_sig'] : $board_config['allow_sig']; + $allow_namechange = ($HTTP_POST_VARS['allow_namechange']) ? $HTTP_POST_VARS['allow_namechange'] : $board_config['allow_namechange']; + $allow_avatars_local = ($HTTP_POST_VARS['allow_avatars_local']) ? $HTTP_POST_VARS['allow_avatars_local'] : $board_config['allow_avatar_local']; + $allow_avatars_remote = ($HTTP_POST_VARS['allow_avatars_remote']) ? $HTTP_POST_VARS['allow_avatars_remote'] : $board_config['allow_avatar_remote']; + $allow_avatars_upload = ($HTTP_POST_VARS['allow_avatars_upload']) ? $HTTP_POST_VARS['allow_avatars_upload'] : $board_config['allow_avatar_upload']; + $avatar_filesize = ($HTTP_POST_VARS['avatar_filesize']) ? $HTTP_POST_VARS['avatar_filesize'] : $board_config['avatar_filesize']; + $avatar_height = ($HTTP_POST_VARS['avatar_height']) ? $HTTP_POST_VARS['avatar_height'] : $board_config['avatar_max_height']; + $avatar_width = ($HTTP_POST_VARS['avatar_width']) ? $HTTP_POST_VARS['avatar_width'] : $board_config['avatar_max_width']; + $avatar_path = ($HTTP_POST_VARS['avatar_path']) ? $HTTP_POST_VARS['avatar_path'] : $board_config['avatar_path']; + $admin_email = ($HTTP_POST_VARS['admin_email']) ? $HTTP_POST_VARS['admin_email'] : $board_config['board_email_from']; + $email_sig = ($HTTP_POST_VARS['email_sig']) ? $HTTP_POST_VARS['email_sig'] : $board_config['board_email']; + $use_smtp = ($HTTP_POST_VARS['use_smtp']) ? $HTTP_POST_VARS['use_smtp'] : $board_config['smtp_delivery']; + $smtp_server = ($HTTP_POST_VARS['smtp_server']) ? $HTTP_POST_VARS['smtp_server'] : $board_config['smtp_host']; + + $html_yes = ($allow_html) ? "CHECKED" : ""; + $html_no = (!$allow_html) ? "CHECKED" : ""; + $bbocde_yes = ($allow_bbcode) ? "CHECKED" : ""; + $bbocde_no = (!$allow_bbcode) ? "CHECKED" : ""; + $activation_yes = ($require_activation) ? "CHECKED" : ""; + $activation_no = (!$require_activation) ? "CHECKED" : ""; + $gzip_yes = ($gzip) ? "CHECKED" : ""; + $gzip_no = (!$gzip) ? "CHECKED" : ""; + $smile_yes = ($allow_smile) ? "CHECKED" : ""; + $smile_no = (!$allow_smile) ? "CHECKED" : ""; + $sig_yes = ($allow_sig) ? "CHECKED" : ""; + $sig_no = (!$allow_sig) ? "CHECKED" : ""; + $namechange_yes = ($allow_namechange) ? "CHECKED" : ""; + $namchange_no = (!$allow_namechange) ? "CHECKED" : ""; + $avatars_local_yes = ($allow_avatars_local) ? "CHECKED" : ""; + $avatars_local_no = (!$allow_avatars_local) ? "CHECKED" : ""; + $avatars_remote_yes = ($allow_avatars_remote) ? "CHECKED" : ""; + $avatars_remote_no = (!$allow_avatars_remote) ? "CHECKED" : ""; + $avatars_upload_yes = ($allow_avatars_upload) ? "CHECKED" : ""; + $avatars_upload_no = (!$allow_avatars_upload) ? "CHECKED" : ""; + $smtp_yes = ($use_smtp) ? "CHECKED" : ""; + $smtp_no = (!$use_smtp) ? "CHECKED" : ""; + + + if($HTTP_POST_VARS['submit']) + { + + + } + + // + // Error occured, show the error box + // + if($error) + { + $template->set_filenames(array( + "reg_header" => "error_body.tpl") + ); + $template->assign_vars(array( + "ERROR_MESSAGE" => $error_msg) + ); + $template->pparse("reg_header"); + } + + $template->set_filenames(array("body" => "admin/admin_config_body.tpl")); + + $template->assign_vars(array("S_CONFIG_ACTION" => append_sid("admin/admin_board.$phpEx"), + "SITENAME" => $sitename, + "ACTIVATION_YES" => $activation_yes, + "ACTIVATION_NO" => $activation_no, + "FLOOD_INTERVAL" => $flood_interval, + "TOPICS_PER_PAGE" => $topics_per_page, + "POSTS_PER_PAGE" => $posts_per_page, + "HOT_TOPIC" => $hot_topic, + "TEMPLATE_SELECT" => $template_select, + "THEME_SELECT" => $theme_select, + "LANG_SELECT" => $lang_select, + "L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'], + "DATE_FORMAT" => $date_format, + "TIMEZONE_SELECT" => $timezone_select, + "GZIP_YES" => $gzip_yes, + "GZIP_NO" => $gzip_no, + "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, + "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" => $avatar_filesize, + "AVATAR_HEIGHT" => $avatar_height, + "AVATAR_WIDTH" => $avatar_width, + "AVATAR_PATH" => $avatar_path, + "ADMIN_EMAIL" => $admin_email, + "EMAIL_SIG" => $email_sig, + "SMTP_YES" => $smtp_yes, + "SMTP_NO" => $smtp_no, + "SMTP_SERVER" => $smtp_server)); + + $template->pparse("body"); + break; + +} +include('page_footer_admin.'.$phpEx); ?>
\ No newline at end of file diff --git a/phpBB/admin/admin_index.php b/phpBB/admin/admin_index.php index f80409510d..ae7846599d 100644 --- a/phpBB/admin/admin_index.php +++ b/phpBB/admin/admin_index.php @@ -34,9 +34,6 @@ if($from_index != 1) $phpbb_root_path = "./../"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); - - $template_header = "admin/page_header.tpl"; - include('page_header_admin.'.$phpEx); } // diff --git a/phpBB/common.php b/phpBB/common.php index b33d6a6eb7..6f725f0132 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -104,6 +104,7 @@ else $board_config['override_user_themes'] = $config['override_themes']; $board_config['posts_per_page'] = $config['posts_per_page']; $board_config['topics_per_page'] = $config['topics_per_page']; + $board_config['hot_threshold'] = $config['hot_threshold']; $board_config['default_theme'] = $config['default_theme']; $board_config['default_dateformat'] = stripslashes($config['default_dateformat']); $board_config['default_template'] = stripslashes($config['sys_template']); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 98769d178b..7cb2c761d8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -626,4 +626,148 @@ function sync($type, $id) } +function language_select($default, $dirname="language/") +{ + global $phpEx; + + $dir = opendir($dirname); + + $lang_select = "<select name=\"language\">\n"; + while ($file = readdir($dir)) + { + if (ereg("^lang_", $file)) + { + $filename = str_replace("lang_", "", $file); + $filename = str_replace(".$phpEx", "", $filename); + $displayname = preg_replace("/(.*)_(.*)/", "\\1 [ \\2 ]", $filename); + $selected = (strtolower($default) == strtolower($filename)) ? " selected" : ""; + $lang_select .= " <option value=\"$filename\"$selected>".ucwords($displayname)."</option>\n"; + } + } + $lang_select .= "</select>\n"; + + closedir($dir); + + return $lang_select; +} +// NOTE: This function should check is_dir($file), however the is_dir function seems to be buggy on my +// system so its not currently implemented that way +// - James +function template_select($default, $dirname = "templates") +{ + $dir = opendir($dirname); + + $template_select = "<select name=\"template\">\n"; + while($file = readdir($dir)) + { + unset($selected); + + if($file != "." && $file != ".." && $file != "CVS") + { + if($file == $default) + { + $selected = " selected"; + } + $template_select .= "<option value=\"$file\"$selected>$file</option>\n"; + } + } + $template_select .= "</select>"; + + closedir($dir); + + return($template_select); +} +function theme_select($default) +{ + global $db, $board_config, $lang; + + $sql = "SELECT themes_id, themes_name + FROM " . THEMES_TABLE . " + WHERE themes_name LIKE '" . $board_config['default_template'] . "-%' + ORDER BY themes_name"; + if($result = $db->sql_query($sql)) + { + $num = $db->sql_numrows($result); + $rowset = $db->sql_fetchrowset($result); + + if($num) + { + $theme_select = "<select name=\"theme\">\n"; + for($i = 0; $i < $num; $i++) + { + if(stripslashes($rowset[$i]['themes_name']) == $default || $rowset[$i]['themes_id'] == $default) + { + $selected = " selected"; + } + else + { + $selected = ""; + } + $theme_select .= "\t<option value=\"" . $rowset[$i]['themes_id'] ."\"$selected>" . stripslashes($rowset[$i]['themes_name']) . "</option>\n"; + } + $theme_select .= "</select>\n"; + } + else + { + $theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>"; + } + } + else + { + message_die(GENERAL_ERROR, "Couldn't query themes table", "", __LINE__, __FILE__, $sql); + } + return($theme_select); +} +function tz_select($default) +{ + global $sys_timezone; + + if(!isset($default)) + { + $default == $sys_timezone; + } + $tz_select = "<select name=\"timezone\">"; + $tz_array = array( + "-12" => "(GMT -12:00 hours) Eniwetok, Kwajalein", + "-11" => "(GMT -11:00 hours) Midway Island, Samoa", + "-10" => "(GMT -10:00 hours) Hawaii", + "-9" => "(GMT -9:00 hours) Alaska", + "-8" => "(GMT -8:00 hours) Pacific Time (US & Canada)", + "-7" => "(GMT -7:00 hours) Mountain Time (US & Canada)", + "-6" => "(GMT -6:00 hours) Central Time (US & Canada), Mexico City", + "-5" => "(GMT -5:00 hours) Eastern Time (US & Canada), Bogota, Lima, Quito", + "-4" => "(GMT -4:00 hours) Atlantic Time (Canada), Caracas, La Paz", + "-3.5" => "(GMT -3:30 hours) Newfoundland", + "-3" => "(GMT -3:00 hours) Brazil, Buenos Aires, Georgetown", + "-2" => "(GMT -2:00 hours) Mid-Atlantic, Ascension Is., St. Helena, ", + "-1" => "(GMT -1:00 hours) Azores, Cape Verde Islands", + "0" => "(GMT) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia", + "+1" => "(GMT +1:00 hours) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome", + "+2" => "(GMT +2:00 hours) Kaliningrad, South Africa, Warsaw", + "+3" => "(GMT +3:00 hours) Baghdad, Riyadh, Moscow, Nairobi", + "+3.5" => "(GMT +3:30 hours) Tehran", + "+4" => "(GMT +4:00 hours) Abu Dhabi, Baku, Muscat, Tbilisi", + "+4.5" => "(GMT +4:30 hours) Kabul", + "+5" => "(GMT +5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent", + "+5.5" => "(GMT +5:30 hours) Bombay, Calcutta, Madras, New Delhi", + "+6" => "(GMT +6:00 hours) Almaty, Colombo, Dhaka", + "+7" => "(GMT +7:00 hours) Bangkok, Hanoi, Jakarta", + "+8" => "(GMT +8:00 hours) Beijing, Chongqing, Hong Kong, Perth, Singapore, Taipei", + "+9" => "(GMT +9:00 hours) Osaka, Sapporo, Seoul, Tokyo, Yakutsk", + "+9.5" => "(GMT +9:30 hours) Adelaide, Darwin", + "+10" => "(GMT +10:00 hours) Guam, Melbourne, Papua New Guinea, Sydney, Vladivostok", + "+11" => "(GMT +11:00 hours) Magadan, New Caledonia, Solomon Islands", + "+12" => "(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island"); + + while(list($offset, $zone) = each($tz_array)) + { + $selected = ($offset == $default) ? " selected" : ""; + $tz_select .= "\t<option value=\"$offset\"$selected>$zone</option>\n"; + } + $tz_select .= "</select>\n"; + + return($tz_select); +} + + ?>
\ No newline at end of file diff --git a/phpBB/profile.php b/phpBB/profile.php index c1f54201b3..a3ef9e2219 100644 --- a/phpBB/profile.php +++ b/phpBB/profile.php @@ -35,157 +35,6 @@ init_userprefs($userdata); // // -// Page specific functions -// - -function language_select($default, $dirname="language/") -{ - global $phpEx; - - $dir = opendir($dirname); - - $lang_select = "<select name=\"language\">\n"; - while ($file = readdir($dir)) - { - if (ereg("^lang_", $file)) - { - $filename = str_replace("lang_", "", $file); - $filename = str_replace(".$phpEx", "", $filename); - $displayname = preg_replace("/(.*)_(.*)/", "\\1 [ \\2 ]", $filename); - $selected = (strtolower($default) == strtolower($filename)) ? " selected" : ""; - $lang_select .= " <option value=\"$filename\"$selected>".ucwords($displayname)."</option>\n"; - } - } - $lang_select .= "</select>\n"; - - closedir($dir); - - return $lang_select; -} -// NOTE: This function should check is_dir($file), however the is_dir function seems to be buggy on my -// system so its not currently implemented that way -// - James -function template_select($default) -{ - $dir = opendir("templates"); - - $template_select = "<select name=\"template\">\n"; - while($file = readdir($dir)) - { - unset($selected); - - if($file != "." && $file != ".." && $file != "CVS") - { - if($file == $default) - { - $selected = " selected"; - } - $template_select .= "<option value=\"$file\"$selected>$file</option>\n"; - } - } - $template_select .= "</select>"; - - closedir($dir); - - return($template_select); -} -function theme_select($default) -{ - global $db, $board_config, $lang; - - $sql = "SELECT themes_id, themes_name - FROM " . THEMES_TABLE . " - WHERE themes_name LIKE '" . $board_config['default_template'] . "-%' - ORDER BY themes_name"; - if($result = $db->sql_query($sql)) - { - $num = $db->sql_numrows($result); - $rowset = $db->sql_fetchrowset($result); - - if($num) - { - $theme_select = "<select name=\"theme\">\n"; - for($i = 0; $i < $num; $i++) - { - if(stripslashes($rowset[$i]['themes_name']) == $default || $rowset[$i]['themes_id'] == $default) - { - $selected = " selected"; - } - else - { - $selected = ""; - } - $theme_select .= "\t<option value=\"" . $rowset[$i]['themes_id'] ."\"$selected>" . stripslashes($rowset[$i]['themes_name']) . "</option>\n"; - } - $theme_select .= "</select>\n"; - } - else - { - $theme_select = "<select name=\"theme\"><option value=\"-1\">" . $lang['No_themes'] . "</option></select>"; - } - } - else - { - message_die(GENERAL_ERROR, "Couldn't query themes table", "", __LINE__, __FILE__, $sql); - } - return($theme_select); -} -function tz_select($default) -{ - global $sys_timezone; - - if(!isset($default)) - { - $default == $sys_timezone; - } - $tz_select = "<select name=\"timezone\">"; - $tz_array = array( - "-12" => "(GMT -12:00 hours) Eniwetok, Kwajalein", - "-11" => "(GMT -11:00 hours) Midway Island, Samoa", - "-10" => "(GMT -10:00 hours) Hawaii", - "-9" => "(GMT -9:00 hours) Alaska", - "-8" => "(GMT -8:00 hours) Pacific Time (US & Canada)", - "-7" => "(GMT -7:00 hours) Mountain Time (US & Canada)", - "-6" => "(GMT -6:00 hours) Central Time (US & Canada), Mexico City", - "-5" => "(GMT -5:00 hours) Eastern Time (US & Canada), Bogota, Lima, Quito", - "-4" => "(GMT -4:00 hours) Atlantic Time (Canada), Caracas, La Paz", - "-3.5" => "(GMT -3:30 hours) Newfoundland", - "-3" => "(GMT -3:00 hours) Brazil, Buenos Aires, Georgetown", - "-2" => "(GMT -2:00 hours) Mid-Atlantic, Ascension Is., St. Helena, ", - "-1" => "(GMT -1:00 hours) Azores, Cape Verde Islands", - "0" => "(GMT) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia", - "+1" => "(GMT +1:00 hours) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome", - "+2" => "(GMT +2:00 hours) Kaliningrad, South Africa, Warsaw", - "+3" => "(GMT +3:00 hours) Baghdad, Riyadh, Moscow, Nairobi", - "+3.5" => "(GMT +3:30 hours) Tehran", - "+4" => "(GMT +4:00 hours) Abu Dhabi, Baku, Muscat, Tbilisi", - "+4.5" => "(GMT +4:30 hours) Kabul", - "+5" => "(GMT +5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent", - "+5.5" => "(GMT +5:30 hours) Bombay, Calcutta, Madras, New Delhi", - "+6" => "(GMT +6:00 hours) Almaty, Colombo, Dhaka", - "+7" => "(GMT +7:00 hours) Bangkok, Hanoi, Jakarta", - "+8" => "(GMT +8:00 hours) Beijing, Chongqing, Hong Kong, Perth, Singapore, Taipei", - "+9" => "(GMT +9:00 hours) Osaka, Sapporo, Seoul, Tokyo, Yakutsk", - "+9.5" => "(GMT +9:30 hours) Adelaide, Darwin", - "+10" => "(GMT +10:00 hours) Guam, Melbourne, Papua New Guinea, Sydney, Vladivostok", - "+11" => "(GMT +11:00 hours) Magadan, New Caledonia, Solomon Islands", - "+12" => "(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall Island"); - - while(list($offset, $zone) = each($tz_array)) - { - $selected = ($offset == $default) ? " selected" : ""; - $tz_select .= "\t<option value=\"$offset\"$selected>$zone</option>\n"; - } - $tz_select .= "</select>\n"; - - return($tz_select); -} - -// -// End of functions defns -// - -// // Start of program proper // if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) |