コード例 #1
0
ファイル: rdf.php プロジェクト: austinvernsonger/scalar
 /**
  * Output information about a page
  */
 public function node()
 {
     if (empty($this->data['book'])) {
         header(StatusCodes::httpHeaderFor(StatusCodes::HTTP_NOT_FOUND));
         exit;
     }
     try {
         $slug = implode('/', array_slice($this->uri->segments, array_search(__FUNCTION__, $this->uri->segments)));
         $slug = no_version(no_ext(str_replace($this->data['book']->slug . '/', '', $slug)));
         $content = $this->pages->get_by_slug($this->data['book']->book_id, $slug);
         // Don't throw an error here if $content is empty, let through to return empty RDF
         if (!empty($content) && !$content->is_live && !$this->login_is_book_admin($this->data['book']->book_id)) {
             $content = null;
         }
         // Protect
         $this->rdf_object->index($this->data['content'], array('book' => $this->data['book'], 'content' => $content, 'base_uri' => $this->data['base_uri'], 'method' => __FUNCTION__ . '/' . $slug, 'restrict' => $this->data['restrict'], 'versions' => $this->data['versions'] ? RDF_Object::VERSIONS_ALL : RDF_Object::VERSIONS_MOST_RECENT, 'ref' => $this->data['references'] ? RDF_Object::REFERENCES_ALL : RDF_Object::REFERENCES_NONE, 'prov' => $this->data['provenance'] ? RDF_Object::PROVENANCE_ALL : RDF_Object::PROVENANCE_NONE, 'pagination' => $this->data['pagination'], 'max_recurses' => $this->data['recursion']));
         $this->rdf_object->serialize($this->data['content'], $this->data['format']);
     } catch (Exception $e) {
         header(StatusCodes::httpHeaderFor(StatusCodes::HTTP_INTERNAL_SERVER_ERROR));
         exit;
     }
     $this->template->set_template('blank');
     $this->template->write_view('content', 'modules/data/' . $this->data['format'], $this->data);
     $this->template->render();
 }
コード例 #2
0
ファイル: editbar.php プロジェクト: austinvernsonger/scalar
if ($mode || !$login->is_logged_in || !$can_edit) {
    return;
}
if (isset($hide_edit_bar) && $hide_edit_bar) {
    return;
}
echo '<div class="edit_options">';
// New Button
if ($this->users->is_a($user_level, 'commentator')) {
    echo '<a class="generic_button large" href="' . $base_uri . 'new.edit">';
    echo 'New' . ('commentator' == strtolower($user_level) ? ' Commentary' : '');
    echo "</a>&nbsp;&nbsp;";
}
// Edit button
$to_edit = no_version($_SERVER['REQUEST_URI']);
if (strpos($to_edit, '?')) {
    $to_edit = substr($to_edit, 0, strpos($to_edit, '?'));
}
if (isset($page->version_index)) {
    $version_num = $page->versions[$page->version_index]->version_num;
    $to_edit .= '.' . $version_num;
}
echo '<a class="generic_button large" href="' . $to_edit . '.edit' . get_str() . '">';
echo 'Edit';
echo "</a>&nbsp;&nbsp;";
// Edit annotations button
if (isset($page->version_index) && !empty($page->versions[$page->version_index]->url)) {
    echo '<a class="generic_button large" href="' . $base_uri . $page->slug . '.annotation_editor">';
    echo 'Edit annotations';
    echo '</a>&nbsp;&nbsp;';