本文整理汇总了PHP中eZSys::indexFile方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::indexFile方法的具体用法?PHP eZSys::indexFile怎么用?PHP eZSys::indexFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::indexFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($process, $event)
{
if (!isset($_POST['CompletePublishing'])) {
$index = eZSys::indexFile(true);
$requestUri = eZSys::indexFile(false) . eZSys::requestUri();
$replace = "@" . preg_quote($index) . "@i";
$requestUri = preg_replace(array($replace), array(''), $requestUri, 1);
$process->Template = array('templateName' => 'file:' . dirname(__FILE__) . basename(__FILE__, '.php') . '.tpl', 'templateVars' => array('uri' => $requestUri), 'path' => array(array('url' => false, 'text' => 'Workflow event regression: fetch template repeat')));
return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
} else {
return eZWorkflowType::STATUS_ACCEPTED;
}
}
示例2: __construct
public function __construct(array $settings = array())
{
$this->settings = $settings + array('use-cache-headers' => true, 'max-age' => 86400, 'siteaccess' => null, 'use-exceptions' => false);
unset($settings);
require_once __DIR__ . '/treemenu_functions.php';
$this->setUseExceptions($this->settings['use-exceptions']);
header('X-Powered-By: ' . eZPublishSDK::EDITION . ' (index_treemenu)');
if ($this->settings['use-cache-headers'] === true) {
define('MAX_AGE', $this->settings['max-age']);
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + MAX_AGE) . ' GMT');
header('Cache-Control: max-age=' . MAX_AGE);
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) . ' GMT');
header('Pragma: ');
exit;
}
}
// Tweaks ini filetime checks if not defined!
// This makes ini system not check modified time so
// that index_treemenu.php can assume that index.php does
// this regular enough, set in config.php to override.
if (!defined('EZP_INI_FILEMTIME_CHECK')) {
define('EZP_INI_FILEMTIME_CHECK', false);
}
eZExecution::addFatalErrorHandler(function () {
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
});
eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
// Trick to get eZSys working with a script other than index.php (while index.php still used in generated URLs):
$_SERVER['SCRIPT_FILENAME'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['SCRIPT_FILENAME']);
$_SERVER['PHP_SELF'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['PHP_SELF']);
$ini = eZINI::instance();
$timezone = $ini->variable('TimeZoneSettings', 'TimeZone');
if ($timezone) {
putenv("TZ={$timezone}");
}
// init uri code
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
eZSys::init('index.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
$this->uri = eZURI::instance(eZSys::requestURI());
$GLOBALS['eZRequestedURI'] = $this->uri;
// Check for extension
eZExtension::activateExtensions('default');
// load siteaccess
// Use injected siteaccess if available or match it internally.
$this->access = isset($this->settings['siteaccess']) ? $this->settings['siteaccess'] : eZSiteAccess::match($this->uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
eZSiteAccess::change($this->access);
// Check for new extension loaded by siteaccess
eZExtension::activateExtensions('access');
}
示例3: exitWithInternalError
// init uri code
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable( 'REQUEST_URI' );
eZSys::init( 'index.php', $ini->variable( 'SiteAccessSettings', 'ForceVirtualHost' ) === 'true' );
$uri = eZURI::instance( eZSys::requestURI() );
$GLOBALS['eZRequestedURI'] = $uri;
// Check for extension
eZExtension::activateExtensions( 'default' );
// load siteaccess
$access = eZSiteAccess::match( $uri,
eZSys::hostname(),
eZSys::serverPort(),
eZSys::indexFile() );
$access = eZSiteAccess::change( $access );
$GLOBALS['eZCurrentAccess'] = $access;
// Check for new extension loaded by siteaccess
eZExtension::activateExtensions( 'access' );
$db = eZDB::instance();
if ( $db->isConnected() )
{
eZSession::start();
}
else
{
exitWithInternalError();
return;
示例4: instance
/**
* Returns a shared instance of the eZUser class pr $id value.
* If user can not be fetched, then anonymous user is returned and
* a warning trown, if anonymous user can not be fetched, then NoUser
* is returned and another warning is thrown.
*
* @param int|false $id On false: Gets current user id from session
* or from {@link eZUser::anonymousId()} if not set.
* @return eZUser
*/
static function instance($id = false)
{
if (!empty($GLOBALS["eZUserGlobalInstance_{$id}"])) {
return $GLOBALS["eZUserGlobalInstance_{$id}"];
}
$userId = $id;
$currentUser = null;
$http = eZHTTPTool::instance();
$anonymousUserID = self::anonymousId();
$sessionHasStarted = eZSession::hasStarted();
// If not specified get the current user
if ($userId === false) {
if ($sessionHasStarted) {
$userId = $http->sessionVariable('eZUserLoggedInID');
if (!is_numeric($userId)) {
$userId = $anonymousUserID;
eZSession::setUserID($userId);
$http->setSessionVariable('eZUserLoggedInID', $userId);
}
} else {
$userId = $anonymousUserID;
eZSession::setUserID($userId);
}
}
// Check user cache (this effectivly fetches user from cache)
// user not found if !isset( isset( $userCache['info'][$userId] ) )
$userCache = self::getUserCacheByUserId($userId);
if (isset($userCache['info'][$userId])) {
$userArray = $userCache['info'][$userId];
if (is_numeric($userArray['contentobject_id'])) {
$currentUser = new eZUser($userArray);
$currentUser->setUserCache($userCache);
}
}
$ini = eZINI::instance();
// Check if:
// - the user has not logged out,
// - the user is not logged in,
// - and if a automatic single sign on plugin is enabled.
if (!self::$userHasLoggedOut && is_object($currentUser) && !$currentUser->isRegistered()) {
$ssoHandlerArray = $ini->variable('UserSettings', 'SingleSignOnHandlerArray');
if (!empty($ssoHandlerArray)) {
$ssoUser = false;
foreach ($ssoHandlerArray as $ssoHandler) {
$className = 'eZ' . $ssoHandler . 'SSOHandler';
if (class_exists($className)) {
$impl = new $className();
$ssoUser = $impl->handleSSOLogin();
// If a user was found via SSO, then use it
if ($ssoUser !== false) {
$currentUser = $ssoUser;
$userId = $currentUser->attribute('contentobject_id');
$userInfo = array();
$userInfo[$userId] = array('contentobject_id' => $userId, 'login' => $currentUser->attribute('login'), 'email' => $currentUser->attribute('email'), 'password_hash' => $currentUser->attribute('password_hash'), 'password_hash_type' => $currentUser->attribute('password_hash_type'));
eZSession::setUserID($userId);
$http->setSessionVariable('eZUserLoggedInID', $userId);
eZUser::updateLastVisit($userId);
eZUser::setCurrentlyLoggedInUser($currentUser, $userId);
eZHTTPTool::redirect(eZSys::wwwDir() . eZSys::indexFile(false) . eZSys::requestURI() . eZSys::queryString(), array(), 302);
eZExecution::cleanExit();
}
} else {
eZDebug::writeError("Undefined ssoHandler class: {$className}", __METHOD__);
}
}
}
}
if ($userId != $anonymousUserID) {
$sessionInactivityTimeout = $ini->variable('Session', 'ActivityTimeout');
if (!isset($GLOBALS['eZSessionIdleTime'])) {
eZUser::updateLastVisit($userId);
} else {
$sessionIdle = $GLOBALS['eZSessionIdleTime'];
if ($sessionIdle > $sessionInactivityTimeout) {
eZUser::updateLastVisit($userId);
}
}
}
if (!$currentUser) {
$currentUser = eZUser::fetch(self::anonymousId());
eZDebug::writeWarning('User not found, returning anonymous');
}
if (!$currentUser) {
$currentUser = new eZUser(array('id' => -1, 'login' => 'NoUser'));
eZDebug::writeWarning('Anonymous user not found, returning NoUser');
}
$GLOBALS["eZUserGlobalInstance_{$id}"] = $currentUser;
return $currentUser;
}
示例5: compilationFilename
static function compilationFilename($key, $resourceData)
{
$internalCharset = eZTextCodec::internalCharset();
$templateFilepath = $resourceData['template-filename'];
$extraName = '';
if (preg_match("#^.+/(.*)\\.tpl\$#", $templateFilepath, $matches)) {
$extraName = $matches[1] . '-';
} else {
if (preg_match("#^(.*)\\.tpl\$#", $templateFilepath, $matches)) {
$extraName = $matches[1] . '-';
}
}
$accessText = false;
if (isset($GLOBALS['eZCurrentAccess']['name'])) {
$accessText = '-' . $GLOBALS['eZCurrentAccess']['name'];
}
$locale = eZLocale::instance();
$language = $locale->localeFullCode();
$http = eZHTTPTool::instance();
$useFullUrlText = $http->UseFullUrl ? 'full' : 'relative';
$pageLayoutVariable = "";
if (isset($GLOBALS['eZCustomPageLayout'])) {
$pageLayoutVariable = $GLOBALS['eZCustomPageLayout'];
}
$ini = eZINI::instance();
$shareTemplates = $ini->hasVariable('TemplateSettings', 'ShareCompiledTemplates') ? $ini->variable('TemplateSettings', 'ShareCompiledTemplates') == 'enabled' : false;
if ($shareTemplates) {
$cacheFileKey = $key . '-' . $language;
} else {
$cacheFileKey = $key . '-' . $internalCharset . '-' . $language . '-' . $useFullUrlText . $accessText . "-" . $pageLayoutVariable . '-' . eZSys::indexFile();
}
$cacheFileName = $extraName . md5($cacheFileKey) . '.php';
return $cacheFileName;
}
示例6: process
/**
* This is a hook which is called by the language switcher module on
* implementation classes.
*
* In this implementation it is doing initialisation as an example.
*
* @return void
*/
public function process()
{
$saIni = $this->getSiteAccessIni();
$this->destinationLocale = $saIni->variable('RegionalSettings', 'ContentObjectLocale');
// Detect the type of siteaccess we are dealing with. Initially URI and Host are supported.
// We don't want the siteaccess part here, since we are inserting our siteaccess name.
$indexFile = trim(eZSys::indexFile(false), '/');
switch ($GLOBALS['eZCurrentAccess']['type']) {
case eZSiteAccess::TYPE_URI:
eZURI::transformURI($host, true, 'full');
break;
default:
$host = $saIni->variable('SiteSettings', 'SiteURL');
$host = eZSys::serverProtocol() . "://" . $host;
break;
}
$this->baseDestinationUrl = "{$host}{$indexFile}";
}
示例7: __construct
/**
* @param array $settings
* @param null $responseWriterClass Name of the ezpRestHttpResponseWriter implementation to use during request
*/
public function __construct(array $settings = array(), $responseWriterClass = null)
{
$this->responseWriterClass = $responseWriterClass;
if (isset($settings['injected-settings'])) {
$injectedSettings = array();
foreach ($settings['injected-settings'] as $keySetting => $injectedSetting) {
list($file, $section, $setting) = explode('/', $keySetting);
$injectedSettings[$file][$section][$setting] = $injectedSetting;
}
// Those settings override anything else in local .ini files and their overrides
eZINI::injectSettings($injectedSettings);
}
if (isset($settings['injected-merge-settings'])) {
$injectedSettings = array();
foreach ($settings['injected-merge-settings'] as $keySetting => $injectedSetting) {
list($file, $section, $setting) = explode('/', $keySetting);
$injectedSettings[$file][$section][$setting] = $injectedSetting;
}
// Those settings override anything else in local .ini files and their overrides
eZINI::injectMergeSettings($injectedSettings);
}
$this->settings = $settings + array('use-cache-headers' => true, 'max-age' => 86400, 'siteaccess' => null, 'use-exceptions' => false);
unset($settings, $injectedSettings, $file, $section, $setting, $keySetting, $injectedSetting);
// lazy loaded database driver
include __DIR__ . '/lazy.php';
$this->setUseExceptions($this->settings['use-exceptions']);
// Tweaks ini filetime checks if not defined!
// This makes ini system not check modified time so
// that index_treemenu.php can assume that index.php does
// this regular enough, set in config.php to override.
if (!defined('EZP_INI_FILEMTIME_CHECK')) {
define('EZP_INI_FILEMTIME_CHECK', false);
}
eZExecution::addFatalErrorHandler(function () {
if (!headers_sent()) {
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
}
});
eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
// Trick to get eZSys working with a script other than index.php (while index.php still used in generated URLs):
$_SERVER['SCRIPT_FILENAME'] = str_replace('/index_rest.php', '/index.php', $_SERVER['SCRIPT_FILENAME']);
$_SERVER['PHP_SELF'] = str_replace('/index_rest.php', '/index.php', $_SERVER['PHP_SELF']);
$ini = eZINI::instance();
$timezone = $ini->variable('TimeZoneSettings', 'TimeZone');
if ($timezone) {
putenv("TZ={$timezone}");
}
eZDebug::setHandleType(eZDebug::HANDLE_NONE);
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
$ini = eZINI::instance();
eZSys::init('index_rest.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') == 'true');
$uri = eZURI::instance(eZSys::requestURI());
$GLOBALS['eZRequestedURI'] = $uri;
// load extensions
eZExtension::activateExtensions('default');
require_once __DIR__ . '/restkernel_functions.php';
// set siteaccess from X-Siteaccess header if given and exists
if (isset($_SERVER['HTTP_X_SITEACCESS']) && eZSiteAccess::exists($_SERVER['HTTP_X_SITEACCESS'])) {
$access = array('name' => $_SERVER['HTTP_X_SITEACCESS'], 'type' => eZSiteAccess::TYPE_STATIC);
} else {
$access = eZSiteAccess::match($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
}
eZSiteAccess::change($access);
// load siteaccess extensions
eZExtension::activateExtensions('access');
// Now that all extensions are activated and siteaccess has been changed, reset
// all eZINI instances as they may not take into account siteaccess specific settings.
eZINI::resetAllInstances(false);
if (ezpRestDebug::isDebugEnabled()) {
$debug = ezpRestDebug::getInstance();
$debug->updateDebugSettings();
}
}
示例8: generateViewCacheFile
static function generateViewCacheFile($user, $nodeID, $offset, $layout, $language, $viewMode, $viewParameters = false, $cachedViewPreferences = false, $viewCacheTweak = '')
{
$cacheNameExtra = '';
$ini = eZINI::instance();
if (!$language) {
$language = false;
}
if (!$viewCacheTweak && $ini->hasVariable('ContentSettings', 'ViewCacheTweaks')) {
$viewCacheTweaks = $ini->variable('ContentSettings', 'ViewCacheTweaks');
if (isset($viewCacheTweaks[$nodeID])) {
$viewCacheTweak = $viewCacheTweaks[$nodeID];
} else {
if (isset($viewCacheTweaks['global'])) {
$viewCacheTweak = $viewCacheTweaks['global'];
}
}
}
// should we use current siteaccess or let several siteaccesse share cache?
if (strpos($viewCacheTweak, 'ignore_siteaccess_name') === false) {
$currentSiteAccess = $GLOBALS['eZCurrentAccess']['name'];
} else {
$currentSiteAccess = $ini->variable('SiteSettings', 'DefaultAccess');
}
$cacheHashArray = array($nodeID, $viewMode, $language, $offset, $layout);
// several user related cache tweaks
if (strpos($viewCacheTweak, 'ignore_userroles') === false) {
$cacheHashArray[] = implode('.', $user->roleIDList());
}
if (strpos($viewCacheTweak, 'ignore_userlimitedlist') === false) {
$cacheHashArray[] = implode('.', $user->limitValueList());
}
if (strpos($viewCacheTweak, 'ignore_discountlist') === false) {
$cacheHashArray[] = implode('.', eZUserDiscountRule::fetchIDListByUserID($user->attribute('contentobject_id')));
}
$cacheHashArray[] = eZSys::indexFile();
// Add access type to cache hash if current access is uri type (so uri and host doesn't share cache)
if (strpos($viewCacheTweak, 'ignore_siteaccess_type') === false && $GLOBALS['eZCurrentAccess']['type'] === eZSiteAccess::TYPE_URI) {
$cacheHashArray[] = eZSiteAccess::TYPE_URI;
}
// Make the cache unique for every logged in user
if (strpos($viewCacheTweak, 'pr_user') !== false and !$user->isAnonymous()) {
$cacheNameExtra = $user->attribute('contentobject_id') . '-';
}
// Make the cache unique for every case of view parameters
if (strpos($viewCacheTweak, 'ignore_viewparameters') === false && $viewParameters) {
$vpString = '';
ksort($viewParameters);
foreach ($viewParameters as $key => $value) {
if (!$key || $key === '_custom') {
continue;
}
$vpString .= 'vp:' . $key . '=' . $value;
}
$cacheHashArray[] = $vpString;
}
// Make the cache unique for every case of the preferences
if ($cachedViewPreferences === false) {
$depPreferences = $ini->variable('ContentSettings', 'CachedViewPreferences');
} else {
$depPreferences = $cachedViewPreferences;
}
if (strpos($viewCacheTweak, 'ignore_userpreferences') === false && isset($depPreferences[$viewMode])) {
$depPreferences = explode(';', $depPreferences[$viewMode]);
$pString = '';
// Fetch preferences for the specified user
$preferences = eZPreferences::values($user);
foreach ($depPreferences as $pref) {
$pref = explode('=', $pref);
if (isset($pref[0])) {
if (isset($preferences[$pref[0]])) {
$pString .= 'p:' . $pref[0] . '=' . $preferences[$pref[0]] . ';';
} else {
if (isset($pref[1])) {
$pString .= 'p:' . $pref[0] . '=' . $pref[1] . ';';
}
}
}
}
$cacheHashArray[] = $pString;
}
$cacheFile = $nodeID . '-' . $cacheNameExtra . md5(implode('-', $cacheHashArray)) . '.cache';
$extraPath = eZDir::filenamePath($nodeID);
$cacheDir = eZDir::path(array(eZSys::cacheDirectory(), $ini->variable('ContentSettings', 'CacheDir'), $currentSiteAccess, $extraPath));
$cachePath = eZDir::path(array($cacheDir, $cacheFile));
return array('cache_path' => $cachePath, 'cache_dir' => $cacheDir, 'cache_file' => $cacheFile);
}
示例9: str_replace
$_SERVER['SCRIPT_FILENAME'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['SCRIPT_FILENAME']);
$_SERVER['PHP_SELF'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['PHP_SELF']);
$ini = eZINI::instance();
$timezone = $ini->variable('TimeZoneSettings', 'TimeZone');
if ($timezone) {
putenv("TZ={$timezone}");
}
// init uri code
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
eZSys::init('index.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
$uri = eZURI::instance(eZSys::requestURI());
$GLOBALS['eZRequestedURI'] = $uri;
// Check for extension
eZExtension::activateExtensions('default');
// load siteaccess
$access = eZSiteAccess::match($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
$access = eZSiteAccess::change($access);
$GLOBALS['eZCurrentAccess'] = $access;
// Check for new extension loaded by siteaccess
eZExtension::activateExtensions('access');
$db = eZDB::instance();
if ($db->isConnected()) {
eZSession::start();
} else {
exitWithInternalError();
return;
}
$moduleINI = eZINI::instance('module.ini');
$globalModuleRepositories = $moduleINI->variable('ModuleSettings', 'ModuleRepositories');
eZModule::setGlobalPathList($globalModuleRepositories);
$module = eZModule::exists('content');
示例10: testIndexFileRemoveSiteAccessIfDefaultAccessDisabled2
/**
* Test eZSys $AccessPath as it works as of 4.4 with propertied to
* define scope of path with RemoveSiteAccessIfDefaultAccess=disabled
*/
public function testIndexFileRemoveSiteAccessIfDefaultAccessDisabled2()
{
// TEST SETUP --------------------------------------------------------
$ini = eZINI::instance();
$defaultAccess = $ini->variable( 'SiteSettings', 'DefaultAccess' );
$this->setSiteAccess( $defaultAccess );
// Make sure to preserve ini settings in case other tests depend on them
$orgRemoveSiteaccess = $ini->variable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess' );
// DISABLE RemoveSiteAccessIfDefaultAccess
$ini->setVariable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess', 'disabled' );
// -------------------------------------------------------------------
// TEST --------------------------------------------------------------
$indexFile = eZSys::indexFile();
self::assertEquals( "/$defaultAccess", $indexFile );
eZSys::setAccessPath( array( 'testing', 'indexFile' ), 'test-path', false );
$indexFile = eZSys::indexFile();
self::assertEquals( "/$defaultAccess/testing/indexFile", $indexFile );
// -------------------------------------------------------------------
// TEST TEAR DOWN ----------------------------------------------------
$ini->setVariable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess', $orgRemoveSiteaccess );
eZSys::clearAccessPath( false );
// -------------------------------------------------------------------
}
示例11: __construct
/**
* Constructs an ezpKernel instance
*/
public function __construct(array $settings = array())
{
$this->settings = $settings + array('siteaccess' => null, 'use-exceptions' => false, 'session' => null);
unset($settings);
require_once __DIR__ . '/global_functions.php';
$this->setUseExceptions($this->settings['use-exceptions']);
$GLOBALS['eZSiteBasics'] = array('external-css' => true, 'show-page-layout' => true, 'module-run-required' => true, 'policy-check-required' => true, 'policy-check-omit-list' => array(), 'url-translator-allowed' => true, 'validity-check-required' => false, 'user-object-required' => true, 'session-required' => true, 'db-required' => false, 'no-cache-adviced' => false, 'site-design-override' => false, 'module-repositories' => array());
$this->siteBasics =& $GLOBALS['eZSiteBasics'];
// Reads settings from i18n.ini and passes them to eZTextCodec.
list($i18nSettings['internal-charset'], $i18nSettings['http-charset'], $i18nSettings['mbstring-extension']) = eZINI::instance('i18n.ini')->variableMulti('CharacterSettings', array('Charset', 'HTTPCharset', 'MBStringExtension'), array(false, false, 'enabled'));
eZTextCodec::updateSettings($i18nSettings);
// @todo Change so code only supports utf-8 in 5.0?
// Initialize debug settings.
eZUpdateDebugSettings();
// Set the different permissions/settings.
$ini = eZINI::instance();
// Set correct site timezone
$timezone = $ini->variable("TimeZoneSettings", "TimeZone");
if ($timezone) {
date_default_timezone_set($timezone);
}
list($iniFilePermission, $iniDirPermission) = $ini->variableMulti('FileSettings', array('StorageFilePermissions', 'StorageDirPermissions'));
// OPTIMIZATION:
// Sets permission array as global variable, this avoids the eZCodePage include
$GLOBALS['EZCODEPAGEPERMISSIONS'] = array('file_permission' => octdec($iniFilePermission), 'dir_permission' => octdec($iniDirPermission), 'var_directory' => eZSys::cacheDirectory());
unset($i18nSettings, $timezone, $iniFilePermission, $iniDirPermission);
eZExecution::addCleanupHandler(function () {
if (class_exists('eZDB', false) && eZDB::hasInstance()) {
eZDB::instance()->setIsSQLOutputEnabled(false);
}
});
eZExecution::addFatalErrorHandler(function () {
header("HTTP/1.1 500 Internal Server Error");
echo "<b>Fatal error</b>: The web server did not finish its request<br/>";
if (ini_get('display_errors') == 1) {
if (eZDebug::isDebugEnabled()) {
echo "<p>The execution of eZ Publish was abruptly ended, the debug output is present below.</p>";
} else {
echo "<p>Debug information can be found in the log files normally placed in var/log/* or by enabling 'DebugOutput' in site.ini</p>";
}
} else {
echo "<p>Contact website owner with current url and info on what you did, and owner will be able to debug the issue further (by enabling 'display_errors' in php.ini).</p>";
}
eZDisplayResult(null);
});
eZExecution::setCleanExit();
// Enable this line to get eZINI debug output
// eZINI::setIsDebugEnabled( true );
// Enable this line to turn off ini caching
// eZINI::setIsCacheEnabled( false);
if ($ini->variable('RegionalSettings', 'Debug') === 'enabled') {
eZLocale::setIsDebugEnabled(true);
}
eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
// Initialize basic settings, such as vhless dirs and separators
eZSys::init('index.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
// Check for extension
eZExtension::activateExtensions('default');
// Extension check end
// Use injected siteaccess if available or match it internally.
$this->access = isset($this->settings['siteaccess']) ? $this->settings['siteaccess'] : eZSiteAccess::match(eZURI::instance(eZSys::requestURI()), eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
eZSiteAccess::change($this->access);
eZDebugSetting::writeDebug('kernel-siteaccess', $this->access, 'current siteaccess');
// Check for siteaccess extension
eZExtension::activateExtensions('access');
// Siteaccess extension check end
// Now that all extensions are activated and siteaccess has been changed, reset
// all eZINI instances as they may not take into account siteaccess specific settings.
eZINI::resetAllInstances(false);
ezpEvent::getInstance()->registerEventListeners();
$this->mobileDeviceDetect = new ezpMobileDeviceDetect(ezpMobileDeviceDetectFilter::getFilter());
if ($this->mobileDeviceDetect->isEnabled()) {
$this->mobileDeviceDetect->process();
if ($this->mobileDeviceDetect->isMobileDevice()) {
$this->mobileDeviceDetect->redirect();
}
}
// eZSession::setSessionArray( $mainRequest->session );
/**
* Check for activating Debug by user ID (Final checking. The first was in eZDebug::updateSettings())
* @uses eZUser::instance() So needs to be executed after eZSession::start()|lazyStart()
*/
eZDebug::checkDebugByUser();
}
示例12: putenv
putenv("TZ={$timezone}");
}
// init uri code
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
eZSys::init('index.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
$uri = eZURI::instance(eZSys::requestURI());
$GLOBALS['eZRequestedURI'] = $uri;
// Check for extension
eZExtension::activateExtensions('default');
// load siteaccess
if (method_exists('eZSiteAccess', 'match') && method_exists('eZSiteAccess', 'change')) {
$access = eZSiteAccess::match($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
$access = eZSiteAccess::change($access);
} else {
include_once 'access.php';
$access = accessType($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
$access = changeAccess($access);
}
$GLOBALS['eZCurrentAccess'] = $access;
// Check for new extension loaded by siteaccess
eZExtension::activateExtensions('access');
$db = eZDB::instance();
if ($db->isConnected()) {
eZSession::start();
} else {
exitWithInternalError();
return;
}
$moduleINI = eZINI::instance('module.ini');
$globalModuleRepositories = $moduleINI->variable('ModuleSettings', 'ModuleRepositories');
$globalModuleRepositories[] = 'extension/eztags/modules';
示例13: while
$step = $stepData->step(0);
//step contains file and class
}
}
}
$done = false;
$result = null;
while (!$done && $step != null) {
// Some common variables for all steps
$tpl->setVariable("script", eZSys::serverVariable('PHP_SELF'));
$siteBasics = $GLOBALS['eZSiteBasics'];
$useIndex = $siteBasics['validity-check-required'];
if ($useIndex) {
$script = eZSys::wwwDir() . eZSys::indexFileName();
} else {
$script = eZSys::indexFile() . "/setup/{$partName}";
}
$tpl->setVariable('script', $script);
$tpl->setVariable("version", array("text" => eZPublishSDK::version(), "major" => eZPublishSDK::majorVersion(), "minor" => eZPublishSDK::minorVersion(), "release" => eZPublishSDK::release(), "alias" => eZPublishSDK::alias()));
if ($persistenceList === null) {
$persistenceList = eZSetupFetchPersistenceList();
}
$tpl->setVariable('persistence_list', $persistenceList);
// Try to include the relevant file
$includeFile = $baseDir . 'steps/ezstep_' . $step['file'] . '.php';
$stepClass = false;
if (file_exists($includeFile)) {
include_once $includeFile;
$className = 'eZStep' . $step['class'];
if ($step == $currentStep) {
$stepInstaller = $previousStepClass;
示例14: __construct
/**
* Constructs an ezpKernel instance
*/
public function __construct(array $settings = array())
{
if (isset($settings['injected-settings'])) {
$injectedSettings = array();
foreach ($settings['injected-settings'] as $keySetting => $injectedSetting) {
list($file, $section, $setting) = explode('/', $keySetting);
$injectedSettings[$file][$section][$setting] = $injectedSetting;
}
// Those settings override anything else in local .ini files and their overrides
eZINI::injectSettings($injectedSettings);
}
if (isset($settings['injected-merge-settings'])) {
$injectedSettings = array();
foreach ($settings['injected-merge-settings'] as $keySetting => $injectedSetting) {
list($file, $section, $setting) = explode('/', $keySetting);
$injectedSettings[$file][$section][$setting] = $injectedSetting;
}
// Those settings override anything else in local .ini files and their overrides
eZINI::injectMergeSettings($injectedSettings);
}
$this->settings = $settings + array('siteaccess' => null, 'use-exceptions' => false, 'session' => null, 'service-container' => null);
unset($settings, $injectedSettings, $file, $section, $setting, $keySetting, $injectedSetting);
require_once __DIR__ . '/global_functions.php';
$this->setUseExceptions($this->settings['use-exceptions']);
$GLOBALS['eZSiteBasics'] = array('external-css' => true, 'show-page-layout' => true, 'module-run-required' => true, 'policy-check-required' => true, 'policy-check-omit-list' => array(), 'url-translator-allowed' => true, 'validity-check-required' => false, 'user-object-required' => true, 'session-required' => true, 'db-required' => false, 'no-cache-adviced' => false, 'site-design-override' => false, 'module-repositories' => array());
$this->siteBasics =& $GLOBALS['eZSiteBasics'];
// Reads settings from i18n.ini and passes them to eZTextCodec.
list($i18nSettings['internal-charset'], $i18nSettings['http-charset'], $i18nSettings['mbstring-extension']) = eZINI::instance('i18n.ini')->variableMulti('CharacterSettings', array('Charset', 'HTTPCharset', 'MBStringExtension'), array(false, false, 'enabled'));
eZTextCodec::updateSettings($i18nSettings);
// @todo Change so code only supports utf-8 in 5.0?
// Initialize debug settings.
eZUpdateDebugSettings();
// Set the different permissions/settings.
$ini = eZINI::instance();
// Set correct site timezone
$timezone = $ini->variable("TimeZoneSettings", "TimeZone");
if ($timezone) {
date_default_timezone_set($timezone);
}
list($iniFilePermission, $iniDirPermission) = $ini->variableMulti('FileSettings', array('StorageFilePermissions', 'StorageDirPermissions'));
// OPTIMIZATION:
// Sets permission array as global variable, this avoids the eZCodePage include
$GLOBALS['EZCODEPAGEPERMISSIONS'] = array('file_permission' => octdec($iniFilePermission), 'dir_permission' => octdec($iniDirPermission), 'var_directory' => eZSys::cacheDirectory());
unset($i18nSettings, $timezone, $iniFilePermission, $iniDirPermission);
eZExecution::addCleanupHandler(function () {
if (class_exists('eZDB', false) && eZDB::hasInstance()) {
eZDB::instance()->setIsSQLOutputEnabled(false);
}
});
// Sets up the FatalErrorHandler
$this->setupFatalErrorHandler();
// Enable this line to get eZINI debug output
// eZINI::setIsDebugEnabled( true );
// Enable this line to turn off ini caching
// eZINI::setIsCacheEnabled( false);
if ($ini->variable('RegionalSettings', 'Debug') === 'enabled') {
eZLocale::setIsDebugEnabled(true);
}
eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
// Initialize basic settings, such as vhless dirs and separators
if ($this->hasServiceContainer() && $this->getServiceContainer()->has('request')) {
eZSys::init(basename($this->getServiceContainer()->get('request')->server->get('SCRIPT_FILENAME')), $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
} else {
eZSys::init('index.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
}
// Check for extension
eZExtension::activateExtensions('default');
// Extension check end
// Use injected siteaccess if available or match it internally.
$this->access = isset($this->settings['siteaccess']) ? $this->settings['siteaccess'] : eZSiteAccess::match(eZURI::instance(eZSys::requestURI()), eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
eZSiteAccess::change($this->access);
eZDebugSetting::writeDebug('kernel-siteaccess', $this->access, 'current siteaccess');
// Check for siteaccess extension
eZExtension::activateExtensions('access');
// Siteaccess extension check end
// Now that all extensions are activated and siteaccess has been changed, reset
// all eZINI instances as they may not take into account siteaccess specific settings.
eZINI::resetAllInstances(false);
ezpEvent::getInstance()->registerEventListeners();
$this->mobileDeviceDetect = new ezpMobileDeviceDetect(ezpMobileDeviceDetectFilter::getFilter());
// eZSession::setSessionArray( $mainRequest->session );
}
示例15: while
}
}
$done = false;
$result = null;
while (!$done && $step != null) {
// Some common variables for all steps
$uriPrefix = '';
if (strpos(eZSys::serverVariable('PHP_SELF'), '/ezsetup')) {
$uriPrefix = '/ezsetup';
}
$siteBasics = $GLOBALS['eZSiteBasics'];
$useIndex = $siteBasics['validity-check-required'];
if ($useIndex) {
$script = eZSys::wwwDir() . eZSys::indexFileName() . $uriPrefix;
} else {
$script = eZSys::indexFile() . "{$uriPrefix}/setup/{$partName}";
}
$tpl->setVariable('script', $script);
$tpl->setVariable("version", array("text" => eZPublishSDK::version(), "major" => eZPublishSDK::majorVersion(), "minor" => eZPublishSDK::minorVersion(), "release" => eZPublishSDK::release(), "alias" => eZPublishSDK::alias()));
if ($persistenceList === null) {
$persistenceList = eZSetupFetchPersistenceList();
}
$tpl->setVariable('persistence_list', $persistenceList);
// Try to include the relevant file
$includeFile = $baseDir . 'steps/ezstep_' . $step['file'] . '.php';
$stepClass = false;
if (file_exists($includeFile)) {
include_once $includeFile;
$className = 'eZStep' . $step['class'];
if ($step == $currentStep) {
$stepInstaller = $previousStepClass;