} if (!empty($pid)) { $questions_sql = "SELECT question,qid FROM {$_TABLES['pollquestions']} " . "WHERE pid='{$pid}' ORDER BY qid"; $questions = DB_query($questions_sql); $nquestions = DB_numRows($questions); } if (empty($pid)) { if ($msg > 0) { $display .= COM_showMessage($msg, 'polls'); } $display .= polllist(); $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_POLLS['pollstitle'])); } else { if (isset($_POST['aid']) && count($_POST['aid']) == $nquestions && !isset($_COOKIE['poll-' . $pid])) { setcookie('poll-' . $pid, implode('-', $aid), time() + $_PO_CONF['pollcookietime'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']); $display .= POLLS_pollsave($pid, $aid); $display = COM_createHTMLDocument($display); } elseif (!empty($pid)) { $result = DB_query("SELECT topic, meta_description, meta_keywords FROM {$_TABLES['polltopics']} WHERE pid = '{$pid}'" . COM_getPermSQL('AND')); $A = DB_fetchArray($result); $polltopic = $A['topic']; if (empty($polltopic)) { // poll doesn't exist or user doesn't have access COM_handle404($_CONF['site_url'] . '/polls/index.php'); } else { // Meta Tags $headercode = ''; if ($_PO_CONF['meta_tags'] > 0) { $headercode = LB . PLG_getMetaTags('poll', $pid, array(array('name' => 'description', 'content' => stripslashes($A['meta_description'])), array('name' => 'keywords', 'content' => stripslashes($A['meta_keywords'])))); } if ($msg > 0) {
} if (!empty($pid)) { $questions_sql = "SELECT question,qid FROM {$_TABLES['pollquestions']} " . "WHERE pid='{$pid}' ORDER BY qid"; $questions = DB_query($questions_sql); $nquestions = DB_numRows($questions); } if (empty($pid)) { $display .= COM_siteHeader('menu', $LANG_POLLS['pollstitle']); if ($msg > 0) { $display .= COM_showMessage($msg, 'polls'); } $display .= polllist(); } else { if (isset($_POST['aid']) && count($_POST['aid']) == $nquestions && !isset($_COOKIE['poll-' . $pid])) { setcookie('poll-' . $pid, implode('-', $aid), time() + $_PO_CONF['pollcookietime'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']); $display .= COM_siteHeader() . POLLS_pollsave($pid, $aid); } elseif (!empty($pid)) { $topic = DB_getItem($_TABLES['polltopics'], 'topic', "pid = '{$pid}'" . COM_getPermSQL('AND')); if (empty($topic)) { // poll doesn't exist or user doesn't have access $display .= COM_siteHeader('menu', $LANG_POLLS['pollstitle']) . COM_showMessageText(sprintf($LANG25[12], $pid)); } else { $display .= COM_siteHeader('menu', $topic); if ($msg > 0) { $display .= COM_showMessage($msg, 'polls'); } if (isset($_POST['aid'])) { $display .= COM_startBlock($LANG_POLLS['not_saved'], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG_POLLS['answer_all'] . ' "' . $topic . '"' . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); } if (DB_getItem($_TABLES['polltopics'], 'is_open', "pid = '{$pid}'") != 1) { $aid = -1;