本文整理汇总了PHP中Sections::lock方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::lock方法的具体用法?PHP Sections::lock怎么用?PHP Sections::lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::lock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
// the title of the page
$context['page_title'] = i18n::s('Lock');
// 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';
// permission denied
} elseif (!Sections::is_owned($item, $anchor) && !Surfer::is_associate()) {
// anonymous users are invited to log in or to register
if (!Surfer::is_logged()) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Sections::get_url($item['id'], 'lock')));
}
// permission denied to authenticated user
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// an error occured
} elseif (count($context['error'])) {
} elseif (Sections::lock($item['id'], $item['locked'])) {
// clear the cache
Sections::clear($item);
// redirect to the page
Safe::redirect(Sections::get_permalink($item));
// failed operation
} else {
$context['text'] .= '<p>' . i18n::s('Operation has failed.') . '</p>';
}
// render the skin
render_skin();