PageRenderTime 55ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 1ms

/include/entryPoint.php

https://bitbucket.org/cviolette/sugarcrm
PHP | 237 lines | 103 code | 31 blank | 103 comment | 16 complexity | bf4cf2159b95180104d07a4af4487e29 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. <?php
  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-2012 SugarCRM Inc.
  6. *
  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.
  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 Affero General Public License for more
  17. * details.
  18. *
  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
  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 Affero General Public License version 3.
  30. *
  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. ********************************************************************************/
  37. /*********************************************************************************
  38. * Description:
  39. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
  40. * Reserved. Contributor(s): ______________________________________..
  41. * *******************************************************************************/
  42. /**
  43. * Known Entry Points as of 4.5
  44. * acceptDecline.php
  45. * campaign_tracker.php
  46. * campaign_trackerv2.php
  47. * cron.php
  48. * dictionary.php
  49. * download.php
  50. * emailmandelivery.php
  51. * export_dataset.php
  52. * export.php
  53. * image.php
  54. * index.php
  55. * install.php
  56. * json.php
  57. * json_server.php
  58. * leadCapture.php
  59. * maintenance.php
  60. * metagen.php
  61. * pdf.php
  62. * phprint.php
  63. * process_queue.php
  64. * process_workflow.php
  65. * removeme.php
  66. * schedulers.php
  67. * soap.php
  68. * su.php
  69. * sugar_version.php
  70. * TreeData.php
  71. * tree_level.php
  72. * tree.php
  73. * vcal_server.php
  74. * vCard.php
  75. * zipatcher.php
  76. * WebToLeadCapture.php
  77. * HandleAjaxCall.php */
  78. /*
  79. * for 50, added:
  80. * minify.php
  81. */
  82. /*
  83. * for 510, added:
  84. * dceActionCleanup.php
  85. */
  86. $GLOBALS['starttTime'] = microtime(true);
  87. set_include_path(
  88. dirname(__FILE__) . '/..' . PATH_SEPARATOR .
  89. get_include_path()
  90. );
  91. if (!defined('PHP_VERSION_ID')) {
  92. $version_array = explode('.', phpversion());
  93. define('PHP_VERSION_ID', ($version_array[0]*10000 + $version_array[1]*100 + $version_array[2]));
  94. }
  95. if(empty($GLOBALS['installing']) && !file_exists('config.php'))
  96. {
  97. header('Location: install.php');
  98. exit ();
  99. }
  100. // config|_override.php
  101. if(is_file('config.php')) {
  102. require_once('config.php'); // provides $sugar_config
  103. }
  104. // load up the config_override.php file. This is used to provide default user settings
  105. if(is_file('config_override.php')) {
  106. require_once('config_override.php');
  107. }
  108. if(empty($GLOBALS['installing']) &&empty($sugar_config['dbconfig']['db_name']))
  109. {
  110. header('Location: install.php');
  111. exit ();
  112. }
  113. // make sure SugarConfig object is available
  114. require_once 'include/SugarObjects/SugarConfig.php';
  115. ///////////////////////////////////////////////////////////////////////////////
  116. //// DATA SECURITY MEASURES
  117. require_once('include/utils.php');
  118. require_once('include/clean.php');
  119. clean_special_arguments();
  120. clean_incoming_data();
  121. //// END DATA SECURITY MEASURES
  122. ///////////////////////////////////////////////////////////////////////////////
  123. // cn: set php.ini settings at entry points
  124. setPhpIniSettings();
  125. require_once('sugar_version.php'); // provides $sugar_version, $sugar_db_version, $sugar_flavor
  126. require_once('include/database/DBManagerFactory.php');
  127. require_once('include/dir_inc.php');
  128. require_once('include/Localization/Localization.php');
  129. require_once('include/javascript/jsAlerts.php');
  130. require_once('include/TimeDate.php');
  131. require_once('include/modules.php'); // provides $moduleList, $beanList, $beanFiles, $modInvisList, $adminOnlyList, $modInvisListActivities
  132. require('include/utils/autoloader.php');
  133. spl_autoload_register(array('SugarAutoLoader', 'autoload'));
  134. require_once('data/SugarBean.php');
  135. require_once('include/utils/mvc_utils.php');
  136. require('include/SugarObjects/LanguageManager.php');
  137. require('include/SugarObjects/VardefManager.php');
  138. require('modules/DynamicFields/templates/Fields/TemplateText.php');
  139. require_once('include/utils/file_utils.php');
  140. require_once('include/SugarEmailAddress/SugarEmailAddress.php');
  141. require_once('include/SugarLogger/LoggerManager.php');
  142. require_once('modules/Trackers/BreadCrumbStack.php');
  143. require_once('modules/Trackers/Tracker.php');
  144. require_once('modules/Trackers/TrackerManager.php');
  145. require_once('modules/ACL/ACLController.php');
  146. require_once('modules/Administration/Administration.php');
  147. require_once('modules/Administration/updater_utils.php');
  148. require_once('modules/Users/User.php');
  149. require_once('modules/Users/authentication/AuthenticationController.php');
  150. require_once('include/utils/LogicHook.php');
  151. require_once('include/SugarTheme/SugarTheme.php');
  152. require_once('include/MVC/SugarModule.php');
  153. require_once('include/SugarCache/SugarCache.php');
  154. require('modules/Currencies/Currency.php');
  155. require_once('include/MVC/SugarApplication.php');
  156. require_once('include/upload_file.php');
  157. UploadStream::register();
  158. //
  159. //SugarApplication::startSession();
  160. ///////////////////////////////////////////////////////////////////////////////
  161. //// Handle loading and instantiation of various Sugar* class
  162. if (!defined('SUGAR_PATH')) {
  163. define('SUGAR_PATH', realpath(dirname(__FILE__) . '/..'));
  164. }
  165. require_once 'include/SugarObjects/SugarRegistry.php';
  166. if(empty($GLOBALS['installing'])){
  167. ///////////////////////////////////////////////////////////////////////////////
  168. //// SETTING DEFAULT VAR VALUES
  169. $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
  170. $error_notice = '';
  171. $use_current_user_login = false;
  172. // Allow for the session information to be passed via the URL for printing.
  173. if(isset($_GET['PHPSESSID'])){
  174. if(!empty($_COOKIE['PHPSESSID']) && strcmp($_GET['PHPSESSID'],$_COOKIE['PHPSESSID']) == 0) {
  175. session_id($_REQUEST['PHPSESSID']);
  176. }else{
  177. unset($_GET['PHPSESSID']);
  178. }
  179. }
  180. if(!empty($sugar_config['session_dir'])) {
  181. session_save_path($sugar_config['session_dir']);
  182. }
  183. SugarApplication::preLoadLanguages();
  184. $timedate = TimeDate::getInstance();
  185. $GLOBALS['sugar_version'] = $sugar_version;
  186. $GLOBALS['sugar_flavor'] = $sugar_flavor;
  187. $GLOBALS['timedate'] = $timedate;
  188. $GLOBALS['js_version_key'] = md5($GLOBALS['sugar_config']['unique_key'].$GLOBALS['sugar_version'].$GLOBALS['sugar_flavor']);
  189. $db = DBManagerFactory::getInstance();
  190. $db->resetQueryCount();
  191. $locale = new Localization();
  192. // Emails uses the REQUEST_URI later to construct dynamic URLs.
  193. // IIS does not pass this field to prevent an error, if it is not set, we will assign it to ''.
  194. if (!isset ($_SERVER['REQUEST_URI'])) {
  195. $_SERVER['REQUEST_URI'] = '';
  196. }
  197. $current_user = new User();
  198. $current_entity = null;
  199. $system_config = new Administration();
  200. $system_config->retrieveSettings();
  201. LogicHook::initialize()->call_custom_logic('', 'after_entry_point');
  202. }
  203. //// END SETTING DEFAULT VAR VALUES
  204. ///////////////////////////////////////////////////////////////////////////////
  205. ?>