} if ( !$poll->store() ) { echo $poll->getHtmlErrors(); exit(); } $i = 0; foreach ( $option_id as $opid ) { $option = new XoopsPollOption($opid); $option_text[$i] = trim ($option_text[$i]); if ( $option_text[$i] != "" ) { $option->setVar("option_text", $option_text[$i]); $option->setVar("option_color", $option_color[$i]); $option->store(); } else { if ( $option->delete() != false ) { XoopsPollLog::deleteByOptionId($option->getVar("option_id")); } } $i++; } $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 == "addmore" ) { $poll = new XoopsPoll($_GET['poll_id']); $poll_form = new XoopsThemeForm(_AM_ADDMORE, "poll_form", "index.php", 'post', true); $question_label = new XoopsFormLabel(_AM_POLLQUESTION, $poll->getVar("question"));
function vote($option_id, $ip, $user_id = null) { if (!empty($option_id)) { if (is_array($option_id)) { foreach ($option_id as $vote) { $option = new XoopsPollOption($vote); if ($this->getVar("poll_id") == $option->getVar("poll_id")) { $log = new XoopsPollLog(); $log->setVar("poll_id", $this->getVar("poll_id")); $log->setVar("option_id", $vote); $log->setVar("ip", $ip); if (isset($user_id)) { $log->setVar("user_id", $user_id); } if (!$log->store()) { } else { $option->updateCount(); } } } } else { $option = new XoopsPollOption($option_id); if ($this->getVar("poll_id") == $option->getVar("poll_id")) { $log = new XoopsPollLog(); $log->setVar("poll_id", $this->getVar("poll_id")); $log->setVar("option_id", $option_id); $log->setVar("ip", $ip); if (isset($user_id)) { $log->setVar("user_id", $user_id); } $log->store(); $option->updateCount(); } } return true; } return false; }
echo "<a href='" . $sorthref . "ip&orderdir=ASC'><img src=" . $arrow_up . "></a>"; echo "<a href='" . $sorthref . "ip&orderdir=DESC'><img src=" . $arrow_down . "></a> " . _AM_IP . "</td>"; echo "<td nowrap>"; echo "<a href='" . $sorthref . "user_id&orderdir=ASC'><img src=" . $arrow_up . "></a>"; echo "<a href='" . $sorthref . "user_id&orderdir=DESC'><img src=" . $arrow_down . "></a> " . _AM_VOTER . "</td>"; echo "<td nowrap>"; echo "<a href='" . $sorthref . "time&orderdir=ASC'><img src=" . $arrow_up . "></a>"; echo "<a href='" . $sorthref . "time&orderdir=DESC'><img src=" . $arrow_down . "></a> " . _AM_VOTETIME . "</td>"; // echo "<td nowrap> </td>"; echo "</tr>"; $max = $logs_count > $limit ? $limit : $logs_count; for ($i = 0; $i < $max; $i++) { $option = new XoopsPollOption($logs_arr[$i]->getVar("option_id")); echo "<tr class='bg1'>"; echo "<td align='center'>" . $logs_arr[$i]->getVar("log_id") . "</td>"; echo "<td>" . $option->getVar('option_text') . "</td>"; if ($xoopsModuleConfig['lookuphost'] == 1) { $remote_ip = gethostbyaddr_with_cache($logs_arr[$i]->getVar("ip")); } else { $remote_ip = $logs_arr[$i]->getVar("ip"); } echo "<td align='center'>" . $remote_ip . "</td>"; if ($logs_arr[$i]->getVar("user_id") != 0) { $user = new XoopsUser($logs_arr[$i]->getVar("user_id")); $uname = $user->getVar('uname'); echo "<td align='center'><a href=" . XOOPS_URL . "/userinfo.php?uid=" . $user->getVar("uid") . ">" . $uname . "</a></td>"; } else { $uname = $xoopsConfig['anonymous']; echo "<td align='center'>" . $uname . "</td>"; } echo "<td>" . formatTimeStamp($logs_arr[$i]->getVar("time"), "l") . "</td>";