Ejemplo n.º 1
0
 /**
  * Show files in the cache
  *
  */
 protected function ShowFiles()
 {
     global $langmessage;
     $this->page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
     $this->page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
     if (!$this->all_files) {
         return;
     }
     echo '<p>';
     echo \gp\tool::Link('Admin/Cache', 'Empty Cache', 'cmd=EmptyResourceCache', array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => 'Empty the resource cache?'));
     echo '</p>';
     echo '<table class="bordered tablesorter full_width">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['File Size'];
     echo '</th><th>';
     echo 'Touched';
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '</thead>';
     $total_size = 0;
     echo '<tbody>';
     foreach ($this->all_files as $file) {
         $full = $this->cache_dir . '/' . $file;
         echo '<tr><td>';
         echo '<a href="?cmd=ViewFile&amp;file=' . rawurlencode($file) . '">';
         echo $file;
         echo '</a>';
         echo '</td><td>';
         $size = filesize($full);
         echo '<span style="display:none">' . $size . '</span>';
         echo \gp\admin\Tools::FormatBytes($size);
         $total_size += $size;
         echo '</td><td>';
         $elapsed = \gp\admin\Tools::Elapsed(time() - filemtime($full));
         echo sprintf($langmessage['_ago'], $elapsed);
         echo '</td><td>';
         echo \gp\tool::Link('Admin/Cache', $langmessage['delete'], 'cmd=DeleteFile&amp;file=' . rawurlencode($file), array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm']));
         echo '</tr>';
     }
     echo '</tbody>';
     //totals
     echo '<tfoot>';
     echo '<tr><td>';
     echo number_format(count($this->all_files)) . ' Files';
     echo '</td><td>';
     echo \gp\admin\Tools::FormatBytes($total_size);
     echo '</td><td>';
     echo '</tr>';
     echo '</table>';
 }
Ejemplo n.º 2
0
 public function TrashRow($trash_index, $info, $show_orphaned = false)
 {
     global $langmessage;
     $class = '';
     if (isset($info['orphaned'])) {
         $class = 'orphaned';
     }
     //title
     echo '<tr class="' . $class . '"><td>';
     echo '<label style="display:block;">';
     echo '<input type="checkbox" name="titles[]" value="' . htmlspecialchars($trash_index) . '" />';
     echo ' &nbsp; ';
     if (isset($info['orphaned'])) {
         echo '(Orphaned) &nbsp; ';
     }
     echo \gp\tool::Link('Admin/Trash/' . $trash_index, str_replace('_', ' ', $info['title']));
     echo '</label>';
     //time
     echo '</td><td>';
     if (!empty($info['time'])) {
         $elapsed = \gp\admin\Tools::Elapsed(time() - $info['time']);
         echo sprintf($langmessage['_ago'], $elapsed);
     }
     echo '</td><td>';
     if (isset($info['type'])) {
         $this->TitleTypes($info['type']);
     }
     echo '</td><td>';
     if (\gp\admin\Tools::CheckPostedNewPage($info['title'], $msg)) {
         echo \gp\tool::Link('Admin/Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'postlink'));
     } else {
         echo '<span>' . $langmessage['restore'] . '</span>';
     }
     echo ' &nbsp; ';
     echo \gp\tool::Link('Admin/Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'postlink'));
     echo '</td></tr>';
 }
Ejemplo n.º 3
0
 /**
  * Return content for history row
  *
  */
 protected function HistoryRow($time, $size, $username, $which = 'history')
 {
     global $langmessage;
     ob_start();
     $date = \gp\tool::date($langmessage['strftime_datetime'], $time);
     echo '<tr><td title="' . htmlspecialchars($date) . '">';
     switch ($which) {
         case 'current':
             echo '<b>' . $langmessage['Current Page'] . '</b><br/>';
             break;
         case 'draft':
             echo '<b>' . $langmessage['Working Draft'] . '</b><br/>';
             break;
     }
     $elapsed = \gp\admin\Tools::Elapsed(time() - $time);
     echo sprintf($langmessage['_ago'], $elapsed);
     echo '</td><td>';
     if ($size && is_numeric($size)) {
         echo \gp\admin\Tools::FormatBytes($size);
     }
     echo '</td><td>';
     if (!empty($username)) {
         echo $username;
     }
     echo '</td><td>';
     switch ($which) {
         case 'current':
             echo \gp\tool::Link($this->title, $langmessage['View'], 'cmd=ViewCurrent', array('data-cmd' => 'cnreq'));
             break;
         case 'draft':
             echo \gp\tool::Link($this->title, $langmessage['View']);
             echo ' &nbsp; ' . \gp\tool::Link($this->title, $langmessage['Publish Draft'], 'cmd=PublishDraft', array('data-cmd' => 'cnreq'));
             break;
         case 'history':
             echo \gp\tool::Link($this->title, $langmessage['View'], 'cmd=ViewRevision&time=' . $time, array('data-cmd' => 'cnreq'));
             echo ' &nbsp; ';
             echo \gp\tool::Link($this->title, $langmessage['delete'], 'cmd=DeleteRevision&time=' . $time, array('data-cmd' => 'gpabox', 'class' => 'gpconfirm'));
             break;
     }
     echo '</td></tr>';
     return ob_get_clean();
 }
Ejemplo n.º 4
0
 /**
  * Display the error log
  *
  */
 function ErrorLog()
 {
     global $langmessage;
     $error_log = ini_get('error_log');
     echo '<h2 class="hmargin">';
     echo \gp\tool::Link('Admin/Errors', 'Fatal Errors');
     echo ' <span> | </span>';
     echo ' Error Log';
     echo '</h2>';
     if (!self::ReadableLog()) {
         echo '<p>Sorry, an error log could not be found or could not be read.</p>';
         echo '<p>Log File: ' . $error_log . '</p>';
         return;
     }
     echo '<p><b>Please Note:</b> The following errors are not limited to your installation of ' . CMS_NAME . '.';
     echo '</p>';
     $lines = file($error_log);
     $lines = array_reverse($lines);
     $time = null;
     $displayed = array();
     foreach ($lines as $line) {
         $line = trim($line);
         if (empty($line)) {
             continue;
         }
         preg_match('#^\\[[a-zA-Z0-9:\\- ]*\\]#', $line, $date);
         if (count($date)) {
             $date = $date[0];
             $line = substr($line, strlen($date));
             $date = trim($date, '[]');
             $new_time = strtotime($date);
             if ($new_time !== $time) {
                 if ($time) {
                     echo '</pre>';
                 }
                 echo '<p>';
                 $elapsed = \gp\admin\Tools::Elapsed(time() - $new_time);
                 echo sprintf($langmessage['_ago'], $elapsed);
                 echo ' (' . $date . ')';
                 echo '</p>';
                 echo '<pre>';
                 $time = $new_time;
                 $displayed = array();
             }
         }
         $line_hash = md5($line);
         if (in_array($line_hash, $displayed)) {
             continue;
         }
         echo $line;
         $displayed[] = $line_hash;
         echo "\n";
     }
     echo '</pre>';
 }