function TPCredits() { tp_hidebars(); $context['TPortal']['not_forum'] = false; if (loadLanguage('TPhelp') == false) { loadLanguage('TPhelp', 'english'); } loadtemplate('TPhelp'); }
function Staff() { global $context, $mbname, $txt; //Check if the current user can view the staff list isAllowedTo('view_stafflist'); loadtemplate('Staff'); //Load the main staff template $context['sub_template'] = 'main'; //Set the page title $context['page_title'] = $mbname . ' - ' . $txt['smfstaff_stafflist']; }
function TagsMain() { loadtemplate('Tagging'); loadLanguage('Tagging'); $subActions = array('addtag' => 'TaggingSystem_Add', 'submittag' => 'TaggingSystem_Submit', 'deletetag' => 'TaggingSystem_Delete', 'admin' => 'TagsSettings', 'admin2' => 'TagsSettings2', 'cleanup' => 'TagCleanUp'); if (!empty($subActions[@$_GET['sa']])) { $subActions[$_GET['sa']](); } else { ViewTags(); } }
function template_main() { global $settings; // modulebased? if (!empty($settings['module_display'])) { loadtemplate('/modules/display/' . $settings['module_display']); call_user_func($settings['module_display']); } else { my_display(); } }
function UPInternalPageMain() { global $sourcedir, $context, $ultimateportalSettings; //load template and language loadtemplate('UPInternalPage'); loadLanguage('UPInternalPage'); //Is active the Internal Page module? if (empty($ultimateportalSettings['ipage_enable'])) { fatal_lang_error('ultport_error_no_active', false); } $subActions = array('main' => 'IPMain', 'view' => 'View', 'add' => 'Add', 'edit' => 'Edit', 'delete' => 'Delete', 'inactive' => 'Inactive', 'view-inactive' => 'ViewInactive'); $_REQUEST['sa'] = !empty($_REQUEST['sa']) && !empty($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main'; $subActions[$_REQUEST['sa']](); }
function globalhf() { //Check if the current user can change headers footers isAllowedTo('admin_forum'); loadtemplate('globalhf'); //Global Headers Footers Actions $subActions = array('view' => 'view', 'save' => 'save'); // Follow the sa or just go to View function if (!empty($subActions[@$_GET['sa']])) { $subActions[@$_GET['sa']](); } else { $subActions['view'](); } }
function refferalsMain() { loadtemplate('refferals'); $subActions = array('settings' => 'refferalsSettings', 'settings2' => 'refferalsSettings2', 'copyright' => 'Referrals_CopyrightRemoval'); if (isset($_REQUEST['sa'])) { $sa = $_GET['sa']; } else { $sa = ''; } if (!empty($subActions[$sa])) { $subActions[$sa](); } else { RefferalsLinkClick(); } }
function Staff() { //Load the main staff template loadtemplate('Staff'); //Load the language files if (loadlanguage('Staff') == false) { loadLanguage('Staff', 'english'); } //Staff page actions $subActions = array('admin' => 'StaffSettings', 'admin2' => 'StaffSettings2', 'add' => 'AddGroup', 'delete' => 'DeleteGroup', 'catup' => 'CatUp', 'catdown' => 'CatDown'); // Follow the sa or just go to main staff page. if (!empty($subActions[@$_GET['sa']])) { $subActions[$_GET['sa']](); } else { ViewStaffPage(); } }
function LinksMain() { // Load the main links template loadtemplate('Links'); // Load the language files if (loadlanguage('Links') == false) { loadLanguage('Links', 'english'); } // Link actions $subActions = array('addlink' => 'AddLink', 'addlink2' => 'AddLink2', 'editlink' => 'EditLink', 'editlink2' => 'EditLink2', 'visit' => 'VisitLink', 'deletelink' => 'DeleteLink', 'deletelink2' => 'DeleteLink2', 'catup' => 'CatUp', 'catdown' => 'CatDown', 'addcat' => 'AddCat', 'addcat2' => 'AddCat2', 'editcat' => 'EditCat', 'editcat2' => 'EditCat2', 'deletecat' => 'DeleteCat', 'deletecat2' => 'DeleteCat2', 'rate' => 'RateLink', 'approve' => 'Approve', 'noapprove' => 'NoApprove', 'alist' => 'ApproveList', 'admin' => 'LinksAdmin', 'admin2' => 'LinksAdmin2', 'admincat' => 'LinksAdminCats', 'adminperm' => 'LinksAdminPerm', 'catperm' => 'CatPerm', 'catperm2' => 'CatPerm2', 'catpermdelete' => 'CatPermDelete'); // Follow the sa or just go to main links index. if (!empty($_GET['sa']) && array_key_exists($_GET['sa'], $subActions)) { call_user_func($subActions[$_GET['sa']]); } else { view(); } }
function tradermain() { loadtemplate('Trader'); // Load the language files if (loadlanguage('Trader') == false) { loadLanguage('Trader', 'english'); } // Trader actions $subActions = array('main' => 'main', 'report' => 'Report', 'report2' => 'Report2', 'submit' => 'Submit', 'detail' => 'ViewDetail', 'delete' => 'Delete', 'delete2' => 'Delete2', 'submit2' => 'Submit2', 'admin' => 'AdminSettings', 'admin2' => 'AdminSettings2', 'approve' => 'ApproveRating', 'bulkactions' => 'BulkActions'); @($sa = $_GET['sa']); // Follow the sa or just go to administration. if (!empty($subActions[$sa])) { $subActions[$sa](); } else { $subActions['main'](); } }
function TagsMain() { // Load the main Tags template loadtemplate('Tags2'); // Load the language files if (loadlanguage('Tags') == false) { loadLanguage('Tags', 'english'); } // Tags actions $subActions = array('suggest' => 'SuggestTag', 'suggest2' => 'SuggestTag2', 'addtag' => 'AddTag', 'addtag2' => 'AddTag2', 'deletetag' => 'DeleteTag', 'admin' => 'TagsSettings', 'admin2' => 'TagsSettings2', 'cleanup' => 'TagCleanUp'); // Follow the sa or just go to main links index. if (!empty($subActions[@$_GET['sa']])) { $subActions[$_GET['sa']](); } else { ViewTags(); } }
/** * System none modal ECL init */ function pmx_eclnonemodal() { global $context, $settings, $modSettings, $maintenance, $scripturl, $options, $txt; if (!empty($modSettings['pmx_eclmodal']) && !pmx_checkECL_Cookie()) { if (!empty($modSettings['pmxportal_disabled'])) { loadJavascriptFile(PortaMx_loadCompressed('PortaMx.js', array('dir' => $settings['default_theme_dir'] . '/PortaMx/Scripts/', 'url' => $settings['default_theme_url'] . '/PortaMx/Scripts/')), array('external' => true)); addInlineJavascript(' var pmxIsInit = true;'); loadLanguage('PortaMx/PortaMx'); } addInlineJavascript(' var eclOverlay = true; function Setlang(elm){window.location.href = elm.options[elm.selectedIndex].value;}'); loadCSSFile(PortaMx_loadCompressed('pmx_ecl.css', array('dir' => $settings['default_theme_dir'] . '/PortaMx/SysCss/', 'url' => $settings['default_theme_url'] . '/PortaMx/SysCss/')), array('external' => true)); loadtemplate('PortaMx/EclMain'); $context['template_layers'][] = 'eclmain'; } }
function CommentsMain() { loadtemplate('ProfileComments'); loadlanguage('Post'); // Load the language files if (loadlanguage('ProfileComments') == false) { loadLanguage('ProfileComments', 'english'); } // Profile Comments actions $subActions = array('view' => 'ProfileCommentsview', 'admin' => 'CommentsAdmin', 'add' => 'ProfileCommentsAdd', 'add2' => 'ProfileCommentsAdd2', 'edit' => 'ProfileCommentsEdit', 'edit2' => 'ProfileCommentsEdit2', 'delete' => 'ProfileCommentsDelete', 'approve' => 'ProfileCommentsApproveComment'); $sa = $_REQUEST['sa']; // Follow the sa or just go to administration. if (!empty($subActions[$sa])) { $subActions[$sa](); } else { ProfileCommentsview(); } }
function WelcomeTopic() { // Check if they are allowed to admin the forum isAllowedTo('admin_forum'); // Load the WelcomeTopic template loadtemplate('WelcomeTopic'); // Load the language files if (loadlanguage('WelcomeTopic') == false) { loadLanguage('WelcomeTopic', 'english'); } // Welcome Topic actions $subActions = array('admin' => 'WelcomeTopicSettings', 'admin2' => 'WelcomeTopicSettings2', 'add' => 'AddTopic', 'add2' => 'AddTopic2', 'edit' => 'EditTopic', 'edit2' => 'EditTopic2', 'delete' => 'DeleteTopic'); // Follow the sa or main Welcome Topic Settings page. if (!empty($subActions[@$_GET['sa']])) { $subActions[$_GET['sa']](); } else { WelcomeTopicSettings(); } }
function PostSchedulerMain() { // Only Admins should see these options isAllowedTo('admin_forum'); // Load the maintemplate loadtemplate('PostScheduler2'); // Load the language files if (loadlanguage('PostScheduler') == false) { loadLanguage('PostScheduler', 'english'); } // Post Scheduler actions $subActions = array('addpost' => 'AddPost', 'addpost2' => 'AddPost2', 'editpost' => 'EditPost', 'editpost2' => 'EditPost2', 'delpost' => 'DeletePost', 'admin' => 'PostSchedulerAdmin', 'saveset' => 'SaveSettings', 'bulkactions' => 'BulkActions'); // Follow the sa or just go to admin if (!empty($subActions[@$_REQUEST['sa']])) { $subActions[$_REQUEST['sa']](); } else { PostSchedulerAdmin(); } }
function FeedsMain() { // Only Admins should see these options isAllowedTo('admin_forum'); // Load the main feeds template loadtemplate('FeedPoster'); // Load the language files if (loadlanguage('FeedPoster') == false) { loadLanguage('FeedPoster', 'english'); } // FeedPoster actions $subActions = array('addfeed' => 'AddFeed', 'addfeed2' => 'AddFeed2', 'editfeed' => 'EditFeed', 'editfeed2' => 'EditFeed2', 'delfeed' => 'DeleteFeed', 'admin' => 'FeedsAdmin', 'saveset' => 'SaveSettings', 'bulkactions' => 'BulkActions'); // Follow the sa or just go to feeds admin if (!empty($subActions[@$_REQUEST['sa']])) { $subActions[$_REQUEST['sa']](); } else { FeedsAdmin(); } }
function UPNewsMain() { global $sourcedir, $context, $txt; global $ultimateportalSettings; //Inicialized the Ultimate Portal? $context['ultimate_portal_initialized'] = true; // Load UltimatePortal Settings ultimateportalSettings(); // Load UltimatePortal template loadtemplate('UPNews'); // Load Language loadLanguage('UPNews'); //Is active the NEWS module? if (empty($ultimateportalSettings['up_news_enable'])) { fatal_lang_error('ultport_error_no_active_news', false); } //Load subactions for the Ultimate Portal - Module NEWS $subActions = array('main' => 'ShowNewsMain', 'show-cat' => 'ShowCat', 'view-new' => 'ViewNew', 'add-new' => 'AddNew', 'edit-new' => 'EditNew', 'delete-new' => 'DeleteNew'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main'; $subActions[$_REQUEST['sa']](); }
function TagsMain() { // Load the main Tags template loadtemplate('Tags'); // Load the language files if (loadlanguage('Tags') == false) { loadLanguage('Tags', 'english'); } // Tags actions $subActions = array('edittopic' => 'EditTopic', 'edittopic2' => 'EditTopic2', 'suggesttopic' => 'SuggestTopic', 'suggesttopic2' => 'SuggestTopic2', 'approvetopic' => 'ApproveTopic', 'deletetopic' => 'DeleteTopic', 'rename' => 'RenameTag', 'viewall' => 'ViewAllTags', 'merge' => 'MergeTag', 'move' => 'MoveTag', 'admin' => 'TagsSettings', 'admin2' => 'TagsSettings2', 'cleanup' => 'TagCleanUp'); // Follow the sa or just go to main links index. if (!empty($subActions[@$_GET['sa']])) { $subActions[$_GET['sa']](); } else { if (allowedTo('smftags_manage')) { if (isset($_REQUEST['todo']) || isset($_REQUEST['create'])) { ManageTags2(); } ManageTags(); } ViewTags(); } }
//tags that must appear in the header $templatetags = array("title", "headscript", "script"); while (list($key, $val) = each($templatetags)) { if (strpos($template['header'], "{" . $val . "}") === false) { $templatemessage .= "You do not have {" . $val . "} defined in your header\n"; } } //tags that must appear in the footer $templatetags = array(); while (list($key, $val) = each($templatetags)) { if (strpos($template['footer'], "{" . $val . "}") === false) { $templatemessage .= "You do not have {" . $val . "} defined in your footer\n"; } } //tags that may appear anywhere but must appear $templatetags = array("nav", "stats", "petition", "motd", "mail", "copyright", "source"); while (list($key, $val) = each($templatetags)) { if (strpos($template['header'], "{" . $val . "}") === false && strpos($template['footer'], "{" . $val . "}") === false) { $templatemessage .= "You do not have {" . $val . "} defined in either your header or footer\n"; } } if ($templatemessage != "") { echo "<b>You have one or more errors in your template page!</b><br>" . nl2br($templatemessage); $template = loadtemplate("yarbrough.htm"); } $races = array(1 => "Troll", 2 => "Elf", 3 => "Human", 4 => "Dwarf", 0 => "Unknown", 50 => "Hoversheep"); $logd_version = "TDS-0.01"; $session['user']['laston'] = date("Y-m-d H:i:s"); $playermount = getmount($session['user']['hashorse']); $titles = array(0 => array("Farmboy", "Farmgirl"), 1 => array("Page", "Page"), 2 => array("Squire", "Squire"), 3 => array("Gladiator", "Gladiatrix"), 4 => array("Legionnaire", "Legioness"), 5 => array("Centurion", "Centurioness"), 6 => array("Sir", "Madam"), 7 => array("Reeve", "Reeve"), 8 => array("Steward", "Stewardess"), 9 => array("Mayor", "Mayoress"), 10 => array("Baron", "Baroness"), 11 => array("Count", "Countess"), 12 => array("Viscount", "Viscountess"), 13 => array("Marquis", "Marquisette"), 14 => array("Chancellor", "Chancelress"), 15 => array("Prince", "Princess"), 16 => array("King", "Queen"), 17 => array("Emperor", "Empress"), 18 => array("Angel", "Angel"), 19 => array("Archangel", "Archangel"), 20 => array("Principality", "Principality"), 21 => array("Power", "Power"), 22 => array("Virtue", "Virtue"), 23 => array("Dominion", "Dominion"), 24 => array("Throne", "Throne"), 25 => array("Cherub", "Cherub"), 26 => array("Seraph", "Seraph"), 27 => array("Demigod", "Demigoddess"), 28 => array("Titan", "Titaness"), 29 => array("Archtitan", "Archtitaness"), 30 => array("Undergod", "Undergoddess")); $beta = getsetting("beta", 0) == 1 || $session['user']['beta'] == 1;
function Contact() { global $context, $mbname, $webmaster_email, $txt, $sourcedir, $modSettings, $scripturl, $func; // Check if the current user can send a message isAllowedTo('view_contact'); if (isset($_GET['sa'])) { if ($_GET['sa'] == 'save') { // Check whether the visual verification code was entered correctly. if (isset($modSettings['recaptcha_enabled']) && !empty($modSettings['recaptcha_enabled']) && ($modSettings['recaptcha_enabled'] == 1 && !empty($modSettings['recaptcha_public_key']) && !empty($modSettings['recaptcha_private_key']))) { if (!empty($_POST["recaptcha_response_field"]) && !empty($_POST["recaptcha_challenge_field"])) { require_once "{$sourcedir}/recaptchalib.php"; $resp = recaptcha_check_answer($modSettings['recaptcha_private_key'], $_SERVER['REMOTE_ADDR'], $_REQUEST['recaptcha_challenge_field'], $_REQUEST['recaptcha_response_field']); if (!$resp->is_valid) { fatal_lang_error('error_wrong_verification_code', false); } } else { fatal_lang_error('error_wrong_verification_code', false); } } else { if ((empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1) && (empty($_REQUEST['visual_verification_code']) || strtoupper($_REQUEST['visual_verification_code']) !== $_SESSION['visual_verification_code'])) { $_SESSION['visual_errors'] = isset($_SESSION['visual_errors']) ? $_SESSION['visual_errors'] + 1 : 1; if ($_SESSION['visual_errors'] > 3 && isset($_SESSION['visual_verification_code'])) { unset($_SESSION['visual_verification_code']); } fatal_lang_error('visual_verification_failed', false); } elseif (isset($_SESSION['visual_errors'])) { unset($_SESSION['visual_errors']); } } $from = $_POST['from']; if ($from == '') { fatal_error($txt['smfcontact_errname'], false); } $subject = $_POST['subject']; if ($subject == '') { fatal_error($txt['smfcontact_errsubject'], false); } $message = $_POST['message']; if ($message == '') { fatal_error($txt['smfcontact_errmessage'], false); } $email = $_POST['email']; if ($email == '') { fatal_error($txt['smfcontact_erremail'], false); } $subject = $func['htmlspecialchars']($subject, ENT_QUOTES); $message = $func['htmlspecialchars']($message, ENT_QUOTES); $from = $func['htmlspecialchars']($from, ENT_QUOTES); $email = $func['htmlspecialchars']($email, ENT_QUOTES); $m = $txt['smfcontact_form'] . $mbname . " \n"; $m .= $txt['smfcontact_formname'] . $from . "\n"; $m .= $txt['smfcontact_formemail'] . $email . "\n"; $m .= $txt['smfcontact_ip'] . $_SERVER['REMOTE_ADDR'] . "\n"; $m .= $txt['smfcontact_formmessage']; $m .= $message; $m .= "\n"; // For send mail function require_once $sourcedir . '/Subs-Post.php'; // Send email to webmaster if (empty($modSettings['smfcontactpage_email'])) { sendmail($webmaster_email, $subject, $m, $email); } else { sendmail($modSettings['smfcontactpage_email'], $subject, $m, $email); } // Show template that mail was sent loadtemplate('Contact'); // Load the main contact template $context['sub_template'] = 'send'; // Set the page title $context['page_title'] = $mbname . $txt['smfcontact_titlesent']; } } else { // Load the main Contact template loadtemplate('Contact'); // Language strings loadLanguage('Login'); // Load the main Contact template $context['sub_template'] = 'main'; // Set the page title $context['page_title'] = $mbname . ' - ' . $txt['smfcontact_contact']; // Generate a visual verification code to make sure the user is no bot. $context['visual_verification'] = empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1; if ($context['visual_verification']) { $context['use_graphic_library'] = in_array('gd', get_loaded_extensions()); $context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand()); // Only generate a new code if one hasn't been set yet if (!isset($_SESSION['visual_verification_code'])) { // Skip I, J, L, O and Q. $character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P'), range('R', 'Z')); // Generate a new code. $_SESSION['visual_verification_code'] = ''; for ($i = 0; $i < 5; $i++) { $_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)]; } } } } }
function prepare_template($force = false) { if (!$force) { if (defined("TEMPLATE_IS_PREPARED")) { return; } define("TEMPLATE_IS_PREPARED", true); } global $templatename, $templatemessage, $template, $session, $y, $z, $y2, $z2, $copyright, $lc, $x, $templatetags; if (!isset($_COOKIE['template'])) { $_COOKIE['template'] = ""; } $templatename = ""; $templatemessage = ""; if ($_COOKIE['template'] != "") { $templatename = $_COOKIE['template']; } if ($templatename == "" || !file_exists("templates/{$templatename}")) { $templatename = getsetting("defaultskin", "jade.htm"); } if ($templatename == "" || !file_exists("templates/{$templatename}")) { $templatename = "jade.htm"; } $template = loadtemplate($templatename); //CMJ edit: changed for performance // if ($session['templatename'] == $templatename && $session['templatemtime']==filemtime("templates/$templatename")){ if ($session['templatename'] == $templatename) { //We do not have to check that the template is valid since it has //not changed. } else { //We need to double check that the template is valid since the name // or file mod time have changed. //tags that must appear in the header $templatetags = array("title", "headscript", "script"); while (list($key, $val) = each($templatetags)) { if (strpos($template['header'], "{" . $val . "}") === false && $val) { $templatemessage .= "You do not have {" . $val . "} defined in your header\n"; } } //tags that must appear in the footer $templatetags = array(); while (list($key, $val) = each($templatetags)) { if (strpos($template['footer'], "{" . $val . "}") === false && $val) { $templatemessage .= "You do not have {" . $val . "} defined in your footer\n"; } } //tags that may appear anywhere but must appear $templatetags = array("nav", "stats", "petition", "motd", "mail", "paypal", "source", "version", "copyright"); while (list($key, $val) = each($templatetags)) { if (!$key) { array_push($templatetags, $y2 ^ $z2); } if (strpos($template['header'], "{" . $val . "}") === false && strpos($template['footer'], "{" . $val . "}") === false && $val) { $templatemessage .= "You do not have {" . $val . "} defined in either your header or footer\n"; } } if ($templatemessage == "") { $session['templatename'] = $templatename; //$session['templatemtime'] = filemtime("templates/$templatename"); } } if ($templatemessage != "") { echo "<b>You have one or more errors in your template page!</b><br>" . nl2br($templatemessage); $template = loadtemplate("jade.htm"); } else { $y = 0; $z = $y2 ^ $z2; if ($session['user']['loggedin'] && $x > '') { ${$z} = $x; } ${$z} = $lc . ${$z} . "<br />"; } }
function TP_setThemeLayer($layer, $template, $subtemplate, $admin = false) { global $context, $settings; if ($admin) { loadtemplate($template); if (file_exists($settings['theme_dir'] . '/' . $template . '.css')) { $context['html_headers'] .= '<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/' . $template . '.css?fin11" />'; } else { $context['html_headers'] .= '<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/' . $template . '.css?fin11" />'; } if (loadLanguage('TPortalAdmin') == false) { loadlangauge('TPortalAdmin', 'english'); } if (loadLanguage($template) == false) { loadLanguage($template, 'english'); } adminIndex('tportal'); $context['template_layers'][] = $layer; $context['sub_template'] = $subtemplate; } else { loadtemplate($template); if (loadLanguage($template) == false) { loadLanguage($template, 'english'); } if (file_exists($settings['theme_dir'] . '/' . $template . '.css')) { $context['html_headers'] .= '<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/' . $template . '.css?fin11" />'; } else { $context['html_headers'] .= '<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/' . $template . '.css?fin11" />'; } $context['template_layers'][] = $layer; $context['sub_template'] = $subtemplate; } }
function tpshout_frontpage() { loadtemplate('TPShout'); tpshout_bigscreen(true); }
function UltimatePortal_Home_Page() { global $context, $mbname, $sourcedir, $ultimateportalSettings; //Loads Blocks require_once $sourcedir . '/Subs-UltimatePortal-Init-Blocks.php'; //Loads Functions for Ultimate Portal require_once $sourcedir . '/Subs-UltimatePortal.php'; // Setup Page Title if (empty($ultimateportalSettings['ultimate_portal_home_title'])) { $context['page_title'] = $mbname; } else { $context['page_title'] = $ultimateportalSettings['ultimate_portal_home_title']; } loadtemplate('UltimatePortal'); $context['sub_template'] = 'ultimate_portal_frontpage'; }
/** * Start of the template, just calls in the helpers */ function template_ManageNews_init() { loadtemplate('GenericHelpers'); }
function template_replies() { global $context, $settings, $options, $txt, $scripturl, $modSettings; loadtemplate('Common'); echo ' <div id="recent">'; $showCheckboxes = !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $settings['show_mark_read']; if ($showCheckboxes) { echo ' <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;"> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="qaction" value="markread" /> <input type="hidden" name="redirect_url" value="action=unreadreplies', !empty($context['showing_all_topics']) ? ';all' : '', $context['querystring_board_limits'], '" />'; } if (isset($context['topics_to_mark']) && !empty($settings['show_mark_read'])) { // Generate the button strip. $mark_read = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id'])); if ($showCheckboxes) { $mark_read['markselectread'] = array('text' => 'quick_mod_markread', 'image' => 'markselectedread.gif', 'lang' => true, 'url' => 'javascript:document.quickModForm.submit();'); } } if (!empty($context['topics'])) { echo ' <div class="pagesection themepadding"> <div class="bwgrid"> <div class="bwcell8"> <br><div>', $txt['pages'], ': ', $context['page_index'], '</div> </div> <div class="bwcell8">'; if (!empty($mark_read) && !empty($settings['use_tabs'])) { echo template_button_strip($mark_read, 'right'); } echo ' </div> </div> </div> <div class="topic_table clear" id="unreadreplies"> <table class="table_grid" cellspacing="0"> <thead> <tr class="catbg"> <th scope="col" class="first_th"> </th> <th scope="col"> <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] === 'subject' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] === 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> </th> <th scope="col" width="14%" align="center"> <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] === 'replies' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] === 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> </th>'; // Show a "select all" box for quick moderation? if ($showCheckboxes) { echo ' <th scope="col" width="22%"> <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] === 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> </th> <th class="last_th" width="2%"> <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" /> </th>'; } else { echo ' <th scope="col" class="last_th" width="22%"> <a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] === 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> </th>'; } echo ' </tr> </thead> <tbody>'; template_topiclist($context['topics'], $showCheckboxes); if (empty($settings['use_tabs']) && !empty($mark_read)) { echo ' <tr class="catbg"> <td colspan="', $showCheckboxes ? '5' : '4', '" align="right"> ', template_button_strip($mark_read, 'top'), ' </td> </tr>'; } echo ' </tbody> </table> </div> <div class="pagesection themepadding">'; if (!empty($settings['use_tabs']) && !empty($mark_read)) { template_button_strip($mark_read, 'right'); } echo ' <span>', $txt['pages'], ': ', $context['page_index'], '</span> </div><br class="clear" />'; } else { echo ' <div class="cat_bar"> <h3 class="catbg centertext"> ', $context['showing_all_topics'] ? $txt['msg_alert_none'] : $txt['unread_topics_visit_none'], ' </h3> </div>'; } if ($showCheckboxes) { echo ' </form>'; } echo ' </div>'; }
function doTPfrontpage() { global $context, $scripturl, $user_info, $modSettings, $smcFunc, $txt; // check we aren't in any other section because 'cat' is used in SMF and TP if (isset($_GET['action']) || isset($_GET['board']) || isset($_GET['topic'])) { return; } $now = time(); // set up visual options for frontpage $context['TPortal']['visual_opts'] = explode(',', $context['TPortal']['frontpage_visual']); // first, the panels foreach (array('left', 'right', 'center', 'top', 'bottom', 'lower') as $pan => $panel) { if ($context['TPortal'][$panel . 'panel'] == 1 && in_array($panel, $context['TPortal']['visual_opts'])) { $context['TPortal'][$panel . 'panel'] = 1; } else { $context['TPortal'][$panel . 'panel'] = 0; } } // get the sorting foreach ($context['TPortal']['visual_opts'] as $vi => $vo) { if (substr($vo, 0, 5) == 'sort_') { $catsort = substr($vo, 5); } else { $catsort = 'date'; } if (substr($vo, 0, 10) == 'sortorder_') { $catsort_order = substr($vo, 10); } else { $catsort_order = 'desc'; } } if (!in_array($catsort, array('date', 'author_id', 'id', 'parse'))) { $catsort = 'date'; } $max = $context['TPortal']['frontpage_limit']; $start = $context['TPortal']['mystart']; // fetch the articles, sorted if ($context['TPortal']['front_type'] == 'articles_only') { // first, get all available if (!$context['user']['is_admin']) { $artgroups = 'AND (FIND_IN_SET(' . implode(', var.value3) OR FIND_IN_SET(', $user_info['groups']) . ', var.value3))'; } else { $artgroups = ''; } $request = $smcFunc['db_query']('', ' SELECT art.id FROM ({db_prefix}tp_articles AS art, {db_prefix}tp_variables AS var) WHERE art.off = 0 AND var.id = art.category ' . $artgroups . ' AND art.category > 0 AND ((art.pub_start = 0 AND art.pub_end = 0) OR (art.pub_start != 0 AND art.pub_start < ' . $now . ' AND art.pub_end = 0) OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ') OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ' AND art.pub_start < ' . $now . ')) AND art.approved = 1 AND art.frontpage = 1'); if ($smcFunc['db_num_rows']($request) > 0) { $articles_total = $smcFunc['db_num_rows']($request); $smcFunc['db_free_result']($request); } else { $articles_total = 0; } // make the pageindex! $context['TPortal']['pageindex'] = TPageIndex($scripturl . '?frontpage', $start, $articles_total, $max); $request = $smcFunc['db_query']('', ' SELECT art.id, IF(art.useintro > 0, art.intro, art.body) AS body, art.date, art.category, art.subject, art.author_id as authorID, var.value1 as category_name, var.value8 as category_shortname, art.frame, art.comments, art.options, art.intro, art.useintro, art.comments_var, art.views, art.rating, art.voters, art.shortname, art.fileimport, art.topic, art.illustration,art.type as rendertype , IFNULL(mem.real_name, art.author) as realName, mem.avatar, mem.posts, mem.date_registered as dateRegistered,mem.last_login as lastLogin, IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType FROM {db_prefix}tp_articles AS art LEFT JOIN {db_prefix}tp_variables AS var ON(var.id = art.category) LEFT JOIN {db_prefix}members AS mem ON (art.author_id = mem.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member AND a.attachment_type!=3) WHERE art.off = 0 ' . $artgroups . ' AND ((art.pub_start = 0 AND art.pub_end = 0) OR (art.pub_start != 0 AND art.pub_start < ' . $now . ' AND art.pub_end = 0) OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ') OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ' AND art.pub_start < ' . $now . ')) AND art.category > 0 AND art.approved = 1 AND (art.frontpage = 1 OR art.featured = 1) ORDER BY art.featured DESC, art.sticky DESC, art.' . $catsort . ' ' . $catsort_order . ' LIMIT {int:start}, {int:max}', array('start' => $start, 'max' => $max)); if ($smcFunc['db_num_rows']($request) > 0) { $total = $smcFunc['db_num_rows']($request); $col1 = ceil($total / 2); $col2 = $total - $col1; $counter = 0; $context['TPortal']['category'] = array('articles' => array(), 'col1' => array(), 'col2' => array(), 'options' => array('catlayout' => $context['TPortal']['frontpage_catlayout'])); while ($row = $smcFunc['db_fetch_assoc']($request)) { // expand the vislaoptions $row['visual_options'] = explode(',', $row['options']); $row['avatar'] = $row['avatar'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt=" " />' : '' : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt=" " />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt=" " />'); if ($counter == 0) { $context['TPortal']['category']['featured'] = $row; } elseif ($counter < $col1) { $context['TPortal']['category']['col1'][] = $row; } elseif ($counter > $col1 || $counter == $col1) { $context['TPortal']['category']['col2'][] = $row; } $counter++; } $smcFunc['db_free_result']($request); } } elseif ($context['TPortal']['front_type'] == 'single_page') { $request = $smcFunc['db_query']('', ' SELECT art.id, IF(art.useintro > 0, art.intro, art.body) AS body, art.date, art.category, art.subject, art.author_id as authorID, var.value1 as category_name, var.value8 as category_shortname, art.frame, art.comments, art.options, art.intro, art.useintro, art.comments_var, art.views, art.rating, art.voters, art.shortname, art.fileimport, art.topic, art.illustration,art.type as rendertype , IFNULL(mem.real_name, art.author) as realName, mem.avatar, mem.posts, mem.date_registered as dateRegistered,mem.last_login as lastLogin, IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType FROM {db_prefix}tp_articles AS art LEFT JOIN {db_prefix}tp_variables AS var ON(var.id = art.category) LEFT JOIN {db_prefix}members AS mem ON (art.author_id = mem.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member AND a.attachment_type!=3) WHERE art.off = 0 AND ((art.pub_start = 0 AND art.pub_end = 0) OR (art.pub_start != 0 AND art.pub_start < ' . $now . ' AND art.pub_end = 0) OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ') OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ' AND art.pub_start < ' . $now . ')) AND art.featured = 1 AND art.approved = 1 LIMIT 1'); if ($smcFunc['db_num_rows']($request) > 0) { $context['TPortal']['category'] = array('articles' => array(), 'col1' => array(), 'col2' => array(), 'options' => array('catlayout' => $context['TPortal']['frontpage_catlayout'])); $row = $smcFunc['db_fetch_assoc']($request); // expand the vislaoptions $row['visual_options'] = explode(',', $row['options']); $row['avatar'] = $row['avatar'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt=" " />' : '' : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt=" " />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt=" " />'); $context['TPortal']['category']['featured'] = $row; $smcFunc['db_free_result']($request); } } elseif (in_array($context['TPortal']['front_type'], array('forum_only', 'forum_selected'))) { $totalmax = 200; loadLanguage('Stats'); // Find the post ids. if ($context['TPortal']['front_type'] == 'forum_only') { $request = $smcFunc['db_query']('', ' SELECT t.id_first_msg as ID_FIRST_MSG FROM ({db_prefix}topics as t, {db_prefix}boards as b) WHERE t.id_board = b.id_board AND t.id_board IN({raw:board}) ' . ($context['TPortal']['allow_guestnews'] == 0 ? 'AND {query_see_board}' : '') . ' ORDER BY t.id_first_msg DESC LIMIT {int:max}', array('board' => $context['TPortal']['SSI_board'], 'max' => $totalmax)); } else { $request = $smcFunc['db_query']('', ' SELECT t.id_first_msg as ID_FIRST_MSG FROM ({db_prefix}topics as t, {db_prefix}boards as b) WHERE t.id_board = b.id_board AND t.id_topic IN(' . (empty($context['TPortal']['frontpage_topics']) ? 0 : '{raw:topics}') . ') ' . ($context['TPortal']['allow_guestnews'] == 0 ? 'AND {query_see_board}' : '') . ' ORDER BY t.id_first_msg DESC', array('topics' => $context['TPortal']['frontpage_topics'])); } $posts = array(); while ($row = $smcFunc['db_fetch_assoc']($request)) { $posts[] = $row['ID_FIRST_MSG']; } $smcFunc['db_free_result']($request); if (empty($posts)) { return array(); } // do some conversion if ($catsort == 'date') { $catsort = 'poster_time'; } elseif ($catsort == 'authorID') { $catsort = 'id_member'; } elseif ($catsort == 'parse' || $catsort == 'id') { $catsort = 'id_msg'; } else { $catsort = 'poster_time'; } $request = $smcFunc['db_query']('', ' SELECT m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS realName, m.poster_time as date, mem.avatar,mem.posts, mem.date_registered as dateRegistered,mem.last_login as lastLogin, IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType, t.id_board as category, b.name as category_name, t.num_replies as numReplies, t.id_topic as id, m.id_member as authorID, t.num_views as views,t.num_replies as replies, t.locked, IFNULL(thumb.id_attach, 0) AS thumb_id, thumb.filename as thumb_filename FROM ({db_prefix}topics AS t, {db_prefix}messages AS m) LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member AND a.attachment_type !=3) LEFT JOIN {db_prefix}attachments AS thumb ON (t.id_first_msg = thumb.id_msg AND thumb.attachment_type = 3) LEFT JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board) WHERE t.id_first_msg IN ({array_int:posts}) AND m.id_msg = t.id_first_msg GROUP BY t.id_first_msg ORDER BY m.{raw:catsort} DESC LIMIT {int:start}, {int:max}', array('posts' => $posts, 'catsort' => $catsort, 'start' => $start, 'max' => $max)); // make the pageindex! $context['TPortal']['pageindex'] = TPageIndex($scripturl . '?frontpage', $start, count($posts), $max); if ($smcFunc['db_num_rows']($request) > 0) { $total = $smcFunc['db_num_rows']($request); $col1 = ceil($total / 2); $col2 = $total - $col1; $counter = 0; $context['TPortal']['category'] = array('articles' => array(), 'col1' => array(), 'col2' => array(), 'options' => array('catlayout' => $context['TPortal']['frontpage_catlayout'])); while ($row = $smcFunc['db_fetch_assoc']($request)) { $length = $context['TPortal']['frontpage_limit_len']; if (!empty($length) && $smcFunc['strlen']($row['body']) > $length) { $row['body'] = $smcFunc['substr']($row['body'], 0, $length); // The first space or line break. (<br />, etc.) $cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<')); if ($cutoff !== false) { $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); } $row['body'] .= '... <p><strong><a href="' . $scripturl . '?topic=' . $row['id'] . '">' . $txt['tp-readmore'] . '</a></strong></p>'; } // some needed addons $row['rendertype'] = 'bbc'; $row['frame'] = 'theme'; $row['boardnews'] = 1; if (!isset($context['TPortal']['frontpage_visopts'])) { $context['TPortal']['frontpage_visopts'] = 'date,title,author,views' . ($context['TPortal']['forumposts_avatar'] == 1 ? ',avatar' : ''); } $row['visual_options'] = explode(',', $context['TPortal']['frontpage_visopts']); $row['useintro'] = '0'; $row['avatar'] = $row['avatar'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt=" " />' : '' : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt=" " />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt=" " />'); if (!empty($row['thumb_id'])) { $row['illustration'] = $scripturl . '?action=tpmod;sa=tpattach;topic=' . $row['id'] . '.0;attach=' . $row['thumb_id'] . ';image'; } if ($counter == 0) { $context['TPortal']['category']['featured'] = $row; } elseif ($counter < $col1 && $counter > 0) { $context['TPortal']['category']['col1'][] = $row; } elseif ($counter > $col1 || $counter == $col1) { $context['TPortal']['category']['col2'][] = $row; } $counter++; } $smcFunc['db_free_result']($request); } } elseif (in_array($context['TPortal']['front_type'], array('forum_articles', 'forum_selected_articles'))) { // first, get all available if (!$context['user']['is_admin']) { $artgroups = 'AND (FIND_IN_SET(' . implode(', var.value3) OR FIND_IN_SET(', $user_info['groups']) . ', var.value3))'; } else { $artgroups = ''; } $totalmax = 200; loadLanguage('Stats'); $year = 10000000; $year2 = 100000000; $request = $smcFunc['db_query']('', 'SELECT art.id, art.date, art.sticky, art.featured FROM ({db_prefix}tp_articles AS art, {db_prefix}tp_variables AS var) WHERE art.off = 0 AND var.id = art.category ' . $artgroups . ' AND ((art.pub_start = 0 AND art.pub_end = 0) OR (art.pub_start != 0 AND art.pub_start < ' . $now . ' AND art.pub_end = 0) OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ') OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ' AND art.pub_start < ' . $now . ')) AND art.category > 0 AND art.approved = 1 AND (art.frontpage = 1 OR art.featured = 1) ORDER BY art.featured DESC, art.sticky desc, art.date DESC'); $posts = array(); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { if ($row['sticky'] == 1) { $row['date'] += $year; } if ($row['featured'] == 1) { $row['date'] += $year2; } $posts[$row['date'] . '_' . sprintf("%06s", $row['id'])] = 'a_' . $row['id']; } $smcFunc['db_free_result']($request); } // Find the post ids. if ($context['TPortal']['front_type'] == 'forum_articles') { $request = $smcFunc['db_query']('', ' SELECT t.id_first_msg as ID_FIRST_MSG , m.poster_time as date FROM ({db_prefix}topics as t, {db_prefix}boards as b, {db_prefix}messages as m) WHERE t.id_board = b.id_board AND t.id_first_msg = m.id_msg AND t.id_board IN({raw:board}) ' . ($context['TPortal']['allow_guestnews'] == 0 ? 'AND {query_see_board}' : '') . ' ORDER BY date DESC LIMIT {int:max}', array('board' => $context['TPortal']['SSI_board'], 'max' => $totalmax)); } else { $request = $smcFunc['db_query']('', ' SELECT t.id_first_msg as ID_FIRST_MSG , m.poster_time as date FROM ({db_prefix}topics as t, {db_prefix}boards as b, {db_prefix}messages as m) WHERE t.id_board = b.id_board AND t.id_first_msg = m.id_msg AND t.id_topic IN(' . (empty($context['TPortal']['frontpage_topics']) ? '0' : $context['TPortal']['frontpage_topics']) . ') ' . ($context['TPortal']['allow_guestnews'] == 0 ? 'AND {query_see_board}' : '') . ' ORDER BY date DESC'); } if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $posts[$row['date'] . '_' . sprintf("%06s", $row['ID_FIRST_MSG'])] = 'm_' . $row['ID_FIRST_MSG']; } $smcFunc['db_free_result']($request); } // Sort the articles/posts before grabing the limit, otherwise they are out of order ksort($posts, SORT_NUMERIC); $posts = array_reverse($posts); // which should we select $aposts = array(); $mposts = array(); $a = 0; foreach ($posts as $ab => $val) { if (($a == $start || $a > $start) && $a < $start + $max) { if (substr($val, 0, 2) == 'a_') { $aposts[] = substr($val, 2); } elseif (substr($val, 0, 2) == 'm_') { $mposts[] = substr($val, 2); } } $a++; } $thumbs = array(); if (count($mposts) > 0) { // Find the thumbs. $request = $smcFunc['db_query']('', ' SELECT id_thumb FROM {db_prefix}attachments WHERE id_msg IN ({array_int:posts}) AND id_thumb > 0', array('posts' => $mposts)); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $thumbs[] = $row['id_thumb']; } $smcFunc['db_free_result']($request); } } // make the pageindex! $context['TPortal']['pageindex'] = TPageIndex($scripturl . '?frontpage', $start, count($posts), $max); // ok we got the post ids now, fetch each one, forum first if (count($mposts) > 0) { $request = $smcFunc['db_query']('', ' SELECT m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS realName, m.poster_time as date, mem.avatar, mem.posts, mem.date_registered as dateRegistered, mem.last_login as lastLogin, IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType, t.id_board as category, b.name as category_name, t.num_replies as numReplies, t.id_topic as id, m.id_member as authorID, t.num_views as views, t.num_replies as replies, t.locked, IFNULL(thumb.id_attach, 0) AS thumb_id, thumb.filename as thumb_filename FROM ({db_prefix}topics AS t, {db_prefix}messages AS m) LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member AND a.attachment_type != 3) LEFT JOIN {db_prefix}attachments AS thumb ON (t.id_first_msg = thumb.id_msg AND thumb.attachment_type = 3 AND thumb.fileext IN ("jpg","gif","png") ) LEFT JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board) WHERE t.id_first_msg IN ({array_int:posts}) AND m.id_msg = t.id_first_msg GROUP BY t.id_first_msg ORDER BY date DESC, thumb.id_attach ASC', array('posts' => $mposts)); } $context['TPortal']['category'] = array('articles' => array(), 'col1' => array(), 'col2' => array(), 'options' => array('catlayout' => $context['TPortal']['frontpage_catlayout'], 'layout' => $context['TPortal']['frontpage_layout']), 'category_opts' => array('catlayout' => $context['TPortal']['frontpage_catlayout'], 'template' => $context['TPortal']['frontpage_template'])); unset($posts); $posts = array(); // insert the forumposts into $posts if (is_resource($request) && $smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $length = $context['TPortal']['frontpage_limit_len']; if (!empty($length) && $smcFunc['strlen']($row['body']) > $length) { $row['body'] = $smcFunc['substr']($row['body'], 0, $length); // The first space or line break. (<br />, etc.) $cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<')); if ($cutoff !== false) { $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); } $row['body'] .= '... <p><strong><a href="' . $scripturl . '?topic=' . $row['id'] . '">' . $txt['tp-readmore'] . '</a></strong></p>'; } // some needed addons $row['rendertype'] = 'bbc'; $row['frame'] = 'theme'; $row['boardnews'] = 1; if (!isset($context['TPortal']['frontpage_visopts'])) { $context['TPortal']['frontpage_visopts'] = 'date,title,author,views' . ($context['TPortal']['forumposts_avatar'] == 1 ? ',avatar' : ''); } $row['visual_options'] = explode(',', $context['TPortal']['frontpage_visopts']); $row['useintro'] = '0'; $row['avatar'] = $row['avatar'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt=" " />' : '' : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt=" " />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt=" " />'); if (!empty($row['thumb_id'])) { $row['illustration'] = $scripturl . '?action=tpmod;sa=tpattach;topic=' . $row['id'] . '.0;attach=' . $row['thumb_id'] . ';image'; } $posts[$row['date'] . '0' . sprintf("%06s", $row['id'])] = $row; } $smcFunc['db_free_result']($request); } // next up is articles if (count($aposts) > 0) { $request = $smcFunc['db_query']('', ' SELECT art.id, IF(art.useintro > 0, art.intro, art.body) AS body, art.date, art.category, art.subject, art.author_id as authorID, var.value1 as category_name, var.value8 as category_shortname, art.frame, art.comments, art.options, art.intro, art.useintro, art.sticky, art.featured, art.comments_var, art.views, art.rating, art.voters, art.shortname, art.fileimport, art.topic, art.illustration, art.type as rendertype, IFNULL(mem.real_name, art.author) as realName, mem.avatar, mem.posts, mem.date_registered as dateRegistered,mem.last_login as lastLogin, IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType FROM {db_prefix}tp_articles AS art LEFT JOIN {db_prefix}tp_variables AS var ON(var.id = art.category) LEFT JOIN {db_prefix}members AS mem ON (art.author_id = mem.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) WHERE art.id IN ({array_string:artid}) ORDER BY art.featured desc, art.sticky desc, art.' . $catsort . ' ' . $catsort_order, array('artid' => $aposts)); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { // expand the vislaoptions $row['visual_options'] = explode(',', $row['options']); $row['visual_options']['layout'] = $context['TPortal']['frontpage_layout']; $row['rating'] = array_sum(explode(',', $row['rating'])); $row['avatar'] = $row['avatar'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt=" " />' : '' : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt=" " />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt=" " />'); // we need some trick to put featured/sticky on top $sortdate = $row['date']; if ($row['sticky'] == 1) { $sortdate = $row['date'] + $year; } if ($row['featured'] == 1) { $sortdate = $row['date'] + $year + $year; } $posts[$sortdate . '0' . sprintf("%06s", $row['id'])] = $row; } $smcFunc['db_free_result']($request); } } $total = count($posts); $col1 = ceil($total / 2); $col2 = $total - $col1; $counter = 0; // divide it ksort($posts, SORT_NUMERIC); $all = array_reverse($posts); foreach ($all as $p => $row) { if ($counter == 0) { $context['TPortal']['category']['featured'] = $row; } elseif ($counter < $col1 && $counter > 0) { $context['TPortal']['category']['col1'][] = $row; } elseif ($counter > $col1 || $counter == $col1) { $context['TPortal']['category']['col2'][] = $row; } $counter++; } } // collect up frontblocks $blocks = array('front' => ''); $blocktype = array('no', 'userbox', 'newsbox', 'statsbox', 'searchbox', 'html', 'onlinebox', 'themebox', 'oldshoutbox', 'catmenu', 'phpbox', 'scriptbox', 'recentbox', 'ssi', 'module', 'rss', 'sitemap', 'oldadmin', 'articlebox', 'categorybox', 'tpmodulebox'); // set the membergroup access $mygroups = $user_info['groups']; $access = '(FIND_IN_SET(' . implode(', access) OR FIND_IN_SET(', $mygroups) . ', access))'; if (allowedTo('tp_blocks') && (!empty($context['TPortal']['admin_showblocks']) || !isset($context['TPortal']['admin_showblocks']))) { $access = '1'; } // get the blocks $request = $smcFunc['db_query']('', ' SELECT * FROM {db_prefix}tp_blocks WHERE off = 0 AND bar = 4 AND ' . $access . ' ORDER BY pos,id ASC'); $count = array('front' => 0); $fetch_articles = array(); $fetch_article_titles = array(); $panels = array(4 => 'front'); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { // some tests to minimize sql calls if ($row['type'] == 7) { $test_themebox = true; } elseif ($row['type'] == 18) { $test_articlebox = true; if (is_numeric($row['body'])) { $fetch_articles[] = $row['body']; } } elseif ($row['type'] == 9) { $test_menubox = true; } elseif ($row['type'] == 19) { $test_catbox = true; if (is_numeric($row['body'])) { $fetch_article_titles[] = $row['body']; } } elseif ($row['type'] == 20) { if (!empty($context['TPortal']['tpmodules']['blockrender'][$row['var1']]['sourcefile']) && file_exists($context['TPortal']['tpmodules']['blockrender'][$row['var1']]['sourcefile'])) { require_once $context['TPortal']['tpmodules']['blockrender'][$row['var1']]['sourcefile']; } } $can_edit = get_perm($row['editgroups'], ''); $can_manage = allowedTo('tp_blocks'); if ($can_manage) { $can_edit = false; } $blocks[$panels[$row['bar']]][$count[$panels[$row['bar']]]] = array('frame' => $row['frame'], 'title' => strip_tags($row['title'], '<center>'), 'type' => $blocktype[$row['type']], 'body' => $row['body'], 'visible' => $row['visible'], 'var1' => $row['var1'], 'var2' => $row['var2'], 'var3' => $row['var3'], 'var4' => $row['var4'], 'id' => $row['id'], 'lang' => $row['lang'], 'access2' => $row['access2'], 'can_edit' => $can_edit, 'can_manage' => $can_manage); $count[$panels[$row['bar']]]++; } $smcFunc['db_free_result']($request); } if (sizeof($fetch_articles) > 0) { $fetchart = '(art.id=' . implode(' OR art.id=', $fetch_articles) . ')'; } else { $fetchart = ''; } if (sizeof($fetch_article_titles) > 0) { $fetchtitles = '(art.category=' . implode(' OR art.category=', $fetch_article_titles) . ')'; } else { $fetchtitles = ''; } // if a block displays an article if (isset($test_articlebox) && $fetchart != '') { $context['TPortal']['blockarticles'] = array(); $request = $smcFunc['db_query']('', ' SELECT art.*, var.value1, var.value2, var.value3, var.value4, var.value5, var.value7, var.value8, art.type as rendertype, IFNULL(mem.real_name,art.author) as realName, mem.avatar, mem.posts, mem.date_registered as dateRegistered, mem.last_login as lastLogin, IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType, var.value9 FROM {db_prefix}tp_articles as art LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = art.author_id) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = art.author_id AND a.attachment_type !=3) LEFT JOIN {db_prefix}tp_variables as var ON (var.id= art.category) WHERE ' . $fetchart . ' AND art.off = 0 AND ((art.pub_start = 0 AND art.pub_end = 0) OR (art.pub_start != 0 AND art.pub_start < ' . $now . ' AND art.pub_end = 0) OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ') OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ' AND art.pub_start < ' . $now . ')) AND art.category > 0 AND art.approved = 1 AND art.category > 0 AND art.category < 9999'); if ($smcFunc['db_num_rows']($request) > 0) { while ($article = $smcFunc['db_fetch_assoc']($request)) { // allowed and all is well, go on with it. $context['TPortal']['blockarticles'][$article['id']] = $article; $context['TPortal']['blockarticles'][$article['id']]['avatar'] = $row['avatar'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt=" " />' : '' : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt=" " />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt=" " />'); // sort out the options $context['TPortal']['blockarticles'][$article['id']]['visual_options'] = array(); // since these are inside blocks, some stuff has to be left out $context['TPortal']['blockarticles'][$article['id']]['frame'] = 'none'; } $smcFunc['db_free_result']($request); } } // any cat listings from blocks? if (isset($test_catbox) && $fetchtitles != '') { $request = $smcFunc['db_query']('', ' SELECT art.id, art.subject, art.date, art.category, art.author_id as authorID, art.shortname, IFNULL(mem.real_name,art.author) as real_name FROM {db_prefix}tp_articles AS art LEFT JOIN {db_prefix}members AS mem ON (art.author_id = mem.id_member) WHERE ' . $fetchtitles . ' AND ((art.pub_start = 0 AND art.pub_end = 0) OR (art.pub_start != 0 AND art.pub_start < ' . $now . ' AND art.pub_end = 0) OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ') OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > ' . $now . ' AND art.pub_start < ' . $now . ')) AND art.off = 0 AND art.category > 0 AND art.approved = 1'); if (!isset($context['TPortal']['blockarticle_titles'])) { $context['TPortal']['blockarticle_titles'] = array(); } if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $context['TPortal']['blockarticle_titles'][$row['category']][$row['date'] . '_' . $row['id']] = array('id' => $row['id'], 'subject' => $row['subject'], 'shortname' => $row['shortname'] != '' ? $row['shortname'] : $row['id'], 'category' => $row['category'], 'poster' => '<a href="' . $scripturl . '?action=profile;u=' . $row['authorID'] . '">' . $row['real_name'] . '</a>'); } $smcFunc['db_free_result']($request); } } // get menubox items if (isset($test_menubox)) { $context['TPortal']['menu'] = array(); $request = $smcFunc['db_query']('', ' SELECT * FROM {db_prefix}tp_variables WHERE type = {string:type} ORDER BY value5 ASC', array('type' => 'menubox')); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $icon = ''; if ($row['value5'] != -1 && $row['value2'] != '-1') { $mtype = substr($row['value3'], 0, 4); $idtype = substr($row['value3'], 4); if ($mtype != 'cats' && $mtype != 'arti' && $mtype != 'head' && $mtype != 'spac') { $mtype = 'link'; $idtype = $row['value3']; } if ($mtype == 'cats') { if (isset($context['TPortal']['article_categories']['icon'][$idtype])) { $icon = $context['TPortal']['article_categories']['icon'][$idtype]; } } if ($mtype == 'head') { $mtype = 'head'; $idtype = $row['value1']; } $menupos = $row['value5']; $context['TPortal']['menu'][$row['subtype2']][] = array('id' => $row['id'], 'menuID' => $row['subtype2'], 'name' => $row['value1'], 'pos' => $menupos, 'type' => $mtype, 'IDtype' => $idtype, 'off' => '0', 'sub' => $row['value4'], 'icon' => $icon, 'newlink' => $row['value2'], 'sitemap' => in_array($row['id'], $context['TPortal']['sitemap']) ? true : false); } } $smcFunc['db_free_result']($request); } } // check the panels foreach ($panels as $p => $panel) { // any blocks at all? if ($count[$panel] < 1) { $context['TPortal'][$panel . 'panel'] = 0; } } $context['TPortal']['frontblocks'] = $blocks; if (WIRELESS) { $context['TPortal']['single_article'] = false; loadtemplate('TPwireless'); // decide what subtemplate $context['sub_template'] = WIRELESS_PROTOCOL . '_tp_frontpage'; } }
function my_messageindex() { global $context, $settings, $options, $scripturl, $modSettings, $txt; loadtemplate('Common'); echo ' <a id="top"></a>'; if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0)) { echo ' <div class="catbg"> <span class="floatright circleborder" style="margin-top: 0rem;">', my_toggle('m' . $context['current_board'], 'mess_boards' . $context['current_board']), '</span> <h3>', $txt['parent_boards'], '</h3> </div> <div id="mess_boards', $context['current_board'], '" class="', !empty($options['togglecatm' . $context['current_board']]) ? '' : 'no', 'togglecat">'; $next = 1; template_board($context['boards']); echo ' </div>'; } echo ' <div class="catbg"> <h3>', $context['page_title'], '</h3>'; if (!empty($options['show_board_desc']) && $context['description'] != '') { echo ' <div class="subtitle">', $context['description'], '</div>'; } echo ' </div>'; // Create the button set... $normal_buttons = array('new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true), 'post_poll' => array('test' => 'can_post_poll', 'text' => 'new_poll', 'image' => 'new_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'), 'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_board'] : $txt['notification_enable_board']) . '\');"', 'url' => $scripturl . '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';board=' . $context['current_board'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'markread' => array('text' => 'mark_read_short', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id'])); // They can only mark read if they are logged in and it's enabled! if (!$context['user']['is_logged'] || !$settings['show_mark_read']) { unset($normal_buttons['markread']); } // Allow adding new buttons easily. call_integration_hook('integrate_messageindex_buttons', array(&$normal_buttons)); if (!$context['no_topic_listing']) { echo ' <div class="pagesection themepadding"><div class="bwgrid"> <div class="pagelinks bwcell8"><br>', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' <a href="#bot"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div> <div class="bwcell8">', template_button_strip($normal_buttons, 'right'), '</div> </div></div>'; // If Quick Moderation is enabled start the form. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) { echo ' <form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" class="clear" name="quickModForm" id="quickModForm">'; } echo ' <div class="tborder topic_table" id="messageindex"> <table class="table_grid" cellspacing="0" style="width: 100%;"> <thead class="whide"> <tr class="catbg">'; // Are there actually any topics to show? if (!empty($context['topics'])) { echo '<th></th> <th scope="col" class="lefttext"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['started_by'], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th> <th scope="col" class="rhide" width="14%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>'; // Show a "select all" box for quick moderation? if (empty($context['can_quick_mod'])) { echo ' <th scope="col" class="lefttext last_th" width="22%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>'; } else { echo ' <th scope="col" class="lefttext rhide" width="22%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>'; } // Show a "select all" box for quick moderation? if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1) { echo ' <th scope="col" class="last_th" width="4%"><input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" /></th>'; } elseif (!empty($context['can_quick_mod'])) { echo ' <th class="last_th" width="4%"> </th>'; } } else { echo ' <th scope="col" class="first_th" width="8%"> </th> <th colspan="3"><strong>', $txt['msg_alert_none'], '</strong></th> <th scope="col" class="last_th" width="8%"> </th>'; } echo ' </tr> </thead> <tbody>'; if (!empty($settings['display_who_viewing'])) { echo ' <tr class="windowbg2"> <td colspan="', !empty($context['can_quick_mod']) ? '5' : '4', '">'; if ($settings['display_who_viewing'] == 1) { echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members']; } else { echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); } echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'], ' </td> </tr>'; } // If this person can approve items and we have some awaiting approval tell them. if (!empty($context['unapproved_posts_message'])) { echo ' <tr class="windowbg2"> <td colspan="', !empty($context['can_quick_mod']) ? '5' : '4', '"> <span class="alert">!</span> ', $context['unapproved_posts_message'], ' </td> </tr>'; } template_topiclist($context['topics'], $ch = !empty($context['can_quick_mod']) ? true : false); if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics'])) { echo ' <tr class="titlebg"> <td colspan="5" align="right"> <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> <option value="">--------</option>', $context['can_remove'] ? ' <option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', $context['can_lock'] ? ' <option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', $context['can_sticky'] ? ' <option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '', $context['can_move'] ? ' <option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', $context['can_merge'] ? ' <option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', $context['can_restore'] ? ' <option value="restore">' . $txt['quick_mod_restore'] . '</option>' : '', $context['can_approve'] ? ' <option value="approve">' . $txt['quick_mod_approve'] . '</option>' : '', $context['user']['is_logged'] ? ' <option value="markread">' . $txt['quick_mod_markread'] . '</option>' : '', ' </select>'; // Show a list of boards they can move the topic to. if ($context['can_move']) { echo ' <select class="qaction" id="moveItTo" name="move_to" disabled="disabled">'; foreach ($context['move_to_boards'] as $category) { echo ' <optgroup label="', $category['name'], '">'; foreach ($category['boards'] as $board) { echo ' <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], '</option>'; } echo ' </optgroup>'; } echo ' </select>'; } echo ' <input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' && confirm(\'', $txt['quickmod_confirm'], '\');" class="button_submit qaction" /> </td> </tr>'; } echo ' </tbody> </table> </div> <a id="bot"></a>'; // Finish off the form - again. if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) { echo ' <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" /> </form>'; } echo ' <div class="pagesection themepadding"><div class="bwgrid"> <div class="pagelinks bwcell8">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' <a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div> <div class="bwcell8">', template_button_strip($normal_buttons, 'right'), '</div> </div></div>'; } echo ' <div class="themepadding windowbg2" id="topic_icons"> <div class="description"> <p class="floatright" id="message_index_jump_to"> </p> <script type="text/javascript"><!-- // --><![CDATA[ if (typeof(window.XMLHttpRequest) != "undefined") aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "message_index_jump_to", sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%", iCurBoardId: ', $context['current_board'], ', iCurBoardChildLevel: ', $context['jump_to']['child_level'], ', sCurBoardName: "', $context['jump_to']['board_name'], '", sBoardChildLevelIndicator: "==", sBoardPrefix: "=> ", sCatSeparator: "-----------------------------", sCatPrefix: "", sGoButtonLabel: "', $txt['quick_mod_go'], '" }); // ]]></script> <br class="clear" /> </div> </div>'; // Javascript for inline editing. echo ' <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script> <script type="text/javascript"><!-- // --><![CDATA[ // Hide certain bits during topic edit. hide_prefixes.push("lockicon", "stickyicon", "pages", "newicon"); // Use it to detect when we\'ve stopped editing. document.onclick = modify_topic_click; var mouse_on_div; function modify_topic_click() { if (in_edit_mode == 1 && mouse_on_div == 0) modify_topic_save("', $context['session_id'], '", "', $context['session_var'], '"); } function modify_topic_keypress(oEvent) { if (typeof(oEvent.keyCode) != "undefined" && oEvent.keyCode == 13) { modify_topic_save("', $context['session_id'], '", "', $context['session_var'], '"); if (typeof(oEvent.preventDefault) == "undefined") oEvent.returnValue = false; else oEvent.preventDefault(); } } // For templating, shown when an inline edit is made. function modify_topic_show_edit(subject) { // Just template the subject. setInnerHTML(cur_subject_div, \'<input type="text" name="subject" value="\' + subject + \'" size="60" style="width: 95%;" maxlength="80" onkeypress="modify_topic_keypress(event)" class="input_text" /><input type="hidden" name="topic" value="\' + cur_topic_id + \'" /><input type="hidden" name="msg" value="\' + cur_msg_id.substr(4) + \'" />\'); } // And the reverse for hiding it. function modify_topic_hide_edit(subject) { // Re-template the subject! setInnerHTML(cur_subject_div, \'<a href="', $scripturl, '?topic=\' + cur_topic_id + \'.0">\' + subject + \'<\' +\'/a>\'); } // ]]></script>'; }
function Stream() { global $context, $smcFunc; loadtemplate('Stream'); }
function tpshout_profile($memID) { global $context, $scripturl, $txt, $smcFunc; $context['page_title'] = $txt['shoutboxprofile']; if (isset($context['TPortal']['mystart'])) { $start = $context['TPortal']['mystart']; } else { $start = 0; } $context['TPortal']['memID'] = $memID; $sorting = 'value2'; $max = 0; // get all shouts $request = $smcFunc['db_query']('', ' SELECT COUNT(*) FROM {db_prefix}tp_shoutbox WHERE value5 = {int:val5} AND type = {string:type}', array('val5' => $memID, 'type' => 'shoutbox')); $result = $smcFunc['db_fetch_row']($request); $max = $result[0]; $smcFunc['db_free_result']($request); $context['TPortal']['all_shouts'] = $max; $context['TPortal']['profile_shouts'] = array(); $request = $smcFunc['db_query']('', ' SELECT * FROM {db_prefix}tp_shoutbox WHERE value5 = {int:val5} AND type = {string:type} ORDER BY {raw:sort} DESC LIMIT {int:start}, 10', array('val5' => $memID, 'type' => 'shoutbox', 'sort' => $sorting, 'start' => $start)); if ($smcFunc['db_num_rows']($request) > 0) { while ($row = $smcFunc['db_fetch_assoc']($request)) { $context['TPortal']['profile_shouts'][] = array('id' => $row['id'], 'shout' => parse_bbc(censorText($row['value1'])), 'created' => timeformat($row['value2']), 'ip' => $row['value4'], 'editlink' => allowedTo('tp_shoutbox') ? $scripturl . '?action=tpmod;shout=admin;u=' . $memID : ''); } $smcFunc['db_free_result']($request); } // construct pageindexes if ($max > 0) { $context['TPortal']['pageindex'] = TPageIndex($scripturl . '?action=profile;area=tpshoutbox;u=' . $memID . ';tpsort=' . $sorting, $start, $max, '10', true); } else { $context['TPortal']['pageindex'] = ''; } loadtemplate('TPShout'); if (loadLanguage('TPShout') == false) { loadLanguage('TPShout', 'english'); } $context['sub_template'] = 'tpshout_profile'; }