function q_thread($s, $dbr) { global $awc, $wikieits, $total_thread_count, $thread_title_for_search, $awc_tables, $tplt; $perm = new awcs_forum_perm_checks(); $perm_sql = $perm->forum_sql(); // if(strlen($s) > 0 AND strlen($perm_sql) > 0) $perm_sql .= ' AND ' ; $sql = "SELECT awc_f_posts.p_id, awc_f_posts.p_title, awc_f_posts.p_post, awc_f_posts.p_user, awc_f_posts.p_userid, awc_f_posts.p_editwhy, awc_f_posts.p_editwho, awc_f_posts.p_editdate, awc_f_posts.p_date,\r\r\n {$awc_tables['awc_f_threads']}.t_id, {$awc_tables['awc_f_threads']}.t_ann, {$awc_tables['awc_f_threads']}.t_pin, {$awc_tables['awc_f_threads']}.t_status, {$awc_tables['awc_f_threads']}.t_name, {$awc_tables['awc_f_threads']}.t_topics, {$awc_tables['awc_f_threads']}.t_hits, {$awc_tables['awc_f_threads']}.t_perm, {$awc_tables['awc_f_threads']}.t_poll, {$awc_tables['awc_f_threads']}.t_wiki_pageid, {$awc_tables['awc_f_threads']}.t_lastdate, \r\r\n {$awc_tables['awc_f_forums']}.f_posting_mesage_tmpt, {$awc_tables['awc_f_forums']}.f_name, {$awc_tables['awc_f_forums']}.f_id, {$awc_tables['awc_f_forums']}.f_wiki_write_perm, {$awc_tables['awc_f_forums']}.f_passworded, \r\r\n {$awc_tables['awc_f_cats']}.cat_name, {$awc_tables['awc_f_cats']}.cat_id\r\r\n FROM {$awc_tables['awc_f_threads']}\r\r\n JOIN {$awc_tables['awc_f_posts']} awc_f_posts\r\r\n ON {$awc_tables['awc_f_threads']}.t_id=awc_f_posts.p_threadid\r\r\n JOIN {$awc_tables['awc_f_forums']}\r\r\n ON {$awc_tables['awc_f_threads']}.t_forumid={$awc_tables['awc_f_forums']}.f_id\r\r\n JOIN {$awc_tables['awc_f_cats']} \r\r\n ON {$awc_tables['awc_f_forums']}.f_parentid={$awc_tables['awc_f_cats']}.cat_id\r\r\n WHERE {$perm_sql} {$s} AND {$awc_tables['awc_f_forums']}.f_passworded = 0\r\r\n ORDER BY awc_f_posts.p_thread_start DESC, awc_f_posts.p_date"; $sql = str_replace('AND AND', ' AND ', $sql); $sql = str_replace('WHERE AND', 'WHERE ', $sql); // awc_pdie($s); global $wgOut; require_once awc_dir . 'includes/post_phase.php'; require_once awc_dir . 'includes/thread_funk.php'; $post_cls = new awcs_forum_post_phase(); $res = $dbr->query($sql); $post_table = null; while ($r = $dbr->fetchObject($res)) { ++$total_thread_count; $thread_title_for_search = '<b>' . $r->t_name . '</b>'; $tplt_info['edit_buttons'] = null; $tplt_info['sig_display'] = null; $tplt_info['user_options'] = null; $tplt_info['post_avatar'] = null; $tplt_info['admin_lookup'] = null; $tplt_info['profile_link'] = null; $tplt_info['m_pm'] = null; $tplt_info['wikiedits_count_link'] = null; $tplt_info['topics_count_link'] = null; $tplt_info['post_count_link'] = null; $tplt_info['group'] = null; $tplt_info['post_edited_on'] = null; $tplt_info['wikiedits_count_link'] = null; $word = null; $tplt_info['user_name'] = $r->p_user; $tplt_info['post_title'] = $r->p_title; // $tplt_info['post_edited_on'] = $r->p_editdate; $tplt_info['date'] = $r->p_date; $tplt_info['post'] = $post_cls->phase_post($r->p_post, '', false); // $tplt_info['post'] = awc_wikipase($r->p_post, $wgOut); // $tplt_info['post'] = $r->p_post ; $tplt_info['avatarwidth'] = 0; $post_table .= $tplt->phase($word, $tplt_info, 'post_table'); } $wgOut->addHTML($post_table); $end = ', ' . get_awcsforum_word('word_inThread') . ' ' . $thread_title_for_search; $title = str_replace("|\$|", $total_thread_count, get_awcsforum_word('search_SearchResultsFound')) . ": {$this->searchword}" . $end; Set_AWC_Forum_SubTitle(get_awcsforum_word('search_SearchResults'), $title); // die($post_table); return; require awc_dir . 'thread.php'; require awc_dir . 'includes/thread_funk.php'; $threads = new awcforum_threads(); $threads->awc_url = $awc['link']; $threads->cookie_expir = $awc['config']['cfl_Post_cookie_postcountexpire']; $threads->quick_height = $awc['config']['cfl_Post_quickpost_box_height']; // isset($awc['config']['wikieits']) ? $threads->wikieits = $awc['config']['wikieits'] : $threads->wikieits=null; // $wikieits = $threads->wikieits; # die($this->searchword); global $wgRequest; $wgRequest->data['action'] .= 'sw:' . $this->searchword; # die(print_r($wgRequest)); $threads->GetPosts($this->tID, $sql); $end = ', ' . get_awcsforum_word('word_inThread') . ' ' . $thread_title_for_search; $title = str_replace("|\$|", $total_thread_count, get_awcsforum_word('search_SearchResultsFound')) . ": {$this->searchword}" . $end; Set_AWC_Forum_SubTitle(get_awcsforum_word('search_SearchResults'), $title); return; }
function GetPosts($tID, $sql2 = '', $single_post = false) { global $LimitJump_top, $LimitJump_bot, $total_thread_count, $thread_title_for_search; global $wgOut, $wgRequest, $wgCookieExpiration, $wgCookiePath, $wgCookieDomain; global $WhoWhere, $awc_tables, $tplt; global $awcUser; if (!$awcUser->canRead) { return $wgOut->loginToUse(); } $perm = new awcs_forum_perm_checks(); $post_cls = new awcs_forum_post_phase(); if ($single_post) { $post_cls->single_post = true; } $word = null; $i = null; $html = null; $e = array(); $tPass = array(); if ($sql2 == '') { $check_subscribe = self::check_subscribe($tID); if ($check_subscribe != 'no') { $e = $check_subscribe['e']; $tPass = $check_subscribe['tPass']; $subscribe_info = $check_subscribe['subscribe_info']; } else { $tPass['subscrib_links'] = null; } } else { $tPass['subscrib_links'] = null; $tplt->kill('subscrib_links'); } $dbr = wfGetDB(DB_SLAVE); $this->display_mem_titles = 1; if ($this->display_mem_titles) { $sql = "SELECT * FROM {$awc_tables['awc_f_member_titles']} ORDER BY memtitle_postcount ASC"; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { $post_cls->mem_post_title[$r->memtitle_id] = array('count' => $r->memtitle_postcount, 'title' => $r->memtitle_title, 'img' => $r->memtitle_img, 'css' => $r->memtitle_css); } unset($res, $r); } else { $post_cls->mem_post_title[0] = 'do_not_show'; } // get number of threads so we can make the Page Blocks # do something different, maybe move to sessions ro somehting $sql = $dbr->selectSQLText(array('awc_f_threads'), array('t_topics, t_postid'), "t_id={$tID}", __METHOD__, array('OFFSET' => '0', 'LIMIT' => '1')); $limit = ''; $tPass['page_jumps'] = null; if ($sql2 == '') { #$sql = "SELECT p_id FROM {$awc_tables['awc_f_posts']} WHERE p_id = $tID "; $res = $dbr->query($sql); $r = $dbr->fetchRow($res); $ex['TotalPosts'] = $r['t_topics']; $dbr->freeResult($res); $total['TotalPosts'] = $ex['TotalPosts']; $total['last'] = $r['t_postid']; $limit = GetLimit($total, 'thread'); $tPass['page_jumps'] = $LimitJump_top; #die($LimitJump_bot); } else { # $ex['sql2'] = $sql2; } # DIE($limit); $limit_is_there = false; # sw: highlightsearchword $action = $wgRequest->action; $spl = explode("/", $action); $search_word = null; # loop through "action" to find seach word foreach ($spl as $k => $value) { if (stristr($value, 'limit')) { $post_cls->has_limit = true; } if (substr($value, 0, 3) == "sw:") { $sw1 = explode("sw:", $value); $search_word = $sw1[1]; break; } } $search_word = str_replace("_", " ", $search_word); $spl2 = explode(" ", $search_word); # loop through seach word's foreach ($spl2 as $k => $value) { $sw[] = $value; } $perm_where = $perm->cat_forum_sql(); $limit = awcsforum_funcs::limitSplit($limit); # awc_pdie($limit); $sql = $dbr->selectSQLText(array('awc_f_threads', 'awc_f_posts', 'awc_f_forums', 'awc_f_cats'), array('p_id, p_title, p_post, p_user, p_userid, p_editwhy, p_editwho, p_editdate, p_date, t_id, t_ann, t_pin, t_status, t_name, t_topics, t_hits, t_perm, t_poll, t_wiki_pageid, t_lastdate, t_pollopen, f_posting_mesage_tmpt, f_name, f_id, f_wiki_write_perm, f_wiki_read_perm, f_passworded, cat_name, cat_id'), "{$perm_where} t_id = {$tID}", __METHOD__, array('OFFSET' => $limit['offset'], 'LIMIT' => $limit['limit'], 'ORDER BY' => 'p_thread_start DESC, p_date ASC'), array('awc_f_posts' => array('JOIN', 't_id=p_threadid'), 'awc_f_forums' => array('JOIN', 't_forumid=f_id'), 'awc_f_cats' => array('JOIN', 'f_parentid=cat_id'))); # die($sql); if (strlen($sql2) > 0) { $sql = $sql2; } $res = $dbr->query($sql); $i = 0; $out = array(); # $e['html'] = null; while ($r = $dbr->fetchObject($res)) { ++$i; if ($i == 1) { # awc_pdie($r); // stuff this stuff here so its not looped... $WhoWhere['where'] = 'cid' . $r->cat_id . '|fid' . $r->f_id . '|tid' . $r->t_id . '||awc-split||' . $r->t_name; $WhoWhere['perm'] = isset($r->f_wiki_read_perm) ? $r->f_wiki_read_perm : ''; $thread_title = $r->t_name; $t_status = $r->t_status; $f_posting_mesage_tmpt = isset($r->f_posting_mesage_tmpt) ? $r->f_posting_mesage_tmpt : ''; $f_wiki_write_perm = isset($r->f_wiki_write_perm) ? $r->f_wiki_write_perm : ''; if (!$awcUser->guest and awcsforum_funcs::wikidate($r->t_lastdate) > $_SESSION['awc_startTime']) { $_SESSION['awc_rActive'][$r->t_id] = awcsforum_funcs::wikidate($r->t_lastdate); } $e['PostTitle'] = $r->t_name; $e['num_topics'] = $r->t_topics; $f_name = $r->f_name; $fID = $r->f_id; $t_wiki_pageid = $r->t_wiki_pageid; if (!isset($awcUser->pw)) { $awcUser->pw[0] = 0; } #die(">" . $r->f_id); if ($perm->is_password($r->f_passworded) and !in_array($r->f_id, $awcUser->pw)) { global $wgOut; $password_field = '<br /><hr />' . get_awcsforum_word('forum_passworded') . '<hr />'; $password_field .= '</form><form action="' . awc_url . 'fpw" method="post" enctype="multipart/form-data"> <input name="fid" type="hidden" value="' . $r->f_id . '"> <input name="pw" type="password" size="20"> <input type="submit" value="' . get_awcsforum_word('submit') . '"> </form><br /><br />'; $wgOut->addHTML($password_field); return; } $this->forum_perm_can_post = false; if ($awcUser->canPost and $perm->can_post($f_wiki_write_perm)) { $this->forum_perm_can_post = true; $post_cls->forum_perm_can_post = true; } // end stuffed... if (!$single_post) { Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'sc/id' . $r->cat_id . '">' . $r->cat_name . '</a>'); $BreadCrumb = Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'sf/id' . $r->f_id . '">' . $r->f_name . '</a>', true); $t = null; if ($r->t_ann == "1") { $t = get_awcsforum_word('thread_makeAnnouncement') . " "; $e['ann'] = true; } if ($r->t_status == "1") { $t = get_awcsforum_word('1indicator_locked') . " "; $e['lock'] = true; } if ($r->t_pin == "1") { $t = get_awcsforum_word('1indicator_sticky') . " "; $e['sticky'] = true; } if ($r->t_pin == "1" and $r->t_status == "1") { $t = get_awcsforum_word('1indicator_lockSticky') . " "; } $e['tID'] = $r->t_id; $e['fID'] = $r->f_id; $e['cID'] = $r->cat_id; $e['pID'] = $r->p_id; Set_AWC_Forum_SubTitle($r->t_name, $t . get_awcsforum_word('word_viewed') . " " . $r->t_hits . " " . get_awcsforum_word('word_times') . ", " . get_awcsforum_word('word_Withatotalof') . " " . $r->t_topics . " " . get_awcsforum_word('word_posts'), $e); $tPass['mod_buttons'] = null; if (UserPerm >= 2) { $e['ann'] = $r->t_ann == '1' ? 'checked' : null; $e['sticky'] = $r->t_pin == '1' ? 'checked' : null; $e['lock'] = $r->t_status == '1' ? 'checked' : null; $e['threadname'] = awcsforum_funcs::awc_html_entity_decode($thread_title); $word['pinned_word'] = get_awcsforum_word('pinned_word'); $word['lockThread_word'] = get_awcsforum_word('lockThread_word'); $word['mod_movethread'] = get_awcsforum_word('mod_movethread'); $word['thread_makeAnnouncement'] = get_awcsforum_word('thread_makeAnnouncement'); $word['mod_post'] = get_awcsforum_word('mod_post'); if ($r->t_ann != "1" || UserPerm == 10) { #$to_skin['mod_buttons'] = ModFormStart($r->t_id, $r->p_id, $r->f_id, awc_url, $r->t_name, $total_topics) ; } #if (UserPerm == 10) $to_skin['mod_buttons'] .= IsAnnonc($r->t_ann); if (UserPerm == 10) { $e['ann'] = $tplt->phase($word, $e, 'mod_thread_dropdown_ann', true); } else { $e['ann'] = ''; } if ((UserPerm >= 2 and $r->t_ann != "1") || UserPerm == 10) { $tPass['mod_buttons'] = $tplt->phase($word, $e, 'mod_thread_dropdown', true); } unset($word); } if ($this->userID != '0') { $tPass['options_menu'] = null; $word['word_thread_options_button'] = get_awcsforum_word('word_thread_options_button'); $tPass['thread_options'] = $tplt->phase($word, $tPass, 'options_dropdown', true); } else { $tplt->kill('options_dropdown'); $tPass['thread_options'] = null; } # $tPass['page_jumps'] // is set above... $html = $tplt->phase($word, $tPass, 'thread_header', true); unset($info, $word, $tPass); #awc_pdie($tplt_info); } else { // single Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'sc/id' . $r->cat_id . '">' . $r->cat_name . '</a>'); Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'sf/id' . $r->f_id . '">' . $r->f_name . '</a>'); Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'st/id' . $r->t_id . '">' . awcsforum_funcs::awc_html_entity_decode($r->t_name) . '</a>', TRUE); $e = array(); $e['tID'] = $r->p_threadid; $e['fID'] = $r->f_id; $e['cID'] = $r->cat_id; $tPass['page_jumps'] = "<b><a href='" . awc_url . "st/id" . $r->t_id . "'>" . get_awcsforum_word('click_here_for_full_thread') . "</a></b>"; $tPass['thread_options'] = null; $html = $tplt->phase($word, $tPass, 'thread_header', true); Set_AWC_Forum_SubTitle($r->t_name, get_awcsforum_word('single_post_sub_title'), $e); } if ($r->t_poll and !$single_post) { $poll = $post_cls->display_poll($tID); $html = $poll . $html; } } // unset($_SESSION['awc_nActive'][$r->p_id]); #if($r->p_wikipage_id != '0') $p_wikipage_id[] = $r->p_wikipage_id ; $post_cls->load_post_phase_info($r); // awc_pdie($post_cls); $html .= $post_cls->display_post(); } # end SQL loop... unset($post_cls); if ($i == 0) { return; } $dbr->freeResult($res); unset($dbr, $res, $r); /* if($this->cf_add_post_text_to_wiki){ $dbw = wfGetDB( DB_MASTER ); $wp_ids = implode(',',$p_wikipage_id); $wiki_page = $dbw->tableName( 'page' ); $dbw->query( "UPDATE {$wiki_page} SET page_counter = page_counter + 1 WHERE page_id IN ($wp_ids)" ); } */ # unset($r, $this, $user_get, $ex, $sql); if (!$single_post and strlen($sql2) == 0) { $total_thread_count = $i; $thread_title_for_search = $thread_title; $yes = false; # $awc_ViewForum = $_COOKIE['awc_forum_ThreadView'] ; $awc_ViewForum = isset($_COOKIE['awc_forum_ThreadView']) ? $_COOKIE['awc_forum_ThreadView'] : null; $spl = explode(",", $awc_ViewForum); foreach ($spl as $fid) { if ($tID == $fid) { $yes = true; } } if (!$yes) { $dbw = wfGetDB(DB_MASTER); $dbw->query("UPDATE {$awc_tables['awc_f_threads']} SET t_hits = t_hits + 1 WHERE t_id = {$tID}"); $expir = $this->cookie_expir; if ($expir >= 1) { $expir = $expir * 60 * 60; } $exp = time() + $expir; # $exp = time() + $wgCookieExpiration; setcookie('awc_forum_ThreadView', $awc_ViewForum . "," . $tID, $exp, $wgCookiePath, $wgCookieDomain); #$_SESSION['awc_forum_ThreadView'] = $awc_ViewForum ; unset($dbw); } # die($LimitJump_top); # $html = $e['html']; $info['page_jumps'] = $LimitJump_bot ? $LimitJump_bot : null; $info['BreadCrumb'] = $BreadCrumb; $html .= $tplt->phase('', $info, 'bottom_page_jumps', true); } $wgOut->addHTML($html); //forum-wiki-perm //if ($awcUser->canPost AND $t_status == "0" || UserPerm >= 2 && $i AND !$single_post){ if ((strlen($sql2) == 0 and $awcUser->canPost and $this->forum_perm_can_post and $t_status == "0" and !$single_post) || (UserPerm >= 2 && $i and !$single_post)) { require awc_dir . '/includes/post_box.php'; $posting_box = new awcs_forum_posting_box(); $posting_box->quick_box = true; $posting_box->f_posting_mesage_tmpt = strlen($f_posting_mesage_tmpt) > 1 ? add_tmpl_to_skin($f_posting_mesage_tmpt) : null; #$posting_box->Thread_Title = awcsforum_funcs::awc_html_entity_decode($thread_title); $posting_box->Thread_Title = awcsforum_funcs::awc_htmlentities($thread_title); $posting_box->tbRows = $this->quick_height; $posting_box->Show_ann_sticky_lock = false; $posting_box->f_name = urlencode($f_name); $posting_box->fID = $fID; $posting_box->tID = $tID; $posting_box->t_wiki_pageid = $t_wiki_pageid; $posting_box->javaCheck = 'onsubmit="return check_quickPost()"'; $posting_box->url = awc_url . 'post/todo_' . urlencode('add_post'); //awc_pdie($subscribe_info); if (!$awcUser->guest) { $posting_box->subscribed_email = $subscribe_info['values']['subscribed_email']; $posting_box->subscribed_list = $subscribe_info['values']['subscribed_list']; $posting_box->subscribed_no = $subscribe_info['values']['subscribed_no']; } $html = $posting_box->box(); unset($posting_box); $wgOut->addHTML($html); } return; }
function mem_profile($action) { global $wgOut, $rev_timestamp, $awc, $wgOut, $wgParser, $WhoWhere, $tplt, $awcs_forum_config, $wgScriptPath, $awcUser; // require(awc_dir . 'skins/members_skin.php'); // $skin_mem = New mem_skin(); require_once awc_dir . 'includes/post_phase.php'; require_once awc_dir . 'includes/thread_funk.php'; $post_cls = new awcs_forum_post_phase(); $WhoWhere = $action; $WhoWhere['type'] = 'forum'; $WhoWhere['where'] = $action . '||awc-split||' . $action; # die($action); $spl = explode("/", $action); if (isset($spl[1])) { $mem_name = $spl[1]; $mem_id = $spl[2]; } else { return awcs_forum_error(''); } $user_get = array('*'); $mem_page = array(); $mem_page = GetMemInfo($mem_id, $user_get); if ($mem_id == 0 and UserPerm != 10) { $mem_name = get_awcsforum_word('word_guest'); } #$out = $wgOut->parse($info); $mem_page['body'] = awc_clean_wikipase($wgOut->parse('[[User:'******'|' . get_awcsforum_word('edit') . ']]')) . ' '; # $mem_page['body'] = str_replace('User:'******'User:'******'&action=edit', $mem_page['body']); $mem_page['body'] .= awc_clean_wikipase($wgOut->parse('[[User_talk:' . $mem_name . '|' . get_awcsforum_word('word_discussion') . ']]')) . '<hr>'; $mem_page['body'] = str_replace('action=edit', 'awc_redirect=' . $mem_id . '&action=edit', $mem_page['body']); $mem_page['body'] = str_replace('action=edit', 'awc_mem_redirect=' . $mem_name . '&action=edit', $mem_page['body']); # die($mem_page['body']); # $post = awc_wikipase($post, $wgOut) ; $GetWikiPage_body = GetWikiPage('<wiki>' . $mem_name . '</wiki>', '', '2', $mem_id); $post_cls->displaysmiles = '0'; $post_cls->convert_wTitle = '0'; $GetWikiPage_body = $post_cls->phase_post($GetWikiPage_body, '', false); // die(awcsforum_funcs::convert_date($rev_timestamp, 'l')); /* $GetWikiPage_body = convert_pre($GetWikiPage_body); $GetWikiPage_body = remove_forum_tag_from_post($GetWikiPage_body); $GetWikiPage_body = br_convert($GetWikiPage_body); $GetWikiPage_body = awc_wikipase($GetWikiPage_body, $wgOut) ; */ $mem_page['body'] .= $GetWikiPage_body; $post = str_replace('</a>', '</a>', $mem_page['body']); $post = str_replace('<a href', '<a href', $post); $post = str_replace('">', '">', $post); $mem_page['body'] = $post; // needs to be in the loop to check against each post for other extensions triggered foreach ($wgParser->mOutput->mHeadItems as $k_ID => $mHeadItems) { $wgOut->addHeadItem($k_ID, $mHeadItems); } $Pass['body_info'] = isset($mem_page['body']) ? $mem_page['body'] : ' '; $Pass['sig'] = isset($mem_page['m_sig']) ? $post_cls->phase_post($mem_page['m_sig'], '', false) : ' '; $Pass['group '] = isset($mem_page['group']) ? $mem_page['group'] : null; $Pass['m_topics'] = $awcs_forum_config->cf_showThreadCount == '1' ? isset($mem_page['m_topics']) ? get_awcsforum_word('word_threads') . ' <a href="' . awc_url . 'search/memtopics/' . urlencode($mem_page['name']) . '/' . $mem_id . '">' . $mem_page['m_topics'] . '</a>' : null : null; $Pass['m_posts'] = $awcs_forum_config->cf_showPostCount == '1' ? isset($mem_page['m_posts']) ? get_awcsforum_word('word_posts') . ' <a href="' . awc_url . 'search/memposts/' . urlencode($mem_page['name']) . '/' . $mem_id . '">' . $mem_page['m_posts'] . '</a>' : null : null; $Pass['m_pm'] = $awcUser->guest == '0' ? get_awcsforum_word('word_send') . ' <a href="' . awc_url . 'member_options/pmnew/' . $mem_page['name'] . '">' . get_awcsforum_word('word_pm') . '</a>' : null; $Pass['wikiedits'] = isset($mem_page['edit_count']) ? get_awcsforum_word('word_postsWikiedits') . ' <a href="' . awcsf_wiki_url . 'Special:Contributions/' . $mem_page['name'] . '">' . $mem_page['edit_count'] . '</a>' : get_awcsforum_word('word_postsWikiedits') . ' <a href="' . awcsf_wiki_url . 'Special:Contributions/' . $mem_page['name'] . '">0</a>'; $m_adv = isset($mem_page['m_adv']) ? 1 : 0; if ($m_adv == 0 || empty($mem_page['m_adv'])) { $m_adv = 1; $AvatraSize = explode('x', $awcs_forum_config->cf_AvatraSize); if ($mem_page['m_topics'] == '0' and $mem_page['m_posts'] == '0') { $mem_page['m_adv'] = "{$wgScriptPath}" . awcForumPath . "images/avatars/avatar_guest.gif"; $mem_page['m_advw'] = $AvatraSize[0]; $mem_page['m_advh'] = $AvatraSize[1]; $this->pm_enable = 0; } else { $mem_page['m_adv'] = "{$wgScriptPath}" . awcForumPath . "images/avatars/avatar_default.gif"; $mem_page['m_advw'] = $AvatraSize[0]; $mem_page['m_advh'] = $AvatraSize[1]; } } $Pass['m_adv'] = ($m_adv == 1 and $mem_page['m_adv'] != '') ? '<DIV align="center"><img class="adv" src="' . $mem_page['m_adv'] . '" border="0" height="' . $mem_page['m_advh'] . '" width="' . $mem_page['m_advw'] . '" align="middle"/></div>' : null; $Pass['avatarwidth'] = $mem_page['m_advw']; $out = $tplt->phase('', $Pass, 'mem_profile_table', true); Set_AWC_Forum_SubTitle(get_awcsforum_word('mem_profile') . $mem_name, get_awcsforum_word('mem_lastmod') . " " . awcsforum_funcs::convert_date($rev_timestamp, 'l')); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('mem_profile') . ' ' . $mem_name, true); $wgOut->addHTML($out); # $dbr = wfGetDB( DB_SLAVE ); }
function poll_add($no_redirect = false) { global $wgRequest; if ($this->polls_enabled != '1') { return ''; } $preview = $wgRequest->getVal('preview'); if (strlen($preview) > 0) { global $wgOut; require_once awc_dir . 'includes/post_phase.php'; return $wgOut->addHTML(awcs_forum_post_phase::display_poll('', true)); } $p['poll_info'] = array(); $p['poll_info']['ispoll'] = 'checked'; $p['poll_info']['pollq'] = trim(self::CleanThreadTitle($wgRequest->getVal('pollq'))); if ($p['poll_info']['pollq'] == '') { return awcs_forum_error(get_awcsforum_word('blank_poll_warning')); } $opt = null; foreach ($_POST as $k => $v) { if (!empty($v)) { if (strstr($k, 'poll_opt')) { ++$opt; if (trim(self::CleanThreadTitle($v)) != '') { $p['poll_info']['poll_options']['poll_opt' . $opt] = trim(self::CleanThreadTitle($v)); } } } } /* // $wgRequest - does not work correctly with MW 1.9, Using the above $_POST does foreach($wgRequest as $k => $v){ if(!empty($v) AND is_array($v)){ foreach($v as $k2 => $v2){ if(strstr($k2,'poll_opt')){ ++$opt; if(trim(self::CleanThreadTitle($v[$k2])) != '') $p['poll_info']['poll_options']['poll_opt' . $opt] = trim(self::CleanThreadTitle($v[$k2])); } } } } */ if (count($p['poll_info']['poll_options']) < 2) { return awcs_forum_error(get_awcsforum_word('blank_poll_option')); } wfRunHooks('awcsforum_add_newpoll', array(&$this, &$p)); // 2.5.5 $wDB = wfGetDB(DB_MASTER); $wDB->insert('awc_f_polls', array('poll_threadid' => $this->tID, 'poll_forumid' => $this->fID, 'poll_q' => $p['poll_info']['pollq'], 'poll_num_options' => '1', 'poll_choice' => serialize($p['poll_info']['poll_options']), 'poll_a' => '1', 'poll_open' => '1', 'poll_start_date' => '1', 'poll_close_date' => '1', 'poll_perm' => '1')); $wDB->update('awc_f_threads', array('t_poll' => '1', 't_pollopen' => 1), array('t_id' => $this->tID), ''); if ($no_redirect) { return; } $info['msg'] = 'poll_has_been_add'; $info['url'] = awc_url . "st/id" . $this->tID; return awcf_redirect($info); }
function pm_send() { global $wgRequest, $wgOut, $awc_tables, $action_url; $preview = $wgRequest->getVal('preview'); $post = $wgRequest->getVal('wpTextbox1'); $title = $wgRequest->getVal('t_title'); $send_to = $wgRequest->getVal('send_to'); #$savetosent = $wgRequest->getVal( 'savetosent' ); $savetosent = $wgRequest->getVal('savetosent'); $savetosent = $savetosent == 'on' ? 'checked' : ''; $sendto_ids = array(); $sendto_names = null; $sendto = explode(';', $send_to); $sendto = array_map('trim', $sendto); if ((UserPerm == 2 and count($sendto) > $this->modPMsendlimit) || (UserPerm == 1 and count($sendto) > $this->userPMsendlimit)) { $preview = true; $l = null; UserPerm == 2 ? $l = $this->modPMsendlimit : ($l = $this->userPMsendlimit); $info['error'] = get_awcsforum_word('mem_pm_sendtomanypeople') . ' ' . $l; } $dbr = wfGetDB(DB_SLAVE); if (strlen($preview) == 0) { $info['error'] = null; $user_table = $dbr->tableName('user'); if (!isset($awcUser->mem_send_pm_body_in_email) or $awcUser->mem_send_thread_body_in_email == '0') { $this->cf_send_post_body_in_email = 0; } foreach ($sendto as $n => $user) { $sql = "SELECT w.user_id, w.user_email, f.m_pmoptions, f.m_idname \r\r\n FROM {$user_table} w\r\r\n LEFT JOIN {$awc_tables['awc_f_mems']} f\r\r\n ON w.user_name=f.m_idname\r\r\n WHERE w.user_name='" . $user . "'\r\r\n LIMIT 1"; $res = $dbr->query($sql); $r = $dbr->fetchRow($res); if (!isset($r['user_id'])) { $sql = "SELECT w.user_id, w.user_email, f.m_pmoptions, f.m_idname \r\r\n FROM {$user_table} w\r\r\n LEFT JOIN {$awc_tables['awc_f_mems']} f\r\r\n ON w.user_name=f.m_idname\r\r\n WHERE w.user_name='" . str_replace('_', ' ', $user) . "'\r\r\n LIMIT 1"; $res = $dbr->query($sql); $r = $dbr->fetchRow($res); } if (!isset($r['user_id'])) { $info['error'] .= get_awcsforum_word('mem_pm_sendnouserbythatname') . ' ' . $user . '<br />'; $preview = true; } else { $sendto_names .= ', ' . $user; $pmoptions = isset($r['m_pmoptions']) ? unserialize($r['m_pmoptions']) : 'no_email'; $sendto_ids[$r['user_id']]['forum_username'] = isset($r['m_idname']) ? $r['m_idname'] : 'no_name'; $sendto_ids[$r['user_id']]['pass_pm_text'] = '0'; if ($pmoptions != 'no_email') { if ($pmoptions['m_pmnewemail'] == '1' and isset($r['user_email']) and !empty($r['user_email'])) { $sendto_ids[$r['user_id']]['email'] = $r['user_email']; $sendto_ids[$r['user_id']]['pass_pm_text'] = $pmoptions['m_pm_text_in_email']; } else { $sendto_ids[$r['user_id']]['email'] = 'no_email'; } } else { $sendto_ids[$r['user_id']]['email'] = 'no_email'; } $sendto_ids[$r['user_id']]['name'] = $user; $sendto_ids[$r['user_id']]['id'] = $r['user_id']; } $dbr->freeResult($res); } } if (strlen($preview) > 1 or strlen($info['error']) > 1) { Set_AWC_Forum_SubTitle(get_awcsforum_word('mem_memCP'), $this->membername); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('mem_pm_sendpm'), true); if (strlen($info['error']) > 1) { $out['body_info'] .= "<br /><b><center>" . $info['error'] . "</center></b><br /><hr />"; } $post_cls = new awcs_forum_post_phase(); $post_box = new awcs_forum_posting_box(); $post_cls->p_userid = $this->m_id; $post_cls->p_user = $this->membername; $post_cls->p_title = $title; $post_cls->p_post = $post; $post_cls->p_date = $dbr->timestamp(); $post_cls->p_id = $r['pm_id']; $post_cls->only_one_post = true; $post_cls->pm_links = null; $out['body_info'] .= $post_cls->display_post(true); $m_pmautosave = get_awcsforum_word('mem_pm_savesenttosavesfolder') . '<INPUT TYPE=CHECKBOX NAME="savetosent" ' . $savetosent . '><br />'; $post_box->user_options = $m_pmautosave; $post_box->is_pm = true; $post_box->post = $post; $post_box->title = $title; $post_box->thread_subscribe = false; $post_box->quick_box = false; $post_box->box_width = "75%"; $post_box->javaCheck = 'onsubmit="return check_NewThread()"'; $post_box->url = awc_url . 'member_options/sendpm'; $post_box->mem_pm_sendto = get_awcsforum_word('mem_pm_sendto'); $post_box->mem_pm_sendto .= ' <input name="send_to" id="send_to" type="text" value="' . $send_to . '" size="75%"><hr />'; $post_box->mem_pm_sendto .= "<div id='ajax_pmnames' name='ajax_pmnames'></div>"; // 2.5.8 $post_box->mem_pm_sendto .= get_awcsforum_word('words_send_to_multi_users') . ' '; if (UserPerm < 2) { $post_box->mem_pm_sendto .= $awcs_forum_config->cf_mem_maxpmsendusers . '<hr />'; } else { $post_box->mem_pm_sendto .= $awcs_forum_config->cf_mod_maxpmsendusers . '<hr />'; } $out['body_info'] .= $post_box->box(); return self::display_memcp($out['body_info']); } $sendto_names = substr($sendto_names, 1); require awc_dir . 'pm.php'; #die(print_r($sendto_ids)); awcforum_pm::sendpm($sendto_ids, $title, $post, $savetosent, $sendto_names); }
function check_msg_len($msg, $len) { if (function_exists('mb_strlen')) { $str_len = 'awc_mbstrlen'; } else { $str_len = 'awcsforum_funcs::awc_strlen'; } if ($str_len($msg) > $len and $len != '0') { if (function_exists('mb_substr')) { $msg = awcsforum_funcs::awc_shorten($msg, $len); } else { $msg = substr($msg, 0, $len); } } require_once awc_dir . 'includes/post_phase.php'; $post_phase = new awcs_forum_post_phase(); $post_phase->convert_wTitle = 0; $post_phase->displaysmiles = 1; $msg = $post_phase->phase_post($msg, 0, false); return $msg; }
function poll($input, $argv) { if (version_compare(awcs_forum_ver_current, awcs_forum_ver, '<')) { return; } if (!isset($argv['id']) or empty($argv['id'])) { return true; } static $here_count; ++$here_count; global $awcs_forum_config, $wgOut, $awcUser, $awcsf_wiki_css_set; if ($here_count == '1') { global $wgHooks; $wgHooks['BeforePageDisplay'][] = 'AWC_FORUMS_POLL_DECODE_BeforePageDisplay'; require_once awc_dir . 'includes/post_phase.php'; // awcsforum_funcs::get_page_lang(array('lang_txt_thread')); // get lang difinitions... awcs_forum_wfLoadExtensionMessages('AWCforum_poll_tag'); global $awc_lang; $awc_lang['word_poll_question'] = wfMsg('awcsf_word_poll_question'); $awc_lang['word_total_votes'] = wfMsg('awcsf_word_total_votes'); $awc_lang['word_votes'] = wfMsg('awcsf_word_votes'); $awc_lang['word_total_percent'] = wfMsg('awcsf_word_total_percent'); $awc_lang['word_poll_option'] = wfMsg('awcsf_word_poll_option'); $awc_lang['word_vote'] = wfMsg('awcsf_word_submit'); if ($awcsf_wiki_css_set != 'yes') { $dbr = wfGetDB(DB_SLAVE); $awc_f_theme_css = $dbr->tableName('awc_f_theme_css'); $sql = "SELECT css_code, css_att\n FROM {$awc_f_theme_css}\n WHERE css_thmn_id = {$awcs_forum_config->cf_css_default} AND\n css_att IN ('.whos_here_row', '.whos_here', '.whos_here_header', '.pagejumps_PostOnForumPage') OR\n css_section = 'css_poll' LIMIT 0,25"; // die($sql); $css = '<style type="text/css">'; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { $css .= "{$r->css_att} {\n {$r->css_code} \n} \n"; } $css .= "\n .nothing {font-size: 0%;\n margin: .0em;\n border: 0;\n margin: 0;\n padding: 0;\n width: 0;}\n"; $css .= "</style>\n"; $wgOut->addScript($css); $awcsf_wiki_css_set = 'yes'; } } $tID = $argv['id']; #$p = new awcs_forum_post_phase(); $poll = awcs_forum_post_phase::display_poll($tID, null, $awcUser->mId); $poll = "@POLL@" . base64_encode($poll) . "@POLL@"; return $poll; }