當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。