function showtopic($showtopic, $mode = '', $onetwo = 1, $page = 1) { global $CONF_FORUM, $_CONF, $_TABLES, $_USER, $LANG_GF01, $LANG_GF02, $LANG_GF09; global $highlight; global $oldPost; $oldPost = 0; //$mytimer = new timerobject(); //$mytimer->setPercision(2); //$mytimer->startTimer(); //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time1: $intervalTime"); if (!class_exists('StringParser')) { require_once $CONF_FORUM['path_include'] . 'bbcode/stringparser_bbcode.class.php'; } $topictemplate = COM_newTemplate(CTL_plugin_templatePath('forum')); $topictemplate->set_file(array('topictemplate' => 'topic.thtml', 'forum_icons' => 'forum_icons.thtml', 'forum_links' => 'forum_links.thtml')); $topictemplate->set_block('topictemplate', 'block_user_information'); $topictemplate->set_block('topictemplate', 'block_anon_user_information'); $topictemplate->set_block('topictemplate', 'location'); $topictemplate->set_block('topictemplate', 'ip_address'); $topictemplate->set_block('topictemplate', 'anon_ip_address'); $topictemplate->set_block('topictemplate', 'user_signature'); $topictemplate->set_block('topictemplate', 'mod_functions'); $blocks = array('block_user_name', 'block_anon_user_name', 'block_user_information', 'block_anon_user_information', 'user_signature', 'mod_functions'); foreach ($blocks as $block) { $topictemplate->set_block('topictemplate', $block); } $topictemplate->set_block('forum_icons', 'topiclocked_icon'); $topictemplate->set_block('forum_icons', 'mood_icon'); $blocks = array('profile_link', 'pm_link', 'email_link', 'website_link', 'quotetopic_link', 'edittopic_link'); foreach ($blocks as $block) { $topictemplate->set_block('forum_links', $block); } // if preview, only stripslashes is gpc=on, else assume from db so strip if ($mode == 'preview') { $showtopic['subject'] = COM_stripslashes($showtopic['subject']); } else { $showtopic['subject'] = stripslashes($showtopic['subject']); } $min_height = 50; // Base minimum height of topic - will increase if avatar or sig is used $date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']); $sql = "SELECT u.*, ui.location FROM {$_TABLES['users']} u, {$_TABLES['userinfo']} ui \n \t\tWHERE u.uid = ui.uid \n \t\tAND u.uid = '{$showtopic['uid']}'"; $userQuery = DB_query($sql); if ($showtopic['uid'] > 1 and DB_numRows($userQuery) == 1) { $userarray = DB_fetchArray($userQuery); $username = COM_getDisplayName($showtopic['uid']); $userlink = "<a href=\"{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}\" "; $userlink .= "class=\"authorname {$onetwo}\"><b>{$username}</b></a>"; $uservalid = true; $postcount = DB_query("SELECT * FROM {$_TABLES['forum_topic']} WHERE uid='{$showtopic['uid']}'"); $posts = DB_numRows($postcount); // STARS CODE if (SEC_inGroup(1, $showtopic['uid'])) { $user_level = showrank(7, $LANG_GF01['admin']); $user_levelname = $LANG_GF01['admin']; } else { if (forum_modPermission($showtopic['forum'], $showtopic['uid'])) { $user_level = showrank(6, $LANG_GF01['moderator']); $user_levelname = $LANG_GF01['moderator']; } else { if ($posts < $CONF_FORUM['level2']) { $user_level = showrank(1, $CONF_FORUM['level1name']); $user_levelname = $CONF_FORUM['level1name']; } elseif ($posts >= $CONF_FORUM['level2'] && $posts < $CONF_FORUM['level3']) { $user_level = showrank(2, $CONF_FORUM['level2name']); $user_levelname = $CONF_FORUM['level2name']; } elseif ($posts >= $CONF_FORUM['level3'] && $posts < $CONF_FORUM['level4']) { $user_level = showrank(3, $CONF_FORUM['level3name']); $user_levelname = $CONF_FORUM['level3name']; } elseif ($posts >= $CONF_FORUM['level4'] && $posts < $CONF_FORUM['level5']) { $user_level = showrank(4, $CONF_FORUM['level4name']); $user_levelname = $CONF_FORUM['level4name']; } elseif ($posts > $CONF_FORUM['level5']) { $user_level = showrank(5, $CONF_FORUM['level5name']); $user_levelname = $CONF_FORUM['level5name']; } } } // Still allow photo to be showen for users if ($showtopic['uid'] > 1 and ($userarray['photo'] != "" or !empty($_CONF['default_photo']))) { $avatar = USER_getPhoto($showtopic['uid'], '', '', $CONF_FORUM['avatar_width']); $min_height = $min_height + 50; } else { $avatar = ''; } $regdate = $LANG_GF01['REGISTERED'] . ': ' . strftime($_CONF['shortdate'], strtotime($userarray['regdate'])) . '<br' . XHTML . '>'; $numposts = $LANG_GF01['POSTS'] . ': ' . $posts; if (DB_count($_TABLES['sessions'], 'uid', $showtopic['uid']) > 0 and DB_getItem($_TABLES['userprefs'], 'showonline', "uid={$showtopic['uid']}") == 1) { $avatar .= '<br' . XHTML . '>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['ONLINE']; } else { $avatar .= '<br' . XHTML . '>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['OFFLINE']; } if ($userarray['sig'] != '') { $sig = $userarray['sig']; $min_height = $min_height + 30; } else { $sig = ''; } } else { $uservalid = false; $userlink = urldecode($showtopic['name']); } if ($CONF_FORUM['show_moods'] && $showtopic['mood'] != "") { $topictemplate->set_var('moodicon', gf_getImage($showtopic['mood'], 'moods')); $topictemplate->set_var('moodicontext', $showtopic['mood']); $topictemplate->parse('mood_icon', 'mood_icon'); $min_height = $min_height + 30; } else { $topictemplate->set_var('mood_icon', ''); } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time3: $intervalTime"); // Handle Pre ver 2.5 quoting and New Line Formatting - consider adding this to a migrate function if ($CONF_FORUM['pre2.5_mode']) { // try to determine if we have an old post... if (strstr($showtopic['comment'], '<pre class="forumCode">') !== false) { $oldPost = 1; } if (strstr($showtopic['comment'], "[code]<code>") !== false) { $oldPost = 1; } if (strstr($showtopic['comment'], "<pre>") !== false) { $oldPost = 1; } if (stristr($showtopic['comment'], '[code') == false || stristr($showtopic['comment'], '[code]<code>') == true) { if (strstr($showtopic['comment'], "<pre>") !== false) { $oldPost = 1; } $showtopic['comment'] = str_replace('<pre>', '[code]', $showtopic['comment']); $showtopic['comment'] = str_replace('</pre>', '[/code]', $showtopic['comment']); } $showtopic['comment'] = str_ireplace("[code]<code>", '[code]', $showtopic['comment']); $showtopic['comment'] = str_ireplace("</code>[/code]", '[/code]', $showtopic['comment']); $showtopic['comment'] = str_replace(array("<br />\r\n", "<br />\n\r", "<br />\r", "<br />\n", "<br>\r\n", "<br>\n\r", "<br>\r", "<br>\n"), '<br' . XHTML . '>', $showtopic['comment']); $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=\\s(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']); /* Reformat code blocks - version 2.3.3 and prior */ $showtopic['comment'] = str_replace('<pre class="forumCode">', '[code]', $showtopic['comment']); $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']); if ($oldPost) { if (strstr($showtopic['comment'], "\\'") !== false) { $showtopic['comment'] = stripslashes($showtopic['comment']); } } } $showtopic['comment'] = gf_formatTextBlock($showtopic['comment'], $showtopic['postmode'], $mode); $showtopic['subject'] = gf_formatTextBlock($showtopic['subject'], 'text', $mode); if ($CONF_FORUM['show_subject_length'] > 0 and strlen($showtopic['subject']) > $CONF_FORUM['show_subject_length']) { $showtopic['subject'] = COM_truncate("{$showtopic['subject']}", $CONF_FORUM['show_subject_length'], '...'); } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time2: $intervalTime"); if ($mode != 'preview' && $uservalid && !COM_isAnonUser() && $_USER['uid'] == $showtopic['uid']) { /* Check if user can still edit this post - within allowed edit timeframe */ $editAllowed = false; if ($CONF_FORUM['allowed_editwindow'] > 0) { $t1 = $showtopic['date']; $t2 = $CONF_FORUM['allowed_editwindow']; if (time() - $t2 < $t1) { $editAllowed = true; } } else { $editAllowed = true; } if ($editAllowed) { $editlink = "{$_CONF['site_url']}/forum/createtopic.php?method=edit&forum={$showtopic['forum']}&id={$showtopic['id']}&editid={$showtopic['id']}&page={$page}"; $editlinktext = $LANG_GF09['edit']; $topictemplate->set_var('editlink', $editlink); $topictemplate->set_var('editlinktext', $editlinktext); $topictemplate->set_var('LANG_edit', $LANG_GF01['EDITICON']); $topictemplate->parse('edittopic_link', 'edittopic_link'); } } if ($highlight != '') { $showtopic['subject'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['subject']); $showtopic['comment'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['comment']); } if (!isset($showtopic['pid'])) { $showtopic['pid'] = 0; } if ($showtopic['pid'] == 0) { $replytopicid = $showtopic['id']; $is_lockedtopic = $showtopic['locked']; $views = $showtopic['views']; $topictemplate->set_var('read_msg', sprintf($LANG_GF02['msg49'], $views)); if ($is_lockedtopic) { $topictemplate->parse('topiclocked_icon', 'topiclocked_icon'); } } else { $replytopicid = $showtopic['pid']; $is_lockedtopic = DB_getItem($_TABLES['forum_topic'], 'locked', "id={$showtopic['pid']}"); $topictemplate->set_var('read_msg', ''); } if ($CONF_FORUM['allow_user_dateformat']) { $date = COM_getUserDateTimeFormat($showtopic['date']); $topictemplate->set_var('posted_date', $date[0]); } else { $date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']); $topictemplate->set_var('posted_date', $date); } if ($mode != 'preview') { if ($is_lockedtopic == 0) { $is_readonly = DB_getItem($_TABLES['forum_forums'], 'is_readonly', 'forum_id=' . $showtopic['forum']); if ($is_readonly == 0 or forum_modPermission($showtopic['forum'], $_USER['uid'], 'mod_edit')) { $quotelink = "{$_CONF['site_url']}/forum/createtopic.php?method=postreply&forum={$showtopic['forum']}&id={$replytopicid}&quoteid={$showtopic['id']}"; $quotelinktext = $LANG_GF09['quote']; $topictemplate->set_var('quotelink', $quotelink); $topictemplate->set_var('quotelinktext', $quotelinktext); $topictemplate->set_var('LANG_quote', $LANG_GF01['QUOTEICON']); $topictemplate->parse('quotetopic_link', 'quotetopic_link'); } } $topictemplate->set_var('topic_post_id', $showtopic['id']); if ($showtopic['uid'] > 1 && $uservalid) { $profile_link = "{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}"; $profile_linktext = $LANG_GF09['profile']; $topictemplate->set_var('profilelink', $profile_link); $topictemplate->set_var('profilelinktext', $profile_linktext); $topictemplate->set_var('LANG_profile', $LANG_GF01['ProfileLink']); $topictemplate->parse('profile_link', 'profile_link'); if ($CONF_FORUM['use_pm_plugin']) { $pmusernmame = COM_getDisplayName($showtopic['uid']); $pmplugin_link = forumPLG_getPMlink($pmusernmame); if ($pmplugin_link != '') { $pm_link = $pmplugin_link; $pm_linktext = $LANG_GF09['pm']; $topictemplate->set_var('pmlink', $pm_link); $topictemplate->set_var('pmlinktext', $pm_linktext); $topictemplate->set_var('LANG_pm', $LANG_GF01['PMLink']); $topictemplate->parse('pm_link', 'pm_link'); } } } if ($userarray['email'] != '' && $showtopic["uid"] > 1) { $email_link = "{$_CONF['site_url']}/profiles.php?uid={$showtopic['uid']}"; $email_linktext = $LANG_GF09['email']; $topictemplate->set_var('emaillink', $email_link); $topictemplate->set_var('emaillinktext', $email_linktext); $topictemplate->set_var('LANG_email', $LANG_GF01['EmailLink']); $topictemplate->parse('email_link', 'email_link'); } if ($userarray['homepage'] != '') { $homepage = trim($userarray['homepage']); if (strtolower(substr($homepage, 0, 4)) != 'http') { $homepage = 'http://' . $homepage; } $homepagetext = $LANG_GF09['website']; $topictemplate->set_var('websitelink', $homepage); $topictemplate->set_var('websitelinktext', $homepagetext); $topictemplate->set_var('LANG_website', $LANG_GF01['WebsiteLink']); $topictemplate->parse('website_link', 'website_link'); } if ($userarray['location'] != '' && $showtopic["uid"] > 1) { $topictemplate->set_var('user_location', $userarray['location']); $topictemplate->parse('location', 'location'); } } else { if (isset($_GET['onlytopic']) and $_GET['onlytopic'] != 1) { $topictemplate->set_var('posted_date', ''); $topictemplate->set_var('preview_topic_subject', $showtopic['subject']); } else { $topictemplate->set_var('preview_topic_subject', ''); } $topictemplate->set_var('read_msg', ''); $topictemplate->set_var('topiclocked_icon', ''); $topictemplate->set_var('preview_mode', 'none'); } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time4: $intervalTime"); $showtopic['comment'] = str_replace('{', '{', $showtopic['comment']); $showtopic['comment'] = str_replace('}', '}', $showtopic['comment']); // Temporary correspondence. You should cope in more roots. $showtopic['comment'] = str_replace(array("<br />", "<br>"), '<br' . XHTML . '>', $showtopic['comment']); $topictemplate->set_var('layout_url', $CONF_FORUM['layout_url']); $topictemplate->set_var('csscode', $onetwo); $topictemplate->set_var('postmode', $showtopic['postmode']); $topictemplate->set_var('userlink', $userlink); $topictemplate->set_var('lang_forum', $LANG_GF01['FORUM']); $topictemplate->set_var('user_levelname', $user_levelname); $topictemplate->set_var('user_level', $user_level); $topictemplate->set_var('avatar', $avatar); $topictemplate->set_var('regdate', $regdate); $topictemplate->set_var('numposts', $numposts); if (forum_modPermission($showtopic['forum'], $_USER['uid'], 'mod_ban')) { $topictemplate->set_var('ip', $showtopic['ip']); if ($showtopic['uid'] == 1) { $topictemplate->parse('ip_address', 'anon_ip_address'); } else { $topictemplate->parse('ip_address', 'ip_address'); } } else { $topictemplate->set_var('ip_address', ''); } $topictemplate->set_var('imgset', $CONF_FORUM['imgset']); $topictemplate->set_var('topic_subject', $showtopic['subject']); $topictemplate->set_var('LANG_ON2', $LANG_GF01['ON2']); if ($mode != 'preview') { $mod_functions = forum_getmodFunctions($showtopic); if (!empty($mod_functions)) { $topictemplate->set_var('mod_functions', $mod_functions); $topictemplate->parse('mod_functions', 'mod_functions'); } else { $topictemplate->set_var('mod_functions', ''); } } $topictemplate->set_var('topic_comment', $showtopic['comment']); $topictemplate->set_var('comment_minheight', "min-height:{$min_height}px"); if (trim($sig) != '') { $topictemplate->set_var('sig', PLG_replaceTags($sig)); $topictemplate->set_var('show_sig', ''); $topictemplate->parse('user_signature', 'user_signature'); } else { $topictemplate->set_var('sig', ''); $topictemplate->set_var('show_sig', 'none'); $topictemplate->set_var('user_signature', ''); } $topictemplate->set_var('forumid', $showtopic['forum']); $topictemplate->set_var('topic_id', $showtopic['id']); $topictemplate->set_var('member_badge', forumPLG_getMemberBadge($showtopic['uid'])); if ($uservalid) { $topictemplate->parse('user_name', 'block_user_name'); $topictemplate->parse('user_information', 'block_user_information'); } else { $topictemplate->parse('user_name', 'block_anon_user_name'); $topictemplate->parse('user_information', 'block_anon_user_information'); } $topictemplate->parse('output', 'topictemplate'); $retval = $topictemplate->finish($topictemplate->get_var('output')); //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time5: $intervalTime"); return $retval; }
function showtopic($showtopic, $mode = '', $onetwo = 1, $page = 1) { global $CONF_FORUM, $_CONF, $_TABLES, $_USER, $LANG_GF01, $LANG_GF02; global $fromblock, $highlight; global $oldPost, $forumfiles; $oldPost = 0; //$mytimer = new timerobject(); //$mytimer->setPercision(2); //$mytimer->startTimer(); //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time1: $intervalTime"); if (!class_exists('StringParser')) { require_once $_CONF['path_html'] . 'forum/include/bbcode/stringparser_bbcode.class.php'; } $topictemplate = new Template($_CONF['path_layout'] . 'forum/layout'); $topictemplate->set_file(array('topictemplate' => 'topic.thtml', 'profile' => 'links/profile.thtml', 'pm' => 'links/pm.thtml', 'email' => 'links/email.thtml', 'website' => 'links/website.thtml', 'quote' => 'links/quotetopic.thtml', 'edit' => 'links/edittopic.thtml')); // if preview, only stripslashes is gpc=on, else assume from db so strip if ($mode == 'preview') { $showtopic['subject'] = COM_stripslashes($showtopic['subject']); $topictemplate->set_var('show_topicrow1', 'none'); $topictemplate->set_var('show_topicrule', 'none'); $topictemplate->set_var('lang_postpreview', $LANG_GF01['PREVIEW_HEADER']); } else { $showtopic['subject'] = stripslashes($showtopic['subject']); $topictemplate->set_var('show_topicrow2', 'none'); } $min_height = 50; // Base minimum height of topic - will increase if avatar or sig is used $date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']); $userQuery = DB_query("SELECT * FROM {$_TABLES['users']} WHERE uid='{$showtopic['uid']}'"); if ($showtopic['uid'] > 1 and DB_numRows($userQuery) == 1) { $userarray = DB_fetchArray($userQuery); $username = COM_getDisplayName($showtopic['uid']); $userlink = "<a href=\"{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}\" "; $userlink .= "class=\"authorname {$onetwo}\"><b>{$username}</b></a>"; $uservalid = true; $postcount = DB_query("SELECT * FROM {$_TABLES['gf_topic']} WHERE uid='{$showtopic['uid']}'"); $posts = DB_numRows($postcount); // STARS CODE $starimage = "<IMG SRC=\"%s\" ALT=\"{$LANG_GF01['FORUM']} %s\" TITLE=\"{$LANG_GF01['FORUM']} %s\">"; if ($posts < $CONF_FORUM['level2']) { $user_level = sprintf($starimage, gf_getImage('rank1', 'ranks'), $CONF_FORUM['level1name'], $CONF_FORUM['level1name']); $user_levelname = $CONF_FORUM['level1name']; } elseif ($posts >= $CONF_FORUM['level2'] && $posts < $CONF_FORUM['level3']) { $user_level = sprintf($starimage, gf_getImage('rank2', 'ranks'), $CONF_FORUM['level2name'], $CONF_FORUM['level2name']); $user_levelname = $CONF_FORUM['level2name']; } elseif ($posts >= $CONF_FORUM['level3'] && $posts < $CONF_FORUM['level4']) { $user_level = sprintf($starimage, gf_getImage('rank3', 'ranks'), $CONF_FORUM['level3name'], $CONF_FORUM['level3name']); $user_levelname = $CONF_FORUM['level3name']; } elseif ($posts >= $CONF_FORUM['level4'] && $posts < $CONF_FORUM['level5']) { $user_level = sprintf($starimage, gf_getImage('rank4', 'ranks'), $CONF_FORUM['level4name'], $CONF_FORUM['level4name']); $user_levelname = $CONF_FORUM['level4name']; } elseif ($posts > $CONF_FORUM['level5']) { $user_level = sprintf($starimage, gf_getImage('rank5', 'ranks'), $CONF_FORUM['level5name'], $CONF_FORUM['level5name']); $user_levelname = $CONF_FORUM['level5name']; } if (forum_modPermission($showtopic['forum'], $showtopic['uid'])) { $user_level = sprintf($starimage, gf_getImage('rank_mod', 'ranks'), $LANG_GF01['moderator'], $LANG_GF01['moderator']); $user_levelname = $LANG_GF01['moderator']; } if (SEC_inGroup(1, $showtopic['uid'])) { $user_level = sprintf($starimage, gf_getImage('rank_admin', 'ranks'), $LANG_GF01['admin'], $LANG_GF01['admin']); $user_levelname = $LANG_GF01['admin']; } if ($userarray['photo'] != "") { $avatar = USER_getPhoto($showtopic['uid'], '', '', $CONF_FORUM['avatar_width']); $min_height = $min_height + 50; } $regdate = $LANG_GF01['REGISTERED'] . ': ' . strftime('%m/%d/%y', strtotime($userarray['regdate'])) . '<br>'; $numposts = $LANG_GF01['POSTS'] . ': ' . $posts; if (DB_count($_TABLES['sessions'], 'uid', $showtopic['uid']) > 0 and DB_getItem($_TABLES['userprefs'], 'showonline', "uid={$showtopic['uid']}") == 1) { $avatar .= '<br>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['ONLINE']; } else { $avatar .= '<br>' . $LANG_GF01['STATUS'] . ' ' . $LANG_GF01['OFFLINE']; } if ($userarray['sig'] != '') { $sig = '<hr width="95%" size="1" style="color=:black; text-align:left; margin-left:0; margin-bottom:5;padding:0" noshade>'; $sig .= '<B>' . $userarray['sig'] . '</B>'; $min_height = $min_height + 30; } } else { $uservalid = false; $userlink = '<b>' . $showtopic['name'] . '</b>'; $userlink = '<font size="-2">' . $LANG_GF01['ANON'] . '</font>' . $showtopic['name']; } if ($CONF_FORUM['show_moods'] && $showtopic['mood'] != "") { $moodimage = '<img align="absmiddle" src="' . gf_getImage($showtopic['mood'], 'moods') . '" title="' . $showtopic['mood'] . '"><br>'; $min_height = $min_height + 30; } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time3: $intervalTime"); // Handle Pre ver 2.5 quoting and New Line Formatting - consider adding this to a migrate function if ($CONF_FORUM['pre2.5_mode']) { // try to determine if we have an old post... if (strstr($showtopic['comment'], '<pre class="forumCode">') !== false) { $oldPost = 1; } if (strstr($showtopic['comment'], "[code]<code>") !== false) { $oldPost = 1; } if (strstr($showtopic['comment'], "<pre>") !== false) { $oldPost = 1; } if (stristr($showtopic['comment'], '[code') == false || stristr($showtopic['comment'], '[code]<code>') == true) { if (strstr($showtopic['comment'], "<pre>") !== false) { $oldPost = 1; } $showtopic['comment'] = str_replace('<pre>', '[code]', $showtopic['comment']); $showtopic['comment'] = str_replace('</pre>', '[/code]', $showtopic['comment']); } $showtopic['comment'] = str_ireplace("[code]<code>", '[code]', $showtopic['comment']); $showtopic['comment'] = str_ireplace("</code>[/code]", '[/code]', $showtopic['comment']); $showtopic['comment'] = str_replace(array("<br />\r\n", "<br />\n\r", "<br />\r", "<br />\n"), '<br />', $showtopic['comment']); $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=\\s(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']); /* Reformat code blocks - version 2.3.3 and prior */ $showtopic['comment'] = str_replace('<pre class="forumCode">', '[code]', $showtopic['comment']); $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']); if ($oldPost) { if (strstr($showtopic['comment'], "\\'") !== false) { $showtopic['comment'] = stripslashes($showtopic['comment']); } } } // Check and see if there are now no [file] bbcode tags in content and reset the show_inline value // This is needed in case user had used the file bbcode tag and then removed it if ($mode == 'preview' and strpos($showtopic['comment'], '[file]') === false) { $usql = "UPDATE {$_TABLES['gf_attachments']} SET show_inline = 0 "; if (isset($_POST['uniqueid']) and $_POST['uniqueid'] > 0) { // User is previewing a new post $usql .= "WHERE topic_id = {$_POST['uniqueid']} AND tempfile=1 "; } else { if (isset($showtopic['id'])) { $usql .= "WHERE topic_id = {$showtopic['id']} "; } } DB_query($usql); } $showtopic['comment'] = gf_formatTextBlock($showtopic['comment'], $showtopic['postmode'], $mode); $showtopic['subject'] = gf_formatTextBlock($showtopic['subject'], 'text', $mode); if (strlen($showtopic['subject']) > $CONF_FORUM['show_subject_length']) { $showtopic['subject'] = substr("{$showtopic['subject']}", 0, $CONF_FORUM['show_subject_length']); $showtopic['subject'] .= "..."; } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time2: $intervalTime"); if ($mode != 'preview' && $uservalid && $_USER['uid'] > 1 && $_USER['uid'] == $showtopic['uid']) { /* Check if user can still edit this post - within allowed edit timeframe */ $editAllowed = false; if ($CONF_FORUM['allowed_editwindow'] > 0) { $t1 = $showtopic['date']; $t2 = $CONF_FORUM['allowed_editwindow']; if (time() - $t2 < $t1) { $editAllowed = true; } } else { $editAllowed = true; } if ($editAllowed) { $editlink = "{$_CONF['site_url']}/forum/createtopic.php?method=edit&forum={$showtopic['forum']}&id={$showtopic['id']}&editid={$showtopic['id']}&page={$page}"; $editlinkimg = '<img src="' . gf_getImage('edit_button') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['EDITICON'] . '" TITLE="' . $LANG_GF01['EDITICON'] . '">'; $topictemplate->set_var('editlink', $editlink); $topictemplate->set_var('editlinkimg', $editlinkimg); $topictemplate->set_var('LANG_edit', $LANG_GF01['EDITICON']); $topictemplate->parse('edittopic_link', 'edit'); } } if ($highlight != '') { $showtopic['subject'] = str_replace("{$highlight}", "<font class=highlight>{$highlight}</font>", $showtopic['subject']); $showtopic['comment'] = str_replace("{$highlight}", "<font class=highlight>{$highlight}</font>", $showtopic['comment']); } if ($showtopic['pid'] == 0) { $replytopicid = $showtopic['id']; $is_lockedtopic = $showtopic['locked']; $views = $showtopic['views']; $topictemplate->set_var('read_msg', sprintf($LANG_GF02['msg49'], $views)); if ($is_lockedtopic) { $topictemplate->set_var('locked_icon', '<img src="' . gf_getImage('padlock') . '" TITLE="' . $LANG_GF02['msg114'] . '">'); } } else { $replytopicid = $showtopic['pid']; $is_lockedtopic = DB_getItem($_TABLES['gf_topic'], 'locked', "id={$showtopic['pid']}"); $topictemplate->set_var('read_msg', ''); } // Bookmark feature if ($_USER['uid'] > 1) { if (DB_count($_TABLES['gf_bookmarks'], array('uid', 'topic_id'), array($_USER['uid'], $showtopic['id']))) { $topictemplate->set_var('bookmark_icon', '<img src="' . gf_getImage('star_on_sm') . '" TITLE="' . $LANG_GF02['msg204'] . '">'); } else { $topictemplate->set_var('bookmark_icon', '<img src="' . gf_getImage('star_off_sm') . '" TITLE="' . $LANG_GF02['msg203'] . '">'); } } if ($CONF_FORUM['allow_user_dateformat']) { $date = COM_getUserDateTimeFormat($showtopic['date']); $topictemplate->set_var('posted_date', $date[0]); } else { $date = strftime($CONF_FORUM['default_Topic_Datetime_format'], $showtopic['date']); $topictemplate->set_var('posted_date', $date); } if ($mode != 'preview') { if ($is_lockedtopic == 0) { $is_readonly = DB_getItem($_TABLES['gf_forums'], 'is_readonly', 'forum_id=' . $showtopic['forum']); if ($is_readonly == 0 or forum_modPermission($showtopic['forum'], $_USER['uid'], 'mod_edit')) { $quotelink = "{$_CONF['site_url']}/forum/createtopic.php?method=postreply&forum={$showtopic['forum']}&id={$replytopicid}"eid={$showtopic['id']}"; $quotelinkimg = '<img src="' . gf_getImage('quote_button') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['QUOTEICON'] . '" TITLE="' . $LANG_GF01['QUOTEICON'] . '">'; $topictemplate->set_var('quotelink', $quotelink); $topictemplate->set_var('quotelinkimg', $quotelinkimg); $topictemplate->set_var('LANG_quote', $LANG_GF01['QUOTEICON']); $topictemplate->parse('quotetopic_link', 'quote'); } } //$topictemplate->set_var ('topic_post_link_begin', '<a name="'.$showtopic['id'].'">'); //$topictemplate->set_var ('topic_post_link_end', '</a>'); $mod_functions = forum_getmodFunctions($showtopic); if ($showtopic['uid'] > 1 && $uservalid) { $profile_link = "{$_CONF['site_url']}/users.php?mode=profile&uid={$showtopic['uid']}"; $profile_linkimg = '<img src="' . gf_getImage('profile_button') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['ProfileLink'] . '" TITLE="' . $LANG_GF01['ProfileLink'] . '">'; $topictemplate->set_var('profilelink', $profile_link); $topictemplate->set_var('profilelinkimg', $profile_linkimg); $topictemplate->set_var('LANG_profile', $LANG_GF01['ProfileLink']); $topictemplate->parse('profile_link', 'profile'); if ($CONF_FORUM['use_pm_plugin']) { $pmusernmame = COM_getDisplayName($showtopic['uid']); $pmplugin_link = forumPLG_getPMlink($pmusernmame); if ($pmplugin_link != '') { $pm_link = $pmplugin_link; $pm_linkimg = '<img src="' . gf_getImage('pm_button') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['PMLink'] . '" TITLE="' . $LANG_GF01['PMLink'] . '">'; $topictemplate->set_var('pmlink', $pm_link); $topictemplate->set_var('pmlinkimg', $pm_linkimg); $topictemplate->set_var('LANG_pm', $LANG_GF01['PMLink']); $topictemplate->parse('pm_link', 'pm'); } } } if ($userarray['email'] != '' && $showtopic["uid"] > 1) { $email_link = "{$_CONF['site_url']}/profiles.php?uid={$showtopic['uid']}"; $email_linkimg = '<img src="' . gf_getImage('email_button') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['EmailLink'] . '" TITLE="' . $LANG_GF01['EmailLink'] . '">'; $topictemplate->set_var('emaillink', $email_link); $topictemplate->set_var('emaillinkimg', $email_linkimg); $topictemplate->set_var('LANG_email', $LANG_GF01['EmailLink']); $topictemplate->parse('email_link', 'email'); } if ($userarray['homepage'] != '') { $homepage = $userarray['homepage']; if (!eregi("http", $homepage)) { $homepage = 'http://' . $homepage; } $homepageimg = '<img src="' . gf_getImage('website_button') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['WebsiteLink'] . '" TITLE="' . $LANG_GF01['WebsiteLink'] . '">'; $topictemplate->set_var('websitelink', $homepage); $topictemplate->set_var('websitelinkimg', $homepageimg); $topictemplate->set_var('LANG_website', $LANG_GF01['WebsiteLink']); $topictemplate->parse('website_link', 'website'); } if ($fromblock != "") { $back2 = $LANG_GF01['back2parent']; } else { $back2 = $LANG_GF01['back2top']; } $backlink = '<center><a href="' . $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . $replytopicid . '">' . $back2 . '</a></center>'; } else { if ($_GET['onlytopic'] != 1) { $topictemplate->set_var('posted_date', ''); $topictemplate->set_var('preview_topic_subject', $showtopic['subject']); } else { $topictemplate->set_var('preview_topic_subject', ''); } $topictemplate->set_var('read_msg', ''); $topictemplate->set_var('locked_icon', ''); $topictemplate->set_var('preview_mode', 'none'); // Check and see if there are no [file] bbcode tags in content and reset the show_inline value // This is needed in case user had used the file bbcode tag and then removed it $imagerecs = ''; if (is_array($forumfiles)) { $imagerecs = implode(',', $forumfiles); } if (!empty($_POST['uniqueid'])) { $sql = "UPDATE {$_TABLES['gf_attachments']} SET show_inline = 0 WHERE topic_id={$_POST['uniqueid']} "; if ($imagerecs != '') { $sql .= "AND id NOT IN ({$imagerecs})"; } DB_query($sql); } else { if (isset($_POST['id'])) { $sql = "UPDATE {$_TABLES['gf_attachments']} SET show_inline = 0 WHERE topic_id={$_POST['id']} "; if ($imagerecs != '') { $sql .= "AND id NOT IN ({$imagerecs})"; } DB_query($sql); } } } //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time4: $intervalTime"); $showtopic['comment'] = str_replace('{', '{', $showtopic['comment']); $showtopic['comment'] = str_replace('}', '}', $showtopic['comment']); $uniqueid = COM_applyFilter($_POST['uniqueid'], true); if ($showtopic['id'] > 0) { $topictemplate->set_var('attachments', gf_showattachments($showtopic['id'])); } elseif ($uniqueid > 0) { $topictemplate->set_var('attachments', gf_showattachments($uniqueid)); } $topictemplate->set_var('layout_url', $_CONF['layout_url']); $topictemplate->set_var('csscode', $onetwo); $topictemplate->set_var('postmode', $showtopic['postmode']); $topictemplate->set_var('userlink', $userlink); $topictemplate->set_var('lang_forum', $LANG_GF01['FORUM']); $topictemplate->set_var('user_levelname', $user_levelname); $topictemplate->set_var('user_level', $user_level); $topictemplate->set_var('magical_image', $moodimage); $topictemplate->set_var('avatar', $avatar); $topictemplate->set_var('regdate', $regdate); $topictemplate->set_var('numposts', $numposts); $topictemplate->set_var('location', $location); $topictemplate->set_var('site_url', $_CONF['site_url']); $topictemplate->set_var('imgset', $CONF_FORUM['imgset']); $topictemplate->set_var('topic_subject', $showtopic['subject']); $topictemplate->set_var('LANG_ON2', $LANG_GF01['ON2']); $topictemplate->set_var('mod_functions', $mod_functions); $topictemplate->set_var('topic_comment', $showtopic['comment']); $topictemplate->set_var('comment_minheight', "min-height:{$min_height}px"); if (trim($sig) != '') { $topictemplate->set_var('sig', PLG_replaceTags($sig)); $topictemplate->set_var('show_sig', ''); } else { $topictemplate->set_var('sig', ''); $topictemplate->set_var('show_sig', 'none'); } $topictemplate->set_var('forumid', $showtopic['forum']); $topictemplate->set_var('topic_id', $showtopic['id']); $topictemplate->set_var('back_link', $backlink); $topictemplate->set_var('member_badge', forumPLG_getMemberBadge($showtopic['uid'])); $topictemplate->parse('output', 'topictemplate'); $retval .= $topictemplate->finish($topictemplate->get_var('output')); //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time5: $intervalTime"); return $retval; }
$topic_footer->set_file(array('topicfooter' => 'topicfooter.thtml', 'new' => 'links/newtopic.thtml', 'reply' => 'links/replytopic.thtml')); if ($viewtopic['is_readonly'] == 0 or forum_modPermission($viewtopic['forum'], $_USER['uid'], 'mod_edit')) { $newtopiclink = "{$_CONF['site_url']}/forum/createtopic.php?method=newtopic&forum={$forum}"; $newtopiclinktext = $LANG_GF09['newtopic']; $topic_footer->set_var('layout_url', $CONF_FORUM['layout_url']); $topicDisplayTime = $mytimer->stopTimer(); $topic_footer->set_var('page_generated_time', sprintf($LANG_GF02['msg179'], $topicDisplayTime)); $topic_footer->set_var('newtopiclink', $newtopiclink); $topic_footer->set_var('newtopiclinkimg', gf_getImage('post_newtopic')); $topic_footer->set_var('newtopiclinktext', $newtopiclinktext); $topic_footer->set_var('LANG_newtopic', $LANG_GF01['NEWTOPIC']); $topic_footer->parse('newtopic_link', 'new'); if ($viewtopic['locked'] != 1) { $replytopiclink = "{$_CONF['site_url']}/forum/createtopic.php?method=postreply&forum={$forum}&id={$replytopic_id}"; $topic_footer->set_var('replytopiclink', $replytopiclink); $topic_footer->set_var('replytopiclinkimg', gf_getImage('post_reply')); $topic_footer->set_var('replytopiclinktext', $LANG_GF09['replytopic']); $topic_footer->set_var('LANG_reply', $LANG_GF01['POSTREPLY']); $topic_footer->parse('replytopic_link', 'reply'); } } } else { $base_url .= '&onlytopic=1'; $topic_footer = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout'); $topic_footer->set_file(array('topicfooter' => 'topicfooter_preview.thtml')); } $topic_footer->set_var('pagenavigation', $pagenavigation); $topic_footer->set_var('forum_id', $forum); $topic_footer->set_var('imgset', $CONF_FORUM['imgset']); $topic_footer->parse('output', 'topicfooter'); $display .= $topic_footer->finish($topic_footer->get_var('output'));
$topiclisting->set_var('category_id', $category['id']); $topiclisting->set_var('forum_name', $category['forum_name']); $topiclisting->set_var('forum_id', $forum); $topiclisting->set_var('imgset', $CONF_FORUM['imgset']); $topiclisting->set_var('LANG_TOPIC', $LANG_GF01['TOPICSUBJECT']); $topiclisting->set_var('LANG_STARTEDBY', $LANG_GF01['STARTEDBY']); $topiclisting->set_var('LANG_REPLIES', $LANG_GF01['REPLIES']); $topiclisting->set_var('LANG_VIEWS', $LANG_GF01['VIEWS']); $topiclisting->set_var('LANG_LASTPOST', $LANG_GF01['LASTPOST']); $topiclisting->set_var('LANG_AUTHOR', $LANG_GF01['AUTHOR']); $topiclisting->set_var('LANG_MSG05', $LANG_GF01['LASTPOST']); $topiclisting->set_var('LANG_newforumposts', $LANG_GF02['msg113']); if ($category['is_readonly'] == 0 or forum_modPermission($forum, $_USER['uid'], 'mod_edit')) { $topiclisting->set_var('LANG_newtopic', $LANG_GF01['NEWTOPIC']); $topiclisting->set_var('newtopiclinktext', $LANG_GF09['newtopic']); $topiclisting->set_var('newtopiclinkimg', gf_getImage('post_newtopic')); $topiclisting->set_var('newtopiclink', "{$_CONF['site_url']}/forum/createtopic.php?method=newtopic&forum={$forum}"); $topiclisting->parse('newtopic_link', 'newtopic_link'); } else { $topiclisting->set_var('LANG_newtopic', ''); $topiclisting->set_var('newtopiclink', '#'); } $displaypostpages = $LANG_GF01['PAGES'] . ':'; // FIXME: is this used anywhere? while ($record = DB_fetchArray($topicResults, false)) { if ($record['replies'] + 1 <= $CONF_FORUM['show_posts_perpage']) { $displaypageslink = ""; $gotomsg = ""; } else { $displaypageslink = ""; $gotomsg = $LANG_GF02['msg85'] . " ";
function f_forumrules() { global $_CONF, $_USER, $LANG_GF01, $LANG_GF02, $CONF_FORUM; if ($CONF_FORUM['registered_to_post'] and ($_USER['uid'] < 2 or empty($_USER['uid']))) { $postperm_msg = $LANG_GF01['POST_PERM_MSG2']; $post_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_no') . '"' . XHTML . '>'; } else { $postperm_msg = $LANG_GF01['POST_PERM_MSG1']; $post_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_yes') . '"' . XHTML . '>'; } if ($CONF_FORUM['allow_html']) { $html_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_yes') . '"' . XHTML . '>'; if ($CONF_FORUM['use_glfilter']) { $htmlmsg = $LANG_GF01['HTML_FILTER_MSG']; } else { $htmlmsg = $LANG_GF01['HTML_FULL_MSG']; } } else { $htmlmsg = $LANG_GF01['HTML_MSG']; $html_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_no') . '"' . XHTML . '>'; } if ($CONF_FORUM['use_censor']) { $censor_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_yes') . '"' . XHTML . '>'; } else { $censor_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_no') . '"' . XHTML . '>'; } if ($CONF_FORUM['show_anonymous_posts']) { $anon_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_yes') . '"' . XHTML . '>'; } else { $anon_perm_image = '<img style="padding: 0.2em; vertical-align: middle;" alt="" src="' . gf_getImage('status_no') . '"' . XHTML . '>'; } $forum_rules = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout/footer'); $forum_rules->set_file(array('forum_rules' => 'forum_rules.thtml')); $forum_rules->set_var('imgset', $CONF_FORUM['imgset']); $forum_rules->set_var('LANG_title', $LANG_GF02['msg101']); $forum_rules->set_var('anonymous_msg', $LANG_GF01['ANON_PERM_MSG']); $forum_rules->set_var('anon_perm_image', $anon_perm_image); $forum_rules->set_var('postingperm_msg', $postperm_msg); $forum_rules->set_var('post_perm_image', $post_perm_image); $forum_rules->set_var('html_msg', $htmlmsg); $forum_rules->set_var('html_perm_image', $html_perm_image); $forum_rules->set_var('censor_msg', $LANG_GF01['CENSOR_PERM_MSG']); $forum_rules->set_var('censor_perm_image', $censor_perm_image); $forum_rules->parse('output', 'forum_rules'); return $forum_rules->finish($forum_rules->get_var('output')); }
} $forum_outline_header = new Template($_CONF['path_layout'] . 'forum/layout'); $forum_outline_header->set_file(array('forum_outline_header' => 'forum_outline_header.thtml')); $forum_outline_header->set_var('imgset', $CONF_FORUM['imgset']); $forum_outline_header->parse('output', 'forum_outline_header'); echo $forum_outline_header->finish($forum_outline_header->get_var('output')); if ($method == 'postreply' or $method == 'edit' and $subject == '') { $subject = $edittopic['subject']; } else { $subject = COM_stripslashes($subject); } $topicnavbar = new Template($_CONF['path_layout'] . 'forum/layout'); $topicnavbar->set_file(array('topicnavbar' => 'post_topic_navbar.thtml')); $topicnavbar->set_var('imgset', $CONF_FORUM['imgset']); $topicnavbar->set_var('navbreadcrumbsimg', '<img src="' . gf_getImage('nav_breadcrumbs') . '">'); $topicnavbar->set_var('navtopicimg', '<img src="' . gf_getImage('nav_topic') . '">'); $topicnavbar->set_var('site_url', $_CONF['site_url']); $topicnavbar->set_var('layout_url', $_CONF['layout_url']); $topicnavbar->set_var('phpself', $_CONF['site_url'] . '/forum/createtopic.php'); if (empty($subject)) { $topicnavbar->set_var('show_subject', 'none'); } if ($method == 'newtopic' || $method == 'postreply') { $uniqueid = COM_applyFilter($_POST['uniqueid'], true); if ($uniqueid == 0) { $topicnavbar->set_var('uniqueid', mt_rand()); } else { $topicnavbar->set_var('uniqueid', $uniqueid); } } if ($method == 'newtopic' and $forum > 0) {
if ($mode != 'preview') { $topic_footer = new Template($_CONF['path_layout'] . 'forum/layout'); $topic_footer->set_file(array('topicfooter' => 'topicfooter.thtml', 'new' => 'links/newtopic.thtml', 'reply' => 'links/replytopic.thtml')); if ($viewtopic['is_readonly'] == 0 or forum_modPermission($viewtopic['forum'], $_USER['uid'], 'mod_edit')) { $newtopiclink = "{$_CONF['site_url']}/forum/createtopic.php?method=newtopic&forum={$forum}"; $newtopiclinkimg = '<img src="' . gf_getImage('post_newtopic') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['NEWTOPIC'] . '" TITLE="' . $LANG_GF01['NEWTOPIC'] . '">'; $topic_footer->set_var('layout_url', $_CONF['layout_url']); $topicDisplayTime = $mytimer->stopTimer(); $topic_footer->set_var('page_generated_time', sprintf($LANG_GF02['msg179'], $topicDisplayTime)); $topic_footer->set_var('newtopiclink', $newtopiclink); $topic_footer->set_var('newtopiclinkimg', $newtopiclinkimg); $topic_footer->set_var('LANG_newtopic', $LANG_GF01['NEWTOPIC']); $topic_footer->parse('newtopic_link', 'new'); if ($viewtopic['locked'] != 1) { $replytopiclink = "{$_CONF['site_url']}/forum/createtopic.php?method=postreply&forum={$forum}&id={$replytopic_id}"; $replytopiclinkimg = '<img src="' . gf_getImage('post_reply') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['POSTREPLY'] . '" TITLE="' . $LANG_GF01['POSTREPLY'] . '">'; $topic_footer->set_var('replytopiclink', $replytopiclink); $topic_footer->set_var('replytopiclinkimg', $replytopiclinkimg); $topic_footer->set_var('LANG_reply', $LANG_GF01['POSTREPLY']); $topic_footer->parse('replytopic_link', 'reply'); } } } else { $base_url .= '&onlytopic=1'; $topic_footer = new Template($_CONF['path_layout'] . 'forum/layout'); $topic_footer->set_file(array('topicfooter' => 'topicfooter_preview.thtml')); } $topic_footer->set_var('pagenavigation', COM_printPageNavigation($base_url, $page, $numpages)); $topic_footer->set_var('forum_id', $forum); $topic_footer->set_var('imgset', $CONF_FORUM['imgset']); $topic_footer->parse('output', 'topicfooter');
} // Bookmark feature - check if the parent topic or any reply topics have been bookmarked by the user if ($_USER['uid'] > 1) { $bsql = "SELECT uid FROM {$_TABLES['gf_bookmarks']} WHERE uid={$_USER['uid']} AND (topic_id={$record['id']} OR pid={$record['id']})"; if (DB_numRows(DB_query($bsql)) > 0) { $topiclisting->set_var('bookmark_icon', '<img src="' . gf_getImage('star_on_sm') . '" TITLE="' . $LANG_GF02['msg204'] . '">'); } else { $topiclisting->set_var('bookmark_icon', '<img src="' . gf_getImage('star_off_sm') . '" TITLE="' . $LANG_GF02['msg203'] . '">'); } } } elseif ($record['sticky'] == 1) { $folderimg = '<img src="' . gf_getImage('sticky') . '" border="0" align="absmiddle" alt="' . $LANG_GF02['msg61'] . '" TITLE="' . $LANG_GF02['msg61'] . '">'; } elseif ($record['locked'] == 1) { $folderimg = '<img src="' . gf_getImage('locked') . '" border="0" align="absmiddle" alt="' . $LANG_GF02['msg114'] . '" TITLE="' . $LANG_GF02['msg114'] . '">'; } else { $folderimg = '<img src="' . gf_getImage('noposts') . '" border="0" align="absmiddle" alt="' . $LANG_GF02['msg59'] . '" TITLE="' . $LANG_GF02['msg59'] . '">'; } if ($lastreply['uid'] > 1) { $lastposter = COM_getDisplayName($lastreply['uid']); } else { $lastposter = $lastreply['name']; } if ($record['moved'] == 1) { $moved = "{$LANG_GF01['MOVED']}: "; } else { $moved = ''; } if (strlen($record['subject']) > $CONF_FORUM['show_subject_length']) { $subject = substr($record['subject'], 0, $CONF_FORUM['show_subject_length']) . '....'; } else { $subject = $record['subject'];
} $forum_outline_header = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout'); $forum_outline_header->set_file(array('forum_outline_header' => 'forum_outline_header.thtml')); $forum_outline_header->set_var('imgset', $CONF_FORUM['imgset']); $forum_outline_header->parse('output', 'forum_outline_header'); $display .= $forum_outline_header->finish($forum_outline_header->get_var('output')); if ($method == 'postreply' or $method == 'edit' and $subject == '') { $subject = $edittopic['subject']; } else { $subject = COM_stripslashes($subject); } $topicnavbar = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout'); $topicnavbar->set_file(array('topicnavbar' => 'post_topic_navbar.thtml')); $topicnavbar->set_var('imgset', $CONF_FORUM['imgset']); $topicnavbar->set_var('navbreadcrumbsimg', '<img alt="" src="' . gf_getImage('nav_breadcrumbs') . '"' . XHTML . '>'); $topicnavbar->set_var('navtopicimg', '<img alt="" src="' . gf_getImage('nav_topic') . '"' . XHTML . '>'); $topicnavbar->set_var('layout_url', $CONF_FORUM['layout_url']); $topicnavbar->set_var('phpself', $_CONF['site_url'] . '/forum/createtopic.php'); if ($method == 'newtopic' and $forum > 0) { // User creating a newtopic $topicnavbar->set_var('forum_id', $forum); $topicnavbar->set_var('cat_name', $newtopic['cat_name']); $topicnavbar->set_var('forum_name', $newtopic['forum_name']); } else { $topicnavbar->set_var('forum_id', $edittopic['forum']); $topicnavbar->set_var('cat_name', $edittopic['cat_name']); $topicnavbar->set_var('forum_name', $edittopic['forum_name']); } // run the subject through the HTML filter to ensure no XSS // issues. $subject = gf_checkHTML($subject);
function f_legend() { global $CONF_FORUM, $forum, $_CONF, $LANG_GF01, $LANG_GF02; $forum_legend = COM_newTemplate(CTL_plugin_templatePath('forum')); $forum_legend->set_file(array('forum_legend' => 'footer/forum_legend.thtml', 'forum_icons' => 'forum_icons.thtml')); $blocks = array('new_icon', 'quiet_icon', 'active_icon', 'normal_icon', 'normalnew_icon', 'sticky_icon', 'stickynew_icon', 'locked_icon', 'lockednew_icon'); foreach ($blocks as $block) { $forum_legend->set_block('forum_icons', $block); } $forum_legend->set_var('imgset', $CONF_FORUM['imgset']); if ($forum == '') { $forum_legend->set_var('normal_msg', $LANG_GF02['msg194']); $forum_legend->set_var('normalnew_msg', $LANG_GF02['msg108']); $forum_legend->parse('normal_icon', 'quiet_icon'); $forum_legend->parse('normalnew_icon', 'active_icon'); $forum_legend->parse('viewnew_icon', 'new_icon'); $forum_legend->set_var('viewnew_msg', $LANG_GF02['msg112']); $forum_legend->set_var('markread_icon', '<img src="' . gf_getImage('allread') . '" alt="' . $LANG_GF02['msg84'] . '" title="' . $LANG_GF02['msg84'] . '"' . XHTML . '>'); $forum_legend->set_var('markread_msg', $LANG_GF02['msg84']); } else { $forum_legend->parse('normal_icon', 'normal_icon'); $forum_legend->parse('normalnew_icon', 'normalnew_icon'); $forum_legend->parse('sticky_icon', 'sticky_icon'); $forum_legend->parse('stickynew_icon', 'stickynew_icon'); $forum_legend->parse('locked_icon', 'locked_icon'); $forum_legend->parse('lockednew_icon', 'lockednew_icon'); $forum_legend->set_var('normal_msg', $LANG_GF02['msg59']); $forum_legend->set_var('normalnew_msg', $LANG_GF02['msg60']); $forum_legend->set_var('sticky_msg', $LANG_GF02['msg61']); $forum_legend->set_var('locked_msg', $LANG_GF02['msg114']); $forum_legend->set_var('stickynew_msg', $LANG_GF02['msg115']); $forum_legend->set_var('lockednew_msg', $LANG_GF02['msg116']); } $forum_legend->parse('output', 'forum_legend'); return $forum_legend->finish($forum_legend->get_var('output')); }
} else { $folderimg = '<img src="' . gf_getImage('newposts', 'status') . '" style="border:none; vertical-align:middle;" alt="' . $LANG_GF02['msg60'] . '" title="' . $LANG_GF02['msg60'] . '"' . XHTML . '>'; } } elseif ($record['sticky'] == 1) { $folderimg = '<img src="' . gf_getImage('sticky', 'status') . '" style="border:none; vertical-align:middle;" alt="' . $LANG_GF02['msg61'] . '" title="' . $LANG_GF02['msg61'] . '"' . XHTML . '>'; } elseif ($record['locked'] == 1) { $folderimg = '<img src="' . gf_getImage('locked', 'status') . '" style="border:none; vertical-align:middle;" alt="' . $LANG_GF02['msg114'] . '" title="' . $LANG_GF02['msg114'] . '"' . XHTML . '>'; } else { $folderimg = '<img src="' . gf_getImage('noposts', 'status') . '" style="border:none; vertical-align:middle;" alt="' . $LANG_GF02['msg59'] . '" title="' . $LANG_GF02['msg59'] . '"' . XHTML . '>'; } } elseif ($record['sticky'] == 1) { $folderimg = '<img src="' . gf_getImage('sticky', 'status') . '" style="border:none; vertical-align:middle;" alt="' . $LANG_GF02['msg61'] . '" title="' . $LANG_GF02['msg61'] . '"' . XHTML . '>'; } elseif ($record['locked'] == 1) { $folderimg = '<img src="' . gf_getImage('locked', 'status') . '" style="border:none; vertical-align:middle;" alt="' . $LANG_GF02['msg114'] . '" title="' . $LANG_GF02['msg114'] . '"' . XHTML . '>'; } else { $folderimg = '<img src="' . gf_getImage('noposts', 'status') . '" style="border:none; vertical-align:middle;" alt="' . $LANG_GF02['msg59'] . '" title="' . $LANG_GF02['msg59'] . '"' . XHTML . '>'; } if ($lastreply['uid'] > 1) { $lastposter = COM_getDisplayName($lastreply['uid']); } else { $lastposter = $lastreply['name']; } if ($record['moved'] == 1) { $moved = "{$LANG_GF01['MOVED']}: "; } else { $moved = ""; } if (strlen($record['subject']) > $CONF_FORUM['show_subject_length']) { $subject = COM_truncate($record['subject'], $CONF_FORUM['show_subject_length'], '...'); } else { $subject = $record['subject'];
/** * This function will replace the symbols in a forum post * with corresponding smilie images or the other way around. */ public function replace($message, $reverse = false) { global $LANG_GF_SMILIES; $search = array(); // list of smilie symbols $replace = array(); // list of IMG tags // The replacement values will be created by filling // in the values in this template variable $template = '<img class="frm_sml frm_sml_%s" src="'; $template .= gf_getImage('pixel'); $template .= '" alt="%s" title="%s"' . XHTML . '>'; foreach ($this->data as $key => $value) { // each smilie defined in the $this->data array $search[] = $value['symbol']; $alt = ''; if (isset($LANG_GF_SMILIES[$key])) { $alt = htmlentities($LANG_GF_SMILIES[$key], ENT_QUOTES); } $replace[] = sprintf($template, $key, $alt, $alt); } // Do the actual replacement in the input string if (!$reverse) { $message = str_replace($search, $replace, $message); } else { $message = str_replace($replace, $search, $message); } return $message; }
$report->set_var('image', gf_getImage('pm')); $report->set_var('link_url', $pmplugin_link); $report->set_var('LANG_title', $LANG_GF01['PMLink']); $report->parse('pm_link', 'link'); } else { $report->set_var('pm_link', ''); } } else { $report->set_var('pm_link', ''); } if ($siteMembers['homepage'] != '') { $homepage = $siteMembers['homepage']; if (!eregi("http", $homepage)) { $homepage = 'http://' . $homepage; } $report->set_var('image', gf_getImage('home')); $report->set_var('link_url', $homepage); $report->set_var('LANG_title', $LANG_GF01['WebsiteLink']); $report->parse('website_link', 'link'); } else { $report->set_var('website_link', ''); } $regdate = explode(" ", $siteMembers['regdate']); $report->set_var('member_uid', $siteMembers['uid']); $report->set_var('member_name', COM_getDisplayName($siteMembers['uid'])); $report->set_var('csscode', $csscode); $report->set_var('member_regdate', $regdate[0]); $report->set_var('member_numposts', $siteMembers['posts']); $report->set_var('member_uid', $siteMembers['uid']); $report->parse('report_records', 'records', true); if ($csscode == 2) {