rendered paste body/** * This function will update or create a config entry based on whether or not it already exists * * @global $db The database object * @global $board_config The configuration entries * @param $config_key The key referring to the config entry * @param $config_val The new configuration value */if ( ! function_exists('config_set') ){ function config_set($config_key, $config_val = '') { global $db, $board_config; $config_key_escaped = str_replace("'", "''", $config_key); $config_val_escaped = str_replace("'", "''", $config_val); if ( !isset($board_config[$config_key]) ) { $sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value) VALUES ('{$config_key_escaped}', '{$config_key_escaped}')"; } else { $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = '{$config_val_escaped}' WHERE config_name = '{$config_key_escaped}'"; } if ( ! $result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'There was an error setting the config entry value.', '', __FILE__, __LINE__, $sql); } $board_config[$config_key] = $config_val; $db->sql_freeresult($result); return; }}