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


PHP eZUser::currentUserID方法代码示例

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


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

示例1: create

    static function create( $name, $command, $userID = false )
    {
        if ( trim( $name ) == '' )
        {
            eZDebug::writeError( 'Empty name. You must supply a valid script name string.', 'ezscriptmonitor' );
            return false;
        }

        if ( trim( $command ) == '' )
        {
            eZDebug::writeError( 'Empty command. You must supply a valid command string.', 'ezscriptmonitor' );
            return false;
        }

        if ( !$userID )
        {
            $userID = eZUser::currentUserID();
        }

        $scriptMonitorIni = eZINI::instance( 'ezscriptmonitor.ini' );
        $scriptSiteAccess = $scriptMonitorIni->variable( 'GeneralSettings', 'ScriptSiteAccess' );
        $command = str_replace( self::SCRIPT_NAME_STRING, $name, $command );
        $command = str_replace( self::SITE_ACCESS_STRING, $scriptSiteAccess, $command );

        // Negative progress means not started yet
        return new self( array( 'name' => $name,
                                'command' => $command,
                                'last_report_timestamp' => time(),
                                'progress' => -1,
                                'user_id' => $userID ) );
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:ezscheduledscript.php

示例2: __construct

 /**
  * @param int $objectID ContentObjectID
  */
 public function __construct($objectID)
 {
     $userID = eZUser::currentUserID();
     $message = ezpI18n::tr('design/standard/error/kernel', 'Access denied') . '. ' . ezpI18n::tr('design/standard/error/kernel', 'You do not have permission to access this area.');
     eZLog::write("Access denied to content object #{$objectID} for user #{$userID}", 'error.log');
     parent::__construct($message);
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:10,代码来源:access_denied.php

示例3: fetchList

 function fetchList($collaborationID, $userID = false, $asObject = true)
 {
     if ($userID == false) {
         $userID == eZUser::currentUserID();
     }
     return eZPersistentObject::fetchObjectList(eZCollaborationItemGroupLink::definition(), null, array('collaboration_id' => $collaborationID, 'user_id' => $userID), null, null, $asObject);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:7,代码来源:ezcollaborationitemgrouplink.php

示例4: setValue

    static function setValue( $name, $value, $storeUserID = false )
    {
        $db = eZDB::instance();
        $name = $db->escapeString( $name );
        $rawValue = $value;
        $value = $db->escapeString( $value );

        $isCurrentUser = true;
        if ( $storeUserID === false )
        {
            $user = eZUser::currentUser();
        }
        else
        {
            $currentID = eZUser::currentUserID();
            if ( $currentID != $storeUserID )
                $isCurrentUser = false;

            $user = eZUser::fetch( $storeUserID );
            if ( !is_object( $user ) )
            {
                eZDebug::writeError( "Cannot set preference for user $storeUserID, the user does not exist" );
                return false;
            }
        }

        // We must store the database changes if:
        // a - The current user is logged in (ie. not anonymous)
        // b - We have specified a specific user (not the current).
        //    in which case isLoggedIn() will fail.
        if ( $storeUserID !== false or $user->isLoggedIn() )
        {
            // Only store in DB if user is logged in or we have
            // a specific user ID defined
            $userID = $user->attribute( 'contentobject_id' );
            $existingRes = $db->arrayQuery( "SELECT * FROM ezpreferences WHERE user_id = $userID AND name='$name'" );

            if ( count( $existingRes ) > 0 )
            {
                $prefID = $existingRes[0]['id'];
                $query = "UPDATE ezpreferences SET value='$value' WHERE id = $prefID AND name='$name'";
                $db->query( $query );
            }
            else
            {
                $query = "INSERT INTO ezpreferences ( user_id, name, value ) VALUES ( $userID, '$name', '$value' )";
                $db->query( $query );
            }
        }

        // We also store in session if this is the current user (anonymous or normal user)
        // use $rawValue as value will be escaped by session code (see #014520)
        if ( $isCurrentUser )
        {
            eZPreferences::storeInSession( $name, $rawValue );
        }

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

示例5: create

 static function create($userID = false)
 {
     $dateTime = time();
     if (!$userID) {
         $userID = eZUser::currentUserID();
     }
     $row = array("id" => null, "name" => "", "creator_id" => $userID, "modifier_id" => $userID, "created" => $dateTime, "modified" => $dateTime);
     return new eZContentClassGroup($row);
 }
开发者ID:legende91,项目名称:ez,代码行数:9,代码来源:ezcontentclassgroup.php

示例6: create

 /**
  * fetch CjwNewsletterBlacklistItem object by id
  * return false if not found
  *
  * @param integer $id
  * @param boolean $asObject
  * @return CjwNewsletterBlacklistItem
  */
 public static function create($email, $note)
 {
     $newsletterUserObject = CjwNewsletterUser::fetchByEmail($email);
     $newsletterUserId = 0;
     if (is_object($newsletterUserObject)) {
         $newsletterUserId = $newsletterUserObject->attribute('id');
     }
     $row = array('email' => strtolower($email), 'note' => $note, 'created' => time(), 'creator_contentobject_id' => eZUser::currentUserID(), 'email_hash' => self::generateEmailHash($email), 'newsletter_user_id' => $newsletterUserId);
     $object = new CjwNewsletterBlacklistItem($row);
     return $object;
 }
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:19,代码来源:cjwnewsletterblacklistitem.php

示例7: updateFields

 static function updateFields($collaborationID, $userID = false, $fields)
 {
     if ($userID === false) {
         $userID = eZUser::currentUserID();
     }
     eZPersistentObject::updateObjectList(array('definition' => eZCollaborationItemStatus::definition(), 'update_fields' => $fields, 'conditions' => array('collaboration_id' => $collaborationID, 'user_id' => $userID)));
     $statusObject =& $GLOBALS['eZCollaborationItemStatusCache'][$collaborationID][$userID];
     if (isset($statusObject)) {
         foreach ($fields as $field => $value) {
             $statusObject->setAttribute($field, $value);
         }
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:13,代码来源:ezcollaborationitemstatus.php

示例8: setLastRead

 static function setLastRead($collaborationID, $userID = false, $timestamp = false)
 {
     if ($userID === false) {
         $userID = eZUser::currentUserID();
     }
     if ($timestamp === false) {
         $timestamp = time();
     }
     $db = eZDB::instance();
     $userID = (int) $userID;
     $timestamp = (int) $timestamp;
     $sql = "UPDATE ezcollab_item_participant_link set last_read='{$timestamp}'\n                WHERE  collaboration_id='{$collaborationID}' AND participant_id='{$userID}'";
     $db->query($sql);
     if (!empty($GLOBALS["eZCollaborationItemParticipantLinkCache"][$collaborationID][$userID])) {
         $GLOBALS["eZCollaborationItemParticipantLinkCache"][$collaborationID][$userID]->setAttribute('last_read', $timestamp);
     }
 }
开发者ID:legende91,项目名称:ez,代码行数:17,代码来源:ezcollaborationitemparticipantlink.php

示例9: filter

 public function filter()
 {
     if (eZINI::instance('rest.ini')->variable('Authentication', 'RequireHTTPS') === 'enabled' && $this->req->isEncrypted === false) {
         // When an unencrypted connection is identified, we have to alter the
         // flag to avoid infinite loop, when the request is rerouted to the error controller.
         // This should be improved in the future.
         $this->req->isEncrypted = true;
         throw new ezpRestHTTPSRequiredException();
     }
     // 0. Check if the given route needs authentication.
     if (!$this->shallAuthenticate()) {
         $this->filter = new ezpRestNoAuthStyle();
     } else {
         if ($this->filter === null) {
             $opt = new ezpExtensionOptions();
             $opt->iniFile = 'rest.ini';
             $opt->iniSection = 'Authentication';
             $opt->iniVariable = 'AuthenticationStyle';
             $authFilter = eZExtension::getHandlerClass($opt);
             if (!$authFilter instanceof ezpRestAuthenticationStyle) {
                 throw new ezpRestAuthStyleNotFoundException();
             }
             $this->filter = $authFilter;
         }
     }
     // 1. Initialize the context needed for authenticating the user.
     $auth = $this->filter->setup($this->req);
     if ($auth instanceof ezcMvcInternalRedirect) {
         return $auth;
     }
     // 2.Perform the authentication
     // Result of authentication filter can be a valid ezp user (auth succeeded) or an internal redirect (ezcMvcInternalRedirect)
     $user = $this->filter->authenticate($auth, $this->req);
     if ($user instanceof eZUser) {
         $userID = $user->id();
         if ($userID != eZUser::currentUserID()) {
             eZUser::setCurrentlyLoggedInUser($user, $userID);
         }
         $this->filter->setUser($user);
     } else {
         if ($user instanceof ezcMvcInternalRedirect) {
             return $user;
         }
     }
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:45,代码来源:auth_configuration.php

示例10: updateblockorder

 /**
  * Update blocks order based on AJAX data send after D&D operation is finished
  *
  * @param mixed $args
  * @return array
  */
 public static function updateblockorder($args)
 {
     $http = eZHTTPTool::instance();
     $contentObjectAttributeID = (int) $http->postVariable('contentobject_attribute_id', 0);
     $version = (int) $http->postVariable('version', 0);
     $zoneID = $http->postVariable('zone', '');
     $blockOrder = $http->postVariable('block_order', array());
     $contentObjectAttribute = eZContentObjectAttribute::fetch($contentObjectAttributeID, $version);
     if (!$contentObjectAttribute instanceof eZContentObjectAttribute) {
         return array();
     }
     $contentObject = $contentObjectAttribute->attribute('object');
     if (!$contentObject->attribute('can_edit')) {
         return array();
     }
     // checking that the version is a draft and belongs to the current user
     $contentVersion = $contentObjectAttribute->attribute('object_version');
     if ($contentVersion->attribute('status') != eZContentObjectVersion::STATUS_DRAFT && $contentVersion->attribute('status') != eZContentObjectVersion::STATUS_INTERNAL_DRAFT) {
         return array();
     }
     if ($contentVersion->attribute('creator_id') != eZUser::currentUserID()) {
         return array();
     }
     $sortArray = array();
     foreach ($blockOrder as $blockID) {
         $idArray = explode('_', $blockID);
         if (isset($idArray[1])) {
             $sortArray[] = $idArray[1];
         }
     }
     if ($contentObjectAttribute) {
         $page = $contentObjectAttribute->content();
     }
     if ($page) {
         $zone = $page->getZone($zoneID);
     }
     if ($zone) {
         $zone->sortBlocks($sortArray);
     }
     $contentObjectAttribute->setContent($page);
     $contentObjectAttribute->store();
     return array();
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:49,代码来源:ezflowservercallfunctions.php

示例11: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'is_bookmarked':
             $bookmarkList = eZPersistentObject::fetchObjectList(eZContentBrowseBookmark::definition(), null, array('user_id' => eZUser::currentUserID(), 'node_id' => $namedParameters['node_id']), array('id' => 'desc'), array('offset' => 0, 'length' => '10'), true);
             if (count($bookmarkList) > 0) {
                 $operatorValue = 1;
             } else {
                 $operatorValue = 0;
             }
             break;
         case 'is_in_subscribed_nodes':
             $subscriptionList = eZPersistentObject::fetchObjectList(eZSubtreeNotificationRule::definition(), array('node_id'), array('user_id' => eZUser::currentUserID(), 'node_id' => $namedParameters['node_id']), null, null, false);
             if (count($subscriptionList) > 0) {
                 $operatorValue = 1;
             } else {
                 $operatorValue = 0;
             }
             break;
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:21,代码来源:bookmarkoperators.php

示例12: installContentObjects

    function installContentObjects( $objectNodes, $topNodeListNode, &$installParameters )
    {
        if ( isset( $installParameters['user_id'] ) )
            $userID = $installParameters['user_id'];
        else
            $userID = eZUser::currentUserID();

        $handlerType = $this->handlerType();
        $firstInstalledID = null;

        foreach( $objectNodes as $objectNode )
        {
            $realObjectNode = $this->getRealObjectNode( $objectNode );

            // Cycle until we reach an element where error has occured.
            // If action has been choosen, try install this item again, else skip it.
            if ( isset( $installParameters['error']['error_code'] ) &&
                 !$this->isErrorElement( $realObjectNode->getAttribute( 'remote_id' ), $installParameters ) )
            {
                continue;
            }

            //we are here, it means we'll try to install some object.
            if ( !$firstInstalledID )
            {
                $firstInstalledID = $realObjectNode->getAttribute( 'remote_id' );
            }

            $newObject = eZContentObject::unserialize( $this->Package, $realObjectNode, $installParameters, $userID, $handlerType );
            if ( !$newObject )
            {
                return false;
            }

            if ( is_object( $newObject ) )
            {
                eZContentObject::clearCache( $newObject->attribute( 'id' ) );
                unset( $newObject );
            }
            unset( $realObjectNode );

            if ( isset( $installParameters['error'] ) && count( $installParameters['error'] ) )
            {
                $installParameters['error'] = array();
            }
        }

        $this->installSuspendedNodeAssignment( $installParameters );
        $this->installSuspendedObjectRelations( $installParameters );

        // Call postUnserialize on all installed objects
        foreach( $objectNodes as $objectNode )
        {
            if ( $objectNode->localName == 'object' )
            {
                $remoteID = $objectNode->getAttribute( 'remote_id' );
            }
            else
            {
                $remoteID = substr( $objectNode->getAttribute( 'filename' ), 7, 32 );
            }

            // Begin from the object that we started from in the previous cycle
            if ( $firstInstalledID && $remoteID != $firstInstalledID )
            {
                continue;
            }
            else
            {
                $firstInstalledID = null;
            }

            $object = eZContentObject::fetchByRemoteID( $remoteID );
            if ( is_object( $object ) )
            {
                $object->postUnserialize( $this->Package );
                eZContentObject::clearCache( $object->attribute( 'id' ) );
            }
            unset( $object );
        }

        return true;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:83,代码来源:ezcontentobjectpackagehandler.php

示例13: array

 function &fetchAlreadyPosted($survey_id, $user_id = false)
 {
     if ($user_id === false) {
         $user_id = eZUser::currentUserID();
     }
     return array('result' => eZPersistentObject::fetchObject(eZSurveyResult::definition(), null, array('survey_id' => $survey_id, 'user_id' => $user_id)) ? true : false);
 }
开发者ID:heliopsis,项目名称:ezsurvey,代码行数:7,代码来源:ezsurveyresult.php

示例14: dataMap

 /**
  * Returns an array with all the content object attributes where the keys are the attribute identifiers.
  *
  * @see eZContentObject::fetchDataMap()
  * @return eZContentObjectAttribute[]
  */
 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'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:17,代码来源:ezcontentobjecttreenode.php

示例15: fetchObjectAttributeHTTPInput

 /**
  * Fetches all variables from the object
  *
  * @return bool true if fetching of class attributes are successfull, false if not
  */
 function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
 {
     $contentObjectID = $contentObjectAttribute->attribute("contentobject_id");
     // check if paex object for the current coID exists, create if needed.
     $paex = $contentObjectAttribute->content();
     if ($paex === null) {
         $paex = eZPaEx::create($contentObjectID);
     }
     // Set current values as default ones
     $passwordvalidationregexp = $paex->attribute('passwordvalidationregexp');
     $passwordlifetime = $paex->attribute('passwordlifetime');
     $expirationnotification = $paex->attribute('expirationnotification');
     $passwordLastUpdated = $paex->attribute('password_last_updated');
     $updatechildren = $paex->attribute('updatechildren');
     $expirationnotificationSent = $paex->attribute('expirationnotification_sent');
     // Update current values with new ones entered in the form if there are any
     if ($http->hasPostVariable($base . "_data_paex_passwordvalidationregexp_" . $contentObjectAttribute->attribute("id"))) {
         $passwordvalidationregexp = $http->postVariable($base . "_data_paex_passwordvalidationregexp_" . $contentObjectAttribute->attribute("id"));
     }
     if ($http->hasPostVariable($base . "_data_paex_passwordlifetime_" . $contentObjectAttribute->attribute("id"))) {
         $passwordlifetime = $http->postVariable($base . "_data_paex_passwordlifetime_" . $contentObjectAttribute->attribute("id"));
     }
     if ($http->hasPostVariable($base . "_data_paex_expirationnotification_" . $contentObjectAttribute->attribute("id"))) {
         $expirationnotification = $http->postVariable($base . "_data_paex_expirationnotification_" . $contentObjectAttribute->attribute("id"));
     }
     // Be sure passwordlifetime is set
     if (trim($passwordlifetime) == '') {
         $passwordlifetime = eZPaEx::NOT_DEFINED;
     }
     // Be sure expirationnotification is set
     if (trim($expirationnotification) == '') {
         $expirationnotification = eZPaEx::NOT_DEFINED;
     }
     // If we are editing a user account set it's password_last_updated as needed.
     if ($paex->isUser()) {
         // Search for password entered in the form
         $newPassword = "";
         foreach ($http->postVariable($base . '_id') as $coaid) {
             if ($http->hasPostVariable($base . '_data_user_password_' . $coaid)) {
                 $newPassword = $http->postVariable($base . '_data_user_password_' . $coaid);
                 break;
             }
         }
         // Check if the password has changed
         if (trim($newPassword) && $newPassword != "_ezpassword") {
             $currentUserID = eZUser::currentUserID();
             if ($currentUserID == $contentObjectID) {
                 // If self editing, set last_updated to current time
                 $passwordLastUpdated = time();
                 // if audit is enabled password changes should be logged
                 eZAudit::writeAudit('user-password-change-self', array());
             } else {
                 if ($currentUserID == eZUser::anonymousId()) {
                     // register, @see http://issues.ez.no/15391
                     $passwordLastUpdated = time();
                 } else {
                     // If changing other user's password, set last_updated to 0 to force
                     // password change in the next connection
                     $passwordLastUpdated = 0;
                     // if audit is enabled password changes should be logged
                     $targetUser = eZUser::fetch($contentObjectID);
                     eZAudit::writeAudit('user-password-change', array('User id' => $targetUser->attribute('contentobject_id'), 'User login' => $targetUser->attribute('login')));
                 }
             }
             // Password has changed, reset expirationnotification_sent flag to send again a notification when this new password be about to expire
             $expirationnotificationSent = 0;
         }
     } else {
         // If we are updating a user group and don't have the updatechildren post var, set updatechildren flag to disabled
         if ($http->hasPostVariable($base . "_data_paex_updatechildren_" . $contentObjectAttribute->attribute("id"))) {
             $updatechildren = $http->postVariable($base . "_data_paex_updatechildren_" . $contentObjectAttribute->attribute("id"));
         } else {
             $updatechildren = 0;
         }
     }
     if ($paex->canEdit()) {
         // If user has permission, update full paex object with possible new values
         $paex->setInformation($contentObjectID, $passwordvalidationregexp, $passwordlifetime, $expirationnotification, $passwordLastUpdated, $updatechildren, $expirationnotificationSent);
     } else {
         // If user don't have permission to update paex data, only update the password_last_updated and expirationnotification_sent fields
         $paex->setAttribute('password_last_updated', $passwordLastUpdated);
         $paex->setAttribute('expirationnotification_sent', $expirationnotificationSent);
     }
     $contentObjectAttribute->setContent($paex);
     return true;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:91,代码来源:ezpaextype.php


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