public function Facebooka() { global $fb_object, $fb_hook_object, $modSettings, $sourcedir, $context; require_once $sourcedir . '/ManageServer.php'; loadTemplate('FacebookAdmin'); allowedTo('admin_forum'); $fb_object = new SAFacebookadmin(); $context['html_headers'] .= ' <script type="text/javascript"> function fbLogin() { FB.login(function(response) { if (response.authResponse) { alert(\'' . $fb_object->txt['fb_grantperm1'] . '\'); window.location = \'https://www.facebook.com/dialog/oauth?client_id=' . $modSettings['fb_app_id'] . '&redirect_uri=' . urlencode($fb_hook_object->scripturl . '') . '&scope=email,publish_actions\'; } else { alert(\'' . $fb_object->txt['fb_grantperm'] . '\'); } }, {scope: \'email,publish_actions\'}); } </script>'; $context['page_title'] = $fb_hook_object->txt['fb_main1']; $context[$context['admin_menu_name']]['tab_data']['title'] = $fb_hook_object->txt['fb_main1']; $context[$context['admin_menu_name']]['tab_data']['description'] = $fb_hook_object->txt['fb_main1']; $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($fb_object->subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'facebook'; call_user_func(array('SAFacebookadmin', $fb_object->subActions[$_REQUEST['sa']])); }
function CopyTopic() { global $txt, $board, $topic, $scripturl, $sourcedir, $modSettings, $context; global $db_prefix, $ID_MEMBER, $boards, $language, $user_info, $func; if (empty($topic)) { fatal_lang_error(1); } // Permission check! isAllowedTo('copy'); loadTemplate('CopyTopic'); // Get a list of boards this moderator can move to. $request = db_query("\n\t\tSELECT b.ID_BOARD, b.name, b.childLevel, c.name AS catName\n\t\tFROM {$db_prefix}boards AS b\n\t\t\tLEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)\n\t\tWHERE {$user_info['query_see_board']}", __FILE__, __LINE__); $context['boards'] = array(); while ($row = mysql_fetch_assoc($request)) { $context['boards'][] = array('id' => $row['ID_BOARD'], 'name' => $row['name'], 'category' => $row['catName'], 'child_level' => $row['childLevel'], 'selected' => !empty($_SESSION['copy_to_topic']) && $_SESSION['copy_to_topic'] == $row['ID_BOARD']); } mysql_free_result($request); if (empty($context['boards'])) { fatal_lang_error('copytopic_noboards', false); } $context['page_title'] = $txt['copytopic']; $context['back_to_topic'] = isset($_REQUEST['goback']); // Register this form and get a sequence number in $context. checkSubmitOnce('register'); }
public function showVerification($isNew, $force_refresh = true) { loadTemplate('reCaptcha'); loadTemplate('VerificationControls'); loadJavascriptFile('https://www.google.com/recaptcha/api.js'); return true; }
/** * gmm_main() * * Traffic cop, checks permissions * calls the template which in turn calls this to request the xml file or js file to template inclusion * * @return */ function gmm_main() { global $context, $txt, $smcFunc; // Are we allowed to view the map? isAllowedTo('googleMap_view'); loadLanguage('GoogleMap'); // Build the XML data? if (isset($_REQUEST['sa']) && $_REQUEST['sa'] === '.xml') { return gmm_build_XML(); } // create the pins (urls) for use gmm_buildpins(); // Build the JS data? if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == '.js') { return gmm_build_JS(); } // load up our template and style sheet loadTemplate('GoogleMap', 'GoogleMap'); // Lets find number of members that have placed their map pin for the template $request = $smcFunc['db_query']('', ' SELECT COUNT(*) as TOTAL FROM {db_prefix}members WHERE latitude <> false AND longitude <> false', array()); $totalSet = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); // show the map $context['total_pins'] = $totalSet[0]; $context['sub_template'] = 'map'; $context['page_title'] = $txt['googleMap']; }
public static function load_theme() { global $context, $modSettings, $txt, $settings, $user_info; if (($themes = cache_get_data('TS_themes_list', 3600)) === null) { loadLanguage('ManageThemes'); require_once SUBSDIR . '/Themes.subs.php'; $themes = availableThemes($user_info['theme'], $user_info['id']); cache_put_data('TS_themes_list', $themes, 3600); } foreach ($themes[0] as $theme_id => $theme) { $name = $theme['name']; $selected = !empty($user_info['theme']) && $user_info['theme'] == $theme_id; $context['ThemeSelector'][$theme_id] = array('name' => $name, 'selected' => $selected, 'variants' => array()); if (isset($theme['variants'])) { foreach ($theme['variants'] as $key => $variant) { $context['ThemeSelector'][$theme_id]['variants'][$key] = array('name' => $variant['label'], 'selected' => $context['theme_variant'] == '_' . $key); } } } if (!isset($context['theme_header_callbacks'])) { $context['theme_header_callbacks'] = array(); } $context['theme_header_callbacks'][] = 'themeselector'; loadTemplate('ThemeSelector'); loadJavascriptFile('ThemeSelector.js'); loadCSSFile('ThemeSelector.css'); }
function Blog() { global $boarddir, $context, $mbname, $smcFunc, $modSettings, $scripturl, $settings, $txt; // Some version stuff $context['blog_version'] = array('version' => '2.0', 'build' => '1', 'revision' => '$Revision: 1 $', 'date' => '$Date: 2010-01-30 18:54:44 +0 $'); // Is the blog disabled? if (empty($modSettings['blog_enable'])) { // Sorry bud, nothing we can do about this... fatal_lang_error('blog_error_disabled'); } // Link tree.... $context['linktree'][] = array('url' => $scripturl . '?action=blog', 'name' => $txt['blog']); // We need some SSI functions. require_once $boarddir . '/SSI.php'; // Load our template. loadTemplate('Blog'); // Use the blog layer $context['template_layers'][] = 'blog'; // Add our stylesheet. $context['html_headers'] .= ' <link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/blog.css" />'; // A default page title. $context['page_title'] = $context['forum_name'] . ' ' . $txt['blog']; // Some actions we can do. $actions = array('index' => 'BlogIndex', 'view_blog' => 'BlogView', 'view_post' => 'BlogViewPost'); // Get the current action. $action = isset($_GET['sa']) ? $_GET['sa'] : 'index'; // Check if the action exist, otherwise go to the index. if (isset($actions[$action])) { $actions[$action](); } else { BlogIndex(); } }
function PrintTopic() { global $db_prefix, $topic, $txt, $scripturl, $context; global $board_info; if (empty($topic)) { fatal_lang_error(472, false); } // Get the topic starter information. $request = db_query("\n\t\tSELECT m.posterTime, IFNULL(mem.realName, m.posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE m.ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG\n\t\tLIMIT 1", __FILE__, __LINE__); if (mysql_num_rows($request) == 0) { fatal_lang_error('smf232'); } $row = mysql_fetch_assoc($request); mysql_free_result($request); // Lets "output" all that info. loadTemplate('Printpage'); $context['template_layers'] = array('print'); $context['board_name'] = $board_info['name']; $context['category_name'] = $board_info['cat']['name']; $context['poster_name'] = $row['posterName']; $context['post_time'] = timeformat($row['posterTime'], false); // Split the topics up so we can print them. $request = db_query("\n\t\tSELECT subject, posterTime, body, IFNULL(mem.realName, posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG", __FILE__, __LINE__); $context['posts'] = array(); while ($row = mysql_fetch_assoc($request)) { // Censor the subject and message. censorText($row['subject']); censorText($row['body']); $context['posts'][] = array('subject' => $row['subject'], 'member' => $row['posterName'], 'time' => timeformat($row['posterTime'], false), 'timestamp' => forum_time(true, $row['posterTime']), 'body' => parse_bbc($row['body'], 'print')); if (!isset($context['topic_subject'])) { $context['topic_subject'] = $row['subject']; } } mysql_free_result($request); }
function indexAction($smarty) { $smarty->assign('pageTitle', 'Головна сторінка сайту'); //loadTemplate($smarty,'index'); loadTemplate($smarty, 'header'); //loadTemplate($smarty,'footer'); }
function Memberlist() { global $scripturl, $txt, $modSettings, $context, $settings; // Make sure they can view the memberlist. isAllowedTo('view_mlist'); loadTemplate('Memberlist'); $context['listing_by'] = !empty($_GET['sa']) ? $_GET['sa'] : 'all'; // $subActions array format: // 'subaction' => array('label', 'function', 'is_selected') $subActions = array('all' => array(&$txt[303], 'MLAll', $context['listing_by'] == 'all'), 'search' => array(&$txt['mlist_search'], 'MLSearch', $context['listing_by'] == 'search')); // Set up the sort links. $context['sort_links'] = array(); foreach ($subActions as $act => $text) { $context['sort_links'][] = array('label' => $text[0], 'action' => $act, 'selected' => $text[2]); } $context['num_members'] = $modSettings['totalMembers']; // Set up the columns... $context['columns'] = array('isOnline' => array('label' => $txt['online8'], 'width' => '20'), 'realName' => array('label' => $txt[35]), 'emailAddress' => array('label' => $txt[307], 'width' => '25'), 'websiteUrl' => array('label' => $txt[96], 'width' => '25'), 'ICQ' => array('label' => $txt[513], 'width' => '25'), 'AIM' => array('label' => $txt[603], 'width' => '25'), 'YIM' => array('label' => $txt[604], 'width' => '25'), 'MSN' => array('label' => $txt['MSN'], 'width' => '25'), 'ID_GROUP' => array('label' => $txt[87]), 'registered' => array('label' => $txt[233]), 'posts' => array('label' => $txt[21], 'width' => '115', 'colspan' => '2')); $context['linktree'][] = array('url' => $scripturl . '?action=mlist', 'name' => &$txt[332]); $context['can_send_pm'] = allowedTo('pm_send'); // Jump to the sub action. if (isset($subActions[$context['listing_by']])) { $subActions[$context['listing_by']][1](); } else { $subActions['all'][1](); } }
function akismet_load_theme() { global $context, $topic; // Is this a topic being displayed? if (empty($_REQUEST['action']) && !empty($board) && !empty($topic)) { // Looking through the topic table can be slow, so try using the cache first. if (($spam = cache_get_data('akismet-spam-topic-' . $topic, 3600)) === NULL) { $request = $smcFunc['db_query']('', ' SELECT id_topic FROM {db_prefix}topics WHERE id_topic = {int:id_topic}', array('id_topic' => $topic)); // So did it find anything? if ($smcFunc['db_num_rows']($request)) { list($spam) = $smcFunc['db_fetch_row']($request); $smcFunc['db_free_result']($request); // Save save save. cache_put_data('akismet-spam-topic-' . $topic, $spam, 120); } } if (!empty($span)) { // So we now know this is a spam topic. Show a warning. loadLanguage('Akismet'); loadTemplate('Akismet'); $context['template_layers'][] = 'akismet_warn_topic'; } } }
function sportal_pages() { global $smcFunc, $context, $txt, $scripturl, $sourcedir, $user_info; loadTemplate('PortalPages'); $page_id = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 0; if (is_numeric($page_id)) { $page_id = (int) $page_id; } else { $page_id = $smcFunc['htmlspecialchars']($page_id, ENT_QUOTES); } $context['SPortal']['page'] = sportal_get_pages($page_id, true, true); if (empty($context['SPortal']['page']['id'])) { fatal_lang_error('error_sp_page_not_found', false); } $context['SPortal']['page']['style'] = sportal_parse_style('explode', $context['SPortal']['page']['style'], true); if (empty($_SESSION['last_viewed_page']) || $_SESSION['last_viewed_page'] != $context['SPortal']['page']['id']) { $smcFunc['db_query']('', ' UPDATE {db_prefix}sp_pages SET views = views + 1 WHERE id_page = {int:current_page}', array('current_page' => $context['SPortal']['page']['id'])); $_SESSION['last_viewed_page'] = $context['SPortal']['page']['id']; } $context['linktree'][] = array('url' => $scripturl . '?page=' . $page_id, 'name' => $context['SPortal']['page']['title']); $context['page_title'] = $context['SPortal']['page']['title']; $context['sub_template'] = 'view_page'; }
function ManageSmileys() { global $context, $txt, $scripturl, $modSettings; isAllowedTo('manage_smileys'); adminIndex('manage_smileys'); loadLanguage('ManageSmileys'); loadTemplate('ManageSmileys'); $subActions = array('addsmiley' => 'AddSmiley', 'editicon' => 'EditMessageIcons', 'editicons' => 'EditMessageIcons', 'editsets' => 'EditSmileySets', 'editsmileys' => 'EditSmileys', 'import' => 'EditSmileySets', 'modifyset' => 'EditSmileySets', 'modifysmiley' => 'EditSmileys', 'setorder' => 'EditSmileyOrder', 'settings' => 'EditSmileySettings', 'install' => 'InstallSmileySet'); // Default the sub-action to 'edit smiley settings'. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'settings'; $context['page_title'] =& $txt['smileys_manage']; $context['sub_action'] = $_REQUEST['sa']; $context['sub_template'] =& $context['sub_action']; // Load up all the tabs... $context['admin_tabs'] = array('title' => &$txt['smileys_manage'], 'help' => 'smileys', 'description' => $txt['smiley_settings_explain'], 'tabs' => array('editsets' => array('title' => $txt['smiley_sets'], 'description' => $txt['smiley_editsets_explain'], 'href' => $scripturl . '?action=smileys;sa=editsets'), 'addsmiley' => array('title' => $txt['smileys_add'], 'description' => $txt['smiley_addsmiley_explain'], 'href' => $scripturl . '?action=smileys;sa=addsmiley'), 'editsmileys' => array('title' => $txt['smileys_edit'], 'description' => $txt['smiley_editsmileys_explain'], 'href' => $scripturl . '?action=smileys;sa=editsmileys'), 'setorder' => array('title' => $txt['smileys_set_order'], 'description' => $txt['smiley_setorder_explain'], 'href' => $scripturl . '?action=smileys;sa=setorder'), 'editicons' => array('title' => $txt['icons_edit_message_icons'], 'description' => $txt['icons_edit_icons_explain'], 'href' => $scripturl . '?action=smileys;sa=editicons'), 'settings' => array('title' => $txt['settings'], 'description' => $txt['smiley_settings_explain'], 'href' => $scripturl . '?action=smileys;sa=settings', 'is_last' => true))); // Select the right tab based on the sub action. if (isset($context['admin_tabs']['tabs'][$context['sub_action']])) { $context['admin_tabs']['tabs'][$context['sub_action']]['is_selected'] = true; } // Some settings may not be enabled, disallow these from the tabs as appropriate. if (empty($modSettings['messageIcons_enable'])) { unset($context['admin_tabs']['tabs']['editicons']); } if (empty($modSettings['smiley_enable'])) { unset($context['admin_tabs']['tabs']['addsmiley']); unset($context['admin_tabs']['tabs']['editsmileys']); unset($context['admin_tabs']['tabs']['setorder']); } // Call the right function for this sub-acton. $subActions[$_REQUEST['sa']](); }
function ENotifyMain() { global $modSettings; // Guests can't have unread things, we don't know anything about them. is_not_guest(); // Update our unread replies log if (!empty($modSettings['enotify_replies'])) { ENotifyUpdateUnreadReplies(); } // Update our personal messages log if (!empty($modSettings['enotify_pms'])) { ENotifyUpdatePms(); } // Load up the notifications at last :) ENotifyLoad(); // Run our garbage collection randomly (setting 0.05% chance for it to run) $random = rand(1, 5000); if ($random == '1987') { ENotifyGarbageCollect(); } // Load the language and the template file. loadLanguage('ENotify'); loadTemplate('ENotify'); template_enotify_main(); // We use this to deactivate the SMF Wrapping Templates die; }
function ManageNews() { global $context, $txt, $scripturl; // First, let's do a quick permissions check for the best error message possible. isAllowedTo(array('edit_news', 'send_mail', 'admin_forum')); // Administrative side bar, here we come! adminIndex('news'); loadTemplate('ManageNews'); // Format: 'sub-action' => array('function', 'permission') $subActions = array('editnews' => array('EditNews', 'edit_news'), 'mailingmembers' => array('SelectMailingMembers', 'send_mail'), 'mailingcompose' => array('ComposeMailing', 'send_mail'), 'mailingsend' => array('SendMailing', 'send_mail'), 'settings' => array('ModifyNewsSettings', 'admin_forum')); // Default to sub action 'main' or 'settings' depending on permissions. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('edit_news') ? 'editnews' : (allowedTo('send_mail') ? 'mailingmembers' : 'settings')); // Have you got the proper permissions? isAllowedTo($subActions[$_REQUEST['sa']][1]); // Create the tabs for the template. $context['admin_tabs'] = array('title' => $txt['news_title'], 'help' => 'edit_news', 'description' => $txt[670], 'tabs' => array()); if (allowedTo('edit_news')) { $context['admin_tabs']['tabs'][] = array('title' => $txt[7], 'description' => $txt[670], 'href' => $scripturl . '?action=news', 'is_selected' => $_REQUEST['sa'] == 'editnews'); } if (allowedTo('send_mail')) { $context['admin_tabs']['tabs'][] = array('title' => $txt[6], 'description' => $txt['news_mailing_desc'], 'href' => $scripturl . '?action=news;sa=mailingmembers', 'is_selected' => substr($_REQUEST['sa'], 0, 7) == 'mailing'); } if (allowedTo('admin_forum')) { $context['admin_tabs']['tabs'][] = array('title' => $txt['settings'], 'description' => $txt['news_settings_desc'], 'href' => $scripturl . '?action=news;sa=settings', 'is_selected' => $_REQUEST['sa'] == 'settings'); } $context['admin_tabs']['tabs'][count($context['admin_tabs']['tabs']) - 1]['is_last'] = true; $subActions[$_REQUEST['sa']][0](); }
function PackageGet() { global $txt, $scripturl, $context, $boarddir, $sourcedir, $modSettings; isAllowedTo('admin_forum'); require_once $sourcedir . '/Subs-Package.php'; // Use the Packages template... no reason to separate. loadLanguage('Packages'); loadTemplate('Packages', 'admin'); $context['page_title'] = $txt['package']; // Here is a list of all the potentially valid actions. $subActions = array('servers' => 'PackageServers', 'add' => 'PackageServerAdd', 'browse' => 'PackageGBrowse', 'download' => 'PackageDownload', 'remove' => 'PackageServerRemove', 'upload' => 'PackageUpload'); // Now let's decide where we are taking this... if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { $context['sub_action'] = $_REQUEST['sa']; } elseif (isset($_GET['pgdownload'])) { $context['sub_action'] = 'download'; } else { $context['sub_action'] = 'servers'; } // We need to force the "Download" tab as selected. $context['menu_data_' . $context['admin_menu_id']]['current_subsection'] = 'packageget'; // Now create the tabs for the template. $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['package_manager'], 'description' => $txt['package_manager_desc'], 'tabs' => array('browse' => array(), 'packageget' => array('description' => $txt['download_packages_desc']), 'installed' => array('description' => $txt['installed_packages_desc']), 'perms' => array('description' => $txt['package_file_perms_desc']), 'options' => array('description' => $txt['package_install_options_ftp_why']))); $subActions[$context['sub_action']](); }
function PackageGet() { global $txt, $scripturl, $context, $boarddir, $sourcedir, $modSettings; isAllowedTo('admin_forum'); require_once $sourcedir . '/Subs-Package.php'; // Still managing packages... adminIndex('manage_packages'); // Use the Packages template... no reason to separate. loadLanguage('Packages'); loadTemplate('Packages'); // Add the appropriate items to the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=packages', 'name' => &$txt['package1']); $context['linktree'][] = array('url' => $scripturl . '?action=packageget', 'name' => &$txt['smf182']); $context['page_title'] = $txt['package1']; // Here is a list of all the potentially valid actions. $subActions = array('servers' => 'PackageServers', 'add' => 'PackageServerAdd', 'browse' => 'PackageGBrowse', 'download' => 'PackageDownload', 'remove' => 'PackageServerRemove', 'upload' => 'PackageUpload'); // Now let's decide where we are taking this... if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { $context['sub_action'] = $_REQUEST['sa']; } elseif ($_REQUEST['action'] == 'pgdownload') { $context['sub_action'] = 'download'; } else { $context['sub_action'] = 'servers'; } // Now create the tabs for the template. $context['admin_tabs'] = array('title' => &$txt['package1'], 'description' => $txt['package_manager_desc'], 'tabs' => array('browse' => array('title' => $txt['package3'], 'href' => $scripturl . '?action=packages;sa=browse'), 'packageget' => array('title' => $txt['download_packages'], 'description' => $txt['download_packages_desc'], 'href' => $scripturl . '?action=packageget', 'is_selected' => true), 'installed' => array('title' => $txt['installed_packages'], 'description' => $txt['installed_packages_desc'], 'href' => $scripturl . '?action=packages;sa=installed'), 'options' => array('title' => $txt['package_settings'], 'description' => $txt['package_install_options_ftp_why'], 'href' => $scripturl . '?action=packages;sa=options', 'is_last' => true))); $subActions[$context['sub_action']](); }
function Packages() { global $txt, $scripturl, $sourcedir, $context; isAllowedTo('admin_forum'); // Managing packages! adminIndex('manage_packages'); // Load all the basic stuff. require_once $sourcedir . '/Subs-Package.php'; loadLanguage('Packages'); loadTemplate('Packages'); // Set up the linktree and title so it's already done. $context['linktree'][] = array('url' => $scripturl . '?action=packages', 'name' => &$txt['package1']); $context['page_title'] = $txt['package1']; // Delegation makes the world... that is, the package manager go 'round. $subActions = array('browse' => 'PackageBrowse', 'remove' => 'PackageRemove', 'list' => 'PackageList', 'install' => 'PackageInstallTest', 'install2' => 'PackageInstall', 'uninstall' => 'PackageInstallTest', 'uninstall2' => 'PackageInstall', 'installed' => 'InstalledList', 'options' => 'PackageOptions', 'flush' => 'FlushInstall', 'examine' => 'ExamineFile'); // Work out exactly who it is we are calling. if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { $context['sub_action'] = $_REQUEST['sa']; } else { $context['sub_action'] = 'browse'; } // Set up some tabs... $context['admin_tabs'] = array('title' => &$txt['package1'], 'description' => $txt['package_manager_desc'], 'tabs' => array('browse' => array('title' => $txt['package3'], 'href' => $scripturl . '?action=packages;sa=browse'), 'packageget' => array('title' => $txt['download_packages'], 'description' => $txt['download_packages_desc'], 'href' => $scripturl . '?action=packageget'), 'installed' => array('title' => $txt['installed_packages'], 'description' => $txt['installed_packages_desc'], 'href' => $scripturl . '?action=packages;sa=installed'), 'options' => array('title' => $txt['package_settings'], 'description' => $txt['package_install_options_ftp_why'], 'href' => $scripturl . '?action=packages;sa=options', 'is_last' => true))); // Attempt to automatically select the right tab. if (isset($context['admin_tabs']['tabs'][$context['sub_action']])) { $context['admin_tabs']['tabs'][$context['sub_action']]['is_selected'] = true; } else { $context['admin_tabs']['tabs']['browse']['is_selected'] = true; } // Call the function we're handing control to. $subActions[$context['sub_action']](); }
/** * Display the mail queue... * * @uses ManageMail template */ public function action_browse() { global $scripturl, $context, $txt; require_once SUBSDIR . '/Mail.subs.php'; loadTemplate('ManageMail'); // First, are we deleting something from the queue? if (isset($_REQUEST['delete'])) { checkSession('post'); deleteMailQueueItems($_REQUEST['delete']); } // Fetch the number of items in the current queue $status = list_MailQueueStatus(); $context['oldest_mail'] = empty($status['mailOldest']) ? $txt['mailqueue_oldest_not_available'] : time_since(time() - $status['mailOldest']); $context['mail_queue_size'] = comma_format($status['mailQueueSize']); // Build our display list $listOptions = array('id' => 'mail_queue', 'title' => $txt['mailqueue_browse'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=mailqueue', 'default_sort_col' => 'age', 'no_items_label' => $txt['mailqueue_no_items'], 'get_items' => array('function' => 'list_getMailQueue'), 'get_count' => array('function' => 'list_getMailQueueSize'), 'columns' => array('subject' => array('header' => array('value' => $txt['mailqueue_subject']), 'data' => array('function' => create_function('$rowData', ' return Util::shorten_text(Util::htmlspecialchars($rowData[\'subject\'], 50)); ')), 'sort' => array('default' => 'subject', 'reverse' => 'subject DESC')), 'recipient' => array('header' => array('value' => $txt['mailqueue_recipient']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('recipient' => true))), 'sort' => array('default' => 'recipient', 'reverse' => 'recipient DESC')), 'priority' => array('header' => array('value' => $txt['mailqueue_priority'], 'class' => 'centertext'), 'data' => array('function' => create_function('$rowData', ' global $txt; // We probably have a text label with your priority. $txtKey = sprintf(\'mq_mpriority_%1$s\', $rowData[\'priority\']); // But if not, revert to priority 0. return isset($txt[$txtKey]) ? $txt[$txtKey] : $txt[\'mq_mpriority_1\']; '), 'class' => 'centertext'), 'sort' => array('default' => 'priority', 'reverse' => 'priority DESC')), 'age' => array('header' => array('value' => $txt['mailqueue_age']), 'data' => array('function' => create_function('$rowData', ' return time_since(time() - $rowData[\'time_sent\']); ')), 'sort' => array('default' => 'time_sent', 'reverse' => 'time_sent DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$rowData', ' return \'<input type="checkbox" name="delete[]" value="\' . $rowData[\'id_mail\'] . \'" class="input_check" />\'; ')))), 'form' => array('href' => $scripturl . '?action=admin;area=mailqueue', 'include_start' => true, 'include_sort' => true), 'additional_rows' => array(array('position' => 'bottom_of_list', 'class' => 'submitbutton', 'value' => ' <input type="submit" name="delete_redirects" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" class="right_submit" /> <a class="linkbutton" href="' . $scripturl . '?action=admin;area=mailqueue;sa=clear;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mailqueue_clear_list_warning'] . '\');">' . $txt['mailqueue_clear_list'] . '</a> '))); require_once SUBSDIR . '/GenericList.class.php'; createList($listOptions); }
function RegCenter() { global $modSettings, $context, $txt, $db_prefix, $scripturl; // Old templates might still request this. if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'browse') { redirectexit('action=viewmembers;sa=browse' . (isset($_REQUEST['type']) ? ';type=' . $_REQUEST['type'] : '')); } $subActions = array('register' => array('AdminRegister', 'moderate_forum'), 'agreement' => array('EditAgreement', 'admin_forum'), 'reservednames' => array('SetReserve', 'admin_forum'), 'settings' => array('AdminSettings', 'admin_forum')); // Work out which to call... $context['sub_action'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('moderate_forum') ? 'register' : 'settings'); // Must have sufficient permissions. isAllowedTo($subActions[$context['sub_action']][1]); // Set the admin area... adminIndex('registration_center'); // Loading, always loading. loadLanguage('Login'); loadTemplate('Register'); // Next create the tabs for the template. $context['admin_tabs'] = array('title' => &$txt['registration_center'], 'help' => 'registrations', 'description' => $txt['admin_settings_desc'], 'tabs' => array('register' => array('title' => $txt['admin_browse_register_new'], 'description' => $txt['admin_register_desc'], 'href' => $scripturl . '?action=regcenter;sa=register', 'is_selected' => $context['sub_action'] == 'register', 'is_last' => !allowedTo('admin_forum')))); if (allowedTo('admin_forum')) { $context['admin_tabs']['tabs']['agreement'] = array('title' => $txt['smf11'], 'description' => $txt['smf12'], 'href' => $scripturl . '?action=regcenter;sa=agreement', 'is_selected' => $context['sub_action'] == 'agreement'); $context['admin_tabs']['tabs']['reservednames'] = array('title' => $txt[341], 'description' => $txt[699], 'href' => $scripturl . '?action=regcenter;sa=reservednames', 'is_selected' => $context['sub_action'] == 'reservednames'); $context['admin_tabs']['tabs']['settings'] = array('title' => $txt['settings'], 'description' => $txt['admin_settings_desc'], 'href' => $scripturl . '?action=regcenter;sa=settings', 'is_last' => true, 'is_selected' => $context['sub_action'] == 'settings'); } // Finally, get around to calling the function... $subActions[$context['sub_action']][0](); }
/** * This function shows the board index. * It uses the BoardIndex template, and main sub template. * It may use the boardindex subtemplate for wireless support. * It updates the most online statistics. * It is accessed by ?action=boardindex. */ function BoardIndex() { global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl; // For wireless, we use the Wireless template... if (WIRELESS) { $context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex'; } else { loadTemplate('BoardIndex'); } // Set a canonical URL for this page. $context['canonical_url'] = $scripturl; // Do not let search engines index anything if there is a random thing in $_GET. if (!empty($_GET)) { $context['robot_no_index'] = true; } // Retrieve the categories and boards. require_once $sourcedir . '/Subs-BoardIndex.php'; $boardIndexOptions = array('include_categories' => true, 'base_level' => 0, 'parent_id' => 0, 'set_latest_post' => true, 'countChildPosts' => !empty($modSettings['countChildPosts'])); $context['categories'] = getBoardIndex($boardIndexOptions); // Get the user online list. require_once $sourcedir . '/Subs-MembersOnline.php'; $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true); $context += getMembersOnlineStats($membersOnlineOptions); $context['show_buddies'] = !empty($user_info['buddies']); // Are we showing all membergroups on the board index? if (!empty($settings['show_group_key'])) { $context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array()); } // Track most online statistics? (Subs-MembersOnline.php) if (!empty($modSettings['trackStats'])) { trackStatsUsersOnline($context['num_guests'] + $context['num_spiders'] + $context['num_users_online']); } // Retrieve the latest posts if the theme settings require it. if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) { $latestPostOptions = array('number_posts' => $settings['number_recent_posts']); $context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions)); } $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0; $settings['show_member_bar'] &= allowedTo('view_mlist'); $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); $context['show_member_list'] = allowedTo('view_mlist'); $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']); // Load the calendar? if (!empty($modSettings['cal_enabled']) && allowedTo('calendar_view')) { // Retrieve the calendar data (events, birthdays, holidays). $eventOptions = array('include_holidays' => $modSettings['cal_showholidays'] > 1, 'include_birthdays' => $modSettings['cal_showbdays'] > 1, 'include_events' => $modSettings['cal_showevents'] > 1, 'num_days_shown' => empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1 ? 1 : $modSettings['cal_days_for_index']); $context += cache_quick_get('calendar_index_offset_' . ($user_info['time_offset'] + $modSettings['time_offset']), 'Subs-Calendar.php', 'cache_getRecentEvents', array($eventOptions)); // Whether one or multiple days are shown on the board index. $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1; // This is used to show the "how-do-I-edit" help. $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); } else { $context['show_calendar'] = false; } $context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']); // Mark read button $context['mark_read_button'] = array('markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id'])); // Allow mods to add additional buttons here call_integration_hook('integrate_mark_read_button'); }
function CopyTopic() { global $txt, $board, $topic, $scripturl, $sourcedir, $modSettings, $context; global $boards, $language, $user_info, $smcFunc; if (empty($topic)) { fatal_lang_error(1); } // Permission check! isAllowedTo('copy'); loadTemplate('CopyTopic'); // Get a list of boards this moderator can move to. $request = $smcFunc['db_query']('', ' SELECT b.id_board, b.name, b.child_level, c.name AS cat_name FROM {db_prefix}boards AS b LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat) WHERE {query_see_board}', array()); $context['boards'] = array(); while ($row = $smcFunc['db_fetch_assoc']($request)) { $context['boards'][] = array('id' => $row['id_board'], 'name' => $row['name'], 'category' => $row['cat_name'], 'child_level' => $row['child_level'], 'selected' => !empty($_SESSION['copy_to_topic']) && $_SESSION['copy_to_topic'] == $row['id_board']); } $smcFunc['db_free_result']($request); if (empty($context['boards'])) { fatal_lang_error('copytopic_noboards', false); } $context['page_title'] = $txt['copytopic']; $context['back_to_topic'] = isset($_REQUEST['goback']); // Register this form and get a sequence number in $context. checkSubmitOnce('register'); }
/** * This keeps track of all registered handling functions for auto suggest * functionality and passes execution to them. * Accessed by action=suggest. * @uses Xml template */ public function action_suggest() { global $context; // These are all registered types. $searchTypes = array('member' => array('file' => SUBSDIR . '/Suggest.class.php', 'class' => 'Suggest', 'function' => 'member')); call_integration_hook('integrate_autosuggest', array(&$searchTypes)); checkSession('get'); loadTemplate('Xml'); // Any parameters? $context['search_param'] = isset($_REQUEST['search_param']) ? unserialize(base64_decode($_REQUEST['search_param'])) : array(); if (isset($_REQUEST['suggest_type'], $_REQUEST['search']) && isset($searchTypes[$_REQUEST['suggest_type']])) { // Shortcut $currentSearch = $searchTypes[$_REQUEST['suggest_type']]; // Do we have a file to include? if (!empty($currentSearch['file']) && file_exists($currentSearch['file'])) { require_once $currentSearch['file']; } // If it is a class, let's instantiate it if (!empty($currentSearch['class']) && class_exists($currentSearch['class'])) { $suggest = new $currentSearch['class'](); // Okay, let's at least assume the method exists... *rolleyes* $context['xml_data'] = $suggest->{$currentSearch}['function'](); } elseif (function_exists('action_suggest_' . $currentSearch['function'])) { $function = 'action_suggest_' . $searchTypes[$_REQUEST['suggest_type']]; $context['xml_data'] = $function(); } if (!empty($context['xml_data'])) { $context['sub_template'] = 'generic_xml'; } } }
/** * This is the main method for markasread controller when using APIs. * @uses Xml template generic_xml_buttons sub template */ public function action_index_api() { global $context, $txt, $user_info, $scripturl; loadTemplate('Xml'); Template_Layers::getInstance()->removeAll(); $context['sub_template'] = 'generic_xml_buttons'; // Guests can't mark things. if ($user_info['is_guest']) { loadLanguage('Errors'); $context['xml_data'] = array('error' => 1, 'text' => $txt['not_guests']); return; } if (checkSession('get', '', false)) { // Again, this is a special case, someone will deal with the others later :P if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'all') { loadLanguage('Errors'); $context['xml_data'] = array('error' => 1, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']); return; } else { obExit(false); } } $this->_dispatch(); // For the time being this is a special case, but in BoardIndex no, we don't want it if (isset($_REQUEST['sa']) && ($_REQUEST['sa'] == 'all' || $_REQUEST['sa'] == 'board') && !isset($_REQUEST['bi'])) { $context['xml_data'] = array('text' => $txt['topic_alert_none'], 'body' => str_replace('{unread_all_url}', $scripturl . '?action=unread;all' . sprintf($this->_querystring_board_limits, 0) . $this->_querystring_sort_limits, $txt['unread_topics_visit_none'])); } else { obExit(false); } }
function ShowAdminHelp() { global $txt, $helptxt, $context, $scripturl; if (!isset($_GET['help']) || !is_string($_GET['help'])) { fatal_lang_error('no_access', false); } if (!isset($helptxt)) { $helptxt = array(); } // Load the admin help language file and template. loadLanguage('Help'); // Permission specific help? if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp') { loadLanguage('ManagePermissions'); } loadTemplate('Help'); // Set the page title to something relevant. $context['page_title'] = $context['forum_name'] . ' - ' . $txt['help']; // Don't show any template layers, just the popup sub template. $context['template_layers'] = array(); $context['sub_template'] = 'popup'; // What help string should be used? if (isset($helptxt[$_GET['help']])) { $context['help_text'] = $helptxt[$_GET['help']]; } elseif (isset($txt[$_GET['help']])) { $context['help_text'] = $txt[$_GET['help']]; } else { $context['help_text'] = $_GET['help']; } // Does this text contain a link that we should fill in? if (preg_match('~%([0-9]+\\$)?s\\?~', $context['help_text'], $match)) { $context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']); } }
function RegbarWarning() { global $context, $settings; loadLanguage('smfhacks_languages/regbar-warning'); loadTemplate('smfhacks_templates/regbar-warning'); $context['html_headers'] .= "\n" . '<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/smfhacks_css/regbar-warning.css" />'; loadSubTemplate('regbar_warning'); }
function indexAction($smarty) { $rsCategories = getAllMainCatsWithChildren(); $smarty->assign('pageTitle', 'Главная страница сайта'); loadTemplate($smarty, 'header'); loadTemplate($smarty, 'index'); loadTemplate($smarty, 'footer'); }
/** * The start point for all interaction with the SimpleDesk departments * * @since 2.0 */ function shd_admin_departments() { global $context, $scripturl, $sourcedir, $settings, $txt, $modSettings; loadTemplate('sd_template/SimpleDesk-AdminDepartments'); $subactions = array('main' => 'shd_admin_dept_list', 'move' => 'shd_admin_dept_move', 'createdept' => 'shd_admin_create_dept', 'editdept' => 'shd_admin_edit_dept', 'savedept' => 'shd_admin_save_dept'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subactions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main'; $subactions[$_REQUEST['sa']](); }
/** * The start point for all interaction with the SimpleDesk departments * * @since 2.0 */ function shd_admin_canned() { global $context, $scripturl, $sourcedir, $settings, $txt, $modSettings; loadTemplate('sd_template/SimpleDesk-AdminCannedReplies'); $subactions = array('main' => 'shd_admin_canned_list', 'createcat' => 'shd_admin_canned_createcat', 'movecat' => 'shd_admin_canned_movecat', 'editcat' => 'shd_admin_canned_editcat', 'savecat' => 'shd_admin_canned_savecat', 'createreply' => 'shd_admin_canned_createreply', 'movereply' => 'shd_admin_canned_movereply', 'movereplycat' => 'shd_admin_canned_movereplycat', 'editreply' => 'shd_admin_canned_editreply', 'savereply' => 'shd_admin_canned_savereply'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subactions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main'; $subactions[$_REQUEST['sa']](); }
function XMLhttpMain() { loadTemplate('Xml'); $sub_actions = array('jumpto' => array('function' => 'GetJumpTo'), 'messageicons' => array('function' => 'ListMessageIcons')); if (!isset($_REQUEST['sa'], $sub_actions[$_REQUEST['sa']])) { fatal_lang_error('no_access', false); } $sub_actions[$_REQUEST['sa']]['function'](); }
function convertFile($src, $dst) { $text = file_get_contents($src); $params = extractParams($text); $params['text'] = \Michelf\MarkdownExtra::defaultTransform($text); $html = loadTemplate($params['template'], $params); $dst = str_replace(array('.txt', '.md'), '.html', $dst); file_put_contents($dst, $html); }