本文整理匯總了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();