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


PHP Articles::allow_publication方法代码示例

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


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

示例1: elseif

$id = NULL;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
    $id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Articles::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor'])) {
    $anchor = Anchors::get($item['anchor']);
}
// surfer can proceed
if (Articles::allow_publication($item, $anchor)) {
    Surfer::empower();
    $permitted = TRUE;
    // disallow access
} else {
    $permitted = FALSE;
}
// load the skin, maybe with a variant
load_skin('articles', $anchor, isset($item['options']) ? $item['options'] : '');
// 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';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:unpublish.php

示例2:

}
// modify this page
if (Articles::allow_modification($item, $anchor)) {
    Skin::define_img('ARTICLES_EDIT_IMG', 'articles/edit.gif');
    if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'articles'))) {
        $label = i18n::s('Edit this page');
    }
    $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'edit'), ARTICLES_EDIT_IMG . $label, 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
}
// access previous versions, if any
if ($has_versions && Articles::is_owned($item, $anchor)) {
    Skin::define_img('ARTICLES_VERSIONS_IMG', 'articles/versions.gif');
    $context['page_tools'][] = Skin::build_link(Versions::get_url('article:' . $item['id'], 'list'), ARTICLES_VERSIONS_IMG . i18n::s('Versions'), 'basic', i18n::s('Restore a previous version if necessary'));
}
// publish this page
if ((!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE) && Articles::allow_publication($item, $anchor)) {
    Skin::define_img('ARTICLES_PUBLISH_IMG', 'articles/publish.gif');
    $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'publish'), ARTICLES_PUBLISH_IMG . i18n::s('Publish'));
}
// review command provided to container owners
if (is_object($anchor) && $anchor->is_owned()) {
    Skin::define_img('ARTICLES_STAMP_IMG', 'articles/stamp.gif');
    $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'stamp'), ARTICLES_STAMP_IMG . i18n::s('Stamp'));
}
// lock command provided to associates and authenticated editors
if (Articles::is_owned($item, $anchor)) {
    if (!isset($item['locked']) || $item['locked'] == 'N') {
        Skin::define_img('ARTICLES_LOCK_IMG', 'articles/lock.gif');
        $context['page_tools'][] = Skin::build_link(Articles::get_url($item['id'], 'lock'), ARTICLES_LOCK_IMG . i18n::s('Lock'));
    } else {
        Skin::define_img('ARTICLES_UNLOCK_IMG', 'articles/unlock.gif');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view_as_wiki.php


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