Exemplo n.º 1
0
     }
     $i = 0;
     echo $tpl->parse("menu");
     echo $tpl->parse("admin/topic/vote_edit");
 } elseif ($action == "vote_edit2") {
     $error = array();
     if (strxlen($_POST['question']) > $config['maxtitlelength']) {
         $error[] = $lang->phrase('question_too_long');
     }
     if (strxlen($_POST['question']) < $config['mintitlelength']) {
         $error[] = $lang->phrase('question_too_short');
     }
     if (count_filled($_POST['notice']) < 2) {
         $error[] = $lang->phrase('min_replies_vote');
     }
     if (count_filled($_POST['notice']) > 50) {
         $error[] = $lang->phrase('max_replies_vote');
     }
     if (count($error) > 0) {
         $data = array('question' => $_POST['question'], 'answer' => $_POST['notice']);
         $fid = save_error_data($data);
         error($error, 'managetopic.php?action=vote_edit&amp;id=' . $_GET['id'] . "&amp;fid=" . $fid . SID2URL_x);
     } else {
         $db->query("UPDATE {$db->pre}topics SET vquestion = '{$_POST['question']}' WHERE id = '{$_GET['id']}' LIMIT 1", __LINE__, __FILE__);
         $result = $db->query("SELECT id, answer FROM {$db->pre}vote WHERE tid = '{$info['id']}' ORDER BY id", __LINE__, __FILE__);
         while ($row = $db->fetch_assoc($result)) {
             if (strlen($_POST['notice'][$row['id']]) > 0 && strlen($_POST['notice'][$row['id']]) < 255) {
                 $db->query("UPDATE {$db->pre}vote SET answer = '{$_POST['notice'][$row['id']]}' WHERE id = '{$row['id']}'", __LINE__, __FILE__);
             }
         }
         if (strlen($_POST['notice'][0]) > 0 && strlen($_POST['notice'][0]) < 255) {
Exemplo n.º 2
0
	}
	if (strxlen($_POST['question']) < $config['mintitlelength']) {
		$error[] = $lang->phrase('question_too_short');
	}
	$notices = $gpc->get('notice', arr_str);
	foreach ($notices as $id => $uval) {
		$uval = trim($uval);
		if (strlen($uval) >= 255) {
			$error[] = $lang->phrase('vote_reply_too_long');
		}
		$notices[$id] = $uval;
	}
	if (count_filled($notices) < 2) {
		$error[] = $lang->phrase('min_replies_vote');
	}
	if (count_filled($notices) > 50) {
		$error[] = $lang->phrase('max_replies_vote');
	}
	if (count($error) > 0) {
		$data = array(
			'question' => $_POST['question'],
			'answer' => $notices
		);
		$fid = save_error_data($data);
		error($error,'managetopic.php?action=vote_edit&amp;id='.$_GET['id'].'&amp;fid='.$fid.SID2URL_x);
	}
	else {
		$db->query("UPDATE {$db->pre}topics SET vquestion = '{$_POST['question']}' WHERE id = '{$_GET['id']}' LIMIT 1");
		$result = $db->query("SELECT id, answer FROM {$db->pre}vote WHERE tid = '{$info['id']}' ORDER BY id");
		while($row = $db->fetch_assoc($result)) {
			if ($notices[$row['id']] != $row['answer']) {