本文整理汇总了PHP中detectBrowser函数的典型用法代码示例。如果您正苦于以下问题:PHP detectBrowser函数的具体用法?PHP detectBrowser怎么用?PHP detectBrowser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了detectBrowser函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smf_main
function smf_main()
{
global $modSettings, $settings, $user_info, $board, $topic, $board_info, $maintenance, $sourcedir;
// Special case: session keep-alive, output a transparent pixel.
if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
header('Content-Type: image/gif');
die("GIF89a€!ù,D;");
}
// 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.
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);
}
// 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();
// Don't track stats of portal xml actions.
if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'portal' || !isset($_GET['xml'])) {
// Track forum statistics and hits...?
if (!empty($modSettings['hitStats'])) {
trackStats(array('hits' => '+'));
}
}
}
// Load SimplePortal.
sportal_init();
// 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', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn')))) {
require_once $sourcedir . '/Subs-Auth.php';
return 'KickGuest';
} elseif (empty($_REQUEST['action'])) {
// Go catch it boy! Catch it!
$sp_action = sportal_catch_action();
if ($sp_action) {
return $sp_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', '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'), 'forum' => array('BoardIndex.php', 'BoardIndex'), 'portal' => array('PortalMain.php', 'sportal_main'), '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));
if (!empty($context['disable_sp'])) {
unset($actionArray['portal'], $actionArray['forum']);
}
// 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];
}
示例2: loadTheme
//.........这里部分代码省略.........
}
// Determine the current smiley set and map it to a numeric id (parsed post cache needs this, because
// we don't want to left join with string matching
$smiley_sets = explode(',', $modSettings['smiley_sets_known']);
$user_info['smiley_set'] = !in_array($user_info['smiley_set'], $smiley_sets) && $user_info['smiley_set'] != 'none' || empty($modSettings['smiley_sets_enable']) ? !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'] : $user_info['smiley_set'];
if ($user_info['smiley_set'] == 'none') {
$user_info['smiley_set_id'] = 0;
} else {
$user_info['smiley_set_id'] = array_search($user_info['smiley_set'], $smiley_sets) + 1;
}
$context['user']['smiley_set'] = $user_info['smiley_set'];
// Some basic information...
if (!isset($context['html_headers'])) {
$context['html_headers'] = '';
}
$context['menu_separator'] = !empty($settings['use_image_buttons']) ? ' ' : ' | ';
$context['session_var'] = $_SESSION['session_var'];
$context['session_id'] = $_SESSION['session_value'];
$context['forum_name'] = $mbname;
$context['forum_name_html_safe'] = commonAPI::htmlspecialchars($context['forum_name']);
$context['header_logo_url_html_safe'] = empty($settings['header_logo_url']) ? '' : commonAPI::htmlspecialchars($settings['header_logo_url']);
$context['current_action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$context['current_subaction'] = isset($_REQUEST['sa']) ? $_REQUEST['sa'] : null;
if (isset($modSettings['load_average'])) {
$context['load_average'] = $modSettings['load_average'];
}
// Set some permission related settings.
$context['show_login_bar'] = $user_info['is_guest'] && !empty($modSettings['enableVBStyleLogin']);
// This determines the server... not used in many places, except for login fixing.
$context['server'] = array('is_iis' => isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false, 'is_apache' => isset($_SERVER['SERVER_SOFTWARE']) && (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false), 'is_lighttpd' => isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false, 'is_nginx' => isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false, 'is_cgi' => isset($_SERVER['SERVER_SOFTWARE']) && strpos(php_sapi_name(), 'cgi') !== false, 'is_windows' => strpos(PHP_OS, 'WIN') === 0, 'iso_case_folding' => ord(strtolower(chr(138))) === 154, 'complex_preg_chars' => 1);
// A bug in some versions of IIS under CGI (older ones) makes cookie setting not work with Location: headers.
$context['server']['needs_login_fix'] = $context['server']['is_cgi'] && $context['server']['is_iis'];
// Detect the browser. This is separated out because it's also used in attachment downloads
detectBrowser();
// Set the top level linktree up.
/*
array_unshift($context['linktree'], array(
'url' => URL::home(),
'name' => $context['forum_name_html_safe']
));
*/
// This allows sticking some HTML on the page output - useful for controls.
if (!isset($txt)) {
$txt = array();
}
$simpleActions = array('findmember', 'helpadmin', 'printpage', 'quotefast');
if (isset($_REQUEST['xml'])) {
loadLanguage('index+Modifications');
loadTemplate('Xml');
$context['template_layers'] = array();
} elseif (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], $simpleActions)) {
loadLanguage('index+Modifications');
$context['template_layers'] = array();
} else {
loadLanguage('index+Modifications');
// Custom templates to load, or just default?
$is_admin = isset($_REQUEST['action']) && $_REQUEST['action'] === 'admin';
$templates = array('index');
// Load each template...
foreach ($templates as $template) {
if (!$is_admin) {
loadTemplate($template);
} else {
loadAdminTemplate($template);
}
}
示例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: unset
$smarty->assign("T_BROWSERS", themes::$browsers);
$entityName = 'themes';
require "entity.php";
if (isset($_GET['set_browser']) && in_array($_GET['set_browser'], $legalValues) && eF_checkParameter($_GET['set_browser'], 'id') && isset($_GET['browser']) && in_array($_GET['browser'], array_keys(themes::$browsers))) {
try {
unset($_SESSION['s_theme']);
$theme = new themes($_GET['set_browser']);
foreach ($themes as $key => $value) {
//$value = new themes($value['id']);
unset($value->options['browsers'][$_GET['browser']]);
$value->persist();
}
$theme->options['browsers'][$_GET['browser']] = 1;
$theme->persist();
$url = '';
if (detectBrowser() == $_GET['browser']) {
if ($theme->options['sidebar_interface'] > 0) {
$url = basename($_SERVER['PHP_SELF']) . '?ctg=themes&tab=set_theme';
} else {
$url = basename($_SERVER['PHP_SELF'], '.php') . 'page.php?ctg=themes&tab=set_theme';
}
}
echo json_encode(array('status' => 1, 'browser' => $_GET['browser'], 'url' => $url));
} catch (Exception $e) {
handleAjaxExceptions($e);
}
exit;
}
if (isset($_GET['set_theme']) && in_array($_GET['set_theme'], $legalValues) && eF_checkParameter($_GET['set_theme'], 'id')) {
try {
unset($_SESSION['s_theme']);
示例5: array
$fields_log = array('users_LOGIN' => $_SESSION['s_login'], 'timestamp' => time(), 'session_ip' => eF_encodeIP($_SERVER['REMOTE_ADDR']));
/*
if (isset($log_comments)) { //If there is a $log_comments variable, it indicates the current action (i.e. the unit that the user saw)
$fields_log['action'] = $ctg;
$fields_log['comments'] = $log_comments;
($_SESSION['s_lessons_ID']) ? $fields_log['lessons_ID'] = $_SESSION['s_lessons_ID'] : $fields_log['lessons_ID'] = 0;
eF_insertTableData("logs", $fields_log);
} else { //Any other move, that has not set the $log_comments variable, is considered a 'lastmove' action
$fields_log['action'] = "lastmove";
$fields_log['comments'] = "";
($_SESSION['s_lessons_ID']) ? $fields_log['lessons_ID'] = $_SESSION['s_lessons_ID'] : $fields_log['lessons_ID'] = 0;
eF_deleteTableData("logs", "users_LOGIN='".$_SESSION['s_login']."' AND action='lastmove'"); //Only one lastmove action interests us, so delete any other
eF_insertTableData("logs", $fields_log);
}
*/
if (detectBrowser() == 'mobile') {
$load_editor = false;
}
$smarty->assign("T_HEADER_EDITOR", $load_editor);
//Specify whether we need to load the editor
/*
* Check if you should input the JS code to
* trigger sending the next notificatoin emails
* Since 3.6.0
*/
if (EfrontNotification::shouldSendNextNotifications()) {
$smarty->assign("T_TRIGGER_NEXT_NOTIFICATIONS_SEND", 1);
$_SESSION['send_next_notifications_now'] = 0;
// the msg that triggered the immediate send should be sent now
}
if (G_VERSIONTYPE != 'community') {
示例6: __generateSubcampo47
function __generateSubcampo47($data)
{
$_browser = detectBrowser();
$browser = $_browser['browser'] . "v" . $_browser['version'] . " " . $_browser['os'];
$hostname = "webCiticinemas";
$country = "MX";
$metodo_envio = "05";
$sku = " ";
$ip = env('REMOTE_ADDR');
$tel = " ";
$codigo_tel = " ";
return sprintf("%s|%s|%s|%s|%s|%s|%s|%s|%s", $data['email'], $hostname, $browser, $country, $metodo_envio, $sku, $ip, $tel, $codigo_tel);
}
示例7: loadTheme
//.........这里部分代码省略.........
$context['javascript_files'] = array();
}
if (!isset($context['css_files'])) {
$context['css_files'] = array();
}
if (!isset($context['javascript_inline'])) {
$context['javascript_inline'] = array('standard' => array(), 'defer' => array());
}
if (!isset($context['javascript_vars'])) {
$context['javascript_vars'] = array();
}
$context['menu_separator'] = !empty($settings['use_image_buttons']) ? ' ' : ' | ';
$context['session_var'] = $_SESSION['session_var'];
$context['session_id'] = $_SESSION['session_value'];
$context['forum_name'] = $mbname;
$context['forum_name_html_safe'] = $context['forum_name'];
$context['current_action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$context['current_subaction'] = isset($_REQUEST['sa']) ? $_REQUEST['sa'] : null;
$context['can_register'] = empty($modSettings['registration_method']) || $modSettings['registration_method'] != 3;
foreach (array('theme_header', 'upper_content') as $call) {
if (!isset($context[$call . '_callbacks'])) {
$context[$call . '_callbacks'] = array();
}
}
// Set some permission related settings.
if ($user_info['is_guest'] && !empty($modSettings['enableVBStyleLogin'])) {
$context['show_login_bar'] = true;
$context['theme_header_callbacks'][] = 'login_bar';
loadJavascriptFile('sha256.js', array('defer' => true));
}
// This determines the server... not used in many places, except for login fixing.
detectServer();
// Detect the browser. This is separated out because it's also used in attachment downloads
detectBrowser();
// Set the top level linktree up.
array_unshift($context['linktree'], array('url' => $scripturl, 'name' => $context['forum_name']));
// This allows sticking some HTML on the page output - useful for controls.
$context['insert_after_template'] = '';
// Just some mobile-friendly settings
if ($context['browser_body_id'] == 'mobile') {
// Disable the preview text.
$modSettings['message_index_preview'] = 0;
// Force the usage of click menu instead of a hover menu.
$options['use_click_menu'] = 1;
// No space left for a sidebar
$options['use_sidebar_menu'] = false;
// Disable the search dropdown.
$modSettings['search_dropdown'] = false;
}
if (!isset($txt)) {
$txt = array();
}
$simpleActions = array('findmember', 'quickhelp', 'printpage', 'quotefast', 'spellcheck');
call_integration_hook('integrate_simple_actions', array(&$simpleActions));
// Output is fully XML, so no need for the index template.
if (isset($_REQUEST['xml'])) {
loadLanguage('index+Addons');
// @todo added because some $settings in template_init are necessary even in xml mode. Maybe move template_init to a settings file?
loadTemplate('index');
loadTemplate('Xml');
Template_Layers::getInstance()->removeAll();
} elseif (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], $simpleActions)) {
loadLanguage('index+Addons');
Template_Layers::getInstance()->removeAll();
} else {
// Custom templates to load, or just default?
示例8: setupThemes
/**
* Setup themes
*
* This function sets up all the required constants and initiates objects
* accordingly, to initialize the current theme
*
* @since 3.6.0
*/
function setupThemes()
{
/** The default theme path*/
define("G_DEFAULTTHEMEPATH", G_THEMESPATH . "default/");
/** The default theme url*/
define("G_DEFAULTTHEMEURL", "themes/default/");
try {
$allThemes = themes::getAll();
if (isset($_GET['preview_theme'])) {
try {
$currentTheme = new themes($_GET['preview_theme']);
} catch (Exception $e) {
}
} elseif (isset($_SESSION['s_theme'])) {
if (!empty($allThemes[$_SESSION['s_theme']])) {
$currentTheme = $allThemes[$_SESSION['s_theme']];
} else {
$currentTheme = new themes($_SESSION['s_theme']);
}
} else {
if (!empty($allThemes[$GLOBALS['configuration']['theme']])) {
$currentTheme = $allThemes[$GLOBALS['configuration']['theme']];
} else {
$currentTheme = new themes($GLOBALS['configuration']['theme']);
}
$browser = detectBrowser();
foreach ($allThemes as $value) {
if (isset($value->options['browsers'][$browser])) {
try {
$browserTheme = $allThemes[$value->themes['id']];
$currentTheme = $browserTheme;
} catch (Exception $e) {
}
}
}
foreach (eF_loadAllModules(true, true) as $module) {
try {
if ($moduleTheme = $module->onSetTheme($currentTheme)) {
if (!$moduleTheme instanceof themes) {
$currentTheme = new themes($moduleTheme);
} else {
$currentTheme = $moduleTheme;
}
}
} catch (Exception $e) {
}
}
$_SESSION['s_theme'] = $currentTheme->{$currentTheme->entity}['id'];
}
} catch (Exception $e) {
try {
$result = eF_getTableData("themes", "*", "name = 'default'");
if (sizeof($result) == 0) {
throw new Exception();
//To be caught right below. This way, the catch() code gets executed either if the result is empty or if there is a db error
}
} catch (Exception $e) {
$file = new EfrontFile(G_DEFAULTTHEMEPATH . "theme.xml");
themes::create(themes::parseFile($file));
}
$currentTheme = new themes('default');
}
$currentThemeName = $currentTheme->{$currentTheme->entity}['name'];
/**The current theme*/
define("G_CURRENTTHEME", $currentThemeName);
/** The current theme path*/
define("G_CURRENTTHEMEPATH", !isset($currentTheme->remote) || !$currentTheme->remote ? G_THEMESPATH . $currentTheme->{$currentTheme->entity}['path'] : $currentTheme->{$currentTheme->entity}['path']);
/** The current theme url*/
define("G_CURRENTTHEMEURL", !isset($currentTheme->remote) || !$currentTheme->remote ? "themes/" . $currentTheme->themes['path'] : $currentTheme->{$currentTheme->entity}['path']);
/** The external pages path*/
define("G_EXTERNALPATH", rtrim(G_CURRENTTHEMEPATH, '/') . "/external/");
is_dir(G_EXTERNALPATH) or mkdir(G_EXTERNALPATH, 0755);
/** The external pages link*/
define("G_EXTERNALURL", rtrim(G_CURRENTTHEMEURL, '/') . "/external/");
if ($fp = fopen(G_CURRENTTHEMEPATH . "css/css_global.css", 'r')) {
/** The current theme's css*/
define("G_CURRENTTHEMECSS", G_CURRENTTHEMEURL . "css/css_global.css?build=" . G_BUILD);
fclose($fp);
} else {
/** The current theme's css*/
define("G_CURRENTTHEMECSS", G_DEFAULTTHEMEURL . "css/css_global.css?build=" . G_BUILD);
}
/** The folder where the template compiled and cached files are kept*/
define("G_THEMECACHE", G_ROOTPATH . "libraries/smarty/themes_cache/");
/** The folder of the current theme's compiled files*/
define("G_CURRENTTHEMECACHE", G_THEMECACHE . $currentThemeName . "/");
/** The full filesystem path of the images directory*/
define("G_IMAGESPATH", G_CURRENTTHEMEPATH . "images/");
/** The full filesystem path of the images directory, in the default theme*/
define("G_DEFAULTIMAGESPATH", G_DEFAULTTHEMEPATH . "images/");
/** The users' avatars directory*/
define("G_AVATARSPATH", G_IMAGESPATH . "avatars/");
//.........这里部分代码省略.........
示例9: sendFile
/**
* Send file to browser
*
* This function reads a file from disk and outputs it to the client, sending appropriate headers
* @param boolena $attachment Whether to send as an attachment or inline
* @since 3.6.3
* @access public
*/
public function sendFile($attachment = false)
{
session_write_close();
//to allow the browser proceeding to other pages as well
if ($attachment) {
$browser = detectBrowser();
//because of #834
if ($browser != 'firefox') {
$this['name'] = urlencode(str_replace(" ", "_", $this['name']));
} else {
$this['name'] = str_replace(" ", "_", $this['name']);
}
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename="' . $this['name'] . '"');
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header("Content-Type: application/force-download");
header("Content-Type: application/download");
if (defined('NO_OUTPUT_BUFFERING') || !$GLOBALS['configuration']['gz_handler']) {
//This does not cooperate well with gzhandler
header("Content-Length: " . filesize($this['path']));
}
} else {
header("Content-Description: File Transfer");
header("Content-Type: {$this['mime_type']}");
header('Content-Disposition: inline; filename="' . $this['name'] . '"');
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
// readfile($this['path']);
$this->readfileChunked($this['path']);
exit;
}
示例10: detectBrowser
<?php
require_once "online/utils.php";
//Detect browser
$outdated = false;
$browser = detectBrowser();
if ($browser != false) {
if (checkBrowser($browser) == false) {
$outdated = true;
}
} else {
$outdated = true;
}
//Outdated browser
if ($outdated) {
echo "<meta http-equiv=\"Refresh\" content=\"0; URL=offline/outdated.php\">";
exit;
}
//Connected or not
$state = check_connected();
//If not connected
if (!$state) {
/*
* User connection
*
*/
//If validation of the Sign in form
if (isset($_POST["go"])) {
//Login & pass from form
$login = strtolower(checkInput("post", "login", "/^[a-zA-Z0-9]{1,}\$/"));
$password = checkInput("post", "password", "/.*/");
示例11: pbe_prepare_text
/**
* Converts a post/pm to text (markdown) for sending in an email
*
* - censors everything it will send
* - pre-converts select bbc tags to html so they can be markdowned properly
* - uses parse-bbc to convert remaining bbc to html
* - uses html2markdown to convert html to markdown text suitable for email
* - if someone wants to write a direct bbc->markdown conversion tool, I'm listening!
*
* @package Maillist
* @param string $message
* @param string $subject
* @param string $signature
*/
function pbe_prepare_text(&$message, &$subject = '', &$signature = '')
{
global $context;
loadLanguage('Maillist');
// Check on some things needed by parse_bbc as an autotask does not load them
if (!isset($context['browser'])) {
detectBrowser();
}
// Server?
if (!isset($context['server'])) {
detectServer();
}
// Clean it up.
censorText($message);
censorText($signature);
$subject = un_htmlspecialchars($subject);
censorText($subject);
// Convert bbc [quotes] before we go to parsebbc so they are easier to plain-textify later
$message = preg_replace_callback('~(\\[quote)\\s?author=(.*)\\s?link=(.*)\\s?date=([0-9]{10})(\\])~sU', 'quote_callback', $message);
$message = preg_replace_callback('~(\\[quote)\\s?author=(.*)\\s?date=([0-9]{10})\\s?link=(.*)(\\])~sU', 'quote_callback_2', $message);
$message = preg_replace('~(\\[quote\\s?\\])~sU', "\n" . '<blockquote>', $message);
$message = str_replace('[/quote]', "</blockquote>\n\n", $message);
// Prevent img tags from getting linked
$message = preg_replace('~\\[img\\](.*?)\\[/img\\]~is', '`<img src="\\1">', $message);
// Leave code tags as code tags for the conversion
$message = preg_replace('~\\[code(.*?)\\](.*?)\\[/code\\]~is', '`<code\\1>\\2`</code>', $message);
// Allow addons to account for their own unique bbc additions e.g. gallery's etc.
call_integration_hook('integrate_mailist_pre_parsebbc', array(&$message));
// Convert the remaining bbc to html
$message = parse_bbc($message, false);
// Change list style to something standard to make text conversion easier
$message = preg_replace('~<ul class=\\"bbc_list\\" style=\\"list-style-type: decimal;\\">(.*?)</ul>~si', '<ol>\\1</ol>', $message);
// Do we have any tables? if so we add in th's based on the number of cols.
$table_content = array();
if (preg_match_all('~<table class="bbc_table">(.*?)</tr>.*?</table>~si', $message, $table_content, PREG_SET_ORDER)) {
// The answer is yes ... work on each one
foreach ($table_content as $table_temp) {
$cols = substr_count($table_temp[1], '<td>');
$table_header = '';
// Build the th line for this table
for ($i = 1; $i <= $cols; $i++) {
$table_header .= '<th>- ' . $i . ' -</th>';
}
// Insert it in to the table tag
$table_header = '<tr>' . $table_header . '</tr>';
$new_table = str_replace('<table class="bbc_table">', '<br /><table>' . $table_header, $table_temp[0]);
// Replace the old table with the new th enabled one
$message = str_replace($table_temp[0], $new_table, $message);
}
}
// Allow addons to account for their own unique bbc additions e.g. gallery's etc.
call_integration_hook('integrate_mailist_pre_markdown', array(&$message));
// Convert the protected (hidden) entities back for the final conversion
$message = strtr($message, array('[' => '[', ']' => ']', '`<' => '<'));
// Convert this to text (markdown)
require_once SUBSDIR . '/Html2Md.class.php';
$mark_down = new Html_2_Md($message);
$message = $mark_down->get_markdown();
// Finally the sig, its goes as just plain text
if ($signature !== '') {
call_integration_hook('integrate_mailist_pre_sig_parsebbc', array(&$signature));
$signature = parse_bbc($signature, false);
$signature = trim(un_htmlspecialchars(strip_tags(strtr($signature, array('</tr>' => " \n", '<br />' => " \n", '</div>' => "\n", '</li>' => " \n", '[' => '[', ']' => ']')))));
}
return;
}