|
iTx Technologies offre gratuitement
|
||
[Vue sommaire] [Imprimer] [Vue textuelle]
1 <?php 2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 3 /********************************************************************************* 4 * SugarCRM is a customer relationship management program developed by 5 * SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc. 6 * 7 * This program is free software; you can redistribute it and/or modify it under 8 * the terms of the GNU General Public License version 3 as published by the 9 * Free Software Foundation with the addition of the following permission added 10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK 11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY 12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. 13 * 14 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License along with 20 * this program; if not, see http://www.gnu.org/licenses or write to the Free 21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 * 02110-1301 USA. 23 * 24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, 25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. 26 * 27 * The interactive user interfaces in modified source and object code versions 28 * of this program must display Appropriate Legal Notices, as required under 29 * Section 5 of the GNU General Public License version 3. 30 * 31 * In accordance with Section 7(b) of the GNU General Public License version 3, 32 * these Appropriate Legal Notices must retain the display of the "Powered by 33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for 34 * technical reasons, the Appropriate Legal Notices must display the words 35 * "Powered by SugarCRM". 36 ********************************************************************************/ 37 global $sugar_version, $js_custom_version; 38 $lang_curr = $_SESSION['language']; 39 require_once ('ModuleInstall/PackageManager/PackageManagerDisplay.php'); 40 if( !isset( $install_script ) || !$install_script ){ 41 die($mod_strings['ERR_NO_DIRECT_SCRIPT']); 42 } 43 /////////////////////////////////////////////////////////////////////////////// 44 //// PREFILL $sugar_config VARS 45 if(empty($sugar_config['upload_dir'])) { 46 $sugar_config['upload_dir'] = 'cache/upload/'; 47 } 48 if(empty($sugar_config['upload_maxsize'])) { 49 $sugar_config['upload_maxsize'] = 8192000; 50 } 51 if(empty($sugar_config['upload_badext'])) { 52 $sugar_config['upload_badext'] = array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm'); 53 } 54 //// END PREFILL $sugar_config VARS 55 /////////////////////////////////////////////////////////////////////////////// 56 require_once ('include/utils/zip_utils.php'); 57 58 require_once ('include/upload_file.php'); 59 60 61 62 $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM'); 63 64 /////////////////////////////////////////////////////////////////////////////// 65 //// PREP VARS FOR LANG PACK 66 $base_upgrade_dir = $sugar_config['upload_dir'] . "upgrades"; 67 $base_tmp_upgrade_dir = $base_upgrade_dir."/temp"; 68 /////////////////////////////////////////////////////////////////////////////// 69 70 /////////////////////////////////////////////////////////////////////////////// 71 //// HANDLE FILE UPLOAD AND PROCESSING 72 $errors = array(); 73 $uploadResult = ''; 74 //commitModules(); 75 if(isset($_REQUEST['languagePackAction']) && !empty($_REQUEST['languagePackAction'])) { 76 switch($_REQUEST['languagePackAction']) { 77 case 'upload': 78 $perform = false; 79 $tempFile = ''; 80 if(isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != ""){ 81 require_once ('ModuleInstall/PackageManager/PackageManager.php'); 82 $pm = new PackageManager(); 83 $tempFile = $pm->download($_REQUEST['release_id'], getcwd().'/'.$sugar_config['upload_dir']); 84 $perform = true; 85 //$base_filename = urldecode($tempFile); 86 }else{ 87 $file = new UploadFile('language_pack'); 88 if($file->confirm_upload()){ 89 $perform = true; 90 if(strpos($file->mime_type, 'zip') !== false) { // only .zip files 91 if(langPackFinalMove($file)) { 92 $perform = true; 93 } 94 else { 95 $errors[] = $mod_strings['ERR_LANG_UPLOAD_3']; 96 } 97 } else { 98 $errors[] = $mod_strings['ERR_LANG_UPLOAD_2']; 99 } 100 } 101 } 102 103 104 if($perform) { // check for a real file 105 $uploadResult = $mod_strings['LBL_LANG_SUCCESS']; 106 $result = langPackUnpack('langpack', $tempFile); 107 } else { 108 $errors[] = $mod_strings['ERR_LANG_UPLOAD_1']; 109 } 110 111 if(count($errors) > 0) { 112 foreach($errors as $error) { 113 $uploadResult .= $error."<br />"; 114 } 115 } 116 break; // end 'validate' 117 case 'commit': 118 $sugar_config = commitModules(false, 'langpack'); 119 break; 120 case 'uninstall': // leaves zip file in "uploaded" state 121 $sugar_config = uninstallLanguagePack(); 122 break; 123 case 'remove': 124 removeLanguagePack(); 125 break; 126 default: 127 break; 128 } 129 } 130 //// END HANDLE FILE UPLOAD AND PROCESSING 131 /////////////////////////////////////////////////////////////////////////////// 132 133 134 /////////////////////////////////////////////////////////////////////////////// 135 //// PRELOAD DISPLAY DATA 136 $upload_max_filesize = ini_get('upload_max_filesize'); 137 $upload_max_filesize_bytes = return_bytes($upload_max_filesize); 138 $fileMaxSize =''; 139 if(!defined('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')){ 140 define('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES', 6 * 1024 * 1024); 141 } 142 143 if($upload_max_filesize_bytes < constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')) { 144 $GLOBALS['log']->debug("detected upload_max_filesize: $upload_max_filesize"); 145 $fileMaxSize = '<p class="error">'.$mod_strings['ERR_UPLOAD_MAX_FILESIZE']."</p>\n"; 146 } 147 $availablePatches = getLangPacks(true); 148 $installedLanguagePacks = getInstalledLangPacks(); 149 $errs = ''; 150 if(isset($validation_errors)) { 151 if(count($validation_errors) > 0) { 152 $errs = '<div id="errorMsgs">'; 153 $errs .= "<p>{$mod_strings['LBL_SYSOPTS_ERRS_TITLE']}</p>"; 154 $errs .= '<ul>'; 155 156 foreach($validation_errors as $error) { 157 $errs .= '<li>' . $error . '</li>'; 158 } 159 160 $errs .= '</ul>'; 161 $errs .= '</div>'; 162 } 163 } 164 165 166 167 //// PRELOAD DISPLAY DATA 168 /////////////////////////////////////////////////////////////////////////////// 169 170 171 /////////////////////////////////////////////////////////////////////////////// 172 //// BEING PAGE OUTPUT 173 $disabled = ""; 174 $result = ""; 175 $out =<<<EOQ 176 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 177 <html> 178 <head> 179 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 180 <meta http-equiv="Content-Script-Type" content="text/javascript"> 181 <meta http-equiv="Content-Style-Type" content="text/css"> 182 <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_MODULE_TITLE']}</title> 183 <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico"> 184 <link rel="stylesheet" href="install/install.css" type="text/css"> 185 <script type="text/javascript" src="install/installCommon.js"></script> 186 <link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css?s={$sugar_version}&c={$js_custom_version}"> 187 <script>jscal_today = 1161698116000; if(typeof app_strings == "undefined") app_strings = new Array();</script> 188 <script type="text/javascript" src="include/javascript/sugar_grp1.js?s={$sugar_version}&c={$js_custom_version}"></script> 189 <script type="text/javascript" src="include/javascript/sugar_grp1_yui.js?s={$sugar_version}&c={$js_custom_version}"></script> 190 191 </head> 192 193 <body onLoad="document.getElementById('defaultFocus').focus();"> 194 {$fileMaxSize} 195 <table cellspacing="0" width="100%" cellpadding="0" border="0" align="center" class="shell"> 196 <tr><td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr> 197 <tr> 198 <th width="500"> 199 <p><img src="include/images/sugar_md.png" alt="SugarCRM" border="0"></p>{$mod_strings['LBL_MODULE_TITLE']}</th> 200 <th width="200" style="text-align: right;"><a href="http://www.sugarcrm.com" target= 201 "_blank"><IMG src="include/images/sugarcrm_login.png" width="145" height="30" alt="SugarCRM" border="0"></a> 202 </th> 203 </tr> 204 205 <tr> 206 <td colspan="2"> 207 <p>{$mod_strings['LBL_LANG_1']}</p> 208 <table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="StyleDottedHr"> 209 <tr> 210 <th colspan="2" align="left">{$mod_strings['LBL_LANG_TITLE']}</th> 211 </tr> 212 <tr> 213 <td colspan="2"> 214 EOQ; 215 $form =<<<EOQ1 216 <form name="the_form" enctype="multipart/form-data" 217 action="install.php" method="post"> 218 <input type="hidden" name="current_step" value="{$next_step}"> 219 <input type="hidden" name="language" value="{$lang_curr}"> 220 <input type="hidden" name="goto" value="{$mod_strings['LBL_CHECKSYS_RECHECK']}"> 221 <input type="hidden" name="languagePackAction" value="upload"> 222 <input type="hidden" name="install_type" value="custom"> 223 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view"> 224 <tr> 225 <td> 226 <table width="450" border="0" cellspacing="0" cellpadding="0"> 227 <tr> 228 <td colspan='2'> 229 {$mod_strings['LBL_LANG_UPLOAD']}:<br /> 230 </td> 231 </tr> 232 <tr> 233 <td> 234 235 <input type="file" name="language_pack" onchange="uploadCheck();" size="40" /> 236 </td> 237 <td valign="bottom"> 238 <input class='button' id="upload_button" type=button value="{$mod_strings['LBL_LANG_BUTTON_UPLOAD']}" 239 disabled="disabled" 240 onClick="document.the_form.language_pack_escaped.value = escape( document.the_form.language_pack.value ); 241 document.the_form.submit();" 242 /> 243 <input type=hidden name="language_pack_escaped" value="" /> 244 </td> 245 </tr> 246 </table> 247 </td> 248 </tr> 249 <tr> 250 <td> 251 {$uploadResult} 252 </td> 253 </tr> 254 </table> 255 </form> 256 <script type="text/javascript" language="Javascript" src="include/JSON.js"></script> 257 <script> 258 function uploadCheck(){ 259 var len = escape(document.the_form.language_pack.value).length; 260 if(escape(document.the_form.language_pack.value).substr(len-3,len) !='zip'){ 261 //document.the_form.upgrade_zip.value = ''; 262 //document.getElementById("upgrade_zip").value = ''; 263 alert('Not a zip file'); 264 document.the_form.language_pack.value = ''; 265 //document.getElementById("language_pack").value=''; 266 document.getElementById("upload_button").disabled='disabled'; 267 } 268 else{ 269 //AJAX call for checking the file size and comparing with php.ini settings. 270 var callback = { 271 success:function(r) { 272 document.the_form.upload_button.disabled=''; 273 } 274 } 275 //var file_name = document.getElementById('upgrade_zip').value; 276 var file_name = document.the_form.language_pack.value; 277 postData = 'file_name=' + file_name + 'install&action=UploadLangFileCheck&to_pdf=1'; 278 YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData); 279 } 280 } 281 </script> 282 EOQ1; 283 $out1 =<<<EOQ2 284 </td> 285 </tr> 286 <tr> 287 <td colspan=2> 288 {$result} 289 </td> 290 </tr> 291 <!--// Available Upgrades //--> 292 <tr> 293 <td align="left" colspan="2"> 294 <hr> 295 <table cellspacing="0" cellpadding="0" border="0" class="stdTable"> 296 {$availablePatches} 297 </table> 298 </td> 299 </tr> 300 301 <td align="left" colspan="2"> 302 <hr> 303 <table cellspacing="0" cellpadding="0" border="0" class="stdTable"> 304 {$installedLanguagePacks} 305 </table> 306 </td> 307 </tr> 308 <tr> 309 <td align="right" colspan="2"> 310 <hr> 311 <form name="the_form1" action="install.php" method="post" id="form"> 312 <input type="hidden" name="current_step" value="{$next_step}"> 313 <input type="hidden" name="language" value="{$lang_curr}"> 314 <input type="hidden" name="install_type" value="custom"> 315 <table cellspacing="0" cellpadding="0" border="0" class="stdTable"> 316 <tr> 317 318 <td> 319 <input type="hidden" name="default_user_name" value="admin"> 320 </td> 321 <td> 322 <input class="button" type="submit" name="goto" value="{$mod_strings['LBL_NEXT']}" id="defaultFocus" {$disabled} /> 323 </td> 324 </tr> 325 </table> 326 </form> 327 </td> 328 </tr> 329 </table> 330 </td> 331 </tr> 332 </table> 333 334 </body> 335 </html> 336 EOQ2; 337 $hidden_fields = "<input type=\"hidden\" name=\"current_step\" value=\"{$next_step}\">"; 338 $hidden_fields .= "<input type=\"hidden\" name=\"goto\" value=\"{$mod_strings['LBL_CHECKSYS_RECHECK']}\">"; 339 $hidden_fields .= "<input type=\"hidden\" name=\"languagePackAction\" value=\"commit\">"; 340 //$form2 = PackageManagerDisplay::buildPackageDisplay($form, $hidden_fields, 'install.php', array('langpack'), 'form1', true); 341 $form2 = PackageManagerDisplay::buildPatchDisplay($form, $hidden_fields, 'install.php', array('langpack')); 342 343 echo $out.$form2.$out1; 344 345 //unlinkTempFiles('',''); 346 //// END PAGEOUTPUT 347 /////////////////////////////////////////////////////////////////////////////// 348 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
|
|
|
|