diff options
author | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-01-13 05:11:11 +0000 |
---|---|---|
committer | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-01-13 05:11:11 +0000 |
commit | ab928d8f5f2668da1354077a94e9326307ac3de4 (patch) | |
tree | e1125cc5ff12bda94d61641c3780cfb2f4fa68a3 /phpBB/includes/functions.php | |
parent | 9f4cb905d3053c6b564b1578dfac0795327a5ecf (diff) | |
download | forums-ab928d8f5f2668da1354077a94e9326307ac3de4.tar forums-ab928d8f5f2668da1354077a94e9326307ac3de4.tar.gz forums-ab928d8f5f2668da1354077a94e9326307ac3de4.tar.bz2 forums-ab928d8f5f2668da1354077a94e9326307ac3de4.tar.xz forums-ab928d8f5f2668da1354077a94e9326307ac3de4.zip |
Minor fixes
git-svn-id: file:///svn/phpbb/trunk@3316 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8689ca7b2a..aa1af28270 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -32,13 +32,26 @@ function sql_quote($msg) function set_config($config_name, $config_value) { global $db, $cache, $config; + + if (isset($config[$config_name])) + { + $sql = 'UPDATE ' . CONFIG_TABLE . " + SET config_value = '" . sql_escape($config_value) . "' + WHERE config_name = '$config_name'"; + $db->sql_query($sql); + } + else + { + $db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE config_name = "' . $config_name . '"'); + + $sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value) + VALUES ('$config_name', '" . sql_escape($config_value) . "'"; + $db->sql_query($sql); + } + $config[$config_name] = $config_value; $cache->save('config', $config); - $sql = 'UPDATE ' . CONFIG_TABLE . " - SET config_value = '" . sql_escape($config_value) . "' - WHERE config_name = '$config_name'"; - $db->sql_query($sql); } function get_userdata($user) @@ -689,18 +702,22 @@ function obtain_word_list(&$orig_word, &$replacement_word) // Redirects the user to another page then exits the script nicely function redirect($url) { - global $db, $config; + global $db, $cache, $config; if (isset($db)) { $db->sql_close(); } + if (isset($cache)) + { + $cache->save_cache(); + } $server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://'; $server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['server_name'])); $server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/'; $script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['script_path'])); - $url = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($url)); + $url = (($script_name == '') ? '' : '/') . preg_replace('/^\/?(.*?)\/?$/', '\1', trim($url)); // Redirect via an HTML form for PITA webservers if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) |