Esempio n. 1
0
 function GetAvailInstall($fullPath)
 {
     $iniFile = $fullPath . '/Addon.ini';
     if (!file_exists($iniFile)) {
         return false;
     }
     $array = gp_ini::ParseFile($iniFile);
     if ($array === false) {
         return false;
     }
     if (!isset($array['Addon_Name'])) {
         return false;
     }
     $array += array('Addon_Version' => '');
     return $array;
 }
 /**
  * Return ini info if the addon is installable
  *
  */
 function GetAvailInstall($dir)
 {
     global $langmessage;
     $iniFile = $dir . '/Addon.ini';
     $template_file = $dir . '/template.php';
     $dirname = basename($dir);
     if (!is_readable($dir)) {
         $this->invalid_folders[$dirname] = 'Directory is not readable';
         return false;
     }
     if (!file_exists($template_file)) {
         $this->invalid_folders[$dirname] = 'template.php is not readable or does not exist';
         return false;
     }
     if (!file_exists($iniFile)) {
         return array();
     }
     $array = gp_ini::ParseFile($iniFile);
     if ($array === false) {
         return array();
     }
     $array += array('Addon_Version' => '');
     return $array;
 }
Esempio n. 3
0
 /**
  * Set $this->ini_contents with the settings for the addon in $ini_dir
  * @return bool
  */
 function Install_Ini($ini_dir)
 {
     global $langmessage, $dataDir, $dirPrefix;
     $ini_file = $ini_dir . '/Addon.ini';
     if (!file_exists($ini_file)) {
         message(sprintf($langmessage['File_Not_Found'], ' <em>' . $ini_file . '</em>'));
         return false;
     }
     $variables = array('{$addon}' => $this->install_folder_name, '{$dataDir}' => $dataDir, '{$dirPrefix}' => $dirPrefix, '{$addonRelativeData}' => common::GetDir('/data/_addondata/' . $this->data_folder), '{$addonRelativeCode}' => common::GetDir('/data/' . $this->addon_folder_name . '/' . $this->install_folder_name));
     //get ini contents
     $this->ini_contents = gp_ini::ParseFile($ini_file, $variables);
     if (!$this->ini_contents) {
         message($langmessage['Ini_Error'] . ' ' . $langmessage['Ini_Submit_Bug']);
         return false;
     }
     if (!isset($this->ini_contents['Addon_Name'])) {
         message($langmessage['Ini_No_Name'] . ' ' . $langmessage['Ini_Submit_Bug']);
         return false;
     }
     if (isset($this->ini_contents['Addon_Unique_ID']) && !is_numeric($this->ini_contents['Addon_Unique_ID'])) {
         message('Invalid Unique ID');
         return false;
     }
     $this->addon_name = $this->ini_contents['Addon_Name'];
     return true;
 }
Esempio n. 4
0
 /**
  * Update available package information from gpEasy.com
  *
  */
 function DoRemoteCheck2()
 {
     global $config, $dataDir;
     $path = common::IdUrl();
     //add any locally available themes with addon ids
     includeFile('tool/parse_ini.php');
     $dir = $dataDir . '/themes';
     $themes = scandir($dir);
     $theme_ids = array();
     foreach ($themes as $name) {
         if ($name == '.' || $name == '..') {
             continue;
         }
         $full_dir = $dir . '/' . $name;
         $templateFile = $full_dir . '/template.php';
         $ini_file = $full_dir . '/Addon.ini';
         if (!file_exists($templateFile)) {
             continue;
         }
         $ini_info = array();
         if (file_exists($ini_file)) {
             $ini_info = gp_ini::ParseFile($ini_file);
         }
         if (isset($ini_info['Addon_Unique_ID'])) {
             $theme_ids[] = $ini_info['Addon_Unique_ID'];
         }
     }
     $theme_ids = array_unique($theme_ids);
     if (count($theme_ids)) {
         $path .= '&th=' . implode('-', $theme_ids);
     }
     //get data from gpEasy
     $result = gpRemoteGet::Get_Successful($path);
     if (!$result) {
         $this->msg(gpRemoteGet::Debug('Sorry, data not fetched'));
         return false;
     }
     //zipped data possible as of gpEasy 4.1
     /*
     if( function_exists('gzinflate') ){
     	$temp = gzinflate($result);
     	if( $temp ){
     		$result = $temp;
     	}
     }
     */
     $result = trim($result);
     $array = json_decode($result, true);
     //json as of gpEasy 4.1
     if (!is_array($array)) {
         $debug = array();
         $debug['Type'] = gettype($array);
         $debug['json_last_error'] = json_last_error();
         $debug['Two'] = substr($result, 0, 20);
         $this->msg(gpRemoteGet::Debug('Sorry, data not fetched', $debug));
         return false;
     }
     if (!$array) {
         $debug = array();
         $debug['Count'] = count($array);
         $debug['Two'] = substr($result, 0, 20);
         $this->msg(gpRemoteGet::Debug('Sorry, data not fetched', $debug));
         return false;
     }
     $this->update_data['packages'] = array();
     $core_version = false;
     foreach ($array as $info) {
         $id =& $info['id'];
         if (!is_numeric($id)) {
             continue;
         }
         if (!isset($info['type'])) {
             continue;
         }
         if ($info['type'] == 'core') {
             $id = 'core';
             $core_version = $info['version'];
         }
         $this->update_data['packages'][$id] = $info;
     }
     if (isset($this->update_data['packages']['core'])) {
         $this->core_package = $this->update_data['packages']['core'];
     }
     return true;
 }
Esempio n. 5
0
 /**
  * Return ini info if the addon is installable
  *
  */
 function GetAvailInstall($dir)
 {
     global $langmessage;
     $iniFile = $dir . '/Addon.ini';
     $dirname = basename($dir);
     if (!file_exists($iniFile)) {
         if (is_readable($dir)) {
             $this->invalid_folders[$dirname] = 'Addon.ini is not readable or does not exist';
         } else {
             $this->invalid_folders[$dirname] = 'Directory is not readable';
         }
         return false;
     }
     $array = gp_ini::ParseFile($iniFile);
     if ($array === false) {
         $this->invalid_folders[$dirname] = $langmessage['Ini_Error'];
         return false;
     }
     if (!isset($array['Addon_Name'])) {
         $this->invalid_folders[$dirname] = $langmessage['Ini_No_Name'];
         return false;
     }
     $array += array('Addon_Version' => '');
     return $array;
 }