Exemple #1
0
 function RunScript()
 {
     if (!$this->SetVars()) {
         return;
     }
     //allow addons to effect page actions and how a page is displayed
     $cmd = \gp\tool::GetCommand();
     $cmd_after = \gp\tool\Plugins::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     $this->GetFile();
     $this->contentBuffer = \gp\tool\Output\Sections::Render($this->file_sections, $this->title, $this->file_stats);
 }
Exemple #2
0
 /**
  * View the current public facing version of the file
  *
  */
 public function ViewCurrent()
 {
     if (!$this->draft_exists) {
         $this->DefaultDisplay();
         return;
     }
     $file_sections = \gp\tool\Files::Get($this->file, 'file_sections');
     $this->revision = $this->fileModTime;
     echo \gp\tool\Output\Sections::Render($file_sections, $this->title, $this->file_stats);
 }
Exemple #3
0
 /**
  * View the contents of a trash file
  *
  */
 public function ViewTrashFile($trash_index)
 {
     global $dataDir, $langmessage, $trash_file;
     $title_info = self::GetInfo($trash_index);
     //delete / restore links
     echo '<div class="pull-right">';
     echo \gp\tool::Link('Admin/Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo ' &nbsp; ';
     echo \gp\tool::Link('Admin/Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo '</div>';
     echo '<h2 class="hmargin">';
     echo \gp\tool::Link('Admin/Trash', $langmessage['trash']);
     echo ' &#187; ';
     echo htmlspecialchars($title_info['title']);
     echo '</h2>';
     echo '<hr>';
     //get file sections
     $file_sections = \gp\tool\Files::Get($title_info['page_file'], 'file_sections');
     if ($file_sections) {
         echo \gp\tool\Output\Sections::Render($file_sections, $title_info['title']);
     } else {
         echo '<p>This page no longer has any content</p>';
     }
 }
Exemple #4
0
 public function SearchPage($title, $index)
 {
     global $gp_menu, $gp_titles;
     //search hidden?
     if (!$this->search_hidden && !isset($gp_menu[$index])) {
         return;
     }
     //private pages
     if (!\gp\tool::LoggedIn()) {
         if (isset($gp_titles[$index]['vis'])) {
             return;
         }
     }
     $full_path = \gp\tool\Files::PageFile($title);
     $file_sections = \gp\tool\Files::Get($full_path, 'file_sections');
     if (!$file_sections) {
         return;
     }
     $content = \gp\tool\Output\Sections::Render($file_sections, $title, \gp\tool\Files::$last_stats);
     $label = \gp\tool::GetLabel($title);
     $this->FindString($content, $label, $title);
 }