function q_results($sql, $dbr) { global $wgOut, $LimitJump_top, $LimitJump_bot, $first_return, $todo, $tplt, $awcUser; $thread_tools = new awcs_forum_thread_list_tools(); $thread_tools->extra_column = true; $word_headers = array('replies' => get_awcsforum_word('word_replies'), 'views' => get_awcsforum_word('views'), 'last_action' => get_awcsforum_word('last_action'), 'started_by' => get_awcsforum_word('thread_title_started_by')); $word = array('started_by' => get_awcsforum_word('forum_started_by')); $sql = str_replace('AND AND', ' AND ', $sql); $sql = str_replace('WHERE AND', 'WHERE ', $sql); #die($sql); $res = $dbr->query($sql); $r = $dbr->fetchRow($res); $total = $dbr->numRows($res); $dbr->freeResult($res); $this->total = $total; $send['TotalPosts'] = $total; $limit = GetLimit($send, 'search'); $i = 0; $tmp = ''; $dbr = wfGetDB(DB_SLAVE); #awcsforum_funcs::limitSplit($limit); #die($limit); #$res = $dbr->query($sql . ' ' . $limit); require_once awc_dir . 'dBase.php'; $dbase = new awcforum_cls_dBase(); $limit = $dbase->limit($limit); $res = $dbr->query("{$sql} {$limit}"); while ($r = $dbr->fetchObject($res)) { // ++$i; $to_skin = $thread_tools->loop_thread_list($r); $e['NewPost'] = $thread_tools->new_thread_check($r->t_id, $r->t_lastdate); if ($todo == 'recent') { if (isset($e['NewPost']) and strlen($e['NewPost']) > 0) { ++$i; $thread_tools->link = awc_url; $thread_tools->tID = $r->t_id; $thread_tools->total_posts = $r->t_topics; $to_skin['search_words'] = ''; $tmp .= $tplt->phase($word, $to_skin, 'thread_list_rows'); } } else { ++$i; $thread_tools->link = awc_url; $thread_tools->tID = $r->t_id; $thread_tools->total_posts = $r->t_topics; $to_skin['search_words'] = ''; $tmp .= $tplt->phase($word, $to_skin, 'thread_list_rows'); } unset($e); } $dbr->freeResult($res); if ($LimitJump_top) { #kw $tID = isset($this->tID) ? '/tID' . $this->tID : null; $fID = isset($this->fID) ? '/fID' . $this->fID : null; $cID = isset($this->cID) ? '/cID' . $this->cID : null; $what = isset($this->what) ? '/what' . $this->what : null; $this->searchword = str_replace(' ', '_', $this->searchword); # die($LimitJump); # $this->fID = $wgRequest->getVal('fID'); # $this->cID = $wgRequest->getVal('cID'); # $LimitJump = $LimitJump . "/kw:$this->searchword$tID$fID$cID"; # die(">". print_r($LimitJump) ); if ($first_return) { $LimitJump_bot = str_replace('limit:', "kw:{$this->searchword}{$tID}{$fID}{$cID}{$what}" . '/limit:', $LimitJump_bot); $LimitJump_top = str_replace('limit:', "kw:{$this->searchword}{$tID}{$fID}{$cID}{$what}" . '/limit:', $LimitJump_top); } $LimitJump = '<tr><td width="100%" colspan="6" align="right" class="page_jumps_holderBot">' . $LimitJump_bot . '</td></tr>'; } else { $LimitJump_top = null; $LimitJump = null; } $to_tplt['col_5_isSearch_forum_name'] = '<td class="thread_col_head" width="20%" align="center" nowrap="nowrap">' . get_awcsforum_word('word_forum') . '</td>'; $to_tplt['tr_id'] = ''; $to_tplt['first_col_name'] = get_awcsforum_word('thread_title'); $html = $tplt->phase($word_headers, $to_tplt, 'thread_list_header'); $html .= $tmp . $LimitJump; $html .= '</table>'; if (!$this->searchword) { $this->searchword = $this->MemSearch; } $end = ''; if ($this->what == 'c') { $end = ', ' . get_awcsforum_word('word_inCat') . ' ' . $cat_name . ''; } if ($this->what == 'f') { $end = ', ' . get_awcsforum_word('word_inForum') . ' ' . $cat_name . '/' . $forum_name . ''; } if ($this->what == 't') { $end = ', ' . get_awcsforum_word('word_inThread') . ' ' . $thread_name; } $title = str_replace("|\$|", $i, get_awcsforum_word('search_SearchResultsFound')) . ": {$this->searchword}" . $end; /* broken... $read_threads = (isset($_SESSION['awc_rActive'])) ? count($_SESSION['awc_rActive']) : 0; if($this->todo == 'search/recent/') $this->total = ($this->total - $read_threads) ; */ if ($this->todo == 'search/recent/') { $this->total = ''; } Set_AWC_Forum_SubTitle('(' . $this->total . ') ' . get_awcsforum_word('search_SearchResults'), $title); Set_AWC_Forum_BreadCrumbs($this->searchword, true); # $str = $wgOut->parse($html); $wgOut->addHTML($html); return; }
function threadsubscribe($where = '') { global $wgOut, $awc, $awc_tables, $tplt; $thread_tools = new awcs_forum_thread_list_tools(); $tplt->add_tplts(array("'memcp_recent_header'", "'memcp_recent_row'", "'memcp_recent_close'", "'postblocks_threadlisting'"), true); $words = array(); $words['thread_title'] = get_awcsforum_word('thread_title'); $words['word_replies'] = get_awcsforum_word('word_replies'); $words['last_action'] = get_awcsforum_word('last_action'); $words['thread_title_started_by'] = get_awcsforum_word('thread_title_started_by'); $words['delete'] = get_awcsforum_word('delete'); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('mem_subscriptionthread')); if (function_exists('bcmod')) { $row_class = 1; } else { $row_class = 0; } $html = '<form action="' . awc_url . 'member_options/delete_tsub" method="post" enctype="multipart/form-data">'; $html .= $tplt->phase($words, '', 'memcp_recent_header', true); $dbr = wfGetDB(DB_SLAVE); if ($where == 'list') { Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_subscribe_memcp'), true); $sql = "SELECT w.wtcht_todo, t.t_postid, t.t_id, t.t_topics, t.t_lastdate, t.t_name, t.t_starterid, t.t_starter, t.t_lastuser, t.t_lastuserid\r\r\n FROM {$awc_tables['awc_f_watchthreads']} w, {$awc_tables['awc_f_threads']} t \r\r\n WHERE w.wtcht_todo='list' AND t.t_id=w.wtcht_thread_id AND w.wtcht_mem_id=" . $this->m_id . " ORDER BY t.t_lastdate DESC"; } elseif ($where == 'email') { Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_subscribe_email'), true); $sql = "SELECT w.wtcht_todo, t.t_postid, t.t_id, t.t_topics, t.t_lastdate, t.t_name, t.t_starterid, t.t_starter, t.t_lastuser, t.t_lastuserid\r\r\n FROM {$awc_tables['awc_f_watchthreads']} w, {$awc_tables['awc_f_threads']} t \r\r\n WHERE w.wtcht_todo='email' AND t.t_id=w.wtcht_thread_id AND w.wtcht_mem_id=" . $this->m_id . " ORDER BY t.t_lastdate DESC"; } else { Set_AWC_Forum_BreadCrumbs('', true); $sql = "SELECT w.wtcht_todo, t.t_postid, t.t_id, t.t_topics, t.t_lastdate, t.t_name, t.t_starterid, t.t_starter, t.t_lastuser, t.t_lastuserid\r\r\n FROM {$awc_tables['awc_f_watchthreads']} w, {$awc_tables['awc_f_threads']} t \r\r\n WHERE t.t_id=w.wtcht_thread_id AND w.wtcht_mem_id=" . $this->m_id . " ORDER BY t.t_lastdate DESC"; } $res = $dbr->query($sql); $c = 0; while ($r = $dbr->fetchObject($res)) { $info['t_id'] = $r->t_id; $info['t_name'] = awcsforum_funcs::awc_html_entity_decode($r->t_name); $info['t_topics'] = $r->t_topics; $info['t_starter'] = $r->t_starter; $info['t_starterid'] = $r->t_starterid; $info['last'] = '<a href="' . awc_url . 'last_post/' . $r->t_id . '">' . awcsforum_funcs::convert_date($r->t_lastdate, "s") . '</a>'; /* if($awcUser->guest == false){ $info['NewPost'] = awcs_forum_CheckIfThreadIsNew($r->t_id, $r->t_lastdate); } else { $info['NewPost'] = null; } */ $info['NewPost'] = $thread_tools->new_thread_check($r->t_id, $r->t_lastdate); $info['url'] = awc_url . 'st/' . $r->t_id; if ($where == 'email' or $where == 'list') { $info['wtcht_todo'] = null; } else { $info['wtcht_todo'] = $r->wtcht_todo; } $thread_tools->link = awc_url; $thread_tools->tID = $r->t_id; $thread_tools->total_posts = $r->t_topics; $info['t_jump'] = $thread_tools->GetThreadPostLimit(); $c++; if ($row_class) { $info['row_class'] = 'thread_rows' . bcmod($c, '2'); } else { $info['row_class'] = 'thread_rows'; } $html .= $tplt->phase($words, $info, 'memcp_recent_row'); } $dbr->freeResult($res); $tplt->kill('memcp_recent_row'); $html .= $tplt->phase($words, '', 'memcp_recent_close', true); $html .= '</form>'; self::display_memcp($html); }