Example #1
0
             $base_filename = pathinfo($tempFile, PATHINFO_BASENAME);
             mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
             $target_path = "{$base_upgrade_dir}/{$upgrade_zip_type}/{$base_filename}";
             $target_manifest = remove_file_extension($target_path) . "-manifest.php";
             if (isset($manifest['icon']) && $manifest['icon'] != "") {
                 $icon_location = UpgradeWizardCommon::extractFile($tempFile, $manifest['icon']);
                 copy($icon_location, remove_file_extension($target_path) . "-icon." . pathinfo($icon_location, PATHINFO_EXTENSION));
             }
             if (rename($tempFile, $target_path)) {
                 copy($manifest_file, $target_manifest);
                 $GLOBALS['ML_STATUS_MESSAGE'] = $base_filename . $mod_strings['LBL_UW_UPLOAD_SUCCESS'];
             } else {
                 $GLOBALS['ML_STATUS_MESSAGE'] = $mod_strings['ERR_UW_UPLOAD_ERROR'];
             }
         } else {
             UpgradeWizardCommon::unlinkTempFiles();
             die($mod_strings['ERR_UW_NO_MANIFEST']);
         }
     }
 } else {
     if ($run == $mod_strings['LBL_UW_BTN_DELETE_PACKAGE']) {
         if (!empty($_REQUEST['install_file'])) {
             die($mod_strings['ERR_UW_NO_UPLOAD_FILE']);
         }
         $delete_me = hashToFile($delete_me);
         $checkFile = strtolower($delete_me);
         if (substr($delete_me, -4) != ".zip" || substr($delete_me, 0, 9) != "upload://" || strpos($checkFile, "..") !== false || !file_exists($checkFile)) {
             die("<span class='error'>" . $mod_strings['ERR_UW_NOT_ZIPPED'] . "</span>");
         }
         if (unlink($delete_me)) {
             // successful deletion?
                    $checked = "checked=\"true\"";
                } else {
                    $highlight_start = "<font color=red>";
                    $highlight_end = "</font>";
                }
                print "<li><input name=\"copy_{$count}\" type=\"checkbox\" value=\"" . $the_file . "\" {$checked} {$disabled} > " . $highlight_start . $new_file . $highlight_end . "<br>\n";
            }
        }
        $count++;
    }
    print "</ul>\n";
}
//    echo '</div>';
if ($mode == "Disable" || $mode == "Enable") {
    //check to see if any files have been modified
    $modified_files = UpgradeWizardCommon::getDiffFiles($unzip_dir, $install_file, $mode == 'Enable', $previous_version);
    if (count($modified_files) > 0) {
        //we need to tell the user that some files have been modified since they last did an install
        echo '<script>' . 'function handleFileChange(){';
        if (count($modified_files) > 0) {
            echo 'if(document.getElementById("radio_overwrite_files") != null && document.getElementById("radio_do_not_overwrite_files") != null){
                			var overwrite = false;
                			if(document.getElementById("radio_overwrite_files").checked){
                   			 overwrite = true
                			}
            			}
        				return true;';
        } else {
            echo 'return true;';
        }
        echo '}</script>';
// present list to user
if ($shouldClearCache) {
    MetaDataManager::clearAPICache();
}
// present list to user
?>
<form action="<?php 
print $form_action;
?>
" method="post">
<input type="hidden" name="reloadMetadata" value="true" />

<?php 
echo smarty_function_sugar_csrf_form_token(array(), $smarty);
echo "<div>";
print UpgradeWizardCommon::getUITextForType($install_type) . " " . UpgradeWizardCommon::getUITextForMode($mode) . " " . $mod_strings['LBL_UW_SUCCESSFULLY'];
echo "<br>";
echo "<br>";
print "<input type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_MOD_LOADER']}\" /><br>";
echo "</div>";
echo "<br>";
if (isset($lang_changed_string)) {
    print $lang_changed_string;
}
if ($install_type != "module" && $install_type != "langpack") {
    if (sizeof($files_to_handle) > 0) {
        echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text">' . SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']) . ' Show Details</div><div id=\'more\' style=\'display: none\'>
            <div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'>' . SugarThemeRegistry::current()->getImage('basic_search', '', null, null, ".gif", $mod_strings['LBL_BASIC_SEARCH']) . ' Hide Details</div><br>';
        print "{$mod_strings['LBL_UW_FOLLOWING_FILES']} {$file_action}:<br>\n";
        print "<ul id=\"subMenu\">\n";
        foreach ($files_to_handle as $file_to_copy) {