$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';
} // 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');