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; }
/** * * @change 2.5.8 */ function loop_thread_list($r) { global $row_class; ++$this->thread_count; $info['poll'] = $r->t_poll; $info['ann'] = $r->t_ann; $info['sticky'] = $r->t_pin; $info['locked'] = $r->t_status; $info['t_id'] = $r->t_id; $tID = $info['t_id']; $info['t_name'] = awcsforum_funcs::awc_html_entity_decode($r->t_name); $info['t_name'] = str_replace('%', '%', $info['t_name']); // die(">" . $this->show_guest_ip); if ($this->show_guest_ip == '0' and $r->t_lastuserid == '0' and UserPerm < 2) { $info['user'] = $this->words['guest']; } else { $info['user'] = $r->t_lastuser; } // $info['user'] = $r->t_lastuser ; $info['userid'] = $r->t_lastuserid; $info['link'] = awc_url; if ($this->thread_count % 2) { $info['row_class'] = 'thread_rows0'; } else { $info['row_class'] = 'thread_rows1'; } $to_tplt = self::Check_ShowForumRows($info); $to_tplt['mem_url'] = awcsforum_funcs::awcforum_url("mem_profile/{$r->t_starter}/{$r->t_starterid}"); // $to_tplt['thread_title'] = awcsforum_funcs::awc_html_entity_decode($info['t_name']); $to_tplt['mod'] = (UserPerm >= 2 and $r->t_ann != '1') ? '<INPUT type="checkbox" name="tID[]" value="' . $info['t_id'] . '">' : null; $to_tplt['col_5_isSearch_forum_name'] = ''; $to_tplt['t_starter'] = $r->t_starter; if ($this->show_guest_ip == '0' and $r->t_starterid == '0' and UserPerm < 2) { $to_tplt['t_starter'] = $this->words['guest']; } $to_tplt['t_topics'] = $r->t_topics; $to_tplt['t_hits'] = $r->t_hits; $to_tplt['last'] = '<a href="' . awc_url . 'last_post/id' . $r->t_id . '">' . awcsforum_funcs::convert_date($r->t_lastdate, "s") . '</a>'; $to_tplt['user'] = $info['user']; $to_tplt['NewPost'] = self::new_thread_check($r->t_id, $r->t_lastdate); $this->link = awc_url; $this->tID = $r->t_id; $this->total_posts = $r->t_topics; $to_tplt['jump'] = self::GetThreadPostLimit(); if ($this->extra_column) { if (!isset($tplt)) { global $tplt; } $to_tplt['forum_name'] = $r->f_name; $word['forum_name'] = $this->words['forums']; $to_tplt['col_5_isSearch_forum_name'] = $tplt->phase($word, $to_tplt, 'col_5_isSearch_forum_name'); // move } return $to_tplt; }
function Set_AWC_Forum_SubTitle($title, $sub = '', $extra = '') { global $wgOut, $tplt; #die($title); $title = strtr($title, "_", " "); $title = str_replace("'", "'", $title); $title = awcsforum_funcs::awc_html_entity_decode($title); if ($sub == '') { $sub = ' '; } $sub = awcsforum_funcs::awc_html_entity_decode($sub); //$sub = strtr($sub, "_", " "); // note - commented out on 3-23-09 if (CanSearch() and isset($extra) and !empty($extra)) { $info['url'] = awc_url; # awc_pdie($extra); $info['hidden_tID'] = isset($extra['tID']) ? '<input name="tID" type="hidden" value="' . $extra['tID'] . '">' : null; $info['hidden_fID'] = isset($extra['fID']) ? '<input name="fID" type="hidden" value="' . $extra['fID'] . '">' : null; $info['hidden_cID'] = isset($extra['cID']) ? '<input name="cID" type="hidden" value="' . $extra['cID'] . '">' : null; $info['drop_cID'] = isset($extra['cID']) ? '<option value="c">' . get_awcsforum_word('search_whatCat') . '</option>' : null; $info['drop_fID'] = isset($extra['fID']) ? '<option value="f">' . get_awcsforum_word('search_whatForum') . '</option>' : null; $info['drop_tID'] = isset($extra['tID']) ? '<option value="t">' . get_awcsforum_word('search_whatThread') . '</option>' : null; #awc_pdie($info); $word['search_search'] = get_awcsforum_word('search_search'); $word['search_whatAll'] = get_awcsforum_word('search_whatAll'); $search = $tplt->phase($word, $info, 'top_search_box'); } else { $search = ''; } $tplt->kill('top_search_box'); $wgOut->setPagetitle($title); $wgOut->setSubtitle($search . $sub); wfRunHooks('awcsforum_before_addKeyword', array(&$title, &$sub)); $wgOut->addKeyword($title . ' ' . $sub); unset($title, $search, $sub); }
function display_post($pm = false, $pm_links = null) { global $tplt; # awc_pdie($this); static $mem_Info = array(); static $word = array(); static $avatarwidth; $height_stuff = array('advar' => 0, 'memtitle' => 0, 'wikicount' => 0, 'postcount' => 0, 'threadcount' => 0); # awc_pdie($this); static $time_func_called = 0; ++$time_func_called; if ($time_func_called == 1) { $word = self::get_words(); if (isset($this->cf_AvatraSize)) { $spl = explode('x', $this->cf_AvatraSize); $avatarwidth = $spl[1] + '20'; } else { $avatarwidth = '135'; } } if ($pm == false) { // wfRunHooks( 'awcsforum_rawpost', array( &$this ) ); if ($time_func_called == 1) { $tplt_info['LimitJump'] = isset($extras['LimitJump_top']) ? $extras['LimitJump_top'] : null; $tplt_info['options_menu'] = isset($extras['options_menu']) ? $extras['options_menu'] : null; } } else { $edit_buttons['edit_buttons'] = $this->pm_links; $tplt_info['edit_buttons'] = $edit_buttons['edit_buttons']; $tplt_info['post_edited_on'] = null; } $tplt_info['avatarwidth'] = $avatarwidth; # Cache... Create array of Members info then check, cut down on queires on Sig and Group $HaveMemInfo = false; if (!empty($mem_Info)) { foreach ($mem_Info as $id => $value) { if ($mem_Info[$id]['m_id'] == $this->p_userid) { $HaveMemInfo = true; } } if (!$HaveMemInfo) { $mem_Info[$this->p_userid] = GetMemInfo($this->p_userid, $this->user_info_cols); } } else { $mem_Info[$this->p_userid] = GetMemInfo($this->p_userid, $this->user_info_cols); } # awc_pdie($mem_Info); $hook_user_info = array(); $hook_user_info['name'] = $this->p_user; $hook_user_info['id'] = $this->p_userid; foreach ($mem_Info as $id => $value) { // if($id != 2) awc_pdie(">". $id); //die("kk"); // if($id == 0){ if ($this->p_userid == 0) { // die(); $AvatraSize = explode('x', $this->cf_AvatraSize); $mem_Info[0]['m_adv'] = "{$this->wgScriptPath}" . awcForumPath . "/images/avatars/avatar_guest.gif"; $mem_Info[0]['m_advw'] = $AvatraSize[0]; $mem_Info[0]['m_advh'] = $AvatraSize[1]; $mem_Info[0]['edit_count'] = 0; $mem_Info[0]['m_posts'] = 0; $mem_Info[0]['m_topics'] = 0; $mem_Info[0]['edit_count'] = 0; $mem_Info[0]['member_title'] = ''; $to_skin['member_title'] = ''; $to_skin['edit_count'] = 0; $to_skin['m_posts'] = 0; $to_skin['m_topics'] = 0; $to_skin['m_advh'] = $mem_Info[0]['m_advh']; $to_skin['m_advw'] = $mem_Info[0]['m_advw']; $to_skin['m_adv'] = $mem_Info[0]['m_adv']; $tplt_info['group'] = ''; $to_skin['m_sig'] = ''; $mem_Info[0]['group'] = isset($mem_Info[$this->p_userid]['group']) ? $mem_Info[$this->p_userid]['group'] : ''; $mem_Info[0]['m_sig'] = ''; // if($this->p_post != 'guest') die($this->p_userid); } else { if (!isset($mem_Info[$id]['cached'])) { $mem_Info[$id]['cached'] = true; if ($mem_Info[$id]['m_id'] == $this->p_userid) { //$mem_Info[0]['member_title'] = ''; mem_post_title // die($this->p_userid); if ($this->viewing_mem_info['displaysigs'] == 1 or $awcUser->guest == '0' and $this->cf_SigGuestView) { $m_sig = $mem_Info[$id]['m_sig']; $m_sig = self::phase_post($m_sig, '', false); $to_skin['m_sig'] = $m_sig; if (isset($mem_Info[$id]['m_sig'])) { $to_skin['m_sig'] = str_replace('<a href=', '<a target="blank" href=', $m_sig); } if ($this->viewing_mem_info['displaysigonce'] == 1 and !isset($mem_Info[$id]['show_sig'])) { $mem_Info[$id]['show_sig'] = true; } elseif ($this->viewing_mem_info['displaysigonce'] == 1) { $to_skin['m_sig'] = null; } } else { $to_skin['m_sig'] = null; } $to_skin['m_adv'] = null; if ($this->viewing_mem_info['viewaadv'] == 1 || ($awcUser->guest == '0' and $this->cf_AdvatarGuestView)) { if (isset($mem_Info[$id]['m_adv']) and !empty($mem_Info[$id]['m_adv'])) { $to_skin['m_adv'] = $mem_Info[$id]['m_adv']; $to_skin['m_advw'] = $mem_Info[$id]['m_advw']; $to_skin['m_advh'] = $mem_Info[$id]['m_advh']; } elseif ($mem_Info[$id]['m_topics'] == '0' and $mem_Info[$id]['m_posts'] == '0') { $AvatraSize = explode('x', $this->cf_AvatraSize); $to_skin['m_adv'] = "{$this->wgScriptPath}" . awcForumPath . "images/avatars/avatar_guest.gif"; $to_skin['m_advw'] = $AvatraSize[0]; $to_skin['m_advh'] = $AvatraSize[1]; } else { $AvatraSize = explode('x', $this->cf_AvatraSize); $to_skin['m_adv'] = "{$this->wgScriptPath}" . awcForumPath . "images/avatars/avatar_default.gif"; $to_skin['m_advw'] = $AvatraSize[0]; $to_skin['m_advh'] = $AvatraSize[1]; } } $mem_Info[$id]['m_adv'] = $to_skin['m_adv']; // flip for caching $mem_Info[$id]['m_advw'] = $to_skin['m_advw']; // flip for caching $mem_Info[$id]['m_advh'] = $to_skin['m_advh']; // flip for caching $mem_Info[$id]['m_sig'] = $to_skin['m_sig']; // flip for caching if (!isset($mem_Info[$id]['m_topics']) or empty($mem_Info[$id]['m_topics'])) { $mem_Info[$id]['m_topics'] = '0'; } $to_skin['m_topics'] = $mem_Info[$id]['m_topics']; if (!isset($mem_Info[$id]['m_posts']) or empty($mem_Info[$id]['m_posts'])) { $mem_Info[$id]['m_posts'] = '0'; } $to_skin['m_posts'] = $mem_Info[$id]['m_posts']; if (!isset($mem_Info[$id]['edit_count']) or empty($mem_Info[$id]['edit_count'])) { $mem_Info[$id]['edit_count'] = '0'; } $to_skin['edit_count'] = $mem_Info[$id]['edit_count']; $tplt_info['group'] = $mem_Info[$id]['group']; // @added 2.5.8 if (!isset($this->mem_post_title[0])) { foreach ($this->mem_post_title as $memPostTitleID) { if ($mem_Info[$id]['m_posts'] >= $memPostTitleID['count']) { $tplt_info['member_title'] = $memPostTitleID['title']; $tplt_info['member_title_css'] = $memPostTitleID['css']; } } } else { $tplt_info['member_title'] = ''; $tplt_info['member_title_css'] = ''; } $mem_Info[$id]['member_title'] = $tplt_info['member_title']; $mem_Info[$id]['member_title_css'] = $tplt_info['member_title_css']; $to_skin['member_title'] = $tplt_info['member_title']; $to_skin['member_title_css'] = $tplt_info['member_title_css']; //- @added / 2.5.8 } } else { $to_skin['edit_count'] = isset($mem_Info[$this->p_userid]['edit_count']) ? $mem_Info[$this->p_userid]['edit_count'] : 0; $to_skin['m_posts'] = $mem_Info[$this->p_userid]['m_posts']; $to_skin['m_topics'] = $mem_Info[$this->p_userid]['m_topics']; $to_skin['m_advh'] = $mem_Info[$this->p_userid]['m_advh']; $to_skin['m_advw'] = $mem_Info[$this->p_userid]['m_advw']; $to_skin['m_adv'] = $mem_Info[$this->p_userid]['m_adv']; $tplt_info['group'] = $mem_Info[$this->p_userid]['group']; $tplt_info['member_title'] = isset($mem_Info[$this->p_userid]['member_title']) ? $mem_Info[$this->p_userid]['member_title'] : ''; $tplt_info['member_title_css'] = isset($mem_Info[$this->p_userid]['member_title_css']) ? $mem_Info[$this->p_userid]['member_title_css'] : ''; # die(); $to_skin['member_title'] = $tplt_info['member_title']; $to_skin['member_title_css'] = $tplt_info['member_title_css']; if ($this->viewing_mem_info['displaysigonce'] == 1) { $to_skin['m_sig'] = ''; } else { $to_skin['m_sig'] = $mem_Info[$this->p_userid]['m_sig']; } } } } $height_stuff['advar'] = $mem_Info[$this->p_userid]['m_advh'] + 15; $height_stuff['memtitle'] = $to_skin['member_title'] == '' ? 0 : 20; $height_stuff['wikicount'] = 20; $height_stuff['postcount'] = 20; $height_stuff['threadcount'] = 20; if (!isset($mem_Info[$this->p_userid]['m_topics']) or empty($mem_Info[$this->p_userid]['m_topics'])) { $height_stuff['threadcount'] = 0; } if (!isset($mem_Info[$this->p_userid]['m_posts']) or empty($mem_Info[$this->p_userid]['m_posts'])) { $height_stuff['postcount'] = 0; } if (!isset($mem_Info[$this->p_userid]['edit_count']) or empty($mem_Info[$this->p_userid]['edit_count'])) { $height_stuff['wikicount'] = 0; } $tplt_info['sig_display'] = $tplt->phase($word, $to_skin, 'sig_display'); $tplt_info['post_avatar'] = $tplt->phase($word, $to_skin, 'post_avatar'); $to_skin['url'] = awcsf_wiki_url . "Special:Contributions/{$this->p_user}"; $tplt_info['wikiedits_count_link'] = $this->showWEcount == '1' ? $tplt->phase($word, $to_skin, 'link_wikiedits') : null; $to_skin['url'] = awc_url . "search/memtopics/" . urlencode($this->p_user) . '/' . $this->p_userid; // $to_skin['url'] = awc_url ."search/memtopics/".$this->p_userid ; $tplt_info['topics_count_link'] = $this->showTcount == '1' ? $tplt->phase($word, $to_skin, 'link_threads') : null; $to_skin['url'] = awc_url . "search/memposts/" . urlencode($this->p_user) . '/' . $this->p_userid; // $to_skin['url'] = awc_url ."search/memposts/".$this->p_userid ; $tplt_info['post_count_link'] = $this->showPcount == '1' ? $tplt->phase($word, $to_skin, 'link_posts') : null; $tplt_info['mem_drop_num'] = $time_func_called; $tplt_info['user_name'] = "<a href=\"" . awc_url . "mem_profile/{$this->p_user}/{$this->p_userid}\" onmouseover=\"mopen('mem{$tplt_info['mem_drop_num']}')\" onmouseout=\"mclosetime()\">{$this->p_user}</a>"; $tplt_info['admin_lookup'] = (UserPerm == 10 and !$this->preview) ? '<a target="blank" href="' . awc_url . 'admin/mem_lookup/' . $this->p_user . '/' . $this->p_userid . '">*</a>' : ''; $to_skin['url'] = awc_url . "mem_profile/{$this->p_user}/{$this->p_userid}"; $tplt_info['profile_link'] = $tplt->phase($word, $to_skin, 'link_profile'); $tplt_info['user_options'] = isset($to_skin['user_options']) ? $to_skin['user_options'] . '<br />' : null; if ($this->p_userid == 0) { //if($this->show_guest_ip == 0) if (UserPerm == 10 and !$this->preview) { $tplt_info['user_name'] = "<a href='" . awcsf_wiki_url . "Special:Contributions/{$this->p_user}'>{$this->p_user}</a>"; } elseif ($this->show_guest_ip == 0) { $tplt_info['user_name'] = get_awcsforum_word('word_guest'); } $tplt_info['post_count_link'] = null; $tplt_info['profile_link'] = null; $tplt_info['user_options'] = null; $tplt_info['topics_count_link'] = null; $tplt_info['group'] = null; $tplt_info['member_title'] = ''; $tplt_info['member_title_css'] = ''; if (UserPerm == 10 and !$this->preview) { } elseif ($this->show_guest_ip == 0) { $tplt_info['wikiedits_count_link'] = null; } } if (!isset($tplt_info['member_title'])) { $tplt_info['member_title'] = ''; $tplt_info['member_title_css'] = ''; } $m_pm = ($this->pm_enable == '1' and $this->guest == false) ? $word['word_send'] . ' <a href="' . awc_url . 'member_options/pmnew/' . $this->p_user . '/' . $this->p_id . '">' . $word['word_pm'] . '</a>' : null; $to_skin['url'] = awc_url . 'member_options/pmnew/' . $this->p_user . '/' . $this->p_id; $tplt_info['m_pm'] = $tplt->phase($word, $to_skin, 'link_send_pm_to'); $tplt_info['date'] = null; $info['date'] = awcsforum_funcs::convert_date($this->p_date, "l") . " "; if (!$this->preview) { $tplt_info['date'] = $tplt->phase($word, $info, 'post_date_link'); } if ($this->single_post or $pm or $this->preview) { $tplt_info['date'] = $info['date']; } $info['post_title'] = awcsforum_funcs::awc_html_entity_decode($this->p_title); #$info['post_title'] = $this->p_title ; $tplt_info['post_title'] = (!empty($this->p_title) and $this->p_title != $this->t_name) ? $tplt->phase($word, $info, 'post_title_row') : ''; if ($time_func_called % 2) { $tplt_info['row_class'] = 'post0'; } else { $tplt_info['row_class'] = 'post1'; } /* if ($this->bcmod) { //$tplt_info['row_class'] = 'post' . bcmod($time_func_called, '2') ; } else { //$tplt_info['row_class'] = 'post' ; } */ if ($pm == false) { if (!empty($this->p_editwho)) { $info['p_editdate'] = awcsforum_funcs::convert_date($this->p_editdate, "l"); $info['p_editwho'] = $this->p_editwho; $tplt_info['post_edited_on'] = $tplt->phase($word, $info, 'post_edited_on'); } else { $tplt_info['post_edited_on'] = null; } $edit_buttons['edit_buttons'] = null; if (UserPerm >= 2 and !$this->preview || CanDelete($this->p_user)) { if ($this->t_ann != "1" || UserPerm == 10) { $url = awc_url . 'mod/mod_post/delete/' . $this->p_id; #$url = awc_url .'post/delete_post/id' . $this->p_id ; $t = $word['thread_deletepost'] . ' ? '; $t = str_replace(array(chr(10), chr(13), "'"), '', $t); $info['url'] = $url; $info['msg'] = $t; $edit_buttons['edit_buttons'] .= $tplt->phase($word, $info, 'post:delete_post'); } } #if ( (UserPerm >= 2 || (CanDelete($this->p_user)) AND # $this->only_one_post == false) ) { # die(">". $this->only_one_post); if (UserPerm >= 2 and !$this->preview and !$this->single_post || CanDelete($this->p_user) and $time_func_called == 1 and !$this->has_limit) { if ($this->t_ann != "1" || UserPerm == 10) { $url = awc_url . 'mod/mod_thread/delete/' . $this->t_id; $t = $word['thread_deletethread'] . ' ? \\n' . $word['deleteThread']; $t = str_replace(array(chr(10), chr(13), "'"), '', $t); $info['url'] = $url; $info['msg'] = $t; $edit_buttons['edit_buttons'] .= $tplt->phase($word, $info, 'post:delete_thread'); } } // die(">". $this->t_pollopen); if (!$this->preview and $time_func_called == 1 and !$this->single_post) { if ($this->polls_enabled == '1' and $this->p_userid != '0' and (!$this->t_poll or $this->multi_polls == '1') and UserPerm >= 10 || $this->uID == $this->p_userid) { $word['poll'] = get_awcsforum_word('word_add_poll'); $info['url'] = awc_url . "post/add_poll/{$this->t_id}/{$this->f_id}"; $edit_buttons['edit_buttons'] .= $tplt->phase($word, $info, 'post:poll'); } } if (UserPerm >= 2 and !$this->preview and $time_func_called != 1) { $info['url'] = awc_url . 'mod/mod_thread/splitmerge_get/' . $this->p_id; $edit_buttons['edit_buttons'] .= $tplt->phase($word, $info, 'post:spltmerge_button'); } if (!$this->preview and $time_func_called == 1 and CanEdit($this->p_user) || UserPerm >= 2) { $info['url'] = awc_url . 'post/GetEditThread/id' . $this->p_id; $edit_buttons['edit_buttons'] .= $tplt->phase($word, $info, 'post:edit_button'); } if (!$this->preview and $time_func_called != 1 and CanEdit($this->p_user) || UserPerm >= 2) { $info['url'] = awc_url . 'post/GetEdit/id' . $this->p_id; $edit_buttons['edit_buttons'] .= $tplt->phase($word, $info, 'post:edit_button'); } // forum-wiki-perm if (($this->canPost and !$this->preview and $this->t_status == "0" and $this->forum_perm_can_post) || UserPerm >= 2) { $info['url'] = awc_url . "post/quote/id" . $this->p_id; $edit_buttons['edit_buttons'] .= $tplt->phase($word, $info, 'post:quote_button'); } # $tplt_info['edit_buttons'] = $tplt->phase($word, $edit_buttons, 'edit_buttons_row'); } $tplt_info['edit_buttons'] = $tplt->phase($word, $edit_buttons, 'edit_buttons_row'); /* if($this->preview){ $tplt_info['edit_buttons'] = null; } else { $tplt_info['edit_buttons'] = $tplt->phase($word, $edit_buttons, 'edit_buttons_row'); } */ # crap! need to find a way to fill the height of the post-text, work-around $add = 0; // 2.5.8 foreach ($height_stuff as $item => $number) { $add = $add + $number; } $tplt_info['table_height'] = $add; //($to_skin['m_adv'] == null) ? '65' : ($to_skin['m_advh'] + 65); // 2.5.8 $tplt_info['post_height'] = $tplt_info['table_height'] - 10; $tplt_info['colspan'] = strlen($edit_buttons['edit_buttons']) > 0 ? ' ' : ' width="100%" colspan="2" '; $post = $this->p_post; $tplt_info['post'] = self::phase_post($post, $this->p_id); $tplt_info['p_id'] = $this->p_id; $tplt_info['pID'] = $this->p_id; wfRunHooks('awcsforum_post_render_display', array(&$tplt_info, $hook_user_info)); // 2.5.6 $post_table = $tplt->phase($word, $tplt_info, 'post_table'); // if($time_func_called == 5) $post_table = '<a name="last"></a>' . $post_table; return $post_table; }
function whoshere() { global $wgOut, $WhoWhere; //$WhoWhere = 'whoshere' ; $WhoWhere['type'] = 'forum'; $WhoWhere['where'] = 'whoshere||awc-split||whoshere'; Set_AWC_Forum_SubTitle(get_awcsforum_word('word_forum_stats_whos_here'), ''); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_forum_stats_whos_here'), true); $dbr = wfGetDB(DB_SLAVE); $awc_f_sessions = $dbr->tableName('awc_f_sessions'); $sql = "SELECT * FROM {$awc_f_sessions} ORDER BY ses_when DESC"; $res = $dbr->query($sql); $out = null; $guest = get_awcsforum_word('word_guests'); $bots = get_awcsforum_word('word_forum_stats_bots'); while ($r = $dbr->fetchObject($res)) { $where = explode('||awc-split||', $r->ses_where); $where_link = $where[0]; $where_text = isset($where[1]) ? $where[1] : $where[0]; $type = $r->ses_type; $who = $r->ses_name; if ($r->ses_guest == '1') { $who = $guest; } if ($r->ses_bot == '1') { $who = $bots; } if ($type == 'wiki') { $f = array('\'', ' '); $r = array('%27', '_'); // note $where_link = str_replace($f, $r, $where_link); $out .= "<b>{$who}</b> - <a href='" . awcsf_wiki_url . "{$where_link}'>" . awcsforum_funcs::awc_html_entity_decode($where_text) . "</a> <br /><br />"; } else { $show = false; $perm = explode(',', $r->ses_perm); if ($r->ses_perm == '') { $show = true; } else { foreach ($perm as $permIs) { if (strstr(UserGroupPerm, $permIs)) { $show = true; break; } } } if ($show) { if (strpos($where_link, 'tid') !== false) { $link = explode('tid', $where_link); $out .= "<b>{$who}</b> - <a href='" . awc_url . "st/id{$link[1]}'>{$where_text}</a> <br /><br />\r"; } elseif (strpos($where_link, 'fid') !== false) { $link = explode('fid', $where_link); $out .= "<b>{$who}</b> - <a href='" . awc_url . "sf/id{$link[1]}'>{$where_text}</a> <br /><br />\r"; } elseif (strpos($where_link, 'cid') !== false) { $link = explode('cid', $where_link); $out .= "<b>{$who}</b> - <a href='" . awc_url . "cf/id{$link[1]}'>{$where_text}</a> <br /><br />\r"; } else { $out .= "<b>{$who}</b> - <a href='" . awc_url . "{$where_link}'>{$where_text}</a> <br /><br />\r"; } } } } $wgOut->addHTML($out); }
function GetQuote($pID) { global $wgOut, $wgRequest, $awc_tables, $awcUser; // forum-wiki-perm move to top if (!$awcUser->canPost) { return $wgOut->loginToUse(); } $rDB = wfGetDB(DB_SLAVE); $res = $rDB->query("SELECT p.*, t.t_wiki_pageid, t.t_id, t.t_name, t.t_ann, t.t_pin, t.t_status, t.t_topics, f.f_name, f.f_wiki_write_perm\r\r\n FROM {$awc_tables['awc_f_posts']} p, {$awc_tables['awc_f_threads']} t, {$awc_tables['awc_f_forums']} f \r\r\n WHERE p.p_id={$pID} AND f.f_id=p.p_forumid AND p.p_threadid=t.t_id LIMIT 1"); $r = $rDB->fetchRow($res); $perm = new awcs_forum_perm_checks(); if (!$awcUser->canPost or !$perm->can_post($r['f_wiki_write_perm'])) { return awcs_forum_error('no_forum_read_perm'); } $title = $r['p_title']; if ($title == "") { $title = $r['t_name']; } $title = awcsforum_funcs::awc_html_entity_decode($title); $ptitle = awcsforum_funcs::awc_html_entity_decode($r['p_title']); $ttitle = awcsforum_funcs::awc_html_entity_decode($r['t_name']); $this->ThreadTitle = $ttitle; $this->f_name = $r['f_name']; $this->t_wiki_pageid = $r['t_wiki_pageid']; $this->tID = $r['t_id']; $this->fID = $r['p_forumid']; if ($r['t_ann']) { $t_ann = "checked"; } if ($r['t_pin']) { $t_pin = "checked"; } if ($r['t_status']) { $t_status = "checked"; } $this->post = "[QUOTE=" . $r['p_user'] . " [[Special:AWCforum/sp/id" . $pID . "|" . awcsforum_funcs::convert_date($r['p_date'], "1") . "]]]" . $r['p_post'] . "[/quote]" . chr(10); Set_AWC_Forum_SubTitle(get_awcsforum_word('word_quoting'), $ptitle); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_quoting')); Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'st/id' . $r['p_threadid'] . '">' . $ttitle . '</a>', true); return self::preview_show('quote'); }
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); }
function GetForumDisplayInfo($info) { global $awc, $wgOut, $awcs_forum_config, $str_len, $forum, $perm_sql; $thread_tools = new awcs_forum_thread_list_tools(); if ($info['both']) { $info['classThreadtitle'] = 'class="' . $info['classThreadtitle'] . '" id="' . $info['idThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['classReplies'] . '" id="' . $info['idReplies'] . '"'; $info['classViews'] = 'class="' . $info['classViews'] . '" id="' . $info['diViews'] . '"'; $info['classLastAction'] = 'class="' . $info['classLastAction'] . '" id="' . $info['idLastAction'] . '"'; } elseif (!$info['id']) { $info['classThreadtitle'] = 'class="' . $info['classThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['classReplies'] . '"'; $info['classViews'] = 'class="' . $info['classViews'] . '"'; $info['classLastAction'] = 'class="' . $info['classLastAction'] . '"'; } else { $info['classThreadtitle'] = 'id="' . $info['idThreadtitle'] . '"'; $info['classReplies'] = 'id="' . $info['idReplies'] . '"'; $info['classViews'] = 'id="' . $info['idViews'] . '"'; $info['classLastAction'] = 'id="' . $info['idLastAction'] . '"'; } # die(">". $UserPerm); $dbr = wfGetDB(DB_SLAVE); $permsql = substr($perm_sql, 0, -4); // if(strlen($info['forum']) > 0) $permsql = substr($permsql, 0, -4); $info['forum'] = substr($info['forum'], 4, strlen($info['forum'])); if (strlen($info['forum']) > 0 and strlen($permsql) > 0) { $permsql .= ' AND '; } $awc_f_threads = $dbr->tableName('awc_f_threads'); $awc_f_forums = $dbr->tableName('awc_f_forums'); $awc_f_cats = $dbr->tableName('awc_f_cats'); $awc_f_posts = $dbr->tableName('awc_f_posts'); $sql = "SELECT {$awc_f_threads}.*, {$awc_f_forums}.f_name, {$awc_f_forums}.f_desc, {$awc_f_forums}.f_id, {$awc_f_forums}.f_parentid, {$awc_f_cats}.cat_name, {$awc_f_cats}.cat_id, {$awc_f_cats}.c_wiki_perm\n FROM {$awc_f_threads}\n INNER JOIN {$awc_f_forums}\n ON {$awc_f_threads}.t_forumid={$awc_f_forums}.f_id\n INNER JOIN {$awc_f_cats}\n ON {$awc_f_cats}.cat_id={$awc_f_forums}.f_parentid\n WHERE {$permsql} \n " . $info['forum'] . " AND {$awc_f_forums}.f_passworded = 0\n ORDER BY {$awc_f_threads}.t_lastdate DESC\n LIMIT " . $info['howmanythreads']; # die(">".$permsql); /* * GROUP BY $awc_f_threads.t_id * $sql = "SELECT $awc_f_threads.*, $awc_f_forums.f_name, $awc_f_forums.f_desc, $awc_f_forums.f_id, $awc_f_forums.parent_id, $awc_f_cats.cat_name, $awc_f_cats.cat_id, $awc_f_cats.c_wiki_perm FROM $awc_f_threads INNER JOIN $awc_f_forums ON $awc_f_threads.t_forumid=$awc_f_forums.f_id INNER JOIN $awc_f_cats ON $awc_f_cats.cat_id=$awc_f_forums.parent_id WHERE $permsql ".$info['forum']." AND $awc_f_forums.f_passworded = 0 GROUP BY $awc_f_threads.t_id ORDER BY $awc_f_threads.t_lastdate DESC LIMIT " . $info['howmanythreads']; $sql = $dbr->selectSQLText( array( 'awc_f_threads', 'awc_f_posts', 'awc_f_forums', 'awc_f_cats' ), array( "$awc_f_posts.*, $awc_f_threads.*, f_name, f_desc, f_id, parent_id, cat_name, cat_id" ), "$permsql ".$info['forum']." AND f_passworded = 0", __METHOD__, array('OFFSET' => 0, 'LIMIT' => $info['howmanythreads'], 'GROUP BY' => 't_id', 'ORDER BY' => 't_lastdate DESC, p_id DESC',), array( 'awc_f_posts' => array('JOIN','t_id=thread_id'), 'awc_f_forums' => array('JOIN','t_forumid=f_id'), 'awc_f_cats' => array('JOIN','parent_id=cat_id')) ); */ if (strlen($info['forum']) == 0 and strlen($permsql) == 0) { $sql = str_replace('WHERE', '', $sql); } // awc_pdie($sql); $html = null; $singleline = null; if ($res = $dbr->query($sql)) { while ($r = $dbr->fetchObject($res)) { $f_name = $r->f_name; $f_id = $r->f_id; $tTitle = awcsforum_funcs::awc_html_entity_decode($r->t_name); $str_len($tTitle) > $awcs_forum_config->cf_forumTag_titlecutoff ? $t_name = awcsforum_funcs::awc_shorten($tTitle, $awcs_forum_config->cf_forumTag_titlecutoff) . "..." : ($t_name = $tTitle); $tmp = $info['imgBeforeThreadTitle'] . ' ' . $info['txtBeforeThreadTitle'] . ' <a href="' . $awc['link'] . 'st/id' . $r->t_id . '">' . $t_name . '</a>'; $limit = null; #$total['TotalPosts'] = null; $send['t_topics'] = $r->t_topics; $send['t_id'] = $r->t_id; $send['t_name'] = $r->t_name; $send['link'] = $this->awc_url; $t = null; if ($r->t_ann == "1") { $t = get_awcsforum_word('thread_makeAnnouncement') . " "; } if ($r->t_status == "1") { $t = get_awcsforum_word('1indicator_locked') . " "; } if ($r->t_pin == "1") { $t = get_awcsforum_word('1indicator_sticky') . " "; } if ($r->t_pin == "1" and $r->t_status == "1") { $t = get_awcsforum_word('1indicator_lockSticky') . " "; } if ($r->t_poll == "1") { $t = get_awcsforum_word('1indicator_poll') . " "; } # $TotalPosts = $tmp['TotalPosts']; # $limit = GetLimit($TotalPosts); $thread_tools->link = $this->awc_url; $thread_tools->tID = $r->t_id; $thread_tools->total_posts = $r->t_topics; $limit = $thread_tools->GetThreadPostLimit(); //$limit = GetThreadPostLimit($send); $tmp = $t . $tmp . ' ' . $limit; # die($awc['link']); $html .= '<tr>'; $html .= '<td width="100%" ' . $info['classThreadtitle'] . ' style="' . $info['styleThreadtitle'] . '" nowrap>' . $tmp . '</td>'; $singleline .= '<tr><td width="100%" ' . $info['classThreadtitle'] . ' style="' . $info['styleThreadtitle'] . '" >'; $singleline .= $tmp; # $singleline .= ; if ($info['replies'] == "yes") { $html .= '<td ' . $info['classReplies'] . ' style="' . $info['styleReplies'] . '" nowrap>' . $r->t_topics . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleReplies'] . '"> (' . $r->t_topics . ' ' . $info['wReplies'] . ') </SPAN>'; } if ($info['postcount'] == "yes") { $html .= '<td ' . $info['classViews'] . ' style="' . $info['styleViews'] . '" nowrap>' . $r->t_hits . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleViews'] . '"> (' . $r->t_hits . ' ' . $info['wViews'] . ') </SPAN> '; } if ($info['date'] == "yes" || $info['users'] == "yes") { $u = $r->t_lastuser == '' ? $r->p_user : $r->t_lastuser; $uID = $r->t_lastuser == '' ? $r->p_userid : $r->t_lastuserid; #$u = $wgOut->parse("[[User:$u|$u]]"); $u = "<a href='" . $awc['link'] . "mem_profile/{$u}/{$uID}'>{$u}</a>"; $rplac = array('<p>', '</p>', chr(10)); $u = str_replace($rplac, '', $u); $u = $info['users'] == "yes" ? ' - ' . $u : null; $d = $info['date'] == "yes" ? '<a href="' . $awc['link'] . 'last_post/id' . $r->t_id . '"> ' . awcsforum_funcs::convert_date($r->t_lastdate, "s") . ' </a>' . ' ' : null; $html .= '<td ' . $info['classLastAction'] . ' style="' . $info['styleLastAction'] . '" nowrap>' . $d . $u . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleLastAction'] . '"> (' . $d . $u . ') </SPAN><td></tr>'; } $html .= '</tr>'; } $dbr->freeResult($res); } if ($f_name == '') { return; } if ($info['header_both']) { $info['classThreadtitle'] = 'class="' . $info['header_classThreadtitle'] . '" id="' . $info['header_idThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['header_classReplies'] . '" id="' . $info['header_idReplies'] . '"'; $info['classViews'] = 'class="' . $info['header_classViews'] . '" id="' . $info['header_diViews'] . '"'; $info['classLastAction'] = 'class="' . $info['header_classLastAction'] . '" id="' . $info['header_idLastAction'] . '"'; } elseif (!$info['header_id']) { $info['classThreadtitle'] = 'class="' . $info['header_classThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['header_classReplies'] . '"'; $info['classViews'] = 'class="' . $info['header_classViews'] . '"'; $info['classLastAction'] = 'class="' . $info['header_classLastAction'] . '"'; } else { $info['classThreadtitle'] = 'id="' . $info['header_idThreadtitle'] . '"'; $info['classReplies'] = 'id="' . $info['header_idReplies'] . '"'; $info['classViews'] = 'id="' . $info['header_idViews'] . '"'; $info['classLastAction'] = 'id="' . $info['header_idLastAction'] . '"'; } $out = null; if ($info['showall'] == false) { $out = '<table width="' . $info['width'] . '" cellpadding="0" cellspacing="0"><tr><td nowrap><a href="' . $awc['link'] . 'sf/id' . $f_id . '">' . $f_name . '</a><hr></td></tr></table>'; } $out .= '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0">'; $out .= '<tr>'; $singleline_out = '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0"><tr>'; $out .= '<td width="75%" align="left" class="' . $info['header_classThreadtitle'] . '" style="' . $info['header_styleThreadtitle'] . '" nowrap>' . $info['wThreadtitle'] . '</td>'; if ($info['replies'] == "yes") { $out .= '<td width="1%" align="left" class="' . $info['header_classReplies'] . '" style="' . $info['header_styleReplies'] . '" nowrap>' . $info['wReplies'] . '</td>'; } if ($info['postcount'] == "yes") { $out .= '<td width="1%" align="left" class="' . $info['header_classViews'] . '" style="' . $info['header_styleViews'] . '" nowrap>' . $info['wViews'] . '</td>'; } #if($info['users'] == true) $out .= '<td width="1%" align="left" nowrap>'.get_awcsforum_word('forum_started_by').'</td>'; if ($info['date'] == "yes" || $info['users'] == "yes") { $out .= '<td width="20%" align="left" class="' . $info['header_classLastAction'] . '" style="' . $info['header_styleLastAction'] . '" nowrap>' . $info['wLastAction'] . '</td>'; } $out .= '</tr>'; $out .= $html; $out .= '</table><br />'; $singleline_out = '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0">'; $singleline_out .= $singleline; $singleline_out .= '</table><br />'; $out = str_replace(chr(10), '', $out); $singleline_out = str_replace(chr(10), '', $singleline_out); if ($info['inline']) { return $singleline_out; } return $out; }
function process_all_cats($cats, $children, $cat_link = null) { global $tplt; $outHTML = null; $word_guest = get_awcsforum_word('word_guest'); $word_header = array('topics' => get_awcsforum_word('word_topics'), 'replies' => get_awcsforum_word('word_replies'), 'forum_last_post' => get_awcsforum_word('forum_last_post')); foreach ($cats as $cat_id => $cat_data) { $html = $tplt->phase('', '', 'cat_open_table'); $info['AdminEdit'] = UserPerm == 10 ? '<a href="' . awc_url . 'admin/cat/get_cat_id_edit/' . $cat_data['id'] . '">*</a> | ' : null; $info['title'] = '<a href="' . awc_url . 'sc/id' . $cat_data['id'] . '/' . rawurlencode(str_replace('/', ' ', $cat_data['name'])) . $this->html_ext . '">' . $cat_data['name'] . '</a>'; if ($cat_link != null) { $info['title'] = $cat_data['name']; } $html .= $tplt->phase($word_header, $info, 'cat_header'); foreach ($children as $forum_id => $c) { if ($c['f_parentid'] == $cat_id) { if ($this->show_guest_ip == '0' and $c['f_lastuserid'] == '0' and UserPerm < 2) { $c['f_lastuser'] = $word_guest; } $c['last_title'] = awcsforum_funcs::awc_html_entity_decode($c['f_lasttitle']); $last_title = $c['last_title']; if (isset($c['last_title'][$this->MaxTitleCol])) { $c['last_title'] = awcsforum_funcs::awc_shorten($c['last_title'], $this->MaxTitleCol) . "..."; } $c['last_date'] = $c['f_lastdate'] != '0000-00-00 00:00:00' ? awcsforum_funcs::convert_date($c['f_lastdate'], "s") : ' '; $c['mem_link'] = awcsforum_funcs::awcforum_url('mem_profile/' . $c['f_lastuser'] . '/' . $c['f_lastuserid']); $c['AdminEditLink'] = UserPerm == 10 ? '<a href="' . awc_url . 'admin/forum/get_forum_id_edit/' . $c['f_id'] . '">*</a> | ' : null; $c['forum_link'] = awc_url . 'sf/id' . $c['f_id'] . '/' . rawurlencode(str_replace('/', ' ', $c['f_name'])) . $this->html_ext; # die($last_title); $c['last_thread_link'] = awc_url . 'last_post/id' . $c['f_threadid'] . '/' . rawurlencode(str_replace('/', ' ', $last_title)) . $this->html_ext; $html .= $tplt->phase('', $c, 'cat_list_forums_rows'); } } $html .= $tplt->phase('', '', 'cat_close_table'); $outHTML .= $html; } $tplt->kill('cat_open_table'); $tplt->kill('cat_close_table'); $tplt->kill('cat_list_forums_rows'); unset($word_header, $c, $info); return $outHTML; }