function __construct()
 {
     global $wgParser, $wgOut, $wgScriptPath;
     global $awcs_forum_config, $tplt, $awcUser;
     $this->awc_wgParser = $wgParser;
     $this->awc_wgOut = $wgOut;
     $this->wgScriptPath = $wgScriptPath;
     $this->canPost = $awcUser->canPost;
     // need forum-wiki-perm
     $this->uID = $awcUser->mId;
     $this->uName = $awcUser->mName;
     $this->guest = $awcUser->guest;
     $this->viewing_mem_info['displaysigs'] = isset($awcUser->m_forumoptions['mem_showsigs']) ? $awcUser->m_forumoptions['mem_showsigs'] : 1;
     $this->viewing_mem_info['displaysigonce'] = isset($awcUser->m_forumoptions['mem_showsigsonlyonce']) ? $awcUser->m_forumoptions['mem_showsigsonlyonce'] : 0;
     $this->viewing_mem_info['viewaadv'] = isset($awcUser->m_forumoptions['mem_showAdv']) ? $awcUser->m_forumoptions['mem_showAdv'] : 1;
     $this->viewing_mem_info['displaysmiles'] = isset($awcUser->m_forumoptions['cf_displaysmiles']) ? $awcUser->m_forumoptions['cf_displaysmiles'] : 1;
     $this->pm_enable = '1';
     $this->convert_wTitle = $awcs_forum_config->cf_wiki_titles;
     $this->displaysmiles = $awcs_forum_config->cf_displaysmiles;
     $this->showTcount = $awcs_forum_config->cf_showThreadCount;
     $this->showPcount = $awcs_forum_config->cf_showPostCount;
     $this->showWEcount = $awcs_forum_config->wikieits;
     $this->show_guest_ip = $awcs_forum_config->cf_show_guest_ip;
     $this->multi_polls = $awcs_forum_config->cf_allow_multi_pols;
     $this->cf_SigGuestView = $awcs_forum_config->cf_SigGuestView;
     $this->cf_AdvatarGuestView = $awcs_forum_config->cf_AdvatarGuestView;
     $this->cf_AvatraSize = $awcs_forum_config->cf_AvatraSize;
     $this->polls_enabled = $awcs_forum_config->cfl_Polls_enabled;
     //  $this->bcmod = function_exists('bcmod') ? true : false ;
     $this->emotions = GetEmotions();
     $user_get = array();
     $user_get[] = 'm_id';
     $user_get[] = 'm_idname';
     if ($this->showTcount == 1) {
         $user_get[] = 'm_posts';
     }
     if ($this->showPcount == 1) {
         $user_get[] = 'm_topics';
     }
     if ($this->viewing_mem_info['displaysigs'] == 1) {
         $user_get[] = 'm_sig';
     }
     if ($this->viewing_mem_info['viewaadv'] == 1) {
         $user_get[] = 'm_adv_size';
     }
     if ($this->viewing_mem_info['viewaadv'] == 1) {
         $user_get[] = 'm_adv';
     }
     //$user_get[] = 'm_sig';
     //$user_get[] = 'm_adv_size';
     //$user_get[] = 'm_adv';
     $this->user_info_cols = $user_get;
     unset($user_get);
     self::can_do();
 }
 function enter_threads($action)
 {
     global $wgRequest, $awcs_forum_config, $WhoWhere;
     $this->cf_AvatraSize = $awcs_forum_config->cf_AvatraSize;
     include_once awc_dir . 'includes/thread_funk.php';
     $this->cookie_expir = $awcs_forum_config->cfl_Post_cookie_postcountexpire;
     $this->quick_height = $awcs_forum_config->cfl_Post_quickpost_box_height;
     $this->cf_SigGuestView = $awcs_forum_config->cf_SigGuestView;
     $this->cf_AdvatarGuestView = $awcs_forum_config->cf_AdvatarGuestView;
     $this->displaysmiles = $awcs_forum_config->cf_displaysmiles;
     $this->wiki_title_search_len = $awcs_forum_config->cf_wiki_title_search_len;
     $this->cf_threadsubscrip = $awcs_forum_config->cf_threadsubscrip;
     $this->wiki_titles = $awcs_forum_config->cf_wiki_titles;
     $this->wiki_pages = $awcs_forum_config->cf_wiki_pages;
     $this->display_mem_titles = $awcs_forum_config->cf_display_mem_titles;
     $this->emotions = GetEmotions();
     $spl = explode("/", $action);
     $todo = $spl[0];
     if (isset($spl[1])) {
         $id = str_replace(array('id', '_'), '', $spl[1]);
     } else {
         $id = $wgRequest->getVal('id');
     }
     if (!is_numeric($id)) {
         return awcs_forum_error('word_nothread');
     }
     $this->id = $id;
     if (!$this->id) {
         $this->id = $wgRequest->getVal('id');
     }
     define('what_page', $todo);
     $WhoWhere['type'] = 'forum';
     switch ($todo) {
         case 'st':
             $str = $this->GetPosts($this->id);
             break;
         case 'sp':
             $str = $this->GetPost($this->id);
             break;
         case 'ann_thread':
             $this->do_ann_thread($this->id, str_replace('fid', '', $spl[3]), '1');
             break;
         case 'edit_post':
             #  $str = $this->edit_post();
             break;
         case 'last_post':
             self::get_latest_post($this->id);
             break;
     }
     #$str = $wgOut->parse($str);
     #$wgOut->addHTML($str);
 }
 function box()
 {
     global $tplt;
     global $oFCKeditorExtension, $pageEditor;
     if ($this->is_pm) {
         $to_skin['posting_message'] = null;
         $word['title'] = get_awcsforum_word('word_posttile');
         $to_skin['user_options'] = $this->user_options;
         $to_skin['pm_send_to_box'] = $this->mem_pm_sendto;
     } else {
         #$info['subscribed_word'] = $extra['subscribed_word'];
         $word['subscribed_word'] = get_awcsforum_word('word_subscribe');
         $word['subscribed_email'] = get_awcsforum_word('word_subscribe_email');
         $info['subscribed_email'] = $this->subscribed_email;
         $word['subscribed_list'] = get_awcsforum_word('word_subscribe_memcp');
         $info['subscribed_list'] = $this->subscribed_list;
         $word['subscribed_no'] = get_awcsforum_word('word_unsubscrib');
         $info['subscribed_no'] = $this->subscribed_no;
         if (isset($this->subscribe) and $this->subscribe == 'dont_show' or $this->mId == 0) {
             $to_skin['user_options'] = null;
         } else {
             $to_skin['user_options'] = $tplt->phase($word, $info, 'subscrib_chk', true);
         }
         $word['title'] = get_awcsforum_word('word_posttile');
         $to_skin['pm_send_to_box'] = null;
     }
     $to_skin['url'] = $this->url;
     $to_skin['javaCheck'] = $this->javaCheck;
     $to_skin['posting_message'] = $this->f_posting_mesage_tmpt;
     $to_skin['post'] = $this->post;
     $to_skin['rows'] = $this->quick_box ? $this->quick_box_height : $this->box_height;
     $to_skin['max_chr'] = $this->max_title_lenth;
     $to_skin['cols'] = $this->quick_box ? $this->quick_box_width : $this->box_width;
     $to_skin['title'] = $this->title;
     $to_skin['hidden_input'] = null;
     $to_skin['mod_options'] = null;
     $to_skin['hidden_input'] .= isset($this->num_topics) ? '<input name="num_topics" type="hidden" value="' . $this->num_topics . '">' : null;
     $to_skin['hidden_input'] .= isset($this->pID) ? '<input name="pID" type="hidden" value="' . $this->pID . '">' : null;
     $to_skin['hidden_input'] .= isset($this->Thread_Title) ? '<input name="threadtitle" type="hidden" value="' . $this->Thread_Title . '">' : null;
     $to_skin['hidden_input'] .= isset($this->isThread) ? '<input name="isThread" type="hidden" value="' . $this->isThread . '">' : null;
     $to_skin['hidden_input'] .= isset($this->fID) ? '<input name="fID" type="hidden" value="' . $this->fID . '">' : null;
     $to_skin['hidden_input'] .= isset($this->tID) ? '<input name="tID" type="hidden" value="' . $this->tID . '">' : null;
     $to_skin['hidden_input'] .= isset($this->f_name) ? '<input name="f_name" type="hidden" value="' . $this->f_name . '">' : null;
     $to_skin['hidden_input'] .= isset($this->t_wiki_pageid) ? '<input name="t_wiki_pageid" type="hidden" value="' . $this->t_wiki_pageid . '">' : null;
     $to_skin['hidden_input'] .= $tplt->phase('', '', 'spam_fields', true);
     if ($this->Show_ann_sticky_lock) {
         if (UserPerm >= 2) {
             $info['ann_chk'] = (isset($this->ann) and $this->ann == '1') ? 'checked' : null;
             $info['pin_chk'] = (isset($this->sticky) and $this->sticky == '1') ? 'checked' : null;
             $info['lock_chk'] = (isset($this->lock) and $this->lock == '1') ? 'checked' : null;
             if (UserPerm == 10) {
                 $word['thread_makeAnnouncement'] = get_awcsforum_word('thread_makeAnnouncement');
                 $info['ann'] = $tplt->phase($word, $info, 'mod_chks_ann', true);
             } else {
                 $info['ann'] = '';
             }
             $word['pinned_word'] = get_awcsforum_word('pinned_word');
             $word['lockThread_word'] = get_awcsforum_word('lockThread_word');
             $to_skin['mod_options'] = $tplt->phase($word, $info, 'mod_chks', true);
         }
     } else {
         $ann = (isset($this->ann) and $this->ann == '1') ? "on" : null;
         $sticky = (isset($this->sticky) and $this->sticky == '1') ? "on" : null;
         $lock = (isset($this->lock) and $this->lock == '1') ? "on" : null;
         $to_skin['hidden_input'] .= '<INPUT TYPE=hidden NAME="ann" value="' . $ann . '">';
         $to_skin['hidden_input'] .= '<INPUT TYPE=hidden NAME="sticky" value="' . $sticky . '">';
         $to_skin['hidden_input'] .= '<INPUT TYPE=hidden NAME="lock" value="' . $lock . '">';
     }
     $to_skin['ExtraWikiToolBar'] = null;
     if (method_exists($oFCKeditorExtension, 'onEditPageShowEditFormInitial') and ($this->FCKeditor and $this->mem_FCKeditor and $this->riched_disable == 0)) {
         $form->textbox1 = str_replace("\r", '<br />', $to_skin['post']);
         $rawPost = $form->textbox1;
         $oFCKeditorExtension->onEditPageShowEditFormInitial($form);
         $to_skin['javaCheck'] = '';
     } else {
         if ($this->extra_wikitools and $this->mem_extra_wikitools and !$this->quick_box) {
             global $wgOut;
             // only needed here...
             $Edittools = GetWikiPage('<wiki>Edittools</wiki>', '', '8', '');
             $Edittools = awc_wikipase($Edittools, $wgOut);
             $to_skin['ExtraWikiToolBar'] = $Edittools;
         }
     }
     $to_skin['SimlieButtons'] = null;
     if ($this->displaysmiles == '1') {
         global $emotions;
         // only needed here...
         if (!isset($emotions)) {
             $emotions = GetEmotions();
         }
         $to_skin['SimlieButtons'] = EmotionsToToolbar($emotions, '');
     }
     $to_skin['WikiToolBar'] = GetWiki_ToolBar();
     // 2.4.3
     $forum_tags = array();
     $forum_tags['center'] = array('open' => '[center]', 'close' => '[/center]', 'image' => 'center.gif');
     $forum_tags['underline'] = array('open' => '[u]', 'close' => '[/u]', 'image' => 'underline.gif');
     $forum_tags['strike'] = array('open' => '[s]', 'close' => '[/s]', 'image' => 'strike.gif');
     $forum_tags['quote'] = array('open' => '[quote=username]', 'close' => '[/quote]', 'image' => 'quote.gif');
     $forum_tags['color'] = array('open' => '[color=red]', 'close' => '[/color]', 'image' => 'color.gif');
     $forum_tags['code'] = array('open' => '[code]', 'close' => '[/code]', 'image' => 'code.gif');
     $forum_tags['search'] = array('open' => '[search]', 'close' => '[/search]', 'image' => 'search.jpg');
     $forum_tags['google'] = array('open' => '[google]', 'close' => '[/google]', 'image' => 'google.gif');
     $forum_tags['yahoo'] = array('open' => '[yahoo]', 'close' => '[/yahoo]', 'image' => 'yahoo.jpg');
     if ($this->SyntaxHighlight_GeSHi) {
         require_once awc_dir . 'config/SyntaxHighlight_GeSHi_tags.php';
     }
     $f_tags = array();
     $f_tags['tags'] = null;
     foreach ($forum_tags as $what => $code) {
         $info['java_script'] = "javascript:insertTags('{$code['open']}', '{$code['close']}', '{$what}')";
         $info['img'] = $code['image'];
         $f_tags['tags'] .= $tplt->phase('', $info, 'forum_tool_bar_tags');
     }
     $tplt->kill('forum_tool_bar_tags');
     $to_skin['ForumBar'] = $tplt->phase('', $f_tags, 'forum_tool_bar', true);
     unset($f_tags, $forum_tags);
     $word['posting_Preview_word'] = get_awcsforum_word('posting_Preview_word');
     $word['submit'] = get_awcsforum_word('submit');
     $submit_buttons = $tplt->phase($word, '', 'button:submit', true);
     if ($this->preview_button) {
         $submit_buttons .= $tplt->phase($word, '', 'button:preview', true);
     }
     $to_skin['submit_buttons'] = $submit_buttons;
     $word['posting_as'] = get_awcsforum_word('word_postingas') . ' <b>' . $this->user_name . '</b>';
     if (!isset($tplt->tplts['post_box']) or empty($tplt->tplts['post_box'])) {
         $tplt->add_tplts(array("'post_box'"), true);
         // need to find out why some severs need this and some dont.
     }
     return $tplt->phase($word, $to_skin, 'post_box', true);
 }