Beispiel #1
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();
 }
Beispiel #2
0
 function CheckStatus()
 {
     global $langmessage;
     $diff = time() - $this->data_timestamp;
     if ($this->data_timestamp > 0) {
         echo '<p>';
         echo sprintf($langmessage['Software_updates_checked'], \gp\tool::date($langmessage['strftime_datetime'], $this->data_timestamp));
         echo '</p>';
     }
     //one hour old
     if ($diff > 3600) {
         echo '<p>';
         echo '<a href="?cmd=checkremote">' . $langmessage['Check Now'] . '</a>';
         echo '</p>';
     }
 }
Beispiel #3
0
 /**
  * Display a form for uploading CKEditor plugins
  *
  */
 function PluginForm()
 {
     global $langmessage;
     echo '<form method="post" action="' . \gp\tool::GetUrl($this->page->requested) . '" enctype="multipart/form-data">';
     echo '<table class="bordered"><tr><th>' . $langmessage['name'] . '</th><th>' . $langmessage['Modified'] . '</th><th>' . $langmessage['options'] . '</th></tr>';
     if (count($this->cke_config['plugins'])) {
         foreach ($this->cke_config['plugins'] as $plugin_name => $plugin_info) {
             echo '<tr><td>';
             echo $plugin_name;
             echo '</td><td>';
             echo \gp\tool::date($langmessage['strftime_datetime'], $plugin_info['updated']);
             echo '</td><td>';
             $attr = array('data-cmd' => 'postlink', 'class' => 'gpconfirm', 'title' => sprintf($langmessage['generic_delete_confirm'], $plugin_name));
             echo \gp\tool::Link($this->page->requested, $langmessage['delete'], 'cmd=rmplugin&plugin=' . rawurlencode($plugin_name), $attr);
             echo '</td></tr>';
         }
     }
     echo '<tr><td>';
     echo '<input type="hidden" name="cmd" value="upload_plugin" />';
     echo '<input type="file" name="plugin" />';
     echo '</td><td>&nbsp;';
     echo '</td><td>';
     echo ' <input type="submit" value="Install Plugin" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     //$this->build_config
     if ($this->build_config && isset($this->build_config['plugins'])) {
         $ordered = array();
         $count = 0;
         foreach ($this->build_config['plugins'] as $plugin => $status) {
             if (!$status) {
                 continue;
             }
             $char = strtoupper($plugin[0]);
             $ordered[$char][] = '<a href="http://ckeditor.com/addon/' . $plugin . '" target="_blank">' . ucfirst($plugin) . '</a>';
             $count++;
         }
         //echo '<h3>'.$langmessage['Installed'].'</h3>';
         echo '<p><br/></p>';
         echo '<table class="bordered">';
         echo '<tr><th colspan="2">' . $langmessage['Installed'] . ' (' . $count . ')</th></tr>';
         foreach ($ordered as $char => $plugins) {
             echo '<tr><td>';
             echo '<b>' . $char . '</b>';
             echo '</td><td>';
             echo implode(', ', $plugins);
             echo '</td></tr>';
         }
         echo '</table>';
     }
 }
Beispiel #4
0
 /**
  * Get the output formatting data for
  *
  */
 public function GetReplaceData($title, $layout_info, $menu_key, $menu_value = array())
 {
     global $langmessage, $gp_titles;
     $isSpecialLink = \gp\tool::SpecialOrAdmin($title);
     //get the data for this title
     $data = array('key' => $menu_key, 'url' => \gp\tool::GetUrl($title), 'title' => $title, 'special' => $isSpecialLink, 'has_layout' => !empty($gp_titles[$menu_key]['gpLayout']), 'layout_color' => $layout_info['color'], 'layout_label' => $layout_info['label'], 'types' => $gp_titles[$menu_key]['type'], 'opts' => '', 'size' => '', 'mtime' => '');
     if (isset($menu_value['level'])) {
         $data['level'] = $menu_value['level'];
     }
     if ($isSpecialLink === false) {
         $file = \gp\tool\Files::PageFile($title);
         $stats = @stat($file);
         if ($stats) {
             $data['size'] = \gp\admin\Tools::FormatBytes($stats['size']);
             $data['time'] = \gp\tool::date($langmessage['strftime_datetime'], $stats['mtime']);
         }
     }
     ob_start();
     \gp\tool\Plugins::Action('MenuPageOptions', array($title, $menu_key, $menu_value, $layout_info));
     $menu_options = ob_get_clean();
     if ($menu_options) {
         $data['opts'] = $menu_options;
     }
     return $data;
 }
Beispiel #5
0
 public function FileInfo($file)
 {
     global $langmessage;
     $file = str_replace('_', '.', $file);
     $temp = explode('.', $file);
     if (count($temp) < 3) {
         return '';
     }
     $info = array();
     $info['ext'] = array_pop($temp);
     $info['bits'] = '';
     if (count($temp) >= 3 && is_numeric($temp[0]) && is_numeric($temp[1])) {
         list($time, $exported) = $temp;
         $info['time'] = \gp\tool::date($langmessage['strftime_datetime'], $time);
         $info['bits'] = $exported;
         foreach ($this->export_fields as $export_field) {
             $index = $export_field['index'];
             if (($exported & $index) == $index) {
                 $info['exported'][] = $export_field['label'];
             }
         }
         if (empty($info['exported'])) {
             $info['exported'][] = 'Unknown';
         }
     } else {
         $info['time'] = $file;
         $info['exported'][] = 'Unknown';
     }
     return $info;
 }
Beispiel #6
0
 public function ReviewAddonForm()
 {
     global $config, $dirPrefix, $langmessage;
     if (!$this->CanRate()) {
         return;
     }
     $this->page->head_js[] = '/include/js/rate.js';
     //get appropriate variables
     $id = $this->addon_info['id'];
     if (isset($_REQUEST['rating'])) {
         $rating = $_REQUEST['rating'];
     } elseif (isset($this->addonReviews[$id])) {
         $rating = $this->addonReviews[$id]['rating'];
     } else {
         $rating = 5;
     }
     if (isset($_REQUEST['review'])) {
         $review = $_REQUEST['review'];
     } elseif (isset($this->addonReviews[$id])) {
         $review = $this->addonReviews[$id]['review'];
     } else {
         $review = '';
     }
     echo '<h2>';
     echo $this->addon_info['name'] . ' &#187; ' . 'Rate';
     echo '</h2>';
     if (isset($this->addonReviews[$id])) {
         echo 'You posted the following review on ' . \gp\tool::date($langmessage['strftime_date'], $this->addonReviews[$id]['time']);
     }
     //echo '<form action="'.\gp\tool::GetUrl($this->scriptUrl,'cmd=rate&arg='.$this->addon_info['pass_arg']).'" method="post">';
     echo '<form action="' . \gp\tool::GetUrl($this->scriptUrl) . '" method="post">';
     echo '<input type="hidden" name="arg" value="' . $this->addon_info['pass_arg'] . '"/>';
     echo '<table class="rating_table">';
     echo '<tr><td>Rating</td><td>';
     echo '<span class="rating">';
     for ($i = 1; $i < 6; $i++) {
         $class = '';
         if ($i > $rating) {
             $class = ' class="unset"';
         }
         echo '<a data-rating="' . $i . '"' . $class . '></a>';
     }
     echo '<input type="hidden" name="rating" value="' . htmlspecialchars($rating) . '" />';
     echo '</span> ';
     echo '</td></tr>';
     echo '<tr><td>Review</td><td>';
     echo '<textarea name="review" cols="50" rows="7" class="gptextarea">';
     echo htmlspecialchars($review);
     echo '</textarea>';
     echo '</td></tr>';
     echo '<tr><td>From</td><td>';
     $host = $_SERVER['HTTP_HOST'] . $dirPrefix;
     echo '<input type="text" name="host"  size="50" value="' . htmlspecialchars($host) . '" readonly="readonly" class="gpinput gpreadonly" />';
     echo '<br/>';
     echo '<input type="checkbox" name="show_site" value="hidden" /> Click to hide your site information on ' . CMS_READABLE_DOMAIN . '.';
     echo '</td></tr>';
     echo '<tr><td></td><td>';
     if (isset($this->addonReviews[$id])) {
         echo '<button type="submit" name="cmd" value="SendAddonReview" class="gppost gpsubmit">Update Review</button>';
     } else {
         echo '<button type="submit" name="cmd" value="SendAddonReview" class="gppost gpsubmit">Send Review</button>';
     }
     echo ' ';
     echo '<input type="submit" name="cmd" value="Cancel" class="admin_box_close gpcancel"/>';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     return true;
 }
Beispiel #7
0
 protected function AvailableThemeOptions($id, $info, $theme_label)
 {
     global $langmessage, $config;
     ob_start();
     if ($id) {
         //more info
         echo '<li>' . self::DetailLink('theme', $id, 'More Info...') . '</li>';
         //support
         $forum_id = 1000 + $id;
         echo '<li><a href="' . addon_browse_path . '/Forum?show=f' . $forum_id . '" target="_blank">' . $langmessage['Support'] . '</a></li>';
         //rating
         $rating = 0;
         if ($info['rt'] > 0) {
             $rating = $info['rt'];
         }
         echo '<li><span class="nowrap">' . $langmessage['rate'] . ' ' . $this->ShowRating($info['rel'], $rating) . '</span></li>';
         //downloads
         if ($info['dn'] > 0) {
             echo '<li><span class="nowrap">Downloads: ' . number_format($info['dn']) . '</span></li>';
         }
     }
     //last updated
     if ($info['tm'] > 0) {
         echo '<li><span class="nowrap">' . $langmessage['Modified'] . ': ';
         echo \gp\tool::date($langmessage['strftime_datetime'], $info['tm']);
         echo '</span></li>';
     }
     if ($info['is_addon']) {
         //delete
         $folder = $info['folder'];
         $title = sprintf($langmessage['generic_delete_confirm'], $theme_label);
         $attr = array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $title);
         echo '<li>' . \gp\tool::Link('Admin_Theme_Content/Available', $langmessage['delete'], 'cmd=DeleteTheme&folder=' . rawurlencode($folder), $attr) . '</li>';
         //order
         if (isset($config['themes'][$folder]['order'])) {
             echo '<li>Order: ' . $config['themes'][$folder]['order'] . '</li>';
         }
     }
     return ob_get_clean();
 }