本文整理汇总了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
示例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;
}