當前位置: 首頁>>代碼示例>>PHP>>正文


PHP article::allows方法代碼示例

本文整理匯總了PHP中article::allows方法的典型用法代碼示例。如果您正苦於以下問題:PHP article::allows方法的具體用法?PHP article::allows怎麽用?PHP article::allows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在article的用法示例。


在下文中一共展示了article::allows方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: article

// current edited article as object
$cur_article = new article();
$cur_article->item = $item;
$cur_article->anchor = $anchor;
$cur_article->overlay = $overlay;
// get related behaviors, if any
$behaviors = NULL;
if (isset($item['id'])) {
    $behaviors = new Behaviors($item, $anchor);
}
// change default behavior
if (isset($item['id']) && is_object($behaviors) && !$behaviors->allow('articles/edit.php', 'article:' . $item['id'])) {
    $permitted = FALSE;
} elseif (!isset($item['id']) && $anchor->allows('creation', 'article')) {
    $permitted = TRUE;
} elseif (isset($item['id']) && $cur_article->allows('modification')) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
global $render_overlaid;
$whole_rendering = !$render_overlaid;
// cascade empowerment
if ($cur_article->is_owned() || Surfer::is_associate()) {
    Surfer::empower();
}
// do not always show the edition form
$with_form = FALSE;
// load the skin, maybe with a variant
load_skin('articles', $anchor, isset($item['options']) ? $item['options'] : '');
// clear the tab we are in, if any
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:edit.php

示例2: article

    $anchor = Anchors::get($item['anchor']);
}
// current viewed article as object
$cur_article = new article();
$cur_article->item = $item;
$cur_article->anchor = $anchor;
$cur_article->overlay = $overlay;
// get related behaviors, if any
$behaviors = NULL;
if (isset($item['id'])) {
    $behaviors = new Behaviors($item, $anchor);
}
// change default behavior
if (isset($item['id']) && is_object($behaviors) && !$behaviors->allow('articles/view.php', 'article:' . $item['id'])) {
    $permitted = FALSE;
} elseif ($cur_article->allows('access')) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
// owners can do what they want
if ($cur_article->allows('modification')) {
    Surfer::empower();
} elseif (Surfer::is_logged() && is_object($anchor) && $anchor->is_assigned()) {
    Surfer::empower('S');
} elseif (isset($item['id']) && $cur_article->is_assigned() && Surfer::is_logged()) {
    Surfer::empower('S');
}
// is the article on user watch list?
$in_watch_list = FALSE;
if (isset($item['id']) && Surfer::get_id()) {
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:view.php

示例3: sprintf

}
// path to this page
$context['path_bar'] = Surfer::get_path_bar($anchor);
// page title
if (isset($item['title'])) {
    $context['page_title'] = sprintf(i18n::s('Stamp: %s'), $item['title']);
}
// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // not found
} elseif (!isset($item['id'])) {
    include '../error.php';
    // publication is restricted to some people
} elseif (!$cur_article->allows('publication')) {
    // anonymous users are invited to log in
    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Articles::get_url($item['id'], 'stamp')));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // review is confirmed
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'review') {
    // update the database
    if ($error = Articles::stamp($item['id'])) {
        Logger::error($error);
    } else {
        // touch the related anchor
        if (is_object($anchor)) {
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:stamp.php


注:本文中的article::allows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。