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


PHP Key::allowView方法代码示例

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


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

示例1: allow

 public function allow()
 {
     if (!$this->public_folder && !Current_User::isLogged()) {
         return false;
     }
     if (!$this->key_id) {
         return true;
     }
     $key = new Key($this->key_id);
     return $key->allowView();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:11,代码来源:Folder.php

示例2: view

 /**
  * Pathing for which view to display
  */
 public function view()
 {
     require_once PHPWS_SOURCE_DIR . 'mod/calendar/class/Event.php';
     $key = new Key($this->calendar->schedule->key_id);
     if (!$key->allowView()) {
         $this->calendar->loadDefaultSchedule();
     }
     $schedule_key = $this->calendar->schedule->getKey();
     if (!$this->calendar->schedule->public && !$schedule_key->allowView()) {
         PHPWS_Core::errorPage('403');
     }
     \Layout::disableRobots();
     $current_date = $this->calendar->current_date * 1000;
     switch ($this->current_view) {
         case 'day':
             $this->content = $this->day();
             break;
         case 'grid':
             if (ALLOW_CACHE_LITE && Current_User::allow('calendar')) {
                 if (strftime('%Y%m', $this->calendar->today) == strftime('%Y%m', $this->calendar->current_date)) {
                     $current_date = $this->calendar->today * 1000;
                 }
                 $this->resetCacheLink('grid', $this->calendar->int_month, $this->calendar->int_year, $this->calendar->schedule->id);
             }
             $this->content = $this->month_grid();
             break;
         case 'list':
             if (ALLOW_CACHE_LITE && Current_User::allow('calendar')) {
                 $this->resetCacheLink('list', $this->calendar->int_month, $this->calendar->int_year, $this->calendar->schedule->id);
             }
             $this->content = $this->month_list();
             break;
         case 'week':
             $this->content = $this->week();
             break;
         case 'event':
             if (isset($_REQUEST['page'])) {
                 $event_id = (int) $_REQUEST['page'];
             } elseif (isset($_REQUEST['event_id'])) {
                 $event_id = $_REQUEST['event_id'];
             } else {
                 $this->content = $this->day();
             }
             if (!$this->loadEvent($event_id) || !$this->event->id) {
                 $this->content = $this->day();
                 break;
             }
             if (isset($_REQUEST['js'])) {
                 $this->content = $this->event(true);
                 Layout::nakedDisplay($this->content);
                 return;
             } else {
                 $this->content = $this->event();
             }
             break;
         default:
             $this->content = dgettext('calendar', 'Incorrect option');
             break;
     }
     if ($this->calendar->schedule->checkPermissions()) {
         if ($this->calendar->schedule->id) {
             require_once PHPWS_SOURCE_DIR . 'mod/calendar/class/Admin.php';
             $event = new Calendar_Event(0, $this->calendar->schedule);
             Layout::add(\Calendar_Admin::eventModal($event));
             \Calendar_Admin::includeEventJS();
             $link = '<a style="cursor:pointer" class="add-event" data-schedule-id="' . $this->calendar->schedule->id . '" data-date="' . $current_date * 1000 . '">Add event</a>';
             MiniAdmin::add('calendar', $link);
             MiniAdmin::add('calendar', $this->calendar->schedule->uploadEventsLink());
         }
     }
     if ($this->current_view == 'event') {
         $this->event->flagKey();
     } else {
         $schedule_key->flag();
     }
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:79,代码来源:User.php

示例3: view

 /**
  * Displays the blog entry
  *
  * @param boolean edit       If true, show edit link
  * @param boolean summarized If true, this is a summarized entry
  */
 public function view($edit = true, $summarized = true)
 {
     if (!$this->id) {
         PHPWS_Core::errorPage(404);
     }
     $key = new Key($this->key_id);
     if (!$key->allowView() || !Blog_User::allowView()) {
         Current_User::requireLogin();
         return dgettext('blog', 'You do not have permission to view this entry.');
     }
     $template['TITLE'] = sprintf('<a href="%s" rel="bookmark">%s</a>', $this->getViewLink(true), $this->title);
     $template['TITLE_NO_LINK'] = $this->title;
     if ($this->publish_date > time()) {
         $template['UNPUBLISHED'] = dgettext('blog', 'Unpublished');
     } elseif ($this->expire_date && $this->expire_date < time()) {
         $template['UNPUBLISHED'] = dgettext('blog', 'Expired');
     }
     $template['LOCAL_DATE'] = $this->getPublishDate();
     $summary = $this->getSummary(true);
     $entry = $this->getEntry(true);
     if ($summarized) {
         if (empty($summary)) {
             $template['SUMMARY'] = PHPWS_Text::parseTag($entry);
         } else {
             if (!empty($entry)) {
                 $template['READ_MORE'] = PHPWS_Text::rewriteLink(Icon::get('chevron-circle-down') . '&nbsp;' . dgettext('blog', 'Read more'), 'blog', array('id' => $this->id), null, 'Read more of this entry', 'btn btn-default');
             }
             $template['SUMMARY'] = PHPWS_Text::parseTag($summary);
         }
     } else {
         $template['SUMMARY'] = PHPWS_Text::parseTag($summary);
         $template['ENTRY'] = PHPWS_Text::parseTag($entry);
     }
     $template['IMAGE'] = $this->getFile($this->thumbnail && $summarized);
     if ($edit && (Current_User::allow('blog', 'edit_blog', $this->id, 'entry') || Current_User::allow('blog', 'edit_blog') && $this->author_id == Current_User::getId())) {
         $vars['blog_id'] = $this->id;
         $vars['action'] = 'admin';
         $vars['command'] = 'edit';
         $template['EDIT_LINK'] = PHPWS_Text::secureLink(dgettext('blog', 'Edit'), 'blog', $vars);
         $template['EDIT_URI'] = PHPWS_Text::linkAddress('blog', $vars, true);
         if (!$summarized) {
             MiniAdmin::add('blog', array(PHPWS_Text::secureLink(dgettext('blog', 'Edit blog'), 'blog', $vars)));
         }
     }
     // Check setting for showing when the entry was posted
     if (PHPWS_Settings::get('blog', 'show_posted_by')) {
         $template['POSTED_BY'] = dgettext('blog', 'By');
         $template['AUTHOR'] = $this->author;
     }
     // Check settings for showing the author of the entry
     if (PHPWS_Settings::get('blog', 'show_posted_date')) {
         $template['PUBLISHED'] = dgettext('blog', 'Published');
         $template['POSTED_ON'] = dgettext('blog', 'Posted on');
         $template['PUBLISHED_DATE'] = $this->getPublishDateShort();
     }
     if ($summarized) {
         $view_tpl = 'view_list.tpl';
     } else {
         $template['COMMENT_SCRIPT'] = PHPWS_Settings::get('blog', 'comment_script');
         $key->flag();
         $view_tpl = 'view_full.tpl';
     }
     return PHPWS_Template::process($template, 'blog', $view_tpl);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:70,代码来源:Blog.php


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