public function initializeModule($request_method, $request_data) { if (empty(PA::$login_uid)) { return 'skip'; } if (!empty($request_data['type'])) { $this->mode = htmlspecialchars($request_data['type']); } if (!empty($request_data['action']) && $request_data['action'] == "delete") { $obj = new poll(); $p_id = $request_data['id']; $c_id = $request_data['cid']; $obj->delete_poll($p_id, $c_id); $this->message = __('Poll has been deleted successfully.'); $this->queryString = '?page_id=' . PAGE_POLL . '&type=select'; if ($this->gid != 0) { $this->redirect2 = PA::$url . "/group_poll.php?gid=" . $this->gid . "&type=select"; $this->queryString .= "&gid=" . $this->gid; } else { $this->redirect2 = PA::$url . "/" . FILE_DYNAMIC; } $this->isError = FALSE; $this->setWebPageMessage(); } }
public function show_active_poll() { $poll = new poll($this->db, $this->output); if ($_SERVER["REQUEST_METHOD"] == "POST") { $poll->vote($_POST["vote"]); } $poll->to_output(); }
public function execute() { $this->output->title = "Poll demo"; $poll = new poll($this->db, $this->output); if ($_SERVER["REQUEST_METHOD"] == "POST") { $poll->vote($_POST["vote"]); } $poll->to_output(); }
function approve($id) { if ($_POST) { $poll = new poll($id); $poll->from_array($_POST); $poll->save(); $poll->clear(); $poll->where('id <>', $id)->get(); $poll->update_all('active', 0); } }
<?php require '../includes/config.php'; require '../structure/database.php'; require '../structure/base.php'; require '../structure/user.php'; require '../structure/poll.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $base = new base($database); $user = new user($database); $poll = new poll($database); $user->updateLastActive(); $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); $id = $_GET['id']; if (!$poll->pollExists($id)) { $base->redirect('index.php'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns:IE> <head> <meta http-equiv="Expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <meta name="MSSmartTagsPreventParsing" content="TRUE"> <title><?php echo $data['wb_title']; ?> </title> <link href="../css/main.css" rel="stylesheet" type="text/css" media="all">
/** * 好产品详细页 * @author song * @param int $rel_id 活动产品id * * @return * */ public function actionDetail() { $rel_id = Yii::$app->request->get('rel_id'); $rel_id = intval($rel_id); if ($rel_id > 0) { //查询活动产品详细 $mActivityProduct = new ActivityProduct(); $actproduct = $mActivityProduct->getDetailBypk($rel_id); if (!$actproduct && $actproduct['status'] != 3) { Yii::$app->util->msg('审核未通过,请联系管理员!'); exit; } //查询活动产品属性 $mapattrval = new ActivityProductAttrVal(); $attrval = $mapattrval->getRealAttrVals($rel_id, ActivityBase::GOOD_PRODUCT); //投票信息 $city = isset($attrval['division']['val']) ? $attrval['division']['val'] : ''; $poll_type_id = PollType::GOODPRODUCT_TYPE; $mpoll = new poll(); $pollone = $mpoll->getPollByCity($city, $poll_type_id); //投票项信息 $moption = new polloption(); $optione = $moption->getOptionByowner($pollone['poll_id'], $rel_id); //var_dump($optione); //exit; //增加页面访问量 $ActivityProductStat_model = new ActivityProductStat(); $ActivityProductStat_model->incr($rel_id, 'page_views'); //产品类型 $IProductType = new IProductType(); $Ptype = $IProductType->product_type_list(); $Ptype = ArrayHelper::map($Ptype, 'id', 'name'); $Ptype[6] = ""; //页面当name为『其他』时,不然显示 // print_r($Ptype);exit; // echo '<pre>'; // print_r($actproduct); // print_r($attrval); // exit; //数据过滤 if (isset($attrval['pokedex']['val']) && is_array($attrval['pokedex']['val'])) { $tmp = []; foreach ($attrval['pokedex']['val'] as $v) { if (!empty($v['title']) && !empty($v['desc']) && !empty($v['url'])) { $tmp[] = $v; } } $attrval['pokedex']['val'] = $tmp; } $this->layout = false; return $this->render('detail', ['attrval' => $attrval, 'product' => $actproduct, 'optione' => $optione, 'type' => $Ptype, 'goodproduct_city' => ActivityBase::GOODPRODUCT_CITY]); } }
<?php defined('DT_ADMIN') or exit('Access Denied'); $TYPE = get_type('poll', 1); require MD_ROOT . '/poll.class.php'; $do = new poll(); $menus = array(array('添加票选', '?moduleid=' . $moduleid . '&file=' . $file . '&action=add'), array('票选列表', '?moduleid=' . $moduleid . '&file=' . $file), array('更新地址', '?moduleid=' . $moduleid . '&file=' . $file . '&action=html'), array('票选分类', 'javascript:Dwidget(\'?file=type&item=' . $file . '\', \'票选分类\');'), array('模块首页', $EXT[$file . '_url'], ' target="_blank"'), array('模块设置', '?moduleid=' . $moduleid . '&file=setting#' . $file)); if ($_catids || $_areaids) { require DT_ROOT . '/admin/admin_check.inc.php'; } switch ($action) { case 'add': if ($submit) { if ($do->pass($post)) { $do->add($post); dmsg('添加成功', $forward); } else { msg($do->errmsg); } } else { foreach ($do->fields as $v) { isset(${$v}) or ${$v} = ''; } $poll_max = 0; $poll_page = 30; $poll_cols = 3; $poll_order = 0; $thumb_width = 120; $thumb_height = 90; $addtime = timetodate($DT_TIME); $typeid = 0;
public function indexAction() { $this->view->poll = poll::find(); }
<?php /*************************/ /* Galore */ /* poll.php */ /* Dummy poll php page */ /*************************/ require "config.php"; include $init->pathObjects . "/poll.php"; $object = new poll(); echo $object->init();
*/ if (!defined('e107_INIT')) { exit; } global $e107; if (defined("POLLRENDERED")) { // return; } if (!e107::isInstalled('poll')) { e107::redirect(); } if (!defined("POLLCLASS")) { require e_PLUGIN . "poll/poll_class.php"; } if (!isset($poll) || !is_object($poll)) { $poll = new poll(); } if (!defined("POLL_1")) { /* if menu is being called from comments, lan files have to be included manually ... */ include_lan(e_PLUGIN . "poll/languages/" . e_LANGUAGE . ".php"); } if (empty($poll_to_show)) { $poll_to_show = ' AND p.`poll_vote_userclass`!=255'; $pollType = 'menu'; $pollMode = 'query'; } else { $poll_to_show = ' AND p.`poll_id`=' . $poll_to_show; $pollType = 'menu'; $pollMode = 'results'; } $query = "SELECT p.*, u.user_name FROM #polls AS p \nLEFT JOIN #user AS u ON p.poll_admin_id = u.user_id\nWHERE p.poll_type=1{$poll_to_show}\nORDER BY p.poll_datestamp DESC LIMIT 0,1\n";
$polls[$i]["duration"] = $duration; $polls[$i]["pollertitle"] = "<a href=\"index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=poller&id=" . $inf["ID"] . "\">" . $inf["pollerTitle"] . "</a>"; $polls[$i]["starter"] = "<a href=\"index.php?page=userdetails&id=" . $inf["starterID"] . "\">" . StripSlashes($inf["prefixcolor"] . $inf["username"] . $inf["suffixcolor"]) . "</a>"; $polls[$i]["active"] = $active; $polls[$i]["vote"] = $vote; $i++; } $admintpl->set("show_poller", false, true); $admintpl->set("new_poll", false, true); $admintpl->set("polls", $polls); } /*** * Show a new poll or edit a poll ***/ if (isset($_POST['new']) || !empty($id)) { $pollObj = new poll(); $pollObj->table_prefix = $TABLE_PREFIX; if (!empty($id)) { $pollObj->getDataById($id); $pollerOptions = $pollObj->getOptionsAsArray(); $votes = $pollObj->getVotesAsArray(); $title = "" . $pollObj->pollerTitle . ""; if ($pollObj->active == "yes") { $check1 = "checked=\"checked\""; } else { $check1 = ""; } if ($pollObj->active == "no") { $check2 = "checked=\"checked\""; } else { $check2 = "";
} if (!defined("USER_WIDTH")) { define("USER_WIDTH", "width:95%"); } // the user box and subject box are not always displayed, therefore we need to define them /in case/ they are, if not they'll be ignored. if (!isset($userbox)) { $userbox = "<tr>\n<td class='forumheader2' style='width:20%'>" . LAN_61 . "</td>\n<td class='forumheader2' style='width:80%'>\n<input class='tbox' type='text' name='anonname' size='71' value='" . $anonname . "' maxlength='20' />\n</td>\n</tr>"; } if (!isset($subjectbox)) { $subjectbox = "<tr>\n<td class='forumheader2' style='width:20%'>" . LAN_62 . "</td>\n<td class='forumheader2' style='width:80%'>\n<input class='tbox' type='text' name='subject' size='71' value='" . $subject . "' maxlength='100' />\n</td>\n</tr>"; } // the poll is optional, be careful when changing the values here, only change if you know what you're doing ... if (!isset($poll_form)) { if (is_readable(e_PLUGIN . "poll/poll_class.php")) { require_once e_PLUGIN . "poll/poll_class.php"; $pollo = new poll(); $poll_form = $pollo->renderPollForm("forum"); } } // finally, file attach is optional, again only change this if you know what you're doing ... if (!isset($fileattach)) { $fileattach = "<tr><td colspan='2' class='nforumcaption2'>" . ($pref['image_post'] ? LAN_390 : LAN_416) . "</td></tr>\n<tr><td style='width:20%' class='forumheader3'>" . LAN_392 . "</td>\n<td style='width:80%' class='forumheader3'>" . LAN_393 . " | " . $allowed_filetypes . " |<br />" . LAN_394 . "<br />" . LAN_395 . ": " . ($pref['upload_maxfilesize'] ? $pref['upload_maxfilesize'] . LAN_396 : ini_get('upload_max_filesize')) . "\n<br />\n\n<div id='fiupsection'>\n<span id='fiupopt'><input class='tbox' name='file_userfile[]' type='file' size='47' /></span>\n</div>\n<input class='button' type='button' name='addoption' value='" . LAN_417 . "' onclick=\"duplicateHTML('fiupopt','fiupsection')\" />\n</td>\n</tr>\n</td>\n</tr>"; } // ------------ if (!isset($FORUMPOST)) { $FORUMPOST = "\n{FORMSTART}\n" . BOXOPEN . "{BACKLINK}" . BOXMAIN . "\n\n<div style='text-align:center'>\n<table style='width:100%' class='fborder'>\n{USERBOX}\n{SUBJECTBOX}\n<tr>\n<td class='forumheader2' style='width:20%; vertical-align:top;'>{POSTTYPE}</td>\n<td style='width:80%'>\n{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}\n</td>\n</tr>\n{POLL}\n{FILEATTACH}\n<tr style='vertical-align:top'>\n<td colspan='2' class='nforumcaption2' style='text-align:center'>\n{BUTTONS}\n</table>\n{FORMEND}\n</div>\n{FORUMJUMP}" . BOXCLOSE; } if (!isset($FORUMPOST_REPLY)) { $FORUMPOST_REPLY = "\n<div style='text-align:center'>\n<div class='spacer'>\n{FORMSTART}\n<table style='" . USER_WIDTH . "' class='fborder'>\n<tr>\n<td colspan='2' class='fcaption'>{BACKLINK}\n</td>\n</tr>\n{USERBOX}\n{SUBJECTBOX}\n<tr>\n<td class='forumheader2' style='width:20%'>{POSTTYPE}</td>\n<td class='forumheader2' style='width:80%'>\n{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}\n</td>\n</tr>\n\n{POLL}\n\n{FILEATTACH}\n\n<tr style='vertical-align:top'>\n<td colspan='2' class='forumheader' style='text-align:center'>\n{BUTTONS}\n</td>\n</tr>\n</table>\n{FORMEND}\n\n<table style='" . USER_WIDTH . "'>\n<tr>\n<td>\n{FORUMJUMP}\n</td>\n</tr>\n</table>\n</div></div>\n<div style='text-align:center'>\n{THREADTOPIC}\n{LATESTPOSTS}\n</div>\n"; } if (!isset($LATESTPOSTS_START)) {
<?php include_once 'modules/poll/class_poll.php'; $poll = new poll(); $pollrow = $db->qry_first('SELECT pollid, caption, comment, UNIX_TIMESTAMP(endtime) AS endtime, multi, anonym FROM %prefix%polls WHERE (!group_id OR group_id = %int%) ORDER BY RAND() LIMIT 1', $auth['group_id']); $voted = $db->qry_first('SELECT 1 AS found FROM %prefix%polloptions AS o INNER JOIN %prefix%pollvotes AS v ON o.polloptionid = v.polloptionid WHERE o.pollid = %int% AND v.userid = %int%', $pollrow['pollid'], $auth['userid']); $box->DotRow('<b>' . $pollrow['caption'] . '</b>'); if ($voted['found'] or $pollrow['endtime'] and $pollrow['endtime'] < time()) { $poll->ShowResult($pollrow['pollid'], $pollrow['anonym'], 1, 80); } else { $res2 = $db->qry('SELECT polloptionid, caption FROM %prefix%polloptions WHERE pollid = %int%', $pollrow['pollid']); $out = '<form id="dsp_form2" name="dsp_form2" method="post" action="index.php?mod=poll&action=show&step=3&pollid=' . $pollrow['pollid'] . '" >'; while ($row2 = $db->fetch_array($res2)) { if ($pollrow['multi']) { $out .= '<input name="option[]" type="checkbox" class="form" value="' . $row2["polloptionid"] . '" /> <label for="option[]">' . $row2['caption'] . '</label><br />'; } else { $out .= '<input name="option" type="radio" class="form" value="' . $row2["polloptionid"] . '" /> <label for="option">' . $row2['caption'] . '</label><br />'; } } $out .= '<input type="submit" class="Button" name="imageField" value="Abstimmen" /></form>'; $box->Row($out . "<br /><br />"); }
function sc_poll($parm = '') { if (is_readable(e_PLUGIN . "poll/poll_class.php")) { require_once e_PLUGIN . "poll/poll_class.php"; $pollo = new poll(); $type = $parm == 'front' ? 'front' : 'forum'; $poll_form = $pollo->renderPollForm($type); } if ($this->var['action'] == 'nt' && check_class($this->forum->prefs->get('poll')) && strpos(e_QUERY, 'edit') === false) { if ($parm == 'front') { return $poll_form; } return "<tr><td><a href='#pollform' class='e-expandit'>" . LAN_FORUM_3028 . "</a></td><td>\n\t\t\t<div id='pollform' style='display:none'>\n\t\t\t<table class='table table-striped'>" . $poll_form . "</table></div></td></tr>"; } return ''; }
<?php require '../includes/config.php'; require '../structure/database.php'; require '../structure/base.php'; require '../structure/user.php'; require '../structure/poll.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $base = new base($database); $user = new user($database); $poll = new poll($database); $user->updateLastActive(); $username = $user->getUsername($_COOKIE['user'], 2); $id = $_POST['id']; if (!$poll->canVote($id, $username) || !$poll->optionExists($id, $_POST['option'])) { $base->redirect('index.php'); } else { $database->processQuery("INSERT INTO `votes` VALUES (null, ?, ?, ?)", array($_POST['option'], $id, $username), false); } $base->redirect('results.php?id=' . $id);
Jarifa is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Jarifa is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Jarifa. If not, see <http://www.gnu.org/licenses/>. */ require_once "inc/poll.inc"; require_once "inc/identica.inc"; $poll = new poll(); // First, create the hash of the password for attaching BOINC projects $passwd_hash = md5($poll->conf->projects->password . "\n"); if ($_GET['auth'] == $passwd_hash) { $two_projects = array(); // Attach to clients only the two most voted projects (in case of a draft with several projects, choose one random) $projects = $poll->get_projects($order = "votes"); // Save stats in stats_poll table $poll->save_stats(); // Rank of votes, zero position has the highest number of votes and last position the lowest one. $votes = $poll->get_votes(); if (count($votes) > 1) { for ($i = 0; $i < 2; $i++) { $clause = "votes=" . $votes[$i]->votes; $candidate_projects = $poll->get_projects("name", $clause); // If there are more than one project with the same number of votes, we choose one of them randomly
<?php include_once("clases.class.php"); $poll = new poll(); switch($_GET["accion"]){ default: echo $poll->mostrarPoll($usuario,$tipo); break; case "votar": $valor=$poll->votar($_POST["opcionvotada"],$poll->uncampo("SELECT id_usuario FROM usuario WHERE login='******'"),$_POST["idpoll"]); $f->redireccionar("","principal.php?tipo=$tipo&usuario=$usuario&voto=$valor&idpoll=".$_REQUEST["idpoll"].""); break; case "verResultados": echo $poll->verResultados($_REQUEST["idPoll"]); break; } ?>
<?php require '../includes/config.php'; require '../structure/database.php'; require '../structure/base.php'; require '../structure/user.php'; require '../structure/poll.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $base = new base($database); $user = new user($database); $poll = new poll($database); $user->updateLastActive(); $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); $id = $_GET['id']; if (!$poll->canVote($id, $username) || !$poll->pollExists($id)) { $base->redirect('index.php'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns:IE> <head> <meta http-equiv="Expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <meta name="MSSmartTagsPreventParsing" content="TRUE"> <title><?php echo $data['wb_title']; ?> </title> <link href="../css/main.css" rel="stylesheet" type="text/css" media="all">
require_once e_PLUGIN . 'forum/forum_mod.php'; $message = forum_thread_moderate($_POST); $thread_info = $forum->thread_get($thread_id, $topic_from - 1, $pref['forum_postspage']); } } require_once HEADERF; require_once e_HANDLER . "level_handler.php"; if ($message) { $ns->tablerender("", $message, array('forum_viewtopic', 'msg')); } if (stristr($thread_info['head']['thread_name'], "[" . LAN_430 . "]")) { if (!defined("POLLCLASS")) { require e_PLUGIN . "poll/poll_class.php"; } $_qry = "SELECT * FROM #polls WHERE `poll_datestamp` = '{$thread_info['head']['thread_id']}'"; $poll = new poll(); $pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, "forum", "query", TRUE) . "</div>"; } //Load forum templates if (!$FORUMSTART) { if (file_exists(THEME . "forum_viewtopic_template.php")) { require_once THEME . "forum_viewtopic_template.php"; } else { if (file_exists(THEME . "forum_template.php")) { require_once THEME . "forum_template.php"; } else { require_once e_PLUGIN . "forum/templates/forum_viewtopic_template.php"; } } } $forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], TRUE, 'USER_TITLE');
/** * [产品详情] * @param int $id 产品id * @return array 产品信息渲染到页面view */ public function actionView($id) { $session = Yii::$app->session; $session->isActive ? '' : $session->open(); //判断产品是否发布 $base = IProductBase::find()->select('status,uid')->where('id = :id', [':id' => $id])->asArray()->one(); if (!empty($_SESSION['user'])) { if ($base['status'] != IProductBase::STATUS_VERIFEND) { if ($base['uid'] != $_SESSION['user']['uid']) { return $this->redirect(['index']); //跳转到完善信息 } } } else { if ($base['status'] != IProductBase::STATUS_VERIFEND) { return $this->redirect(['index']); //跳转到完善信息 } } //增加总访问量 $mProductStat = new IProductStat(); $mProductStat->modify('page_views', $id, 1, true); //访问日志 $mViewsLog = new ViewsLog(); $mViewsLog->modify($id, ViewsLog::PRODUCT_TYPE); //增加周访问量,月访问量 $week_num = $mViewsLog->ViewsNum($id, ViewsLog::PRODUCT_TYPE, 7); $month_num = $mViewsLog->ViewsNum($id, ViewsLog::PRODUCT_TYPE, 30); $mProductStat->modifyviewnum('week_views', $id, $week_num); $mProductStat->modifyviewnum('month_views', $id, $month_num); //基础数据和扩展数据查询 $re = IProductBase::find()->With('extra', 'stat')->where(IProductBase::tableName() . '.id = :id', [':id' => $id])->asArray()->one(); //该产品用户共发布产品数 $presentNum = IProductBase::find()->where(['uid' => $re['uid'], 'status' => IProductBase::STATUS_VERIFEND])->count(); //喜欢此产品用户 $model = new ProductFollow(); $loves = $model->getFollowUsers($id); //产品发布人头像及姓名 $model = new Member(); $user = $model->find()->select(['avatar', 'nickname'])->where(['uid' => $re['uid']])->asArray()->one(); //参加活动 $model = new ActivityProduct(); // print_r($id);exit; $actives = $model->getActivityDetail($id); // $actives = $model->getActivitiseById($id); // print_r($actives);exit; foreach ($actives as $key => $value) { if ($value['acti_id'] == 8) { $mBaiyingShare = new BaiyingShare(); $number = $mBaiyingShare->getShareNum($value['id']); } if ($value['acti_id'] == 9) { $rel_id = $value['id']; } } //活动map $activityBase = new ActivityBase(); $activesMap = $activityBase->getActivityMap(); if (isset($rel_id)) { //投票信息 $city = "上海"; $poll_type_id = PollType::GOODPRODUCT_TYPE; $mpoll = new poll(); $pollone = $mpoll->getPollByCity($city, $poll_type_id); //投票项信息 $moption = new polloption(); $optione = $moption->getOptionByowner($pollone['poll_id'], $rel_id); } return $this->render('view', ['re' => $re, 'present_num' => $presentNum, 'actives' => $actives, 'now' => time(), 'number' => isset($number) ? intval($number) : '', 'loves' => $loves, 'user' => $user, 'activesMap' => $activesMap, 'optione' => isset($optione) ? $optione : '']); }
} if (!defined("USER_WIDTH")) { define("USER_WIDTH", "width:95%"); } // the user box and subject box are not always displayed, therefore we need to define them /in case/ they are, if not they'll be ignored. if (!$userbox) { $userbox = "<tr>\n<td class='forumheader2' style='width:20%'>" . LAN_61 . "</td>\n<td class='forumheader2' style='width:80%'>\n<input class='tbox' type='text' name='anonname' size='71' value='" . $anonname . "' maxlength='20' style='width:95%' />\n</td>\n</tr>"; } if (!$subjectbox) { $subjectbox = "<tr>\n<td class='forumheader2' style='width:20%'>" . LAN_62 . "</td>\n<td class='forumheader2' style='width:80%'>\n<input class='tbox' type='text' name='subject' size='71' value='" . $subject . "' maxlength='100' style='width:95%' />\n</td>\n</tr>"; } // the poll is optional, be careful when changing the values here, only change if you know what you're doing ... if (!$poll_form) { if (is_readable(e_PLUGIN . 'poll/poll_class.php')) { require_once e_PLUGIN . 'poll/poll_class.php'; $pollo = new poll(); $poll_form = $pollo->renderPollForm('forum'); } } // finally, file attach is optional, again only change this if you know what you're doing ... if (!$fileattach) { $fileattach = "\n<tr>\n\t<td colspan='2' class='nforumcaption2'>" . ($pref['image_post'] ? LAN_390 : LAN_416) . "</td>\n</tr>\n<tr>\n\t<td style='width:20%' class='forumheader3'>" . LAN_392 . "</td>\n\t<td style='width:80%' class='forumheader3'>" . LAN_393 . " | " . $allowed_filetypes . " |<br />" . LAN_394 . "<br />" . LAN_395 . ": " . ($max_upload_size ? $max_upload_size . LAN_396 : ini_get('upload_max_filesize')) . "\n\t\t<br />\n\t\t<div id='fiupsection'>\n\t\t<span id='fiupopt'>\n\t\t\t<input class='tbox' name='file_userfile[]' type='file' size='47' />\n\t\t</span>\n\t\t</div>\n\t\t<input class='button' type='button' name='addoption' value='" . LAN_417 . "' onclick=\"duplicateHTML('fiupopt','fiupsection')\" />\n\t</td>\n</tr>\n"; //</td> //</tr> } // If the upload directory is not writable, we need to alert the user about this. if (!$fileattach_alert) { $fileattach_alert = "\n\t<tr>\n\t\t<td colspan='2' class='nforumcaption2'>" . ($pref['image_post'] ? LAN_390 : LAN_416) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan='2' class='forumheader3'>" . LAN_FORUM_1 . "</td>\n\t</tr>\n"; } // ------------ if (!$FORUMPOST) {
<?php defined('IN_DESTOON') or exit('Access Denied'); require DT_ROOT . '/module/' . $module . '/common.inc.php'; $MOD['poll_enable'] or dheader(DT_PATH); $TYPE = get_type('poll', 1); require MD_ROOT . '/poll.class.php'; $do = new poll(); $typeid = isset($typeid) ? intval($typeid) : 0; if ($action == 'js') { $itemid or exit; echo 'document.write(\'<iframe src="' . $EXT['poll_url'] . 'index.php?action=show&itemid=' . $itemid . '" style="width:99%;height:0;" scrolling="no" frameborder="0" id="poll__' . $itemid . '"></iframe>\');'; } else { if ($action == 'ajax') { if (!check_group($_groupid, $MOD['poll_group'])) { exit($_userid ? $L['poll_error_1'] : $L['poll_error_2']); } $itemid or exit($L['poll_error_3']); $I = $db->get_one("SELECT * FROM {$DT_PRE}poll_item WHERE itemid={$itemid}"); $I or exit($L['poll_error_4']); $do->itemid = $pollid = $I['pollid']; $item = $do->get_one(); $item or exit($L['poll_error_5']); if ($item['fromtime'] && $item['fromtime'] > $DT_TIME) { exit($L['poll_error_6']); } if ($item['totime'] && $item['totime'] < $DT_TIME) { exit($L['poll_error_7']); } $condition = $_username ? "AND username='******'" : "AND ip='{$DT_IP}' AND polltime>" . ($DT_TIME - 86400); $t = $db->get_one("SELECT * FROM {$DT_PRE}poll_record WHERE itemid={$itemid} {$condition}");
/** * Insert a new thread or a reply/quoted reply. */ function insertPost() { $postInfo = array(); $threadInfo = array(); $threadOptions = array(); $fp = new floodprotect(); if (isset($_POST['newthread']) && trim($_POST['subject']) == '' || trim($_POST['post']) == '') { message_handler('ALERT', 5); } else { if ($fp->flood('forum_thread', 'thread_datestamp') == false && !ADMIN) { echo "<script type='text/javascript'>document.location.href='" . e_BASE . "index.php'</script>\n"; exit; } $hasPoll = $this->action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != ''; if (USER) { $postInfo['post_user'] = USERID; $threadInfo['thread_lastuser'] = USERID; $threadInfo['thread_user'] = USERID; $threadInfo['thread_lastuser_anon'] = ''; } else { $postInfo['post_user_anon'] = $_POST['anonname']; $threadInfo['thread_lastuser_anon'] = $_POST['anonname']; $threadInfo['thread_user_anon'] = $_POST['anonname']; } $time = time(); $postInfo['post_entry'] = $_POST['post']; $postInfo['post_forum'] = $this->data['forum_id']; $postInfo['post_datestamp'] = $time; $postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE); $threadInfo['thread_lastpost'] = $time; if (isset($_POST['no_emote'])) { $postInfo['post_options'] = serialize(array('no_emote' => 1)); } //If we've successfully uploaded something, we'll have to edit the post_entry and post_attachments $newValues = array(); if ($uploadResult = $this->processAttachments()) { foreach ($uploadResult as $ur) { //$postInfo['post_entry'] .= $ur['txt']; // $_tmp = $ur['type'].'*'.$ur['file']; // if($ur['thumb']) { $_tmp .= '*'.$ur['thumb']; } // if($ur['fname']) { $_tmp .= '*'.$ur['fname']; } $type = $ur['type']; $newValues[$type][] = $ur['file']; // $attachments[] = $_tmp; } // $postInfo['_FIELD_TYPES']['post_attachments'] = 'array'; $postInfo['post_attachments'] = e107::serialize($newValues); //FIXME XXX - broken encoding when saved to DB. } // var_dump($uploadResult); switch ($this->action) { // Reply only. Add the post, update thread record with latest post info. // Update forum with latest post info case 'rp': $postInfo['post_thread'] = $this->id; $newPostId = $this->forumObj->postAdd($postInfo); break; // New thread started. Add the thread info (with lastest post info), add the post. // Update forum with latest post info // New thread started. Add the thread info (with lastest post info), add the post. // Update forum with latest post info case 'nt': $threadInfo['thread_sticky'] = MODERATOR ? (int) $_POST['threadtype'] : 0; $threadInfo['thread_name'] = $_POST['subject']; $threadInfo['thread_forum_id'] = $this->id; $threadInfo['thread_active'] = 1; $threadInfo['thread_datestamp'] = $time; if ($hasPoll) { $threadOptions['poll'] = '1'; } if (is_array($threadOptions) && count($threadOptions)) { $threadInfo['thread_options'] = serialize($threadOptions); } else { $threadInfo['thread_options'] = ''; } if ($postResult = $this->forumObj->threadAdd($threadInfo, $postInfo)) { $newPostId = $postResult['postid']; $newThreadId = $postResult['threadid']; $this->data['thread_id'] = $newThreadId; // $this->data['thread_sef'] = $postResult['threadsef']; $this->data['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'], 'dashl'); if ($_POST['email_notify']) { $this->forumObj->track('add', USERID, $newThreadId); } } break; } e107::getMessage()->addDebug(print_a($postInfo, true)); // e107::getMessage()->addDebug(print_a($this,true)); if ($postResult === -1 || $newPostId === -1) { require_once HEADERF; $message = LAN_FORUM_3006 . "<br ><a class='btn btn-default' href='" . $_SERVER['HTTP_REFERER'] . "'>Return</a>"; $text = e107::getMessage()->addError($message)->render(); e107::getRender()->tablerender(LAN_PLUGIN_FORUM_NAME, $text); // change to forum-title pref. require_once FOOTERF; exit; } $threadId = $this->action == 'nt' ? $newThreadId : $this->id; //If a poll was submitted, let's add it to the poll db if ($this->action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != '') { require_once e_PLUGIN . 'poll/poll_class.php'; $_POST['iid'] = $threadId; $poll = new poll(); $poll->submit_poll(2); } e107::getCache()->clear('newforumposts'); // $postInfo = $this->forumObj->postGet($newPostId, 'post'); // $forumInfo = $this->forumObj->forumGet($postInfo['post_forum']); // $threadLink = e107::getUrl()->create('forum/thread/last', $postInfo); // $forumLink = e107::getUrl()->create('forum/forum/view', $forumInfo); $threadLink = e107::url('forum', 'topic', $this->data, 'full') . "&last=1"; $forumLink = e107::url('forum', 'forum', $this->data); if ($this->forumObj->prefs->get('redirect')) { $this->redirect($threadLink); // header('location:'.e107::getUrl()->create('forum/thread/last', $postInfo, array('encode' => false, 'full' => true))); exit; } else { require_once HEADERF; $template = $this->getTemplate('posted'); $SHORTCODES = array('THREADLINK' => $threadLink, 'FORUMLINK' => $forumLink); $txt = isset($_POST['newthread']) ? $template['thread'] : $template['reply']; $txt = e107::getParser()->parseTemplate($txt, true, $SHORTCODES); e107::getRender()->tablerender('Forums', e107::getMessage()->render() . $txt); require_once FOOTERF; exit; } } }
if (!getperms("P") || !e107::isInstalled('poll')) { header("location:" . e_BASE . "index.php"); exit; } $e_sub_cat = 'poll'; include_lan(e_PLUGIN . 'poll/languages/' . e_LANGUAGE . '_admin_poll.php'); require_once e_ADMIN . "auth.php"; require_once e_PLUGIN . "poll/poll_class.php"; require_once e_HANDLER . "userclass_class.php"; require_once e_HANDLER . "form_handler.php"; // FIXME using 'form' instead of 'e_form' if (isset($_POST)) { $_POST = strip_if_magic($_POST); } $rs = new form(); $poll = new poll(); $frm = e107::getForm(); $mes = e107::getMessage(); if (isset($_POST['reset'])) { unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['multipleChoice'], $_POST['showResults'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear']); define("RESET", TRUE); } if (varset($_POST['delete'])) { $poll->delete_poll(key($_POST['delete'])); // TODO check security? $mes->addSuccess(LAN_DELETED); unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']); $_GET['mode'] = 'list'; } if (isset($_POST['submit'])) { if ($_POST['poll_title']) {
<?php include_once 'modules/poll/class_poll.php'; $poll = new poll(); $pollrow = $db->qry_first('SELECT caption, comment, UNIX_TIMESTAMP(endtime) AS endtime, multi, anonym, requirement FROM %prefix%polls WHERE pollid = %int% AND (!group_id OR group_id = %int%)', $_GET['pollid'], $auth['group_id']); $dsp->NewContent(t('Poll') . ': ' . $pollrow["caption"], $func->text2html($pollrow['comment'])); $voted = $db->qry_first('SELECT 1 AS found FROM %prefix%polloptions AS o INNER JOIN %prefix%pollvotes AS v ON o.polloptionid = v.polloptionid WHERE o.pollid = %int% AND v.userid = %int%', $_GET['pollid'], $auth['userid']); if (!$pollrow['caption']) { $func->error(t('Dieser Poll existiert nicht, oder du hast keine Berechtigung ihn zu sehen'), NO_LINK); $_GET['step'] = 1; } $func->SetRead('poll', $_GET['pollid']); $poll->ShowResult($_GET['pollid'], $pollrow['anonym']); $dsp->AddBackButton("index.php?mod=poll", "poll/vote");
} if (!getperms("P") || !plugInstalled('poll')) { header("location:" . e_BASE . "index.php"); exit; } $e_sub_cat = 'poll'; include_lan(e_PLUGIN . 'poll/languages/' . e_LANGUAGE . '_admin_poll.php'); require_once e_ADMIN . "auth.php"; require_once e_PLUGIN . "poll/poll_class.php"; require_once e_HANDLER . "form_handler.php"; require_once e_HANDLER . "userclass_class.php"; if (isset($_POST)) { $_POST = strip_if_magic($_POST); } $rs = new form(); $poll = new poll(); if (isset($_POST['reset'])) { unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['multipleChoice'], $_POST['showResults'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear']); define("RESET", TRUE); } $emessage = eMessage::getInstance(); if (varset($_POST['delete'])) { $message = $poll->delete_poll(key($_POST['delete'])); unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']); $_GET['mode'] = 'list'; } if (isset($_POST['submit'])) { if ($_POST['poll_title']) { define("POLLID", $_POST['poll_id']); $emessage->add($poll->submit_poll(), E_MESSAGE_SUCCESS); unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']);
define("META_DESCRIPTION", $tp->text_truncate(str_replace(array('"', "'"), '', strip_tags($tp->toHTML($postList[0]['post_entry']))), 250, '...')); } $gen = new convert(); if ($thread->message) { //$ns->tablerender('', $thread->message, array('forum_viewtopic', 'msg')); e107::getMessage()->add($thread->message); } //if (isset($thread->threadInfo['thread_options']['poll'])) //XXX Currently Failing - misconfigured thread-options. //{ if (e107::isInstalled('poll')) { $_qry = 'SELECT * FROM `#polls` WHERE `poll_datestamp` = ' . $thread->threadId; if ($sql->gen($_qry)) { if (!defined('POLLCLASS')) { include_once e_PLUGIN . 'poll/poll_class.php'; } $poll = new poll(); $pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>'; } } //} //Load forum templates // FIXME - new template paths! if (file_exists(THEME . 'forum_design.php')) { include_once THEME . 'forum_design.php'; } if (!vartrue($FORUMSTART)) { if (file_exists(THEME . 'forum_viewtopic_template.php')) { require_once THEME . 'forum_viewtopic_template.php'; } elseif (file_exists(THEME . 'templates/forum/forum_viewtopic_template.php')) { require_once THEME . 'templates/forum/forum_viewtopic_template.php'; } elseif (file_exists(THEME . 'forum_template.php')) {
$message = @$_REQUEST['msg']; global $flag, $type; if (!$error) { if (!empty($_GET['type'])) { $type = htmlspecialchars($_GET['type']); } if (!empty($_POST['submit'])) { $obj = new Poll(); $obj->poll_id = $_POST['poll']; $obj->prev_changed = $_POST['prev_poll_changed']; $obj->prev_poll_id = $_POST['prev_poll_id']; $obj->save_current(); header("Location: " . PA::$url . PA_ROUTE_HOME_PAGE); } if (!empty($_GET['action']) && $_GET['action'] == "delete") { $obj = new poll(); $p_id = $_GET['id']; $c_id = $_GET['cid']; $obj->delete_poll($p_id, $c_id); header("Location: " . PA::$url . "/poll.php?type=select"); } if (!empty($_POST['create'])) { $poll_topic = $_POST['topic']; $cnt = $_POST['num_option']; $poll_option = array(); for ($i = 1; $i <= $cnt; $i++) { $poll_option['option' . $i] = $_POST['option' . $i]; } $option = serialize($poll_option); $obj = new POll(); $obj->author_id = $login_uid;
/** * 改变中国好产品 状态,并添加进投票项 * @param int $id 活动产品id * @param int $status 活动产品状态 * * @return json * */ public function actionStatus() { $admin = Yii::$app->util->isAdminLogin(); if (!$admin && !Yii::$app->util->isAjax()) { echo Yii::$app->util->formatResEncode('1001', 'login error'); exit; } $params = Yii::$app->request->post(); $rel_id = isset($params['id']) ? intval($params['id']) : ''; $status = isset($params['status']) ? intval($params['status']) : ''; if (empty($rel_id) || empty($status)) { echo Yii::$app->util->formatResEncode('1002', 'param error'); exit; } $mActivityProduct = new ActivityProduct(); $actproduct = $mActivityProduct->getDetailBypk($rel_id); $product = $actproduct['product']['name']; if ($mActivityProduct->changeStatus($rel_id, $status)) { $msg = '产品:' . $product . '状态更改成功!'; //审核通过 增加投票项 if ($status == ActivityProduct::STATUS_VERIFY_THROUGH) { $mapattrval = new ActivityProductAttrVal(); $attrval = $mapattrval->getRealAttrVals($rel_id, ActivityBase::GOOD_PRODUCT); $city = $attrval['division']['val']; $poll_type_id = PollType::GOODPRODUCT_TYPE; $mpoll = new poll(); $pollone = $mpoll->getPollByCity($city, $poll_type_id); if ($pollone) { $option = ['poll_id' => $pollone['poll_id'], 'owner_id' => $rel_id, 'option_name' => $product, 'option_type_id' => ActivityBase::GOOD_PRODUCT]; $mpolloption = new PollOption(); //判断该活动产品 是否已经添加进去投票项 $isoption = $mpolloption->isOptionRel($option); if (!$isoption) { $option_id = $mpolloption->storeSave($option); if ($option_id) { if (!strpos($pollone['poll_option_ids'], $rel_id)) { $mpoll = new poll(); $ids = empty($pollone['poll_option_ids']) ? $rel_id : $pollone['poll_option_ids'] . ',' . $rel_id; $mpoll->storeSave(['poll_id' => $pollone['poll_id'], 'poll_option_ids' => $ids]); } $option_id ? $msg .= ',添加成为投票项' : ''; } } } } echo Yii::$app->util->formatResEncode('0', $msg); } else { echo Yii::$app->util->formatResEncode('1003', '更改失败!'); } }
<?php $lang->addModSpecificLocalization('poll'); $tpl_file = $template_dir . "/pollbox.tpl"; include_once "./mod/default/poll/poll.class.php"; $pollclass = new poll($db, 100, explode(",", $config->get("poll", "barcolor"))); $poll = $pollclass->getRandomPoll(); if ($poll['name'] != '') { $poll['url'] = makeURL('poll', array('pollid' => $poll['ID'])); $pollbox['poll'] = $poll; $smarty->assign('pollbox', $pollbox); $smarty->assign('tworower', $config->get('poll', 'box-show-bar-in-second-row')); $smarty->assign('layout', $config->get('poll', 'box-layout')); } else { $tpl_file = $template_dir . "/nopoll.tpl"; } $visible = true;