eZPublish(LegacyStack)  5.1
eZSys Class Reference

Public Member Functions

 __construct (array $serverParams=array())
 Initialize the object with settings taken from the current script run. More...
 
 __get ($propertyName)
 Magic function to get access readonly properties (protected) More...
 
 __isset ($propertyName)
 Magic function to see if readonly properties (protected) exists. More...
 
 attribute ($attr)
 Returns the attribute value for $attr or null if the attribute does not exist. More...
 
 attributes ()
 Make sure that certain attribute keys are available in $this->Attributes. More...
 
 hasAttribute ($attr)
 Checks if the attribute $attr is set. More...
 

Static Public Member Functions

static addAccessPath ($path, $name= 'undefined', $siteaccess=true)
 Appends the access path (parts of url that identifies siteaccess), used by eZSys::indexFile() NOTE: Does not make sense to use for siteaccess, as you would want to clear current path and set new one normally, so preferably use eZSys::setAccessPath() in this case. More...
 
static backupFilename ()
 Returns the backup filename for this platform. More...
 
static cacheDirectory ()
 Returns the current cache directory. More...
 
static clearAccessPath ($siteaccess=true)
 Clears the access path, used by eZSys::indexFile(). More...
 
static clientIP ()
 Returns the client IP whether he's behind a proxy or not. More...
 
static createShellArgument ($argumentText, array $replaceList)
 Replaces % elements in $argumentText using $replaceList, and also properly escape the argument. More...
 
static environmentVariable ($variableName, $quiet=false)
 Returns an environment variable or null if it is not available. More...
 
static envSeparator ()
 Returns the string used as environment separator on the current system. More...
 
static escapeShellArgument ($argument)
 Returns an escaped string to be used as a shell argument. More...
 
static ezcrc32 ($string)
 A wrapper for PHP's crc32 function. More...
 
static fileSeparator ()
 Returns the string used as the file separator on the current system. More...
 
static filesystemType ()
 Returns the filesystem type. More...
 
static globBrace ($pattern, $flags=0)
 Wraps around the built-in glob() function to provide same functionality for systems (e.g Solaris) that does not support GLOB_BRACE. More...
 
static hasEnvironmentVariable ($variableName)
 Checks if an environment variable is available. More...
 
static hostname ()
 Returns the current hostname. More...
 
static indexDir ($withAccessList=true)
 Returns the filepath for the index file. More...
 
static indexFile ($withAccessPath=true)
 Returns the filepath for the index file with the access path appended. More...
 
static indexFileName ()
 Returns the filepath for the index file. More...
 
static init ($index= 'index.php', $forceVirtualHost=null)
 Initializes some variables according to some global PHP values. More...
 
static instance ()
 Returns a shared instance of the eZSys class. More...
 
static isShellExecution ()
 Determines if the current process has been started from the web or the shell. More...
 
static isSSLNow ()
 Determines if SSL is enabled and protocol HTTPS is used. More...
 
static lineSeparator ()
 Returns the string used as line separator on the current system. More...
 
static mergeArgumentElements (array $argumentElements)
 Merges an argument list created by eZSys::splitArgumentIntoElements() back into a text string. More...
 
static osName ()
 Returns the current OS name or false if it can not be determined. More...
 
static osType ()
 Returns the OS type. More...
 
static path ($quiet=false)
 Returns the server's path string. More...
 
static protocolSchema ()
 Returns the schema of the request. More...
 
static queryString ()
 Returns the query string for the current request. More...
 
static requestURI ()
 Returns the URI used for parsing modules, views and parameters. More...
 
static rootDir ()
 Returns the absolute path to the eZ Publish root directory. More...
 
static serverPort ()
 Returns the server port or 80 as default if the server port can not be retrieved from the hostname or the server variable 'SERVER_PORT'. More...
 
static serverProtocol ()
 Returns the current server protocol depending on if SSL is enabled or not. More...
 
static serverURL ()
 Returns the server URL (protocol and hostname and port) More...
 
static serverVariable ($variableName, $quiet=false)
 Returns the value of $_SERVER[$variableName] if it is set. More...
 
static setAccessPath (array $path=array(), $name= 'undefined', $siteaccess=true)
 Set access path (parts of url that identifies siteaccess), used by eZSys::indexFile(). More...
 
static setEnvironmentVariable ($variableName, $variableValue)
 Sets an environment variable for the current process/page view. More...
 
static setInstance (eZSys $instance=null)
 Sets eZSys instance or clears it if left undefined. More...
 
static setServerVariable ($variableName, $variableValue)
 Sets a server variable in the global array $_SERVER. More...
 
static siteDir ()
 Returns the path to where all the code resides. More...
 
static splitArgumentIntoElements ($argumentText)
 Splits $argumentText on boundaries formed by one or more spaces and save them into an array of separate arguments. More...
 
static storageDirectory ()
 Returns the current storage directory. More...
 
static varDirectory ()
 Returns the path of the current var directory. More...
 
static wwwDir ()
 Returns the relative directory path of the vhless setup. More...
 

Public Attributes

 $EnvSeparator
 
 $FileSeparator
 
 $FileSystemType
 
 $IndexFile
 
 $LineSeparator
 
 $OSType
 
 $RequestURI
 
 $RootDir
 
 $ShellEscapeCharacter
 
 $SiteDir
 
 $WWWDir
 

Static Protected Member Functions

static getValidwwwDir ($phpSelf, $scriptFileName, $index)
 Generate wwwdir from phpSelf if valid accoring to scriptFileName and return null if invalid and false if there is no index in phpSelf. More...
 
static simulateGlobBrace ($filenames)
 Expands a list of filenames like GLOB_BRACE does. More...
 

Protected Attributes

 $AccessPath
 
 $Params
 
 $QueryString
 

Static Protected Attributes

static $instance = null
 

Constructor & Destructor Documentation

eZSys::__construct ( array  $serverParams = array())

Initialize the object with settings taken from the current script run.

Parameters
array$serverParamsFor unit testing use, see first few lines for content

Member Function Documentation

eZSys::__get (   $propertyName)

Magic function to get access readonly properties (protected)

Parameters
string$propertyName
Returns
mixed
Exceptions
ezcBasePropertyNotFoundException
eZSys::__isset (   $propertyName)

Magic function to see if readonly properties (protected) exists.

Parameters
string$propertyNameOption name to check for.
Returns
bool Whether the option exists.
static eZSys::addAccessPath (   $path,
  $name = 'undefined',
  $siteaccess = true 
)
static

Appends the access path (parts of url that identifies siteaccess), used by eZSys::indexFile() NOTE: Does not make sense to use for siteaccess, as you would want to clear current path and set new one normally, so preferably use eZSys::setAccessPath() in this case.

Parameters
array | string$path
string$nameAn identifer of the name of the path provided $AccessPath
bool$siteaccessHints if path is siteaccess related or not, needed in case subsequesnt code suddenly changes siteaccess and needs to clear siteaccess scope
eZSys::attribute (   $attr)

Returns the attribute value for $attr or null if the attribute does not exist.

Parameters
string$attr
Returns
null|string
eZSys::attributes ( )

Make sure that certain attribute keys are available in $this->Attributes.

Returns
array

Referenced by hasAttribute().

static eZSys::backupFilename ( )
static

Returns the backup filename for this platform.

Possible values: .bak (win32), ~ (unix, mac)

Returns
string

Referenced by eZCodeTemplate\apply(), and eZINI\save().

static eZSys::clearAccessPath (   $siteaccess = true)
static

Clears the access path, used by eZSys::indexFile().

Parameters
bool$siteaccess
Returns
void

Referenced by eZSiteAccess\change().

static eZSys::clientIP ( )
static

Returns the client IP whether he's behind a proxy or not.

Use [HTTPHeaderSettings].ClientIpByCustomHTTPHeader in site.ini if you want to use a custom http header such as X-Forwarded-For

Note: X-Forwarded-For is transformed by PHP into $_SERVER['HTTP_X_FORWARDED_FOR]

eZDebug calls in this method should be avoided as there is a risk of infinite recurstion due to IP check (http://issues.ez.no/19045

Returns
string

Referenced by eZPaymentCallbackChecker\checkServerIP(), eZDebug\isAllowedByCurrentIP(), eZUser\isUserIPInList(), eZDebug\write(), eZAudit\writeAudit(), and eZDebug\writeFile().

static eZSys::createShellArgument (   $argumentText,
array  $replaceList 
)
static

Replaces % elements in $argumentText using $replaceList, and also properly escape the argument.

Parameters
string$argumentText
array$replaceList
Returns
string

Referenced by eZImageShellHandler\convert(), and eZImageHandler\convertFilterToText().

static eZSys::environmentVariable (   $variableName,
  $quiet = false 
)
static

Returns an environment variable or null if it is not available.

If the variable is not available, trigger an error message

Parameters
string$variableName
bool$quiet
Returns
null|string

Referenced by eZSetupTestFileUpload().

static eZSys::envSeparator ( )
static

Returns the string used as environment separator on the current system.

Returns
string

Referenced by eZSetupCheckExecutable().

static eZSys::escapeShellArgument (   $argument)
static

Returns an escaped string to be used as a shell argument.

Parameters
string$argument
Returns
string

Referenced by eZImageShellHandler\convert().

static eZSys::fileSeparator ( )
static

Returns the string used as the file separator on the current system.

Returns
string

Referenced by eZImageShellHandler\convert(), eZSetupPrvtAreDirAndFilesWritable(), eZDir\isWriteable(), and eZDir\separator().

static eZSys::filesystemType ( )
static

Returns the filesystem type.

Possible values: win32, unix

Returns
string

Referenced by eZStepEmailSettings\display(), eZSetupCheckExecutable(), and eZStepEmailSettings\init().

static eZSys::getValidwwwDir (   $phpSelf,
  $scriptFileName,
  $index 
)
staticprotected

Generate wwwdir from phpSelf if valid accoring to scriptFileName and return null if invalid and false if there is no index in phpSelf.

Parameters
string$phpSelf
string$scriptFileName
string$index
Returns
string|null|false String in form 'path/path2' if valid, null if not and false if $index is not part of phpself
static eZSys::globBrace (   $pattern,
  $flags = 0 
)
static

Wraps around the built-in glob() function to provide same functionality for systems (e.g Solaris) that does not support GLOB_BRACE.

Parameters
string$pattern
int$flags
Returns
array

Referenced by eZFSFileHandler\fileDeleteByDirList(), and eZFSFileHandler\fileDeleteByWildcard().

eZSys::hasAttribute (   $attr)

Checks if the attribute $attr is set.

Parameters
string$attr
Returns
bool
static eZSys::hasEnvironmentVariable (   $variableName)
static

Checks if an environment variable is available.

Parameters
string$variableName
Returns
bool

Referenced by eZSetupTestFileUpload().

static eZSys::hostname ( )
static

Returns the current hostname.

First tries to use X-Forward-Host before it goes on to use host in header, if none of them exists fallback to use host part of site.ini[SiteSettings]|SiteURL setting.

Returns
string

Referenced by ezpKernelTreeMenu\__construct(), ezpKernelWeb\__construct(), eZHTTPTool\createRedirectUrl(), eZSiteInstaller\createSiteaccessUrls(), eZRSSExport\fetchImageURL(), eZModule\redirectTo(), and eZUserOperationCollection\sendActivationEmail().

static eZSys::indexDir (   $withAccessList = true)
static
static eZSys::indexFile (   $withAccessPath = true)
static

Returns the filepath for the index file with the access path appended.

Parameters
bool$withAccessPath
Returns
string

Referenced by ezpKernelTreeMenu\__construct(), ezpKernelWeb\__construct(), attribute(), eZTemplateCompiler\compilationFilename(), eZNodeviewfunctions\generateViewCacheFile(), eZUser\instance(), and ezpLanguageSwitcher\process().

static eZSys::indexFileName ( )
static

Returns the filepath for the index file.

Returns
string

Referenced by eZSiteInstaller\createSiteaccessUrls(), and eZStepSecurity\init().

static eZSys::init (   $index = 'index.php',
  $forceVirtualHost = null 
)
static

Initializes some variables according to some global PHP values.

This function should be called once in the index file with the parameters stated in the parameter list.

Parameters
string$indexThe current index file, needed for virtual host mode detection.
bool$forceVirtualHostVirtual host mode is normally autodetected, but if not this can be forced by setting this to true.

Referenced by ezpKernelTreeMenu\__construct(), and ezpKernelWeb\__construct().

static eZSys::isShellExecution ( )
static

Determines if the current process has been started from the web or the shell.

Returns
bool

Referenced by eZDebug\isAllowedByCurrentIP(), eZContentOperationCollection\publishNode(), and eZDBInterface\reportError().

static eZSys::isSSLNow ( )
static

Determines if SSL is enabled and protocol HTTPS is used.

Returns
bool

Referenced by ezpRestHttpRequestParser\processEncryption(), and eZSSLZone\switchIfNeeded().

static eZSys::lineSeparator ( )
static

Returns the string used as line separator on the current system.

Returns
string

Referenced by eZINI\save().

static eZSys::mergeArgumentElements ( array  $argumentElements)
static

Merges an argument list created by eZSys::splitArgumentIntoElements() back into a text string.

Parameters
array$argumentElements
Returns
string
static eZSys::osName ( )
static

Returns the current OS name or false if it can not be determined.

Possible values: windows, linux, freebsd, darwin

Returns
string|bool
static eZSys::path (   $quiet = false)
static

Returns the server's path string.

Parameters
bool$quiet
Returns
mixed|null

Referenced by eZSetupCheckExecutable().

static eZSys::protocolSchema ( )
static

Returns the schema of the request.

Returns
string
static eZSys::queryString ( )
static

Returns the query string for the current request.

?param1=value1&param2=value2

Returns
string

Referenced by eZURI\attribute(), attribute(), ezpLanguageSwitcherOperator\modify(), and eZSSLZone\switchIfNeeded().

static eZSys::requestURI ( )
static

Returns the URI used for parsing modules, views and parameters.

May differ from $_SERVER['REQUEST_URI'].

Returns
string

Referenced by ezpKernelTreeMenu\__construct(), ezpKernelWeb\__construct(), eZTemplateCacheBlock\filterKeys(), eZURI\instance(), eZUser\instance(), ezpKernelWeb\redirect(), ezpKernelWeb\requestInit(), ezpKernelWeb\run(), and eZSSLZone\switchIfNeeded().

static eZSys::rootDir ( )
static

Returns the absolute path to the eZ Publish root directory.

Returns
string|null

Referenced by eZSetupTestDirectoryPermissions(), eZCacheHelper\internalClear(), and eZDir\recursiveDelete().

static eZSys::serverPort ( )
static

Returns the server port or 80 as default if the server port can not be retrieved from the hostname or the server variable 'SERVER_PORT'.

Returns
int

Referenced by ezpKernelTreeMenu\__construct(), ezpKernelWeb\__construct(), and eZHTTPTool\createRedirectUrl().

static eZSys::serverProtocol ( )
static

Returns the current server protocol depending on if SSL is enabled or not.

Returns
string

Referenced by ezpLanguageSwitcher\process().

static eZSys::serverURL ( )
static

Returns the server URL (protocol and hostname and port)

Returns
string
static eZSys::serverVariable (   $variableName,
  $quiet = false 
)
static

Returns the value of $_SERVER[$variableName] if it is set.

If it isn't set, trigger an error message if $quiet is false

Parameters
string$variableName
bool$quiet
Returns
mixed|null

Referenced by ezpKernelTreeMenu\__construct(), ezpKernelWeb\__construct(), clientIP(), eZPaymentCallbackChecker\createDataFromGET(), eZHTTPTool\createRedirectUrl(), eZSiteAccess\match(), ezpMobileDeviceRegexpFilter\redirect(), eZDBInterface\reportError(), eZSiteAccess\siteAccessList(), eZSSLZone\switchIfNeeded(), eZDebug\write(), eZAudit\writeAudit(), and eZDebug\writeFile().

static eZSys::setAccessPath ( array  $path = array(),
  $name = 'undefined',
  $siteaccess = true 
)
static

Set access path (parts of url that identifies siteaccess), used by eZSys::indexFile().

Parameters
array$path
string$nameAn identifer of the name of the path provided $AccessPath
bool$siteaccessHints if path is siteaccess related or not, needed in case subsequesnt code suddenly changes siteaccess and needs to clear siteaccess scope

Referenced by eZSiteAccess\change().

static eZSys::setEnvironmentVariable (   $variableName,
  $variableValue 
)
static

Sets an environment variable for the current process/page view.

Parameters
string$variableName
mixed$variableValue
Returns
void
static eZSys::setInstance ( eZSys  $instance = null)
static

Sets eZSys instance or clears it if left undefined.

Parameters
eZSys$instance
static eZSys::setServerVariable (   $variableName,
  $variableValue 
)
static

Sets a server variable in the global array $_SERVER.

Note: Variables are only set for the current process/page view

Parameters
string$variableName
mixed$variableValue
Returns
void
static eZSys::simulateGlobBrace (   $filenames)
staticprotected

Expands a list of filenames like GLOB_BRACE does.

GLOB_BRACE is non POSIX and only available in GNU glibc. This is needed to support operating systems like Solars.

Parameters
$filenames
Returns
array
static eZSys::siteDir ( )
static

Returns the path to where all the code resides.

Returns
string

Referenced by attribute().

static eZSys::splitArgumentIntoElements (   $argumentText)
static

Splits $argumentText on boundaries formed by one or more spaces and save them into an array of separate arguments.

The number of spaces between to arguments is inserted as an integer value between two argument values.

Example: $list = splitArgumentIntoElements( "-geometry 100x100" ); var_dump( $list ); // Output: array( "-geometry", 1, "100x100" );

You can then easily modify the elements separately and create the argument text with eZSys::mergeArgumentElements()

Parameters
string$argumentText
Returns
array
static eZSys::varDirectory ( )
static

Returns the path of the current var directory.

Returns
string

Referenced by eZWebDAVContentBackend\appendLogEntry(), eZDebug\printReport(), and eZWebDAVContentBackend\tempDirectory().

Member Data Documentation

eZSys::$AccessPath
protected

Referenced by __get().

eZSys::$EnvSeparator
eZSys::$FileSeparator
eZSys::$FileSystemType
eZSys::$IndexFile

Referenced by init().

eZSys::$instance = null
staticprotected
eZSys::$LineSeparator
eZSys::$OSType
eZSys::$Params
protected
eZSys::$QueryString
protected
eZSys::$RequestURI
eZSys::$RootDir
eZSys::$ShellEscapeCharacter
eZSys::$SiteDir
eZSys::$WWWDir

The documentation for this class was generated from the following file: