function awcsf_admin_forum_func() { global $action_url, $wgRequest; $fid = $wgRequest->getVal('id'); $forum_cls = new awcsf_admin_forum(); switch ($action_url['todo']) { case 'create_forum': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_create_new_forum'), true); $forum_cls->create_forum(); break; case 'do_create_forum': $forum_cls->do_create_forum(); break; case 'get_forum_list': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_edit_forum'), true); $forum_cls->get_forum_list(); break; case 'get_forum_id_edit': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_edit_forum'), true); $forum_cls->fID = strlen($fid) > 0 ? $fid : $action_url[2]; $forum_cls->get_forum_id_edit(); break; case 'edit_forum_do': $forum_cls->edit_forum_do(); break; case 'delete_forum': $forum_cls->delete_forum(); break; } }
/** * Categories 'todo' entry method * @uses awcsf_admin_categories * @uses Set_AWC_Forum_BreadCrumbs * @uses get_awcsforum_word * @since Version 2.5.8 */ function awcsf_admin_categories_func() { global $action_url, $wgRequest; $cid = $wgRequest->getVal('id'); $cat_cls = new awcsf_admin_categories(); switch ($action_url['todo']) { case 'create_cat': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_create_new_cat'), true); $cat_cls->create_cat(); break; case 'do_create_cat': $cat_cls->do_create_cat(); break; case 'get_cat_list': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_word_edit_cat'), true); $cat_cls->get_cat_list(); break; case 'get_cat_id_edit': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_word_edit_cat'), true); $cat_cls->cID = strlen($cid) > 0 ? $cid : $action_url[2]; $cat_cls->get_cat_id_edit(); break; case 'edit_cat_do': $cat_cls->edit_cat_do(); break; case 'delete_cat': $cat_cls->delete_cat(); break; } }
function awcsf_admin_membertitle_func() { global $action_url, $wgRequest; $mem_cls = new awcsf_admin_membertitle(); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('cf_display_mem_titles'), true); switch ($action_url['todo']) { case 'insert_new': $mem_cls->insert_new(); break; case 'get_all': $mem_cls->get_all(); break; case 'saveEdit': $mem_cls->saveEdit(); break; } }
/** * Get forum options, pass into to AdminSkin, set page title * * @uses Set_AWC_Forum_BreadCrumbs * @uses get_awcsforum_word * @uses admin_GetConfig * @since Version 2.5.8 */ function do_get_config($todo) { global $wgOut, $ADskin; Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_get_config')); switch ($todo) { case 'forum': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_display_forum_options'), true); break; case 'general': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_display_geneal_options'), true); break; case 'mem': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_display_mem_options'), true); break; case 'thread': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_display_thread_options'), true); break; case 'forum_tag': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_display_forumtag_options'), true); break; case 'get_emotions': Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('admin_emotions_edit'), true); break; default: # $b[] = get_awcsforum_word('admin_config_forum') ; break; } $wgOut->addHTML($ADskin->admin_GetConfig($todo)); }
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 display_lang_options() { global $wgOut, $awc_lang, $awc, $wgLanguageCode, $wgUser; Set_AWC_Forum_BreadCrumbs('', true); # pull form Wiki... used for "Create New Lang Pack" option $languages = Language::getLanguageNames(false); #sort($languages); $html = '<table width="100%" class="dl_maintable" cellpadding="0" cellspacing="0">'; $e = null; $d = null; $dbr = wfGetDB(DB_SLAVE); $table_1 = $dbr->tableName('awc_f_langs'); $sql = "SELECT lang_code, lang_name FROM {$table_1}"; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { if ($wgLanguageCode == $r->lang_code) { $e .= '<option value="' . $r->lang_code . '" SELECTED>' . $r->lang_name . '</option>'; if ($r->lang_code != 'en') { $d .= '<option value="' . $r->lang_code . '" SELECTED>' . $r->lang_name . '</option>'; } } else { $e .= '<option value="' . $r->lang_code . '">' . $r->lang_name . '</option>'; if ($r->lang_code != 'en') { $d .= '<option value="' . $r->lang_code . '">' . $r->lang_name . '</option>'; } } } $dbr->freeResult($res); $html .= '<tr><td width="100%" align="left" nowrap> <br />'; $html .= '<hr /><form enctype="multipart/form-data" action="' . awc_url . 'admin/awc_lang/get_edit_lang" method="post">'; $html .= get_awcsforum_word('admin_lang_selecttoedit') . '<br /> <select name="lang_code">' . $e . '</select>'; $html .= " <select name='lang_txt'>\n <option value='lang_txt_forum'>" . get_awcsforum_word('admin_lang_txt_forum') . "</option>\n <option value='lang_txt_mem'>" . get_awcsforum_word('admin_lang_txt_mem') . "</option>\n <option value='lang_txt_admin'>" . get_awcsforum_word('admin_lang_txt_admin') . "</option>\n <option value='lang_txt_tag'>" . get_awcsforum_word('admin_lang_txt_tag') . "</option>\n <option value='lang_txt_search'>" . get_awcsforum_word('admin_lang_txt_search') . "</option>\n <option value='lang_txt_thread'>" . get_awcsforum_word('admin_lang_txt_threads') . "</option>\n <option value='lang_txt_redirects'>" . get_awcsforum_word('admin_lang_txt_redirects') . "</option>\n <option value='lang_txt_errormsg'>" . get_awcsforum_word('admin_lang_txt_errormsg') . "</option>\n <option value='lang_update'>" . get_awcsforum_word('admin_new_lang_update') . "</option>\n </select>"; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '">'; $html .= ' </form> <hr><br />'; if (in_array('bureaucrat', $wgUser->getGroups())) { $html .= '<hr /><form enctype="multipart/form-data" onsubmit="return delete_form_check(\'' . get_awcsforum_word('admin_lang_deletelangcheck') . '\')";" action="' . awc_url . 'admin/awc_lang/do_delete_lang" method="post">'; $html .= get_awcsforum_word('admin_lang_selecttodelete') . '<br /> <select name="lang_code">' . $d . '</select>'; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '">'; $html .= ' </form> <hr><br />'; } $html .= '</td></tr>'; $html .= '<tr>'; $html .= '<td width="100%" class="dl_maintable_head" nowrap>'; $html .= '<hr /><form enctype="multipart/form-data" id="config" name="config " action="' . awc_url . 'admin/awc_lang/add_new_lang" method="post">'; $html .= get_awcsforum_word('admin_lang_addnew_langfile'); $html .= ' <br /><a target="blank" href="http://wiki.anotherwebcom.com/Creating_New_Lang_Files">' . get_awcsforum_word('word_moreinfo') . '</a><br />'; $html .= '<select name="lang_code">'; foreach ($languages as $l_code => $l_txt) { $html .= '<option value="' . $l_code . '">' . $l_txt . '</option>'; } $html .= '</select>'; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '">'; $html .= ' </form> <hr><br />'; $html .= '<hr /><b>' . get_awcsforum_word('admin_word_import_export_update') . '</b><br />' . get_awcsforum_word('admin_lang_import_update_diff') . '<hr><br />'; $html .= '<form enctype="multipart/form-data" action="' . awc_url . 'admin/awc_lang/update_lang_file" method="post">'; $html .= '<a target="blank" href="http://wiki.anotherwebcom.com/Updating%2C_Importing_and_Exporting_of_the_Lang_File">' . get_awcsforum_word('word_readthis') . '</a>: '; $html .= get_awcsforum_word('admin_lang_update_langfile') . '<br />'; #$html .= ' <select name="lang_code">' . $e . '</select>'; $html .= ' <input name="new_lang" type="file" size="57" /> '; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '">'; $html .= ' </form> <hr><br />'; $html .= '<form enctype="multipart/form-data" action="' . awc_url . 'admin/awc_lang/export_lang" method="post">'; $html .= '<a target="blank" href="http://wiki.anotherwebcom.com/Updating%2C_Importing_and_Exporting_of_the_Lang_File">' . get_awcsforum_word('word_readthis') . '</a>: ' . get_awcsforum_word('admin_lang_export_langfile'); $html .= ' <br /><select name="lang_code">' . $e . '</select> '; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '">'; $html .= ' <br /> <a href="' . awc_url . 'admin/awc_lang/download_lang_file">' . get_awcsforum_word('admin_lang_viewexportedfiles') . '</a> '; $html .= ' </form> <hr><br />'; $html .= '<form enctype="multipart/form-data" id="config" name="config " action="' . awc_url . 'admin/awc_lang/import_lang" method="post">'; $html .= '<a target="blank" href="http://wiki.anotherwebcom.com/Updating%2C_Importing_and_Exporting_of_the_Lang_File">' . get_awcsforum_word('word_readthis') . '</a>: ' . get_awcsforum_word('admin_lang_import_langfile'); $html .= ' <br /><select name="lang_code">' . $e . '</select>'; $html .= ' <input name="new_lang" type="file" size="57" /> '; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '">'; $html .= '</form></tr><tr>'; $html .= '</table>'; $wgOut->addHTML($html); }
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 show_sections_list() { global $wgOut, $awcs_forum_config; $tplt_info = array('all', 'buttons', 'cat', 'forms', 'mem_profile', 'memcp', 'page_jumps', 'poll', 'search', 'special', 'thread', 'thread_listing'); // $out = ' <a href="'.awc_url.'admin/tplt/export_xml/">(export)</a><br /><br />'; $out = '<br /><hr />'; $out .= '<a href="http://wiki.anotherwebcom.com/Skin Template editing (Forum AdminCP)" target="break">' . get_awcsforum_word('word_help') . '</a>'; $out .= '<hr />'; $out .= '<form enctype="multipart/form-data" action="' . awc_url . 'admin/tplt/import_xml" method="post">'; $out .= get_awcsforum_word('admin_import_tplt') . " <br />"; $out .= ' <input name="new_tplt_file" type="file" size="57" /> '; $out .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '">'; $out .= '</form><hr /><br />'; $awc_f_theme_names = $this->rDB->tableName('awc_f_theme_names'); $sql = "SELECT thmn_id, thmn_title, thmn_when, thmn_who, thmn_where FROM {$awc_f_theme_names} WHERE thmn_what = 'tplt' ORDER BY thmn_title"; $res = $this->rDB->query($sql); while ($r = $this->rDB->fetchObject($res)) { if ($r->thmn_id == $awcs_forum_config->thmn_id) { $default = 'CHECKED'; $default_word = '<b>' . get_awcsforum_word('word_default') . '</b>'; $delete = null; $default_css = " class='thread_rows0' "; } else { $default = null; $default_word = get_awcsforum_word('word_default'); $default_css = " class='thread_rows1' "; $delete = ' - <b><a href="javascript:void(0);" onclick="javascript:msgcheck(' . "'" . awc_url . "admin/tplt/tplt_delete/" . $r->thmn_id . "','" . get_awcsforum_word('delete') . "'" . ')">' . get_awcsforum_word('delete') . '</a></b>'; } if (in_array($r->thmn_id, $awcs_forum_config->cf_css_active_ids)) { $active = 'CHECKED'; $active_word = '<b>' . get_awcsforum_word('word_active') . '</b>'; } else { $active = ''; $active_word = get_awcsforum_word('word_active'); } $out .= '<table width="100%" class="dl_maintable">'; $out .= "<tr> <td {$default_css}>"; $out .= '<form action="' . awc_url . 'admin/tplt/show_section" method="post">'; $out .= ' <input name="them_id" type="hidden" value="' . $r->thmn_id . '">'; $out .= "<b>{$r->thmn_title}</b> "; $out .= '<select name="tplt_section">'; foreach ($tplt_info as $k) { $out .= "<option value='{$k}'>{$k}</option>"; } $out .= '</select> '; $out .= ' <input type="submit" value="' . get_awcsforum_word('word_edit') . '"> '; // $out .= ' <input type="submit" name="add" value="'.get_awcsforum_word('word_add').'"> '; $out .= get_awcsforum_word('admin_lang_owner') . ' <a target="blank" href="http://' . str_replace('http://', '', $r->thmn_where) . '">' . $r->thmn_who . '</a>'; $out .= '</form>'; $out .= '</td></tr>'; $out .= "<tr> <td {$default_css}>"; $out .= '<form action="' . awc_url . 'admin/tplt/set_default" method="post">'; $out .= '<input name="them_id" type="hidden" value="' . $r->thmn_id . '">'; $out .= "{$default_word} <INPUT type='checkbox' name='css_default' value='default' {$default}> "; // $out .= "$active_word <INPUT type='checkbox' name='css_active' value='active' $active> "; $out .= '<input type="submit" value="' . get_awcsforum_word('submit') . '"> '; // $out .= ' <input type="submit" name="save_css_file" value="'.get_awcsforum_word('word_save_as_file').'">'; // $out .= ' <a href="'. awc_url .'admin/tplt/create_new_based_on/'.$r->thmn_id.'">' . get_awcsforum_word('admin_create_new_tmplt_based_on') . '</a> ' ; $out .= $delete; $out .= " <a href='" . awc_url . 'admin/tplt/export_xml/' . $r->thmn_id . "'>export</a>"; $out .= '</form>'; $out .= '<form enctype="multipart/form-data" action="' . awc_url . 'admin/tplt/search" method="post">'; $out .= ' <input name="k" type="text" size="37" /> '; $out .= '<input name="them_id" type="hidden" value="' . $r->thmn_id . '">'; $out .= ' <input type="submit" value="' . get_awcsforum_word('admin_search_tplt') . '">'; $out .= '</form>'; $out .= '</td></tr>'; $out .= '</table>'; $out .= "<br />"; } /* $awc_f_theme_tplt = $this->rDB->tableName( 'awc_f_theme_tplt' ); $sql = "SELECT tplt_section FROM $awc_f_theme_tplt WHERE tplt_thmn_id=$this->thmn_id GROUP BY tplt_section" ; $res = $this->rDB->query($sql); while ($r = $this->rDB->fetchObject( $res )) { $out .= '<a href="'.awc_url.'admin/tplt/show_section/'.$r->tplt_section .'">' . $r->tplt_section . '</a> <br /> '; } */ $this->rDB->freeResult($res); Set_AWC_Forum_BreadCrumbs('', true); $wgOut->addHTML($out); }
function exported_css_list($ext = '.xml') { global $wgOut, $awc; Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_exported_files'), true); // xported_files if ($ext == '.xml') { $url = awc_path . 'xported_files/'; $dir = awc_dir . 'xported_files/'; } else { $url = awc_path . 'skins/css/'; $dir = awc_dir . 'skins/css/'; } $d = dir($dir); while (false !== ($entry = $d->read())) { if (substr($entry, -4) == $ext) { $export_files[] = $entry; } } $d->close(); # die(print_r($export_files)); $html = '<hr><br />' . get_awcsforum_word('admin_lang_download_export') . '<hr><br />'; if (!isset($export_files)) { return $wgOut->addHTML($html); } arsort($export_files); foreach ($export_files as $file) { $html .= '(<a href="' . awc_url . 'admin/css/delete_export_file/' . $file . '">' . get_awcsforum_word('delete') . '</a>) - '; $html .= ' <a target="blank" href="' . $url . $file . '">' . str_replace('export_', '', $file) . '</a><br>'; } # $html .= get_awcsforum_word('admin_lang_download_export'); return $wgOut->addHTML($html); }
function credits() { global $wgOut, $awc_tables; Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_credits'), true); Set_AWC_Forum_SubTitle(get_awcsforum_word('word_credits'), get_awcsforum_word('word_specialthanks')); $dbr = wfGetDB(DB_SLAVE); $sql = "SELECT lang_name, lang_owner_info FROM {$awc_tables['awc_f_langs']}"; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { $lang_info[$r->lang_name]['lang_owner_info'] = unserialize($r->lang_owner_info); } get_awcsforum_word('word_awcthanks') == '' ? $ty = "AWC would like to thank..." : ($ty = get_awcsforum_word('word_awcthanks')); $wgOut->addHTML('<br /><b>' . $ty . '</b><hr>'); get_awcsforum_word('word_thanksforthesmilies') == '' ? $htpc = "Has been a GREAT help !" : ($htpc = get_awcsforum_word('word_beenagreatehelp')); $wgOut->addHTML('<br /><a target="blank" href="">HTPC</a> ' . $htpc); get_awcsforum_word('word_thanksforthesmilies') == '' ? $smilies = "Thanks for the smilies" : ($smilies = get_awcsforum_word('word_thanksforthesmilies')); $wgOut->addHTML('<br /><hr><a target="blank" href="http://www.greghilton.com">Greg Hilton</a> ' . $smilies); $wgOut->addHTML('<br /><br /><hr><b>' . get_awcsforum_word('word_langtranslate') . '</b><hr>'); foreach ($lang_info as $k => $v) { $wgOut->addHTML($k . ' - ' . $lang_info[$k]['lang_owner_info']['lang_owner_when'] . '<br />' . $lang_info[$k]['lang_owner_info']['lang_owner'] . '<br /><a target="blank" href="http://' . str_replace('http://', '', $lang_info[$k]['lang_owner_info']['lang_owner_contact']) . '">' . $lang_info[$k]['lang_owner_info']['lang_owner_contact'] . '</a><br /><br />'); # die(print_r($lang_info)); } $wgOut->addHTML('<br /><hr>'); }
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 DisplayUserInfo_for_admin() { global $wgOut, $awcs_forum_config; if ($this->todo_url == 'member_options') { Set_AWC_Forum_SubTitle(get_awcsforum_word('mem_memCP'), $this->membername); } if ($this->todo_url == 'member_options') { Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('mem_memCP')); Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . $this->todo_url . '">' . get_awcsforum_word('word_mem') . '</a>'); Set_AWC_Forum_BreadCrumbs($this->membername, true); } $html = ''; /* $user_get = array(); $user_get[] = 'm_id'; $user_get[] = 'm_idname'; $user_get[] = 'm_sig'; $user_get[] = 'm_viewaadv'; $user_get[] = 'm_displaysig'; $user_get[] = 'm_displaysigonce'; $user_get[] = 'm_adv'; $user_get[] = 'm_advtag'; $user_get[] = 'm_displaysigonce'; $info = GetMemInfo($this->m_id, $user_get); unset($user_get); */ $sig_is = isset($this->mem_info['m_sig']) ? $this->mem_info['m_sig'] : ''; #$m_viewaadv = isset($this->mem_info['m_viewaadv']) ? $this->mem_info['m_viewaadv'] == '1'?'checked' : '' : '' ; #$m_displaysig = isset($this->mem_info['m_displaysig']) ? $this->mem_info['m_displaysig'] == '1'? 'checked' : '' : '' ; #$m_displysigonce = isset($this->mem_info['m_displaysigonce']) ? $this->mem_info['m_displaysigonce'] == '1'? 'checked' : '' : '' ; if (isset($this->mem_info['m_adv'])) { $m_adv = '<DIV align="center"><img align="left" src="' . $this->mem_info['m_adv'] . '" border="0" height="' . $this->mem_info['m_advh'] . '" width="' . $this->mem_info['m_advw'] . '" align="middle"/></div>'; $m_advURL = $this->mem_info['m_adv']; $m_advtag = $this->mem_info['m_advtag']; if ($m_advtag == '') { $m_advtag = $m_advURL; } } else { $m_adv = ''; $m_advURL = ''; $m_advtag = ''; } # start table... #$html = '<a href="http://wiki.anotherwebcom.com/Category:MediaWiki:Forum" target="new"><img src="http://anotherwebcom.com/awc_forum_update.gif"></a>'; $html = '<p align="right"><a href="http://wiki.anotherwebcom.com/Category:MediaWiki:Forum" target="new"><img src="http://anotherwebcom.com/awc_forum_update.gif"></a></p>'; $html .= '<br /><table width="100%" class="forum_posts" cellpadding="0" cellspacing="0">'; $html .= '<tr><td valign="top"> '; # MISC User Settings ... #$html .= '<form action="'.awc_url. $this->todo_url . 'miscusersettings" method="post">'; #$html .= '<input name="mem_name" type="hidden" value="'.$this->membername.'">' ; #$html .= '<input name="m_id" type="hidden" value="'.$this->m_id.'">' ; #$html .= '<INPUT TYPE=CHECKBOX NAME="m_viewaadv" '. $m_viewaadv.'> ' .get_awcsforum_word('mem_showAdv') . "<br />" ; # $html .= '<INPUT TYPE=CHECKBOX NAME="m_displaysig" '.$m_displaysig.'> ' .get_awcsforum_word('mem_showsigs') . "<br />" ; # $html .= '<INPUT TYPE=CHECKBOX NAME="m_displaysigonce" '.$m_displysigonce.'> ' .get_awcsforum_word('mem_showsigsonlyonce') . "<br />" ; #$html .= '<input type="submit" value="'.get_awcsforum_word('submit').'"></form><br /><hr>'; # Avatar stuff ... $html .= get_awcsforum_word('mem_advatarsize') . ' ' . $awcs_forum_config->cf_AvatraSize . '<hr>'; if ($awcs_forum_config->cf_advatar_no_url == '0') { $html .= get_awcsforum_word('mem_advatar_no_url') . '<br />'; } if ($awcs_forum_config->cf_advatar_no_wiki == '0') { $html .= get_awcsforum_word('mem_advatar_no_wiki') . '<br />'; } $html .= $m_adv . ' <br /> '; $html .= ' <form enctype="multipart/form-data" id="get_advatar" name="get_advatar" action="' . awc_url . $this->todo_url . 'CheckAvatraSize" method="post">'; $html .= ' <input name="mem_name" type="hidden" value="' . $this->membername . '">'; $html .= ' <input name="m_id" type="hidden" value="' . $this->m_id . '">'; $html .= ' <input name="path" type="text" value="' . $m_advtag . '" size="100"><br />'; if ($this->upload == '1') { $html .= ' <input name="uploaded" type="file" size="87" /><br />'; } $html .= ' <INPUT TYPE=CHECKBOX NAME="clear_ad"> ' . get_awcsforum_word('mem_delete_advatar') . '<br />'; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '"></form><br /><br />'; $html .= '</td></tr>'; $html .= '<tr><td>'; $html .= '<form action="' . awc_url . $this->todo_url . 'save_sig" method="post">'; $html .= '<br /><br /><table width="100%" class="forum_posts" cellpadding="0" cellspacing="0">'; $html .= '<tr><td>' . get_awcsforum_word('mem_word_sig') . '</td></tr>'; $html .= '<tr><td class="mem_name">'; $html .= convert($wgOut->parse($sig_is)); $html .= '</tr></td></table>'; $html .= '<table class="dl_maintable" cellpadding="0" cellspacing="0"><tr>'; $html .= '<td width="100%" align="left">'; $html .= $this->WikiToolBar; $html .= '<input name="mem_name" type="hidden" value="' . $this->membername . '">'; $html .= '<input name="m_id" type="hidden" value="' . $this->m_id . '">'; $html .= '<textarea name="wpTextbox1" id="wpTextbox1" cols="98%" rows="10" wrap="virtual" class="post_box" onKeyDown="limitText(this.form.wpTextbox1,this.form.countdown,' . $this->sig_length . ');" onKeyUp="limitText(this.form.wpTextbox1,this.form.countdown,' . $this->sig_length . ');"">' . $sig_is . '</textarea>'; $html .= '<br />'; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '"> ' . get_awcsforum_word('cf_SigLength') . ' ' . $this->sig_length . ' / <input readonly type="text" name="countdown" size="3" value="100"></form>'; $html .= '</td>'; $html .= '</tr></table></form>'; $html .= '</td></tr>'; $html .= '</table><br /><br />'; return $html; }
function splitmerge_get($id) { global $wgOut, $tplt, $awc_tables; if (UserPerm < 2) { return $wgOut->loginToUse(); } $id = $id[0]; awcsforum_funcs::get_page_lang(array('lang_txt_thread')); // get lang difinitions... Set_AWC_Forum_SubTitle(get_awcsforum_word('word_split_merge'), ''); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_split_merge'), true); $dbr = wfGetDB(DB_SLAVE); $r = $dbr->selectRow('awc_f_posts', array('p_title'), "p_id={$id}", __METHOD__, array('OFFSET' => 0, 'LIMIT' => 1)); $title = $r->p_title; unset($r); $sql = "SELECT f_id, f_name FROM {$awc_tables['awc_f_forums']} WHERE f_perm <= '" . UserPerm . "' ORDER BY f_order ASC "; $info['forums_dropdown'] = '<select name="fID">'; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { $info['forums_dropdown'] .= '<option value="' . $r->f_id . '">' . $r->f_name . '</option>'; } $dbr->freeResult($res); unset($dbr, $r, $res); $info['forums_dropdown'] .= '</select>'; $info['pID'] = $id; $word['word_create_new_thread'] = get_awcsforum_word('word_create_new_thread'); $word['word_thread_title_for_new_thread'] = get_awcsforum_word('word_thread_title_for_new_thread'); $word['submit'] = get_awcsforum_word('submit'); $word['word_merge_this_post_to_this_thread'] = get_awcsforum_word('word_merge_this_post_to_this_thread'); $tplt->add_tplts(array("'split_and_merge'"), true); $out = $tplt->phase($word, $info, 'split_and_merge', true); $wgOut->addHTML($out); }
function awcs_forum_error($err) { global $wgOut, $awcs_forum_config, $wgSitename, $tplt; awcsforum_funcs::get_page_lang(array('lang_txt_errormsg')); // get lang difinitions... $tplt->add_tplts(array("'error_table'"), true); $Tforum_name = str_replace('|$|', ' ' . $wgSitename . ' ', $awcs_forum_config->name); Set_AWC_Forum_SubTitle($Tforum_name, get_awcsforum_word('word_Error')); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_Error'), true); $error = get_awcsforum_word($err); if ($error == '') { $error = $err; } $info['error'] = $error; $word['word_Error'] = get_awcsforum_word('word_Error'); $html = $tplt->phase($word, $info, 'error_table', true); $wgOut->addHTML($html); }
function ShowThreads($id) { global $LimitJump_top, $LimitJump_bot, $awcUser; global $wgOut, $wgUser, $WhoWhere, $awc_tables, $numthreadcols, $tplt; $perm = new awcs_forum_perm_checks(); $thread_tools = new awcs_forum_thread_list_tools(); $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('replies' => get_awcsforum_word('word_replies'), 'views' => get_awcsforum_word('views'), 'last_action' => get_awcsforum_word('last_action'), 'started_by' => get_awcsforum_word('forum_started_by')); $f_id = (int) $id; $sql = $this->rDB->selectSQLText(array('awc_f_forums', 'awc_f_cats'), array('f_name, f_desc, f_top_tmplt, f_parentid, f_id, f_threads, f_wiki_read_perm, f_wiki_write_perm, f_passworded, cat_name'), "f_id={$f_id}", __METHOD__, array('OFFSET' => '0', 'LIMIT' => '1'), array('awc_f_cats' => array('LEFT JOIN', 'cat_id=f_parentid'))); $res = $this->rDB->query($sql); $r = $this->rDB->fetchRow($res); $this->rDB->freeResult($res); $forum_info = array(); $forum_info['f_name'] = $r['f_name']; $forum_info['f_desc'] = $r['f_desc']; $forum_info['f_top_tmplt'] = $r['f_top_tmplt']; $forum_info['cid'] = $r['f_parentid']; $forum_info['cat_name'] = $r['cat_name']; $forum_info['fid'] = $r['f_id']; $forum_info['f_threads'] = $r['f_threads']; $forum_info['f_wiki_write_perm'] = $r['f_wiki_write_perm']; $forum_info['f_wiki_read_perm'] = $r['f_wiki_read_perm']; $forum_info['f_passworded'] = $r['f_passworded']; $WhoWhere['type'] = 'forum'; $WhoWhere['where'] = 'cid' . $r['f_parentid'] . '|fid' . $r['f_id'] . '||awc-split||' . $forum_info['f_name']; $WhoWhere['perm'] = $forum_info['f_wiki_read_perm']; unset($r, $res); // check for Forums Subscriptions if ($awcUser->isLoggedIn and $this->cf_forumsubscrip == '1') { $m_forum_subsrib = array(); $m_forum_subsrib = $awcUser->m_forum_subsrib; if (!empty($m_forum_subsrib)) { if (!array_key_exists($id, $m_forum_subsrib)) { $word_subscribe = get_awcsforum_word('word_subscribe'); $options_menu = null; } else { $word_subscribe = get_awcsforum_word('word_unsubscrib'); $options_menu = get_awcsforum_word('word_youraresubscribed'); if ($awcUser->m_forum_subsrib[$id] == '') { $dbw = wfGetDB(DB_MASTER); $awcUser->m_forum_subsrib[$id] = 'seen'; awcsforum_funcs::get_table_names(array('awc_f_mems', 'awc_f_watchforums')); $sql = "UPDATE {$awc_tables['awc_f_watchforums']} f \r\r\n JOIN {$awc_tables['awc_f_mems']} m\r\r\n ON f.wtchf_mem_id=m.m_id \r\r\n SET f.wtchf_sent=0, m.m_forum_subsrib='" . serialize($awcUser->m_forum_subsrib) . "' \r\r\n WHERE f.wtchf_forum_id = {$id} AND f.wtchf_mem_id = {$awcUser->mId}"; $dbw->query($sql); } } } else { $word_subscribe = get_awcsforum_word('word_subscribe'); $options_menu = null; } } $ann_threads = '<form name="mod_form" enctype="multipart/form-data" action="' . awc_url . 'mod/" method="post"> <input name="todo" type="hidden" value="mod_thread">'; # query for Announcement threads... $totalAnnocments = 0; $sql = "SELECT t.t_id,t.t_ann,t.t_pin,t.t_status,t.t_poll,t.t_name,t.t_starter,t.t_starterid,t.t_topics,t.t_hits,t.t_lastdate, t.t_lastuser, t.t_lastuserid, t.t_forumid \r\r\n\t\t\t\tFROM {$awc_tables['awc_f_anns']} a\r\r\n INNER JOIN {$awc_tables['awc_f_threads']} t ON a.ann_id=t.t_id \r\r\n\t\t\t\tORDER BY t.t_lastdate DESC, t.t_name DESC "; $res = $this->rDB->query($sql); $a = null; $sa = null; $to_skin = array(); while ($r = $this->rDB->fetchObject($res)) { $a++; if ($a == 1) { // create announcements header $to_skin['col_5_isSearch_forum_name'] = ''; $to_skin['tr_id'] = 'id="annc"'; $to_skin['first_col_name'] = get_awcsforum_word('announcement'); $ann_threads .= $tplt->phase($word_headers, $to_skin, 'thread_list_header'); unset($to_skin); } /* check if threads being looped are part of the current forum if so, count them for the "math" in the thread-display-limit */ if ($r->forum_id == $id) { $totalAnnocments++; } $to_skin = $thread_tools->loop_thread_list($r); $ann_threads .= $tplt->phase($word, $to_skin, 'thread_list_rows'); // unset($to_skin); } $this->rDB->freeResult($res); unset($r, $res); if ($a >= 1) { $ann_threads .= "</table><br />"; } $can_read = $perm->can_read($forum_info['f_wiki_read_perm']); if (!$can_read) { global $wgOut; $wgOut->addHTML($ann_threads); return awcs_forum_error('no_forum_read_perm'); } if (!isset($awcUser->pw)) { $awcUser->pw[0] = 0; } if ($perm->is_password($forum_info['f_passworded']) and !in_array($id, $awcUser->pw)) { // show Announcement's then password field Set_AWC_Forum_SubTitle($forum_info['f_name'], $forum_info['f_desc'], ''); Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'sc/id' . $forum_info['cid'] . '">' . $forum_info['cat_name'] . '</a>'); Set_AWC_Forum_BreadCrumbs(strtr($forum_info['f_name'], "_", " "), true); 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="' . $id . '"> <input name="pw" type="password" size="20"> <input type="submit" value="' . get_awcsforum_word('submit') . '"> </form><br /><br />'; $wgOut->addHTML($ann_threads . $password_field); return; } $post_button = ''; if ($awcUser->canPost and $perm->can_post($forum_info['f_wiki_write_perm'])) { $word1['start_new_thread'] = str_replace(' ', ' ', get_awcsforum_word('start_new_thread')); $info['url'] = awc_url . 'post/todo_new_t/id' . $id; $post_button = $tplt->phase($word1, $info, 'forum:start_new_thread'); } $tplt->kill('forum:start_new_thread'); // add templet after anncoments... todo if (strlen($forum_info['f_top_tmplt']) > 1) { $ann_threads .= add_tmpl_to_skin($forum_info['f_top_tmplt']); } $TotalPosts = intval($forum_info['f_threads'] - $totalAnnocments); $total['TotalPosts'] = $TotalPosts; $limit = GetLimit($total, 'cat'); if ($awcUser->isLoggedIn and $this->cf_forumsubscrip == '1') { $info['url'] = awc_url . 'post/fsub/id' . $id; $word1['subscrib'] = $word_subscribe; $sb = $tplt->phase($word1, $info, 'forum:subscrib_to_forum'); } else { $sb = null; } unset($word1); $tplt->kill('forum:subscrib_to_forum'); // add tplt, start new thread button, subscrib, page jumps $info['jump'] = $LimitJump_top; $info['new_thread_button'] = $post_button; $info['subscrib_button'] = $sb; $html = $tplt->phase('', $info, 'thread_list_header_menu', true); unset($info); $info['col_5_isSearch_forum_name'] = ''; $info['tr_id'] = null; $info['first_col_name'] = UserPerm >= 2 ? '<INPUT type="checkbox" name="checkbox_toggle" onChange="return checkall_toggle(\'mod_form\',\'tID[]\', this.checked)"> ' : null; $info['first_col_name'] .= get_awcsforum_word('thread_title'); $html .= $tplt->phase($word_headers, $info, 'thread_list_header', true); unset($info, $word_headers); $limit = str_replace('LIMIT ', '', $limit); $limitSPLIT = explode(',', $limit); $offset = isset($limitSPLIT[0]) ? $limitSPLIT[0] : 0; $limit = isset($limitSPLIT[1]) ? $limitSPLIT[1] : 15; $t_forumid = (int) $id; $sql = $this->rDB->selectSQLText(array('awc_f_threads'), array('t_id,t_ann,t_pin,t_status,t_poll,t_name,t_starter,t_starterid,t_topics,t_hits,t_lastdate,t_lastuser,t_lastuserid'), "t_forumid={$t_forumid} AND t_ann=0", __METHOD__, array('OFFSET' => $offset, 'LIMIT' => $limit, 'ORDER BY' => 't_pin DESC, t_lastdate DESC,t_name')); $res = $this->rDB->query($sql); $isThreads = false; $thread_tools->thread_count = 0; while ($r = $this->rDB->fetchObject($res)) { $isThreads = true; $to_tplt = $thread_tools->loop_thread_list($r); $html .= $tplt->phase($word, $to_tplt, 'thread_list_rows'); } $this->rDB->freeResult($res); unset($r, $res); $tplt->kill('thread_list_rows'); if (!$isThreads) { // keep this here... $tplt->add_tplts(array("'empty_forum'"), true); $info['new_thread_button'] = $post_button; $info['subscrib_button'] = $sb; $word['empty_forum'] = get_awcsforum_word('word_emptyforum'); $html = $tplt->phase($word, $info, 'empty_forum', true); } $html .= "</table>"; $e = array(); $e['fID'] = $id; $e['cID'] = $forum_info['cid']; Set_AWC_Forum_SubTitle($forum_info['f_name'], $forum_info['f_desc'], $e); unset($e); Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'sc/id' . $forum_info['cid'] . '">' . $forum_info['cat_name'] . '</a>'); $BreadCrumb = Set_AWC_Forum_BreadCrumbs(strtr($forum_info['f_name'], "_", " "), true); # # $info['page_jumps'] = $LimitJump_bot ? $LimitJump_bot : null; if (UserPerm >= 2) { $words['ann'] = get_awcsforum_word('thread_makeAnnouncement'); $words['unann'] = get_awcsforum_word('thread_UnMakeAnnouncement'); $mod['ann'] = UserPerm >= 10 ? $tplt->phase($words, '', 'thread_listing_mod_drop_ann') : null; $tplt->kill('thread_listing_mod_drop_ann'); $words['pinn'] = get_awcsforum_word('pinned_word'); $words['unpinn'] = get_awcsforum_word('pinnedUn_word'); $words['lock'] = get_awcsforum_word('lockThread_word'); $words['unlock'] = get_awcsforum_word('lockThreadUn_word'); $words['move'] = get_awcsforum_word('mod_movethread'); $words['delete'] = get_awcsforum_word('delete'); $words['mod_options'] = get_awcsforum_word('mod_post'); $info['page_jumps'] = ' ' . $tplt->phase($words, $mod, 'thread_listing_mod_drop', true) . $info['page_jumps']; unset($words, $mod); } $info['BreadCrumb'] = $BreadCrumb; $html .= $tplt->phase($word, $info, 'bottom_page_jumps', true); return $ann_threads . $html . '</form>'; }