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


PHP eZUser::currentUser方法代码示例

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


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

示例1: onPublish

 function onPublish($attribute, $contentObject, $publishedNodes)
 {
     $user = eZUser::currentUser();
     $address = $user->attribute('email');
     $userID = $user->attribute('contentobject_id');
     $nodeIDList = eZSubtreeNotificationRule::fetchNodesForUserID($user->attribute('contentobject_id'), false);
     if ($attribute->attribute('data_int') == '1') {
         $newSubscriptions = array();
         foreach ($publishedNodes as $node) {
             if (!in_array($node->attribute('node_id'), $nodeIDList)) {
                 $newSubscriptions[] = $node->attribute('node_id');
             }
         }
         foreach ($newSubscriptions as $nodeID) {
             $rule = eZSubtreeNotificationRule::create($nodeID, $userID);
             $rule->store();
         }
     } else {
         foreach ($publishedNodes as $node) {
             if (in_array($node->attribute('node_id'), $nodeIDList)) {
                 eZSubtreeNotificationRule::removeByNodeAndUserID($user->attribute('contentobject_id'), $node->attribute('node_id'));
             }
         }
     }
     return true;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:26,代码来源:ezsubtreesubscriptiontype.php

示例2: 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

示例3: modify

 function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'recaptcha_get_html':
             include_once 'extension/recaptcha/classes/recaptchalib.php';
             // Retrieve the reCAPTCHA public key from the ini file
             $ini = eZINI::instance('recaptcha.ini');
             $key = $ini->variable('Keys', 'PublicKey');
             if (is_array($key)) {
                 $hostname = eZSys::hostname();
                 if (isset($key[$hostname])) {
                     $key = $key[$hostname];
                 } else {
                     // try our luck with the first entry
                     $key = array_shift($key);
                 }
             }
             // check if the current user is able to bypass filling in the captcha and
             // return nothing so that no captcha is displayed
             $currentUser = eZUser::currentUser();
             $accessAllowed = $currentUser->hasAccessTo('recaptcha', 'bypass_captcha');
             if ($accessAllowed["accessWord"] == 'yes') {
                 $operatorValue = 'User bypasses CAPTCHA';
             } else {
                 // Run the HTML generation code from the reCAPTCHA PHP library
                 $operatorValue = recaptcha_get_html($key);
             }
             break;
     }
 }
开发者ID:landinsicht,项目名称:ezpublish-recaptcha,代码行数:30,代码来源:recaptchatemplateoperator.php

示例4: checkIfLoggedIn

 protected static function checkIfLoggedIn()
 {
     $ini = eZINI::instance('cookielaw.ini');
     if (eZUser::currentUser()->isLoggedIn() && ($ini->hasVariable('UriExcludeList', 'ExcludeUserLoggedIn') && $ini->variable('UriExcludeList', 'ExcludeUserLoggedIn') == 'enabled')) {
         self::$isActive = false;
     }
 }
开发者ID:OpencontentCoop,项目名称:occookielaw,代码行数:7,代码来源:occookielaw.php

示例5: akismet_ContentActionHandler

function akismet_ContentActionHandler($module, $http, $objectID)
{
    $object = eZContentObject::fetch($objectID);
    $version = $object->attribute('current');
    if ($http->hasPostVariable('AkismetSubmitSpam')) {
        $user = eZUser::currentUser();
        $accessResult = $user->hasAccessTo('akismet', 'submit');
        if ($accessResult['accessWord'] === 'yes') {
            $mainNode = $object->attribute('main_node');
            $module->redirectTo($mainNode->attribute('url_alias'));
            $akismetObject = new eZContentObjectAkismet();
            $comment = $akismetObject->akismetInformationExtractor($version);
            if ($comment) {
                $akismet = new eZAkismet($comment);
                if ($akismet) {
                    $feedback = $akismet->submitSpam();
                    $response[] = $feedback[1];
                } else {
                    $response[] = ezi18n('extension/contactivity/akismet/submit', "An error has occured, unable to submit spam to Akismet.");
                }
            } else {
                $response[] = ezi18n('extension/contactivity/akismet/submit', "An error has occured, unable to submit spam to Akismet.");
            }
        }
        $mainNode = $object->attribute('main_node');
        $module->redirectTo($mainNode->attribute('url_alias'));
        return true;
    }
}
开发者ID:BGCX067,项目名称:ezakismet-svn-to-git,代码行数:29,代码来源:content_actionhandler.php

示例6: reCAPTCHAValidate

 static function reCAPTCHAValidate($http)
 {
     // check if the current user is able to bypass filling in the captcha and
     // return true without checking if so
     $currentUser = eZUser::currentUser();
     $accessAllowed = $currentUser->hasAccessTo('recaptcha', 'bypass_captcha');
     if ($accessAllowed["accessWord"] == 'yes') {
         return true;
     }
     $ini = eZINI::instance('recaptcha.ini');
     // If PrivateKey is an array try and find a match for the current host
     $privatekey = $ini->variable('Keys', 'PrivateKey');
     if (is_array($privatekey)) {
         $hostname = eZSys::hostname();
         if (isset($privatekey[$hostname])) {
             $privatekey = $privatekey[$hostname];
         } else {
             // try our luck with the first entry
             $privatekey = array_shift($privatekey);
         }
     }
     $recaptcha_challenge_field = $http->postVariable('recaptcha_challenge_field');
     $recaptcha_response_field = $http->postVariable('recaptcha_response_field');
     $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $recaptcha_challenge_field, $recaptcha_response_field);
     return $resp->is_valid;
 }
开发者ID:nfrp,项目名称:ezpublish-recaptcha,代码行数:26,代码来源:recaptchatype.php

示例7: enabled

    static function enabled()
    {
        if ( isset( $GLOBALS['eZHTTPHeaderCustom'] ) )
        {
            return $GLOBALS['eZHTTPHeaderCustom'];
        }

        $ini = eZINI::instance();
        if ( !$ini->hasVariable( 'HTTPHeaderSettings', 'CustomHeader' ) )
        {
            $GLOBALS['eZHTTPHeaderCustom'] = false;
        }
        else
        {
            if ( $ini->variable( 'HTTPHeaderSettings', 'CustomHeader' ) === 'enabled'
                 && $ini->hasVariable( 'HTTPHeaderSettings', 'OnlyForAnonymous' )
                 && $ini->variable( 'HTTPHeaderSettings', 'OnlyForAnonymous' ) === 'enabled' )
            {
                $user = eZUser::currentUser();
                $GLOBALS['eZHTTPHeaderCustom'] = !$user->isLoggedIn();
            }
            else
            {
                $GLOBALS['eZHTTPHeaderCustom'] = $ini->variable( 'HTTPHeaderSettings', 'CustomHeader' ) == 'enabled';
            }
        }

        return $GLOBALS['eZHTTPHeaderCustom'];
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:29,代码来源:ezhttpheader.php

示例8: checkAccess

	function checkAccess( $functionName, $contentObject )
	{
		if( $contentObject instanceof feZMetaData and $functionName)
		{
			$result = $contentObject->checkAccess( $functionName );
			return array( 'result' => $result );
		}
		else
		{
			$user = eZUser::currentUser();
        	$userID = $user->attribute( 'contentobject_id' );

		    $accessResult = $user->hasAccessTo( 'fezmetadata', $functionName );
		    $accessWord = $accessResult['accessWord'];

    		if( $accessWord == 'yes' )
	    	{
		    	return 1;
    		}
	    	else
		    {
    			return 0;
	    	}
		}
	}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:25,代码来源:fezmetadata_fetch_collection.php

示例9: bookmarks

 /**
  * Gets current users bookmarks by offset and limit
  *
  * @param array $args  0 => offset:0, 1 => limit:10
  * @return hash
  */
 public static function bookmarks($args)
 {
     $offset = isset($args[0]) ? (int) $args[0] : 0;
     $limit = isset($args[1]) ? (int) $args[1] : 10;
     $http = eZHTTPTool::instance();
     $user = eZUser::currentUser();
     $sort = 'desc';
     if (!$user instanceof eZUser) {
         throw new ezcBaseFunctionalityNotSupportedException('Bookmarks retrival', 'current user object is not of type eZUser');
     }
     $userID = $user->attribute('contentobject_id');
     if ($http->hasPostVariable('SortBy') && $http->postVariable('SortBy') !== 'asc') {
         $sort = 'asc';
     }
     // fetch bookmarks
     $count = eZPersistentObject::count(eZContentBrowseBookmark::definition(), array('user_id' => $userID));
     if ($count) {
         $objectList = eZPersistentObject::fetchObjectList(eZContentBrowseBookmark::definition(), null, array('user_id' => $userID), array('id' => $sort), array('offset' => $offset, 'length' => $limit), true);
     } else {
         $objectList = false;
     }
     // Simplify node list so it can be encoded
     if ($objectList) {
         $list = ezjscAjaxContent::nodeEncode($objectList, array('loadImages' => true, 'fetchNodeFunction' => 'fetchNode', 'fetchChildrenCount' => true), 'raw');
     } else {
         $list = array();
     }
     return array('list' => $list, 'count' => $count ? count($objectList) : 0, 'total_count' => (int) $count, 'offset' => $offset, 'limit' => $limit);
 }
开发者ID:legende91,项目名称:ez,代码行数:35,代码来源:ezoeserverfunctions.php

示例10: store

 function store($fieldFilters = null)
 {
     $dateTime = time();
     $user = eZUser::currentUser();
     $this->setAttribute('modifier_id', $user->attribute('contentobject_id'));
     $this->setAttribute('modified', $dateTime);
     parent::store($fieldFilters);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:8,代码来源:ezrssimport.php

示例11: sectionEditActionCheck

function sectionEditActionCheck( $module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
{
    if ( $module->isCurrentAction( 'SectionEdit' ) )
    {
        $http = eZHTTPTool::instance();
        if ( $http->hasPostVariable( 'SelectedSectionId' ) )
        {
            $selectedSectionID = (int) $http->postVariable( 'SelectedSectionId' );
            $selectedSection = eZSection::fetch( $selectedSectionID );
            if ( is_object( $selectedSection ) )
            {
                $currentUser = eZUser::currentUser();
                if ( $currentUser->canAssignSectionToObject( $selectedSectionID, $object ) )
                {
                    $db = eZDB::instance();
                    $db->begin();
                    $assignedNodes = $object->attribute( 'assigned_nodes' );
                    if ( count( $assignedNodes ) > 0 )
                    {
                        foreach ( $assignedNodes as $node )
                        {
                            if ( eZOperationHandler::operationIsAvailable( 'content_updatesection' ) )
                            {
                                $operationResult = eZOperationHandler::execute( 'content',
                                                                                'updatesection',
                                                                                array( 'node_id'             => $node->attribute( 'node_id' ),
                                                                                       'selected_section_id' => $selectedSectionID ),
                                                                                null,
                                                                                true );

                            }
                            else
                            {
                                eZContentOperationCollection::updateSection( $node->attribute( 'node_id' ), $selectedSectionID );
                            }
                        }
                    }
                    else
                    {
                        // If there are no assigned nodes we should update db for the current object.
                        $objectID = $object->attribute( 'id' );
                        $db->query( "UPDATE ezcontentobject SET section_id='$selectedSectionID' WHERE id = '$objectID'" );
                        $db->query( "UPDATE ezsearch_object_word_link SET section_id='$selectedSectionID' WHERE  contentobject_id = '$objectID'" );
                    }
                    $object->expireAllViewCache();
                    $db->commit();
                }
                else
                {
                    eZDebug::writeError( "You do not have permissions to assign the section <" . $selectedSection->attribute( 'name' ) .
                                         "> to the object <" . $object->attribute( 'name' ) . ">." );
                }
                $module->redirectToView( 'edit', array( $object->attribute( 'id' ), $editVersion, $editLanguage, $fromLanguage ) );
            }
        }
    }
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:57,代码来源:section_edit.php

示例12: create

 static function create($type, $text = false, $creatorID = false)
 {
     $date_time = time();
     if ($creatorID === false) {
         $user = eZUser::currentUser();
         $creatorID = $user->attribute('contentobject_id');
     }
     return new eZCollaborationSimpleMessage(array('message_type' => $type, 'data_text1' => $text, 'creator_id' => $creatorID, 'created' => $date_time, 'modified' => $date_time));
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:9,代码来源:ezcollaborationsimplemessage.php

示例13: eZOOImport

 function eZOOImport()
 {
     $this->ERROR['number'] = 0;
     $this->ERROR['value'] = '';
     $this->ERROR['description'] = '';
     $currentUser = eZUser::currentUser();
     $this->currentUserID = $currentUser->id();
     $this->ImportDir .= md5(time()) . "/";
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:9,代码来源:ezooimport.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $currentUser = eZUser::currentUser();
     $anonymousID = eZUser::anonymousId();
     if ($currentUser->isRegistered()) {
         self::$previousUserID = $currentUser->attribute('contentobject_id');
         eZUser::setCurrentlyLoggedInUser(eZUser::fetch($anonymousID), $anonymousID);
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:10,代码来源:ezpcontent_regression.php

示例15: eZOOImport

 function eZOOImport()
 {
     $this->ERROR['number'] = 0;
     $this->ERROR['value'] = '';
     $this->ERROR['description'] = '';
     $currentUser = eZUser::currentUser();
     $this->currentUserID = $currentUser->id();
     $this->ImportDir .= md5(time()) . "/";
     $this->ooINI = eZINI::instance('odf.ini');
 }
开发者ID:netbliss,项目名称:ezodf,代码行数:10,代码来源:ezooimport.php


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