/**
  * Run through the installation process
  *
  */
 function InstallSteps()
 {
     global $dataDir;
     $this->GetAddonData();
     // addonHistory
     $this->Init_PT();
     // $this->config
     //get from remote
     if ($this->remote_install && !$this->GetRemote()) {
         return false;
     }
     //check ini contents
     $this->display_name = basename($this->source);
     if (!$this->GetINI($this->source, $error)) {
         //local themes don't need addon.ini files
         if (empty($this->new_layout)) {
             $this->message($error);
             return false;
         }
     }
     // upgrade/destination
     $this->upgrade_key = $this->config_key = admin_addons_tool::UpgradePath($this->ini_contents, $this->config_index);
     if ($this->remote_install) {
         if ($this->config_key) {
             $this->dest = $this->addon_folder . '/' . $this->config_key;
         } else {
             $this->dest = $this->TempFile();
         }
     } else {
         $this->dest = $this->source;
     }
     $this->dest_name = basename($this->dest);
     if (!$this->config_key) {
         $this->config_key = $this->dest_name;
     }
     //the data folder will not always be the same as the addon folder
     if (isset($this->config[$this->config_key]['data_folder'])) {
         $this->data_folder = $this->config[$this->config_key]['data_folder'];
     } elseif ($this->upgrade_key && file_exists($dataDir . '/data/_addondata/' . $this->upgrade_key)) {
         $this->data_folder = $this->upgrade_key;
     } else {
         $this->data_folder = $this->dest_name;
     }
     $this->IniContents();
     if (!$this->PrepConfig()) {
         return false;
     }
     if (!$this->CheckFile()) {
         return false;
     }
     //hooks
     if (!$this->Hooks()) {
         return false;
     }
     //layout
     if (!$this->Layout()) {
         return false;
     }
     //move new addon folder into place
     if (!$this->FinalizeFolder()) {
         return false;
     }
     if (!$this->FinalizeConfig()) {
         return false;
     }
     // Save
     if (!admin_tools::SaveAllConfig()) {
         $this->message($langmessage['OOPS'] . ' (Configuration not saved)');
         return false;
     }
     if ($this->order) {
         $img_path = common::IdUrl('ci');
         common::IdReq($img_path);
     }
     $this->UpdateHistory();
     return true;
 }
示例#2
0
 /**
  * Get a list of available addons
  *
  */
 function GetAvailAddons()
 {
     global $dataDir;
     $addonPath = $dataDir . '/addons';
     if (!file_exists($addonPath)) {
         message('Warning: The /addons folder "<em>' . $addonPath . '</em>" does not exist on your server.');
         return array();
     }
     $installed_path = $dataDir . '/data/_addoncode';
     $folders = gpFiles::ReadDir($addonPath, 1);
     $versions = array();
     $avail = array();
     foreach ($folders as $value) {
         $fullPath = $addonPath . '/' . $value;
         $info = $this->GetAvailInstall($fullPath);
         if (!$info) {
             continue;
         }
         $info['upgrade_key'] = admin_addons_tool::UpgradePath($info);
         $avail[$value] = $info;
         if (isset($info['Addon_Version']) && isset($info['Addon_Unique_ID'])) {
             $id = $info['Addon_Unique_ID'];
             $version = $info['Addon_Version'];
             if (!isset($versions[$id])) {
                 $versions[$id] = $version;
                 continue;
             }
             if (version_compare($versions[$id], $version, '<')) {
                 $versions[$id] = $version;
             }
         }
     }
     if (!gp_unique_addons) {
         return $avail;
     }
     //show only the most recent versions
     $temp = array();
     foreach ($avail as $key => $info) {
         if (!isset($info['Addon_Version']) || !isset($info['Addon_Unique_ID'])) {
             $temp[$key] = $info;
             continue;
         }
         $id = $info['Addon_Unique_ID'];
         $version = $info['Addon_Version'];
         if (version_compare($versions[$id], $version, '>')) {
             continue;
         }
         $temp[$key] = $info;
     }
     return $temp;
 }
示例#3
0
 /**
  * Get a list of available addons
  *
  */
 function GetAvailAddons()
 {
     global $dataDir;
     $addonPath = $dataDir . '/addons';
     if (!file_exists($addonPath)) {
         message('Warning: The /addons folder "<em>' . $addonPath . '</em>" does not exist on your server.');
         return array();
     }
     $installed_path = $dataDir . '/data/_addoncode';
     $folders = gpFiles::ReadDir($addonPath, 1);
     $versions = array();
     $avail = array();
     foreach ($folders as $value) {
         $fullPath = $addonPath . '/' . $value;
         $info = $this->GetAvailInstall($fullPath);
         if (!$info) {
             continue;
         }
         $info['upgrade_key'] = admin_addons_tool::UpgradePath($info);
         $avail[$value] = $info;
         if (isset($info['Addon_Version']) && isset($info['Addon_Unique_ID'])) {
             $id = $info['Addon_Unique_ID'];
             if (!isset($versions[$id])) {
                 $versions[$id] = $info['Addon_Version'];
             } elseif (version_compare($versions[$id], $info['Addon_Version'], '<')) {
                 $versions[$id] = $info['Addon_Version'];
                 continue;
             }
         }
         if (!$info['upgrade_key']) {
             $this->avail_count++;
         }
     }
     if (gp_unique_addons) {
         $avail = self::FilterUnique($avail, $versions);
     }
     return $avail;
 }