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


PHP Application::user方法代码示例

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


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

示例1: blogEntry

        public static function blogEntry($author_id = '',$entry_id = '')
	{
	    $entry = new Entry();
        $min_access = Application::user()->minAccessLevel();
        $access = $entry->also('Access');
        $access->clause('access_level',$min_access,Clause::GTE);
	    
	    if(Application::user()->id())
	    {
	        $lbk_user = $entry->also('LogbookUser');
                $lbk_user->clauseSafe('user_id',Application::user()->id());
	    }

	    if($author_id)
	        $entry->clauseSafe('author_id',Logbook::current()->authorId());

	        $entry->maybe('BlogTag');
            
            if(!$entry_id)
                $entry_id = Application::param('entry_id');

            if($entry_id&&$author_id)
	        $entry->clauseSafe('entry_id',$entry_id);

            $entry->order('entry_date');
            
            /*$entry->order('author_id');
            $entry->order('entry_id');*/
            $entry->maybe('Comment');
            $entry->descending();
            
            try
            {
	        $page = $entry->page(1,1);
	        $ret = current($page->objects());
	        Logbook::current()->setAuthorId($ret->get('author_id'));
            }
            
            catch(Exception $exc)
            {
                $ret = new Entry();
            }
	    
	    return $ret;
        }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:45,代码来源:view_blog_entry.class.php

示例2: userChanged

 public function userChanged()
 {
     $ret = false;
     if ($this->ajaxResponse()) {
         if ($disp = $this->getPreviousDisplay()) {
             $prev = $disp['user'];
             $ret = Application::user()->toString() != $prev;
         }
     }
     return $ret;
 }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:11,代码来源:remote_display.class.php

示例3: runHandlerTest

 public function runHandlerTest()
 {
     $redir = Application::current()->redirection_listener;
     Application::current()->setRedirectionListener($this);
     Application::alterParam('h', $this->test_handler->getClass());
     try {
         ob_start();
         Application::current()->run();
         $cached = ob_get_clean();
     } catch (RedirectionException $exc) {
         $this->setResult('Redirected to: ' . $exc->handler() . ' with vars: ' . $exc->varString(), MurphyTest::REDIRECT);
         Application::current()->setRedirectionLister($redir);
     } catch (AccessDeniedException $exc) {
         $this->setResult('Access denied to ' . $this->test_handler->getClass() . ' for user: ' . Application::user()->toString() . ' in test: ' . $this->name, MurphyTest::ACCESS_DENIED);
         Application::current()->setRedirectionLister($redir);
     } catch (Exception $exc) {
         $this->setResult('Exception of type ' . get_class($exc) . ': ' . $exc->getMessage(), MurphyTest::EXCEPTION);
         Application::current()->setRedirectionLister($redir);
     }
     $this->setResult('Completed handler test for: ' . $this->name, MurphyTest::COMPLETE);
 }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:21,代码来源:unit_test_scenario.class.php

示例4: getSearchObjectForUser

 private static function getSearchObjectForUser($user)
 {
     $min_access = $user->minAccessLevel();
     $ret = new Entry();
     $access = $ret->also('Access');
     $access->clause('access_level', $min_access, Clause::GTE);
     if (Application::user()->id()) {
         $lbk_user = $ret->also('LogbookUser');
         $lbk_user->clause('user_id', $user);
     }
     $ret->order('entry_date');
     $ret->descending();
     $ret->sterile();
     return $ret;
 }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:15,代码来源:logbook.class.php

示例5: impersonateUser

 public function impersonateUser($user)
 {
     Session::register('not_impersonated_user', Application::user());
     Application::setUser($user);
     SiteNavigation::init($user->getHandlerTree());
 }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:6,代码来源:pilot_application.class.php

示例6: userCanDoAction

 public function userCanDoAction($user, $entry, $action)
 {
     //DEFAULT RETURN VALUE IS TRUE
     $ret = true;
     //GRANT ALL PERMISSIONS TO THE AUTHOR
     $author = new Author();
     $author->clause('author_id', $entry->get('author_id'));
     $author->noForeign();
     $author_user_id = $author->get('user_id');
     if ($author_user_id != $user->id()) {
         //FIRST CHECK IF WE ARE EXCLUDED BASED ON ACCESS LEVEL
         $min_level = Application::user()->minAccessLevel();
         $check_entry = $entry->restrict();
         //IF THE ENTRY ACCESS ID IS GREATER THAN THE MIN LEVEL
         //OF THE CURRENT APP USER (0 IS ROOT LEVEL ACCESS)
         if ($access = $check_entry->fetchSingle('Access')) {
             $level = $access->get('access_level');
         } else {
             $level = 0;
         }
         if ($level >= $min_level) {
             if ($user->id()) {
                 $access = new EntryGroupAccess();
                 //NOW CHECK IF THERE IS GROUP ACCESS CONTROL FOR
                 //ANY GROUPS THIS USER IS A MEMBER OF
                 $user = $user->restrict();
                 $user->also('Group');
                 $access->clause('author_id', $entry->get('author_id'));
                 $access->clause('entry_id', $entry->get('entry_id'));
                 //IF THE USER IS IN ANY GROUPS
                 if ($groups = $user->fetch('Group')) {
                     $access->clause('group_id', $groups, Clause::IN);
                 } else {
                     $access->clause('group_id', 0);
                 }
                 //IF THERE WERE ACCESS ENTRIES FOR GROUPS THAT THIS USER IS IN
                 if ($entries = $access->fetch()) {
                     //LOOP THROUGH UNTIL WE FIND A GROUP THAT DIASALLOWS
                     //THEN STOP
                     foreach ($entries as $access_entry) {
                         if ($ret) {
                             $ret = $access_entry->get($action);
                         } else {
                             end($entries);
                         }
                     }
                 } else {
                     if ($action != LogbookAccess::VIEW) {
                         $ret = false;
                     }
                 }
             } else {
                 if ($action != LogbookAccess::VIEW) {
                     $ret = false;
                 }
             }
         } else {
             $ret = false;
         }
     }
     return $ret;
 }
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:62,代码来源:logbook_access.class.php


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