debug("detected upload_max_filesize: $upload_max_filesize"); print('

' . $mod_strings['MSG_INCREASE_UPLOAD_MAX_FILESIZE'] . ' ' . get_cfg_var('cfg_file_path') . "

\n"); } // // process "run" commands // if( isset( $_REQUEST['run'] ) && ($_REQUEST['run'] != "") ){ $run = $_REQUEST['run']; if( $run == "upload" ){ $perform = false; if(isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != ""){ require_once('ModuleInstall/PackageManager.php'); $pm = new PackageManager(); $tempFile = $pm->download('','',$_REQUEST['release_id'], getAbsolutePath($sugar_config['upload_dir'],true)); $perform = true; $base_filename = urldecode($tempFile); } elseif(!empty($_REQUEST['load_module_from_dir'])){ //copy file to proper location then call performSetup $tempFile = getAbsolutePath($sugar_config['upload_dir'].$_REQUEST['upgrade_zip_escaped'],true); copy($_REQUEST['load_module_from_dir'].'/'.$_REQUEST['upgrade_zip_escaped'], $tempFile); $perform = true; $base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] ); }else if( empty( $_FILES['upgrade_zip']['tmp_name'] ) ){ echo $mod_strings['ERR_UW_NO_UPLOAD_FILE']; } else{ if(!move_uploaded_file($_FILES['upgrade_zip']['tmp_name'], getAbsolutePath($sugar_config['upload_dir'].$_FILES['upgrade_zip']['name'],true))) { unlinkTempFiles(); die($mod_strings['ERR_NOT_VALID_UPLOAD']); } else { $tempFile = getAbsolutePath($sugar_config['upload_dir'].$_FILES['upgrade_zip']['name'],true); $perform = true; $base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] ); } } if($perform){ $manifest_file = extractManifest( $tempFile ); if(is_file($manifest_file)) { //SCAN THE MANIFEST FILE TO MAKE SURE NO COPIES OR ANYTHING ARE HAPPENING IN IT $ms = new ModuleScanner(); $fileIssues = $ms->scanFile($manifest_file); if(!empty($fileIssues)){ echo '

' . $mod_strings['ML_MANIFEST_ISSUE'] . '


'; $ms->displayIssues(); die(); } require_once( $manifest_file ); validate_manifest( $manifest ); $upgrade_zip_type = $manifest['type']; // exclude the bad permutations if( $view == "module" ) { if ($upgrade_zip_type != "module" && $upgrade_zip_type != "theme" && $upgrade_zip_type != "langpack") { unlinkTempFiles(); die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']); } } elseif( $view == "default" ) { if($upgrade_zip_type != "patch" ) { unlinkTempFiles(); die($mod_strings['ERR_UW_ONLY_PATCHES']); } } //$base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] ); $base_filename = preg_replace( "#\\\\#", "/", $base_filename ); $base_filename = basename( $base_filename ); 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 = extractFile( $tempFile ,$manifest['icon'] ); $path_parts = pathinfo( $icon_location ); copy( $icon_location, remove_file_extension( $target_path ) . "-icon." . $path_parts['extension'] ); } if( copy( $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 { 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 = clean_path(trim(strtolower($delete_me))); if(false !== strpos($checkFile, '.zip')) { // is zip file? if(false !== strpos($checkFile, $sugar_config['upload_dir'])) { // is in upload dir? if(false === strpos($checkFile, "..")) { // no dir navigation if(!file_exists($checkFile)) { // file exists? if(unlink($delete_me)) { // successful deletion? echo "Package $delete_me has been removed.
"; } else { die("Problem removing package $delete_me."); } } else { die("File to be deleted does not exist."); } } else { die("Path is trying to navigate folders."); } } else { die("File is not located in SugarCRM's upload cache directory."); } } else { die("File is not a zipped archive."); } } } if( $view == "module") { print( get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_LOADER_TITLE'], true) ); } else { print( get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'].": ".$mod_strings['LBL_UPGRADE_WIZARD_TITLE'], true) ); } // upload link if(!empty($GLOBALS['sugar_config']['use_common_ml_dir']) && $GLOBALS['sugar_config']['use_common_ml_dir'] && !empty($GLOBALS['sugar_config']['common_ml_dir'])){ //rrs $form = '
'; $form .= '
'.$mod_strings['LBL_MODULE_UPLOAD_DISABLE_HELP_TEXT'].'
'; $form .=''; if ($handle = opendir($GLOBALS['sugar_config']['common_ml_dir'])) { while (false !== ($filename = readdir($handle))) { if($filename == '.' || $filename == '..' || !preg_match("#.*\.zip\$#", $filename)) { continue; } $form .= ''; } } $form .= '
'.$mod_strings['LBL_ML_NAME'].''.$mod_strings['LBL_ML_ACTION'].'
'.$filename.'
'; //rrs }else{ $form =<<
{$uploaddLabel}
eoq; } $hidden_fields = ""; $hidden_fields .= ""; $form2 = PackageManagerDisplay::buildPackageDisplay($form, $hidden_fields, $form_action, array('module')); $form3 =<<\n"); print( "\n" ); ?> */ $GLOBALS['log']->info( "Upgrade Wizard view"); ?>