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-2013 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 /*********************************************************************************
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
42 * Reserved. Contributor(s): ______________________________________..
43 * *******************************************************************************/
46 * Known Entry Points as of 4.5
48 * campaign_tracker.php
49 * campaign_trackerv2.php
53 * emailmandelivery.php
67 * process_workflow.php
79 * WebToLeadCapture.php
80 * HandleAjaxCall.php */
87 * dceActionCleanup.php
89 $GLOBALS['starttTime'] = microtime(true);
92 dirname(__FILE__) . '/..' . PATH_SEPARATOR .
96 if (!defined('PHP_VERSION_ID')) {
97 $version_array = explode('.', phpversion());
98 define('PHP_VERSION_ID', ($version_array[0]*10000 + $version_array[1]*100 + $version_array[2]));
101 if(empty($GLOBALS['installing']) && !file_exists('config.php'))
103 header('Location: install.php');
108 // config|_override.php
109 if(is_file('config.php')) {
110 require_once('config.php'); // provides $sugar_config
113 // load up the config_override.php file. This is used to provide default user settings
114 if(is_file('config_override.php')) {
115 require_once('config_override.php');
117 if(empty($GLOBALS['installing']) &&empty($sugar_config['dbconfig']['db_name']))
119 header('Location: install.php');
123 if (!empty($sugar_config['xhprof_config']))
125 require_once 'include/SugarXHprof/SugarXHprof.php';
126 SugarXHprof::getInstance()->start();
129 // make sure SugarConfig object is available
130 require_once 'include/SugarObjects/SugarConfig.php';
132 ///////////////////////////////////////////////////////////////////////////////
133 //// DATA SECURITY MEASURES
134 require_once('include/utils.php');
135 require_once('include/clean.php');
136 clean_special_arguments();
137 clean_incoming_data();
138 //// END DATA SECURITY MEASURES
139 ///////////////////////////////////////////////////////////////////////////////
141 // cn: set php.ini settings at entry points
144 require_once('sugar_version.php'); // provides $sugar_version, $sugar_db_version, $sugar_flavor
145 require_once('include/database/DBManagerFactory.php');
146 require_once('include/dir_inc.php');
148 require_once('include/Localization/Localization.php');
149 require_once('include/javascript/jsAlerts.php');
150 require_once('include/TimeDate.php');
151 require_once('include/modules.php'); // provides $moduleList, $beanList, $beanFiles, $modInvisList, $adminOnlyList, $modInvisListActivities
153 require('include/utils/autoloader.php');
154 spl_autoload_register(array('SugarAutoLoader', 'autoload'));
155 require_once('data/SugarBean.php');
156 require_once('include/utils/mvc_utils.php');
157 require('include/SugarObjects/LanguageManager.php');
158 require('include/SugarObjects/VardefManager.php');
160 require('modules/DynamicFields/templates/Fields/TemplateText.php');
162 require_once('include/utils/file_utils.php');
163 require_once('include/SugarEmailAddress/SugarEmailAddress.php');
164 require_once('include/SugarLogger/LoggerManager.php');
165 require_once('modules/Trackers/BreadCrumbStack.php');
166 require_once('modules/Trackers/Tracker.php');
167 require_once('modules/Trackers/TrackerManager.php');
168 require_once('modules/ACL/ACLController.php');
169 require_once('modules/Administration/Administration.php');
170 require_once('modules/Administration/updater_utils.php');
171 require_once('modules/Users/User.php');
172 require_once('modules/Users/authentication/AuthenticationController.php');
173 require_once('include/utils/LogicHook.php');
174 require_once('include/SugarTheme/SugarTheme.php');
175 require_once('include/MVC/SugarModule.php');
176 require_once('include/SugarCache/SugarCache.php');
177 require('modules/Currencies/Currency.php');
178 require_once('include/MVC/SugarApplication.php');
180 require_once('include/upload_file.php');
181 UploadStream::register();
183 //SugarApplication::startSession();
185 ///////////////////////////////////////////////////////////////////////////////
186 //// Handle loading and instantiation of various Sugar* class
187 if (!defined('SUGAR_PATH')) {
188 define('SUGAR_PATH', realpath(dirname(__FILE__) . '/..'));
190 require_once 'include/SugarObjects/SugarRegistry.php';
192 if(empty($GLOBALS['installing'])){
193 ///////////////////////////////////////////////////////////////////////////////
194 //// SETTING DEFAULT VAR VALUES
195 $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
197 $use_current_user_login = false;
199 // Allow for the session information to be passed via the URL for printing.
200 if(isset($_GET['PHPSESSID'])){
201 if(!empty($_COOKIE['PHPSESSID']) && strcmp($_GET['PHPSESSID'],$_COOKIE['PHPSESSID']) == 0) {
202 session_id($_REQUEST['PHPSESSID']);
204 unset($_GET['PHPSESSID']);
208 if(!empty($sugar_config['session_dir'])) {
209 session_save_path($sugar_config['session_dir']);
212 SugarApplication::preLoadLanguages();
214 $timedate = TimeDate::getInstance();
216 $GLOBALS['sugar_version'] = $sugar_version;
217 $GLOBALS['sugar_flavor'] = $sugar_flavor;
218 $GLOBALS['timedate'] = $timedate;
219 $GLOBALS['js_version_key'] = md5($GLOBALS['sugar_config']['unique_key'].$GLOBALS['sugar_version'].$GLOBALS['sugar_flavor']);
221 $db = DBManagerFactory::getInstance();
222 $db->resetQueryCount();
223 $locale = new Localization();
225 // Emails uses the REQUEST_URI later to construct dynamic URLs.
226 // IIS does not pass this field to prevent an error, if it is not set, we will assign it to ''.
227 if (!isset ($_SERVER['REQUEST_URI'])) {
228 $_SERVER['REQUEST_URI'] = '';
231 $current_user = new User();
232 $current_entity = null;
233 $system_config = new Administration();
234 $system_config->retrieveSettings();
236 LogicHook::initialize()->call_custom_logic('', 'after_entry_point');
240 //// END SETTING DEFAULT VAR VALUES
241 ///////////////////////////////////////////////////////////////////////////////