$author = new XoopsUser($poll->getVar("user_id")); $xoopsMailer->setToUsers($author); $xoopsMailer->assign("POLL_QUESTION", $poll->getVar("question")); $xoopsMailer->assign("POLL_START", formatTimestamp($poll->getVar("start_time"), "l", $author->timezone())); $xoopsMailer->assign("POLL_END", formatTimestamp($poll->getVar("end_time"), "l", $author->timezone())); $xoopsMailer->assign("POLL_VOTES", $poll->getVar("votes")); $xoopsMailer->assign("POLL_VOTERS", $poll->getVar("voters")); $xoopsMailer->assign("POLL_ID", $poll->getVar("poll_id")); $xoopsMailer->assign("SITENAME", $xoopsConfig['sitename']); $xoopsMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']); $xoopsMailer->assign("SITEURL", $xoopsConfig['xoops_url'] . "/"); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(sprintf(_PL_YOURPOLLAT, $author->uname(), $xoopsConfig['sitename'])); if ($xoopsMailer->send() != false) { $poll->setVar("mail_status", POLL_MAILED); $poll->store(); } } } if ($url != null) { redirect_header($url, 1, $msg); } else { redirect_header(XOOPS_URL . "/modules/xoopspoll/pollresults.php?poll_id={$poll_id}", 1, $msg); } exit; } elseif (!empty($poll_id)) { $xoopsOption['template_main'] = 'xoopspoll_view.html'; include XOOPS_ROOT_PATH . "/header.php"; $poll = new XoopsPoll($poll_id); $renderer = new XoopsPollRenderer($poll);
$poll_id_hidden = new XoopsFormHidden("poll_id", $poll->getVar("poll_id")); $poll_form->addElement($poll_id_hidden); $submit_button = new XoopsFormButton("", "poll_submit", _MD_POLL_RESTART, "submit"); $poll_form->addElement($submit_button); //include XOOPS_ROOT_PATH."/header.php"; echo "<h4>" . _MD_POLL_POLLCONF . "</h4>"; $poll_form->display(); //include XOOPS_ROOT_PATH."/footer.php"; //exit(); } if ($op == "restart_ok") { $poll = new XoopsPoll($poll_id); $end_time = empty($_POST['end_time']) ? "" : $_POST['end_time']; if (!empty($end_time)) { $timezone = is_object($xoopsUser) ? $xoopsUser->timezone() : null; $poll->setVar("end_time", userTimeToServerTime(strtotime($end_time), $timezone)); } else { $poll->setVar("end_time", time() + 86400 * 10); } if (!empty($_POST["notify"]) && $end_time > time()) { // if notify, set mail status to "not mailed" $poll->setVar("mail_status", POLL_NOTMAILED); } else { // if not notify, set mail status to already "mailed" $poll->setVar("mail_status", POLL_MAILED); } if (!empty($_POST["reset"])) { // reset all logs XoopsPollLog::deleteByPollId($poll->getVar("poll_id")); XoopsPollOption::resetCountByPollId($poll->getVar("poll_id")); }
xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php",1,_AM_DBUPDATED); exit(); } if ( $op == "log" ) { xoops_cp_header(); echo "<h4>"._AM_POLLCONF."</h4>"; echo "<br>View Log<br> Sorry, not yet. ;-)"; xoops_cp_footer(); exit(); } if ( $op == "quickupdate" ) { $count = count($poll_id); for ( $i = 0; $i < $count; $i++ ) { $display[$i] = empty($display[$i]) ? 0 : 1; $weight[$i] = empty($weight[$i]) ? 0 : $weight[$i]; if ( $display[$i] != $old_display[$i] || $weight[$i] != $old_weight[$i] ) { $poll = new XoopsPoll($poll_id[$i]); $poll->setVar("display", $display[$i]); $poll->setVar("weight", intval($weight[$i])); $poll->store(); } } include_once XOOPS_ROOT_PATH.'/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php",1,_AM_DBUPDATED); exit(); } ?>
} $poll->updateCount(); include_once XOOPS_ROOT_PATH . '/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php", 1, _AM_DBUPDATED); exit; } if ($op == "log") { xoops_cp_header(); echo "<h4>" . _AM_POLLCONF . "</h4>"; echo "<br />View Log<br /> Sorry, not yet. ;-)"; xoops_cp_footer(); exit; } if ($op == "quickupdate") { $count = count($_POST['poll_id']); for ($i = 0; $i < $count; $i++) { $display[$i] = empty($_POST['display'][$i]) ? 0 : 1; $weight[$i] = empty($_POST['weight'][$i]) ? 0 : intval($_POST['weight'][$i]); if ($display[$i] != $_POST['old_display'][$i] || $weight[$i] != $_POST['old_weight'][$i]) { $poll = new XoopsPoll($_POST['poll_id'][$i]); $poll->setVar("display", $display[$i]); $poll->setVar("weight", $weight[$i]); $poll->store(); } } include_once XOOPS_ROOT_PATH . '/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php", 1, _AM_DBUPDATED); exit; }