当前位置: 首页>>代码示例>>PHP>>正文


PHP eZAudit::isAuditEnabled方法代码示例

本文整理汇总了PHP中eZAudit::isAuditEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP eZAudit::isAuditEnabled方法的具体用法?PHP eZAudit::isAuditEnabled怎么用?PHP eZAudit::isAuditEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZAudit的用法示例。


在下文中一共展示了eZAudit::isAuditEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: writeAudit

    /**
     * Writes $auditName with $auditAttributes as content
     * to file name that will be fetched from ini settings by auditNameSettings() for logging.
     *
     * @param string $auditName
     * @param array $auditAttributes
     * @return bool
     */
    static function writeAudit( $auditName, $auditAttributes = array() )
    {
        $enabled = eZAudit::isAuditEnabled();
        if ( !$enabled )
            return false;

        $auditNameSettings = eZAudit::auditNameSettings();

        if ( !isset( $auditNameSettings[$auditName] ) )
            return false;

        $ip = eZSys::clientIP();
        if ( !$ip )
            $ip = eZSys::serverVariable( 'HOSTNAME', true );

        $user = eZUser::currentUser();
        $userID = $user->attribute( 'contentobject_id' );
        $userLogin = $user->attribute( 'login' );

        $message = "[$ip] [$userLogin:$userID]\n";

        foreach ( array_keys( $auditAttributes ) as $attributeKey )
        {
            $attributeValue = $auditAttributes[$attributeKey];
            $message .= "$attributeKey: $attributeValue\n";
        }

        $logName = $auditNameSettings[$auditName]['file_name'];
        $dir = $auditNameSettings[$auditName]['dir'];
        eZLog::write( $message, $logName, $dir );

        return true;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:41,代码来源:ezaudit.php

示例2: unhideSubTree

 /**
  * Unhide a subtree
  *
  * Unhide algorithm:
  * if ( parent node is visible )
  * {
  *     1) Mark root node as not hidden and visible.
  *     2) Recursively mark child nodes as visible (except for nodes previosly marked as hidden, and all their children).
  * }
  * else
  * {
  *     Mark root node as not hidden.
  * }
  *
  * Transaction unsafe. If you call several transaction unsafe methods you must enclose
  * the calls within a db transaction; thus within db->begin and db->commit.
  *
  * @param eZContentObjectTreeNode $node Root node of the subtree
  * @param bool $modifyRootNode Whether to modify the root node (true/false)
  */
 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()) {
         // Set audit params.
         $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')) {
         // 1) Mark root node as not hidden and visible.
         if ($modifyRootNode) {
             $db->query("UPDATE ezcontentobject_tree SET is_invisible=0, is_hidden=0, modified_subnode={$time} WHERE node_id={$nodeID}");
         }
         // 2) Recursively mark child nodes as visible (except for nodes previosly marked as hidden, and all their children).
         // 2.1) $hiddenChildren = Fetch all hidden children for the root node
         $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'] . "%'";
         }
         // 2.2) Mark those children as visible which are not under nodes in $hiddenChildren
         $db->query("UPDATE ezcontentobject_tree SET is_invisible=0, modified_subnode={$time} WHERE path_string LIKE '{$nodePath}%' {$skipSubtreesString}");
     } else {
         // Mark root node as not hidden.
         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);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:63,代码来源:ezcontentobjecttreenode.php

示例3: removeThis

 function removeThis()
 {
     $ini = eZINI::instance();
     $object = $this->object();
     $nodeID = $this->attribute('node_id');
     if (eZAudit::isAuditEnabled()) {
         // Set audit params.
         $objectID = $object->attribute('id');
         $objectName = $object->attribute('name');
         eZAudit::writeAudit('content-delete', array('Node ID' => $nodeID, 'Object ID' => $objectID, 'Content Name' => $objectName, 'Comment' => 'Removed the current node: eZContentObjectTreeNode::removeNode()'));
     }
     $db = eZDB::instance();
     $db->begin();
     $nodePath = $this->attribute('path_string');
     $childrensPath = $nodePath;
     $pathString = " path_string like '{$childrensPath}%' ";
     $urlAlias = $this->attribute('url_alias');
     // Remove static cache
     if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
         $staticCache = new eZStaticCache();
         $staticCache->removeURL("/" . $urlAlias);
         $staticCache->generateAlwaysUpdatedCache();
         $parent = $this->fetchParent();
     }
     $db->query("DELETE FROM ezcontentobject_tree\n                            WHERE {$pathString} OR\n                            path_string = '{$nodePath}'");
     // Re-cache parent node
     if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
         if ($parent) {
             $staticCache->cacheURL("/" . $parent->urlAlias());
         }
     }
     // Clean up URL alias entries
     eZURLAliasML::removeByAction('eznode', $nodeID);
     // Clean up content cache
     eZContentCacheManager::clearContentCacheIfNeeded($this->attribute('contentobject_id'));
     // clean up user cache
     if (in_array($object->attribute('contentclass_id'), eZUser::contentClassIDs())) {
         eZUser::removeSessionData($object->attribute('id'));
         eZUser::purgeUserCacheByUserId($object->attribute('id'));
     }
     $parentNode = $this->attribute('parent');
     if (is_object($parentNode)) {
         eZContentCacheManager::clearContentCacheIfNeeded($parentNode->attribute('contentobject_id'));
         $parentNode->updateAndStoreModified();
     }
     // Clean up policies and limitations
     eZRole::cleanupByNode($this);
     // Clean up recent items
     eZContentBrowseRecent::removeRecentByNodeID($nodeID);
     // Clean up bookmarks
     eZContentBrowseBookmark::removeByNodeID($nodeID);
     // Clean up tip-a-friend counter
     eZTipafriendCounter::removeForNode($nodeID);
     // Clean up view counter
     eZViewCounter::removeCounter($nodeID);
     $db->commit();
 }
开发者ID:rmiguel,项目名称:ezpublish,代码行数:57,代码来源:ezcontentobjecttreenode.php


注:本文中的eZAudit::isAuditEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。