'.__('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('

'.__('Error(s)').'

'); } } if (!empty($_GET['done'])) buffer::str('

'.__('Saved').'

'); if (file_exists($file)) $questions = parse_ini_file($file, true); if (empty($questions)) $questions = array(array('', ''), array('', '')); buffer::str('

'.__('This plugin functions as an easy antispam tool. You can enter questions and answers here. '. 'One a of those will be randomly asked to the user when he wants to comment on an article. '. 'If the answer is wrong, the user can\'t add a comment. Answers are case insensitive.').'

'.__('Fill-in those questions and answers').' '); foreach ($questions as $k=>$q) { buffer::str(''); buffer::str(''); } buffer::str('
'.($k+1).'.'.__('Question :').''. form::field('questions['.$k.'][0]',60,'', htmlspecialchars($q[0])) . '
'.__('Answer :').''. form::field('questions['.$k.'][1]',40,'', htmlspecialchars($q[1])) . '

'. dcNonce::form(). '

'); } ?>