function __construct() { global $tplt, $awcs_forum_config, $awcUser, $str_len; $this->skin = $tplt; $this->list_limit = intval($awcs_forum_config->cfl_Post_DisplayLimit); $this->block_limit = intval($awcs_forum_config->cfl_PostPageBlockLimitThreadTitle); $this->html_ext = $awcs_forum_config->cf_html_extension; $this->threadtitlelength = $awcs_forum_config->cfl_ThreadTitleLength; $this->show_guest_ip = $awcs_forum_config->cf_show_guest_ip; $this->words['last'] = get_awcsforum_word('word_last'); $this->words['new_thread'] = get_awcsforum_word('1indicator_newThreadOrPost'); $this->words['locked'] = get_awcsforum_word('1indicator_locked'); $this->words['sticky'] = get_awcsforum_word('1indicator_sticky'); $this->words['locked_sticky'] = get_awcsforum_word('1indicator_lockSticky'); $this->words['poll'] = get_awcsforum_word('word_poll'); $this->words['forums'] = get_awcsforum_word('word_forum'); $this->words['guest'] = get_awcsforum_word('word_guest'); $this->isGuest = $awcUser->guest; // if (function_exists('bcmod')) $this->alt_row = true; if (function_exists('mb_strlen')) { $str_len = 'awc_mbstrlen'; } else { $str_len = 'awcsforum_funcs::awc_strlen'; } }
function Uninstallforum() { global $wgOut, $wgUser, $wgDBprefix, $awc; $dbw =& wfGetDB(DB_MASTER); $dbw->sourceFile(awc_dir . 'updates/install/ununinstall_tables.sql'); $lines = file(awc_dir . 'updates/install/ununinstall_tables.sql'); foreach ($lines as $line_num => $line) { $wgOut->addHTML(htmlspecialchars($line) . "<br />\n"); } $page = $_SERVER["SERVER_NAME"] . $_SERVER["SCRIPT_NAME"]; $file = "http://anotherwebcom.com/app_count.php?app=WikiForum_UnInstall&url={$page}"; $file = @fopen($file, "r"); $wgOut->addHTML('<br>' . get_awcsforum_word('word_done') . '<br>' . get_awcsforum_word('admin_lang_uninstall_remocelocalsttingsedit') . '<br><b>require( "$IP/extensions/awc/forums/awc_forum.php" ); #awc</b><br>' . get_awcsforum_word('admin_lang_uninstall_anddeleteallfiles') . '<br>'); }
function get_all() { global $wgOut; $dbr = wfGetDB(DB_SLAVE); $awc_f_member_titles = $dbr->tableName('awc_f_member_titles'); $sql = "SELECT * FROM {$awc_f_member_titles} "; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { $memtitles .= get_awcsforum_word('cf_display_mem_title') . ' <input name="' . $r->memtitle_id . '" type="text" value="' . $r->memtitle_title . '"> ' . get_awcsforum_word('cf_display_mem_count') . ' <input name="' . $r->memtitle_id . '_count" type="text" value="' . $r->memtitle_postcount . '"> ' . get_awcsforum_word('cf_display_mem_img') . ' <input name="' . $r->memtitle_id . '_img" type="text" value="' . $r->memtitle_img . '"> ' . get_awcsforum_word('cf_display_mem_css') . ' <input name="' . $r->memtitle_id . '_css" type="text" value="' . $r->memtitle_css . '"><br />'; } $html .= '<form action="' . awc_url . 'admin/mem_title/saveEdit/" method="post">'; $html .= $memtitles; $html .= ' <br /><input type="submit" value="' . get_awcsforum_word('edit') . '">'; $html .= '</form><br />'; $wgOut->addHTML($html); #return $memtitles; }
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 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 send() { global $wgOut, $tplt; $before = null; $end = null; $out = null; $bc = null; $spliter = get_awcsforum_word('1indicator_main_bread_crumb'); wfRunHooks('awcsforum_breadcrumb', array(&$before, &$this->links, &$after)); // changed 2.5.7 $bc = implode(' ' . $spliter . ' ', $this->links); $info['bc_links'] = $before . $bc . $after; $BreadCrumb = $info['bc_links']; $out = $tplt->phase('', $info, 'breadcrumbs', true); $wgOut->addHTML($out); return $BreadCrumb; }
/** * Categories delete form * * Displays drop down to move Forums to along with Delete button * @parameter string $cID (Cat ID, used so not to display current Cat in "move to" drop down) * @parameter string $cName (Current Cat name used for display) * @uses get_awcsforum_word * @return string * @since Version 2.5.8 */ function delete_forum($cID, $cName) { $out = '<form onsubmit="return delete_form_check(\'' . get_awcsforum_word('admin_delete_cat') . ' ?\')";" action="' . awc_url . 'admin/cat/delete_cat" method="post">'; $out .= '<input name="cID" type="hidden" value="' . $cID . '">'; $out .= get_awcsforum_word('admin_delete_cat') . ' ( <b>' . $cName . '</b> )<br />'; $out .= get_awcsforum_word('admin_move_forums_to') . ' '; $out .= '<select name="move_to">'; foreach ($this->cat_info as $id => $info) { if ($cID != $id) { $out .= '<option value="' . $id . '"> ' . $info['cat_name'] . '</option>'; } } $out .= '</select>'; $out .= ' <input type="submit" value="' . get_awcsforum_word('delete') . '">'; $out .= '</form><hr />'; return $out; }
function check_for_subscribed_members() { global $awc_tables; $email_adds = array(); // this can be set in a HOOK to false to create your own user-email list if ($this->email_lookup) { $rDB = wfGetDB(DB_SLAVE); $wiki_user = $rDB->tableName('user'); if ($this->forum_or_thread == 'thread') { $sql = "SELECT wu.user_email, t.wtcht_mem_id FROM {$awc_tables['awc_f_watchthreads']} t\n JOIN {$wiki_user} wu\n ON t.wtcht_mem_id=wu.user_id\n WHERE t.wtcht_thread_id={$this->tID} AND t.wtcht_sent=0 AND t.wtcht_todo= 'email'"; } else { $sql = "SELECT wu.user_email, f.wtchf_mem_id FROM {$awc_tables['awc_f_watchforums']} f\n JOIN {$wiki_user} wu\n ON f.wtchf_mem_id=wu.user_id\n WHERE f.wtchf_forum_id={$this->fID} AND f.wtchf_sent=0"; } $res = $rDB->query($sql); while ($r = $rDB->fetchObject($res)) { if ($this->forum_or_thread == 'thread') { if ($this->cur_memID != $r->wtcht_mem_id) { // "safe" check if ($r->user_email != '') { $email_adds[] = $r->user_email; } } } else { if ($this->cur_memID != $r->wtchf_mem_id) { // "safe" check if ($r->user_email != '') { $email_adds[] = $r->user_email; } } } } } wfRunHooks('awcsforum_subscribe_get_email_address', array(&$email_adds, &$this)); // 2.5.5 if (!empty($email_adds)) { require_once awc_dir . 'send_mail.php'; if ($this->forum_or_thread == "thread") { $send_title = get_awcsforum_word('word_email_newreplieswaitingtitle') . ' ' . $this->title; $send_body = get_awcsforum_word('word_email_newreplieswaiting'); $send_body .= " \n" . $this->title; $send_body .= " \n\n <a href='" . awc_url . "st/id" . $this->tID . "'>" . awc_url . "st/id" . $this->tID . "</a><br /><br />"; if ($this->cf_send_post_body_in_email == '1') { $send_body .= " \n" . awcsforum_mailer::check_msg_len($this->post, $this->post_text_limit); } } else { $send_title = get_awcsforum_word('word_email_newreplieswaitingtitle_forum') . ' ' . $this->title; $send_body = get_awcsforum_word('word_email_newreplieswaiting_forum'); $send_body .= " \n" . $this->title; $send_body .= " \n\n <a href='" . awc_url . "sf/id" . $this->fID . "'>" . awc_url . "sf/id" . $this->fID . "</a><br /><br />"; if ($this->cf_send_thread_body_in_email == '1') { $send_body .= " \n" . awcsforum_mailer::check_msg_len($this->post, $this->thread_text_limit); } } $html = true; if ($this->send_email_html == '0') { $html = false; } awcsforum_mailer::send_mail($email_adds, $send_title, $send_body, $html); if ($this->forum_or_thread == 'thread') { $this->wDB->update('awc_f_watchthreads', array('wtcht_sent' => '1'), array('wtcht_thread_id' => $this->tID, 'wtcht_sent' => '0'), ''); } else { $this->wDB->update('awc_f_watchforums', array('wtchf_sent' => '1'), array('wtchf_forum_id' => $this->fID, 'wtchf_sent' => '0'), ''); } } if ($this->subscribe != 'no' and $this->forum_or_thread != "thread") { self::subscribe_to_thread(); self::update_mem_thread(); } }
function TopSearchBox($info) { $html .= '<form id="editform" name="editform" action="' . $awc['link'] . 'search" method="post" enctype="multipart/form-data">'; $html .= '<input name="tID" type="hidden" value="' . $info['tID'] . '">'; $html .= '<input name="fID" type="hidden" value="' . $info['fID'] . '">'; $html .= ' <input type="submit" value="' . get_awcsforum_word('submit') . '"></form>'; return $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 GetMemInfo($n, $info = '', $uGroup = true) { global $wgOut, $wikieits, $awc_ver; $tmp = array(); $tmp["name"] = null; $tmp["m_id"] = $n; $info[] = 'm_idname'; $info[] = 'm_id'; // awc_pdie($n); $user_fields = implode(',', $info); $dbr =& wfGetDB(DB_SLAVE); $dbr->ignoreErrors(true); if (!($r = $dbr->selectRow('awc_f_mems', array($user_fields), "m_id={$n}", __METHOD__, array('OFFSET' => 0, 'LIMIT' => 1)))) { if (!$dbr->tableExists('awc_f_mems')) { $dbr->ignoreErrors(false); $tmp['name'] = 'error_no_dbase_table'; return $tmp; } $dbr->ignoreErrors(false); $tmp['name'] = ''; return $tmp; } if (empty($r) or !isset($r)) { $tmp['name'] = ''; return $tmp; } # awc_pdie($r); if (empty($r) or !isset($r)) { $tmp['name'] = ''; return $tmp; } foreach ($r as $k => $info) { # print($k . "<br />"); switch ($k) { case 'm_idname': case 'm_nickname': #awc_pdie($info); $tmp['name'] = $info; # if($tmp['name'] == '') $tmp['name'] = $r->m_idname; break; case 'm_adv': $tmp['m_adv'] = $r->m_adv; if (isset($r->m_adv_size)) { $s = explode('x', $r->m_adv_size); $tmp['m_advw'] = isset($s[0]) ? $s[0] : '75'; $tmp['m_advh'] = isset($s[1]) ? $s[1] : '75'; } break; case 'm_forum_subsrib': case 'm_thread_subsrib': case 'm_pmoptions': case 'm_forumoptions': case 'm_menu_options': $tmp[$k] = isset($info) ? unserialize($info) : ''; #$tmp[$k] = unserialize($info) ; break; default: $tmp[$k] = $info; break; } } if ($tmp['name'] == '') { $tmp['name'] = $r->m_idname; } if ($uGroup) { $g = ''; $wiki_user_tbl = $dbr->tableName('user'); $wiki_user_groups_tbl = $dbr->tableName('user_groups'); #$user_editcount = ', u.user_editcount'; $user_editcount = $wikieits == '1' ? ', u.user_editcount' : null; $sql = "SELECT g.ug_group {$user_editcount} \r\r\n FROM {$wiki_user_tbl} u \r\r\n LEFT JOIN {$wiki_user_groups_tbl} g \r\r\n ON u.user_id=g.ug_user\r\r\n WHERE u.user_id={$n} "; $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { if (isset($r->user_editcount)) { $tmp['edit_count'] = $r->user_editcount; } // $g .= wfMsg($r->ug_group) . ", "; $g .= $r->ug_group . ", "; } $dbr->freeResult($res); $g = substr($g, 0, strlen($g) - 2); $tmp['group'] = $g; if ($g == "") { $tmp['group'] = get_awcsforum_word('word_mem'); } } return $tmp; }
function do_merge() { global $wgRequest, $awc_tables; $dbw = wfGetDB(DB_MASTER); $dbr = wfGetDB(DB_SLAVE); $this->tID = $wgRequest->getVal('tID'); $this->pID = $wgRequest->getVal('pID'); $r = $dbr->selectRow('awc_f_threads', array('t_forumid, t_topics'), "t_id={$this->tID}", __METHOD__, array('OFFSET' => 0, 'LIMIT' => 1)); $new_forum_id = $r->t_forumid; $new_t_topics = $r->t_topics; $new_t_topics = $new_t_topics + 1; if ($new_forum_id == '') { return awcs_forum_error(get_awcsforum_word('word_no_thread_id_for_move') . ' ' . $this->tID); } # die(">" . $this->pID); $sql = $dbr->selectSQLText(array('awc_f_posts', 'awc_f_threads'), array('p_threadid, p_forumid, t_topics'), "p_id={$this->pID}", __METHOD__, array('OFFSET' => '0', 'LIMIT' => '1'), array('awc_f_threads' => array('LEFT JOIN', 'p_threadid=t_id'))); /* $r = $dbr->selectRow( 'awc_f_posts, awc_f_threads', array( 'p_threadid, p_forumid, t_topics' ), "p_id = {$this->pID} AND p_threadid=t_id" , __METHOD__, array('OFFSET' => 0 , 'LIMIT' => 1)); */ $res = $dbr->query($sql); $r = $dbr->fetchObject($res); $current_thread_id = $r->p_threadid; $current_forum_id = $r->p_forumid; $current_t_topics = $r->t_topics; $current_t_topics = $current_t_topics - 1; # die("$current_thread_id"); $dbw->update('awc_f_posts', array('p_threadid' => $this->tID, 'p_forumid' => $new_forum_id), array('p_ID' => $this->pID), ''); #self::update_thread_last_post($this->tID); #self::update_thread_last_post($current_thread_id); $sql = "UPDATE {$awc_tables['awc_f_forums']} SET f_replies = f_replies - 1 "; $sql .= " WHERE f_id =" . $current_forum_id; $dbw->query($sql); $sql = "UPDATE {$awc_tables['awc_f_forums']} SET f_replies = f_replies + 1 "; $sql .= " WHERE f_id =" . $new_forum_id; $dbw->query($sql); $dbw->update('awc_f_threads', array('t_topics' => $current_t_topics), array('t_id' => $current_thread_id), ''); $dbw->update('awc_f_threads', array('t_topics' => $new_t_topics), array('t_id' => $this->tID), ''); $dbw->commit(); unset($dbw, $dbr, $r); // Update threads first $this->update_thread_last_post($this->tID); $this->update_thread_last_post($current_thread_id); // Update forums second... $this->update_forum_last_thread($new_forum_id); $this->update_forum_last_thread($current_forum_id); $info['msg'] = 'post_has_been_merged'; $info['url'] = awc_url . "st/id" . $this->tID; return awcf_redirect($info); }
function GetLimit($tmp, $todo) { global $action_url, $awcs_forum_config, $wgRequest, $LimitJump_bot, $LimitJump_top, $LimitJump, $wgTitle, $first_return, $tplt; # die(">". $todo); $TotalPosts = intval($tmp['TotalPosts']); $last_id = '/#last'; $url = null; $url_limit = null; $current_page_num = null; $tmp_top = null; $tmp_bot = null; $back_top = null; $back_bot = null; $HasLimit = false; $page_number = 0; $w_next = get_awcsforum_word('word_next'); $w_prev = get_awcsforum_word('word_prev'); $w_last = get_awcsforum_word('word_last'); switch ($todo) { case 'search': case 'cat': $limit = $awcs_forum_config->cfl_Thread_DisplayLimit; $PageCutOff = $awcs_forum_config->cfl_ThreadPageBlockLimit; break; case 'thread': $limit = $awcs_forum_config->cfl_Post_DisplayLimit + 1; $PageCutOff = $awcs_forum_config->cfl_PostPageBlockLimit; break; } $total_page_count = intval($TotalPosts / $limit); # die(">". $TotalPosts); # loop through "action" and construct a new url also check for 'limit:' in current url $action = $wgRequest->action; $spl = explode("/", $action); foreach ($spl as $k => $value) { # print($value . '<br />'); if (substr($value, 0, 6) == "limit:") { $url_limit = $value; $HasLimit = true; } else { $url .= urlencode($value) . '/'; } } $url = str_replace('//', '/', $url); // do double replace before awc_url or http:// will mess up $url = awc_url . $url; $url = str_replace(' ', '_', $url); // test $s = 0; # carry this all the way down... if ($HasLimit) { $HasLimit = false; $l = explode(":", $url_limit); $lm = explode(",", $l[1]); if (is_numeric($lm[0]) && is_numeric($lm[1])) { $s = $lm[0]; $tmp_limit = 'limit:' . $s . ',' . $limit; $sql_limit = 'LIMIT ' . $s . ',' . $lm[1]; $current_page_num = $s; $HasLimit = true; # die($current_page_num); if ($lm[0] == '0') { $HasLimit = false; } } else { #if(is_numeric($lm[0]) && is_numeric($lm[1])) { $sql_limit = "LIMIT {$s},{$limit}"; } } else { # if($HasLimit) if ($limit) { $sql_limit = "LIMIT {$s},{$limit}"; } else { $sql_limit = ''; } $first_return = true; } $limit = intval($limit); $TotalPosts = intval($TotalPosts); #$page_number = intval($page_number); $PageCutOff = intval($PageCutOff); if ($limit == $TotalPosts) { $HasLimit = true; } $page_number = (int) (($limit + $s) / $limit); # (int) will round the number down if its funky # die(">". $page_number); $sLoop = intval($current_page_num + $limit - 1); $eLoop = intval($PageCutOff + ($current_page_num + $limit) - 1); # die(">".$current_page_num ); $sLimit = intval($s); $n = null; for ($i = 0; $i < $PageCutOff; ++$i) { $n++; $sLimit = $sLimit + $limit; if ($sLimit > $total_page_count * $limit + 1) { break; } $word['jump_to'] = null; $info['url'] = $url . 'limit:' . ($sLimit - 1) . ',' . $limit . $last_id; $info['click'] = $n + $page_number; $tmp_top .= $tplt->phase($word, $info, 'top_blocks'); $tmp_bot .= $tplt->phase($word, $info, 'bottom_blocks'); #die(">". $limit); if ($sLimit >= $total_page_count * $limit) { break; } } $word['jump_to'] = null; $info['url'] = $url . 'limit:' . ($total_page_count * $limit - 1) . ',' . ($limit + 1) . $last_id; $info['click'] = $w_last; $lastJump_top = $tplt->phase($word, $info, 'top_blocks'); $lastJump_bot = $tplt->phase($word, $info, 'bottom_blocks'); if (isset($lm[0]) and $lm[0] != '0') { $b = $s - $limit; if (substr($b, 0, 1) == "-") { $b = '0'; } $word['jump_to'] = null; $info['url'] = $url . 'limit:' . $b . ',' . $limit . $last_id; $info['click'] = $w_prev . ' ' . $limit; $back_top = $tplt->phase($word, $info, 'top_blocks'); $back_bot = $tplt->phase($word, $info, 'bottom_blocks'); } $word['jump_to'] = null; $info['url'] = $url . 'limit:' . ($s + $limit - 1) . ',' . ($limit + 1) . $last_id; $info['click'] = $w_next . ' ' . $limit; $next_top = $tplt->phase($word, $info, 'top_blocks'); $next_bot = $tplt->phase($word, $info, 'bottom_blocks'); if ($tmp_bot) { $word['jump_to'] = get_awcsforum_word('word_JumpToPage') . ' '; $info['url'] = $url; $info['click'] = '1'; $LimitJump_top = $tplt->phase($word, $info, 'top_blocks'); $LimitJump_bot = $tplt->phase($word, $info, 'bottom_blocks'); $LimitJump_bot .= $back_bot . $tmp_bot . $next_bot . $lastJump_bot; $LimitJump_top .= $back_top . $tmp_top . $next_top . $lastJump_top; } else { $word['jump_to'] = get_awcsforum_word('word_JumpToPage') . ' '; $info['url'] = $url; $info['click'] = '1'; $LimitJump_top = $tplt->phase($word, $info, 'top_blocks'); $LimitJump_bot = $tplt->phase($word, $info, 'bottom_blocks'); $LimitJump_bot .= $back_bot; $LimitJump_top .= $back_top; } # die(">". $limit ); if ($TotalPosts < $limit) { $LimitJump_top = null; $LimitJump_bot = null; } #die($sql_limit); return $sql_limit; }
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>'; }
function delete_all_tplt($redirect = true) { $dbr = wfGetDB(DB_SLAVE); $awc_f_theme_names = $dbr->tableName('awc_f_theme_names'); $sql = "SELECT thmn_id FROM {$awc_f_theme_names} WHERE thmn_what='tplt'"; $res = $dbr->query($sql); $total = $dbr->numRows($res); if ($total == '1') { return awcs_forum_error(get_awcsforum_word('word_css_cant_delete')); } $this->wDB->delete('awc_f_theme_tplt', array('tplt_thmn_id' => $this->thmn_id), ''); $this->wDB->delete('awc_f_theme_names', array('thmn_id' => $this->thmn_id), ''); $this->wDB->delete('awc_f_theme_tplt_history', array('tplth_thmn_id' => $this->thmn_id), ''); if ($redirect) { $info['msg'] = 'tplt_has_been_deleted'; $info['url'] = awc_url . "admin/tplt/display"; return awcf_redirect($info); } }
function avatra_check_size() { global $wgOut, $wgRequest, $awcs_forum_config, $wgScriptPath, $IP; $path = trim($wgRequest->getVal('path')); /* $user_get = array(); $user_get[] = 'm_id'; $user_get[] = 'm_idname'; $user_get[] = 'm_adv'; $user_get[] = 'm_advtag'; #die(print_r($user_get)); $info = GetMemInfo($this->m_id, $user_get); unset($user_get); */ if (substr($wgScriptPath, strlen($wgScriptPath) - 1, 1) == '/' || substr($wgScriptPath, strlen($wgScriptPath) - 1, 1) == '\\') { $sPath = substr($wgScriptPath, 0, strlen($wgScriptPath) - 1) . $this->imagepath; } else { $sPath = $this->imagepath; } $delete_image = $this->imagefolder . str_replace($sPath, '', $this->mem_info['m_adv']); if ($wgRequest->getVal('clear_ad') == 'on') { $dbw = wfGetDB(DB_MASTER); $dbw->update('awc_f_mems', array('m_adv' => '', 'm_adv_size' => '0x0', 'm_advtag' => ''), array('m_id' => $this->m_id), ''); @unlink($delete_image); return $wgOut->redirect(awc_url . $this->todo_url); } $splAWC = explode('x', $awcs_forum_config->cf_AvatraSize); $aD = $awcs_forum_config->cf_AvatraSize; $aH = $splAWC[0]; $aW = $splAWC[1]; $ext = explode(',', $this->uploadext); $ext = array_map('trim', $ext); if ($_FILES["uploaded"]["error"] == '0') { $size = $_FILES["uploaded"]["size"]; $path = $_FILES["uploaded"]["tmp_name"]; $name = $_FILES["uploaded"]["name"]; $img = getimagesize($path); $type = $img['mime']; $type = str_replace('image/', '', $type); if ($size > $this->uploadsize) { return $size . ' ' . get_awcsforum_word('mem_advatar_upload_size') . ' ' . $this->uploadsize; } if (!in_array($type, $ext)) { return get_awcsforum_word('mem_advatar_upload_ext') . ' ' . $this->uploadext . '<br />' . get_awcsforum_word('mem_advatar_upload_extyourectis') . '<b>' . $type . '</b> '; } $h = $img['1']; $w = $img['0']; if ($h > $aH || $w > $aW) { return get_awcsforum_word('mem_advatarsize') . " {$aD}. <br />Your pic is " . $h . 'x' . $w; } if (@move_uploaded_file($path, $this->imagefolder . $this->m_id . '_' . $name)) { @unlink($delete_image); $this->avtar_save($sPath . $this->m_id . '_' . $name, $h, $w, $name); return $wgOut->redirect(awc_url . $this->todo_url); } else { return get_awcsforum_word('mem_advatar_upload_no_move'); } } else { if (strstr($path, "http://")) { if ($path == '') { return get_awcsforum_word('mem_noAvatar'); } if ($awcs_forum_config->cf_advatar_no_url == '0') { return get_awcsforum_word('mem_advatar_no_url'); } $path = str_replace(' ', '%20', $path); #$path = urlencode($path); $img = getimagesize($path); if (isset($img['mime'])) { $h = $img['1']; $w = $img['0']; $type = $img['mime']; if ($w > $aW or $h > $aH) { return get_awcsforum_word('mem_advatarsize') . " {$aD}. <br />Your pic is " . $h . 'x' . $w; } $type = str_replace('image/', '', $img['mime']); if (!in_array($type, $ext)) { return $type . ' ' . get_awcsforum_word('mem_advatar_upload_ext') . ' ' . $this->uploadext; } @unlink($delete_image); $this->avtar_save($path, $h, $w, $path); $wgOut->redirect(awc_url . $this->todo_url); } else { return get_awcsforum_word('word_noadvatarurl'); } } else { if (substr($path, 0, 2) == '[[') { if ($path == '') { return get_awcsforum_word('mem_noAvatar'); } if ($awcs_forum_config->cf_advatar_no_wiki == '0' and substr($path, 0, 2) == '[[') { return get_awcsforum_word('mem_advatar_no_wiki'); } #$img = $path; $tag = $path; $pic = $wgOut->parse($path); $spl_w = explode('width="', $pic); $spl_w = explode('"', $spl_w[1]); $w = $spl_w[0]; $spl_h = explode('height="', $pic); $spl_h = explode('"', $spl_h[1]); $h = $spl_h[0]; if (!is_numeric($w) || !is_numeric($h)) { return get_awcsforum_word('mem_cantreadwikiimagetag'); } $spl_p = explode('src="', $pic); $spl_p = explode('"', $spl_p[1]); $path = $spl_p[0]; if ($w > $aW or $h > $aH) { return get_awcsforum_word('mem_advatarsize') . " {$aD}. <br />Your pic is " . $w . 'x' . $h; } @unlink($delete_image); $this->avtar_save($path, $h, $w, $tag); $wgOut->redirect(awc_url . $this->todo_url); } else { return get_awcsforum_word('mem_miscAvatarprobelm'); } } } }
function css_editing_boxs($css_info, $css_id) { # awc_pdie($css_info); #$html = '<input name="'.$att.'_ver" type="hidden" value="'.$ver.'">' ; if ($css_info['att'][0] == "#" || $css_info['att'][0] == ".") { $link = substr($css_info['att'], 1, strlen($css_info['att'])); } else { $link = $css_info['att']; } $link = str_replace(array('}', '[', ']', '{'), '', $link); if ($css_info['custom'] == 0) { $html = "<a href='http://wiki.anotherwebcom.com/{$link} (Forum CSS)' target='_blank'>{$css_info['att']}</a> " . get_awcsforum_word('admin_edit_ver') . " {$css_info['ver']}<br />"; } else { $html = $css_info['att'] . " " . get_awcsforum_word('admin_edit_ver') . " {$css_info['ver']} <b>" . get_awcsforum_word('word_custom') . '</b><br />'; } $code = htmlentities($css_info['code'], ENT_NOQUOTES); $html .= "<textarea name='css_code' cols='75' rows='5' wrap='virtual' class='post_box'>{$code}</textarea> <br />"; $html .= '<input type="submit" value="' . get_awcsforum_word('word_edit') . '"> <br /><br />'; return $html; }
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 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 write_admin_config_to_wiki() { $out = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"><head></head><body>'; $dbr = wfGetDB(DB_SLAVE); $awc_f_config = $dbr->tableName('awc_f_config'); $sql = "SELECT * \n FROM {$awc_f_config} "; # die($sql); $res = $dbr->query($sql); while ($r = $dbr->fetchObject($res)) { #$when = isset($r->thmn_when) ? $r->thmn_when : wfTimestampNow() ; $out .= $this->wiki_top_editing_box($r->q . ' (AdminCP Setting)'); $out .= '<textarea name="wpTextbox1" id="wpTextbox1" rows="0" cols="20" >'; $out .= "\n== Setting Information ==\n"; $out .= "'''Setting Name''' <br />\n"; $out .= get_awcsforum_word($r->q); $out .= "\n\n"; $out .= "'''Default Setting''' <br />\n"; if ($r->typeis == 'yesno' and $r->a == '1') { $out .= "Yes"; } elseif ($r->typeis == 'yesno' and $r->a == '0') { $out .= "No"; } else { $out .= $r->a; } $out .= "\n\n"; $out .= "'''Setting Type''' <br />\n"; if ($r->typeis == 'drop') { $out .= "Drop down option"; } elseif ($r->typeis == 'yesno') { $out .= "Yes/No toggle"; } else { $out .= "Text entry"; } $out .= "\n\n"; $out .= "'''Admin Section''' <br />\n"; switch ($r->section) { case 'general': $out .= get_awcsforum_word('admin_display_geneal_options'); break; case 'forum': $out .= get_awcsforum_word('admin_display_forum_options'); break; case 'mem': $out .= get_awcsforum_word('admin_display_mem_options'); break; case 'thread': $out .= get_awcsforum_word('admin_display_thread_options'); break; case 'forum_tag': $out .= get_awcsforum_word('admin_display_forumtag_options'); break; } $out .= "\n\n"; $out .= "\n== What it does ==\n"; $out .= "coming soon... \n\n\n\n"; $out .= '[[Category:Forum AdminCP Settings]]'; $out .= "\n"; $out .= '</textarea>'; $out .= $this->wiki_bot_editing_box(str_replace('"', '', $r->q)); } $dbr->freeResult($res); $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; //awc_default $out .= '</body></html>'; self::write_file('admin_settings.html', $out); }
function display_result_bars($p) { global $tplt; $total = null; $c = null; $Pass['results'] = null; $word['word_votes'] = get_awcsforum_word('word_votes'); $word['word_total_percent'] = get_awcsforum_word('word_total_percent'); $word['word_poll_option'] = get_awcsforum_word('word_poll_option'); $word['word_total_votes'] = get_awcsforum_word('word_total_votes'); if (!empty($p['poll_results'])) { foreach ($p['poll_results'] as $k => $re) { $total = $total + $re; } } else { $total = "0"; } foreach ($p['poll_choice'] as $f => $v) { if (!isset($p['poll_results'][$f])) { $p['poll_results'][$f] = '0'; } $Pass['percent'] = @round($p['poll_results'][$f] / $total * 100, 2); $Pass['poll_results'] = $p['poll_results'][$f]; $Pass['option'] = $v; if ($v != '') { ++$c; $Pass['c'] = $c; $Pass['results'] .= $tplt->phase($word, $Pass, 'poll_display_result_bars'); } } $Pass['total'] = $total; $Pass['options'] = $tplt->phase($word, $Pass, 'poll_display_results'); return $Pass; }
function poll_form_options() { global $wgRequest, $tplt; $word['word_poll_option'] = get_awcsforum_word('word_poll_option'); $to_skin['max_chr'] = '255'; $html = null; for ($i = 1; $i <= 10; $i++) { $info['poll_options']['poll_opt' . $i] = $wgRequest->getVal('poll_opt' . $i); $to_skin['name'] = "poll_opt{$i}"; $to_skin['value'] = $info['poll_options']['poll_opt' . $i]; $html .= $tplt->phase($word, $to_skin, 'poll_form_options'); } $tplt->kill('poll_form_options'); return $html; }
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 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>'); }
/** * 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 sendpm($to_name, $title, $msg, $save_sent = false, $sendto_names = null) { global $wgUser, $wgOut, $wgPasswordSender, $IP, $awc_tables, $awcs_forum_config; // awcsforum_funcs::get_page_lang(array('lang_txt_mem')); /* if ( !file_exists($IP . '/includes/AutoLoader.php')){ require($IP . "/includes/UserMailer.php"); } */ $sender_name = $wgUser->mName; $sender_id = $wgUser->mId; $send_msg_text = false; if (isset($awcs_forum_config->cf_send_pm_body_in_email) and $awcs_forum_config->cf_send_pm_body_in_email == '1') { $send_msg_text = true; } $user_get = array(); $user_get[] = 'm_id'; $dbw = wfGetDB(DB_MASTER); $date_seperated = $dbw->timestamp(); $pm_count = null; $to_address = array(); /* set up email stuff here so its not included in the loop */ $send_title = get_awcsforum_word('mem_pm_email_newpmawaiting') . ' ' . $title; $send_body = get_awcsforum_word('mem_pm_email_newpmawaitingbody'); $send_body .= " \n" . $sender_name; $send_body .= " \n\n <a href='" . awcsforum_funcs::awcforum_url('member_options/pminbox') . "'>" . awcsforum_funcs::awcforum_url('member_options/pminbox') . "</a> \n\r\n\r"; require_once awc_dir . 'send_mail.php'; $html = true; if ($awcs_forum_config->cf_send_email_html == '0') { $html = false; } foreach ($to_name as $id => $send_to_info) { $pm_count++; if ($pm_count == 1) { #$bs = $dbw->nextSequenceValue( 'awc_f_pms_pm_id_seq' ); $dbw->insert('awc_f_pms', array('pm_title' => $title, 'pm_text' => $msg)); $pm_id = awcsforum_funcs::lastID($dbw, 'awc_f_pms', 'pm_id'); } $dbw->insert('awc_f_pms_info', array('pmi_pmid' => $pm_id, 'pmi_sender' => $sender_name, 'pmi_sender_id' => $sender_id, 'pmi_receipt_id' => $send_to_info['id'], 'pmi_receipt' => $sendto_names, 'pmi_send_date' => $date_seperated)); # $mem = GetMemInfo($id, $user_get); # if(isset($mem['name'])){ # awc_pdie($wgUser->mId); if ($send_to_info['forum_username'] != 'no_name' or $send_to_info['id'] == $wgUser->mId) { $dbw->query("UPDATE {$awc_tables['awc_f_mems']} \n SET m_pmtotal = m_pmtotal + 1,\n m_pmunread = m_pmunread + 1, \n m_pminbox = m_pminbox + 1,\n m_pmpop = '1'\n WHERE m_id =" . $send_to_info['id']); } else { $dbw->insert('awc_f_mems', array('m_id' => $send_to_info['id'], 'm_idname' => $send_to_info['name'], 'm_pmtotal' => '1', 'm_pmunread' => '1', 'm_pminbox' => '1', 'm_pmpop' => '1')); } /* @changeVer 2.5.8 */ if (isset($send_to_info['email']) && !empty($send_to_info['email']) && $send_to_info['email'] != 'no_email') { $to_address[] = new MailAddress($send_to_info['email']); if ($send_to_info['pass_pm_text'] == '1' and $send_msg_text) { $send_body .= "\n\r\n\r" . awcsforum_mailer::check_msg_len($msg, 0); } awcsforum_mailer::send_mail($to_address, $send_title, $send_body, $html); } } if ($save_sent) { $dbw->insert('awc_f_pms_info', array('pmi_pmid' => $pm_id, 'pmi_sender' => $sender_name, 'pmi_sender_id' => $sender_id, 'pmi_receipt_id' => $sender_id, 'pmi_receipt' => $sendto_names, 'pmi_send_date' => $date_seperated, 'pmi_folder_id' => '1', 'pmi_read_date' => $date_seperated, 'pmi_read' => '1')); $mem = GetMemInfo($id, $user_get); if (isset($mem['name'])) { $dbw->query("UPDATE {$awc_tables['awc_f_mems']} \n SET m_pmtotal = m_pmtotal + 1,\n m_pmsent = m_pmsent + 1\n WHERE m_id =" . $sender_id); } else { $dbw->insert('awc_f_mems', array('m_id' => $sender_id, 'm_idname' => $wgUser->mName, 'm_pmtotal' => '1', 'm_pmsent' => '1')); } } $wgOut->redirect(awc_url . 'member_options/pminbox'); }