[ Index ]
 

Code source de SugarCRM 5.0.0beta1

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

title

Body

[fermer]

/ -> leadCapture.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  require_once ('modules/Leads/LeadFormBase.php');
  36  
  37  $app_strings = return_application_language($sugar_config['default_language']);
  38  $app_list_strings = return_app_list_strings_language($sugar_config['default_language']);
  39  $mod_strings = return_module_language($sugar_config['default_language'], 'Leads');
  40  
  41  $app_list_strings['record_type_module'] = array('Contact'=>'Contacts', 'Account'=>'Accounts', 'Opportunity'=>'Opportunities', 'Case'=>'Cases', 'Note'=>'Notes', 'Call'=>'Calls', 'Email'=>'Emails', 'Meeting'=>'Meetings', 'Task'=>'Tasks', 'Lead'=>'Leads','Bug'=>'Bugs',
  42  
  43  
  44  
  45  );
  46  /**

  47   * To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there

  48   */
  49  $users = array(
  50      'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
  51  );
  52  if(file_exists('leadCapture_override.php')){
  53      include('leadCapture_override.php');
  54  }
  55  if (!empty($_POST['user']) && !empty($users[$_POST['user']])) {
  56      $current_user->user_name = $users[$_POST['user']]['name'];
  57  
  58      if($current_user->authenticate_user($users[$_POST['user']]['pass'])){
  59          $userid = $current_user->retrieve_user_id($users[$_REQUEST['user']]['name']);
  60          $current_user->retrieve($userid);
  61          $leadForm = new LeadFormBase();
  62          $prefix = '';
  63          if(!empty($_POST['prefix'])){
  64              $prefix =     $_POST['prefix'];
  65          }
  66  
  67          if( !isset($_POST['assigned_user_id']) || !empty($_POST['assigned_user_id']) ){
  68              $_POST['prefix'] = $userid;
  69          }
  70  
  71          $_POST['record'] ='';
  72  
  73          if( isset($_POST['_splitName']) ) {
  74              $name = explode(' ',$_POST['name']);
  75              if(sizeof($name) == 1) {
  76                  $_POST['first_name'] = '';  $_POST['last_name'] = $name[0];
  77              }
  78              else {
  79                  $_POST['first_name'] = $name[0];  $_POST['last_name'] = $name[1];
  80              }
  81          }
  82  
  83          $return_val = $leadForm->handleSave($prefix, false, true);
  84  
  85          if(isset($_POST['redirect']) && !empty($_POST['redirect'])){
  86  
  87              //header("Location: ".$_POST['redirect']);

  88              echo '<html><head><title>SugarCRM</title></head><body>';
  89              echo '<form name="redirect" action="' .$_POST['redirect']. '" method="POST">';
  90  
  91              foreach($_POST as $param => $value) {
  92  
  93                  if($param != 'redirect' || $param != 'submit') {
  94                      echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
  95                  }
  96  
  97              }
  98  
  99              if( ($return_val == '') || ($return_val  == 0) || ($return_val < 0) ) {
 100                  echo '<input type="hidden" name="error" value="1">';
 101              }
 102              echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
 103              echo '</body></html>';
 104          }
 105          else{
 106              echo "Thank You For Your Submission.";
 107          }
 108          sugar_cleanup();
 109          // die to keep code from running into redirect case below

 110          die();
 111      }
 112  }
 113  
 114  echo "We're sorry, the server is currently unavailable, please try again later.";
 115  if (!empty($_POST['redirect'])) {
 116      echo '<html><head><title>SugarCRM</title></head><body>';
 117      echo '<form name="redirect" action="' .$_POST['redirect']. '" method="POST">';
 118      echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
 119      echo '</body></html>';
 120  }
 121  ?>


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