// 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();