function display_poll($tID, $preview = false, $uID = null) { global $tplt, $wgRequest; if ($uID == null) { $uID = isset($this->uID) ? $this->uID : '0'; } if (!isset($tplt->tplts['poll_display_results']) or empty($tplt->tplts['poll_display_results'])) { $tplt->add_tplts(array("'poll_display_options'", "'poll_display_results'", "'poll_opt_options'", "'poll_display_result_bars'", "'poll_display'"), true); } $word['word_poll_question'] = get_awcsforum_word('word_poll_question'); $Pass['thread_link'] = null; if ($preview) { $word['word_votes'] = get_awcsforum_word('word_votes'); $word['word_total_percent'] = get_awcsforum_word('word_total_percent'); $word['word_poll_option'] = get_awcsforum_word('word_poll_option'); $word['word_total_votes'] = get_awcsforum_word('word_total_votes'); $opt = null; foreach ($_POST as $k => $v) { if (!empty($v)) { if (strstr($k, 'poll_opt')) { ++$opt; if (trim(awcsforum_post_cls::CleanThreadTitle($v)) != '') { $p['poll_choice']['poll_opt' . $opt] = trim(awcsforum_post_cls::CleanThreadTitle($v)); } } } } $p['poll_results'] = array(); #$p['poll_results'] = '0'; $Pass = self::display_result_bars($p); $Pass['poll_q'] = $wgRequest->getVal('pollq'); $poll = $tplt->phase($word, $Pass, 'poll_display', true); //$poll .= '<br /><br />'; require awc_dir . 'includes/post_box.php'; $posting_box = new awcs_forum_posting_box(); $posting_box->tID = $this->tID; $posting_box->fID = $this->fID; $poll .= $posting_box->poll_form_display(); return $poll; } $dbr = wfGetDB(DB_SLAVE); $awc_f_polls = $dbr->tableName('awc_f_polls'); $awc_f_forums = $dbr->tableName('awc_f_forums'); // $awc_f_threads = $dbr->tableName( 'awc_f_threads' ); // die($tID); $poll_sql = "SELECT * FROM {$awc_f_polls} WHERE poll_threadid={$tID} ORDER BY poll_id ASC"; // poll_open // elseif($this->t_poll AND $this->t_pollopen == 0 AND UserPerm >= 2) { // word_pollClosed $poll = null; $poll_res = $dbr->query($poll_sql); # $poll_r = $dbr->fetchRow($poll_res); while ($poll_r = $dbr->fetchObject($poll_res)) { // $poll_r = $dbr->fetchRow($poll_res); $Pass['pollID'] = $poll_r->poll_id; $Pass['tID'] = $poll_r->poll_threadid; $Pass['poll_q'] = $poll_r->poll_q; $Pass['poll_q'] = '<a href="' . awc_url . 'st/id' . $tID . '">' . $Pass['poll_q'] . '</a> '; $p = array(); $p['poll_choice'] = @unserialize($poll_r->poll_choice); $p['poll_results'] = @unserialize($poll_r->poll_a); $p['poll_whovoted'] = @unserialize($poll_r->poll_whovoted); $p['poll_q'] = '<a href="' . awc_url . 'st/id' . $tID . '">' . $poll_r->poll_q . '</a> '; // $Pass['thread_link'] = '<a href="'.awc_url.'/st/id'.$tID.'">'.get_awcsforum_word('word_votes').'</a> '; $poll_buttons = self::poll_buttons($poll_r->poll_open, $poll_r->poll_id, $tID); // 2.5.8 #unset($poll_r, $p_res); if (!@array_key_exists($uID, $p['poll_whovoted']) and $uID != 0) { # $p['options'] = $calling_class->skin_thread->poll_displayoptions_select($p['poll_choice'],$pIDs ); if ($poll_r->poll_open == 1) { $t = 0; $Pass['select_options'] = null; foreach ($p['poll_choice'] as $f => $v) { if ($v != '') { ++$t; $Pass['url'] = awc_url . 'post/todo_poll_vote'; $Pass['value'] = $f; $Pass['id'] = "polloption{$f}"; $word['option'] = $v; // word_pollnovote #$word['option'] = get_awcsforum_word('word_votes'); $word['submit'] = get_awcsforum_word('word_vote'); $Pass['select_options'] .= $tplt->phase($word, $Pass, 'poll_opt_options'); } } $Pass['value'] = '-1'; $Pass['id'] = "polloption_opt" . ($t + 1); $word['option'] = get_awcsforum_word('word_pollnovote'); $Pass['select_options'] .= $tplt->phase($word, $Pass, 'poll_opt_options'); $Pass['options'] = $tplt->phase($word, $Pass, 'poll_display_options'); } else { $Pass = self::display_result_bars($p); $Pass['poll_q'] = $p['poll_q']; $Pass['options'] .= get_awcsforum_word('word_pollClosed'); // 2.5.8 } $Pass['options'] .= $poll_buttons; // 2.5.8 } elseif ($uID != 0) { if (!empty($p['poll_results'])) { $Pass = self::display_result_bars($p); $Pass['poll_q'] = $p['poll_q']; } else { $Pass['options'] = null; } if ($poll_r->poll_open == 0) { $Pass['options'] .= get_awcsforum_word('word_pollClosed'); // 2.5.8 } $Pass['options'] .= $poll_buttons; // 2.5.8 } else { if ($poll_r->poll_open == 0) { $Pass = self::display_result_bars($p); $Pass['poll_q'] = $p['poll_q']; $Pass['options'] .= get_awcsforum_word('word_pollClosed'); // 2.5.8 } else { $option = null; foreach ($p['poll_choice'] as $f => $v) { if ($v != '') { $option .= $v . '<br />'; } } $Pass['options'] = $option; } #$Pass['options'] = get_awcsforum_word('word_poll_guest_message'); } if (!isset($tplt->tplts['poll_display']) or empty($tplt->tplts['poll_display'])) { $tplt->add_tplts(array("'poll_display'"), true); // need to find out why some severs need this and some dont. } $poll .= $tplt->phase($word, $Pass, 'poll_display'); if ($this->multi_polls == '0') { break; } } return $poll; }
function do_split() { global $awcUser, $awc_tables, $wgRequest, $awcs_forum_config; if (UserPerm < 2) { return $wgOut->loginToUse(); } require awc_dir . 'post.php'; $post_cls = new awcsforum_post_cls(); $pID = $this->tID[0]; $dbr = wfGetDB(DB_SLAVE); $r = $dbr->selectRow('awc_f_posts', array('*'), "p_id={$pID}", __METHOD__, array('OFFSET' => 0, 'LIMIT' => 1)); $this->tID = array(0 => $pID); $post_cls->post = $r->p_post; $post_cls->cur_memID = $r->p_userid; $post_cls->cur_memName = $r->p_user; unset($dbr, $r); $user_get = array(); $user_get[] = 'm_id'; $user_get[] = 'm_posts'; $user_get[] = 'm_topics'; $mem_Info = GetMemInfo($post_cls->cur_memID, $user_get); unset($user_get); $post_cls->cur_m_posts = $mem_Info['m_posts']; $post_cls->cur_m_topics = $mem_Info['m_topics']; $post_cls->mName = $post_cls->cur_memName; unset($mem_Info); $title = trim($wgRequest->getVal('t_title')); $post_cls->title = $post_cls->CleanThreadTitle($title); $post_cls->fID = $wgRequest->getVal('fID'); $post_cls->is_poll = false; $post_cls->subscrib_what = 'no'; $post_cls->forum_Antispam = ''; $post_cls->ann = '0'; $post_cls->sticky = '0'; $post_cls->lock = '0'; $post_cls->cf_threadsubscrip = $awcs_forum_config->cf_threadsubscrip; $post_cls->cf_forumsubscrip = $awcs_forum_config->cf_forumsubscrip; $post_cls->add_thread(); self::delete_post(true); }