idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
40,300 | function rollback ( ) { if ( is_array ( $ this -> TransactionStackTree ) ) { $ this -> TransactionStackTree = array ( ) ; } $ ini = eZINI :: instance ( ) ; if ( $ ini -> variable ( "DatabaseSettings" , "Transactions" ) == "enabled" ) { if ( $ this -> TransactionCounter <= 0 ) { eZDebug :: writeError ( 'No transaction in progress, cannot rollback' , __METHOD__ ) ; return false ; } $ this -> TransactionCounter = 0 ; if ( $ this -> isConnected ( ) ) { $ oldRecordError = $ this -> RecordError ; $ this -> RecordError = false ; $ this -> rollbackQuery ( ) ; $ this -> RecordError = $ oldRecordError ; } } return true ; } | Cancels the transaction . |
40,301 | function generateFailedTransactionStackEntry ( $ stack , $ indentCount ) { $ stackText = '' ; $ indent = '' ; if ( $ indentCount > 0 ) { $ indent = str_repeat ( " " , $ indentCount * 4 ) ; } $ stackText .= $ indent . "Level " . $ stack [ 'level' ] . "\n" . $ indent . "{" . $ indent . "\n" ; $ stackText .= $ indent . " Began at:\n" ; for ( $ i = 0 ; $ i < 2 && $ i < count ( $ stack [ 'trace' ] ) ; ++ $ i ) { $ indent2 = str_repeat ( " " , $ i + 1 ) ; if ( $ i > 0 ) { $ indent2 .= "->" ; } $ stackText .= $ indent . $ indent2 . $ this -> generateTraceEntry ( $ stack [ 'trace' ] [ $ i ] ) ; $ stackText .= "\n" ; } foreach ( $ stack [ 'sub_levels' ] as $ subStack ) { $ stackText .= $ this -> generateFailedTransactionStackEntry ( $ subStack , $ indentCount + 1 ) ; } if ( isset ( $ stack [ 'commit_trace' ] ) ) { $ stackText .= $ indent . " And commited at:\n" ; for ( $ i = 0 ; $ i < 2 && $ i < count ( $ stack [ 'commit_trace' ] ) ; ++ $ i ) { $ indent2 = str_repeat ( " " , $ i + 1 ) ; if ( $ i > 0 ) { $ indent2 .= "->" ; } $ stackText .= $ indent . $ indent2 . $ this -> generateTraceEntry ( $ stack [ 'commit_trace' ] [ $ i ] ) ; $ stackText .= "\n" ; } } $ stackText .= $ indent . "}" . "\n" ; return $ stackText ; } | Recursive helper function for generating stack tree output . |
40,302 | function generateTraceEntry ( $ entry ) { if ( isset ( $ entry [ 'file' ] ) ) { $ stackText = $ entry [ 'file' ] ; } else { $ stackText = "???" ; } $ stackText .= ":" ; if ( isset ( $ entry [ 'line' ] ) ) { $ stackText .= $ entry [ 'line' ] ; } else { $ stackText .= "???" ; } $ stackText .= " " ; if ( isset ( $ entry [ 'class' ] ) ) { $ stackText .= $ entry [ 'class' ] ; } else { $ stackText .= "???" ; } $ stackText .= "::" ; if ( isset ( $ entry [ 'function' ] ) ) { $ stackText .= $ entry [ 'function' ] ; } else { $ stackText .= "???" ; } return $ stackText ; } | Helper function for generating output for one stack - trace entry . |
40,303 | function reportError ( ) { if ( $ this -> TransactionCounter > 0 ) { $ this -> invalidateTransaction ( ) ; $ transID = 'TRANSID-' . md5 ( time ( ) . mt_rand ( ) ) ; eZDebug :: writeError ( 'Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is ' . $ transID . '.' , 'eZDBInterface::commit ' . $ transID ) ; $ this -> rollback ( ) ; if ( $ this -> errorHandling == eZDB :: ERROR_HANDLING_EXCEPTIONS ) { throw new eZDBException ( $ this -> ErrorMessage , $ this -> ErrorNumber ) ; } else { eZExecution :: cleanup ( ) ; eZExecution :: setCleanExit ( ) ; eZDebug :: setHandleType ( eZDebug :: HANDLE_NONE ) ; $ ini = eZINI :: instance ( ) ; $ adminEmail = $ ini -> variable ( 'MailSettings' , 'AdminEmail' ) ; if ( ! eZSys :: isShellExecution ( ) ) { if ( ! headers_sent ( ) ) { header ( "HTTP/1.1 500 Internal Server Error" ) ; } $ site = htmlentities ( eZSys :: serverVariable ( 'HTTP_HOST' ) , ENT_QUOTES ) ; $ uri = htmlentities ( eZSys :: serverVariable ( 'REQUEST_URI' ) , ENT_QUOTES ) ; print ( "<div class=\"fatal-error\" style=\"" ) ; print ( 'margin: 0.5em 0 1em 0; ' . 'padding: 0.25em 1em 0.75em 1em;' . 'border: 4px solid #000000;' . 'background-color: #f8f8f4;' . 'border-color: #f95038;" >' ) ; print ( "<b>Fatal error</b>: A database transaction in eZ Publish failed.<br/>" ) ; print ( "<p>" ) ; print ( "The current execution was stopped to prevent further problems.<br/>\n" . "You should contact the <a href=\"mailto:$adminEmail?subject=Transaction failed on $site and URI $uri with ID $transID\">System Administrator</a> of this site with the information on this page.<br/>\n" . "The current transaction ID is <b>$transID</b> and has been logged.<br/>\n" . "Please include the transaction ID and the current URL when contacting the system administrator.<br/>\n" ) ; print ( "</p>" ) ; print ( "</div>" ) ; $ templateResult = null ; if ( function_exists ( 'eZDisplayResult' ) ) { eZDisplayResult ( $ templateResult ) ; } } else { fputs ( STDERR , "Fatal error: A database transaction in eZ Publish failed.\n" ) ; fputs ( STDERR , "\n" ) ; fputs ( STDERR , "The current execution was stopped to prevent further problems.\n" . "You should contact the System Administrator ($adminEmail) of this site.\n" . "The current transaction ID is $transID and has been logged.\n" . "Please include the transaction ID and the name of the current script when contacting the system administrator.\n" ) ; fputs ( STDERR , "\n" ) ; fputs ( STDERR , eZDebug :: printReport ( false , false , true ) ) ; } exit ( 1 ) ; } } } | This is called whenever an error occurs in one of the database handlers . |
40,304 | function relationName ( $ relationType ) { $ names = array ( eZDBInterface :: RELATION_TABLE => 'TABLE' , eZDBInterface :: RELATION_SEQUENCE => 'SEQUENCE' , eZDBInterface :: RELATION_TRIGGER => 'TRIGGER' , eZDBInterface :: RELATION_VIEW => 'VIEW' , eZDBInterface :: RELATION_INDEX => 'INDEX' ) ; if ( ! isset ( $ names [ $ relationType ] ) ) return false ; return $ names [ $ relationType ] ; } | Returns the name of the relation type which is usable in SQL or false if unknown type . |
40,305 | function dropTempTableList ( $ tableList , $ server = self :: SERVER_SLAVE ) { foreach ( $ tableList as $ tableName ) $ this -> dropTempTable ( "DROP TABLE $tableName" , $ server ) ; } | Drop temporary table list |
40,306 | function generateUniqueTempTableName ( $ pattern , $ randomizeIndex = false , $ server = self :: SERVER_SLAVE ) { $ tableList = array_keys ( $ this -> eZTableList ( $ server ) ) ; if ( $ randomizeIndex === false ) { $ randomizeIndex = mt_rand ( 10 , 1000 ) ; } do { $ uniqueTempTableName = str_replace ( '%' , $ randomizeIndex , $ pattern ) ; $ randomizeIndex ++ ; } while ( in_array ( $ uniqueTempTableName , $ tableList ) ) ; return $ uniqueTempTableName ; } | Generate unique table name basing on the given pattern . |
40,307 | public function setErrorHandling ( $ errorHandling ) { if ( $ errorHandling != eZDB :: ERROR_HANDLING_EXCEPTIONS && $ errorHandling != eZDB :: ERROR_HANDLING_STANDARD ) throw new RuntimeException ( "Unknown eZDB error handling mode $errorHandling" ) ; $ this -> errorHandling = $ errorHandling ; } | Sets the eZDB error handling mode |
40,308 | static function create ( $ parentNodeID = null , $ contentObjectID = null , $ contentObjectVersion = 0 , $ sortField = 0 , $ sortOrder = true ) { $ row = array ( 'node_id' => null , 'main_node_id' => null , 'parent_node_id' => $ parentNodeID , 'contentobject_id' => $ contentObjectID , 'contentobject_version' => $ contentObjectVersion , 'contentobject_is_published' => false , 'depth' => 1 , 'path_string' => null , 'path_identification_string' => null , 'is_hidden' => false , 'is_invisible' => false , 'sort_field' => $ sortField , 'sort_order' => $ sortOrder , 'modified_subnode' => 0 , 'remote_id' => eZRemoteIdUtility :: generate ( 'node' ) , 'priority' => 0 ) ; $ node = new eZContentObjectTreeNode ( $ row ) ; return $ node ; } | Creates a new tree node and returns it . |
40,309 | function dataMap ( ) { $ object = $ this -> object ( ) ; if ( self :: $ useCurrentUserDraft ) { $ draft = eZContentObjectVersion :: fetchLatestUserDraft ( $ object -> attribute ( 'id' ) , eZUser :: currentUserID ( ) , $ object -> currentLanguageObject ( ) -> attribute ( 'id' ) , $ object -> attribute ( 'modified' ) ) ; if ( $ draft instanceof eZContentObjectVersion ) return $ object -> fetchDataMap ( $ draft -> attribute ( 'version' ) ) ; } return $ object -> fetchDataMap ( $ this -> attribute ( 'contentobject_version' ) ) ; } | Returns an array with all the content object attributes where the keys are the attribute identifiers . |
40,310 | function remoteID ( ) { $ remoteID = $ this -> attribute ( 'remote_id' , true ) ; if ( ! $ remoteID ) { $ this -> setAttribute ( 'remote_id' , eZRemoteIdUtility :: generate ( 'node' ) ) ; $ this -> sync ( array ( 'remote_id' ) ) ; $ remoteID = $ this -> attribute ( 'remote_id' , true ) ; } return $ remoteID ; } | Get the remote id of content node |
40,311 | function canRead ( ) { if ( ! isset ( $ this -> Permissions [ "can_read" ] ) ) { $ this -> Permissions [ "can_read" ] = $ this -> checkAccess ( 'read' ) ; } return ( $ this -> Permissions [ "can_read" ] == 1 ) ; } | Returns true if the node can be read by the current user . |
40,312 | function canPdf ( ) { if ( ! isset ( $ this -> Permissions [ "can_pdf" ] ) ) { $ this -> Permissions [ "can_pdf" ] = $ this -> checkAccess ( 'pdf' ) ; } return ( $ this -> Permissions [ "can_pdf" ] == 1 ) ; } | Returns true if the current user can create a pdf of this content object . |
40,313 | function canViewEmbed ( ) { if ( ! isset ( $ this -> Permissions [ "can_view_embed" ] ) ) { $ this -> Permissions [ "can_view_embed" ] = $ this -> checkAccess ( 'view_embed' ) ; } return ( $ this -> Permissions [ "can_view_embed" ] == 1 ) ; } | Returns true if the node can be viewed as embeded object by the current user . |
40,314 | function canEdit ( ) { if ( ! isset ( $ this -> Permissions [ "can_edit" ] ) ) { $ this -> Permissions [ "can_edit" ] = $ this -> checkAccess ( 'edit' ) ; if ( $ this -> Permissions [ "can_edit" ] != 1 ) { $ user = eZUser :: currentUser ( ) ; if ( $ user -> id ( ) == $ this -> ContentObject -> attribute ( 'id' ) ) { $ access = $ user -> hasAccessTo ( 'user' , 'selfedit' ) ; if ( $ access [ 'accessWord' ] == 'yes' ) { $ this -> Permissions [ "can_edit" ] = 1 ; } } } } return ( $ this -> Permissions [ "can_edit" ] == 1 ) ; } | Returns true if the node can be edited by the current user . |
40,315 | function canHide ( ) { if ( ! isset ( $ this -> Permissions [ "can_hide" ] ) ) { $ this -> Permissions [ "can_hide" ] = $ this -> checkAccess ( 'hide' ) ; } return ( $ this -> Permissions [ "can_hide" ] == 1 ) ; } | Returns true if the node can be hidden by the current user . |
40,316 | function canCreate ( ) { if ( ! isset ( $ this -> Permissions [ "can_create" ] ) ) { $ this -> Permissions [ "can_create" ] = $ this -> checkAccess ( 'create' ) ; } return ( $ this -> Permissions [ "can_create" ] == 1 ) ; } | Returns true if the current user can create a new node as child of this node . |
40,317 | function canRemove ( ) { if ( ! isset ( $ this -> Permissions [ "can_remove" ] ) ) { $ this -> Permissions [ "can_remove" ] = $ this -> checkAccess ( 'remove' ) ; } return ( $ this -> Permissions [ "can_remove" ] == 1 ) ; } | Returns true if the node can be removed by the current user . |
40,318 | function canMoveFrom ( ) { if ( ! isset ( $ this -> Permissions [ 'can_move_from' ] ) ) { $ this -> Permissions [ 'can_move_from' ] = $ this -> checkAccess ( 'edit' ) && $ this -> checkAccess ( 'remove' ) ; } return ( $ this -> Permissions [ 'can_move_from' ] == 1 ) ; } | Returns true if the node can be moved by the current user . |
40,319 | function canSwap ( ) { if ( ! isset ( $ this -> Permissions [ 'can_swap' ] ) ) { $ this -> Permissions [ 'can_swap' ] = $ this -> checkAccess ( 'edit' ) ; } return ( $ this -> Permissions [ 'can_swap' ] == 1 ) ; } | Returns true if a node can be swaped by the current user . |
40,320 | static function fetchListCount ( ) { $ sql = "SELECT count( node_id ) as count FROM ezcontentobject_tree" ; $ db = eZDB :: instance ( ) ; $ rows = $ db -> arrayQuery ( $ sql ) ; return $ rows [ 0 ] [ 'count' ] ; } | Fetches the number of nodes which exists in the system . |
40,321 | static function fetchList ( $ asObject = true , $ offset = false , $ limit = false ) { $ sql = "SELECT * FROM ezcontentobject_tree" ; $ parameters = array ( ) ; if ( $ offset !== false ) $ parameters [ 'offset' ] = $ offset ; if ( $ limit !== false ) $ parameters [ 'limit' ] = $ limit ; $ db = eZDB :: instance ( ) ; $ rows = $ db -> arrayQuery ( $ sql , $ parameters ) ; $ nodes = array ( ) ; if ( $ asObject ) { foreach ( $ rows as $ row ) { $ nodes [ ] = new eZContentObjectTreeNode ( $ row ) ; } return $ nodes ; } else return $ rows ; } | Fetches a list of nodes and returns it . Offset and limitation can be set if needed . |
40,322 | static function createClassFilteringSQLString ( $ classFilterType , & $ classFilterArray ) { $ classCondition = '' ; if ( isset ( $ classFilterType ) && ( $ classFilterType == 'include' || $ classFilterType == 'exclude' ) && count ( $ classFilterArray ) > 0 ) { $ classCondition = ' ' ; $ i = 0 ; $ classCount = count ( $ classFilterArray ) ; $ classIDArray = array ( ) ; foreach ( $ classFilterArray as $ classID ) { $ originalClassID = $ classID ; if ( is_string ( $ classID ) && ! is_numeric ( $ classID ) ) { $ classID = eZContentClass :: classIDByIdentifier ( $ classID ) ; } if ( is_numeric ( $ classID ) ) { $ classIDArray [ ] = $ classID ; } else { eZDebugSetting :: writeWarning ( 'kernel-content-class' , "Invalid class identifier in subTree() classfilterarray, classID : " . $ originalClassID ) ; } } if ( count ( $ classIDArray ) > 0 ) { $ classCondition .= " ezcontentobject.contentclass_id " ; if ( $ classFilterType == 'include' ) $ classCondition .= " IN " ; else $ classCondition .= " NOT IN " ; $ classIDString = implode ( ', ' , $ classIDArray ) ; $ classCondition .= ' ( ' . $ classIDString . ' ) AND' ; } else { if ( count ( $ classIDArray ) == 0 and count ( $ classFilterArray ) > 0 and $ classFilterType == 'include' ) { $ classCondition = false ; } } } return $ classCondition ; } | Returns an SQL string to filter query results by classes |
40,323 | static function createExtendedAttributeFilterSQLStrings ( & $ extendedAttributeFilter ) { $ filter = array ( 'tables' => '' , 'joins' => '' , 'columns' => '' , 'group_by' => '' ) ; if ( $ extendedAttributeFilter and count ( $ extendedAttributeFilter ) > 1 ) { $ extendedAttributeFilterID = $ extendedAttributeFilter [ 'id' ] ; $ extendedAttributeFilterParams = $ extendedAttributeFilter [ 'params' ] ; $ filterINI = eZINI :: instance ( 'extendedattributefilter.ini' ) ; if ( ! $ filterINI -> hasGroup ( $ extendedAttributeFilterID ) ) { eZDebug :: writeError ( "Unable to find configuration for the extended attribute filter '$extendedAttributeFilterID', the filter will be ignored" , __METHOD__ ) ; return $ filter ; } $ filterClassName = $ filterINI -> variable ( $ extendedAttributeFilterID , 'ClassName' ) ; $ filterMethodName = $ filterINI -> variable ( $ extendedAttributeFilterID , 'MethodName' ) ; if ( $ filterINI -> hasVariable ( $ extendedAttributeFilterID , 'FileName' ) ) { $ filterFile = $ filterINI -> variable ( $ extendedAttributeFilterID , 'FileName' ) ; if ( $ filterINI -> hasVariable ( $ extendedAttributeFilterID , 'ExtensionName' ) ) { $ extensionName = $ filterINI -> variable ( $ extendedAttributeFilterID , 'ExtensionName' ) ; include_once ( eZExtension :: baseDirectory ( ) . "/$extensionName/$filterFile" ) ; } else { include_once ( $ filterFile ) ; } } if ( ! class_exists ( $ filterClassName , true ) ) { eZDebug :: writeError ( "Unable to find the PHP class '$filterClassName' associated with the extended attribute filter '$extendedAttributeFilterID', the filter will be ignored" , __METHOD__ ) ; return $ filter ; } $ classObject = new $ filterClassName ( ) ; $ parameterArray = array ( $ extendedAttributeFilterParams ) ; $ sqlResult = call_user_func_array ( array ( $ classObject , $ filterMethodName ) , $ parameterArray ) ; $ filter [ 'tables' ] = $ sqlResult [ 'tables' ] ; $ filter [ 'joins' ] = $ sqlResult [ 'joins' ] ; $ filter [ 'columns' ] = isset ( $ sqlResult [ 'columns' ] ) ? $ sqlResult [ 'columns' ] : '' ; if ( isset ( $ sqlResult [ 'group_by' ] ) ) $ filter [ 'group_by' ] = $ sqlResult [ 'group_by' ] ; } return $ filter ; } | Creates a filter array from extended attribute filters |
40,324 | static function fetchAliasesFromNodeList ( $ nodeList ) { if ( ! is_array ( $ nodeList ) || count ( $ nodeList ) < 1 ) return array ( ) ; $ db = eZDB :: instance ( ) ; $ where = $ db -> generateSQLINStatement ( $ nodeList , 'node_id' , false , false , 'int' ) ; $ query = "SELECT node_id, path_identification_string FROM ezcontentobject_tree WHERE $where" ; $ pathListArray = $ db -> arrayQuery ( $ query ) ; return $ pathListArray ; } | Fetches path_identification_string for a list of nodes |
40,325 | static function findMainNodeArray ( $ objectIDArray , $ asObject = true ) { if ( empty ( $ objectIDArray ) ) return null ; $ db = eZDB :: instance ( ) ; $ nodeListArray = $ db -> arrayQuery ( "SELECT " . "ezcontentobject.contentclass_id, ezcontentobject.current_version, ezcontentobject.id, ezcontentobject.initial_language_id, ezcontentobject.language_mask, " . "ezcontentobject.modified, ezcontentobject.name, ezcontentobject.owner_id, ezcontentobject.published, ezcontentobject.remote_id AS object_remote_id, ezcontentobject.section_id, " . "ezcontentobject.status, ezcontentobject_tree.contentobject_is_published, ezcontentobject_tree.contentobject_version, ezcontentobject_tree.depth, ezcontentobject_tree.is_hidden, " . "ezcontentobject_tree.is_invisible, ezcontentobject_tree.main_node_id, ezcontentobject_tree.modified_subnode, ezcontentobject_tree.node_id, ezcontentobject_tree.parent_node_id, " . "ezcontentobject_tree.path_identification_string, ezcontentobject_tree.path_string, ezcontentobject_tree.priority, ezcontentobject_tree.remote_id, ezcontentobject_tree.sort_field, " . "ezcontentobject_tree.sort_order, ezcontentclass.serialized_name_list as class_serialized_name_list, ezcontentclass.identifier as class_identifier, ezcontentclass.is_container " . "FROM ezcontentobject_tree " . "INNER JOIN ezcontentobject ON (ezcontentobject.id = ezcontentobject_tree.contentobject_id) " . "INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) " . "WHERE " . $ db -> generateSQLINStatement ( $ objectIDArray , 'ezcontentobject_tree.contentobject_id' , false , false , 'int' ) . " AND " . "ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id AND " . "ezcontentclass.version = 0" ) ; if ( $ asObject ) { return eZContentObjectTreeNode :: makeObjectsArray ( $ nodeListArray ) ; } return $ nodeListArray ; } | Fetches the main nodes for an array of object id s |
40,326 | function subtreeSoleNodeCount ( $ params = array ( ) ) { $ nodeID = $ this -> attribute ( 'node_id' ) ; $ node = $ this ; $ depth = false ; if ( isset ( $ params [ 'Depth' ] ) && is_numeric ( $ params [ 'Depth' ] ) ) { $ depth = $ params [ 'Depth' ] ; } $ fromNode = $ nodeID ; $ nodePath = null ; $ nodeDepth = 0 ; if ( count ( $ node ) != 0 ) { $ nodePath = $ node -> attribute ( 'path_string' ) ; $ nodeDepth = $ node -> attribute ( 'depth' ) ; } $ childPath = $ nodePath ; $ db = eZDB :: instance ( ) ; $ pathString = " ezcot.path_string like '$childPath%' and " ; $ notEqParentString = "ezcot.node_id != $fromNode" ; $ depthCond = '' ; if ( $ depth ) { $ nodeDepth += $ depth ; if ( isset ( $ params [ 'DepthOperator' ] ) && $ params [ 'DepthOperator' ] == 'eq' ) { $ depthCond = ' ezcot.depth = ' . $ nodeDepth . '' ; $ notEqParentString = '' ; } else $ depthCond = ' ezcot.depth <= ' . $ nodeDepth . ' and ' ; } $ tmpTableName = $ db -> generateUniqueTempTableName ( 'eznode_count_%' ) ; $ db -> createTempTable ( "CREATE TEMPORARY TABLE $tmpTableName ( count int )" ) ; $ query = "INSERT INTO $tmpTableName SELECT count( ezcot.main_node_id ) AS count FROM ezcontentobject_tree ezcot, ezcontentobject_tree ezcot_all WHERE $pathString $depthCond $notEqParentString and ezcot.contentobject_id = ezcot_all.contentobject_id GROUP BY ezcot_all.main_node_id HAVING count( ezcot.main_node_id ) <= 1" ; $ db -> query ( $ query , eZDBInterface :: SERVER_SLAVE ) ; $ query = "SELECT count( * ) AS count FROM $tmpTableName" ; $ rows = $ db -> arrayQuery ( $ query , array ( ) , eZDBInterface :: SERVER_SLAVE ) ; $ db -> dropTempTable ( "DROP TABLE $tmpTableName" ) ; return $ rows [ 0 ] [ 'count' ] ; } | Returns the number of nodes in the current subtree that have no other placements . |
40,327 | protected function hasCurrentSubtreeLimitation ( array $ policy ) { if ( ! isset ( $ policy [ 'Subtree' ] ) && ! isset ( $ policy [ 'Node' ] ) ) { return true ; } if ( isset ( $ policy [ 'Subtree' ] ) ) { foreach ( $ policy [ 'Subtree' ] as $ subtreeString ) { if ( strpos ( $ this -> attribute ( 'path_string' ) , $ subtreeString ) !== false ) { return true ; } } } if ( isset ( $ policy [ 'Node' ] ) ) { foreach ( $ policy [ 'Node' ] as $ subtreeString ) { if ( strpos ( $ this -> attribute ( 'path_string' ) , $ subtreeString ) !== false ) { return true ; } } } return false ; } | Checks if provided policy array has a limitation on current subtree |
40,328 | static function getParentNodeIdListByContentObjectID ( $ objectIDs , $ groupByObjectId = false , $ onlyMainNode = false ) { if ( ! $ objectIDs ) return null ; if ( ! is_array ( $ objectIDs ) ) $ objectIDs = array ( $ objectIDs ) ; $ db = eZDB :: instance ( ) ; $ query = 'SELECT parent_node_id, contentobject_id FROM ezcontentobject_tree WHERE ' . $ db -> generateSQLINStatement ( $ objectIDs , 'contentobject_id' , false , false , 'int' ) ; if ( $ onlyMainNode ) { $ query .= ' AND node_id = main_node_id' ; } $ list = $ db -> arrayQuery ( $ query ) ; $ parentNodeIDs = array ( ) ; if ( $ groupByObjectId ) { foreach ( $ list as $ item ) { $ objectID = $ item [ 'contentobject_id' ] ; if ( ! isset ( $ parentNodeIDs [ $ objectID ] ) ) { $ parentNodeIDs [ $ objectID ] = array ( ) ; } $ parentNodeIDs [ $ objectID ] [ ] = $ item [ 'parent_node_id' ] ; } } else { foreach ( $ list as $ item ) { $ parentNodeIDs [ ] = $ item [ 'parent_node_id' ] ; } } return $ parentNodeIDs ; } | Get parent node id s by content object id s . |
40,329 | function object ( ) { if ( $ this -> hasContentObject ( ) ) { return $ this -> ContentObject ; } $ contentobject_id = $ this -> attribute ( 'contentobject_id' ) ; $ obj = eZContentObject :: fetch ( $ contentobject_id ) ; if ( $ this -> CurrentLanguage ) { $ obj -> setCurrentLanguage ( $ this -> CurrentLanguage ) ; } $ this -> ContentObject = $ obj ; return $ obj ; } | Returns the eZContentObject associated to this node |
40,330 | function creator ( ) { $ db = eZDB :: instance ( ) ; $ query = "SELECT creator_id FROM ezcontentobject_version WHERE contentobject_id = '$this->ContentObjectID' AND version = '$this->ContentObjectVersion' " ; $ creatorArray = $ db -> arrayQuery ( $ query ) ; return eZContentObject :: fetch ( $ creatorArray [ 0 ] [ 'creator_id' ] ) ; } | Returns the creator of the version published in the node . |
40,331 | function contentObjectVersionObject ( $ asObject = true ) { $ version = eZContentObjectVersion :: fetchVersion ( $ this -> ContentObjectVersion , $ this -> ContentObjectID , $ asObject ) ; if ( $ this -> CurrentLanguage != false ) { $ version -> CurrentLanguage = $ this -> CurrentLanguage ; } return $ version ; } | Returns the eZContentObjectVersionObject of the current node |
40,332 | function urlAlias ( ) { $ useURLAlias = & $ GLOBALS [ 'eZContentObjectTreeNodeUseURLAlias' ] ; $ ini = eZINI :: instance ( ) ; $ cleanURL = '' ; if ( ! isset ( $ useURLAlias ) ) { $ useURLAlias = $ ini -> variable ( 'URLTranslator' , 'Translation' ) == 'enabled' ; } if ( $ useURLAlias ) { $ path = $ this -> pathWithNames ( ) ; if ( $ ini -> hasVariable ( 'SiteAccessSettings' , 'PathPrefix' ) && $ ini -> variable ( 'SiteAccessSettings' , 'PathPrefix' ) != '' ) { $ prepend = $ ini -> variable ( 'SiteAccessSettings' , 'PathPrefix' ) ; $ pathIdenStr = substr ( $ prepend , strlen ( $ prepend ) - 1 ) == '/' ? $ path . '/' : $ path ; if ( strncasecmp ( $ pathIdenStr , $ prepend , strlen ( $ prepend ) ) == 0 ) $ cleanURL = eZURLAliasML :: cleanURL ( substr ( $ path , strlen ( $ prepend ) ) ) ; else $ cleanURL = eZURLAliasML :: cleanURL ( $ path ) ; } else { $ cleanURL = eZURLAliasML :: cleanURL ( $ path ) ; } } else { $ cleanURL = eZURLAliasML :: cleanURL ( 'content/view/full/' . $ this -> NodeID ) ; } return $ cleanURL ; } | Returns the node s url alias |
40,333 | public function classIdentifier ( ) { if ( $ this -> ClassIdentifier === null ) { $ object = $ this -> object ( ) ; $ this -> ClassIdentifier = $ object -> contentClassIdentifier ( ) ; } return $ this -> ClassIdentifier ; } | Returns the node s class identifier |
40,334 | public function className ( ) { if ( $ this -> ClassName === null ) { $ object = $ this -> object ( ) ; $ class = $ object -> contentClass ( ) ; $ this -> ClassName = $ class -> attribute ( 'name' ) ; } return $ this -> ClassName ; } | Returns the node s class name |
40,335 | public function classIsContainer ( ) { if ( $ this -> ClassIsContainer === null ) { $ object = $ this -> object ( ) ; $ class = $ object -> contentClass ( ) ; $ this -> ClassIsContainer = $ class -> attribute ( 'is_container' ) ; } return $ this -> ClassIsContainer ; } | Returns 1 if the node s class is a container class 0 otherwise |
40,336 | function hiddenStatusString ( ) { if ( $ this -> IsHidden ) { return ezpI18n :: tr ( 'kernel/content' , 'Hidden' ) ; } else if ( $ this -> IsInvisible ) { return ezpI18n :: tr ( 'kernel/content' , 'Hidden by superior' ) ; } return ezpI18n :: tr ( 'kernel/content' , 'Visible' ) ; } | Returns combined string representation of both is_hidden and is_invisible attributes Used in the limitation handling templates . |
40,337 | static function hideSubTree ( eZContentObjectTreeNode $ node , $ modifyRootNode = true ) { $ nodeID = $ node -> attribute ( 'node_id' ) ; $ time = time ( ) ; $ db = eZDB :: instance ( ) ; if ( eZAudit :: isAuditEnabled ( ) ) { $ objectID = $ node -> attribute ( 'contentobject_id' ) ; $ objectName = $ node -> attribute ( 'name' ) ; eZAudit :: writeAudit ( 'content-hide' , array ( 'Node ID' => $ nodeID , 'Object ID' => $ objectID , 'Content Name' => $ objectName , 'Time' => $ time , 'Comment' => 'Node has been hidden: eZContentObjectTreeNode::hideSubTree()' ) ) ; } $ db -> begin ( ) ; if ( ! $ node -> attribute ( 'is_invisible' ) ) { if ( $ modifyRootNode ) $ db -> query ( "UPDATE ezcontentobject_tree SET is_hidden=1, is_invisible=1, modified_subnode=$time WHERE node_id=$nodeID" ) ; $ nodePath = $ node -> attribute ( 'path_string' ) ; $ db -> query ( "UPDATE ezcontentobject_tree SET is_invisible=1, modified_subnode=$time WHERE is_invisible=0 AND path_string LIKE '$nodePath%'" ) ; } else { if ( $ modifyRootNode ) $ db -> query ( "UPDATE ezcontentobject_tree SET is_hidden=1, modified_subnode=$time WHERE node_id=$nodeID" ) ; } $ node -> updateAndStoreModified ( ) ; $ db -> commit ( ) ; eZContentObjectTreeNode :: clearViewCacheForSubtree ( $ node , $ modifyRootNode ) ; } | Hide a subtree |
40,338 | static function unhideSubTree ( eZContentObjectTreeNode $ node , $ modifyRootNode = true ) { $ nodeID = $ node -> attribute ( 'node_id' ) ; $ nodePath = $ node -> attribute ( 'path_string' ) ; $ nodeInvisible = $ node -> attribute ( 'is_invisible' ) ; $ parentNode = $ node -> attribute ( 'parent' ) ; if ( ! $ parentNode instanceof eZContentObjectTreeNode ) { eZDebug :: writeError ( "Parent of Node #$nodeID doesn't exist or inaccesible." , __METHOD__ ) ; return ; } $ time = time ( ) ; if ( eZAudit :: isAuditEnabled ( ) ) { $ objectID = $ node -> attribute ( 'contentobject_id' ) ; $ objectName = $ node -> attribute ( 'name' ) ; eZAudit :: writeAudit ( 'content-hide' , array ( 'Node ID' => $ nodeID , 'Object ID' => $ objectID , 'Content Name' => $ objectName , 'Time' => $ time , 'Comment' => 'Node has been unhidden: eZContentObjectTreeNode::unhideSubTree()' ) ) ; } $ db = eZDB :: instance ( ) ; $ db -> begin ( ) ; if ( ! $ parentNode -> attribute ( 'is_invisible' ) ) { if ( $ modifyRootNode ) $ db -> query ( "UPDATE ezcontentobject_tree SET is_invisible=0, is_hidden=0, modified_subnode=$time WHERE node_id=$nodeID" ) ; $ hiddenChildren = $ db -> arrayQuery ( "SELECT path_string FROM ezcontentobject_tree " . "WHERE node_id <> $nodeID AND is_hidden=1 AND path_string LIKE '$nodePath%'" ) ; $ skipSubtreesString = '' ; foreach ( $ hiddenChildren as $ i ) $ skipSubtreesString .= " AND path_string NOT LIKE '" . $ i [ 'path_string' ] . "%'" ; $ db -> query ( "UPDATE ezcontentobject_tree SET is_invisible=0, modified_subnode=$time WHERE path_string LIKE '$nodePath%' $skipSubtreesString" ) ; } else { if ( $ modifyRootNode ) $ db -> query ( "UPDATE ezcontentobject_tree SET is_hidden=0, modified_subnode=$time WHERE node_id=$nodeID" ) ; } $ node -> updateAndStoreModified ( ) ; $ db -> commit ( ) ; eZContentObjectTreeNode :: clearViewCacheForSubtree ( $ node , $ modifyRootNode ) ; } | Unhide a subtree |
40,339 | static function clearViewCacheForSubtree ( eZContentObjectTreeNode $ node , $ clearForRootNode = true ) { static $ limit = 200 ; if ( $ clearForRootNode ) { $ objectID = $ node -> attribute ( 'contentobject_id' ) ; eZContentCacheManager :: clearContentCacheIfNeeded ( $ objectID ) ; } $ offset = 0 ; $ params = array ( 'AsObject' => false , 'Depth' => false , 'Limitation' => array ( ) ) ; $ subtreeCount = $ node -> subTreeCount ( $ params ) ; while ( $ offset < $ subtreeCount ) { $ params [ 'Offset' ] = $ offset ; $ params [ 'Limit' ] = $ limit ; $ subtreeChunk = $ node -> subTree ( $ params ) ; $ nNodesInChunk = count ( $ subtreeChunk ) ; $ offset += $ nNodesInChunk ; if ( $ nNodesInChunk == 0 ) break ; $ objectIDList = array ( ) ; foreach ( $ subtreeChunk as $ curNode ) $ objectIDList [ ] = $ curNode [ 'id' ] ; unset ( $ subtreeChunk ) ; eZContentCacheManager :: clearContentCacheIfNeeded ( array_unique ( $ objectIDList ) ) ; } return true ; } | Clears the view cache for a subtree |
40,340 | static function availableClassListJsArray ( $ parameters = false ) { $ iniMenu = eZINI :: instance ( 'contentstructuremenu.ini' ) ; $ falseValue = "''" ; if ( $ iniMenu -> hasVariable ( 'TreeMenu' , 'CreateHereMenu' ) ) { $ createHereMenu = $ iniMenu -> variable ( 'TreeMenu' , 'CreateHereMenu' ) ; } else { $ createHereMenu = 'simplified' ; } if ( $ createHereMenu != 'simplified' and $ createHereMenu != 'full' ) return $ falseValue ; $ ini = eZINI :: instance ( 'content.ini' ) ; list ( $ usersClassGroupID , $ setupClassGroupID ) = $ ini -> variableMulti ( 'ClassGroupIDs' , array ( 'Users' , 'Setup' ) ) ; $ userRootNode = $ ini -> variable ( 'NodeSettings' , 'UserRootNode' ) ; $ groupIDs = false ; $ filterType = 'include' ; if ( ! is_array ( $ parameters ) ) return $ falseValue ; $ node = isset ( $ parameters [ 'node' ] ) ? $ parameters [ 'node' ] : false ; if ( is_object ( $ node ) ) { if ( $ createHereMenu == 'full' and ! $ node -> canCreate ( ) ) return $ falseValue ; $ obj = $ node -> object ( ) ; $ contentClass = $ obj -> attribute ( 'content_class' ) ; if ( ! $ contentClass -> attribute ( 'is_container' ) ) { return $ falseValue ; } $ pathArray = $ node -> pathArray ( ) ; } else { if ( isset ( $ parameters [ 'is_container' ] ) and ! $ parameters [ 'is_container' ] ) return $ falseValue ; if ( $ createHereMenu == 'full' and isset ( $ parameters [ 'node_id' ] ) ) { $ node = eZContentObjectTreeNode :: fetch ( $ parameters [ 'node_id' ] ) ; if ( is_object ( $ node ) and ! $ node -> canCreate ( ) ) return $ falseValue ; } $ pathString = isset ( $ parameters [ 'path_string' ] ) ? $ parameters [ 'path_string' ] : false ; if ( ! $ pathString ) return $ falseValue ; $ pathItems = explode ( '/' , $ pathString ) ; $ pathArray = array ( ) ; foreach ( $ pathItems as $ pathItem ) { if ( $ pathItem != '' ) $ pathArray [ ] = ( int ) $ pathItem ; } } if ( in_array ( $ userRootNode , $ pathArray ) ) { $ groupIDs = array ( $ usersClassGroupID ) ; } else { $ groupIDs = array ( $ usersClassGroupID , $ setupClassGroupID ) ; $ filterType = 'exclude' ; } if ( $ createHereMenu == 'simplified' ) { $ classes = eZContentClass :: fetchAllClasses ( false , $ filterType == 'include' , $ groupIDs ) ; return eZContentObjectTreeNode :: getClassesJsArray ( false , $ filterType == 'include' , $ groupIDs , false , $ classes ) ; } return eZContentObjectTreeNode :: getClassesJsArray ( $ node , $ filterType == 'include' , $ groupIDs ) ; } | Returns available classes as Js array . Checks for ini settings . |
40,341 | public function isNodeTrashAllowed ( ) { $ userClassIDArray = eZUser :: contentClassIDs ( ) ; $ class = $ this -> attribute ( 'object' ) -> attribute ( 'content_class' ) ; if ( in_array ( $ class -> attribute ( 'id' ) , $ userClassIDArray ) ) { return false ; } return $ this -> subTreeCount ( array ( 'Limitation' => array ( ) , 'SortBy' => array ( 'path' , false ) , 'IgnoreVisibility' => true , 'ClassFilterType' => 'include' , 'ClassFilterArray' => $ userClassIDArray , 'AsObject' => false ) ) == 0 ; } | Figure out if a node can be sent to trash or if it should be directly deleted as objects containing ezuser attributes can not be sent to trash . |
40,342 | static function getObjectIdsInNodeSubTree ( $ node ) { $ db = eZDB :: instance ( ) ; $ nodePath = $ node -> attribute ( 'path_string' ) ; $ pathString = " path_string like '$nodePath%' AND " ; $ objectIDArray = $ db -> arrayQuery ( "SELECT ezcontentobject.id FROM ezcontentobject_tree, ezcontentobject WHERE $pathString ezcontentobject_tree.contentobject_id=ezcontentobject.id AND ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id" ) ; if ( count ( $ objectIDArray ) == 0 ) return null ; $ objectSimpleIDArray = array ( ) ; foreach ( $ objectIDArray as $ objectID ) { $ objectSimpleIDArray [ ] = $ objectID [ 'id' ] ; } return $ objectSimpleIDArray ; } | Returns an array of Object IDs inside node subtree or null when empty . |
40,343 | public static function query ( ezpContentCriteria $ criteria ) { $ fetchParams = self :: translateFetchParams ( $ criteria ) ; $ nodes = eZContentObjectTreeNode :: subTreeByNodeID ( $ fetchParams -> params , $ fetchParams -> rootNodeId ) ; $ return = array ( ) ; foreach ( $ nodes as $ node ) { $ return [ ] = ezpContent :: fromNode ( $ node ) ; } return $ return ; } | Runs a content repository query using a given set of criteria |
40,344 | public static function queryCount ( ezpContentCriteria $ criteria ) { $ fetchParams = self :: translateFetchParams ( $ criteria ) ; $ count = eZContentObjectTreeNode :: subTreeCountByNodeID ( $ fetchParams -> params , $ fetchParams -> rootNodeId ) ; return $ count ; } | Returns node count using a given set of criteria |
40,345 | public function process ( $ text , $ createRootNode = true ) { $ text = preg_replace ( '#<!--.*? , '' , $ text ) ; $ text = str_replace ( array ( ' ' , ' ' , ' ' ) , "\xC2\xA0" , $ text ) ; return parent :: process ( $ text , $ createRootNode ) ; } | Process html text and transform it to xml . |
40,346 | private static function packedToBin ( $ packedIPAddress ) { $ binaryIPAddress = '' ; if ( version_compare ( PHP_VERSION , '5.5.0-dev' , '>=' ) ) { $ unpackedIPAddress = unpack ( 'a16' , $ packedIPAddress ) ; } else { $ unpackedIPAddress = unpack ( 'A16' , $ packedIPAddress ) ; } $ unpackedIPAddressArray = str_split ( $ unpackedIPAddress [ 1 ] ) ; foreach ( $ unpackedIPAddressArray as $ character ) { $ binaryIPAddress .= str_pad ( decbin ( ord ( $ character ) ) , 8 , '0' , STR_PAD_LEFT ) ; } return $ binaryIPAddress ; } | Turns the packed output of inet_pton into a full binary representation |
40,347 | private static function isAllowedByCurrentIP ( $ allowedIpList ) { $ ipAddresIPV4Pattern = "/^(([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+))(\/([0-9]+)$|$)/" ; $ ipAddressIPV6Pattern = "/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))(\/([0-9]+)$|$)$/" ; $ ipAddress = eZSys :: clientIP ( ) ; if ( $ ipAddress ) { foreach ( $ allowedIpList as $ itemToMatch ) { if ( preg_match ( "/:/" , $ ipAddress ) ) { if ( preg_match ( $ ipAddressIPV6Pattern , $ itemToMatch , $ matches ) ) { if ( $ matches [ 69 ] ) { if ( self :: isIPInNetIPv6 ( $ ipAddress , $ itemToMatch ) ) { return true ; } } else { if ( $ matches [ 1 ] == $ itemToMatch ) { return true ; } } } } elseif ( preg_match ( "/\./" , $ ipAddress ) ) { if ( preg_match ( $ ipAddresIPV4Pattern , $ itemToMatch , $ matches ) ) { if ( $ matches [ 6 ] ) { if ( self :: isIPInNet ( $ ipAddress , $ matches [ 1 ] , $ matches [ 7 ] ) ) { return true ; } } else { if ( $ matches [ 1 ] == $ ipAddress ) { return true ; } } } } } return false ; } else { return eZSys :: isShellExecution ( ) && in_array ( 'commandline' , $ allowedIpList ) ; } } | If debugging is allowed for the current IP address . |
40,348 | static function baseDirectory ( eZINI $ siteINI = null ) { if ( $ siteINI === null ) $ siteINI = eZINI :: instance ( ) ; $ extensionDirectory = $ siteINI -> variable ( 'ExtensionSettings' , 'ExtensionDirectory' ) ; return $ extensionDirectory ; } | return the base directory for extensions |
40,349 | public static function activeExtensions ( $ extensionType = false , eZINI $ siteINI = null ) { if ( $ siteINI === null ) { $ siteINI = eZINI :: instance ( ) ; } $ activeExtensions = array ( ) ; if ( ! $ extensionType || $ extensionType === 'default' ) { $ activeExtensions = $ siteINI -> variable ( 'ExtensionSettings' , 'ActiveExtensions' ) ; } if ( ! $ extensionType || $ extensionType === 'access' ) { $ activeExtensions = array_merge ( $ activeExtensions , $ siteINI -> variable ( 'ExtensionSettings' , 'ActiveAccessExtensions' ) ) ; } if ( isset ( $ GLOBALS [ 'eZActiveExtensions' ] ) ) { $ activeExtensions = array_merge ( $ activeExtensions , $ GLOBALS [ 'eZActiveExtensions' ] ) ; } if ( ! isset ( $ activeExtensions [ 0 ] ) ) { return $ activeExtensions ; } $ activeExtensions = array_unique ( $ activeExtensions ) ; if ( $ siteINI -> variable ( 'ExtensionSettings' , 'ExtensionOrdering' ) !== 'enabled' ) { return $ activeExtensions ; } $ cacheIdentifier = md5 ( serialize ( $ activeExtensions ) ) ; if ( isset ( self :: $ activeExtensionsCache [ $ cacheIdentifier ] ) ) { return self :: $ activeExtensionsCache [ $ cacheIdentifier ] ; } $ extensionDirectory = self :: baseDirectory ( ) ; $ expiryHandler = eZExpiryHandler :: instance ( ) ; $ phpCache = new eZPHPCreator ( self :: CACHE_DIR , "active_extensions_{$cacheIdentifier}.php" ) ; $ expiryTime = $ expiryHandler -> hasTimestamp ( 'active-extensions-cache' ) ? $ expiryHandler -> timestamp ( 'active-extensions-cache' ) : 0 ; if ( ! $ phpCache -> canRestore ( $ expiryTime ) ) { self :: $ activeExtensionsCache [ $ cacheIdentifier ] = self :: extensionOrdering ( $ activeExtensions ) ; foreach ( self :: $ activeExtensionsCache [ $ cacheIdentifier ] as $ activeExtension ) { if ( ! file_exists ( $ extensionDirectory . '/' . $ activeExtension ) ) { eZDebug :: writeError ( "Extension '$activeExtension' does not exist, looked for directory '" . $ extensionDirectory . '/' . $ activeExtension . "'" , __METHOD__ ) ; } } $ phpCache -> addVariable ( 'activeExtensions' , self :: $ activeExtensionsCache [ $ cacheIdentifier ] ) ; $ phpCache -> store ( true ) ; } else { $ data = $ phpCache -> restore ( array ( 'activeExtensions' => 'activeExtensions' ) ) ; self :: $ activeExtensionsCache [ $ cacheIdentifier ] = $ data [ 'activeExtensions' ] ; } return self :: $ activeExtensionsCache [ $ cacheIdentifier ] ; } | Return an array with activated extensions . |
40,350 | public static function extensionOrdering ( array $ activeExtensions ) { $ activeExtensionsSet = array_flip ( $ activeExtensions ) ; $ dependencies = array ( ) ; foreach ( $ activeExtensions as $ extension ) { $ loadingOrderData = ezpExtension :: getInstance ( $ extension ) -> getLoadingOrder ( ) ; if ( ! isset ( $ dependencies [ $ extension ] ) ) $ dependencies [ $ extension ] = array ( ) ; if ( isset ( $ loadingOrderData [ 'after' ] ) ) { foreach ( $ loadingOrderData [ 'after' ] as $ dependency ) { if ( isset ( $ activeExtensionsSet [ $ dependency ] ) ) $ dependencies [ $ extension ] [ ] = $ dependency ; } } if ( isset ( $ loadingOrderData [ 'before' ] ) ) { foreach ( $ loadingOrderData [ 'before' ] as $ dependency ) { if ( isset ( $ activeExtensionsSet [ $ dependency ] ) ) $ dependencies [ $ dependency ] [ ] = $ extension ; } } } $ topologySort = new ezpTopologicalSort ( $ dependencies ) ; $ activeExtensionsSorted = $ topologySort -> sort ( ) ; return $ activeExtensionsSorted !== false ? $ activeExtensionsSorted : $ activeExtensions ; } | Returns the provided array reordered with loading order information taken into account . |
40,351 | static function activateExtensions ( $ extensionType = 'default' , eZINI $ siteINI = null ) { if ( $ siteINI === null ) { $ siteINI = eZINI :: instance ( ) ; } if ( $ extensionType === false ) { eZDebug :: writeStrict ( "Setting parameter \$extensionType to false is deprecated as of 4.4, see doc/bc/4.4!" , __METHOD__ ) ; } $ extensionDirectory = self :: baseDirectory ( ) ; $ activeExtensions = self :: activeExtensions ( $ extensionType , $ siteINI ) ; $ hasExtensions = false ; foreach ( $ activeExtensions as $ activeExtension ) { $ extensionSettingsPath = $ extensionDirectory . '/' . $ activeExtension . '/settings' ; if ( $ extensionType === 'access' ) $ siteINI -> prependOverrideDir ( $ extensionSettingsPath , true , 'extension:' . $ activeExtension , 'sa-extension' ) ; else $ siteINI -> prependOverrideDir ( $ extensionSettingsPath , true , 'extension:' . $ activeExtension , 'extension' ) ; if ( isset ( $ GLOBALS [ 'eZCurrentAccess' ] ) ) self :: prependSiteAccess ( $ activeExtension , $ GLOBALS [ 'eZCurrentAccess' ] [ 'name' ] , $ siteINI ) ; $ hasExtensions = true ; } if ( $ hasExtensions ) $ siteINI -> load ( ) ; } | Will make sure that all extensions that has settings directories are added to the eZINI override list . |
40,352 | static function prependExtensionSiteAccesses ( $ accessName = false , $ ini = false , $ globalDir = true , $ identifier = null , $ order = true ) { $ extensionList = eZExtension :: activeExtensions ( 'default' ) ; if ( ! $ order ) { $ extensionList = array_reverse ( $ extensionList ) ; } foreach ( $ extensionList as $ extension ) { self :: prependSiteAccess ( $ extension , $ accessName , $ ini , $ globalDir , $ identifier ) ; } } | Prepend extension siteaccesses |
40,353 | static function prependSiteAccess ( $ extension , $ accessName = false , $ ini = false , $ globalDir = true , $ identifier = null ) { if ( ! $ accessName ) { $ accessName = $ GLOBALS [ 'eZCurrentAccess' ] [ 'name' ] ; } $ extensionSettingsPath = eZExtension :: baseDirectory ( ) . '/' . $ extension ; if ( $ identifier === null ) { $ identifier = "ext-siteaccess:$extension" ; } if ( ! $ ini instanceof eZINI ) { $ ini = eZINI :: instance ( ) ; } $ ini -> prependOverrideDir ( $ extensionSettingsPath . '/settings/siteaccess/' . $ accessName , $ globalDir , $ identifier , 'siteaccess' ) ; } | Prepend siteaccess for specified extension |
40,354 | protected static function createFormatter ( $ format ) { $ formatterOptions = new ezpExtensionOptions ( ) ; $ formatterOptions -> iniFile = 'template.ini' ; $ formatterOptions -> iniSection = 'AttributeOperator' ; $ formatterOptions -> iniVariable = 'OutputFormatter' ; $ formatterOptions -> handlerIndex = $ format ; $ formatterInstance = eZExtension :: getHandlerClass ( $ formatterOptions ) ; if ( ! ( $ formatterInstance instanceof ezpAttributeOperatorFormatterInterface ) ) eZDebug :: writeError ( "Undefined output formatter for '{$format}'" , __METHOD__ ) ; return $ formatterInstance ; } | Searches for the output formatter handler class for a given format |
40,355 | public static function getOutputFormatter ( $ format ) { if ( ! self :: isRegisteredFormatter ( $ format ) ) { $ format = eZINI :: instance ( 'template.ini' ) -> variable ( 'AttributeOperator' , 'DefaultFormatter' ) ; } if ( ! ( self :: $ formatter instanceof ezpAttributeOperatorFormatterInterface ) || $ format != self :: $ format ) { self :: $ formatter = self :: createFormatter ( $ format ) ; self :: $ format = $ format ; } return self :: $ formatter ; } | Returns formatter object for a given format |
40,356 | protected function fillVariables ( ) { $ variables = array ( ) ; $ internalVariables = array ( 'ResponseGroups' ) ; foreach ( $ internalVariables as $ internalVariable ) { if ( isset ( $ _GET [ $ internalVariable ] ) ) { switch ( $ internalVariable ) { case 'ResponseGroups' : $ variables [ $ internalVariable ] = explode ( ',' , $ _GET [ $ internalVariable ] ) ; break ; default : $ variables [ $ internalVariable ] = $ _GET [ $ internalVariable ] ; } unset ( $ _GET [ $ internalVariable ] ) ; } else { switch ( $ internalVariable ) { case 'ResponseGroups' : $ variables [ $ internalVariable ] = array ( ) ; break ; default : $ variables [ $ internalVariable ] = null ; } } } return $ variables ; } | Extract variables to be used internally from GET |
40,357 | protected function fillContentVariables ( ) { $ contentVariables = array ( ) ; $ expectedVariables = array ( 'Translation' , 'OutputFormat' ) ; foreach ( $ expectedVariables as $ variable ) { if ( isset ( $ _GET [ $ variable ] ) ) { switch ( $ variable ) { case 'Translation' : default : $ contentVariables [ $ variable ] = $ _GET [ $ variable ] ; } unset ( $ _GET [ $ variable ] ) ; } else { $ contentVariables [ $ variable ] = null ; } } return $ contentVariables ; } | Extract variables related to content from GET |
40,358 | protected function processProtocol ( ) { $ req = $ this -> request ; $ req -> originalProtocol = $ req -> protocol = 'http-' . ( isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) ? strtolower ( $ _SERVER [ 'REQUEST_METHOD' ] ) : "get" ) ; if ( $ req -> protocol === 'http-post' && isset ( $ _POST [ '_method' ] ) ) { $ method = strtolower ( $ _POST [ '_method' ] ) ; if ( $ method === 'put' || $ method === 'delete' ) $ req -> protocol = "http-{$method}" ; unset ( $ _POST [ '_method' ] ) ; } } | Processes the request protocol . |
40,359 | protected function processDate ( ) { $ this -> request -> date = isset ( $ _SERVER [ 'REQUEST_TIME' ] ) ? new DateTime ( '@' . ( int ) $ _SERVER [ 'REQUEST_TIME' ] ) : new DateTime ( ) ; } | Processes the request date . |
40,360 | function performOutput ( $ dom ) { $ this -> XMLSchema = eZXMLSchema :: instance ( ) ; $ this -> NestingLevel = 0 ; $ this -> Output = '' ; $ sectionLevel = - 1 ; $ this -> createLinksArray ( $ dom ) ; $ this -> outputTag ( $ dom -> documentElement , $ sectionLevel ) ; return $ this -> Output ; } | Call this function to obtain edit output string |
40,361 | public function read ( $ sessionId ) { $ db = eZDB :: instance ( ) ; if ( ! $ db -> isConnected ( ) ) { return false ; } $ escKey = $ db -> escapeString ( $ sessionId ) ; $ sessionRes = ! $ this -> userHasCookie ? false : $ db -> arrayQuery ( "SELECT data, user_id, expiration_time FROM ezsession WHERE session_key='$escKey'" ) ; if ( $ sessionRes !== false and count ( $ sessionRes ) == 1 ) { eZSession :: setUserID ( $ sessionRes [ 0 ] [ 'user_id' ] ) ; $ ini = eZINI :: instance ( ) ; $ sessionUpdatesTime = $ sessionRes [ 0 ] [ 'expiration_time' ] - $ ini -> variable ( 'Session' , 'SessionTimeout' ) ; $ sessionIdle = time ( ) - $ sessionUpdatesTime ; $ GLOBALS [ 'eZSessionIdleTime' ] = $ sessionIdle ; return $ sessionRes [ 0 ] [ 'data' ] ; } else { return false ; } } | Session read handler |
40,362 | public function write ( $ sessionId , $ sessionData ) { $ db = eZDB :: instance ( ) ; if ( ! $ db -> isConnected ( ) ) { return false ; } $ ini = eZINI :: instance ( ) ; $ expirationTime = time ( ) + $ ini -> variable ( 'Session' , 'SessionTimeout' ) ; if ( $ db -> bindingType ( ) != eZDBInterface :: BINDING_NO ) { $ sessionData = $ db -> bindVariable ( $ sessionData , array ( 'name' => 'data' ) ) ; } else { $ sessionData = '\'' . $ db -> escapeString ( $ sessionData ) . '\'' ; } $ escKey = $ db -> escapeString ( $ sessionId ) ; $ userID = $ db -> escapeString ( eZSession :: userID ( ) ) ; $ sessionRes = ! $ this -> userHasCookie ? false : $ db -> arrayQuery ( "SELECT session_key FROM ezsession WHERE session_key='$escKey'" ) ; if ( $ sessionRes !== false and count ( $ sessionRes ) == 1 ) { $ ret = $ db -> query ( "UPDATE ezsession SET expiration_time='$expirationTime', data=$sessionData, user_id='$userID' WHERE session_key='$escKey'" ) ; } else { $ insertQuery = "INSERT INTO ezsession ( session_key, expiration_time, data, user_id ) VALUES ( '$escKey', '$expirationTime', $sessionData, '$userID' )" ; $ ret = $ db -> query ( $ insertQuery ) ; } return true ; } | Session write handler |
40,363 | public function destroy ( $ sessionId ) { ezpEvent :: getInstance ( ) -> notify ( 'session/destroy' , array ( $ sessionId ) ) ; $ db = eZDB :: instance ( ) ; $ escKey = $ db -> escapeString ( $ sessionId ) ; eZSession :: triggerCallback ( 'destroy_pre' , array ( $ db , $ sessionId , $ escKey ) ) ; $ db -> query ( "DELETE FROM ezsession WHERE session_key='$escKey'" ) ; eZSession :: triggerCallback ( 'destroy_post' , array ( $ db , $ sessionId , $ escKey ) ) ; return true ; } | Session destroy handler |
40,364 | public function regenerate ( $ updateBackendData = true ) { $ oldSessionId = session_id ( ) ; session_regenerate_id ( ) ; $ newSessionId = session_id ( ) ; ezpEvent :: getInstance ( ) -> notify ( 'session/regenerate' , array ( $ oldSessionId , $ newSessionId ) ) ; if ( $ updateBackendData ) { $ db = eZDB :: instance ( ) ; if ( ! $ db -> isConnected ( ) ) { return false ; } $ escOldKey = $ db -> escapeString ( $ oldSessionId ) ; $ escNewKey = $ db -> escapeString ( $ newSessionId ) ; $ escUserID = $ db -> escapeString ( eZSession :: userID ( ) ) ; eZSession :: triggerCallback ( 'regenerate_pre' , array ( $ db , $ escNewKey , $ escOldKey , $ escUserID ) ) ; $ db -> query ( "UPDATE ezsession SET session_key='$escNewKey', user_id='$escUserID' WHERE session_key='$escOldKey'" ) ; $ db -> query ( "UPDATE ezbasket SET session_id='$escNewKey' WHERE session_id='$escOldKey'" ) ; eZSession :: triggerCallback ( 'regenerate_post' , array ( $ db , $ escNewKey , $ escOldKey , $ escUserID ) ) ; } return true ; } | Regenerate session id |
40,365 | public function deleteByUserIDs ( array $ userIDArray ) { $ db = eZDB :: instance ( ) ; $ userINString = $ db -> generateSQLINStatement ( $ userIDArray , 'user_id' , false , false , 'int' ) ; $ rows = $ db -> arrayQuery ( "SELECT session_key FROM ezsession WHERE $userINString" ) ; foreach ( $ rows as $ row ) { $ this -> destroy ( $ row [ 'session_key' ] ) ; } } | Remove all session data for a specific user |
40,366 | protected static function createRenderer ( $ renderer , ezpContent $ content , ezpRestMvcController $ controller ) { $ rendererOptions = new ezpExtensionOptions ( ) ; $ rendererOptions -> iniFile = 'rest.ini' ; $ rendererOptions -> iniSection = 'OutputSettings' ; $ rendererOptions -> iniVariable = 'RendererClass' ; $ rendererOptions -> handlerIndex = $ renderer ; $ rendererOptions -> handlerParams = array ( $ content , $ controller ) ; $ rendererInstance = eZExtension :: getHandlerClass ( $ rendererOptions ) ; if ( ! ( $ rendererInstance instanceof ezpRestContentRendererInterface ) ) throw new ezpRestContentRendererNotFoundException ( $ renderer ) ; return $ rendererInstance ; } | Returns ezpRestContentProviderInterface object for requested renderer |
40,367 | public static function getRenderer ( $ renderer , ezpContent $ content , ezpRestMvcController $ controller ) { if ( empty ( $ renderer ) ) { $ renderer = self :: DEFAULT_RENDERER ; } if ( ! ( self :: $ renderer instanceof ezpRestContentProviderInterface ) ) { self :: $ renderer = self :: createRenderer ( $ renderer , $ content , $ controller ) ; } return self :: $ renderer ; } | Returns ezpRestContentProviderInterface object for given renderer and content |
40,368 | public static function fetchByNodeId ( $ nodeId ) { $ node = eZContentObjectTreeNode :: fetch ( $ nodeId ) ; if ( $ node instanceof eZContentObjectTreeNode ) { return self :: fromNode ( $ node ) ; } else { throw new ezpContentNotFoundException ( "Unable to find node with ID $nodeId" ) ; } } | Returns the ezpContentLocation object for a particular node by ID |
40,369 | public function sessionStart ( ) { if ( $ this -> storage && ! $ this -> storage -> isStarted ( ) ) { $ this -> storage -> start ( ) ; } return true ; } | Let Symfony starts the session |
40,370 | function restore ( ) { $ Timestamps = $ this -> CacheFile -> processFile ( array ( $ this , 'fetchData' ) ) ; if ( $ Timestamps === false ) { $ errMsg = 'Fatal error - could not restore expiry.php file.' ; eZDebug :: writeError ( $ errMsg , __METHOD__ ) ; trigger_error ( $ errMsg , E_USER_ERROR ) ; } $ this -> Timestamps = $ Timestamps ; $ this -> IsModified = false ; } | Load the expiry timestamps from cache |
40,371 | function store ( ) { if ( ! $ this -> IsModified ) { return ; } $ modifiedTimestamps = $ this -> Timestamps ; $ this -> restore ( ) ; foreach ( $ modifiedTimestamps as $ name => $ value ) { if ( $ value > self :: getTimestamp ( $ name , 0 ) ) { $ this -> setTimestamp ( $ name , $ value ) ; } } if ( $ this -> IsModified ) { $ this -> CacheFile -> storeContents ( "<?php\n\$Timestamps = " . var_export ( $ this -> Timestamps , true ) . ";\n?>" , 'expirycache' , false , true ) ; $ this -> IsModified = false ; } } | Stores the current timestamps values to cache |
40,372 | function setTimestamp ( $ name , $ value ) { $ this -> Timestamps [ $ name ] = $ value ; $ this -> IsModified = true ; } | Sets the expiry timestamp for a key |
40,373 | function timestamp ( $ name ) { if ( ! isset ( $ this -> Timestamps [ $ name ] ) ) { eZDebug :: writeError ( "Unknown expiry timestamp called '$name'" , __METHOD__ ) ; return false ; } return $ this -> Timestamps [ $ name ] ; } | Returns the expiry timestamp for a key |
40,374 | static function getTimestamp ( $ name , $ default = false ) { $ handler = eZExpiryHandler :: instance ( ) ; if ( ! isset ( $ handler -> Timestamps [ $ name ] ) ) { return $ default ; } return $ handler -> Timestamps [ $ name ] ; } | Returns the expiry timestamp for a key or a default value if it isn t set |
40,375 | public function run ( $ credentials ) { $ status = self :: STATUS_INVALID_USER ; $ count = eZPersistentObject :: count ( eZUser :: definition ( ) , array ( 'contentobject_id' => ( int ) $ credentials -> id ) ) ; if ( $ count > 0 ) { $ status = self :: STATUS_OK ; } return $ status ; } | Will check if UserID provided in credentials is valid |
40,376 | public static function getInstance ( $ name ) { if ( ! isset ( self :: $ instances [ $ name ] ) ) self :: $ instances [ $ name ] = new self ( $ name ) ; return self :: $ instances [ $ name ] ; } | ezpExtension constructor . |
40,377 | public function getLoadingOrder ( ) { $ return = array ( 'before' => array ( ) , 'after' => array ( ) ) ; if ( is_readable ( $ XMLDependencyFile = eZExtension :: baseDirectory ( ) . "/{$this->name}/extension.xml" ) ) { libxml_use_internal_errors ( true ) ; $ xml = simplexml_load_file ( $ XMLDependencyFile ) ; if ( $ xml === false ) { eZDebug :: writeError ( libxml_get_errors ( ) , "ezpExtension( {$this->name} )::getLoadingOrder()" ) ; return null ; } foreach ( $ xml -> dependencies as $ dependenciesNode ) { foreach ( $ dependenciesNode as $ dependencyType => $ dependenciesNode ) { switch ( $ dependencyType ) { case 'requires' : $ relationship = 'after' ; break ; case 'uses' : $ relationship = 'after' ; break ; case 'extends' : $ relationship = 'before' ; break ; } foreach ( $ dependenciesNode as $ dependency ) { $ return [ $ relationship ] [ ] = ( string ) $ dependency [ 'name' ] ; } } } } return $ return ; } | Returns the loading order informations from extension . xml |
40,378 | public function getInfo ( ) { if ( is_readable ( $ XMLFilePath = eZExtension :: baseDirectory ( ) . "/{$this->name}/extension.xml" ) ) { $ infoFields = array ( 'name' , 'description' , 'version' , 'copyright' , 'author' , 'license' , 'info_url' ) ; libxml_use_internal_errors ( true ) ; $ xml = simplexml_load_file ( $ XMLFilePath ) ; if ( $ xml === false ) { eZDebug :: writeError ( libxml_get_errors ( ) , "ezpExtension({$this->name})::getInfo()" ) ; return null ; } $ return = array ( ) ; $ metadataNode = $ xml -> metadata ; foreach ( $ infoFields as $ field ) { if ( ( string ) $ metadataNode -> $ field !== '' ) $ return [ $ field ] = ( string ) $ metadataNode -> $ field ; } if ( ! $ metadataNode -> software -> uses ) return $ return ; $ index = 1 ; foreach ( $ metadataNode -> software -> uses as $ software ) { $ label = "Includes the following third-party software" ; if ( $ index > 1 ) $ label .= " (" . $ index . ")" ; foreach ( $ infoFields as $ field ) { if ( ( string ) $ software -> $ field !== '' ) $ return [ $ label ] [ $ field ] = ( string ) $ software -> $ field ; } $ index ++ ; } return $ return ; } elseif ( is_readable ( $ infoFilePath = eZExtension :: baseDirectory ( ) . "/{$this->name}/ezinfo.php" ) ) { include_once ( $ infoFilePath ) ; $ className = $ this -> name . 'Info' ; if ( is_callable ( array ( $ className , 'info' ) ) ) { $ result = call_user_func_array ( array ( $ className , 'info' ) , array ( ) ) ; if ( is_array ( $ result ) ) { return $ result ; } } } else { return null ; } } | Returns the extension informations Uses extension . xml by default then tries ezinfo . php for backwards compatibility |
40,379 | public function registerEventListeners ( ) { if ( $ this -> loadGlobalEvents ) { $ listeners = eZINI :: instance ( ) -> variable ( 'Event' , 'Listeners' ) ; foreach ( $ listeners as $ listener ) { if ( $ listener == "" ) { continue ; } list ( $ event , $ callback ) = explode ( '@' , $ listener ) ; $ this -> attach ( $ event , $ callback ) ; } } } | Registers the event listeners defined the site . ini files . |
40,380 | public function attach ( $ name , $ listener ) { $ id = self :: $ listenerIdNumber ++ ; if ( is_string ( $ listener ) && strpos ( $ listener , '::' ) !== false ) { $ listener = explode ( '::' , $ listener ) ; } $ this -> listeners [ $ name ] [ $ id ] = $ listener ; return $ id ; } | Attach an event listener at run time on demand . |
40,381 | public function detach ( $ name , $ id ) { if ( ! isset ( $ this -> listeners [ $ name ] [ $ id ] ) ) { return false ; } unset ( $ this -> listeners [ $ name ] [ $ id ] ) ; return true ; } | Detach an event listener by id given when it was added . |
40,382 | public function notify ( $ name , array $ params = array ( ) ) { if ( empty ( $ this -> listeners [ $ name ] ) ) { return false ; } foreach ( $ this -> listeners [ $ name ] as $ listener ) { call_user_func_array ( $ listener , $ params ) ; } return true ; } | Notify all listeners of an event |
40,383 | public static function fetchByName ( $ name ) { $ result = parent :: fetchObject ( self :: definition ( ) , null , array ( 'name' => $ name ) ) ; return $ result ; } | Fetches a site data by name |
40,384 | public function line ( $ key , $ item , $ showValues , $ level ) { $ type = $ this -> getType ( $ item ) ; $ value = $ this -> getValue ( $ item ) ; $ spacing = str_repeat ( ">" , $ level ) ; if ( $ showValues ) $ output = "<tr><td>{$spacing}{$key}</td>\n<td>{$type}</td>\n<td>{$value}</td>\n</tr>\n" ; else $ output = "<tr><td>{$spacing}{$key}</td>\n<td>{$type}</td>\n</tr>\n" ; return $ output ; } | Formats single line for the attribute template operator output |
40,385 | static function instance ( $ params = false ) { if ( is_object ( $ params ) ) { $ db = $ params ; $ params = array ( 'instance' => $ db ) ; } if ( ! isset ( $ params [ 'instance' ] ) ) { $ db = eZDB :: instance ( ) ; $ params [ 'instance' ] = $ db ; } $ db = $ params [ 'instance' ] ; if ( ! isset ( $ params [ 'type' ] ) ) $ params [ 'type' ] = $ db -> databaseName ( ) ; if ( ! isset ( $ params [ 'schema' ] ) ) $ params [ 'schema' ] = false ; $ dbname = $ params [ 'type' ] ; $ ini = eZINI :: instance ( 'dbschema.ini' ) ; $ schemaPaths = $ ini -> variable ( 'SchemaSettings' , 'SchemaPaths' ) ; $ schemaHandlerClasses = $ ini -> variable ( 'SchemaSettings' , 'SchemaHandlerClasses' ) ; if ( ! isset ( $ schemaPaths [ $ dbname ] ) or ! isset ( $ schemaHandlerClasses [ $ dbname ] ) ) { eZDebug :: writeError ( "No schema handler for database type: $dbname" , __METHOD__ ) ; return false ; } require_once ( $ schemaPaths [ $ dbname ] ) ; return new $ schemaHandlerClasses [ $ dbname ] ( $ params ) ; } | Returns a shared instance of the eZDBSchemaInterface class . |
40,386 | static function merge ( $ schema1 , $ schema2 ) { $ merged = $ schema1 ; foreach ( $ schema2 as $ tablename => $ tabledef ) { if ( $ tablename != '_info' ) { $ merged [ $ tablename ] = $ tabledef ; } } return $ merged ; } | Merges 2 db schemas basically appending 2nd on top of 1st |
40,387 | static function instance ( $ viewMode , $ type = self :: TYPE_STANDARD ) { if ( $ type == self :: TYPE_STANDARD ) $ instance = & $ GLOBALS [ "eZCollaborationView" ] [ $ viewMode ] ; else if ( $ type == self :: TYPE_GROUP ) $ instance = & $ GLOBALS [ "eZCollaborationGroupView" ] [ $ viewMode ] ; else { return null ; } if ( ! isset ( $ instance ) ) { $ instance = new eZCollaborationViewHandler ( $ viewMode , $ type ) ; } return $ instance ; } | Returns a shared instance of the eZCollaborationViewHandler class pr the two input params . |
40,388 | protected function shutdown ( $ reInitialize = true ) { eZExecution :: cleanup ( ) ; eZExecution :: setCleanExit ( ) ; eZExpiryHandler :: shutdown ( ) ; if ( $ reInitialize ) $ this -> isInitialized = false ; } | Runs the shutdown process |
40,389 | public function existsOnDFS ( $ filePath ) { if ( file_exists ( $ this -> makeDFSPath ( $ filePath ) ) ) { return true ; } $ filePathDir = substr ( $ filePath , 0 , strpos ( $ filePath , '/' ) + 1 ) ; $ path = realpath ( $ this -> getMountPoint ( ) ) . '/' . $ filePathDir ; if ( ! file_exists ( $ path ) || ! is_dir ( $ path ) ) { throw new eZDFSFileHandlerBackendException ( "NFS mount root $path not found" ) ; } return false ; } | Checks if a file exists on the DFS |
40,390 | protected function copyTimestamp ( $ srcFilePath , $ dstFilePath ) { clearstatcache ( true , $ srcFilePath ) ; $ originalTimestamp = filemtime ( $ srcFilePath ) ; if ( ! $ originalTimestamp ) { return false ; } return touch ( $ dstFilePath , $ originalTimestamp ) ; } | copies the timestamp from the original file to the destination file |
40,391 | static function import ( $ archiveName , & $ packageName , $ dbAvailable = true , $ repositoryID = false ) { if ( is_dir ( $ archiveName ) ) { eZDebug :: writeError ( "Importing from directory is not supported." ) ; $ retValue = false ; return $ retValue ; } else { $ tempDirPath = eZPackage :: temporaryImportPath ( ) ; do { $ archivePath = eZDir :: path ( array ( $ tempDirPath , mt_rand ( ) ) ) ; } while ( file_exists ( $ archivePath ) ) ; eZDir :: mkdir ( $ archivePath , false , true ) ; $ archiveOptions = new ezcArchiveOptions ( array ( 'readOnly' => true ) ) ; $ archive = ezcArchive :: open ( "compress.zlib://$archiveName" , ezcArchive :: TAR_GNU , $ archiveOptions ) ; $ fileList = array ( ) ; $ fileList [ ] = eZPackage :: definitionFilename ( ) ; foreach ( $ archive as $ entry ) { if ( in_array ( $ entry -> getPath ( ) , $ fileList ) ) { if ( ! $ archive -> extractCurrent ( $ archivePath ) ) { eZDebug :: writeError ( "Failed extracting package definition file from $archivePath" ) ; return false ; } } } $ definitionFileName = eZDir :: path ( array ( $ archivePath , self :: definitionFilename ( ) ) ) ; $ package = eZPackage :: fetchFromFile ( $ definitionFileName ) ; eZPackage :: removeFiles ( $ archivePath ) ; if ( $ package ) { $ packageName = $ package -> attribute ( 'name' ) ; if ( ! self :: isValidName ( $ packageName ) ) { return eZPackage :: STATUS_INVALID_NAME ; } if ( ! $ repositoryID ) { $ repositoryID = $ package -> attribute ( 'vendor-dir' ) ; } $ existingPackage = eZPackage :: fetch ( $ packageName , false , false , $ dbAvailable ) ; if ( $ existingPackage ) { return eZPackage :: STATUS_ALREADY_EXISTS ; } unset ( $ package ) ; $ fullRepositoryPath = eZPackage :: repositoryPath ( ) . '/' . $ repositoryID ; $ packagePath = $ fullRepositoryPath . '/' . $ packageName ; if ( ! file_exists ( $ packagePath ) ) { eZDir :: mkdir ( $ packagePath , false , true ) ; } $ archive -> extract ( $ packagePath ) ; $ package = eZPackage :: fetch ( $ packageName , $ fullRepositoryPath , false , $ dbAvailable ) ; if ( ! $ package ) { eZDebug :: writeError ( "Failed loading imported package $packageName from $fullRepositoryPath" ) ; } } else { eZDebug :: writeError ( "Failed loading temporary package $packageName" ) ; } return $ package ; } } | Imports a package from a gzip compressed tarball file |
40,392 | function install ( & $ installParameters ) { if ( $ this -> Parameters [ 'install_type' ] != 'install' ) return ; $ installItems = $ this -> Parameters [ 'install' ] ; if ( ! isset ( $ installParameters [ 'path' ] ) ) $ installParameters [ 'path' ] = false ; $ installResult = true ; foreach ( $ installItems as $ item ) { if ( ! $ this -> installItem ( $ item , $ installParameters ) ) { eZDebug :: writeDebug ( $ item , 'item which failed installing' ) ; $ installResult = false ; } } $ this -> setInstalled ( ) ; return $ installResult ; } | Installs all items in the package |
40,393 | static function isValidName ( $ packageName , & $ transformedPackageName = null ) { $ trans = eZCharTransform :: instance ( ) ; $ transformedPackageName = $ trans -> transformByGroup ( $ packageName , 'identifier' ) ; return $ transformedPackageName === $ packageName ; } | Checks if a package name is valid |
40,394 | static public function getPersistentVariable ( $ key = null ) { if ( $ key !== null ) { if ( isset ( self :: $ persistentVariable [ $ key ] ) ) return self :: $ persistentVariable [ $ key ] ; return null ; } return self :: $ persistentVariable ; } | Reusable function for getting internal persistent_variable |
40,395 | function o_destination ( $ id , $ action , $ options = '' ) { if ( $ action != 'new' ) { $ o = & $ this -> objects [ $ id ] ; } switch ( $ action ) { case 'new' : $ this -> objects [ $ id ] = array ( 't' => 'destination' , 'info' => array ( ) ) ; $ tmp = '' ; switch ( $ options [ 'type' ] ) { case 'XYZ' : case 'FitR' : $ tmp = ' ' . sprintf ( '%.3F' , $ options [ 'p3' ] ) . $ tmp ; case 'FitV' : case 'FitBH' : case 'FitBV' : $ tmp = ' ' . sprintf ( '%.3F' , $ options [ 'p2' ] ) . $ tmp ; case 'Fit' : case 'FitH' : $ tmp = ' ' . sprintf ( '%.3F' , $ options [ 'p1' ] ) . $ tmp ; case 'FitB' : $ tmp = $ options [ 'type' ] . $ tmp ; $ this -> objects [ $ id ] [ 'info' ] [ 'string' ] = $ tmp ; $ this -> objects [ $ id ] [ 'info' ] [ 'page' ] = $ options [ 'page' ] ; } break ; case 'out' : $ tmp = $ o [ 'info' ] ; $ res = "\n" . $ id . " 0 obj\n" . '[' . $ tmp [ 'page' ] . ' 0 R /' . $ tmp [ 'string' ] . "]\nendobj\n" ; return $ res ; break ; } } | destination object used to specify the location for the user to jump to presently on opening |
40,396 | function o_catalog ( $ id , $ action , $ options = '' ) { if ( $ action != 'new' ) { $ o = & $ this -> objects [ $ id ] ; } switch ( $ action ) { case 'new' : $ this -> objects [ $ id ] = array ( 't' => 'catalog' , 'info' => array ( ) ) ; $ this -> catalogId = $ id ; break ; case 'outlines' : case 'pages' : case 'openHere' : $ o [ 'info' ] [ $ action ] = $ options ; break ; case 'viewerPreferences' : if ( ! isset ( $ o [ 'info' ] [ 'viewerPreferences' ] ) ) { $ this -> numObj ++ ; $ this -> o_viewerPreferences ( $ this -> numObj , 'new' ) ; $ o [ 'info' ] [ 'viewerPreferences' ] = $ this -> numObj ; } $ vp = $ o [ 'info' ] [ 'viewerPreferences' ] ; $ this -> o_viewerPreferences ( $ vp , 'add' , $ options ) ; break ; case 'out' : $ res = "\n" . $ id . " 0 obj\n" . '<< /Type /Catalog' ; foreach ( $ o [ 'info' ] as $ k => $ v ) { switch ( $ k ) { case 'outlines' : $ res .= "\n" . '/Outlines ' . $ v . ' 0 R' ; break ; case 'pages' : $ res .= "\n" . '/Pages ' . $ v . ' 0 R' ; break ; case 'viewerPreferences' : $ res .= "\n" . '/ViewerPreferences ' . $ o [ 'info' ] [ 'viewerPreferences' ] . ' 0 R' ; break ; case 'openHere' : $ res .= "\n" . '/OpenAction ' . $ o [ 'info' ] [ 'openHere' ] . ' 0 R' ; break ; } } $ res .= " >>\nendobj" ; return $ res ; break ; } } | define the document catalog the overall controller for the document |
40,397 | function o_outlines ( $ id , $ action , $ options = '' ) { if ( $ action != 'new' ) { $ o = & $ this -> objects [ $ id ] ; } switch ( $ action ) { case 'new' : $ this -> objects [ $ id ] = array ( 't' => 'outlines' , 'info' => array ( 'outlines' => array ( ) ) ) ; $ this -> o_catalog ( $ this -> catalogId , 'outlines' , $ id ) ; break ; case 'outline' : $ o [ 'info' ] [ 'outlines' ] [ ] = $ options ; break ; case 'out' : if ( count ( $ o [ 'info' ] [ 'outlines' ] ) ) { $ res = "\n" . $ id . " 0 obj\n<< /Type /Outlines /Kids [" ; foreach ( $ o [ 'info' ] [ 'outlines' ] as $ k => $ v ) { $ res .= $ v . " 0 R " ; } $ res .= "] /Count " . count ( $ o [ 'info' ] [ 'outlines' ] ) . " >>\nendobj" ; } else { $ res = "\n" . $ id . " 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj" ; } return $ res ; break ; } } | define the outlines in the doc empty for now |
40,398 | function o_function ( $ id , $ action , $ options = '' ) { if ( $ action != 'new' ) { $ o = & $ this -> objects [ $ id ] ; } switch ( $ action ) { case 'new' : { $ this -> objects [ $ id ] = array ( 't' => 'function' , 'info' => array ( ) ) ; if ( isset ( $ options [ 'type' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'type' ] = $ options [ 'type' ] ; } else { $ this -> objects [ $ id ] [ 'info' ] [ 'type' ] = '2' ; } if ( isset ( $ options [ 'Domain' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'Domain' ] = $ options [ 'Domain' ] ; } else { $ this -> objects [ $ id ] [ 'info' ] [ 'Domain' ] = '[0.0 1.0]' ; } if ( $ this -> objects [ $ id ] [ 'info' ] [ 'type' ] == '2' ) { if ( isset ( $ options [ 'C0' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'C0' ] = $ options [ 'C0' ] ; } if ( isset ( $ options [ 'C1' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'C1' ] = $ options [ 'C1' ] ; } if ( isset ( $ options [ 'N' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'N' ] = $ options [ 'N' ] ; } else { $ this -> objects [ $ id ] [ 'info' ] [ 'N' ] = '1.0' ; } } } break ; case 'out' : { $ res = "\n" . $ id . " 0 obj\n<< " ; $ res .= "/FunctionType " . $ o [ 'info' ] [ 'type' ] . "\n" ; $ res .= "/Domain " . $ o [ 'info' ] [ 'Domain' ] . "\n" ; if ( isset ( $ o [ 'info' ] [ 'C0' ] ) ) $ res .= "/C0 " . $ o [ 'info' ] [ 'C0' ] . "\n" ; if ( isset ( $ o [ 'info' ] [ 'C1' ] ) ) $ res .= "/C1 " . $ o [ 'info' ] [ 'C1' ] . "\n" ; $ res .= "/N " . $ o [ 'info' ] [ 'N' ] . "\n" ; $ res .= ">>\nendobject" ; return $ res ; } break ; } } | Add object to hold Function properties Only partial support for type 0 3 and 4 |
40,399 | function o_pattern ( $ id , $ action , $ options = '' ) { if ( $ action != 'new' ) { $ o = & $ this -> objects [ $ id ] ; } switch ( $ action ) { case 'new' : { $ this -> objects [ $ id ] = array ( 't' => 'shading' , 'info' => array ( ) ) ; if ( isset ( $ options [ 'type' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'PatternType' ] = $ options [ 'type' ] ; } else { $ this -> objects [ $ id ] [ 'info' ] [ 'PatternType' ] = '2' ; } if ( isset ( $ options [ 'matrix' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'Matrix' ] = '[ ' ; foreach ( $ options [ 'matrix' ] as $ coord ) { $ this -> objects [ $ id ] [ 'info' ] [ 'Matrix' ] .= sprintf ( ' %.3F ' , $ coord ) ; } $ this -> objects [ $ id ] [ 'info' ] [ 'Matrix' ] .= ' ]' ; } if ( $ this -> objects [ $ id ] [ 'info' ] [ 'PatternType' ] == 1 ) { $ this -> objects [ $ id ] [ 'info' ] [ 'PaintType' ] = $ options [ 'paintType' ] ; $ this -> objects [ $ id ] [ 'info' ] [ 'TilingType' ] = $ options [ 'tilingType' ] ; $ this -> objects [ $ id ] [ 'info' ] [ 'BBox' ] = '[ ' ; foreach ( $ options [ 'bbox' ] as $ coord ) { $ this -> objects [ $ id ] [ 'info' ] [ 'BBox' ] .= sprintf ( ' %.3F ' , $ coord ) ; } $ this -> objects [ $ id ] [ 'info' ] [ 'BBox' ] .= ']' ; $ this -> objects [ $ id ] [ 'info' ] [ 'XStep' ] = $ options [ 'xstep' ] ; $ this -> objects [ $ id ] [ 'info' ] [ 'YStep' ] = $ options [ 'ystep' ] ; } else { if ( isset ( $ options [ 'shading' ] ) ) { $ this -> objects [ $ id ] [ 'info' ] [ 'Shading' ] = $ options [ 'shading' ] . ' R' ; } } } break ; case 'out' : { $ res = "\n" . $ id . " 0 obj\n<< " ; foreach ( $ this -> objects [ $ id ] [ 'info' ] as $ key => $ info ) { $ res .= '/' . $ key . ' ' . $ info [ $ key ] . "\n" ; } $ res .= ">>\nendobject" ; return $ res ; } break ; } } | Add object to hold pattern properties |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.