idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
40,600
public function current ( ) { $ file = $ this -> getInnerIterator ( ) -> current ( ) ; $ filePathName = $ file -> getPathname ( ) ; return substr ( $ filePathName , strlen ( $ this -> prefix ) + 1 ) ; }
Transforms the SplFileInfo in a simple relative path
40,601
public function process ( ezcMvcResponseWriter $ writer ) { if ( $ writer instanceof ezcMvcHttpResponseWriter ) { $ writer -> headers [ "HTTP/1.1 " . $ this -> code ] = self :: $ statusCodes [ $ this -> code ] ; $ writer -> headers = $ this -> headers + $ writer -> headers ; } if ( $ this -> message !== null ) { $ writer -> headers [ 'Content-Type' ] = 'application/json; charset=UTF-8' ; $ writer -> response -> body = json_encode ( $ this -> message ) ; } }
This method is called by the response writers to process the data contained in the status objects .
40,602
public static function getToken ( ezcMvcRequest $ request ) { $ token = null ; $ checkStack = array ( 'header' , 'get' , 'post' ) ; foreach ( $ checkStack as $ step ) { switch ( $ step ) { case 'header' : $ token = self :: getTokenFromAuthorizationHeader ( ) ; break ; case 'get' : $ token = self :: getTokenFromQueryComponent ( $ request ) ; break ; case 'post' : $ token = self :: getTokenFromHttpBody ( $ request ) ; break ; } if ( isset ( $ token ) ) { break ; } } return $ token ; }
Retrieving token as per section 5 of draft - ietf - oauth - v2 - 10
40,603
protected static function getTokenFromAuthorizationHeader ( ) { $ token = null ; $ authHeader = null ; if ( function_exists ( 'apache_request_headers' ) ) { $ apacheHeaders = apache_request_headers ( ) ; if ( isset ( $ apacheHeaders [ self :: AUTH_HEADER_NAME ] ) ) $ authHeader = $ apacheHeaders [ self :: AUTH_HEADER_NAME ] ; } else { if ( isset ( $ _SERVER [ self :: AUTH_CGI_HEADER_NAME ] ) ) $ authHeader = $ _SERVER [ self :: AUTH_CGI_HEADER_NAME ] ; } if ( isset ( $ authHeader ) ) { $ tokenPattern = "/^(?P<authscheme>OAuth)\s(?P<token>[a-zA-Z0-9]+)$/" ; $ match = preg_match ( $ tokenPattern , $ authHeader , $ m ) ; if ( $ match > 0 ) { $ token = $ m [ 'token' ] ; } } return $ token ; }
Extracts the OAuth token from the HTTP header Authorization .
40,604
protected static function getTokenFromQueryComponent ( ezpRestRequest $ request ) { $ token = null ; if ( isset ( $ request -> get [ 'oauth_token' ] ) ) { $ token = $ request -> get [ 'oauth_token' ] ; } return $ token ; }
Extracts OAuth token query component aka GET parameter .
40,605
protected static function getTokenFromHttpBody ( ezpRestRequest $ request ) { $ token = null ; if ( isset ( $ request -> post [ 'oauth_token' ] ) ) { $ token = $ request -> post [ 'oauth_token' ] ; } return $ token ; }
Extracts OAuth token fro HTTP Post body .
40,606
public static function doRefreshToken ( $ clientId , $ clientSecret , $ refreshToken ) { $ client = ezpRestClient :: fetchByClientId ( $ clientId ) ; $ tokenTTL = ( int ) eZINI :: instance ( 'rest.ini' ) -> variable ( 'OAuthSettings' , 'TokenTTL' ) ; if ( ! ( $ client instanceof ezpRestClient ) ) throw new ezpOauthInvalidRequestException ( ezpOauthTokenEndpointErrorType :: INVALID_CLIENT ) ; if ( ! $ client -> validateSecret ( $ clientSecret ) ) throw new ezpOauthInvalidRequestException ( ezpOauthTokenEndpointErrorType :: INVALID_CLIENT ) ; $ session = ezcPersistentSessionInstance :: get ( ) ; $ q = $ session -> createFindQuery ( 'ezpRestToken' ) ; $ q -> where ( $ q -> expr -> eq ( 'refresh_token' , $ q -> bindValue ( $ refreshToken ) ) ) ; $ refreshInfo = $ session -> find ( $ q , 'ezpRestToken' ) ; if ( empty ( $ refreshInfo ) ) { throw new ezpOauthInvalidRequestException ( "Specified refresh-token does not exist." ) ; } $ refreshInfo = array_shift ( $ refreshInfo ) ; $ authorized = ezpRestAuthorizedClient :: fetchForClientUser ( $ client , eZUser :: fetch ( $ refreshInfo -> user_id ) ) ; if ( ! ( $ authorized instanceof ezpRestAuthorizedClient ) ) { throw new ezpOauthInvalidRequestException ( ezpOauthTokenEndpointErrorType :: INVALID_CLIENT ) ; } $ newToken = new ezpRestToken ( ) ; $ newToken -> id = ezpRestToken :: generateToken ( '' ) ; $ newToken -> refresh_token = ezpRestToken :: generateToken ( '' ) ; $ newToken -> client_id = $ clientId ; $ newToken -> user_id = $ refreshInfo -> user_id ; $ newToken -> expirytime = time ( ) + $ tokenTTL ; $ session -> save ( $ newToken ) ; $ session -> delete ( $ refreshInfo ) ; return $ newToken ; }
Handles a refresh_token request . Returns the new token object as ezpRestToken
40,607
public static function doRefreshTokenWithAuthorizationCode ( $ clientId , $ clientSecret , $ authCode , $ redirectUri ) { $ client = ezpRestClient :: fetchByClientId ( $ clientId ) ; $ tokenTTL = ( int ) eZINI :: instance ( 'rest.ini' ) -> variable ( 'OAuthSettings' , 'TokenTTL' ) ; if ( ! ( $ client instanceof ezpRestClient ) ) throw new ezpOauthInvalidRequestException ( ezpOauthTokenEndpointErrorType :: INVALID_CLIENT ) ; if ( ! $ client -> validateSecret ( $ clientSecret ) ) throw new ezpOauthInvalidRequestException ( ezpOauthTokenEndpointErrorType :: INVALID_CLIENT ) ; if ( ! $ client -> isEndPointValid ( $ redirectUri ) ) throw new ezpOauthInvalidRequestException ( ezpOauthTokenEndpointErrorType :: INVALID_REQUEST ) ; $ session = ezcPersistentSessionInstance :: get ( ) ; $ q = $ session -> createFindQuery ( 'ezpRestAuthcode' ) ; $ q -> where ( $ q -> expr -> eq ( 'id' , $ q -> bindValue ( $ authCode ) ) ) ; $ codeInfo = $ session -> find ( $ q , 'ezpRestAuthcode' ) ; if ( empty ( $ codeInfo ) ) { throw new ezpOauthInvalidTokenException ( "Specified authorization code does not exist." ) ; } $ codeInfo = array_shift ( $ codeInfo ) ; $ authorized = ezpRestAuthorizedClient :: fetchForClientUser ( $ client , eZUser :: fetch ( $ codeInfo -> user_id ) ) ; if ( ! ( $ authorized instanceof ezpRestAuthorizedClient ) ) { throw new ezpOauthInvalidRequestException ( ezpOauthTokenEndpointErrorType :: INVALID_CLIENT ) ; } if ( $ codeInfo -> expirytime != 0 ) { if ( $ codeInfo -> expirytime < time ( ) ) { $ d = date ( "c" , $ codeInfo -> expirytime ) ; throw new ezpOauthExpiredTokenException ( "Authorization code expired on {$d}" ) ; } } $ accessToken = ezpRestToken :: generateToken ( '' ) ; $ refreshToken = ezpRestToken :: generateToken ( '' ) ; $ token = new ezpRestToken ( ) ; $ token -> id = $ accessToken ; $ token -> refresh_token = $ refreshToken ; $ token -> client_id = $ clientId ; $ token -> user_id = $ codeInfo -> user_id ; $ token -> expirytime = time ( ) + $ tokenTTL ; $ session = ezcPersistentSessionInstance :: get ( ) ; $ session -> save ( $ token ) ; $ session -> delete ( $ codeInfo ) ; return $ token ; }
Generates a new token against an authorization_code Auth code is checked against clientId clientSecret and redirectUri as registered for client in admin Auth code is for one - use only and will be removed once the access token generated
40,608
protected function getNodes ( $ requestUri , $ depth ) { $ source = $ requestUri ; $ nodeInfo = $ this -> getNodeInfo ( $ requestUri ) ; if ( ! $ nodeInfo [ 'nodeExists' ] ) { return array ( ) ; } if ( ! $ nodeInfo [ 'isCollection' ] ) { return array ( new ezcWebdavResource ( $ source , $ this -> getAllProperties ( $ source ) ) ) ; } if ( $ depth === ezcWebdavRequest :: DEPTH_ZERO ) { return array ( new ezcWebdavCollection ( $ source , $ this -> getAllProperties ( $ source ) ) ) ; } $ nodes = array ( new ezcWebdavCollection ( $ source , $ this -> getAllProperties ( $ source ) ) ) ; $ recurseCollections = array ( $ source ) ; for ( $ i = 0 ; $ i < count ( $ recurseCollections ) ; ++ $ i ) { $ source = $ recurseCollections [ $ i ] ; if ( $ source { strlen ( $ source ) - 1 } !== '/' ) { $ source .= '/' ; } $ children = $ this -> getCollectionMembers ( $ source , $ depth ) ; foreach ( $ children as $ child ) { $ nodes [ ] = $ child ; if ( $ child instanceof ezcWebdavCollection && $ depth === ezcWebdavRequest :: DEPTH_INFINITY && $ child -> path !== $ source ) { $ recurseCollections [ ] = $ child -> path ; } } } return $ nodes ; }
Returns all child nodes .
40,609
protected function getResourceContents ( $ target ) { $ result = array ( 'data' => false , 'file' => false ) ; $ fullPath = $ target ; $ target = $ this -> splitFirstPathElement ( $ fullPath , $ currentSite ) ; $ data = $ this -> getVirtualFolderData ( $ result , $ currentSite , $ target , $ fullPath ) ; if ( $ data [ 'file' ] ) { $ file = eZClusterFileHandler :: instance ( $ data [ 'file' ] ) ; return $ file -> fetchContents ( ) ; } return false ; }
Returns the contents of a resource .
40,610
protected function getCollectionMembers ( $ path , $ depth = ezcWebdavRequest :: DEPTH_INFINITY ) { $ properties = $ this -> handledLiveProperties ; $ fullPath = $ path ; $ collection = $ this -> splitFirstPathElement ( $ fullPath , $ currentSite ) ; if ( ! $ currentSite ) { $ entries = $ this -> fetchSiteListContent ( $ fullPath , $ depth , $ properties ) ; } else { $ entries = $ this -> getVirtualFolderCollection ( $ currentSite , $ collection , $ fullPath , $ depth , $ properties ) ; } $ contents = array ( ) ; foreach ( $ entries as $ entry ) { if ( $ path === $ entry [ 'href' ] ) { continue ; } if ( $ entry [ 'mimetype' ] === self :: DIRECTORY_MIMETYPE ) { $ contents [ ] = new ezcWebdavCollection ( $ entry [ 'href' ] , $ this -> getAllProperties ( $ path ) ) ; } else { $ entry [ 'href' ] = rtrim ( $ entry [ 'href' ] , '/' ) ; $ contents [ ] = new ezcWebdavResource ( $ entry [ 'href' ] , $ this -> getAllProperties ( $ path ) ) ; } } return $ contents ; }
Returns members of collection .
40,611
public function getAllProperties ( $ path ) { $ storage = $ this -> getPropertyStorage ( $ path ) ; foreach ( $ this -> handledLiveProperties as $ property ) { $ storage -> attach ( $ this -> getProperty ( $ path , $ property ) ) ; } return $ storage ; }
Returns all properties for a resource .
40,612
protected function nodeExists ( $ path ) { if ( ! isset ( $ this -> cachedNodes [ $ path ] ) ) { $ this -> cachedNodes [ $ path ] = $ this -> getNodeInfo ( $ path ) ; } return $ this -> cachedNodes [ $ path ] [ 'nodeExists' ] ; }
Returns if a resource exists .
40,613
protected function isCollection ( $ path ) { if ( ! isset ( $ this -> cachedNodes [ $ path ] ) ) { $ this -> cachedNodes [ $ path ] = $ this -> getNodeInfo ( $ path ) ; } return $ this -> cachedNodes [ $ path ] [ 'isCollection' ] ; }
Returns if resource is a collection .
40,614
public function get ( ezcWebdavGetRequest $ request ) { $ this -> acquireLock ( true ) ; $ return = parent :: get ( $ request ) ; $ this -> freeLock ( ) ; return $ return ; }
Serves GET requests .
40,615
public function head ( ezcWebdavHeadRequest $ request ) { $ this -> acquireLock ( true ) ; $ return = parent :: head ( $ request ) ; $ this -> freeLock ( ) ; return $ return ; }
Serves HEAD requests .
40,616
public function propFind ( ezcWebdavPropFindRequest $ request ) { $ ini = eZINI :: instance ( 'i18n.ini' ) ; $ dataCharset = $ ini -> variable ( 'CharacterSettings' , 'Charset' ) ; $ xmlCharset = 'utf-8' ; $ this -> acquireLock ( true ) ; $ return = parent :: propFind ( $ request ) ; if ( isset ( $ return -> responses ) && is_array ( $ return -> responses ) ) { foreach ( $ return -> responses as $ response ) { $ href = $ response -> node -> path ; $ pathArray = explode ( '/' , self :: recode ( $ href , $ dataCharset , $ xmlCharset ) ) ; $ encodedPath = '/' ; foreach ( $ pathArray as $ pathElement ) { if ( $ pathElement != '' ) { $ encodedPath .= rawurlencode ( $ pathElement ) ; $ encodedPath .= '/' ; } } $ encodedPath = rtrim ( $ encodedPath , '/' ) ; $ response -> node -> path = $ encodedPath ; } } $ this -> freeLock ( ) ; return $ return ; }
Serves PROPFIND requests .
40,617
public function propPatch ( ezcWebdavPropPatchRequest $ request ) { $ this -> acquireLock ( ) ; $ return = parent :: propPatch ( $ request ) ; $ this -> freeLock ( ) ; return $ return ; }
Serves PROPPATCH requests .
40,618
public function setProperty ( $ path , ezcWebdavProperty $ property ) { if ( ! in_array ( $ property -> name , $ this -> handledLiveProperties , true ) ) { return false ; } $ storage = new ezcWebdavBasicPropertyStorage ( ) ; $ storage -> attach ( $ property ) ; $ this -> storeProperties ( $ path , $ storage ) ; return true ; }
Manually sets a property on a resource .
40,619
public function put ( ezcWebdavPutRequest $ request ) { $ this -> acquireLock ( ) ; $ return = parent :: put ( $ request ) ; $ this -> freeLock ( ) ; return $ return ; }
Serves PUT requests .
40,620
protected function setResourceContents ( $ path , $ content ) { $ tempFile = $ this -> storeUploadedFile ( $ path , $ content ) ; eZWebDAVContentBackend :: appendLogEntry ( 'SetResourceContents:' . $ path . ';' . $ tempFile ) ; if ( ! $ tempFile ) { return false ; } $ fullPath = $ path ; $ target = $ this -> splitFirstPathElement ( $ path , $ currentSite ) ; if ( ! $ currentSite ) { return false ; } $ result = $ this -> putVirtualFolderData ( $ currentSite , $ target , $ tempFile ) ; unlink ( $ tempFile ) ; eZDir :: cleanupEmptyDirectories ( dirname ( $ tempFile ) ) ; return $ result ; }
Sets the contents of a resource .
40,621
public function delete ( ezcWebdavDeleteRequest $ request ) { $ this -> acquireLock ( ) ; $ return = parent :: delete ( $ request ) ; $ this -> freeLock ( ) ; return $ return ; }
Serves DELETE requests .
40,622
public function checkDeleteRecursive ( $ target ) { $ errors = array ( ) ; $ fullPath = $ target ; $ target = $ this -> splitFirstPathElement ( $ target , $ currentSite ) ; if ( ! $ currentSite ) { return array ( new ezcWebdavErrorResponse ( ezcWebdavResponse :: STATUS_403 , $ fullPath ) , ) ; } if ( $ target === "" ) { return array ( new ezcWebdavErrorResponse ( ezcWebdavResponse :: STATUS_403 , $ fullPath ) , ) ; } return $ errors ; }
Returns if everything below a path can be deleted recursively .
40,623
protected function performDelete ( $ target ) { switch ( $ _SERVER [ 'REQUEST_METHOD' ] ) { case 'MOVE' : return null ; default : $ errors = $ this -> checkDeleteRecursive ( $ target ) ; break ; } if ( count ( $ errors ) > 0 ) { return new ezcWebdavMultistatusResponse ( $ errors ) ; } $ fullPath = $ target ; $ target = $ this -> splitFirstPathElement ( $ target , $ currentSite ) ; $ status = $ this -> deleteVirtualFolder ( $ currentSite , $ target ) ; return null ; }
Deletes everything below a path .
40,624
public function copy ( ezcWebdavCopyRequest $ request ) { $ this -> acquireLock ( ) ; $ return = parent :: copy ( $ request ) ; $ this -> freeLock ( ) ; return $ return ; }
Serves COPY requests .
40,625
protected function performCopy ( $ source , $ destination , $ depth = ezcWebdavRequest :: DEPTH_INFINITY ) { switch ( $ _SERVER [ 'REQUEST_METHOD' ] ) { case 'MOVE' : $ errors = $ this -> moveRecursive ( $ source , $ destination , $ depth ) ; break ; case 'COPY' : $ errors = $ this -> copyRecursive ( $ source , $ destination , $ depth ) ; break ; default : $ errors = $ this -> moveRecursive ( $ source , $ destination , $ depth ) ; break ; } foreach ( $ errors as $ nr => $ error ) { $ errors [ $ nr ] = new ezcWebdavErrorResponse ( ezcWebdavResponse :: STATUS_423 , $ error ) ; } $ storage = $ this -> getPropertyStorage ( $ source ) ; $ this -> storeProperties ( $ destination , $ storage ) ; return $ errors ; }
Copies resources recursively from one path to another .
40,626
public function moveRecursive ( $ source , $ destination , $ depth = ezcWebdavRequest :: DEPTH_INFINITY ) { $ errors = array ( ) ; $ fullSource = $ source ; $ fullDestination = $ destination ; $ source = $ this -> splitFirstPathElement ( $ source , $ sourceSite ) ; $ destination = $ this -> splitFirstPathElement ( $ destination , $ destinationSite ) ; if ( $ sourceSite !== $ destinationSite ) { return array ( ) ; } if ( ! $ sourceSite or ! $ destinationSite ) { return array ( $ fullSource ) ; } $ this -> moveVirtualFolder ( $ sourceSite , $ destinationSite , $ source , $ destination , $ fullSource , $ fullDestination ) ; if ( $ depth === ezcWebdavRequest :: DEPTH_ZERO || ! $ this -> isCollection ( $ fullSource ) ) { return array ( ) ; } $ nodes = $ this -> getCollectionMembers ( $ fullSource ) ; foreach ( $ nodes as $ node ) { if ( $ node -> path === $ fullSource . '/' ) { continue ; } $ newDepth = ( $ depth !== ezcWebdavRequest :: DEPTH_ONE ) ? $ depth : ezcWebdavRequest :: DEPTH_ZERO ; $ errors = array_merge ( $ errors , $ this -> moveRecursive ( $ node -> path , $ fullDestination . '/' . $ this -> getProperty ( $ node -> path , 'displayname' ) -> displayName , $ newDepth ) ) ; } return $ errors ; }
Recursively move a file or directory .
40,627
public function move ( ezcWebdavMoveRequest $ request ) { $ this -> acquireLock ( ) ; $ return = parent :: move ( $ request ) ; $ this -> freeLock ( ) ; return $ return ; }
Serves MOVE requests .
40,628
public function options ( ezcWebdavOptionsRequest $ request ) { $ response = new ezcWebdavOptionsResponse ( '1' ) ; $ allowed = 'GET, HEAD, PROPFIND, PROPPATCH, OPTIONS, ' ; if ( $ this instanceof ezcWebdavBackendChange ) { $ allowed .= 'DELETE, COPY, MOVE, ' ; } if ( $ this instanceof ezcWebdavBackendMakeCollection ) { $ allowed .= 'MKCOL, ' ; } if ( $ this instanceof ezcWebdavBackendPut ) { $ allowed .= 'PUT, ' ; } if ( $ this instanceof ezcWebdavLockBackend ) { $ allowed .= 'LOCK, UNLOCK, ' ; } $ response -> setHeader ( 'Allow' , substr ( $ allowed , 0 , - 2 ) ) ; return $ response ; }
Required method to serve OPTIONS requests .
40,629
public function setCurrentSite ( $ site ) { eZWebDAVContentBackend :: appendLogEntry ( __FUNCTION__ . '1:' . $ site ) ; $ access = array ( 'name' => $ site , 'type' => eZSiteAccess :: TYPE_STATIC ) ; $ access = eZSiteAccess :: change ( $ access ) ; eZWebDAVContentBackend :: appendLogEntry ( __FUNCTION__ . '2:' . $ site ) ; eZDebugSetting :: writeDebug ( 'kernel-siteaccess' , $ access , 'current siteaccess' ) ; $ nullVar = null ; eZDB :: setInstance ( $ nullVar ) ; }
Sets the current site .
40,630
protected function getVirtualFolderData ( $ result , $ currentSite , $ target , $ fullPath ) { $ target = $ this -> splitFirstPathElement ( $ target , $ virtualFolder ) ; if ( ! $ target ) { return false ; } if ( ! in_array ( $ virtualFolder , array ( self :: virtualContentFolderName ( ) , self :: virtualMediaFolderName ( ) ) ) ) { return false ; } if ( $ virtualFolder === self :: virtualContentFolderName ( ) or $ virtualFolder === self :: virtualMediaFolderName ( ) ) { return $ this -> getContentNodeData ( $ result , $ currentSite , $ virtualFolder , $ target , $ fullPath ) ; } return false ; }
Handles data retrival on the virtual folder level .
40,631
protected function getContentNodeData ( $ result , $ currentSite , $ virtualFolder , $ target , $ fullPath ) { $ nodePath = $ this -> internalNodePath ( $ virtualFolder , $ target ) ; eZWebDAVContentBackend :: appendLogEntry ( __FUNCTION__ . " Path:" . $ nodePath ) ; $ node = $ this -> fetchNodeByTranslation ( $ nodePath ) ; $ info = $ this -> fetchNodeInfo ( $ fullPath , $ node ) ; if ( $ node === null ) { return $ result ; } if ( ! $ node -> canRead ( ) ) { return false ; } $ object = $ node -> attribute ( 'object' ) ; foreach ( $ info as $ key => $ value ) { $ result [ $ key ] = $ value ; } $ upload = new eZContentUpload ( ) ; $ info = $ upload -> objectFileInfo ( $ object ) ; if ( $ info ) { $ result [ 'file' ] = $ info [ 'filepath' ] ; } else { $ class = $ object -> contentClass ( ) ; if ( $ this -> isObjectFolder ( $ object , $ class ) ) { $ result [ 'isCollection' ] = true ; } } return $ result ; }
Handles data retrival on the content tree level .
40,632
protected function getCollectionContent ( $ collection , $ depth = false , $ properties = false ) { $ fullPath = $ collection ; $ collection = $ this -> splitFirstPathElement ( $ collection , $ currentSite ) ; if ( ! $ currentSite ) { $ entries = $ this -> fetchSiteListContent ( $ fullPath , $ depth , $ properties ) ; return $ entries ; } return $ this -> getVirtualFolderCollection ( $ currentSite , $ collection , $ fullPath , $ depth , $ properties ) ; }
Produces the collection content .
40,633
protected function fetchVirtualSiteContent ( $ target , $ site , $ depth , $ properties ) { $ requestUri = $ target ; $ contentEntry = array ( ) ; $ scriptURL = $ requestUri ; if ( $ scriptURL { strlen ( $ scriptURL ) - 1 } !== '/' ) { $ scriptURL .= "/" ; } $ contentEntry [ "name" ] = $ scriptURL ; $ contentEntry [ "size" ] = 0 ; $ contentEntry [ "mimetype" ] = self :: DIRECTORY_MIMETYPE ; $ contentEntry [ "ctime" ] = filectime ( 'settings/siteaccess/' . $ site ) ; $ contentEntry [ "mtime" ] = filemtime ( 'settings/siteaccess/' . $ site ) ; $ contentEntry [ "href" ] = $ requestUri ; $ entries [ ] = $ contentEntry ; $ defctime = $ contentEntry [ 'ctime' ] ; $ defmtime = $ contentEntry [ 'mtime' ] ; if ( $ depth > 0 ) { $ scriptURL = $ requestUri ; if ( $ scriptURL { strlen ( $ scriptURL ) - 1 } !== '/' ) { $ scriptURL .= "/" ; } foreach ( array ( self :: virtualContentFolderName ( ) , self :: virtualMediaFolderName ( ) ) as $ name ) { $ entry = array ( ) ; $ entry [ "name" ] = $ name ; $ entry [ "size" ] = 0 ; $ entry [ "mimetype" ] = self :: DIRECTORY_MIMETYPE ; $ entry [ "ctime" ] = $ defctime ; $ entry [ "mtime" ] = $ defmtime ; $ entry [ "href" ] = $ scriptURL . $ name ; $ entries [ ] = $ entry ; } } return $ entries ; }
Builds and returns the content of the virtual start folder for a site .
40,634
protected function getVirtualFolderCollection ( $ currentSite , $ collection , $ fullPath , $ depth , $ properties ) { if ( ! $ collection ) { $ entries = $ this -> fetchVirtualSiteContent ( $ fullPath , $ currentSite , $ depth , $ properties ) ; return $ entries ; } $ collection = $ this -> splitFirstPathElement ( $ collection , $ virtualFolder ) ; if ( ! in_array ( $ virtualFolder , array ( self :: virtualContentFolderName ( ) , self :: virtualMediaFolderName ( ) ) ) ) { return false ; } $ ini = eZINI :: instance ( ) ; $ prefixAdded = false ; $ prefix = $ ini -> hasVariable ( 'SiteAccessSettings' , 'PathPrefix' ) && $ ini -> variable ( 'SiteAccessSettings' , 'PathPrefix' ) != '' ? eZURLAliasML :: cleanURL ( $ ini -> variable ( 'SiteAccessSettings' , 'PathPrefix' ) ) : false ; if ( $ prefix ) { $ escapedPrefix = preg_quote ( $ prefix , '#' ) ; if ( ! preg_match ( "#^$escapedPrefix(/.*)?$#i" , $ collection ) ) { $ exclude = $ ini -> hasVariable ( 'SiteAccessSettings' , 'PathPrefixExclude' ) ? $ ini -> variable ( 'SiteAccessSettings' , 'PathPrefixExclude' ) : false ; $ breakInternalURI = false ; foreach ( $ exclude as $ item ) { $ escapedItem = preg_quote ( $ item , '#' ) ; if ( preg_match ( "#^$escapedItem(/.*)?$#i" , $ collection ) ) { $ breakInternalURI = true ; break ; } } if ( ! $ breakInternalURI ) { $ collection = $ prefix . '/' . $ collection ; $ prefixAdded = true ; } } } return $ this -> getContentTreeCollection ( $ currentSite , $ virtualFolder , $ collection , $ fullPath , $ depth , $ properties ) ; }
Handles collections on the virtual folder level if no virtual folder elements are accessed it lists the virtual folders .
40,635
protected function getContentTreeCollection ( $ currentSite , $ virtualFolder , $ collection , $ fullPath , $ depth , $ properties ) { $ nodePath = $ this -> internalNodePath ( $ virtualFolder , $ collection ) ; $ node = $ this -> fetchNodeByTranslation ( $ nodePath ) ; if ( ! $ node ) { return false ; } if ( ! $ node -> canRead ( ) ) { return false ; } $ entries = $ this -> fetchContentList ( $ fullPath , $ node , $ nodePath , $ depth , $ properties ) ; return $ entries ; }
Handles collections on the content tree level .
40,636
protected function fetchContentList ( $ fullPath , & $ node , $ target , $ depth , $ properties ) { $ entries = array ( ) ; if ( $ depth === ezcWebdavRequest :: DEPTH_ONE || $ depth === ezcWebdavRequest :: DEPTH_INFINITY ) { $ subTree = $ node -> subTree ( array ( 'Depth' => 1 ) ) ; foreach ( $ subTree as $ someNode ) { $ entries [ ] = $ this -> fetchNodeInfo ( $ fullPath , $ someNode ) ; } } $ thisNodeInfo = $ this -> fetchNodeInfo ( $ fullPath , $ node ) ; $ scriptURL = $ fullPath ; if ( $ scriptURL { strlen ( $ scriptURL ) - 1 } !== '/' ) { $ scriptURL .= "/" ; } $ thisNodeInfo [ "href" ] = $ scriptURL ; $ entries [ ] = $ thisNodeInfo ; return $ entries ; }
Gets and returns the content of an actual node .
40,637
protected function fetchSiteListContent ( $ target , $ depth , $ properties ) { $ entries = array ( ) ; $ contentEntry = array ( ) ; $ entries = array ( ) ; $ scriptURL = $ target ; if ( $ scriptURL { strlen ( $ scriptURL ) - 1 } !== '/' ) { $ scriptURL .= "/" ; } $ thisNodeInfo [ "href" ] = $ scriptURL ; $ contentEntry [ "name" ] = '/' ; $ contentEntry [ "href" ] = $ scriptURL ; $ contentEntry [ "size" ] = 0 ; $ contentEntry [ "mimetype" ] = self :: DIRECTORY_MIMETYPE ; $ contentEntry [ "ctime" ] = filectime ( 'var' ) ; $ contentEntry [ "mtime" ] = filemtime ( 'var' ) ; $ entries [ ] = $ contentEntry ; if ( $ depth > 0 ) { foreach ( $ this -> availableSites as $ site ) { $ contentEntry [ "name" ] = $ scriptURL . $ site . '/' ; $ contentEntry [ "size" ] = 0 ; $ contentEntry [ "mimetype" ] = self :: DIRECTORY_MIMETYPE ; $ contentEntry [ "ctime" ] = filectime ( 'settings/siteaccess/' . $ site ) ; $ contentEntry [ "mtime" ] = filemtime ( 'settings/siteaccess/' . $ site ) ; if ( $ target === '/' ) { $ contentEntry [ "href" ] = $ contentEntry [ "name" ] ; } else { $ contentEntry [ "href" ] = $ scriptURL . $ contentEntry [ "name" ] ; } $ entries [ ] = $ contentEntry ; } } return $ entries ; }
Builds a content - list of available sites and returns it .
40,638
protected function mkcolVirtualFolder ( $ currentSite , $ target ) { $ target = $ this -> splitFirstPathElement ( $ target , $ virtualFolder ) ; if ( ! in_array ( $ virtualFolder , array ( self :: virtualContentFolderName ( ) , self :: virtualMediaFolderName ( ) ) ) ) { return false ; } if ( ! $ target ) { return false ; } if ( $ virtualFolder === self :: virtualContentFolderName ( ) or $ virtualFolder === self :: virtualMediaFolderName ( ) ) { return $ this -> mkcolContent ( $ currentSite , $ virtualFolder , $ target ) ; } return false ; }
Handles collection creation on the virtual folder level .
40,639
protected function mkcolContent ( $ currentSite , $ virtualFolder , $ target ) { $ nodePath = $ this -> internalNodePath ( $ virtualFolder , $ target ) ; $ node = $ this -> fetchNodeByTranslation ( $ nodePath ) ; if ( $ node ) { return false ; } $ parentNode = $ this -> fetchParentNodeByTranslation ( $ nodePath ) ; if ( ! $ parentNode ) { return false ; } if ( ! $ parentNode -> canRead ( ) ) { return false ; } return $ this -> createFolder ( $ parentNode , $ nodePath ) ; }
Handles collection creation on the content tree level .
40,640
protected function deleteVirtualFolder ( $ currentSite , $ target ) { $ target = $ this -> splitFirstPathElement ( $ target , $ virtualFolder ) ; if ( ! in_array ( $ virtualFolder , array ( self :: virtualContentFolderName ( ) , self :: virtualMediaFolderName ( ) ) ) ) { return false ; } if ( ! $ target ) { return false ; } if ( $ virtualFolder === self :: virtualContentFolderName ( ) or $ virtualFolder === self :: virtualMediaFolderName ( ) ) { return $ this -> deleteContent ( $ currentSite , $ virtualFolder , $ target ) ; } return false ; }
Handles deletion on the virtual folder level .
40,641
protected function deleteContent ( $ currentSite , $ virtualFolder , $ target ) { $ nodePath = $ this -> internalNodePath ( $ virtualFolder , $ target ) ; $ node = $ this -> fetchNodeByTranslation ( $ nodePath ) ; if ( $ node === null ) { return false ; } if ( ! $ node -> canRead ( ) or ! $ node -> canRemove ( ) ) { return false ; } $ contentINI = eZINI :: instance ( 'content.ini' ) ; $ removeAction = $ contentINI -> hasVariable ( 'RemoveSettings' , 'DefaultRemoveAction' ) ? $ contentINI -> variable ( 'RemoveSettings' , 'DefaultRemoveAction' ) : 'trash' ; if ( $ removeAction !== 'trash' && $ removeAction !== 'delete' ) { $ removeAction = 'trash' ; } $ moveToTrash = ( $ removeAction === 'trash' ) ? true : false ; $ node -> removeNodeFromTree ( $ moveToTrash ) ; return true ; }
Handles deletion on the content tree level .
40,642
protected function copyVirtualFolder ( $ sourceSite , $ destinationSite , $ source , $ destination ) { $ source = $ this -> splitFirstPathElement ( $ source , $ sourceVFolder ) ; $ destination = $ this -> splitFirstPathElement ( $ destination , $ destinationVFolder ) ; if ( ! in_array ( $ sourceVFolder , array ( self :: virtualContentFolderName ( ) , self :: virtualMediaFolderName ( ) ) ) ) { return false ; } if ( ! in_array ( $ destinationVFolder , array ( self :: virtualContentFolderName ( ) , self :: virtualMediaFolderName ( ) ) ) ) { return false ; } if ( ! $ source or ! $ destination ) { return false ; } if ( ( $ sourceVFolder === self :: virtualContentFolderName ( ) or $ sourceVFolder === self :: virtualMediaFolderName ( ) ) and ( $ destinationVFolder === self :: virtualContentFolderName ( ) or $ destinationVFolder === self :: virtualMediaFolderName ( ) ) ) { return $ this -> copyContent ( $ sourceSite , $ destinationSite , $ sourceVFolder , $ destinationVFolder , $ source , $ destination ) ; } return false ; }
Handles copying on the virtual folder level .
40,643
protected function moveVirtualFolder ( $ sourceSite , $ destinationSite , $ source , $ destination , $ fullSource , $ fullDestination ) { $ this -> setCurrentSite ( $ sourceSite ) ; $ source = $ this -> splitFirstPathElement ( $ source , $ sourceVFolder ) ; $ destination = $ this -> splitFirstPathElement ( $ destination , $ destinationVFolder ) ; if ( ! $ source or ! $ destination ) { return false ; } if ( ( $ sourceVFolder === self :: virtualContentFolderName ( ) or $ sourceVFolder === self :: virtualMediaFolderName ( ) ) and ( $ destinationVFolder === self :: virtualContentFolderName ( ) or $ destinationVFolder === self :: virtualMediaFolderName ( ) ) ) { return $ this -> moveContent ( $ sourceSite , $ destinationSite , $ sourceVFolder , $ destinationVFolder , $ source , $ destination , $ fullSource , $ fullDestination ) ; } return false ; }
Handles moving on the virtual folder level .
40,644
protected static function tempDirectory ( ) { $ tempDir = eZSys :: varDirectory ( ) . '/webdav/tmp' ; if ( ! file_exists ( $ tempDir ) ) { eZDir :: mkdir ( $ tempDir , eZDir :: directoryPermission ( ) , true ) ; } return $ tempDir ; }
Returns the path to the WebDAV temporary directory .
40,645
protected function internalNodePath ( $ virtualFolder , $ collection ) { if ( $ virtualFolder === self :: virtualMediaFolderName ( ) ) { $ nodePath = 'media' ; if ( strlen ( $ collection ) > 0 ) { $ nodePath .= '/' . $ collection ; } } else { $ nodePath = $ collection ; } return $ nodePath ; }
Returns a path that corresponds to the internal path of nodes .
40,646
static function parameterSet ( $ fileName = 'site.ini' , $ rootDir = 'settings' , & $ section , & $ parameter ) { if ( ! eZINI :: exists ( $ fileName , $ rootDir ) ) return false ; $ iniInstance = eZINI :: instance ( $ fileName , $ rootDir , null , null , null , true ) ; return $ iniInstance -> hasVariable ( $ section , $ parameter ) ; }
Check whether a specified parameter in a specified section is set in a specified file
40,647
protected static function selectOverrideScope ( $ scope , $ identifier , $ dir , $ default ) { if ( $ scope !== null ) { $ def = self :: defaultOverrideDirs ( ) ; if ( isset ( $ def [ $ scope ] ) ) return $ scope ; eZDebug :: writeWarning ( "Undefined override dir scope: '$scope' with dir: '$dir'" , __METHOD__ ) ; } if ( $ identifier === 'siteaccess' ) return 'siteaccess' ; else if ( $ identifier && strpos ( $ identifier , 'extension:' ) === 0 ) return 'extension' ; else if ( strpos ( $ dir , 'siteaccess' ) !== false ) return 'siteaccess' ; else if ( strpos ( $ dir , 'extension' ) !== false ) return 'extension' ; eZDebug :: writeStrict ( "Could not figgure out INI scope for \$identifier: '$identifier' with \$dir: '$dir', falling back to '$default'" , __METHOD__ ) ; return $ default ; }
Function to handle bc with code from pre 4 . 4 that does not know about scopes
40,648
function variable ( $ blockName , $ varName ) { if ( isset ( $ this -> BlockValues [ $ blockName ] [ $ varName ] ) ) { $ value = $ this -> BlockValues [ $ blockName ] [ $ varName ] ; } if ( isset ( self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { $ value = self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ; } if ( isset ( $ value ) && isset ( self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { if ( ! is_array ( $ value ) || ! is_array ( self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { throw new RuntimeException ( "injected-merge-settings can only reference and contain array values" ) ; } $ value = array_merge ( $ value , self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ; } if ( isset ( $ value ) ) return $ value ; if ( ! isset ( $ this -> BlockValues [ $ blockName ] ) ) eZDebug :: writeError ( "Undefined group: '$blockName' in " . $ this -> FileName , __METHOD__ ) ; else eZDebug :: writeError ( "Undefined variable: '$varName' in group '$blockName' in " . $ this -> FileName , __METHOD__ ) ; return false ; }
Reads a variable from the ini file . Returns false if the variable was not found .
40,649
function variableMulti ( $ blockName , $ varNames , $ signatures = array ( ) ) { $ ret = array ( ) ; if ( ! isset ( $ this -> BlockValues [ $ blockName ] ) && ! isset ( self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] ) ) { eZDebug :: writeError ( "Undefined group: '$blockName' in " . $ this -> FileName , "eZINI" ) ; return false ; } foreach ( $ varNames as $ key => $ varName ) { $ ret [ $ key ] = null ; if ( isset ( $ this -> BlockValues [ $ blockName ] [ $ varName ] ) ) { $ ret [ $ key ] = $ this -> BlockValues [ $ blockName ] [ $ varName ] ; } if ( isset ( self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { $ ret [ $ key ] = self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ; } if ( isset ( self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { if ( ! is_array ( $ ret [ $ key ] ) || ! is_array ( self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { throw new RuntimeException ( "injected-merge-settings can only reference and contain array values" ) ; } $ ret [ $ key ] = array_merge ( $ this -> BlockValues [ $ blockName ] [ $ varName ] , self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ; } if ( isset ( $ ret [ $ key ] ) && isset ( $ signatures [ $ key ] ) ) { switch ( $ signatures [ $ key ] ) { case 'enabled' : $ ret [ $ key ] = $ this -> BlockValues [ $ blockName ] [ $ varName ] == 'enabled' ; break ; } } } return $ ret ; }
Reads multiple variables from the ini file . Returns false if the block does not exist .
40,650
function hasVariable ( $ blockName , $ varName ) { if ( ! isset ( self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) && ! isset ( $ this -> BlockValues [ $ blockName ] [ $ varName ] ) ) { return false ; } if ( isset ( self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) && self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] === false ) { return false ; } return true ; }
Checks if a variable is set .
40,651
function variableArray ( $ blockName , $ varName ) { $ ret = $ this -> variable ( $ blockName , $ varName ) ; if ( is_array ( $ ret ) ) { $ arr = array ( ) ; foreach ( $ ret as $ key => $ retItem ) { $ arr [ $ key ] = explode ( ';' , $ retItem ) ; } $ ret = $ arr ; } else if ( $ ret !== false ) { $ ret = trim ( $ ret ) === '' ? array ( ) : explode ( ';' , $ ret ) ; } return $ ret ; }
Reads a variable from the ini file or injected settings . The variable will be returned as an array . ; is used as delimiter .
40,652
function group ( $ blockName ) { if ( ! isset ( $ this -> BlockValues [ $ blockName ] ) ) { eZDebug :: writeError ( "Unknown group: '$blockName'" , __METHOD__ ) ; $ ret = null ; return $ ret ; } if ( isset ( self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] ) ) { $ ret = array_merge ( $ this -> BlockValues [ $ blockName ] , self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] ) ; } else { $ ret = $ this -> BlockValues [ $ blockName ] ; } return $ ret ; }
Fetches a variable group and returns it as an associative array .
40,653
function groups ( ) { if ( isset ( self :: $ injectedSettings [ $ this -> FileName ] ) || isset ( self :: $ injectedMergeSettings [ $ this -> FileName ] ) ) { $ result = $ this -> BlockValues ; foreach ( $ result as $ blockName => $ vars ) { foreach ( $ vars as $ varName => $ varValue ) { if ( isset ( self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { $ result [ $ blockName ] [ $ varName ] = self :: $ injectedSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ; } if ( isset ( self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { if ( ! is_array ( $ result [ $ blockName ] [ $ varName ] ) || ! is_array ( self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ) { throw new RuntimeException ( "injected-merge-settings can only reference and contain array values" ) ; } $ result [ $ blockName ] [ $ varName ] = array_merge ( $ varValue , self :: $ injectedMergeSettings [ $ this -> FileName ] [ $ blockName ] [ $ varName ] ) ; } } } foreach ( self :: $ injectedSettings [ $ this -> FileName ] as $ blockName => $ vars ) { if ( ! isset ( $ result [ $ blockName ] ) ) { $ result [ $ blockName ] = $ vars ; } } return $ result ; } return $ this -> BlockValues ; }
Fetches all defined groups and returns them as an associative array
40,654
function getNamedArray ( ) { if ( isset ( self :: $ injectedSettings [ $ this -> FileName ] ) ) { return array_merge ( $ this -> BlockValues , self :: $ injectedSettings [ $ this -> FileName ] ) ; } return $ this -> BlockValues ; }
Returns BlockValues which is a nicely named Array
40,655
static function resetGlobals ( $ fileName = 'site.ini' , $ rootDir = 'settings' , $ useLocalOverrides = null ) { self :: resetInstance ( $ fileName , $ rootDir , $ useLocalOverrides ) ; }
Resets a specific instance of eZINI .
40,656
public function filter ( ) { if ( preg_match ( $ this -> getPrefixPattern ( ) , $ this -> request -> uri , $ tokenMatches ) ) { $ this -> versionToken = isset ( $ tokenMatches [ 'version' ] ) ? $ tokenMatches [ 'version' ] : '' ; $ this -> apiProviderToken = isset ( $ tokenMatches [ 'provider' ] ) ? $ tokenMatches [ 'provider' ] : '' ; self :: $ version = $ this -> parseVersionValue ( ) ; self :: $ apiProvider = empty ( $ this -> apiProviderToken ) ? null : $ this -> apiProviderToken ; } }
Filters the request object for API provider name and version token .
40,657
public function disconnect ( ) { if ( self :: $ dbbackend !== null ) { self :: $ dbbackend -> _disconnect ( ) ; self :: $ dbbackend = null ; } }
Disconnects the cluster handler from the database
40,658
public function loadMetaData ( $ force = false ) { if ( $ this -> filePath === false ) return ; if ( $ force && isset ( $ GLOBALS [ 'eZClusterInfo' ] [ $ this -> filePath ] ) ) unset ( $ GLOBALS [ 'eZClusterInfo' ] [ $ this -> filePath ] ) ; if ( isset ( $ GLOBALS [ 'eZClusterInfo' ] [ $ this -> filePath ] ) ) { $ GLOBALS [ 'eZClusterInfo' ] [ $ this -> filePath ] [ 'cnt' ] += 1 ; $ this -> _metaData = $ GLOBALS [ 'eZClusterInfo' ] [ $ this -> filePath ] [ 'data' ] ; return ; } $ metaData = self :: $ dbbackend -> _fetchMetadata ( $ this -> filePath ) ; if ( $ metaData ) $ this -> _metaData = $ metaData ; else $ this -> _metaData = false ; if ( isset ( $ GLOBALS [ 'eZClusterInfo' ] ) && count ( $ GLOBALS [ 'eZClusterInfo' ] ) >= self :: INFOCACHE_MAX ) { usort ( $ GLOBALS [ 'eZClusterInfo' ] , function ( $ a , $ b ) { $ a = $ a [ 'cnt' ] ; $ b = $ b [ 'cnt' ] ; if ( $ a == $ b ) { return 0 ; } return $ a > $ b ? - 1 : 1 ; } ) ; array_pop ( $ GLOBALS [ 'eZClusterInfo' ] ) ; } $ GLOBALS [ 'eZClusterInfo' ] [ $ this -> filePath ] = array ( 'cnt' => 1 , 'data' => $ metaData ) ; }
Loads file meta information .
40,659
public function fileStore ( $ filePath , $ scope = false , $ delete = false , $ datatype = false ) { $ filePath = self :: cleanPath ( $ filePath ) ; eZDebugSetting :: writeDebug ( 'kernel-clustering' , "dfs::fileStore( '$filePath' )" ) ; if ( $ scope === false ) $ scope = 'UNKNOWN_SCOPE' ; if ( $ datatype === false ) $ datatype = 'misc' ; self :: $ dbbackend -> _store ( $ filePath , $ datatype , $ scope ) ; if ( $ delete ) @ unlink ( $ filePath ) ; }
Stores a file by path to the backend
40,660
public function storeContents ( $ contents , $ scope = false , $ datatype = false , $ storeLocally = false ) { if ( $ scope === false ) $ scope = 'UNKNOWN_SCOPE' ; if ( $ datatype === false ) $ datatype = 'misc' ; $ filePath = $ this -> filePath ; eZDebugSetting :: writeDebug ( 'kernel-clustering' , "dfs::storeContents( '$filePath' )" ) ; $ result = self :: $ dbbackend -> _storeContents ( $ filePath , $ contents , $ scope , $ datatype ) ; if ( $ result && $ storeLocally ) { eZFile :: create ( basename ( $ filePath ) , dirname ( $ filePath ) , $ contents , true ) ; } return $ result ; }
Store file contents using binary data
40,661
function fileFetch ( $ filePath ) { $ filePath = self :: cleanPath ( $ filePath ) ; eZDebugSetting :: writeDebug ( 'kernel-clustering' , "dfs::fileFetch( '$filePath' )" ) ; return self :: $ dbbackend -> _fetch ( $ filePath ) ; }
Fetches file from DFS and saves it in LFS under the same name .
40,662
public function fetchUnique ( ) { $ filePath = $ this -> filePath ; eZDebugSetting :: writeDebug ( 'kernel-clustering' , "dfs::fetchUnique( '$filePath' )" ) ; $ fetchedFilePath = self :: $ dbbackend -> _fetch ( $ filePath , true ) ; $ this -> uniqueName = $ fetchedFilePath ; return $ fetchedFilePath ; }
Fetches file from db and saves it in FS under a unique name
40,663
public function isDBFileExpired ( $ expiry , $ curtime , $ ttl ) { $ mtime = isset ( $ this -> metaData [ 'mtime' ] ) ? $ this -> metaData [ 'mtime' ] : 0 ; return self :: isFileExpired ( $ this -> filePath , $ mtime , $ expiry , $ curtime , $ ttl ) ; }
Calculates if the DB file is expired or not .
40,664
public function fileDeleteByWildcard ( $ wildcard ) { $ wildcard = self :: cleanPath ( $ wildcard ) ; eZDebug :: writeWarning ( "Using " . __METHOD__ . " is not recommended since it has some severe performance issues" ) ; eZDebugSetting :: writeDebug ( 'kernel-clustering' , "dfs::fileDeleteByWildcard( '$wildcard' )" ) ; self :: $ dbbackend -> _deleteByWildcard ( $ wildcard ) ; }
Deletes a list of files by wildcard
40,665
function purge ( $ printCallback = false , $ microsleep = false , $ max = false , $ expiry = false ) { eZDebugSetting :: writeDebug ( 'kernel-clustering' , "dfs::purge( '$this->filePath' )" ) ; $ file = $ this -> filePath ; if ( $ max === false ) { $ max = 100 ; } $ count = 0 ; do { if ( $ count > 0 && $ microsleep ) { usleep ( $ microsleep ) ; } $ count = self :: $ dbbackend -> _purgeByLike ( $ file . "/%" , true , $ max , $ expiry , 'purge' ) ; self :: $ dbbackend -> _purge ( $ file , true , $ expiry , 'purge' ) ; if ( $ printCallback ) { call_user_func_array ( $ printCallback , array ( $ file , $ count ) ) ; } } while ( $ count > 0 ) ; if ( is_file ( $ file ) ) { @ unlink ( $ file ) ; } elseif ( is_dir ( $ file ) ) { eZDir :: recursiveDelete ( $ file ) ; } eZClusterFileHandler :: cleanupEmptyDirectories ( $ file ) ; }
Purges local and remote file data for current file path .
40,666
function passthrough ( $ startOffset = 0 , $ length = false ) { eZDebugSetting :: writeDebug ( 'kernel-clustering' , "dfs::passthrough( '{$this->filePath}', $startOffset, $length )" ) ; self :: $ dbbackend -> _passThrough ( $ this -> filePath , $ startOffset , $ length , "dfs::passthrough( '{$this->filePath}'" ) ; }
Outputs file contents directly
40,667
function getFileList ( $ scopes = false , $ excludeScopes = false , $ limit = false , $ path = false ) { eZDebugSetting :: writeDebug ( 'kernel-clustering' , sprintf ( "dfs::getFileList( array( %s ), %d )" , is_array ( $ scopes ) ? implode ( ', ' , $ scopes ) : '' , ( int ) $ excludeScopes ) ) ; return self :: $ dbbackend -> _getFileList ( $ scopes , $ excludeScopes , $ limit , $ path ) ; }
Get list of files stored in database .
40,668
public function startCacheGeneration ( ) { eZDebugSetting :: writeDebug ( 'kernel-clustering' , "Starting cache generation" , "dfs::startCacheGeneration( '{$this->filePath}' )" ) ; $ generatingFilePath = $ this -> filePath . '.generating' ; try { $ ret = self :: $ dbbackend -> _startCacheGeneration ( $ this -> filePath , $ generatingFilePath ) ; } catch ( RuntimeException $ e ) { eZDebug :: writeError ( $ e -> getMessage ( ) ) ; return false ; } if ( $ ret [ 'result' ] == 'ok' ) { eZClusterFileHandler :: addGeneratingFile ( $ this ) ; $ this -> realFilePath = $ this -> filePath ; $ this -> filePath = $ generatingFilePath ; $ this -> generationStartTimestamp = $ ret [ 'mtime' ] ; return true ; } elseif ( $ ret [ 'result' ] == 'ko' ) { return $ ret [ 'remaining' ] ; } else { eZLog :: write ( "An error occured starting cache generation on '$generatingFilePath'" , 'cluster.log' ) ; return false ; } }
Starts cache generation for the current file .
40,669
public function abortCacheGeneration ( ) { eZDebugSetting :: writeDebug ( 'kernel-clustering' , 'Aborting cache generation' , "dfs::abortCacheGeneration( '{$this->filePath}' )" ) ; self :: $ dbbackend -> _abortCacheGeneration ( $ this -> filePath ) ; $ this -> filePath = $ this -> realFilePath ; $ this -> realFilePath = null ; eZClusterFileHandler :: removeGeneratingFile ( $ this ) ; }
Aborts the current cache generation process .
40,670
protected function prepareData ( $ data ) { if ( ( is_object ( $ data ) && ! ( $ data instanceof ezcBaseExportable ) ) || is_resource ( $ data ) ) { throw new ezcCacheInvalidDataException ( gettype ( $ data ) , array ( 'scalar' , 'array' , 'ezcBaseExportable' ) ) ; } return "<?php\nreturn " . var_export ( $ data , true ) . ";\n?>\n" ; }
Serialize the data for storing .
40,671
protected static function makePostArray ( eZHTTPTool $ http , $ key ) { if ( $ http -> hasPostVariable ( $ key ) && $ http -> postVariable ( $ key ) !== '' ) { $ value = $ http -> postVariable ( $ key ) ; if ( is_array ( $ value ) ) return $ value ; elseif ( strpos ( $ value , ',' ) === false ) return array ( $ value ) ; else return explode ( ',' , $ value ) ; } return array ( ) ; }
Creates an array out of a post parameter return empty array if post parameter is not set . Splits string on in case of comma seperated values .
40,672
protected static function hasPostValue ( eZHTTPTool $ http , $ key , $ falseValue = '' ) { return $ http -> hasPostVariable ( $ key ) && $ http -> postVariable ( $ key ) !== $ falseValue ; }
Checks if a post variable exitst and has a value
40,673
protected static function getDesignFile ( $ file ) { static $ bases = null ; static $ wwwDir = null ; if ( $ bases === null ) $ bases = eZTemplateDesignResource :: allDesignBases ( ) ; if ( $ wwwDir === null ) $ wwwDir = eZSys :: wwwDir ( ) . '/' ; $ triedFiles = array ( ) ; $ match = eZTemplateDesignResource :: fileMatch ( $ bases , '' , $ file , $ triedFiles ) ; if ( $ match === false ) { eZDebug :: writeWarning ( "Could not find: $file" , __METHOD__ ) ; return false ; } return $ wwwDir . htmlspecialchars ( $ match [ 'path' ] ) ; }
Internal function to get current index dir
40,674
public static function count ( $ def , $ conds = null , $ field = null ) { if ( ! isset ( $ field ) ) { $ field = '*' ; } $ customFields = array ( array ( 'operation' => 'COUNT( ' . $ field . ' )' , 'name' => 'row_count' ) ) ; $ rows = eZPersistentObject :: fetchObjectList ( $ def , array ( ) , $ conds , array ( ) , null , false , false , $ customFields ) ; return $ rows [ 0 ] [ 'row_count' ] ; }
Fetches the number of rows by using the object definition .
40,675
public static function fetchObject ( $ def , $ field_filters , $ conds , $ asObject = true , $ grouping = null , $ custom_fields = null ) { $ rows = eZPersistentObject :: fetchObjectList ( $ def , $ field_filters , $ conds , array ( ) , null , $ asObject , $ grouping , $ custom_fields ) ; if ( $ rows ) return $ rows [ 0 ] ; return null ; }
Fetches and returns an object based on the given parameters and returns is either as an object or as an array
40,676
public static function newObjectOrder ( $ def , $ orderField , $ conditions ) { $ db = eZDB :: instance ( ) ; $ table = $ def [ "name" ] ; $ keys = $ def [ "keys" ] ; $ cond_text = eZPersistentObject :: conditionText ( $ conditions ) ; $ rows = $ db -> arrayQuery ( "SELECT MAX($orderField) AS $orderField FROM $table $cond_text" ) ; if ( count ( $ rows ) > 0 and isset ( $ rows [ 0 ] [ $ orderField ] ) ) return $ rows [ 0 ] [ $ orderField ] + 1 ; else return 1 ; }
Returns an order value which can be used for new items in table for instance placement .
40,677
public static function reorderObject ( $ def , $ orderField , $ conditions , $ down = true ) { $ db = eZDB :: instance ( ) ; $ table = $ def [ "name" ] ; $ keys = $ def [ "keys" ] ; reset ( $ orderField ) ; $ order_id = key ( $ orderField ) ; $ order_val = $ orderField [ $ order_id ] ; if ( $ down ) { $ order_operator = ">=" ; $ order_type = "asc" ; $ order_add = - 1 ; } else { $ order_operator = "<=" ; $ order_type = "desc" ; $ order_add = 1 ; } $ fields = array_merge ( $ keys , array ( $ order_id ) ) ; $ rows = eZPersistentObject :: fetchObjectList ( $ def , $ fields , array_merge ( $ conditions , array ( $ order_id => array ( $ order_operator , $ order_val ) ) ) , array ( $ order_id => $ order_type ) , array ( "length" => 2 ) , false ) ; if ( count ( $ rows ) == 2 ) { $ swapSQL1 = eZPersistentObject :: swapRow ( $ table , $ keys , $ order_id , $ rows , 1 , 0 ) ; $ swapSQL2 = eZPersistentObject :: swapRow ( $ table , $ keys , $ order_id , $ rows , 0 , 1 ) ; $ db -> begin ( ) ; $ db -> query ( $ swapSQL1 ) ; $ db -> query ( $ swapSQL2 ) ; $ db -> commit ( ) ; } else { $ tmp = eZPersistentObject :: fetchObjectList ( $ def , $ fields , $ conditions , array ( $ order_id => $ order_type ) , array ( "length" => 1 ) , false ) ; $ where_text = eZPersistentObject :: conditionTextByRow ( $ keys , $ rows [ 0 ] ) ; $ db -> query ( "UPDATE $table SET $order_id='" . ( $ tmp [ 0 ] [ $ order_id ] + $ order_add ) . "'$where_text" ) ; } }
Moves a row in a database table .
40,678
public static function updateObjectList ( $ parameters ) { $ db = eZDB :: instance ( ) ; $ def = $ parameters [ 'definition' ] ; $ table = $ def [ 'name' ] ; $ fields = $ def [ 'fields' ] ; $ keys = $ def [ 'keys' ] ; $ updateFields = $ parameters [ 'update_fields' ] ; $ conditions = $ parameters [ 'conditions' ] ; $ query = "UPDATE $table SET " ; $ i = 0 ; $ valueBound = false ; foreach ( $ updateFields as $ field => $ value ) { $ fieldDef = $ fields [ $ field ] ; $ numericDataTypes = array ( 'integer' , 'float' , 'double' ) ; if ( strlen ( $ value ) == 0 && is_array ( $ fieldDef ) && in_array ( $ fieldDef [ 'datatype' ] , $ numericDataTypes ) && array_key_exists ( 'default' , $ fieldDef ) && $ fieldDef [ 'default' ] !== null ) { $ value = $ fieldDef [ 'default' ] ; } $ bindDataTypes = array ( 'text' ) ; if ( $ db -> bindingType ( ) != eZDBInterface :: BINDING_NO && $ db -> countStringSize ( $ value ) > 2000 && is_array ( $ fieldDef ) && in_array ( $ fieldDef [ 'datatype' ] , $ bindDataTypes ) ) { $ value = $ db -> bindVariable ( $ value , $ fieldDef ) ; $ valueBound = true ; } else $ valueBound = false ; if ( $ i > 0 ) $ query .= ', ' ; if ( $ valueBound ) $ query .= $ field . "=" . $ value ; else $ query .= $ field . "='" . $ db -> escapeString ( $ value ) . "'" ; ++ $ i ; } $ query .= ' WHERE ' ; $ i = 0 ; foreach ( $ conditions as $ conditionKey => $ condition ) { if ( $ i > 0 ) $ query .= ' AND ' ; if ( is_array ( $ condition ) ) { $ query .= $ conditionKey . ' IN (' ; $ j = 0 ; foreach ( $ condition as $ conditionValue ) { if ( $ j > 0 ) $ query .= ', ' ; $ query .= "'" . $ db -> escapeString ( $ conditionValue ) . "'" ; ++ $ j ; } $ query .= ')' ; } else $ query .= $ conditionKey . "='" . $ db -> escapeString ( $ condition ) . "'" ; ++ $ i ; } $ db -> query ( $ query ) ; }
Updates rows matching the given parameters
40,679
public function attributes ( ) { $ def = $ this -> definition ( ) ; $ attrs = array_keys ( $ def [ "fields" ] ) ; if ( isset ( $ def [ "function_attributes" ] ) ) $ attrs = array_unique ( array_merge ( $ attrs , array_keys ( $ def [ "function_attributes" ] ) ) ) ; if ( isset ( $ def [ "functions" ] ) ) $ attrs = array_unique ( array_merge ( $ attrs , array_keys ( $ def [ "functions" ] ) ) ) ; return $ attrs ; }
Returns the attributes for this object taken from the definition fields and function attributes .
40,680
public function registerChild ( ezpTopologicalSortNode $ childNode ) { if ( ! $ this -> children -> contains ( $ childNode ) ) $ this -> children -> attach ( $ childNode ) ; }
Register a child node .
40,681
public function registerParent ( ezpTopologicalSortNode $ parentNode ) { if ( ! $ this -> parents -> contains ( $ parentNode ) ) $ this -> parents -> attach ( $ parentNode ) ; }
Register a parent node .
40,682
public function popChild ( ) { if ( ! $ this -> children -> valid ( ) ) $ this -> children -> rewind ( ) ; if ( ! $ this -> children -> valid ( ) ) return false ; $ child = $ this -> children -> current ( ) ; $ this -> children -> detach ( $ child ) ; return $ child ; }
Pop a child from the list of children .
40,683
public static function serializeDraft ( eZUser $ user ) { return json_encode ( array ( 'login' => $ user -> attribute ( 'login' ) , 'password_hash' => $ user -> attribute ( 'password_hash' ) , 'email' => $ user -> attribute ( 'email' ) , 'password_hash_type' => $ user -> attribute ( 'password_hash_type' ) ) ) ; }
Generates a serialized draft of the ezuser content
40,684
static public function defaultExceptionHandler ( $ e ) { if ( PHP_SAPI != 'cli' ) { header ( 'HTTP/1.x 500 Internal Server Error' ) ; header ( 'Content-Type: text/html' ) ; echo "An unexpected error has occurred. Please contact the webmaster.<br />" ; if ( eZDebug :: isDebugEnabled ( ) ) { echo $ e -> getMessage ( ) . ' in ' . $ e -> getFile ( ) . ' on line ' . $ e -> getLine ( ) ; } } else { $ cli = eZCLI :: instance ( ) ; $ cli -> error ( "An unexpected error has occurred. Please contact the webmaster." ) ; if ( eZDebug :: isDebugEnabled ( ) ) { $ cli -> error ( $ e -> getMessage ( ) . ' in ' . $ e -> getFile ( ) . ' on line ' . $ e -> getLine ( ) ) ; } } eZLog :: write ( 'Unexpected error, the message was : ' . $ e -> getMessage ( ) . ' in ' . $ e -> getFile ( ) . ' on line ' . $ e -> getLine ( ) , 'error.log' ) ; eZExecution :: cleanup ( ) ; eZExecution :: setCleanExit ( ) ; exit ( 1 ) ; }
Installs the default Exception handler
40,685
protected function exitWithInternalError ( $ errorMessage , $ errorCode = 500 ) { if ( eZModule :: $ useExceptions ) { switch ( $ errorCode ) { case 403 : throw new ezpAccessDenied ( $ errorMessage ) ; case 500 : default : throw new RuntimeException ( $ errorMessage , $ errorCode ) ; } } else { header ( $ _SERVER [ 'SERVER_PROTOCOL' ] . ' 500 Internal Server Error' ) ; eZExecution :: cleanup ( ) ; eZExecution :: setCleanExit ( ) ; return new ezpKernelResult ( json_encode ( array ( 'error' => $ errorMessage , 'code' => $ errorCode ) ) ) ; } }
Handles an internal error . If not using exceptions will return an ezpKernelResult object with JSON encoded message .
40,686
protected final static function initHooks ( ) { if ( isset ( $ init ) ) return ; static $ init = true ; $ ini = eZINI :: instance ( 'content.ini' ) ; self :: attachHooks ( 'preQueue' , $ ini -> variable ( 'PublishingSettings' , 'AsynchronousPublishingPreQueueHooks' ) ) ; self :: attachHooks ( 'postHandling' , $ ini -> variable ( 'PublishingSettings' , 'AsynchronousPublishingPostHandlingHooks' ) ) ; }
Initializes queue hooks from INI settings
40,687
protected final static function attachHooks ( $ connector , $ hooksList ) { if ( is_array ( $ hooksList ) && count ( $ hooksList ) ) { foreach ( $ hooksList as $ hook ) { self :: signals ( ) -> connect ( $ connector , $ hook ) ; } } }
Attaches hooks to a signal slot
40,688
public static function add ( $ objectId , $ version ) { self :: init ( ) ; self :: signals ( ) -> emit ( 'preQueue' , $ version , $ objectId ) ; $ processObject = ezpContentPublishingProcess :: queue ( eZContentObjectVersion :: fetchVersion ( $ version , $ objectId ) ) ; return $ processObject ; }
Adds a draft to the publishing queue
40,689
public static function isQueued ( $ objectId , $ version ) { $ process = ezpContentPublishingProcess :: fetchByContentObjectVersion ( $ objectId , $ version ) ; return ( $ process instanceof ezpContentPublishingProcess ) ; }
Checks if an object exists in the queue whatever the status is
40,690
private static function getNextItem ( ) { $ pendingStatusValue = ezpContentPublishingProcess :: STATUS_PENDING ; $ workingStatusValue = ezpContentPublishingProcess :: STATUS_WORKING ; $ sql = <<< SQLSELECT *FROM ezpublishingqueueprocesses p, ezcontentobject_version vWHERE p.status = $pendingStatusValue AND p.ezcontentobject_version_id = v.id AND v.contentobject_id NOT IN ( SELECT v.contentobject_id FROM ezpublishingqueueprocesses p, ezcontentobject_version v WHERE p.ezcontentobject_version_id = v.id AND p.status = $workingStatusValue )ORDER BY p.created, p.ezcontentobject_version_id ASCSQL ; $ db = eZDB :: instance ( ) ; $ rows = $ db -> arrayQuery ( $ sql , array ( 'offset' => 0 , 'limit' => 1 ) ) ; if ( count ( $ rows ) == 0 ) return false ; $ persistentObjects = eZPersistentObject :: handleRows ( $ rows , 'ezpContentPublishingProcess' , true ) ; return $ persistentObjects [ 0 ] ; }
Returns the next queued item excluding those for which another version of the same content is being published .
40,691
public function generateUrl ( array $ arguments = null ) { $ apiPrefix = ezpRestPrefixFilterInterface :: getApiPrefix ( ) . '/' ; $ apiProviderName = ezpRestPrefixFilterInterface :: getApiProviderName ( ) ; return $ apiPrefix . ( ! $ apiProviderName ? '' : $ apiProviderName . '/' ) . 'v' . $ this -> version . '/' . str_replace ( $ apiPrefix , '' , $ this -> route -> generateUrl ( $ arguments ) ) ; }
Generates an URL back out of a route including possible arguments
40,692
function prefetch ( ) { $ relatedObjectIDArray = array ( ) ; $ nodeIDArray = array ( ) ; $ linkIDArray = $ this -> getAttributeValueArray ( 'link' , 'url_id' ) ; if ( count ( $ linkIDArray ) > 0 ) { $ inIDSQL = implode ( ', ' , $ linkIDArray ) ; $ db = eZDB :: instance ( ) ; $ linkArray = $ db -> arrayQuery ( "SELECT * FROM ezurl WHERE id IN ( $inIDSQL ) " ) ; foreach ( $ linkArray as $ linkRow ) { $ url = str_replace ( '&' , '&amp;' , $ linkRow [ 'url' ] ) ; $ this -> LinkArray [ $ linkRow [ 'id' ] ] = $ url ; } } $ linkRelatedObjectIDArray = $ this -> getAttributeValueArray ( 'link' , 'object_id' ) ; $ linkNodeIDArray = $ this -> getAttributeValueArray ( 'link' , 'node_id' ) ; $ objectRelatedObjectIDArray = $ this -> getAttributeValueArray ( 'object' , 'id' ) ; $ embedRelatedObjectIDArray = $ this -> getAttributeValueArray ( 'embed' , 'object_id' ) ; $ embedInlineRelatedObjectIDArray = $ this -> getAttributeValueArray ( 'embed-inline' , 'object_id' ) ; $ embedNodeIDArray = $ this -> getAttributeValueArray ( 'embed' , 'node_id' ) ; $ embedInlineNodeIDArray = $ this -> getAttributeValueArray ( 'embed-inline' , 'node_id' ) ; $ relatedObjectIDArray = array_merge ( $ linkRelatedObjectIDArray , $ objectRelatedObjectIDArray , $ embedRelatedObjectIDArray , $ embedInlineRelatedObjectIDArray ) ; $ relatedObjectIDArray = array_unique ( $ relatedObjectIDArray ) ; if ( count ( $ relatedObjectIDArray ) > 0 ) { if ( $ this -> ContentObjectAttribute instanceof eZContentObjectAttribute ) { $ this -> ObjectArray = eZContentObject :: fetchIDArray ( $ relatedObjectIDArray , true , $ this -> ContentObjectAttribute -> attribute ( 'language_code' ) ) ; } else { $ this -> ObjectArray = eZContentObject :: fetchIDArray ( $ relatedObjectIDArray ) ; } } $ nodeIDArray = array_merge ( $ linkNodeIDArray , $ embedNodeIDArray , $ embedInlineNodeIDArray ) ; $ nodeIDArray = array_unique ( $ nodeIDArray ) ; if ( count ( $ nodeIDArray ) > 0 ) { $ nodes = eZContentObjectTreeNode :: fetch ( $ nodeIDArray ) ; if ( is_array ( $ nodes ) ) { foreach ( $ nodes as $ node ) { $ nodeID = $ node -> attribute ( 'node_id' ) ; $ this -> NodeArray [ $ nodeID ] = $ node ; } } elseif ( $ nodes ) { $ node = $ nodes ; $ nodeID = $ node -> attribute ( 'node_id' ) ; $ this -> NodeArray [ $ nodeID ] = $ node ; } } }
Prefetch objects nodes and urls for further rendering
40,693
function renderAll ( $ element , $ childrenOutput , $ vars ) { $ tagText = '' ; foreach ( $ childrenOutput as $ childOutput ) { $ tagText .= $ childOutput [ 1 ] ; } $ tagText = $ this -> renderTag ( $ element , $ tagText , $ vars ) ; return array ( false , $ tagText ) ; }
Renders all the content of children tags inside the current tag
40,694
function attribute ( $ name ) { if ( $ name === 'is_editor_enabled' ) $ attr = self :: isEditorEnabled ( ) ; else if ( $ name === 'can_disable' ) $ attr = $ this -> currentUserHasAccess ( 'disable_editor' ) ; else if ( $ name === 'editor_layout_settings' ) $ attr = $ this -> getEditorLayoutSettings ( ) ; else if ( $ name === 'browser_supports_dhtml_type' ) $ attr = self :: browserSupportsDHTMLType ( ) ; else if ( $ name === 'is_compatible_version' ) $ attr = $ this -> isCompatibleVersion ( ) ; else if ( $ name === 'version' ) $ attr = self :: version ( ) ; else if ( $ name === 'ezpublish_version' ) $ attr = $ this -> eZPublishVersion ; else if ( $ name === 'xml_tag_alias' ) $ attr = self :: getXmlTagAliasList ( ) ; else if ( $ name === 'json_xml_tag_alias' ) $ attr = json_encode ( self :: getXmlTagAliasList ( ) ) ; else $ attr = parent :: attribute ( $ name ) ; return $ attr ; }
Function used by template system to call ezoe functions
40,695
public static function browserSupportsDHTMLType ( ) { if ( self :: $ browserType === null ) { self :: $ browserType = false ; $ userAgent = eZSys :: serverVariable ( 'HTTP_USER_AGENT' ) ; if ( strpos ( $ userAgent , 'Presto' ) !== false && preg_match ( '/Presto\/([0-9\.]+)/i' , $ userAgent , $ browserInfo ) ) { if ( $ browserInfo [ 1 ] >= 2.1 ) self :: $ browserType = 'Presto' ; } else if ( strpos ( $ userAgent , 'Trident' ) !== false && preg_match ( '/Trident\/([0-9\.]+)/i' , $ userAgent , $ browserInfo ) ) { if ( $ browserInfo [ 1 ] >= 4.0 ) self :: $ browserType = 'Trident' ; } else if ( strpos ( $ userAgent , 'MSIE' ) !== false && preg_match ( '/MSIE[ \/]([0-9\.]+)/i' , $ userAgent , $ browserInfo ) ) { if ( $ browserInfo [ 1 ] >= 6.0 ) self :: $ browserType = 'Trident' ; } else if ( strpos ( $ userAgent , 'Gecko' ) !== false && preg_match ( '/rv:([0-9\.]+)/i' , $ userAgent , $ browserInfo ) ) { if ( $ browserInfo [ 1 ] >= 1.9 ) self :: $ browserType = 'Gecko' ; } else if ( strpos ( $ userAgent , 'WebKit' ) !== false && strpos ( $ userAgent , 'Mobile' ) === false && strpos ( $ userAgent , 'Android' ) === false && strpos ( $ userAgent , 'iPad' ) === false && strpos ( $ userAgent , 'iPhone' ) === false && strpos ( $ userAgent , 'iPod' ) === false && preg_match ( '/WebKit\/([0-9\.]+)/i' , $ userAgent , $ browserInfo ) ) { if ( $ browserInfo [ 1 ] >= 528.16 ) self :: $ browserType = 'WebKit' ; } else if ( strpos ( $ userAgent , 'AppleWebKit' ) !== false && strpos ( $ userAgent , 'Mobile' ) !== false && preg_match ( '/AppleWebKit\/([0-9\.]+)/i' , $ userAgent , $ browserInfo ) ) { if ( $ browserInfo [ 1 ] >= 534.46 ) self :: $ browserType = 'MobileWebKit' ; } if ( self :: $ browserType === false ) eZDebug :: writeNotice ( 'Browser not supported: ' . $ userAgent , __METHOD__ ) ; } return self :: $ browserType ; }
browserSupportsDHTMLType Identify supported browser by layout engine using user agent string .
40,696
public static function getXmlTagAliasList ( ) { if ( self :: $ xmlTagAliasList === null ) { $ ezoeIni = eZINI :: instance ( 'ezoe.ini' ) ; self :: $ xmlTagAliasList = $ ezoeIni -> variable ( 'EditorSettings' , 'XmlTagNameAlias' ) ; } return self :: $ xmlTagAliasList ; }
getXmlTagAliasList Get and chache XmlTagNameAlias from ezoe . ini
40,697
function isValid ( ) { if ( ! $ this -> currentUserHasAccess ( ) ) { eZDebug :: writeNotice ( 'Current user does not have access to ezoe, falling back to normal xml editor!' , __METHOD__ ) ; return false ; } if ( ! self :: browserSupportsDHTMLType ( ) ) { if ( $ this -> currentUserHasAccess ( 'disable_editor' ) ) { eZDebug :: writeNotice ( 'Current browser is not supported by ezoe, falling back to normal xml editor!' , __METHOD__ ) ; return false ; } eZDebug :: writeWarning ( 'Current browser is not supported by ezoe, but user does not have access to disable editor!' , __METHOD__ ) ; } return true ; }
isValid Called by handler loading code to see if this is a valid handler .
40,698
function customObjectAttributeHTTPAction ( $ http , $ action , $ contentObjectAttribute ) { switch ( $ action ) { case 'enable_editor' : { self :: setIsEditorEnabled ( true ) ; } break ; case 'disable_editor' : { if ( $ this -> currentUserHasAccess ( 'disable_editor' ) ) self :: setIsEditorEnabled ( false ) ; else eZDebug :: writeError ( 'Current user does not have access to disable editor, but trying anyway!' , __METHOD__ ) ; } break ; default : { eZDebug :: writeError ( 'Unknown custom HTTP action: ' . $ action , __METHOD__ ) ; } break ; } }
customObjectAttributeHTTPAction Custom http actions exposed by the editor .
40,699
public static function updateUrlObjectLinks ( $ contentObjectAttribute , $ urlIDArray ) { $ objectAttributeID = $ contentObjectAttribute -> attribute ( 'id' ) ; $ objectAttributeVersion = $ contentObjectAttribute -> attribute ( 'version' ) ; foreach ( $ urlIDArray as $ urlID ) { $ linkObjectLink = eZURLObjectLink :: fetch ( $ urlID , $ objectAttributeID , $ objectAttributeVersion ) ; if ( $ linkObjectLink == null ) { $ linkObjectLink = eZURLObjectLink :: create ( $ urlID , $ objectAttributeID , $ objectAttributeVersion ) ; $ linkObjectLink -> store ( ) ; } } }
updateUrlObjectLinks Updates URL to object links .