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


PHP Current_User::isUser方法代码示例

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


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

示例1: getUserTpl

 public function getUserTpl()
 {
     // Don't let a deity change their deity status
     // Don't let non-deities change status
     if (Current_User::isDeity() && !Current_User::isUser($this->id)) {
         if ($this->isDeity()) {
             $dvars['QUESTION'] = dgettext('users', 'Are you sure you want to remove deity status?');
             $dvars['ADDRESS'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'mortalize_user', 'user_id' => $this->id), 1);
             $dvars['LINK'] = sprintf('<i class="fa fa-cloud" title="%s"></i>', dgettext('users', 'Deity'));
             $links[] = javascript('confirm', $dvars);
         } else {
             $dvars['QUESTION'] = dgettext('users', 'Are you sure you want to deify this user?');
             $dvars['ADDRESS'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'deify_user', 'user_id' => $this->id), 1);
             $dvars['LINK'] = sprintf('<i class="fa fa-male" title="%s"></i>', dgettext('users', 'Mortal'));
             $links[] = javascript('confirm', $dvars);
         }
     }
     $linkVar['action'] = 'admin';
     $linkVar['user_id'] = $this->id;
     if ($this->isActive()) {
         if (!$this->deity) {
             $linkVar['command'] = 'deactivateUser';
             $template['ACTIVE'] = PHPWS_Text::secureLink(dgettext('users', 'Yes'), 'users', $linkVar, null, dgettext('users', 'Deactivate this user'));
         } else {
             $template['ACTIVE'] = dgettext('users', 'Yes');
         }
     } else {
         if (!$this->deity) {
             $linkVar['command'] = 'activateUser';
             $template['ACTIVE'] = PHPWS_Text::secureLink(dgettext('users', 'No'), 'users', $linkVar, null, dgettext('users', 'Activate this user'));
         } else {
             $template['ACTIVE'] = dgettext('users', 'No');
         }
     }
     $logged = $this->getLastLogged('%Y/%m/%d %H:%M');
     if (empty($logged)) {
         $template['LAST_LOGGED'] = dgettext('users', 'Never');
     } else {
         $template['LAST_LOGGED'] = $logged;
     }
     $template['EMAIL'] = $this->getEmail(true, true);
     $jsvar['QUESTION'] = sprintf(dgettext('users', 'Are you certain you want to delete the user &quot;%s&quot; permanently?'), $this->getUsername());
     $link = new PHPWS_Link(null, 'users', array('action' => 'admin', 'command' => 'deleteUser', 'user_id' => $this->id), true);
     $link->setSalted();
     $jsvar['ADDRESS'] = $link->getAddress();
     $jsvar['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('users', 'Delete user') . '"></i>';
     $linkVar['command'] = 'editUser';
     $links[] = PHPWS_Text::secureLink('<i class="fa fa-edit"></i>', 'users', $linkVar);
     $linkVar['command'] = 'setUserPermissions';
     $links[] = PHPWS_Text::secureLink('<i class="fa fa-key" title="' . dgettext('users', 'Permissions') . '"></i>', 'users', $linkVar);
     if (!$this->isDeity() && $this->id != Current_User::getId()) {
         $links[] = Layout::getJavascript('confirm', $jsvar);
     }
     $template['ACTIONS'] = implode('&nbsp;', $links);
     if ($this->deity && !Current_User::isDeity()) {
         unset($template['ACTIONS']);
     }
     return $template;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:59,代码来源:Users.php

示例2: main

 public static function main()
 {
     if (!Current_User::authorized('blog')) {
         Current_User::disallow(dgettext('blog', 'User attempted access to Blog administration.'));
         return;
     }
     $title = $content = NULL;
     $message = Blog_Admin::getForward();
     $panel = Blog_Admin::cpanel();
     $panel->enableSecure();
     if (isset($_REQUEST['command'])) {
         $command = $_REQUEST['command'];
     } else {
         $command = $panel->getCurrentTab();
     }
     if (isset($_REQUEST['blog_id'])) {
         $blog = new Blog((int) $_REQUEST['blog_id']);
     } else {
         $blog = new Blog();
     }
     switch ($command) {
         case 'edit':
             $panel->setCurrentTab('list');
             if (!Current_User::isUser($blog->author_id) && !Current_User::authorized('blog', 'edit_blog', $_REQUEST['blog_id'], 'entry')) {
                 Current_User::disallow(dgettext('blog', 'User tried to edit a blog.'));
                 return;
             }
             $title = dgettext('blog', 'Update Blog Entry');
             $content = Blog_Form::edit($blog);
             break;
         case 'new':
             $title = dgettext('blog', 'New Blog Entry');
             $content = Blog_Form::edit($blog);
             break;
         case 'delete':
             //Blog_Admin::resetCache();
             $result = $blog->delete();
             Blog_Admin::setForward(dgettext('blog', 'Blog entry deleted.'), 'list');
             break;
         case 'list':
             $title = dgettext('blog', 'Blog Entries');
             $content = Blog_Admin::entry_list();
             break;
         case 'menu_submit_link':
             Menu::pinLink(dgettext('blog', 'Submit entry'), 'index.php?module=blog&action=user&action=submit');
             PHPWS_Core::reroute('index.php?module=blog&action=admin&tab=settings&authkey=' . Current_User::getAuthKey());
             break;
         case 'sticky':
             if (!Current_User::isUnrestricted('blog')) {
                 Current_User::disallow();
             }
             Blog_Admin::sticky($blog);
             PHPWS_Core::goBack();
             break;
         case 'unsticky':
             if (!Current_User::isUnrestricted('blog')) {
                 Current_User::disallow();
             }
             Blog_Admin::unsticky($blog);
             PHPWS_Core::goBack();
             break;
         case 'post_entry':
             $title = dgettext('blog', 'Blog Archive');
             $panel->setCurrentTab('list');
             $blog->post_entry();
             $link_back = PHPWS_Text::linkAddress('blog', array('action' => 'admin', 'tab' => 'list'), TRUE);
             if ($blog->_error) {
                 if (empty($blog->id)) {
                     $panel->setCurrentTab('new');
                 }
                 $content = Blog_Form::edit($blog);
             } else {
                 if (!isset($_POST['blog_id']) && PHPWS_Core::isPosted()) {
                     Blog_Admin::setForward(dgettext('blog', 'Entry saved successfully.'), 'list');
                 }
                 $result = $blog->save();
                 //Blog_Admin::resetCache();
                 if (PHPWS_Error::isError($result)) {
                     $message = dgettext('blog', 'An error occurred when trying to save your entry. Please check your logs.');
                     PHPWS_Error::log($result);
                     Blog_Admin::setForward($message, 'list');
                 }
                 if (!$blog->approved) {
                     Blog_Admin::setForward(dgettext('blog', 'Your entry is being held for approval.'), 'list');
                 } else {
                     PHPWS_Core::reroute($blog->getViewLink(true));
                 }
             }
             break;
         case 'reset_cache':
             Blog_Admin::resetCache();
             PHPWS_Core::goBack();
             break;
         case 'post_settings':
             if (!Current_User::authorized('blog', 'settings')) {
                 Current_User::disallow();
                 return;
             }
             if (Current_User::isDeity() && isset($_POST['purge_confirm'])) {
                 $title = dgettext('blog', 'Purge Blog Entries');
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Blog_Admin.php


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