コード例 #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;
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #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;
 }
コード例 #4
0
ファイル: admin_port.php プロジェクト: GedionChang/gpEasy-CMS
 function ExtractIni($tar_object)
 {
     //get Export.ini
     $ini_contents = $tar_object->extractInString('gpexport/Export.ini');
     if (empty($ini_contents)) {
         return false;
     }
     return gp_ini::ParseString($ini_contents);
 }
コード例 #5
0
ファイル: admin_port.php プロジェクト: jozefkrz/gpEasy-CMS
 /**
  * Get the export.ini contents
  *
  */
 public function ExtractIni($archive)
 {
     //$full_path			= $this->export_dir.'/'.$archive;
     //$ini_path			= 'phar://'.$full_path.'/gpexport/Export.ini';
     //$ini_contents		= file_get_contents($ini_path);
     $ini_contents = $this->import_object->getFromName('/gpexport/Export.ini');
     if (empty($ini_contents)) {
         return false;
     }
     return gp_ini::ParseString($ini_contents);
 }
コード例 #6
0
ファイル: update.php プロジェクト: barbrick/gpEasy-CMS
 /**
  * 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;
 }
コード例 #7
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;
 }
コード例 #8
0
ファイル: parse_ini.php プロジェクト: VTAMAGNO/gpEasy-CMS
 static function GetAssignment($line, &$key, &$value)
 {
     $key = $value = false;
     //get the key
     $len = strspn($line, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_\\- *:');
     if ($len < 1) {
         return true;
     }
     $key = substr($line, 0, $len);
     $key = trim($key);
     $line = substr($line, $len);
     //check for the =
     $line = trim($line);
     if (strlen($line) < 1) {
         return true;
     }
     if ($line[0] != '=') {
         return true;
     }
     $line = substr($line, 1);
     $line = trim($line);
     if (strlen($line) < 1) {
         return true;
     }
     //get the value
     if ($line[0] == '"') {
         $value = gp_ini::GetQuotedText($line, '"');
     } elseif ($line[0] == "'") {
         $value = gp_ini::GetQuotedText($line, "'");
     } else {
         $pos = strpos($line, ';');
         if ($pos > 0) {
             $value = substr($line, 0, $pos);
             $value = trim($value);
         } else {
             $value = $line;
         }
         if (!empty($value)) {
             $value = gp_ini::Value($value);
         }
     }
     return true;
 }
コード例 #9
0
 /**
  * Parse the ini a second time with variables
  *
  */
 function IniContents()
 {
     global $dataDir, $dirPrefix;
     $folder = basename($this->dest);
     $variables = array('{$addon}' => $folder, '{$plugin}' => $folder, '{$dataDir}' => $dataDir, '{$dirPrefix}' => $dirPrefix, '{$addonRelativeData}' => common::GetDir('/data/_addondata/' . $this->data_folder), '{$addonRelativeCode}' => common::GetDir($this->addon_folder_rel . '/' . $folder));
     $this->ini_contents = gp_ini::ParseString($this->ini_text, $variables);
 }