Ejemplo n.º 1
0
 function UpdateCMS()
 {
     global $langmessage;
     if (!$this->core_package) {
         echo $langmessage['OOPS'] . ' (Core Package Not Set)';
         return false;
     }
     if (isset($_POST['step'])) {
         $this->curr_step = (int) $_POST['step'];
     }
     //already up to date?
     if ($this->curr_step < 4 && version_compare(gpversion, $this->core_package['version'], '>=')) {
         msg($langmessage['UP_TO_DATE']);
         return false;
     }
     //filesystem
     $filesystem_method = $this->DetectFileSystem();
     if (!$filesystem_method) {
         msg('Update Aborted: Could not establish a file writing method compatible with your server.');
         return false;
     }
     $this->Steps();
     echo '<form method="post" action="?cmd=update">';
     if ($filesystem_method) {
         echo '<input type="hidden" name="filesystem_method" value="' . htmlspecialchars($filesystem_method) . '" />';
     }
     $step_content = $this->RunStep();
     $this->OutputMessages();
     echo $step_content;
     if ($this->FileSystem) {
         $this->FileSystem->destruct();
     }
     \gp\admin\Tools::VersionData($this->update_data);
     //save any changes made by the steps
     if (!$this->done) {
         if ($this->passed) {
             echo '<input type="hidden" name="step" value="' . min(count($this->steps), $this->curr_step + 1) . '"/>';
             echo '<input type="submit" class="submit" name="" value="' . htmlspecialchars($langmessage['next_step']) . '" />';
         } elseif ($this->curr_step < 3) {
             echo '<input type="hidden" name="step" value="' . min(count($this->steps), $this->curr_step) . '"/>';
             echo '<input type="submit" class="submit" name="" value="' . htmlspecialchars($langmessage['continue']) . '" />';
         } else {
             echo '<input type="hidden" name="failed_install" value="failed_install"/>';
             echo '<input type="hidden" name="step" value="4"/>';
             echo '<input type="submit" class="submit" name="" value="' . htmlspecialchars($langmessage['step:clean']) . '..." />';
         }
     }
     echo '</form>';
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Sort the list available addons
  *
  */
 private function SortAvailable()
 {
     // get addon information for ordering
     \gp\admin\Tools::VersionData($version_data);
     $version_data = $version_data['packages'];
     // combine remote addon information
     foreach ($this->avail_addons as $theme_id => $info) {
         if (isset($info['id'])) {
             $id = $info['id'];
             if (isset($version_data[$id])) {
                 $info = array_merge($info, $version_data[$id]);
                 $info['rt'] *= 5;
             }
             //use local rating
             if (isset($this->addonReviews[$id])) {
                 $info['rt'] = $this->addonReviews[$id]['rating'];
             }
         } else {
             $info['rt'] = 6;
             //give local themes a high rating to make them appear first, rating won't actually display
         }
         $info += array('dn' => 0, 'rt' => 0);
         //modified time
         if (!isset($info['tm'])) {
             $info['tm'] = self::ModifiedTime($info['full_dir']);
         }
         $this->avail_addons[$theme_id] = $info;
     }
     // sort by
     uasort($this->avail_addons, array($this, 'SortUpdated'));
     switch ($this->searchOrder) {
         case 'downloads':
             uasort($this->avail_addons, array($this, 'SortDownloads'));
             break;
         case 'modified':
             uasort($this->avail_addons, array($this, 'SortRating'));
             uasort($this->avail_addons, array($this, 'SortUpdated'));
             break;
         case 'rating_score':
         default:
             uasort($this->avail_addons, array($this, 'SortRating'));
             break;
     }
 }