PageRenderTime 66ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/cubi/openbiz/sys_init.php

http://openbiz-cubi.googlecode.com/
PHP | 220 lines | 195 code | 5 blank | 20 comment | 2 complexity | 7180f43d439b6b54f8daa813e433f166 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-3.0
  1. <?php
  2. /**
  3. * Openbiz Cubi Application Platform
  4. *
  5. * LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
  6. *
  7. * @package openbiz.bin
  8. * @copyright Copyright (c) 2005-2011, Openbiz Technology LLC
  9. * @license http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
  10. * @link http://code.google.com/p/openbiz-cubi/
  11. * @version $Id$
  12. */
  13. /* * **************************************************************************
  14. openbiz core path
  15. * ************************************************************************** */
  16. //define('OPENBIZ_HOME', 'absolute_dir/Openbiz');
  17. define('OPENBIZ_HOME', dirname(__FILE__));
  18. /* * **************************************************************************
  19. application related path
  20. * ************************************************************************** */
  21. define('APP_HOME', dirname(dirname(__FILE__)));
  22. /* website url. please change the localhost to real url */
  23. if (isset($_SERVER["HTTP_HOST"])) {
  24. define('SITE_URL','http://local.openbiz.me/');
  25. } else {
  26. define('SITE_URL','http://local.openbiz.me/');
  27. }
  28. define('DEFAULT_SYSTEM_NAME','Openbiz Framework');
  29. /* APP_URL is /a/b in case of http://host/a/b/index.php?... */
  30. $appHome = str_replace('\\', '/', APP_HOME);
  31. if (isset($_SERVER['DOCUMENT_ROOT'])) {
  32. $appPath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $appHome);
  33. } else {
  34. $appPath = $appHome;
  35. }
  36. if ($appPath == $appHome) {
  37. //support for apache alias path
  38. //$doc_root = str_replace('\\','/',dirname(APP_HOME));
  39. $doc_root = str_replace('\\', '/', APP_HOME);
  40. $appPath = str_replace($doc_root, "", $appHome);
  41. }
  42. if (substr($appPath, 0, 1) != '/' && strlen($appPath) > 0) {
  43. $appPath = '/' . $appPath;
  44. }
  45. if ($appPath == '/') {
  46. define('APP_URL', '');
  47. } else {
  48. if (!isset($_SERVER['HTTP_HOST'])) {
  49. define('APP_URL', '');
  50. } else {
  51. define('APP_URL', $appPath);
  52. }
  53. }
  54. /* APP_INDEX is /a/b/index.php in case of http://host/a/b/index.php?... */
  55. $indexScript = "/index.php"; // or "", or "/?"
  56. define('APP_INDEX', APP_URL . $indexScript);
  57. /* define modules path */
  58. define('MODULE_PATH', APP_HOME . DIRECTORY_SEPARATOR . "modules");
  59. /* define modules extension path that can store custom code who overrides default module logic */
  60. define('MODULE_EX_PATH',APP_HOME.DIRECTORY_SEPARATOR."module_customized");
  61. /* define messages files path */
  62. define('MESSAGE_PATH', APP_HOME . DIRECTORY_SEPARATOR . "messages");
  63. /* define themes const */
  64. define('USE_THEME', 1);
  65. define('THEME_URL', APP_URL . "/themes");
  66. define('THEME_PATH', APP_HOME . DIRECTORY_SEPARATOR . "themes"); // absolution path the themes
  67. define('DEFAULT_THEME_NAME', 'default'); // name of the theme. theme files are under themes/theme_name
  68. define('SMARTY_CPL_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files/tpl_cpl"); // smarty template compiling path
  69. /* define javascript path */
  70. define('JS_URL', APP_URL . "/js");
  71. define('OTHERS_URL', APP_URL . "/others");
  72. /* Log file path */
  73. define("LOG_PATH", APP_HOME . DIRECTORY_SEPARATOR . "log");
  74. /* file path. */
  75. define('APP_FILE_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files");
  76. define('APP_FILE_URL', APP_URL . "/files");
  77. /* define session save handler */
  78. if (is_file(APP_FILE_PATH . '/install.lock') && defined('USE_CUSTOM_SESSION_HANDLER') && USE_CUSTOM_SESSION_HANDLER ==true ) {
  79. define("SESSION_HANDLER", MODULE_PATH . "/system/lib/SessionDBHandler"); // save session in DATABASE
  80. //define("SESSION_HANDLER", MODULE_PATH."/system/lib/SessionMCHandler"); // save session in MEMCACHE
  81. //define("SESSION_PATH", APP_HOME.DIRECTORY_SEPARATOR."session"); // for default FILE type session handler
  82. } else {
  83. define("SESSION_PATH", APP_HOME . DIRECTORY_SEPARATOR . "session"); // for default FILE type session handler^M
  84. }
  85. /* resources path. */
  86. define('RESOURCE_PATH', APP_HOME . DIRECTORY_SEPARATOR . "resources");
  87. define('RESOURCE_URL', APP_URL . "/resources");
  88. define('RESOURCE_PHP', APP_URL . "/rs.php");
  89. /* secured upload / attachment file path. files cannot be accessed by a direct url */
  90. define('SECURE_UPLOAD_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR . "sec_upload");
  91. /* public upload file path. for example, uploaded image files. files can be accessed by a direct url */
  92. define('PUBLIC_UPLOAD_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR . "upload");
  93. define('PUBLIC_UPLOAD_URL', APP_FILE_URL . '/upload');
  94. /* file cache.DIRECTORY_SEPARATOR."rectory */
  95. define('CACHE_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR . "cache");
  96. /* temopary files directory */
  97. define('TEMPFILE_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR . "tmp");
  98. /* metadata cache files directory */
  99. define('CACHE_METADATA_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR . "cache" . DIRECTORY_SEPARATOR . "metadata");
  100. /* data cache files directory */
  101. define('CACHE_DATA_PATH', APP_HOME . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR . "cache" . DIRECTORY_SEPARATOR . "data");
  102. /* * **************************************************************************
  103. application system level constances
  104. * ************************************************************************** */
  105. /* whether print debug infomation or not */
  106. define("DEBUG", 1);
  107. /* check whether user logged in */
  108. //define("CHECKUSER", "Y");
  109. /* session timeout seconds */
  110. define("TIMEOUT", 86400); // 86400 = 1 day
  111. //I18n
  112. //define('DEFAULT_LANGUAGE','en_US');
  113. define('DEFAULT_CURRENCY','CNY');
  114. define('DEFAULT_LANGUAGE', 'en_US');
  115. define("LANGUAGE_PATH", APP_HOME . DIRECTORY_SEPARATOR . "languages");
  116. /* define locale to be set in typemanager.php depending on selected language */
  117. //$local["es"]="es_ES.utf8";
  118. //$local["en"]="en_EN.utf8";
  119. //{$row.fld_latitude},{$row.fld_longtitude}
  120. define('DEFAULT_LATITUDE', '39.92');
  121. define('DEFAULT_LONGTITUDE', '116.46');
  122. //session strict
  123. //0=allow concurrent session
  124. //1=limited to single session
  125. define('SESSION_STRICT', '0');
  126. // login page
  127. define('USER_LOGIN_VIEW', "user.view.LoginView");
  128. // session timeout page
  129. define('USER_TIMEOUT_VIEW', "common.view.TimeoutView");
  130. // access deny page
  131. define('ACCESS_DENIED_VIEW', "common.view.AccessDenyView");
  132. // security deny page
  133. define('SECURITY_DENIED_VIEW', "common.view.SecurityDenyView");
  134. // not found page
  135. define('NOTFOUND_VIEW', "common.view.NotfoundView");
  136. // internal error page
  137. define('INTERNAL_ERROR_VIEW', "common.view.ErrorView");
  138. // define service namings
  139. define('EVENTLOG_SERVICE', "eventlogService");
  140. define('USER_EMAIL_SERVICE', "userEmailService");
  141. define('VISIBILITY_SERVICE', "visService");
  142. define('PDF_SERVICE', "pdfService");
  143. define('PREFERENCE_SERVICE', "preferenceService");
  144. define('DATAPERM_SERVICE', "dataPermService");
  145. define('UTIL_SERVICE', "utilService");
  146. define('LOV_SERVICE', "lovService");
  147. define('DENY', 0);
  148. define('ALLOW', 1);
  149. define('ALLOW_OWNER', 2);
  150. define('APPBUILDER', '1'); // 0: hidden, 1: show
  151. // load default theme
  152. if (@isset($_GET['theme'])) {
  153. //$_GET
  154. define('THEME_NAME', $_GET['theme']);
  155. //save cookies
  156. setcookie("THEME_NAME", $_GET['theme'], time() + 86400 * 365, "/");
  157. } elseif (@isset($_COOKIE['THEME_NAME'])) {
  158. define('THEME_NAME', $_COOKIE['THEME_NAME']);
  159. } else {
  160. //default
  161. define('THEME_NAME', DEFAULT_THEME_NAME);
  162. }
  163. include_once(OPENBIZ_HOME . "/bin/sysheader_inc.php");
  164. // service alias. used in expression engine
  165. $g_ServiceAlias = array('validate' => VALIDATE_SERVICE, 'query' => QUERY_SERVICE, 'vis' => VISIBILITY_SERVICE, 'preference' => PREFERENCE_SERVICE, 'util' => UTIL_SERVICE);
  166. //init default timezone setting
  167. define('DEFAULT_TIMEZONE', 'Asia/Chongqing');
  168. $DefaultTimezone = BizSystem::sessionContext()->getVar("TIMEZONE");
  169. // default language
  170. if ($DefaultTimezone == "") {
  171. $DefaultTimezone = DEFAULT_TIMEZONE;
  172. }
  173. date_default_timezone_set($DefaultTimezone);
  174. define('FusionChartVersion', "Pro");
  175. define('GROUP_DATA_SHARE', '1');
  176. define('DATA_ACL', '1');
  177. define('DEFAULT_OWNER_PERM', '3');
  178. define('DEFAULT_GROUP_PERM', '1');
  179. define('DEFAULT_OTHER_PERM', '0');