[ Index ]
 

Code source de SugarCRM 5.0.0beta1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> export.php (source)

   1  <?php
   2  if(!defined('sugarEntry'))define('sugarEntry', true);
   3  /*********************************************************************************

   4   * SugarCRM is a customer relationship management program developed by

   5   * SugarCRM, Inc. Copyright (C) 2004 - 2007 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.

  10   * 

  11   * This program is distributed in the hope that it will be useful, but WITHOUT

  12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS

  13   * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more

  14   * details.

  15   * 

  16   * You should have received a copy of the GNU General Public License along with

  17   * this program; if not, see http://www.gnu.org/licenses or write to the Free

  18   * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA

  19   * 02110-1301 USA.

  20   * 

  21   * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,

  22   * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.

  23   * 

  24   * The interactive user interfaces in modified source and object code versions

  25   * of this program must display Appropriate Legal Notices, as required under

  26   * Section 5 of the GNU General Public License version 3.

  27   * 

  28   * In accordance with Section 7(b) of the GNU General Public License version 3,

  29   * these Appropriate Legal Notices must retain the display of the "Powered by

  30   * SugarCRM" logo. If the display of the logo is not reasonably feasible for

  31   * technical reasons, the Appropriate Legal Notices must display the words

  32   * "Powered by SugarCRM".

  33   ********************************************************************************/
  34  require_once ('include/entryPoint.php');
  35  //fixes IE bug where the file name can't be overwritten in the header on IE

  36  if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
  37      session_cache_limiter("public");
  38  }
  39  
  40  ob_start();
  41  require_once ('include/export_utils.php');
  42  
  43  //set module and application string arrays based upon selected language

  44  $app_strings = return_application_language($sugar_config['default_language']);
  45  session_start();
  46  
  47  $user_unique_key = (isset($_SESSION['unique_key'])) ? $_SESSION['unique_key'] : "";
  48  $server_unique_key = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : "";
  49  
  50  if($user_unique_key != $server_unique_key) {
  51      session_destroy();
  52      exit();
  53  }
  54  
  55  if(!isset($_SESSION['authenticated_user_id'])) {
  56      session_destroy();
  57      die($app_strings['ERR_NEED_ACTIVE_SESSION']);
  58  }
  59  
  60  // get the current User

  61  $current_user = new User();
  62  $result = $current_user->retrieve($_SESSION['authenticated_user_id']);
  63  if($result == null) {
  64      session_destroy();
  65      die($app_strings['ERR_NEED_ACTIVE_SESSION']);
  66  }
  67  
  68  $the_module = clean_string($_REQUEST['module']);
  69  
  70  if($sugar_config['disable_export'] || (!empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || (ACLController::moduleSupportsACL($the_module)  && ACLAction::getUserAccessLevel($current_user->id,$the_module, 'access') == ACL_ALLOW_ENABLED && ACLAction::getUserAccessLevel($current_user->id, $the_module, 'admin') == ACL_ALLOW_ADMIN)))){
  71      die($app_strings['ERR_EXPORT_DISABLED']);
  72  }
  73  
  74  if(!empty($_REQUEST['uid'])) 
  75      $content = export(clean_string($_REQUEST['module']), $_REQUEST['uid']);
  76  else 
  77      $content = export(clean_string($_REQUEST['module']));
  78  
  79  ///////////////////////////////////////////////////////////////////////////////

  80  ////    BUILD THE EXPORT FILE

  81  ob_clean();
  82  header("Pragma: cache");
  83  header("Content-type: application/octet-stream; charset=".$locale->getExportCharset());
  84  header("Content-Disposition: attachment; filename={$_REQUEST['module']}.csv");
  85  header("Content-transfer-encoding: binary");
  86  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
  87  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
  88  header("Cache-Control: post-check=0, pre-check=0", false );
  89  header("Content-Length: ".strlen($content));
  90  
  91  print $locale->translateCharset($content, 'UTF-8', $locale->getExportCharset());
  92  
  93  sugar_cleanup(true);
  94  ?>


Généré le : Tue Sep 11 10:48:47 2007 par Balluche grâce à PHPXref 0.7