本文整理汇总了PHP中loadTheme函数的典型用法代码示例。如果您正苦于以下问题:PHP loadTheme函数的具体用法?PHP loadTheme怎么用?PHP loadTheme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadTheme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fatal_lang_error
function fatal_lang_error($error, $log = 'general', $sprintf = array())
{
global $txt, $language, $modSettings, $user_info, $context;
static $fatal_error_called = false;
if ($error == 'loginWaitTime_broken' && is_int($sprintf[0])) {
sleep($sprintf[0]);
return;
}
// Try to load a theme if we don't have one.
if (empty($context['theme_loaded']) && empty($fatal_error_called)) {
$fatal_error_called = true;
@loadTheme();
}
// If we have no theme stuff we can't have the lanuage file...
if (empty($context['theme_loaded'])) {
die($error);
}
$reload_lang_file = true;
// Log the error in the forum's language, but don't waste the time if we aren't logging
if ($log || !empty($modSettings['enableErrorLogging']) && $modSettings['enableErrorLogging'] == 2) {
loadLanguage('Errors', $language);
$reload_lang_file = $language != $user_info['language'];
$error_message = empty($sprintf) ? $txt[$error] : vsprintf($txt[$error], $sprintf);
log_error($error_message, $log);
}
// Load the language file, only if it needs to be reloaded
if ($reload_lang_file) {
loadLanguage('Errors');
$error_message = empty($sprintf) ? $txt[$error] : vsprintf($txt[$error], $sprintf);
}
setup_fatal_error_context($error_message);
}
示例2: htmlentities
<?php
/**
* Created by PhpStorm.
* User: laffu
* Date: 07/03/2016
* Time: 10:48
*/
include $_SERVER["DOCUMENT_ROOT"] . "/theWood/back/Models/M_theme.php";
if (isset($_POST['idDomaine'])) {
$idDomaine = htmlentities(intval($_POST['idDomaine']));
$themes = loadTheme($idDomaine);
// envoi du résultat au success
echo json_encode($themes);
}
示例3: elk_main
/**
* The main dispatcher.
* This delegates to each area.
*/
function elk_main()
{
global $modSettings, $user_info, $topic, $board_info, $context;
// Special case: session keep-alive, output a transparent pixel.
if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
header('Content-Type: image/gif');
die("GIF89a€!ù,D;");
}
// We should set our security headers now.
frameOptionsHeader();
securityOptionsHeader();
// Load the user's cookie (or set as guest) and load their settings.
loadUserSettings();
// Load the current board's information.
loadBoard();
// Load the current user's permissions.
loadPermissions();
// Load BadBehavior before we go much further
loadBadBehavior();
// Attachments don't require the entire theme to be loaded.
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest'])) {
detectBrowser();
} else {
loadTheme();
}
// Check if the user should be disallowed access.
is_not_banned();
// If we are in a topic and don't have permission to approve it then duck out now.
if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
fatal_lang_error('not_a_topic', false);
}
$no_stat_actions = array('dlattach', 'findmember', 'jsoption', 'requestmembers', 'jslocale', 'xmlpreview', 'suggest', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewadminfile');
call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
// Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], $no_stat_actions)) {
// I see you!
writeLog();
// Track forum statistics and hits...?
if (!empty($modSettings['hitStats'])) {
trackStats(array('hits' => '+'));
}
}
unset($no_stat_actions);
// What shall we do?
require_once SOURCEDIR . '/SiteDispatcher.class.php';
$dispatcher = new Site_Dispatcher();
// Show where we came from, and go
$context['site_action'] = $dispatcher->site_action();
$context['site_action'] = !empty($context['site_action']) ? $context['site_action'] : (isset($_REQUEST['action']) ? $_REQUEST['action'] : '');
$dispatcher->dispatch();
}
示例4: SetThemeSettings
function SetThemeSettings()
{
global $txt, $context, $settings, $modSettings, $sourcedir, $smcFunc;
if (empty($_GET['th']) && empty($_GET['id'])) {
return ThemeAdmin();
}
$_GET['th'] = isset($_GET['th']) ? (int) $_GET['th'] : (int) $_GET['id'];
// Select the best fitting tab.
$context[$context['admin_menu_name']]['current_subsection'] = 'list';
loadLanguage('Admin');
isAllowedTo('admin_forum');
// Validate inputs/user.
if (empty($_GET['th'])) {
fatal_lang_error('no_theme', false);
}
// Fetch the smiley sets...
$sets = explode(',', 'none,' . $modSettings['smiley_sets_known']);
$set_names = explode("\n", $txt['smileys_none'] . "\n" . $modSettings['smiley_sets_names']);
$context['smiley_sets'] = array('' => $txt['smileys_no_default']);
foreach ($sets as $i => $set) {
$context['smiley_sets'][$set] = htmlspecialchars($set_names[$i]);
}
$old_id = $settings['theme_id'];
$old_settings = $settings;
loadTheme($_GET['th'], false);
// Sadly we really do need to init the template.
loadSubTemplate('init', 'ignore');
// Also load the actual themes language file - in case of special settings.
loadLanguage('Settings', '', true, true);
// Let the theme take care of the settings.
loadTemplate('Settings');
loadSubTemplate('settings');
// Submitting!
if (isset($_POST['submit'])) {
checkSession();
if (empty($_POST['options'])) {
$_POST['options'] = array();
}
if (empty($_POST['default_options'])) {
$_POST['default_options'] = array();
}
// Make sure items are cast correctly.
foreach ($context['theme_settings'] as $item) {
// Disregard this item if this is just a separator.
if (!is_array($item)) {
continue;
}
foreach (array('options', 'default_options') as $option) {
if (!isset($_POST[$option][$item['id']])) {
continue;
} elseif (empty($item['type'])) {
$_POST[$option][$item['id']] = $_POST[$option][$item['id']] ? 1 : 0;
} elseif ($item['type'] == 'number') {
$_POST[$option][$item['id']] = (int) $_POST[$option][$item['id']];
}
}
}
// Set up the sql query.
$inserts = array();
foreach ($_POST['options'] as $opt => $val) {
$inserts[] = array(0, $_GET['th'], $opt, is_array($val) ? implode(',', $val) : $val);
}
foreach ($_POST['default_options'] as $opt => $val) {
$inserts[] = array(0, 1, $opt, is_array($val) ? implode(',', $val) : $val);
}
// If we're actually inserting something..
if (!empty($inserts)) {
$smcFunc['db_insert']('replace', '{db_prefix}themes', array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'), $inserts, array('id_member', 'id_theme', 'variable'));
}
cache_put_data('theme_settings-' . $_GET['th'], null, 90);
cache_put_data('theme_settings-1', null, 90);
// Invalidate the cache.
updateSettings(array('settings_updated' => time()));
redirectexit('action=admin;area=theme;sa=settings;th=' . $_GET['th'] . ';' . $context['session_var'] . '=' . $context['session_id']);
}
$context['sub_template'] = 'set_settings';
$context['page_title'] = $txt['theme_settings'];
foreach ($settings as $setting => $dummy) {
if (!in_array($setting, array('theme_url', 'theme_dir', 'images_url', 'template_dirs'))) {
$settings[$setting] = htmlspecialchars__recursive($settings[$setting]);
}
}
$context['settings'] = $context['theme_settings'];
$context['theme_settings'] = $settings;
foreach ($context['settings'] as $i => $setting) {
// Separators are dummies, so leave them alone.
if (!is_array($setting)) {
continue;
}
if (!isset($setting['type']) || $setting['type'] == 'bool') {
$context['settings'][$i]['type'] = 'checkbox';
} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
$context['settings'][$i]['type'] = 'number';
} elseif ($setting['type'] == 'string') {
$context['settings'][$i]['type'] = 'text';
}
if (isset($setting['options'])) {
$context['settings'][$i]['type'] = 'list';
}
$context['settings'][$i]['value'] = !isset($settings[$setting['id']]) ? '' : $settings[$setting['id']];
//.........这里部分代码省略.........
示例5: setup_fatal_error_context
function setup_fatal_error_context($error_message)
{
global $context, $txt, $ssi_on_error_method;
static $level = 0;
// Attempt to prevent a recursive loop.
++$level;
if ($level > 1) {
return false;
}
// Maybe they came from dlattach or similar?
if (SMF != 'SSI' && empty($context['theme_loaded'])) {
loadTheme();
}
// Don't bother indexing errors mate...
$context['robot_no_index'] = true;
if (!isset($context['error_title'])) {
$context['error_title'] = $txt['error_occured'];
}
$context['error_message'] = isset($context['error_message']) ? $context['error_message'] : $error_message;
if (empty($context['page_title'])) {
$context['page_title'] = $context['error_title'];
}
EoS_Smarty::resetTemplates();
// discard all templates loaded so far. We don't need them any longer
EoS_Smarty::loadTemplate('errors');
// If this is SSI, what do they want us to do?
if (SMF == 'SSI') {
if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) {
call_user_func($ssi_on_error_method);
} elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) {
loadSubTemplate('fatal_error');
}
// No layers?
if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) {
exit;
}
}
// We want whatever for the header, and a footer. (footer includes sub template!)
obExit(null, true, false, true);
/* DO NOT IGNORE:
If you are creating a bridge to SMF or modifying this function, you MUST
make ABSOLUTELY SURE that this function quits and DOES NOT RETURN TO NORMAL
PROGRAM FLOW. Otherwise, security error messages will not be shown, and
your forum will be in a very easily hackable state.
*/
trigger_error('Hacking attempt...', E_USER_ERROR);
}
示例6: unset
}
$sc = $_SESSION['session_value'];
}
// Get rid of $board and $topic... do stuff loadBoard would do.
unset($board, $topic);
$user_info['is_mod'] = false;
$context['user']['is_mod'] =& $user_info['is_mod'];
$context['linktree'] = array();
// Load the user and their cookie, as well as their settings.
loadUserSettings();
// Load the current user's permissions....
loadPermissions();
// Load BadBehavior functions
loadBadBehavior();
// Load the current or SSI theme. (just use $ssi_theme = id_theme;)
loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0);
// @todo: probably not the best place, but somewhere it should be set...
if (!headers_sent()) {
header('Content-Type: text/html; charset=UTF-8');
}
// Take care of any banning that needs to be done.
if (isset($_REQUEST['ssi_ban']) || isset($ssi_ban) && $ssi_ban === true) {
is_not_banned();
}
// Do we allow guests in here?
if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php') {
require_once CONTROLLERDIR . '/Auth.controller.php';
$controller = new Auth_Controller();
$controller->action_kickguest();
obExit(null, true);
}
示例7: SetThemeSettings
function SetThemeSettings()
{
global $txt, $sc, $context, $settings, $db_prefix, $modSettings;
if (empty($_GET['th']) && empty($_GET['id'])) {
return ThemeAdmin();
}
$_GET['th'] = isset($_GET['th']) ? (int) $_GET['th'] : (int) $_GET['id'];
// Select the best fitting tab.
$context['admin_tabs']['tabs']['list']['is_selected'] = true;
loadLanguage('Admin');
isAllowedTo('admin_forum');
// Just for navigation, show some nice bar on the left.
adminIndex($settings['theme_id'] == $_GET['th'] ? 'edit_theme_settings' : 'manage_themes');
// Validate inputs/user.
if (empty($_GET['th'])) {
fatal_lang_error('theme3', false);
}
// Submitting!
if (isset($_POST['submit'])) {
checkSession();
if (empty($_POST['options'])) {
$_POST['options'] = array();
}
if (empty($_POST['default_options'])) {
$_POST['default_options'] = array();
}
// Set up the sql query.
$setString = '';
foreach ($_POST['options'] as $opt => $val) {
$setString .= "\n\t\t\t\t(0, {$_GET['th']}, SUBSTRING('{$opt}', 1, 255), SUBSTRING('" . (is_array($val) ? implode(',', $val) : $val) . "', 1, 65534)),";
}
foreach ($_POST['default_options'] as $opt => $val) {
$setString .= "\n\t\t\t\t(0, 1, SUBSTRING('{$opt}', 1, 255), SUBSTRING('" . (is_array($val) ? implode(',', $val) : $val) . "', 1, 65534)),";
}
// If we're actually inserting something..
if ($setString != '') {
// Get rid of the last comma.
$setString = substr($setString, 0, -1);
db_query("\n\t\t\t\tREPLACE INTO {$db_prefix}themes\n\t\t\t\t\t(ID_MEMBER, ID_THEME, variable, value)\n\t\t\t\tVALUES {$setString}", __FILE__, __LINE__);
}
cache_put_data('theme_settings-' . $_GET['th'], null, 90);
cache_put_data('theme_settings-1', null, 90);
redirectexit('action=theme;sa=settings;th=' . $_GET['th'] . ';sesc=' . $sc);
}
checkSession('get');
// Fetch the smiley sets...
$sets = explode(',', 'none,' . $modSettings['smiley_sets_known']);
$set_names = explode("\n", $txt['smileys_none'] . "\n" . $modSettings['smiley_sets_names']);
$context['smiley_sets'] = array('' => $txt['smileys_no_default']);
foreach ($sets as $i => $set) {
$context['smiley_sets'][$set] = $set_names[$i];
}
$old_id = $settings['theme_id'];
$old_settings = $settings;
loadTheme($_GET['th'], false);
// Let the theme take care of the settings.
loadTemplate('Settings');
loadSubTemplate('settings');
$context['sub_template'] = 'set_settings';
$context['page_title'] = $txt['theme4'];
foreach ($settings as $setting => $dummy) {
if (!in_array($setting, array('theme_url', 'theme_dir', 'images_url'))) {
$settings[$setting] = htmlspecialchars($settings[$setting]);
}
}
$context['settings'] = $context['theme_settings'];
$context['theme_settings'] = $settings;
foreach ($context['settings'] as $i => $setting) {
if (!isset($setting['type']) || $setting['type'] == 'bool') {
$context['settings'][$i]['type'] = 'checkbox';
} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
$context['settings'][$i]['type'] = 'number';
} elseif ($setting['type'] == 'string') {
$context['settings'][$i]['type'] = 'text';
}
if (isset($setting['options'])) {
$context['settings'][$i]['type'] = 'list';
}
$context['settings'][$i]['value'] = !isset($settings[$setting['id']]) ? '' : $settings[$setting['id']];
}
// Restore the current theme.
loadTheme($old_id, false);
$settings = $old_settings;
loadTemplate('Themes');
}
示例8: getLanguages
function getLanguages($use_cache = true, $favor_utf8 = true)
{
global $context, $settings, $modSettings;
// Either we don't use the cache, or its expired.
if (!$use_cache || ($context['languages'] = CacheAPI::getCache('known_languages' . ($favor_utf8 ? '' : '_all'), !empty($modSettings['cache_enable']) && $modSettings['cache_enable'] < 1 ? 86400 : 3600)) == null) {
// If we don't have our theme information yet, lets get it.
if (empty($settings['default_theme_dir'])) {
loadTheme(0, false);
} else {
$settings['actual_theme_url'] = $settings['theme_url'];
$settings['actual_images_url'] = $settings['images_url'];
$settings['actual_theme_dir'] = $settings['theme_dir'];
}
// Default language directories to try.
$language_directories = array($settings['default_theme_dir'] . '/languages', $settings['actual_theme_dir'] . '/languages');
// We possibly have a base theme directory.
if (!empty($settings['base_theme_dir'])) {
$language_directories[] = $settings['base_theme_dir'] . '/languages';
}
// Remove any duplicates.
$language_directories = array_unique($language_directories);
foreach ($language_directories as $language_dir) {
// Can't look in here... doesn't exist!
if (!file_exists($language_dir)) {
continue;
}
$dir = dir($language_dir);
while ($entry = $dir->read()) {
// Look for the index language file....
if (!preg_match('~^index\\.(.+)\\.php$~', $entry, $matches)) {
continue;
}
$context['languages'][$matches[1]] = array('name' => commonAPI::ucwords(strtr($matches[1], array('_' => ' '))), 'selected' => false, 'filename' => $matches[1], 'location' => $language_dir . '/index.' . $matches[1] . '.php');
}
$dir->close();
}
// Favoring UTF8? Then prevent us from selecting non-UTF8 versions.
if ($favor_utf8) {
foreach ($context['languages'] as $lang) {
if (substr($lang['filename'], strlen($lang['filename']) - 5, 5) != '-utf8' && isset($context['languages'][$lang['filename'] . '-utf8'])) {
unset($context['languages'][$lang['filename']]);
}
}
}
// Lets cash in on this deal.
if (!empty($modSettings['cache_enable'])) {
CacheAPI::putCache('known_languages' . ($favor_utf8 ? '' : '_all'), $context['languages'], !empty($modSettings['cache_enable']) && $modSettings['cache_enable'] < 1 ? 86400 : 3600);
}
}
return $context['languages'];
}
示例9: smf_main
function smf_main()
{
global $modSettings, $settings, $user_info, $board, $topic, $maintenance, $sourcedir;
// Special case: session keep-alive.
if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
die;
}
// Load the user's cookie (or set as guest) and load their settings.
loadUserSettings();
// Load the current board's information.
loadBoard();
// Load the current theme. (note that ?theme=1 will also work, may be used for guest theming.)
loadTheme();
// Check if the user should be disallowed access.
// is_not_banned();
// Load the current user's permissions.
loadPermissions();
// Do some logging, unless this is an attachment, avatar, theme option or XML feed.
if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'jsoption', '.xml'))) {
// Log this user as online.
writeLog();
// Track forum statistics and hits...?
if (!empty($modSettings['hitStats'])) {
trackStats(array('hits' => '+'));
}
}
// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum')) {
// You can only login.... otherwise, you're getting the "maintenance mode" display.
if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout')) {
require_once $sourcedir . '/LogInOut.php';
return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
} else {
require_once $sourcedir . '/Subs-Auth.php';
return 'InMaintenance';
}
} elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'smstats', 'help', 'verificationcode')))) {
require_once $sourcedir . '/Subs-Auth.php';
return 'KickGuest';
} elseif (empty($_REQUEST['action'])) {
// Action and board are both empty... BoardIndex!
if (empty($board) && empty($topic)) {
require_once $sourcedir . '/BoardIndex.php';
return 'BoardIndex';
} elseif (empty($topic)) {
require_once $sourcedir . '/MessageIndex.php';
return 'MessageIndex';
} else {
require_once $sourcedir . '/Display.php';
return 'Display';
}
}
// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
$actionArray = array('activate' => array('Register.php', 'Activate'), 'admin' => array('Admin.php', 'Admin'), 'announce' => array('Post.php', 'AnnounceTopic'), 'ban' => array('ManageBans.php', 'Ban'), 'boardrecount' => array('Admin.php', 'AdminBoardRecount'), 'buddy' => array('Subs-Members.php', 'BuddyListToggle'), 'calendar' => array('Calendar.php', 'CalendarMain'), 'cleanperms' => array('Admin.php', 'CleanupPermissions'), 'collapse' => array('Subs-Boards.php', 'CollapseCategory'), 'convertentities' => array('Admin.php', 'ConvertEntities'), 'convertutf8' => array('Admin.php', 'ConvertUtf8'), 'coppa' => array('Register.php', 'CoppaForm'), 'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'), 'detailedversion' => array('Admin.php', 'VersionDetail'), 'display' => array('Display.php', 'Display'), 'dlattach' => array('Display.php', 'Download'), 'dumpdb' => array('DumpDatabase.php', 'DumpDatabase2'), 'editpoll' => array('Poll.php', 'EditPoll'), 'editpoll2' => array('Poll.php', 'EditPoll2'), 'featuresettings' => array('ModSettings.php', 'ModifyFeatureSettings'), 'featuresettings2' => array('ModSettings.php', 'ModifyFeatureSettings2'), 'findmember' => array('Subs-Auth.php', 'JSMembers'), 'help' => array('Help.php', 'ShowHelp'), 'helpadmin' => array('Help.php', 'ShowAdminHelp'), 'im' => array('PersonalMessage.php', 'MessageMain'), 'jsoption' => array('Themes.php', 'SetJavaScript'), 'jsmodify' => array('Post.php', 'JavaScriptModify'), 'lock' => array('LockTopic.php', 'LockTopic'), 'lockVoting' => array('Poll.php', 'LockVoting'), 'login' => array('LogInOut.php', 'Login'), 'login2' => array('LogInOut.php', 'Login2'), 'logout' => array('LogInOut.php', 'Logout'), 'maintain' => array('Admin.php', 'Maintenance'), 'manageattachments' => array('ManageAttachments.php', 'ManageAttachments'), 'manageboards' => array('ManageBoards.php', 'ManageBoards'), 'managecalendar' => array('ManageCalendar.php', 'ManageCalendar'), 'managesearch' => array('ManageSearch.php', 'ManageSearch'), 'markasread' => array('Subs-Boards.php', 'MarkRead'), 'membergroups' => array('ManageMembergroups.php', 'ModifyMembergroups'), 'mergetopics' => array('SplitTopics.php', 'MergeTopics'), 'mlist' => array('Memberlist.php', 'Memberlist'), 'modifycat' => array('ManageBoards.php', 'ModifyCat'), 'modifykarma' => array('Karma.php', 'ModifyKarma'), 'modlog' => array('Modlog.php', 'ViewModlog'), 'movetopic' => array('MoveTopic.php', 'MoveTopic'), 'movetopic2' => array('MoveTopic.php', 'MoveTopic2'), 'news' => array('ManageNews.php', 'ManageNews'), 'notify' => array('Notify.php', 'Notify'), 'notifyboard' => array('Notify.php', 'BoardNotify'), 'optimizetables' => array('Admin.php', 'OptimizeTables'), 'packageget' => array('PackageGet.php', 'PackageGet'), 'packages' => array('Packages.php', 'Packages'), 'permissions' => array('ManagePermissions.php', 'ModifyPermissions'), 'pgdownload' => array('PackageGet.php', 'PackageGet'), 'pm' => array('PersonalMessage.php', 'MessageMain'), 'post' => array('Post.php', 'Post'), 'post2' => array('Post.php', 'Post2'), 'postsettings' => array('ManagePosts.php', 'ManagePostSettings'), 'printpage' => array('Printpage.php', 'PrintTopic'), 'profile' => array('Profile.php', 'ModifyProfile'), 'profile2' => array('Profile.php', 'ModifyProfile2'), 'quotefast' => array('Post.php', 'QuoteFast'), 'quickmod' => array('Subs-Boards.php', 'QuickModeration'), 'quickmod2' => array('Subs-Boards.php', 'QuickModeration2'), 'recent' => array('Recent.php', 'RecentPosts'), 'regcenter' => array('ManageRegistration.php', 'RegCenter'), 'register' => array('Register.php', 'Register'), 'register2' => array('Register.php', 'Register2'), 'reminder' => array('Reminder.php', 'RemindMe'), 'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'), 'removeoldtopics2' => array('RemoveTopic.php', 'RemoveOldTopics2'), 'removepoll' => array('Poll.php', 'RemovePoll'), 'repairboards' => array('RepairBoards.php', 'RepairBoards'), 'reporttm' => array('SendTopic.php', 'ReportToModerator'), 'reports' => array('Reports.php', 'ReportsMain'), 'requestmembers' => array('Subs-Auth.php', 'RequestMembers'), 'search' => array('Search.php', 'PlushSearch1'), 'search2' => array('Search.php', 'PlushSearch2'), 'sendtopic' => array('SendTopic.php', 'SendTopic'), 'serversettings' => array('ManageServer.php', 'ModifySettings'), 'serversettings2' => array('ManageServer.php', 'ModifySettings2'), 'smileys' => array('ManageSmileys.php', 'ManageSmileys'), 'smstats' => array('Stats.php', 'SMStats'), 'spellcheck' => array('Subs-Post.php', 'SpellCheck'), 'splittopics' => array('SplitTopics.php', 'SplitTopics'), 'stats' => array('Stats.php', 'DisplayStats'), 'sticky' => array('LockTopic.php', 'Sticky'), 'theme' => array('Themes.php', 'ThemesMain'), 'trackip' => array('Profile.php', 'trackIP'), 'about:mozilla' => array('Karma.php', 'BookOfUnknown'), 'about:unknown' => array('Karma.php', 'BookOfUnknown'), 'unread' => array('Recent.php', 'UnreadTopics'), 'unreadreplies' => array('Recent.php', 'UnreadTopics'), 'viewErrorLog' => array('ManageErrors.php', 'ViewErrorLog'), 'viewmembers' => array('ManageMembers.php', 'ViewMembers'), 'viewprofile' => array('Profile.php', 'ModifyProfile'), 'verificationcode' => array('Register.php', 'VerificationCode'), 'vote' => array('Poll.php', 'Vote'), 'viewquery' => array('ViewQuery.php', 'ViewQuery'), 'who' => array('Who.php', 'Who'), '.xml' => array('News.php', 'ShowXmlFeed'));
// Get the function and file to include - if it's not there, do the board index.
if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {
// Catch the action with the theme?
if (!empty($settings['catch_action'])) {
require_once $sourcedir . '/Themes.php';
return 'WrapAction';
}
// Fall through to the board index then...
require_once $sourcedir . '/BoardIndex.php';
return 'BoardIndex';
}
// Otherwise, it was set - so let's go to that action.
require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
return $actionArray[$_REQUEST['action']][1];
}
示例10: setup_fatal_error_context
/**
* It is called by fatal_error() and fatal_lang_error().
*
* @uses Errors template, fatal_error sub template
* @param string $error_message
* @param string $error_code string or int code
*/
function setup_fatal_error_context($error_message, $error_code)
{
global $context, $txt, $ssi_on_error_method;
static $level = 0;
// Attempt to prevent a recursive loop.
++$level;
if ($level > 1) {
return false;
}
// Maybe they came from dlattach or similar?
if (ELK != 'SSI' && empty($context['theme_loaded'])) {
loadTheme();
}
// Don't bother indexing errors mate...
$context['robot_no_index'] = true;
if (!isset($context['error_title'])) {
$context['error_title'] = $txt['error_occurred'];
}
$context['error_message'] = isset($context['error_message']) ? $context['error_message'] : $error_message;
$context['error_code'] = isset($error_code) ? 'id="' . htmlspecialchars($error_code) . '" ' : '';
if (empty($context['page_title'])) {
$context['page_title'] = $context['error_title'];
}
// Load the template and set the sub template.
loadTemplate('Errors');
$context['sub_template'] = 'fatal_error';
// If this is SSI, what do they want us to do?
if (ELK == 'SSI') {
if (!empty($ssi_on_error_method) && $ssi_on_error_method !== true && is_callable($ssi_on_error_method)) {
$ssi_on_error_method();
} elseif (empty($ssi_on_error_method) || $ssi_on_error_method !== true) {
loadSubTemplate('fatal_error');
}
// No layers?
if (empty($ssi_on_error_method) || $ssi_on_error_method !== true) {
exit;
}
}
// We want whatever for the header, and a footer. (footer includes sub template!)
obExit(null, true, false, true);
/* DO NOT IGNORE:
If you are creating a bridge or modifying this function, you MUST
make ABSOLUTELY SURE that this function quits and DOES NOT RETURN TO NORMAL
PROGRAM FLOW. Otherwise, security error messages will not be shown, and
your forum will be in a very easily hackable state.
*/
trigger_error('Hacking attempt...', E_USER_ERROR);
}
示例11: action_setthemesettings
/**
* Administrative global settings.
*
* What it does:
* - Saves and requests global theme settings. ($settings)
* - Loads the Admin language file.
* - Calls action_admin() if no theme is specified. (the theme center.)
* - Requires admin_forum permission.
* - Accessed with ?action=admin;area=theme;sa=list&th=xx.
*/
public function action_setthemesettings()
{
global $txt, $context, $settings, $modSettings;
require_once SUBSDIR . '/Themes.subs.php';
// Nothing chosen, back to the start you go
if (empty($_GET['th']) && empty($_GET['id'])) {
return $this->action_admin();
}
// The theme's ID is needed
$theme = isset($_GET['th']) ? (int) $_GET['th'] : (int) $_GET['id'];
// Validate inputs/user.
if (empty($theme)) {
fatal_lang_error('no_theme', false);
}
// Select the best fitting tab.
$context[$context['admin_menu_name']]['current_subsection'] = 'list';
loadLanguage('Admin');
// Fetch the smiley sets...
$sets = explode(',', 'none,' . $modSettings['smiley_sets_known']);
$set_names = explode("\n", $txt['smileys_none'] . "\n" . $modSettings['smiley_sets_names']);
$context['smiley_sets'] = array('' => $txt['smileys_no_default']);
foreach ($sets as $i => $set) {
$context['smiley_sets'][$set] = htmlspecialchars($set_names[$i], ENT_COMPAT, 'UTF-8');
}
$old_id = $settings['theme_id'];
$old_settings = $settings;
loadTheme($theme, false);
// Also load the actual themes language file - in case of special settings.
loadLanguage('Settings', '', true, true);
// And the custom language strings...
loadLanguage('ThemeStrings', '', false, true);
// Let the theme take care of the settings.
loadTemplate('Settings');
loadSubTemplate('settings');
// Load the variants separately...
$settings['theme_variants'] = array();
if (file_exists($settings['theme_dir'] . '/index.template.php')) {
$file_contents = implode("\n", file($settings['theme_dir'] . '/index.template.php'));
if (preg_match('~\'theme_variants\'\\s*=>(.+?\\)),$~sm', $file_contents, $matches)) {
eval('global $settings; $settings[\'theme_variants\'] = ' . $matches[1] . ';');
}
call_integration_hook('integrate_init_theme', array($theme, &$settings));
}
// Submitting!
if (isset($_POST['save'])) {
// Allowed?
checkSession();
validateToken('admin-sts');
if (empty($_POST['options'])) {
$_POST['options'] = array();
}
if (empty($_POST['default_options'])) {
$_POST['default_options'] = array();
}
// Make sure items are cast correctly.
foreach ($context['theme_settings'] as $item) {
// Unwatch this item if this is just a separator.
if (!is_array($item)) {
continue;
}
// Clean them up for the database
foreach (array('options', 'default_options') as $option) {
if (!isset($_POST[$option][$item['id']])) {
continue;
} elseif (empty($item['type'])) {
$_POST[$option][$item['id']] = $_POST[$option][$item['id']] ? 1 : 0;
} elseif ($item['type'] == 'number') {
$_POST[$option][$item['id']] = (int) $_POST[$option][$item['id']];
}
}
}
// Set up the sql query.
$inserts = array();
foreach ($_POST['options'] as $opt => $val) {
$inserts[] = array($theme, 0, $opt, is_array($val) ? implode(',', $val) : $val);
}
foreach ($_POST['default_options'] as $opt => $val) {
$inserts[] = array(1, 0, $opt, is_array($val) ? implode(',', $val) : $val);
}
// If we're actually inserting something..
if (!empty($inserts)) {
updateThemeOptions($inserts);
}
// Clear and Invalidate the cache.
cache_put_data('theme_settings-' . $theme, null, 90);
cache_put_data('theme_settings-1', null, 90);
updateSettings(array('settings_updated' => time()));
redirectexit('action=admin;area=theme;sa=list;th=' . $theme . ';' . $context['session_var'] . '=' . $context['session_id']);
}
$context['sub_template'] = 'set_settings';
//.........这里部分代码省略.........
示例12: smf_main
function smf_main()
{
global $modSettings, $settings, $user_info, $board, $topic, $board_info, $maintenance, $sourcedir, $request_name, $txt, $user_settings, $mobiquo_config, $topic_per_page, $limit_num;
// Load the user's cookie (or set as guest) and load their settings.
loadUserSettings();
// Load the current board's information.
loadBoard();
// Load the current user's permissions.
loadPermissions();
// Attachments don't require the entire theme to be loaded.
loadTheme();
header('Mobiquo_is_login:' . ($GLOBALS['context']['user']['is_logged'] ? 'true' : 'false'));
// Check if the user should be disallowed access.
if (!in_array($request_name, array('get_config', 'login'))) {
is_not_banned();
}
// If we are in a topic and don't have permission to approve it then duck out now.
if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
//fatal_lang_error('not_a_topic', false);
get_error('The topic is not approved');
}
// Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'findmember', 'jseditor', 'jsoption', 'requestmembers', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'))) {
// Log this user as online.
writeLog();
// Track forum statistics and hits...?
if (!empty($modSettings['hitStats'])) {
trackStats(array('hits' => '+'));
}
}
// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum')) {
if ($request_name != 'get_config' && $request_name != 'login') {
get_error($txt['maintain_mode_on']);
}
} elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('push_content_check', 'user_subscription', 'set_api_key', 'reset_push_slug', 'prefetch_account', 'update_password', 'forget_password', 'sign_in', 'coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn')))) {
if ($request_name != 'get_config' && $request_name != 'prefetch_account') {
loadLanguage('Login');
get_error($txt['only_members_can_access']);
//require_once($sourcedir . '/Subs-Auth.php');
//return 'KickGuest';
}
}
//-------------transform input data to local character set if needed
utf8_to_local();
//-------------change some setting for tapatalk display
$settings['message_index_preview'] = 1;
$modSettings['todayMod_bak'] = $modSettings['todayMod'];
$modSettings['todayMod'] = 0;
$user_settings['pm_prefs'] = 0;
$user_info['user_time_format'] = $user_info['time_format'];
$user_info['time_format'] = '%Y%m%dT%H:%M:%S+00:00';
$modSettings['disableCustomPerPage'] = 1;
$modSettings['disableCheckUA'] = 1;
$modSettings['defaultMaxMessages'] = isset($limit_num) ? $limit_num : 20;
$modSettings['defaultMaxMembers'] = 100;
$modSettings['search_results_per_page'] = isset($topic_per_page) && $topic_per_page > 0 ? $topic_per_page : 20;
$modSettings['defaultMaxTopics'] = isset($topic_per_page) && $topic_per_page > 0 ? $topic_per_page : 20;
$modSettings['disable_pm_verification'] = $mobiquo_config['disable_pm_verification'];
//-------------do something before action--------------
if (function_exists('before_action_' . $request_name)) {
call_user_func('before_action_' . $request_name);
}
if (empty($_REQUEST['action']) && !empty($board)) {
if (empty($topic)) {
require_once 'include/MessageIndex.php';
return 'MessageIndex';
} else {
require_once 'include/Display.php';
return 'Display';
}
}
// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
$actionArray = array('activate' => array('Register.php', 'Activate'), 'admin' => array('Admin.php', 'AdminMain'), 'announce' => array('Post.php', 'AnnounceTopic'), 'attachapprove' => array('ManageAttachments.php', 'ApproveAttach'), 'buddy' => array('Subs-Members.php', 'BuddyListToggle'), 'calendar' => array('Calendar.php', 'CalendarMain'), 'clock' => array('Calendar.php', 'clock'), 'collapse' => array('BoardIndex.php', 'CollapseCategory'), 'coppa' => array('Register.php', 'CoppaForm'), 'credits' => array('Who.php', 'Credits'), 'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'), 'display' => array('Display.php', 'Display'), 'dlattach' => array('Display.php', 'Download'), 'editpoll' => array('Poll.php', 'EditPoll'), 'editpoll2' => array('Poll.php', 'EditPoll2'), 'emailuser' => array('SendTopic.php', 'EmailUser'), 'findmember' => array('Subs-Auth.php', 'JSMembers'), 'groups' => array('Groups.php', 'Groups'), 'help' => array('Help.php', 'ShowHelp'), 'helpadmin' => array('Help.php', 'ShowAdminHelp'), 'im' => array('PersonalMessage.php', 'MessageMain'), 'jseditor' => array('Subs-Editor.php', 'EditorMain'), 'jsmodify' => array('Post.php', 'JavaScriptModify'), 'jsoption' => array('Themes.php', 'SetJavaScript'), 'lock' => array('LockTopic.php', 'LockTopic'), 'lockvoting' => array('Poll.php', 'LockVoting'), 'login' => array('LogInOut.php', 'Login'), 'login2' => array('LogInOut.php', 'Login2'), 'logout' => array('LogInOut.php', 'Logout'), 'markasread' => array('Subs-Boards.php', 'MarkRead'), 'mergetopics' => array('SplitTopics.php', 'MergeTopics'), 'mlist' => array('Memberlist.php', 'Memberlist'), 'moderate' => array('ModerationCenter.php', 'ModerationMain'), 'modifycat' => array('ManageBoards.php', 'ModifyCat'), 'modifykarma' => array('Karma.php', 'ModifyKarma'), 'movetopic' => array('MoveTopic.php', 'MoveTopic'), 'movetopic2' => array('MoveTopic.php', 'MoveTopic2'), 'notify' => array('Notify.php', 'Notify'), 'notifyboard' => array('Notify.php', 'BoardNotify'), 'openidreturn' => array('Subs-OpenID.php', 'smf_openID_return'), 'pm' => array('PersonalMessage.php', 'MessageMain'), 'post' => array('Post.php', 'Post'), 'post2' => array('Post.php', 'Post2'), 'printpage' => array('Printpage.php', 'PrintTopic'), 'profile' => array('Profile.php', 'ModifyProfile'), 'quotefast' => array('Post.php', 'QuoteFast'), 'quickmod' => array('MessageIndex.php', 'QuickModeration'), 'quickmod2' => array('Display.php', 'QuickInTopicModeration'), 'recent' => array('Recent.php', 'RecentPosts'), 'register' => array('Register.php', 'Register'), 'register2' => array('Register.php', 'Register2'), 'reminder' => array('Reminder.php', 'RemindMe'), 'removepoll' => array('Poll.php', 'RemovePoll'), 'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'), 'reporttm' => array('SendTopic.php', 'ReportToModerator'), 'requestmembers' => array('Subs-Auth.php', 'RequestMembers'), 'restoretopic' => array('RemoveTopic.php', 'RestoreTopic'), 'search' => array('Search.php', 'PlushSearch1'), 'search2' => array('Search.php', 'PlushSearch2'), 'sendtopic' => array('SendTopic.php', 'EmailUser'), 'smstats' => array('Stats.php', 'SMStats'), 'suggest' => array('Subs-Editor.php', 'AutoSuggestHandler'), 'spellcheck' => array('Subs-Post.php', 'SpellCheck'), 'splittopics' => array('SplitTopics.php', 'SplitTopics'), 'stats' => array('Stats.php', 'DisplayStats'), 'sticky' => array('LockTopic.php', 'Sticky'), 'theme' => array('Themes.php', 'ThemesMain'), 'trackip' => array('Profile-View.php', 'trackIP'), 'about:mozilla' => array('Karma.php', 'BookOfUnknown'), 'about:unknown' => array('Karma.php', 'BookOfUnknown'), 'unread' => array('Recent.php', 'UnreadTopics'), 'unreadreplies' => array('Recent.php', 'UnreadTopics'), 'verificationcode' => array('Register.php', 'VerificationCode'), 'viewprofile' => array('Profile.php', 'ModifyProfile'), 'vote' => array('Poll.php', 'Vote'), 'viewquery' => array('ViewQuery.php', 'ViewQuery'), 'viewsmfile' => array('Admin.php', 'DisplayAdminFile'), 'who' => array('Who.php', 'Who'), '.xml' => array('News.php', 'ShowXmlFeed'), 'xmlhttp' => array('Xml.php', 'XMLhttpMain'));
// Allow modifying $actionArray easily.
call_integration_hook('integrate_actions', array(&$actionArray));
//error_log($request_name.'-'.$_REQUEST['action']); //for debugging
// Get the function and file to include - if it's not there, do the board index.
if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {
if (function_exists('action_' . $request_name)) {
return 'action_' . $request_name;
} else {
get_error('Invalid action');
}
}
$local_action = array('login2', 'post', 'post2', 'who', 'profile', 'notify', 'notifyboard', 'markasread', 'unread', 'search2', 'pm', 'logout');
// Otherwise, it was set - so let's go to that action.
if (in_array($_REQUEST['action'], $local_action)) {
if (file_exists(TT_ROOT . 'include/' . $actionArray[$_REQUEST['action']][0])) {
require_once TT_ROOT . 'include/' . $actionArray[$_REQUEST['action']][0];
} else {
if (file_exists($sourcedir . '/' . $actionArray[$_REQUEST['action']][0])) {
require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
}
}
} else {
if (file_exists($sourcedir . '/' . $actionArray[$_REQUEST['action']][0])) {
require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
}
}
//.........这里部分代码省略.........
示例13: is_not_guest
function is_not_guest($message = '')
{
global $user_info, $txt, $context, $scripturl;
// Luckily, this person isn't a guest.
if (!$user_info['is_guest']) {
return;
}
// People always worry when they see people doing things they aren't actually doing...
$_GET['action'] = '';
$_GET['board'] = '';
$_GET['topic'] = '';
writeLog(true);
// Just die.
if (isset($_REQUEST['xml'])) {
obExit(false);
}
// Attempt to detect if they came from dlattach.
if (SMF != 'SSI' && empty($context['theme_loaded'])) {
loadTheme();
}
// Never redirect to an attachment
if (strpos($_SERVER['REQUEST_URL'], 'dlattach') === false) {
$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];
}
// Load the Login template and language file.
loadLanguage('Login');
// Apparently we're not in a position to handle this now. Let's go to a safer location for now.
if (empty($context['template_layers'])) {
$_SESSION['login_url'] = $scripturl . '?' . $_SERVER['QUERY_STRING'];
redirectexit('action=login');
} else {
EoS_Smarty::resetTemplates();
EoS_Smarty::loadTemplate('generic_skeleton');
EoS_Smarty::getConfigInstance()->registerHookTemplate('generic_content_area', 'loginout/login');
$context['is_kick_guest'] = true;
$context['robot_no_index'] = true;
}
// Use the kick_guest sub template...
$context['kick_message'] = $message;
$context['page_title'] = $txt['login'];
obExit();
// We should never get to this point, but if we did we wouldn't know the user isn't a guest.
trigger_error('Hacking attempt...', E_USER_ERROR);
}
示例14: is_not_guest
/**
* Require a user who is logged in. (not a guest.)
*
* What it does:
* - Checks if the user is currently a guest, and if so asks them to login with a message telling them why.
* - Message is what to tell them when asking them to login.
*
* @param string $message = ''
* @param boolean $is_fatal = true
*/
function is_not_guest($message = '', $is_fatal = true)
{
global $user_info, $txt, $context, $scripturl;
// Luckily, this person isn't a guest.
if (isset($user_info['is_guest']) && !$user_info['is_guest']) {
return true;
}
// People always worry when they see people doing things they aren't actually doing...
$_GET['action'] = '';
$_GET['board'] = '';
$_GET['topic'] = '';
writeLog(true);
// Just die.
if (isset($_REQUEST['xml']) || !$is_fatal) {
obExit(false);
}
// Attempt to detect if they came from dlattach.
if (ELK != 'SSI' && empty($context['theme_loaded'])) {
loadTheme();
}
// Never redirect to an attachment
if (strpos($_SERVER['REQUEST_URL'], 'dlattach') === false) {
$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];
}
// Load the Login template and language file.
loadLanguage('Login');
// Apparently we're not in a position to handle this now. Let's go to a safer location for now.
if (!Template_Layers::getInstance()->hasLayers()) {
$_SESSION['login_url'] = $scripturl . '?' . $_SERVER['QUERY_STRING'];
redirectexit('action=login');
} elseif (isset($_GET['api'])) {
return false;
} else {
loadTemplate('Login');
loadJavascriptFile('sha256.js', array('defer' => true));
$context['sub_template'] = 'kick_guest';
$context['robot_no_index'] = true;
}
// Use the kick_guest sub template...
$context['kick_message'] = $message;
$context['page_title'] = $txt['login'];
obExit();
// We should never get to this point, but if we did we wouldn't know the user isn't a guest.
trigger_error('Hacking attempt...', E_USER_ERROR);
}
示例15: is_not_guest
function is_not_guest($message = '')
{
global $user_info, $txt, $context, $scripturl;
// Luckily, this person isn't a guest.
if (!$user_info['is_guest']) {
return;
}
// People always worry when they see people doing things they aren't actually doing...
$_GET['action'] = '';
$_GET['board'] = '';
$_GET['topic'] = '';
writeLog(true);
// Just die.
if (isset($_REQUEST['xml'])) {
obExit(false);
}
// Attempt to detect if they came from dlattach.
if (!WIRELESS && SMF != 'SSI' && empty($context['theme_loaded'])) {
loadTheme();
}
// Never redirect to an attachment
if (strpos($_SERVER['REQUEST_URL'], 'dlattach') === false) {
$_SESSION['login_url'] = $_SERVER['REQUEST_URL'];
}
// Load the Login template and language file.
loadLanguage('Login');
// Are we in wireless mode?
if (WIRELESS) {
$context['login_error'] = $message ? $message : $txt['only_members_can_access'];
$context['sub_template'] = WIRELESS_PROTOCOL . '_login';
} elseif (empty($context['template_layers'])) {
$_SESSION['login_url'] = $scripturl . '?' . $_SERVER['QUERY_STRING'];
redirectexit('action=login');
} else {
loadTemplate('Login');
$context['sub_template'] = 'kick_guest';
$context['robot_no_index'] = true;
}
// Use the kick_guest sub template...
$context['kick_message'] = $message;
$context['page_title'] = $txt['login'];
obExit();
// We should never get to this point, but if we did we wouldn't know the user isn't a guest.
trigger_error('Hacking attempt...', E_USER_ERROR);
}