PUN_ADMIN)
message($lang_common['No permission']);
if (isset($_POST['form_sent']))
{
// Lazy referer check (in case base_url isn't correct)
if (!isset($_SERVER['HTTP_REFERER']) || !preg_match('#/admin_options\.php#i', $_SERVER['HTTP_REFERER']))
message($lang_common['Bad referrer']);
$form = array_map('trim', $_POST['form']);
if ($form['board_title'] == '')
message('Vous devez saisir un titre pour vos forums.');
require PUN_ROOT.'include/email.php';
$form['admin_email'] = strtolower($form['admin_email']);
if (!is_valid_email($form['admin_email']))
message('L\'adresse email administrateur que vous avez saisi est incorrecte.');
$form['webmaster_email'] = strtolower($form['webmaster_email']);
if (!is_valid_email($form['webmaster_email']))
message('L\'adresse email webmaster que vous avez saisi est incorrecte.');
if ($form['mailing_list'] != '')
$form['mailing_list'] = strtolower(preg_replace('/[\s]/', '', $form['mailing_list']));
// Make sure base_url doesn't end with a slash
if (substr($form['base_url'], -1) == '/')
$form['base_url'] = substr($form['base_url'], 0, -1);
// Make sure avatars_dir doesn't end with a slash
if (substr($form['avatars_dir'], -1) == '/')
$form['avatars_dir'] = substr($form['avatars_dir'], 0, -1);
if ($form['additional_navlinks'] != '')
$form['additional_navlinks'] = trim(pun_linebreaks($form['additional_navlinks']));
if ($form['announcement_message'] != '')
$form['announcement_message'] = pun_linebreaks($form['announcement_message']);
else
{
$form['announcement_message'] = 'Saisissez votre annonce ici.';
if ($form['announcement'] == '1')
$form['announcement'] = '0';
}
if ($form['rules_message'] != '')
$form['rules_message'] = pun_linebreaks($form['rules_message']);
else
{
$form['rules_message'] = 'Saisissez les règles d\'utilisation ici.';
if ($form['rules'] == '1')
$form['rules'] = '0';
}
if ($form['maintenance_message'] != '')
$form['maintenance_message'] = pun_linebreaks($form['maintenance_message']);
else
{
$form['maintenance_message'] = 'Les forums sont temporairement fermés pour des raisons de maintenance. Veuillez essayer à nouveau d\'ici quelques minutes.
\\n
\\n/Administrateur';
if ($form['maintenance'] == '1')
$form['maintenance'] = '0';
}
$form['timeout_visit'] = intval($form['timeout_visit']);
$form['timeout_online'] = intval($form['timeout_online']);
$form['redirect_delay'] = intval($form['redirect_delay']);
$form['topic_review'] = intval($form['topic_review']);
$form['disp_topics_default'] = intval($form['disp_topics_default']);
$form['disp_posts_default'] = intval($form['disp_posts_default']);
$form['indent_num_spaces'] = intval($form['indent_num_spaces']);
$form['avatars_width'] = intval($form['avatars_width']);
$form['avatars_height'] = intval($form['avatars_height']);
$form['avatars_size'] = intval($form['avatars_size']);
if ($form['timeout_online'] >= $form['timeout_visit'])
message('La valeur de "Temps mort en ligne" doit être inférieur à la valeur de "Temps mort de visite".');
while (list($key, $input) = @each($form))
{
// Only update values that have changed
if (array_key_exists('o_'.$key, $pun_config) && $pun_config['o_'.$key] != $input)
{
if ($input != '' || is_int($input))
$value = '\''.$db->escape($input).'\'';
else
$value = 'NULL';
$db->query('UPDATE '.$db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'o_'.$db->escape($key).'\'') or error('Impossible de mettre à jour la configuration des forums', __FILE__, __LINE__, $db->error());
}
}
// Regenerate the config cache
require_once PUN_ROOT.'include/cache.php';
generate_config_cache();
redirect('admin_options.php', 'Options modifiées. Redirection ...');
}
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Options';
$form_name = 'update_options';
require PUN_ROOT.'header.php';
generate_admin_menu('options');
?>