iTx Technologies offre gratuitement
cet espace pour SugarCRM !

title

Body

[fermer]

/install/ -> download_patches.php (source)

   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  require_once ('ModuleInstall/PackageManager/PackageManagerDisplay.php');
  39  if( !isset( $install_script ) || !$install_script ){
  40      die($mod_strings['ERR_NO_DIRECT_SCRIPT']);
  41  }
  42  ///////////////////////////////////////////////////////////////////////////////
  43  ////    PREFILL $sugar_config VARS
  44  if(empty($sugar_config['upload_dir'])) {
  45      $sugar_config['upload_dir'] = 'cache/upload/';
  46  }
  47  if(empty($sugar_config['upload_maxsize'])) {
  48      $sugar_config['upload_maxsize'] = 8192000;
  49  }
  50  if(empty($sugar_config['upload_badext'])) {
  51      $sugar_config['upload_badext'] = array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm');
  52  }
  53  ////    END PREFILL $sugar_config VARS
  54  ///////////////////////////////////////////////////////////////////////////////
  55  require_once ('include/utils/zip_utils.php');
  56  
  57  require_once ('include/upload_file.php');
  58  
  59  
  60  ///////////////////////////////////////////////////////////////////////////////
  61  ////    PREP VARS FOR LANG PACK
  62      $base_upgrade_dir       = $sugar_config['upload_dir'] . "upgrades";
  63      $base_tmp_upgrade_dir   = $base_upgrade_dir."/temp";
  64  ///////////////////////////////////////////////////////////////////////////////    
  65  
  66  ///////////////////////////////////////////////////////////////////////////////
  67  ////    HANDLE FILE UPLOAD AND PROCESSING
  68  $errors = array();
  69  $uploadResult = '';
  70  if(isset($_REQUEST['languagePackAction']) && !empty($_REQUEST['languagePackAction'])) {
  71      switch($_REQUEST['languagePackAction']) {
  72          case 'upload':
  73          $perform = false;
  74          $tempFile = '';
  75          if(isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != ""){
  76              require_once ('ModuleInstall/PackageManager/PackageManager.php');
  77              $pm = new PackageManager();
  78              $tempFile = $pm->download('3', '3', $_REQUEST['release_id'], getcwd().'/'.$sugar_config['upload_dir']);    
  79              $perform = true;
  80              //$base_filename = urldecode($tempFile);
  81          }else{
  82              $file = new UploadFile('language_pack');
  83              if($file->confirm_upload())
  84              $perform = true; 
  85               if(strpos($file->mime_type, 'zip') !== false) { // only .zip files
  86                      if(langPackFinalMove($file)) {
  87                          $perform = true; 
  88                      }
  89                      else {
  90                          $errors[] = $mod_strings['ERR_LANG_UPLOAD_3'];   
  91                      }
  92                  } else {
  93                      $errors[] = $mod_strings['ERR_LANG_UPLOAD_2'];
  94                  }   
  95          }
  96              
  97      
  98              if($perform) { // check for a real file               
  99                          $uploadResult = $mod_strings['LBL_LANG_SUCCESS'];
 100                          $result = langPackUnpack('patch', $tempFile);                   
 101              } else {
 102                  $errors[] = $mod_strings['ERR_LANG_UPLOAD_1'];
 103              }
 104              
 105              if(count($errors) > 0) {
 106                  foreach($errors as $error) {
 107                      $uploadResult .= $error."<br />";
 108                  }
 109              }        
 110              break; // end 'validate'
 111          case 'commit':
 112              $sugar_config = commitPatch();
 113              break;
 114          case 'remove':
 115              removeLanguagePack();
 116              break;
 117          default:
 118              break;                   
 119      }
 120  }
 121  ////    END HANDLE FILE UPLOAD AND PROCESSING
 122  ///////////////////////////////////////////////////////////////////////////////
 123  
 124  
 125  ///////////////////////////////////////////////////////////////////////////////
 126  ////    PRELOAD DISPLAY DATA
 127  $upload_max_filesize = ini_get('upload_max_filesize');
 128  $upload_max_filesize_bytes = return_bytes($upload_max_filesize);
 129  $fileMaxSize ='';
 130  if(!defined('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')){
 131      define('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES', 6 * 1024 * 1024);
 132  }
 133  if($upload_max_filesize_bytes < constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')) {
 134      $GLOBALS['log']->debug("detected upload_max_filesize: $upload_max_filesize");
 135      $fileMaxSize = '<p class="error">'.$mod_strings['ERR_UPLOAD_MAX_FILESIZE']."</p>\n";
 136  }
 137  $availablePatches = getLangPacks(false, array('patch'), $mod_strings['LBL_PATCH_READY']);
 138  
 139  $errs = '';
 140  if(isset($validation_errors)) {
 141      if(count($validation_errors) > 0) {
 142          $errs  = '<div id="errorMsgs">';
 143          $errs .= "<p>{$mod_strings['LBL_SYSOPTS_ERRS_TITLE']}</p>";
 144          $errs .= '<ul>';
 145  
 146          foreach($validation_errors as $error) {
 147              $errs .= '<li>' . $error . '</li>';
 148          }
 149  
 150          $errs .= '</ul>';
 151          $errs .= '</div>';
 152      }
 153  }
 154  
 155  ////    PRELOAD DISPLAY DATA
 156  ///////////////////////////////////////////////////////////////////////////////
 157  
 158  
 159  ///////////////////////////////////////////////////////////////////////////////
 160  ////    BEING PAGE OUTPUT
 161  $disabled = "";
 162  $result = "";
 163  $out =<<<EOQ
 164  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 165  <html>
 166  <head>
 167     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 168     <meta http-equiv="Content-Script-Type" content="text/javascript">
 169     <meta http-equiv="Content-Style-Type" content="text/css">
 170     <title>{$mod_strings['LBL_WIZARD_TITLE']} {$next_step}</title>
 171     <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico">
 172     <link rel="stylesheet" href="install/install.css" type="text/css">
 173     <script type="text/javascript" src="install/installCommon.js"></script>
 174     <link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css?s={$sugar_version}&c={$js_custom_version}">
 175     <script>jscal_today = 1161698116000; if(typeof app_strings == "undefined") app_strings = new Array();</script>
 176     <script type="text/javascript" src="include/javascript/sugar_grp1.js?s={$sugar_version}&c={$js_custom_version}"></script>
 177     <script type="text/javascript" src="include/javascript/sugar_grp1_yui.js?s={$sugar_version}&c={$js_custom_version}"></script>
 178  
 179  
 180  </head>
 181  
 182  <body onLoad="document.getElementById('defaultFocus').focus();">
 183  {$fileMaxSize}
 184    <table cellspacing="0" width="100%" cellpadding="0" border="0" align="center" class="shell">
 185        <tr><td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr>
 186      <tr>
 187        <th width="500">
 188          <p><img src="include/images/sugar_md.png" alt="SugarCRM" border="0"></p>
 189        {$mod_strings['LBL_PATCHES_TITLE']}</th>
 190        <th width="200" style="text-align: right;"><a href="http://www.sugarcrm.com" target=
 191        "_blank"><IMG src="include/images/sugarcrm_login.png" width="145" height="30" alt="SugarCRM" border="0"></a>
 192          </th>
 193      </tr>
 194  
 195      <tr>
 196          <td colspan="2">
 197              <p>{$mod_strings['LBL_PATCH_1']}</p>
 198              <table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="StyleDottedHr">
 199                  <tr>
 200                      <th colspan="2" align="left">{$mod_strings['LBL_PATCH_TITLE']}</th>
 201                  </tr>
 202                  <tr>
 203                      <td colspan="2">
 204  EOQ;
 205  $form =<<<EOQ1
 206                      <form name="the_form" enctype="multipart/form-data" 
 207                          action="install.php" method="post">
 208                          <input type="hidden" name="current_step" value="{$next_step}">
 209                          <input type="hidden" name="goto" value="{$mod_strings['LBL_CHECKSYS_RECHECK']}">
 210                          <input type="hidden" name="languagePackAction" value="upload">
 211                      
 212                      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
 213                          <tr>
 214                              <td>
 215                                  <table width="450" border="0" cellspacing="0" cellpadding="0">
 216                                      <tr>
 217                                          <td colspan='2'>
 218                                              {$mod_strings['LBL_PATCH_UPLOAD']}:
 219                                          </td>
 220                                      </tr><tr>
 221                                          <td>
 222                                              
 223                                              <input type="file" name="language_pack" size="40" />
 224                                          </td>
 225                                          <td valign="bottom">
 226                                              <input class='button' type=button value="{$mod_strings['LBL_LANG_BUTTON_UPLOAD']}"  onClick="document.the_form.language_pack_escaped.value = escape( document.the_form.language_pack.value ); document.the_form.submit();"/>
 227                                              <input type=hidden name="language_pack_escaped" value="" />
 228                                          </td>
 229                                      </tr>
 230                                  </table>
 231                              </td>
 232                          </tr>
 233                          <tr>
 234                              <td>
 235                                  {$uploadResult}
 236                              </td>
 237                          </tr>
 238                      </table>
 239                      </form>
 240  EOQ1;
 241  $out1 =<<<EOQ2
 242                    </td>
 243                  </tr>
 244                  <tr>
 245                      <td colspan=2>
 246                          {$result}
 247                      </td>
 248                  </tr>
 249                 
 250                  <!--// Available Upgrades //-->
 251                  <tr>
 252                      <td align="left" colspan="2">
 253                          <hr>
 254                          <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
 255                              {$availablePatches}
 256                          </table>
 257                      </td>
 258                  </tr>
 259                   <tr>
 260                      <td align="right" colspan="2">
 261                          <hr>
 262                          <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
 263                          <tr><td><form action='install.php' method='POST'>
 264                                  <input type='hidden' name='current_step' value="{$next_step}">
 265                                  <input type='hidden' name='goto' value="{$mod_strings['LBL_CHECKSYS_RECHECK']}">
 266                                  <input type='hidden' name='languagePackAction' value='commit'> 
 267                                  <input type='submit' value="{$mod_strings['LBL_INSTALL']}" class='button'>
 268                                  </form>
 269                          </td></tr>
 270                          </table>
 271                      </td>
 272                  </tr>
 273                  <tr>
 274                      <td align="right" colspan="2">
 275                          <hr>
 276                          <form name="the_form1" action="install.php" method="post">
 277                          <input type="hidden" name="current_step" value="{$next_step}">
 278                          <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
 279                              <tr>
 280                                  <td>
 281                                    
 282                                  </td>
 283                                  <td>
 284                                      <input class="button" type="submit" name="goto" value="{$mod_strings['LBL_NEXT']}" id="defaultFocus" {$disabled} />
 285                                  </td>
 286                              </tr>
 287                          </table>
 288                          </form>
 289                      </td>
 290                  </tr>
 291              </table>
 292          </td>
 293      </tr>
 294  </table>
 295  
 296  </body>
 297  </html>
 298  EOQ2;
 299  $hidden_fields =  "<input type=\"hidden\" name=\"current_step\" value=\"{$next_step}\">";
 300  $hidden_fields .=  "<input type=\"hidden\" name=\"goto\" value=\"{$mod_strings['LBL_CHECKSYS_RECHECK']}\">";
 301  $hidden_fields .=  "<input type=\"hidden\" name=\"languagePackAction\" value=\"upload\">";
 302  $form2 = PackageManagerDisplay::buildPatchDisplay($form, $hidden_fields, 'install.php', array('patch'));
 303  
 304  echo $out.$form2.$out1;
 305  
 306  //unlinkTempFiles('','');
 307  ////    END PAGEOUTPUT
 308  ///////////////////////////////////////////////////////////////////////////////
 309  ?>


Generé en: Thu Mar 4 09:44:50 2010 | Cross-referenced par PHPXref 0.7