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


PHP Articles::allow_access方法代码示例

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


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

示例1: load_skin

}
// load the skin, maybe with a variant
load_skin('articles', $anchor, isset($item['options']) ? $item['options'] : '');
// clear the tab we are in, if any
if (is_object($anchor)) {
    $context['current_focus'] = $anchor->get_focus();
}
// the title of the page
if (isset($item['title'])) {
    $context['page_title'] = $item['title'];
}
// not found
if (!isset($item['id'])) {
    include '../error.php';
    // permission denied
} elseif (!Articles::allow_access($item, $anchor)) {
    // give anonymous surfers a chance for HTTP authentication
    if (!Surfer::is_logged()) {
        Safe::header('WWW-Authenticate: Basic realm="' . utf8::to_iso8859($context['site_name']) . '"');
        Safe::header('Status: 401 Unauthorized', TRUE, 401);
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // describe the article
} else {
    // initialize the rendering engine
    Codes::initialize(Articles::get_permalink($item));
    // compute the url for this article
    $permanent_link = Articles::get_permalink($item);
    // the trackback link
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:describe.php

示例2: allow_modification

 /**
  * check if an article can be modified
  *
  * This function returns TRUE if the page can be modified,
  * and FALSE otherwise.
  *
  * @param array a set of item attributes, aka, the target article
  * @param object an instance of the Anchor interface
  * @return TRUE or FALSE
  */
 public static function allow_modification($item, $anchor)
 {
     global $context;
     // sanity check
     if (!isset($item['id']) && !$anchor) {
         return FALSE;
     }
     // surfer is an associate
     if (Surfer::is_associate()) {
         return TRUE;
     }
     // ensure access rights
     if (!Articles::allow_access($item, $anchor)) {
         return FALSE;
     }
     // submissions have been disallowed
     if (isset($context['users_without_submission']) && $context['users_without_submission'] == 'Y') {
         return FALSE;
     }
     // surfer owns the container or the article
     if (Articles::is_owned($item, $anchor)) {
         return TRUE;
     }
     // allow section editors to manage content, except on private sections
     if (Surfer::is_member() && is_object($anchor) && !$anchor->is_hidden() && $anchor->is_assigned()) {
         return TRUE;
     }
     // allow page editors to manage content, except on private page
     if (Surfer::is_member() && $item['active'] != 'N' && Articles::is_assigned($item['id'])) {
         return TRUE;
     }
     // article has been locked
     if (isset($item['locked']) && $item['locked'] == 'Y') {
         return FALSE;
     }
     // maybe this anonymous surfer is allowed to handle this item
     if (isset($item['handle']) && Surfer::may_handle($item['handle'])) {
         return TRUE;
     }
     // community wiki
     if (Surfer::is_logged() && Articles::has_option('members_edit', $anchor, $item)) {
         return TRUE;
     }
     // public wiki
     if (Articles::has_option('anonymous_edit', $anchor, $item)) {
         return TRUE;
     }
     // default case
     return FALSE;
 }
开发者ID:rair,项目名称:yacs,代码行数:60,代码来源:articles.php


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