1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
|
$filename = 'pollstart.php';
require('./global.php');
$lang->load('POLL');
if (isset($_REQUEST['idhash'])) {
$idhash = wbb_trim($_REQUEST['idhash']);
}
else {
$idhash = '';
}
if (!checkpermissions('can_post_poll') || !$idhash) {
eval("\$tpl->output(\"".$tpl->get("window_close")."\");");
exit();
}
// check if
list ($pollid) = $db->query_first("SELECT pollid FROM bb".$n."_polls WHERE idhash = '".addslashes($idhash)."'");
if ($pollid) {
header("Location: polledit.php?pollid=$pollid&boardid=$boardid&idhash=$idhash$SID_ARG_2ND_UN");
exit;
}
if (isset($_POST['send'])) {
$question = wbb_trim($_POST['question']);
$db->query("INSERT INTO bb".$n."_polls (question,starttime,choicecount,timeout,idhash) VALUES ('".addslashes($question)."','".time()."','".intval($_POST['choicecount'])."','".intval($_POST['timeout'])."','".addslashes($idhash)."')");
$pollid = $db->insert_id();
$options = explode("\n", $_POST['polloptions']);
$count = 1;
for ($i = 0; $i < count($options); $i++) {
$options[$i] = wbb_trim($options[$i]);
if (!$options[$i]) continue;
$db->query("INSERT INTO bb".$n."_polloptions (pollid,polloption,showorder) VALUES ('$pollid','".addslashes($options[$i])."','$count')");
$count++;
}
$question = str_replace("'", "\'", $question);
eval("\$tpl->output(\"".$tpl->get("pollstart_give_parent")."\");");
exit();
}
else {
$choicecount = 1;
$timeout = 0;
$question = '';
}
$idhash = htmlconverter($idhash);
eval("\$tpl->output(\"".$tpl->get("pollstart")."\");");
?> |