From c0ac873a086d0d118fde15fbf5a13fed7c64af24 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 9 Sep 2001 23:22:29 +0000 Subject: Combined theme/templates in profile as suggested, added META refresh and made a couple of other changes git-svn-id: file:///svn/phpbb/trunk@1018 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 187 ++++++++++++++----------------------------- 1 file changed, 62 insertions(+), 125 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 40b7756daa..ecc1727452 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -270,7 +270,7 @@ function init_userprefs($userdata) $template = new Template($phpbb_root_path . "templates/" . $board_config['board_template']); - if($template) + if( $template ) { @include($phpbb_root_path . "templates/" . $board_config['board_template'] . "/" . $board_config['board_template'] . ".cfg"); @@ -454,51 +454,6 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add } -// -// Check to see if email address is banned -// or already present in the DB -// -function validate_email($email) -{ - global $db; - - if($email != "") - { - $sql = "SELECT ban_email - FROM " . BANLIST_TABLE; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Couldn't obtain email ban information.", "", __LINE__, __FILE__, $sql); - } - $ban_email_list = $db->sql_fetchrowset($result); - for($i = 0; $i < count($ban_email_list); $i++) - { - $match_email = str_replace("*@", ".*@", $ban_email_list[$i]['ban_email']); - if( preg_match("/^" . $match_email . "$/is", $email) ) - { - return(0); - } - } - $sql = "SELECT user_email - FROM " . USERS_TABLE . " - WHERE user_email = '" . $email . "'"; - if(!$result = $db->sql_query($sql)) - { - message_die(GENERAL_ERROR, "Couldn't obtain user email information.", "", __LINE__, __FILE__, $sql); - } - $email_taken = $db->sql_fetchrow($result); - if($email_taken['user_email'] != "") - { - return(0); - } - - return(1); - } - else - { - return(0); - } -} // // Check to see if the username has been taken, or if it is disallowed. @@ -565,6 +520,9 @@ function validate_username($username) } +// +// Synchronise functions for forums/topics +// function sync($type, $id) { global $db; @@ -713,13 +671,17 @@ function sync($type, $id) } -function language_select($default, $select_name, $dirname="language/") + +// +// Pick a language, any language ... +// +function language_select($default, $select_name = "language", $dirname="language/") { global $phpEx; $dir = opendir($dirname); - $lang_select = ""; while ($file = readdir($dir)) { if (ereg("^lang_", $file)) @@ -728,86 +690,65 @@ function language_select($default, $select_name, $dirname="language/") $filename = str_replace(".$phpEx", "", $filename); $displayname = preg_replace("/(.*)_(.*)/", "\\1 [ \\2 ]", $filename); $selected = (strtolower($default) == strtolower($filename)) ? " selected=\"selected\"" : ""; - $lang_select .= " \n"; + $lang_select .= ""; } } - $lang_select .= "\n"; + $lang_select .= ""; 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, $select_name = 'template', $dirname = "templates") + +// +// Pick a template/theme combo, personally recommend +// PSO - Blue but then I would ... +// +function style_select($default_template, $default_theme, $select_name = "style", $dirname = "templates") { - $dir = opendir($dirname); + global $db; - $template_select = ""; + while( $file = readdir($dir) ) + { + if( $file != "." && $file != ".." && $file != "CVS" ) { - if($file == $default) + for($i = 0; $i < count($template_themes[$file]['id']); $i++) { - $selected = " selected=\"selected\""; + $selected = ( $file == $default_template && $template_themes[$file]['id'][$i] == $default_theme ) ? " selected=\"selected\"" : ""; + + $style_select .= ""; } - $template_select .= "\n"; } } - $template_select .= ""; + $style_select .= ""; closedir($dir); - return($template_select); + return($style_select); } -function theme_select($default, $select_name = 'theme') -{ - global $db, $board_config, $lang; - - $sql = "SELECT themes_id, themes_name - FROM " . THEMES_TABLE . " - WHERE themes_name LIKE '" . $board_config['board_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 = "\n"; - } - else - { - $theme_select = ""; - } - } - else - { - message_die(GENERAL_ERROR, "Couldn't query themes table", "", __LINE__, __FILE__, $sql); - } - return($theme_select); -} +// +// Pick a timezone +// function tz_select($default, $select_name = 'timezone') { global $sys_timezone; @@ -827,47 +768,43 @@ function tz_select($default, $select_name = 'timezone') "-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.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", + "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", + "+3.5" => "(GMT +3:30 hours) Tehran", "+4" => "(GMT +4:00 hours) Abu Dhabi, Baku, Muscat, Tbilisi", - "+4.5" => "(GMT +4:30 hours) Kabul", + "+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", + "+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, Hong Kong, Perth, Singapore, Taipei", "+9" => "(GMT +9:00 hours) Osaka, Sapporo, Seoul, Tokyo, Yakutsk", - "+9.5" => "(GMT +9:30 hours) Adelaide, Darwin", + "+9.5" => "(GMT +9:30 hours) Adelaide, Darwin", "+10" => "(GMT +10:00 hours) Melbourne, Papua New Guinea, Sydney, Vladivostok", "+11" => "(GMT +11:00 hours) Magadan, New Caledonia, Solomon Islands", "+12" => "(GMT +12:00 hours) Auckland, Wellington, Fiji, Marshall Island"); - while(list($offset, $zone) = each($tz_array)) + while( list($offset, $zone) = each($tz_array) ) { $selected = ($offset == $default) ? " selected=\"selected\"" : ""; - $tz_select .= "\t\n"; + $tz_select .= "\t"; } - $tz_select .= "\n"; + $tz_select .= ""; return($tz_select); } + // -// Smilies code ... would this be better tagged -// on to the end of bbcode.php? -// +// Smilies code ... would this be better tagged on to the end of bbcode.php? // Probably so and I'll move it before B2 -// The_Systech // - - function smilies_pass($message) { global $db, $board_config; @@ -905,11 +842,11 @@ function smiley_sort($a, $b) return (strlen($a['code']) > strlen($b['code'])) ? -1 : 1; } + // -// Obtain list of naughty words and build preg style -// replacement arrays for use by the calling script, -// note that the vars are passed as references this just makes -// it easier to return both sets of arrays +// Obtain list of naughty words and build preg style replacement arrays for use by the +// calling script, note that the vars are passed as references this just makes it easier +// to return both sets of arrays // function obtain_word_list(&$orig_word, &$replacement_word) { @@ -943,4 +880,4 @@ function obtain_word_list(&$orig_word, &$replacement_word) return(TRUE); } -?> +?> \ No newline at end of file -- cgit v1.2.1