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 awcs_forum_threads($action) { $threads = new awcforum_threads(); $threads->enter_threads($action); }
function add_single_post($no_redirect = false) { global $awc_tables, $ForumStat, $awcUser; $wDB = wfGetDB(DB_MASTER); $t_lastdate = $wDB->timestamp(); wfRunHooks('awcsforum_add_newpost', array(&$this)); // 2.5.5 #$bs = $dbw->nextSequenceValue( 'awc_f_posts_p_id_seq' ); $p_wiki_hidden = $wDB->timestamp(); $wDB->insert('awc_f_posts', array('p_threadid' => $this->tID, 'p_post' => $this->post, 'p_title' => $this->p_title, 'p_user' => $this->cur_memName, 'p_userid' => $this->cur_memID, 'p_date' => $t_lastdate, 'p_editdate' => $t_lastdate, 'p_forumid' => $this->fID, 'p_wiki_hidden' => $p_wiki_hidden)); $pid = awcsforum_funcs::lastID($wDB, 'awc_f_posts', 'p_id'); $_SESSION['awc_rActive'][$this->tID] = $t_lastdate; //$_SESSION['awc_rActive'][$pid] = $pid; //unset($_SESSION['awc_nActive'][$pid]); // add to wiki dbase if ($this->cf_add_post_text_to_wiki) { require_once awc_dir . 'includes/to_wiki_dbase.php'; $ws = new awcs_forum_wikisearch_cls(); $ws->post = $this->post; $ws->title = $this->p_title; $ws->rev_comment = strlen($this->p_title) > 0 ? $this->p_title : ''; $ws->tID = $this->tID; $ws->pID = $pid; $ws->pageID = $this->t_wiki_pageid; $ws->p_wiki_hidden = $p_wiki_hidden; $ws->add_post(); } $time_now = $wDB->timestamp(); /* $wDB->query( "UPDATE {$awc_tables['awc_f_threads']} as t JOIN {$awc_tables['awc_f_forums']} as f ON t.forum_id=f.f_id SET t.t_topics = t.t_topics + 1, t.t_postid ='". $pid ."', t.t_lastdate = $time_now, t.t_lastuser = '******', t.t_lastuserid = ". $this->cur_memID .", f.f_replies = f.f_replies + 1, f.f_lastdate = $time_now, f.f_lastuser = '******', f.f_lastuserid = ". $this->cur_memID .", f.f_lasttitle = '". $this->ThreadTitle ."', f.f_threadid = '". $this->tID ."' WHERE t_id = $this->tID"); */ $wDB->query("UPDATE {$awc_tables['awc_f_threads']} \r\r\n SET t_topics = t_topics + 1,\r\r\n t_postid =" . $pid . ",\r\r\n t_lastdate = '" . $wDB->timestamp() . "',\r\r\n t_lastuser = '******',\r\r\n t_lastuserid = " . $this->cur_memID . "\r\r\n WHERE t_id = " . $this->tID); # include_once(awc_dir . 'includes/mod_post.php'); # awcs_forum_mod_post::update_forum_last_thread($this->fID); $wDB->query("UPDATE {$awc_tables['awc_f_forums']} \r\r\n SET f_replies = f_replies + 1,\r\r\n f_lastdate = '" . $wDB->timestamp() . "',\r\r\n f_lastuser = '******',\r\r\n f_lastuserid = " . $this->cur_memID . ",\r\r\n f_lasttitle = '" . $this->ThreadTitle . "',\r\r\n f_threadid = '" . $this->tID . "'\r\r\n WHERE f_id =" . $this->fID); $m_topics = $this->cur_m_topics; $m_posts = $this->cur_m_posts; $name = $this->cur_memName; // die("cur_memID=$this->cur_memID, m_posts = $m_posts, m_topics = $m_topics"); if ($this->cur_memID != '0') { $wDB->update('awc_f_mems', array('m_posts' => $m_posts + 1), array('m_idname' => $this->cur_memName), ''); } if (isset($ForumStat)) { $ForumStat->stat_posts(1); } require_once awc_dir . 'includes/subscribe.php'; $t_subscribe = new awcs_forum_subscribe(); $t_subscribe->fID = $this->fID; $t_subscribe->tID = $this->tID; $t_subscribe->cur_memID = $this->cur_memID; $t_subscribe->subscribe = $this->subscribe; $t_subscribe->title = $this->ThreadTitle; # die($this->ThreadTitle); $t_subscribe->post = $this->post; $t_subscribe->m_thread_subsrib = $this->m_thread_subsrib; $t_subscribe->m_forum_subsrib = $this->m_forum_subsrib; wfRunHooks('awcsforum_add_newpost_thread_subscribe', array(&$t_subscribe, &$this)); // 2.5.5 $t_subscribe->check_user_thread_subscribe(); if ($no_redirect) { return; } require_once awc_dir . 'thread.php'; $info['msg'] = 'post_has_been_add'; $awcforum_threads = new awcforum_threads(); $info['url'] = $awcforum_threads->get_latest_post($this->tID, true); #$info['url'] = awc_url . "last_post/id{$this->tID}"; #awc_pdie($info); return awcf_redirect($info); }