if ( key == keys[i])
                	{
                    	var liclass = "active";
                    	var linkclass = "current";
                    	document.getElementById(keys[i]+"_div").style.display = "block";
                	}else{
                    	document.getElementById(keys[i]+"_div").style.display = "none";
                	}
                	document.getElementById(keys[i]+"_li").className = liclass;
                	document.getElementById(keys[i]+"_link").className = linkclass;
            	}
                tabPreviousKey = key;
            }
      </script>';
$fileHash = fileToHash($install_file);
?>
    <?php 
print $hidden_fields;
?>
    <input type="hidden" name="copy_count" value="<?php 
print $count;
?>
"/>
    <input type="hidden" name="run" value="commit" />
    <input type="hidden" name="install_file"  value="<?php 
echo $fileHash;
?>
" />
    <input type="hidden" name="unzip_dir"     value="<?php 
echo basename($unzip_dir);
 function getinstalledPackages($types = array('module', 'langpack'))
 {
     global $sugar_config;
     $installeds = $this->getInstalled($types);
     $packages = array();
     $upgrades_installed = 0;
     $uh = new UpgradeHistory();
     $base_upgrade_dir = sugar_cached("/upgrades");
     $base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
     foreach ($installeds as $installed) {
         $populate = false;
         $filename = from_html($installed->filename);
         $date_entered = $installed->date_entered;
         $type = $installed->type;
         $version = $installed->version;
         $uninstallable = false;
         $link = "";
         $description = $installed->description;
         $name = $installed->name;
         $enabled = true;
         $enabled_string = 'ENABLED';
         //if the name is empty then we should try to pull from manifest and populate upgrade_history_table
         if (empty($name)) {
             $populate = true;
         }
         $upgrades_installed++;
         switch ($type) {
             case "theme":
             case "langpack":
             case "module":
             case "patch":
                 if ($populate) {
                     $manifest_file = $this->extractManifest($filename, $base_tmp_upgrade_dir);
                     require_once $manifest_file;
                     $GLOBALS['log']->info("Filling in upgrade_history table");
                     $populate = false;
                     if (isset($manifest['name'])) {
                         $name = $manifest['name'];
                         $installed->name = $name;
                     }
                     if (isset($manifest['description'])) {
                         $description = $manifest['description'];
                         $installed->description = $description;
                     }
                     if (isset($installdefs) && isset($installdefs['id'])) {
                         $id_name = $installdefs['id'];
                         $installed->id_name = $id_name;
                     }
                     $serial_manifest = array();
                     $serial_manifest['manifest'] = isset($manifest) ? $manifest : '';
                     $serial_manifest['installdefs'] = isset($installdefs) ? $installdefs : '';
                     $serial_manifest['upgrade_manifest'] = isset($upgrade_manifest) ? $upgrade_manifest : '';
                     $installed->manifest = base64_encode(serialize($serial_manifest));
                     $installed->save();
                 } else {
                     $serial_manifest = unserialize(base64_decode($installed->manifest));
                     $manifest = $serial_manifest['manifest'];
                 }
                 if (($upgrades_installed == 0 || $uh->UninstallAvailable($installeds, $installed)) && is_file($filename) && !empty($manifest['is_uninstallable'])) {
                     $uninstallable = true;
                 }
                 $enabled = $installed->enabled;
                 if (!$enabled) {
                     $enabled_string = 'DISABLED';
                 }
                 $file_uninstall = $filename;
                 if (!$uninstallable) {
                     $file_uninstall = 'UNINSTALLABLE';
                     $enabled_string = 'UNINSTALLABLE';
                 } else {
                     $file_uninstall = fileToHash($file_uninstall);
                 }
                 $packages[] = array('name' => $name, 'version' => $version, 'type' => $type, 'published_date' => $date_entered, 'description' => $description, 'uninstallable' => $uninstallable, 'file_install' => $file_uninstall, 'file' => fileToHash($filename), 'enabled' => $enabled_string);
                 break;
             default:
                 break;
         }
     }
     //rof
     return $packages;
 }
Esempio n. 3
0
 public function testhashToFile()
 {
     //execute the method and test if it returns expected values
     //test with invalid hash.
     $actual = hashToFile('');
     $this->assertFalse($actual);
     //test with a newly generated hash
     $hash = fileToHash('config.php');
     $actual = hashToFile($hash);
     $this->assertSame('config.php', $actual);
 }