'.__('Comments Antispam').'');
$file = DC_BASE_DIR . '/conf/questions.ini';
$url = 'tools.php?p=antispam';
if (!defined('dc_use_custom_questions') || !dc_use_custom_questions)
{
$err = __("You have to enable 'Use custom antispam questions' in the blog configuration to edit this page.");
buffer::str('
'.__('Error(s)').' :
'.$err.'
');
}
elseif (file_exists($file) && !is_writable($file))
{
$err = ''.sprintf(__('Config file %s, is not writable.'),'conf/questions.ini').'
';
buffer::str(''.__('Error(s)').' :
'.$err.'
');
}
else
{
if (!empty($_POST['save']))
{
$ini = '';
$i = 0;
foreach ($_POST['questions'] as $q)
{
if (empty($q[0]))
{
continue;
}
$ini .= '[' . (int)$i . "]\n";
$ini .= '0 = "' . $q[0] . "\"\n";
$ini .= '1 = "' . $q[1] . "\"\n\n";
$i++;
}
$fp = @fopen($file, 'w');
if ($fp)
{
fputs($fp, $ini);
fclose($fp);
header('Location: '.$url.'&done=1');
exit;
}
else
{
buffer::str('');
}
}
if (!empty($_GET['done']))
buffer::str('');
if (file_exists($file))
$questions = parse_ini_file($file, true);
if (empty($questions))
$questions = array(array('', ''), array('', ''));
buffer::str('');
}
?>