2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero 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.
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 Affero General Public License for more
19 * You should have received a copy of the GNU Affero 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
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.
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 Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero 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 ********************************************************************************/
38 global $sugar_version, $js_custom_version;
39 $lang_curr = $_SESSION['language'];
40 require_once('ModuleInstall/PackageManager/PackageManagerDisplay.php');
42 if(!isset( $install_script ) || !$install_script || empty($_SESSION['setup_db_admin_user_name'])){
43 die($mod_strings['ERR_NO_DIRECT_SCRIPT']);
45 ///////////////////////////////////////////////////////////////////////////////
46 //// PREFILL $sugar_config VARS
47 if(empty($sugar_config['upload_dir'])) {
48 $sugar_config['upload_dir'] = 'cache/upload/';
50 if(empty($sugar_config['upload_maxsize'])) {
51 $sugar_config['upload_maxsize'] = 8192000;
53 if(empty($sugar_config['upload_badext'])) {
54 $sugar_config['upload_badext'] = array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm');
56 //// END PREFILL $sugar_config VARS
57 ///////////////////////////////////////////////////////////////////////////////
58 require_once('include/utils/zip_utils.php');
60 require_once('include/upload_file.php');
64 $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
66 ///////////////////////////////////////////////////////////////////////////////
67 //// PREP VARS FOR LANG PACK
68 $base_upgrade_dir = $sugar_config['upload_dir'] . "upgrades";
69 $base_tmp_upgrade_dir = $base_upgrade_dir."/temp";
70 ///////////////////////////////////////////////////////////////////////////////
72 ///////////////////////////////////////////////////////////////////////////////
73 //// HANDLE FILE UPLOAD AND PROCESSING
77 if(isset($_REQUEST['languagePackAction']) && !empty($_REQUEST['languagePackAction'])) {
78 switch($_REQUEST['languagePackAction']) {
82 if(isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != ""){
83 require_once('ModuleInstall/PackageManager/PackageManager.php');
84 $pm = new PackageManager();
85 $tempFile = $pm->download($_REQUEST['release_id'], getcwd().'/'.$sugar_config['upload_dir']);
87 //$base_filename = urldecode($tempFile);
89 $file = new UploadFile('language_pack');
90 if($file->confirm_upload()){
92 if(strpos($file->mime_type, 'zip') !== false) { // only .zip files
93 if(langPackFinalMove($file)) {
97 $errors[] = $mod_strings['ERR_LANG_UPLOAD_3'];
100 $errors[] = $mod_strings['ERR_LANG_UPLOAD_2'];
106 if($perform) { // check for a real file
107 $uploadResult = $mod_strings['LBL_LANG_SUCCESS'];
108 $result = langPackUnpack('langpack', $tempFile);
110 $errors[] = $mod_strings['ERR_LANG_UPLOAD_1'];
113 if(count($errors) > 0) {
114 foreach($errors as $error) {
115 $uploadResult .= $error."<br />";
118 break; // end 'validate'
120 $sugar_config = commitModules(false, 'langpack');
122 case 'uninstall': // leaves zip file in "uploaded" state
123 $sugar_config = uninstallLanguagePack();
126 removeLanguagePack();
132 //// END HANDLE FILE UPLOAD AND PROCESSING
133 ///////////////////////////////////////////////////////////////////////////////
136 ///////////////////////////////////////////////////////////////////////////////
137 //// PRELOAD DISPLAY DATA
138 $upload_max_filesize = ini_get('upload_max_filesize');
139 $upload_max_filesize_bytes = return_bytes($upload_max_filesize);
141 if(!defined('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')){
142 define('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES', 6 * 1024 * 1024);
145 if($upload_max_filesize_bytes < constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')) {
146 $GLOBALS['log']->debug("detected upload_max_filesize: $upload_max_filesize");
147 $fileMaxSize = '<p class="error">'.$mod_strings['ERR_UPLOAD_MAX_FILESIZE']."</p>\n";
149 $availablePatches = getLangPacks(true);
150 $installedLanguagePacks = getInstalledLangPacks();
152 if(isset($validation_errors)) {
153 if(count($validation_errors) > 0) {
154 $errs = '<div id="errorMsgs">';
155 $errs .= "<p>{$mod_strings['LBL_SYSOPTS_ERRS_TITLE']}</p>";
158 foreach($validation_errors as $error) {
159 $errs .= '<li>' . $error . '</li>';
169 //// PRELOAD DISPLAY DATA
170 ///////////////////////////////////////////////////////////////////////////////
173 ///////////////////////////////////////////////////////////////////////////////
174 //// BEING PAGE OUTPUT
178 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
181 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
182 <meta http-equiv="Content-Script-Type" content="text/javascript">
183 <meta http-equiv="Content-Style-Type" content="text/css">
184 <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_MODULE_TITLE']}</title>
185 <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico">
186 <link rel="stylesheet" href="install/install.css" type="text/css">
187 <script type="text/javascript" src="install/installCommon.js"></script>
188 <link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css?s={$sugar_version}&c={$js_custom_version}">
189 <script>jscal_today = 1161698116000; if(typeof app_strings == "undefined") app_strings = new Array();</script>
190 <script type="text/javascript" src="include/javascript/sugar_grp1.js?s={$sugar_version}&c={$js_custom_version}"></script>
191 <script type="text/javascript" src="include/javascript/sugar_grp1_yui.js?s={$sugar_version}&c={$js_custom_version}"></script>
192 <script type="text/javascript">
200 <body onLoad="document.getElementById('button_next2').focus();">
202 <table cellspacing="0" width="100%" cellpadding="0" border="0" align="center" class="shell">
203 <tr><td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr>
207 <img src="{$sugar_md}" alt="SugarCRM" border="0">
208 </p>{$mod_strings['LBL_MODULE_TITLE']}</th>
209 <th width="200" style="text-align: right;"><a href="http://www.sugarcrm.com" target=
210 "_blank"><IMG src="include/images/sugarcrm_login.png" width="145" height="30" alt="SugarCRM" border="0"></a>
216 <p>{$mod_strings['LBL_LANG_1']}</p>
217 <table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="StyleDottedHr">
219 <th colspan="2" align="left">{$mod_strings['LBL_LANG_TITLE']}</th>
225 <form name="the_form" enctype="multipart/form-data"
226 action="install.php" method="post">
227 <input type="hidden" name="current_step" value="{$next_step}">
228 <input type="hidden" name="language" value="{$lang_curr}">
229 <input type="hidden" name="goto" value="{$mod_strings['LBL_CHECKSYS_RECHECK']}">
230 <input type="hidden" name="languagePackAction" value="upload">
231 <input type="hidden" name="install_type" value="custom">
232 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
235 <table width="450" border="0" cellspacing="0" cellpadding="0">
238 {$mod_strings['LBL_LANG_UPLOAD']}:<br />
244 <input type="file" name="language_pack" onchange="uploadCheck();" size="40" />
247 <input class='button' id="upload_button" type=button value="{$mod_strings['LBL_LANG_BUTTON_UPLOAD']}"
249 onClick="document.the_form.language_pack_escaped.value = escape( document.the_form.language_pack.value );
250 document.the_form.submit();"
252 <input type=hidden name="language_pack_escaped" value="" />
266 function uploadCheck(){
267 var len = escape(document.the_form.language_pack.value).length;
268 if(escape(document.the_form.language_pack.value).substr(len-3,len) !='zip'){
269 //document.the_form.upgrade_zip.value = '';
270 //document.getElementById("upgrade_zip").value = '';
271 alert('Not a zip file');
272 document.the_form.language_pack.value = '';
273 //document.getElementById("language_pack").value='';
274 document.getElementById("upload_button").disabled='disabled';
277 //AJAX call for checking the file size and comparing with php.ini settings.
279 success:function(r) {
280 document.the_form.upload_button.disabled='';
283 //var file_name = document.getElementById('upgrade_zip').value;
284 var file_name = document.the_form.language_pack.value;
285 postData = 'file_name=' + file_name + 'install&action=UploadLangFileCheck&to_pdf=1';
286 YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
299 <!--// Available Upgrades //-->
301 <td align="left" colspan="2">
303 <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
309 <td align="left" colspan="2">
311 <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
312 {$installedLanguagePacks}
317 <td align="right" colspan="2">
319 <form name="the_form1" action="install.php" method="post" id="form">
320 <input type="hidden" name="current_step" value="{$next_step}">
321 <input type="hidden" name="language" value="{$lang_curr}">
322 <input type="hidden" name="install_type" value="custom">
323 <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
327 <input type="hidden" name="default_user_name" value="admin">
330 <input class="button" type="submit" name="goto" value="{$mod_strings['LBL_NEXT']}" id="button_next2" {$disabled} />
345 $hidden_fields = "<input type=\"hidden\" name=\"current_step\" value=\"{$next_step}\">";
346 $hidden_fields .= "<input type=\"hidden\" name=\"goto\" value=\"{$mod_strings['LBL_CHECKSYS_RECHECK']}\">";
347 $hidden_fields .= "<input type=\"hidden\" name=\"languagePackAction\" value=\"commit\">";
348 //$form2 = PackageManagerDisplay::buildPackageDisplay($form, $hidden_fields, 'install.php', array('langpack'), 'form1', true);
349 $form2 = PackageManagerDisplay::buildPatchDisplay($form, $hidden_fields, 'install.php', array('langpack'));
351 echo $out.$form2.$out1;
353 //unlinkTempFiles('','');
355 ///////////////////////////////////////////////////////////////////////////////