function Check_ShowForumRows($info) { global $str_len; if ($str_len($info['t_name']) > $this->threadtitlelength) { $info['t_name'] = awcsforum_funcs::awc_shorten($info['t_name'], $this->threadtitlelength) . "..."; } if ($info['user']) { $info['user'] = "******" . awcsforum_funcs::awcforum_url('mem_profile/' . $info['user'] . '/' . $info['userid']) . "'>" . $info['user'] . "</a>"; } if (isset($info['search_words'])) { $info['thread_url'] = awcsforum_funcs::awcforum_url('st/id' . $info['t_id'] . $info['search_words']); } else { $info['thread_url'] = awcsforum_funcs::awcforum_url('st/id' . $info['t_id'] . '/' . str_replace(array('>', '<'), ' ', $info['t_name'])) . $this->html_ext; } $classID = "row_info"; $info['indicator_lock_sticky_ann'] = null; if (isset($info['locked']) and $info['locked'] == "1") { $info['indicator_lock_sticky_ann'] = $this->words['locked'] . ' '; //$info['row_class'] = 'locked_thread' ; } if (isset($info['sticky']) and $info['sticky'] == "1") { $info['indicator_lock_sticky_ann'] = $this->words['sticky'] . ' '; $info['row_class'] = 'sticky'; } if (isset($info['sticky']) and isset($info['locked'])) { if ($info['sticky'] == "1" and $info['locked'] == "1") { $info['indicator_lock_sticky_ann'] = $this->words['locked_sticky'] . ' '; $info['row_class'] = 'sticky'; } } if (isset($info['poll']) and $info['poll'] == "1") { $info['indicator_lock_sticky_ann'] = $this->words['poll'] . ' '; $info['row_class'] = 'poll_thread_listing'; } return $info; }
function check_msg_len($msg, $len) { if (function_exists('mb_strlen')) { $str_len = 'awc_mbstrlen'; } else { $str_len = 'awcsforum_funcs::awc_strlen'; } if ($str_len($msg) > $len and $len != '0') { if (function_exists('mb_substr')) { $msg = awcsforum_funcs::awc_shorten($msg, $len); } else { $msg = substr($msg, 0, $len); } } require_once awc_dir . 'includes/post_phase.php'; $post_phase = new awcs_forum_post_phase(); $post_phase->convert_wTitle = 0; $post_phase->displaysmiles = 1; $msg = $post_phase->phase_post($msg, 0, false); return $msg; }
function Convert($txt) { static $t = 0; $t++; if ($t == 1) { #die($txt); } $txt = awcf_hide_code2($txt); $txt = preg_replace("#\\[b\\](.+?)\\[/b\\]#is", "<b>\\1</b>", $txt); $txt = preg_replace("#\\[i\\](.+?)\\[/i\\]#is", "<i>\\1</i>", $txt); $txt = preg_replace("#\\[u\\](.+?)\\[/u\\]#is", "<u>\\1</u>", $txt); $txt = preg_replace("#\\[s\\](.+?)\\[/s\\]#is", "<s>\\1</s>", $txt); $txt = preg_replace("#\\[search\\](.+?)\\[/search\\]#is", "<a href='" . awc_url . "search/s/?&kw=\\1'>\\1</a>", $txt); $txt = preg_replace("#\\[google\\](.+?)\\[/google\\]#is", "<a href='http://www.google.com/search?q=\\1'>\\1</a>", $txt); $txt = preg_replace("#\\[yahoo\\](.+?)\\[/yahoo\\]#is", "<a href='http://search.yahoo.com/search?p=\\1'>\\1</a>", $txt); $txt = preg_replace("#\\[size\\s*=\\s*(\\S+?)\\s*\\](.*?)\\[\\/size\\]#is", "<font size='\\1'>\\2</font>", $txt); $txt = preg_replace("#\\[size\\s*=\\s*(\\S+?)\\s*\\](.*?)\\<\\/font>(.*?)\\[\\/size\\]#is", "</font><font size='\\1'>\\2</font>", $txt); $txt = preg_replace("#\\[color\\s*=\\s*(\\S+?)\\s*\\](.*?)\\[\\/color\\]#is", "<font color='\\1'>\\2</font>", $txt); $txt = preg_replace("#\\[color\\s*=\\s*(\\S+?)\\s*\\](.*?)\\<\\/font>(.*?)\\[\\/color\\]#i", "</font><font color='\\1'>\\2</font>", $txt); $txt = preg_replace("#\\[center\\](.+?)\\[/center\\]#is", "<center>\\1</center>", $txt); # needs work... $txt = preg_replace("#\\[right\\](.+?)\\[/right\\]#is", "<div align='right'>\\1</div>", $txt); $txt = preg_replace("#\\[left\\](.+?)\\[/left\\]#is", "<div align='left'>\\1</div>", $txt); # needs work... $txt = preg_replace("#\\[[hr]\\]#is", "<hr>", $txt); #$txt = preg_replace( "#\[list\](.+?)\[\*\](.+?)\[/list\]#is" , "<ul>\\1<li>\\2</li></ul>" , $txt ); $match = "#\\[list\\](.+?)\\[/list\\]#is"; if (preg_match_all($match, $txt, $found)) { $txt = str_replace($found[0][0], "<ul>" . $found[1][0] . "</ul>", $txt); $match2 = "#\\[\\*\\](.+?)#U"; if (preg_match_all($match2, $txt, $found2)) { foreach ($found2[1] as $k => $v) { $txt = str_replace($found2[0][$k], "<li>" . $v . "</li>", $txt); } } } // cant do this, wiki phases urls before hand... #$txt = preg_replace( "#\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]#is" , "[\\1 \\2]" , $txt ); #$txt = preg_replace( "#\[URL\s*=\s*(\S+?)\s*\](.*?)\[\/URL\]#is" , "[\\1 \\2]" , $txt ); $txt = preg_replace("#\\[quote\\]#is", "<div class='quote_title'>Quote:<div class='quote'>\\1", $txt); $txt = preg_replace("#\\[quote=([^\\]]+?)\\]#is", "<div class='quote_title'>Quote:\\1<div class='quote'>\\2", $txt); $txt = preg_replace("#\\[/quote\\]#is", '</div id="quote"></div id="quote">', $txt); /* 2.5 change, no longer needed... $txt = str_replace("</li><br />", "</li>", $txt); $txt = str_replace("<ul><br />", "<ul>", $txt); $txt = str_replace("<br /><ul>", "<ul>", $txt); $txt = str_replace("</ul><br />", "</ul>", $txt); $txt = str_replace("</div><br />", "</div>", $txt); $txt = str_replace("<br /><tr>", '<tr>', $txt); $txt = str_replace("<br /><td>", '<td>', $txt); $txt = str_replace("<br /></p><br />", '<br />', $txt); $txt = str_replace("<br /><p>", '<br />', $txt); */ # die($txt); #$txt = preg_replace( "#\|emotion_tag\|(.+?)\|emotion_tag\|_end\|#is", "<img src=\"\\1\" />", $txt ); $txt = preg_replace("#\\|emotion_tag\\|(.+?)\\|emotion_tag\\|_end\\|#is", "<img src=\"\\1\" />", $txt); # trying to cut done on URL lenths... $match = "#<a(.+?)<\\/a>#is"; if (preg_match_all($match, $txt, $found)) { foreach ($found[0] as $url_title) { $match = "#\">(.+?)<\\/a>#is"; if (preg_match_all($match, $url_title, $found2)) { $img_match = "#<img(.+?)>#is"; if (!preg_match_all($img_match, $found2[0][0], $found3)) { $replace = str_replace('">', '', $found2[0][0]); $replace = str_replace('</a>', '', $replace); if (strlen($replace) > 90) { $txt = str_replace($found2[0][0], '">' . awcsforum_funcs::awc_shorten($replace, 90) . '...</a>', $txt); } } } } } $f = array('</a>', '<a href', '">', "<a href="); $r = array('</a>', '<a href', '">', "<a target='blank' href=", ''); $txt = str_replace($f, $r, $txt); $txt = awcf_unhide_code($txt); return $txt; }
function GetForumDisplayInfo($info) { global $awc, $wgOut, $awcs_forum_config, $str_len, $forum, $perm_sql; $thread_tools = new awcs_forum_thread_list_tools(); if ($info['both']) { $info['classThreadtitle'] = 'class="' . $info['classThreadtitle'] . '" id="' . $info['idThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['classReplies'] . '" id="' . $info['idReplies'] . '"'; $info['classViews'] = 'class="' . $info['classViews'] . '" id="' . $info['diViews'] . '"'; $info['classLastAction'] = 'class="' . $info['classLastAction'] . '" id="' . $info['idLastAction'] . '"'; } elseif (!$info['id']) { $info['classThreadtitle'] = 'class="' . $info['classThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['classReplies'] . '"'; $info['classViews'] = 'class="' . $info['classViews'] . '"'; $info['classLastAction'] = 'class="' . $info['classLastAction'] . '"'; } else { $info['classThreadtitle'] = 'id="' . $info['idThreadtitle'] . '"'; $info['classReplies'] = 'id="' . $info['idReplies'] . '"'; $info['classViews'] = 'id="' . $info['idViews'] . '"'; $info['classLastAction'] = 'id="' . $info['idLastAction'] . '"'; } # die(">". $UserPerm); $dbr = wfGetDB(DB_SLAVE); $permsql = substr($perm_sql, 0, -4); // if(strlen($info['forum']) > 0) $permsql = substr($permsql, 0, -4); $info['forum'] = substr($info['forum'], 4, strlen($info['forum'])); if (strlen($info['forum']) > 0 and strlen($permsql) > 0) { $permsql .= ' AND '; } $awc_f_threads = $dbr->tableName('awc_f_threads'); $awc_f_forums = $dbr->tableName('awc_f_forums'); $awc_f_cats = $dbr->tableName('awc_f_cats'); $awc_f_posts = $dbr->tableName('awc_f_posts'); $sql = "SELECT {$awc_f_threads}.*, {$awc_f_forums}.f_name, {$awc_f_forums}.f_desc, {$awc_f_forums}.f_id, {$awc_f_forums}.f_parentid, {$awc_f_cats}.cat_name, {$awc_f_cats}.cat_id, {$awc_f_cats}.c_wiki_perm\n FROM {$awc_f_threads}\n INNER JOIN {$awc_f_forums}\n ON {$awc_f_threads}.t_forumid={$awc_f_forums}.f_id\n INNER JOIN {$awc_f_cats}\n ON {$awc_f_cats}.cat_id={$awc_f_forums}.f_parentid\n WHERE {$permsql} \n " . $info['forum'] . " AND {$awc_f_forums}.f_passworded = 0\n ORDER BY {$awc_f_threads}.t_lastdate DESC\n LIMIT " . $info['howmanythreads']; # die(">".$permsql); /* * GROUP BY $awc_f_threads.t_id * $sql = "SELECT $awc_f_threads.*, $awc_f_forums.f_name, $awc_f_forums.f_desc, $awc_f_forums.f_id, $awc_f_forums.parent_id, $awc_f_cats.cat_name, $awc_f_cats.cat_id, $awc_f_cats.c_wiki_perm FROM $awc_f_threads INNER JOIN $awc_f_forums ON $awc_f_threads.t_forumid=$awc_f_forums.f_id INNER JOIN $awc_f_cats ON $awc_f_cats.cat_id=$awc_f_forums.parent_id WHERE $permsql ".$info['forum']." AND $awc_f_forums.f_passworded = 0 GROUP BY $awc_f_threads.t_id ORDER BY $awc_f_threads.t_lastdate DESC LIMIT " . $info['howmanythreads']; $sql = $dbr->selectSQLText( array( 'awc_f_threads', 'awc_f_posts', 'awc_f_forums', 'awc_f_cats' ), array( "$awc_f_posts.*, $awc_f_threads.*, f_name, f_desc, f_id, parent_id, cat_name, cat_id" ), "$permsql ".$info['forum']." AND f_passworded = 0", __METHOD__, array('OFFSET' => 0, 'LIMIT' => $info['howmanythreads'], 'GROUP BY' => 't_id', 'ORDER BY' => 't_lastdate DESC, p_id DESC',), array( 'awc_f_posts' => array('JOIN','t_id=thread_id'), 'awc_f_forums' => array('JOIN','t_forumid=f_id'), 'awc_f_cats' => array('JOIN','parent_id=cat_id')) ); */ if (strlen($info['forum']) == 0 and strlen($permsql) == 0) { $sql = str_replace('WHERE', '', $sql); } // awc_pdie($sql); $html = null; $singleline = null; if ($res = $dbr->query($sql)) { while ($r = $dbr->fetchObject($res)) { $f_name = $r->f_name; $f_id = $r->f_id; $tTitle = awcsforum_funcs::awc_html_entity_decode($r->t_name); $str_len($tTitle) > $awcs_forum_config->cf_forumTag_titlecutoff ? $t_name = awcsforum_funcs::awc_shorten($tTitle, $awcs_forum_config->cf_forumTag_titlecutoff) . "..." : ($t_name = $tTitle); $tmp = $info['imgBeforeThreadTitle'] . ' ' . $info['txtBeforeThreadTitle'] . ' <a href="' . $awc['link'] . 'st/id' . $r->t_id . '">' . $t_name . '</a>'; $limit = null; #$total['TotalPosts'] = null; $send['t_topics'] = $r->t_topics; $send['t_id'] = $r->t_id; $send['t_name'] = $r->t_name; $send['link'] = $this->awc_url; $t = null; if ($r->t_ann == "1") { $t = get_awcsforum_word('thread_makeAnnouncement') . " "; } if ($r->t_status == "1") { $t = get_awcsforum_word('1indicator_locked') . " "; } if ($r->t_pin == "1") { $t = get_awcsforum_word('1indicator_sticky') . " "; } if ($r->t_pin == "1" and $r->t_status == "1") { $t = get_awcsforum_word('1indicator_lockSticky') . " "; } if ($r->t_poll == "1") { $t = get_awcsforum_word('1indicator_poll') . " "; } # $TotalPosts = $tmp['TotalPosts']; # $limit = GetLimit($TotalPosts); $thread_tools->link = $this->awc_url; $thread_tools->tID = $r->t_id; $thread_tools->total_posts = $r->t_topics; $limit = $thread_tools->GetThreadPostLimit(); //$limit = GetThreadPostLimit($send); $tmp = $t . $tmp . ' ' . $limit; # die($awc['link']); $html .= '<tr>'; $html .= '<td width="100%" ' . $info['classThreadtitle'] . ' style="' . $info['styleThreadtitle'] . '" nowrap>' . $tmp . '</td>'; $singleline .= '<tr><td width="100%" ' . $info['classThreadtitle'] . ' style="' . $info['styleThreadtitle'] . '" >'; $singleline .= $tmp; # $singleline .= ; if ($info['replies'] == "yes") { $html .= '<td ' . $info['classReplies'] . ' style="' . $info['styleReplies'] . '" nowrap>' . $r->t_topics . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleReplies'] . '"> (' . $r->t_topics . ' ' . $info['wReplies'] . ') </SPAN>'; } if ($info['postcount'] == "yes") { $html .= '<td ' . $info['classViews'] . ' style="' . $info['styleViews'] . '" nowrap>' . $r->t_hits . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleViews'] . '"> (' . $r->t_hits . ' ' . $info['wViews'] . ') </SPAN> '; } if ($info['date'] == "yes" || $info['users'] == "yes") { $u = $r->t_lastuser == '' ? $r->p_user : $r->t_lastuser; $uID = $r->t_lastuser == '' ? $r->p_userid : $r->t_lastuserid; #$u = $wgOut->parse("[[User:$u|$u]]"); $u = "<a href='" . $awc['link'] . "mem_profile/{$u}/{$uID}'>{$u}</a>"; $rplac = array('<p>', '</p>', chr(10)); $u = str_replace($rplac, '', $u); $u = $info['users'] == "yes" ? ' - ' . $u : null; $d = $info['date'] == "yes" ? '<a href="' . $awc['link'] . 'last_post/id' . $r->t_id . '"> ' . awcsforum_funcs::convert_date($r->t_lastdate, "s") . ' </a>' . ' ' : null; $html .= '<td ' . $info['classLastAction'] . ' style="' . $info['styleLastAction'] . '" nowrap>' . $d . $u . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleLastAction'] . '"> (' . $d . $u . ') </SPAN><td></tr>'; } $html .= '</tr>'; } $dbr->freeResult($res); } if ($f_name == '') { return; } if ($info['header_both']) { $info['classThreadtitle'] = 'class="' . $info['header_classThreadtitle'] . '" id="' . $info['header_idThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['header_classReplies'] . '" id="' . $info['header_idReplies'] . '"'; $info['classViews'] = 'class="' . $info['header_classViews'] . '" id="' . $info['header_diViews'] . '"'; $info['classLastAction'] = 'class="' . $info['header_classLastAction'] . '" id="' . $info['header_idLastAction'] . '"'; } elseif (!$info['header_id']) { $info['classThreadtitle'] = 'class="' . $info['header_classThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['header_classReplies'] . '"'; $info['classViews'] = 'class="' . $info['header_classViews'] . '"'; $info['classLastAction'] = 'class="' . $info['header_classLastAction'] . '"'; } else { $info['classThreadtitle'] = 'id="' . $info['header_idThreadtitle'] . '"'; $info['classReplies'] = 'id="' . $info['header_idReplies'] . '"'; $info['classViews'] = 'id="' . $info['header_idViews'] . '"'; $info['classLastAction'] = 'id="' . $info['header_idLastAction'] . '"'; } $out = null; if ($info['showall'] == false) { $out = '<table width="' . $info['width'] . '" cellpadding="0" cellspacing="0"><tr><td nowrap><a href="' . $awc['link'] . 'sf/id' . $f_id . '">' . $f_name . '</a><hr></td></tr></table>'; } $out .= '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0">'; $out .= '<tr>'; $singleline_out = '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0"><tr>'; $out .= '<td width="75%" align="left" class="' . $info['header_classThreadtitle'] . '" style="' . $info['header_styleThreadtitle'] . '" nowrap>' . $info['wThreadtitle'] . '</td>'; if ($info['replies'] == "yes") { $out .= '<td width="1%" align="left" class="' . $info['header_classReplies'] . '" style="' . $info['header_styleReplies'] . '" nowrap>' . $info['wReplies'] . '</td>'; } if ($info['postcount'] == "yes") { $out .= '<td width="1%" align="left" class="' . $info['header_classViews'] . '" style="' . $info['header_styleViews'] . '" nowrap>' . $info['wViews'] . '</td>'; } #if($info['users'] == true) $out .= '<td width="1%" align="left" nowrap>'.get_awcsforum_word('forum_started_by').'</td>'; if ($info['date'] == "yes" || $info['users'] == "yes") { $out .= '<td width="20%" align="left" class="' . $info['header_classLastAction'] . '" style="' . $info['header_styleLastAction'] . '" nowrap>' . $info['wLastAction'] . '</td>'; } $out .= '</tr>'; $out .= $html; $out .= '</table><br />'; $singleline_out = '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0">'; $singleline_out .= $singleline; $singleline_out .= '</table><br />'; $out = str_replace(chr(10), '', $out); $singleline_out = str_replace(chr(10), '', $singleline_out); if ($info['inline']) { return $singleline_out; } return $out; }
function process_all_cats($cats, $children, $cat_link = null) { global $tplt; $outHTML = null; $word_guest = get_awcsforum_word('word_guest'); $word_header = array('topics' => get_awcsforum_word('word_topics'), 'replies' => get_awcsforum_word('word_replies'), 'forum_last_post' => get_awcsforum_word('forum_last_post')); foreach ($cats as $cat_id => $cat_data) { $html = $tplt->phase('', '', 'cat_open_table'); $info['AdminEdit'] = UserPerm == 10 ? '<a href="' . awc_url . 'admin/cat/get_cat_id_edit/' . $cat_data['id'] . '">*</a> | ' : null; $info['title'] = '<a href="' . awc_url . 'sc/id' . $cat_data['id'] . '/' . rawurlencode(str_replace('/', ' ', $cat_data['name'])) . $this->html_ext . '">' . $cat_data['name'] . '</a>'; if ($cat_link != null) { $info['title'] = $cat_data['name']; } $html .= $tplt->phase($word_header, $info, 'cat_header'); foreach ($children as $forum_id => $c) { if ($c['f_parentid'] == $cat_id) { if ($this->show_guest_ip == '0' and $c['f_lastuserid'] == '0' and UserPerm < 2) { $c['f_lastuser'] = $word_guest; } $c['last_title'] = awcsforum_funcs::awc_html_entity_decode($c['f_lasttitle']); $last_title = $c['last_title']; if (isset($c['last_title'][$this->MaxTitleCol])) { $c['last_title'] = awcsforum_funcs::awc_shorten($c['last_title'], $this->MaxTitleCol) . "..."; } $c['last_date'] = $c['f_lastdate'] != '0000-00-00 00:00:00' ? awcsforum_funcs::convert_date($c['f_lastdate'], "s") : ' '; $c['mem_link'] = awcsforum_funcs::awcforum_url('mem_profile/' . $c['f_lastuser'] . '/' . $c['f_lastuserid']); $c['AdminEditLink'] = UserPerm == 10 ? '<a href="' . awc_url . 'admin/forum/get_forum_id_edit/' . $c['f_id'] . '">*</a> | ' : null; $c['forum_link'] = awc_url . 'sf/id' . $c['f_id'] . '/' . rawurlencode(str_replace('/', ' ', $c['f_name'])) . $this->html_ext; # die($last_title); $c['last_thread_link'] = awc_url . 'last_post/id' . $c['f_threadid'] . '/' . rawurlencode(str_replace('/', ' ', $last_title)) . $this->html_ext; $html .= $tplt->phase('', $c, 'cat_list_forums_rows'); } } $html .= $tplt->phase('', '', 'cat_close_table'); $outHTML .= $html; } $tplt->kill('cat_open_table'); $tplt->kill('cat_close_table'); $tplt->kill('cat_list_forums_rows'); unset($word_header, $c, $info); return $outHTML; }