国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

common.inc.php 9.8KB

2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
4 jaren geleden
2 jaren geleden
1 jaar geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
3 jaren geleden
1 jaar geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
1 jaar geleden
4 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?php
  2. /**
  3. * @version $id:common.inc.php 3 17:44 2010-11-23 tianya $
  4. * @package DedeBIZ.Libraries
  5. * @copyright Copyright (c) 2022 DedeBIZ.COM
  6. * @license https://www.dedebiz.com/license
  7. * @link https://www.dedebiz.com
  8. */
  9. //系统默认运行模式为安全模式,模板管理、标签管理、数据库管理、模块管理等功能已暂停,如果您需要这些功能,DEDEBIZ_SAFE_MODE后面值`TRUE`改为`FALSE`恢复使用
  10. define('DEDEBIZ_SAFE_MODE', TRUE);
  11. //生产环境使用`production`,如果采用`dev`模式,会有一些php的报错信息提示,用于开发调试
  12. if (!defined('DEDE_ENVIRONMENT')) {
  13. define('DEDE_ENVIRONMENT', 'production');
  14. }
  15. if (!defined('DEBUG_LEVEL')) {
  16. if (DEDE_ENVIRONMENT == 'production') {
  17. define('DEBUG_LEVEL', FALSE);
  18. } else {
  19. define('DEBUG_LEVEL', TRUE);
  20. }
  21. }
  22. if (DEDE_ENVIRONMENT == 'production') {
  23. ini_set('display_errors', 0);
  24. if (version_compare(PHP_VERSION, '5.3', '>='))
  25. {
  26. error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
  27. } else {
  28. error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
  29. }
  30. } else {
  31. error_reporting(-1);
  32. ini_set('display_errors', 1);
  33. }
  34. define('DEDEINC', str_replace("\\", '/', dirname(__FILE__)));
  35. define('DEDEROOT', str_replace("\\", '/', substr(DEDEINC, 0, -6))); //站点根目录
  36. define('DEDEDATA', substr(DEDEINC, 0, -6).'data');
  37. define('DEDESTATIC', DEDEROOT.'/static');
  38. define('DEDEMEMBER', DEDEROOT.'/user');
  39. define('DEDETEMPLATE', DEDEROOT.'/theme');
  40. define('DEDEBIZURL', "http://127.0.0.1:8898");//DedeBiz商业支持
  41. define('DEDEBIZCDN', "https://cdn.dedebiz.com");//DedeBizCDN镜像
  42. define('DEDEVER', 6);//当前系统大版本
  43. define('DEDEPUB', '
  44. -----BEGIN PUBLIC KEY-----
  45. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvupO2Lixns34bBqwTzK0
  46. 9wA9sfGBdgc03zh1sUacieJBikx08e7xmkJbMF81jb/YfNGW/+iJ3qHULdc9Dtd3
  47. +FsnHG+tUDnzjkPnVVmnrjucQqfHRRVKKAgXOWxtuRKUVF3NDjiJtDAf5Y2BMAhw
  48. oqzeepye5I4mWyO4A8/V2ougO+xDK426MIf1dq+W59NVZj8k+zeZrbPh7+fPFw4u
  49. PwAMpkTJJ9nwNOO6saH2eMGaQ3oxZIQ+SmminDB8miI/+hwIn2hNmaHFuur0OGlB
  50. NQabUzX9JoYtXqPcpZRT7ymHrppU0KFdUSEJiW0utTWJo0HrDOBIT5qWlM0MP9p/
  51. PwIDAQAB
  52. -----END PUBLIC KEY-----
  53. ');//DedeBIZ系统公钥
  54. define('DEDECDNURL', 'https://cdn.dedebiz.com');//默认静态资源地址
  55. if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
  56. if (!function_exists('session_register')) {
  57. function session_register()
  58. {
  59. $args = func_get_args();
  60. foreach ($args as $key) {
  61. $_SESSION[$key] = $GLOBALS[$key];
  62. }
  63. }
  64. function session_is_registered($key)
  65. {
  66. return isset($_SESSION[$key]);
  67. }
  68. function session_unregister($key)
  69. {
  70. unset($_SESSION[$key]);
  71. }
  72. }
  73. }
  74. //是否启用mb_substr替换cn_substr来提高效率
  75. $cfg_is_mb = $cfg_is_iconv = FALSE;
  76. if (function_exists('mb_substr')) $cfg_is_mb = TRUE;
  77. if (function_exists('iconv_substr')) $cfg_is_iconv = TRUE;
  78. function _RunMagicQuotes(&$svar)
  79. {
  80. if (is_array($svar)) {
  81. foreach ($svar as $_k => $_v) {
  82. if ($_k == 'nvarname') continue;
  83. _RunMagicQuotes($_k);
  84. $svar[$_k] = _RunMagicQuotes($_v);
  85. }
  86. } else {
  87. if (strlen($svar) > 0 && preg_match('#^(cfg_|GLOBALS|_GET|_REQUEST|_POST|_COOKIE|_SESSION)#', $svar)) {
  88. exit('Request var not allow!');
  89. }
  90. $svar = addslashes($svar);
  91. }
  92. return $svar;
  93. }
  94. foreach (array('_GET', '_POST', '_COOKIE') as $_req) {
  95. foreach ($$_req as $_k => $_v) {
  96. if ($_k == 'nvarname') ${$_k} = $_v;
  97. else ${$_k} = _RunMagicQuotes($_v);
  98. }
  99. }
  100. //系统相关变量检测
  101. if (!isset($needFilter)) {
  102. $needFilter = false;
  103. }
  104. $registerGlobals = @ini_get("register_globals");
  105. $isUrlOpen = @ini_get("allow_url_fopen");
  106. $isSafeMode = @ini_get("safe_mode");
  107. if (preg_match('/windows/i', @getenv('OS'))) {
  108. $isSafeMode = false;
  109. }
  110. //系统配置参数
  111. require_once(DEDEDATA."/config.cache.inc.php");
  112. //Session保存路径
  113. $sessSaveHandler = @ini_get("session.save_handler");
  114. if ($sessSaveHandler !== "files") {
  115. @ini_set("session.save_handler", "files");
  116. }
  117. $enkey = substr(md5(substr($cfg_cookie_encode, 0, 5)), 0, 10);
  118. $sessSavePath = DEDEDATA."/sessions_{$enkey}";
  119. if (!is_dir($sessSavePath)) mkdir($sessSavePath);
  120. if (is_writeable($sessSavePath) && is_readable($sessSavePath)) {
  121. session_save_path($sessSavePath);
  122. }
  123. //转换上传的文件相关的变量及安全处理、并引用前台通用的上传函数
  124. if ($_FILES) {
  125. require_once(DEDEINC.'/uploadsafe.inc.php');
  126. }
  127. //数据库配置文件
  128. require_once(DEDEDATA.'/common.inc.php');
  129. if (!isset($cfg_dbtype)) {
  130. $cfg_dbtype = 'mysql';
  131. }
  132. //Session跨域设置
  133. if (!empty($cfg_domain_cookie)) {
  134. @session_set_cookie_params(0, '/', $cfg_domain_cookie);
  135. }
  136. //php5.1版本以上时区设置
  137. //由于这个函数对于是php5.1以下版本并无意义,因此实际上的时间调用,应该用MyDate函数调用
  138. if (PHP_VERSION > '5.1') {
  139. $time51 = $cfg_cli_time * -1;
  140. @date_default_timezone_set('Etc/GMT'.$time51);
  141. }
  142. $cfg_isUrlOpen = @ini_get("allow_url_fopen");
  143. //用户浏览的网站host
  144. if (PHP_SAPI === 'cli') {
  145. $cfg_clihost = 'https://www.dedebiz.com';
  146. } else {
  147. $cfg_clihost = 'http://'.$_SERVER['HTTP_HOST'];
  148. }
  149. //站点根目录
  150. $cfg_basedir = preg_replace('#'.$cfg_cmspath.'\/system$#i', '', DEDEINC);
  151. if ($cfg_multi_site == 'Y') {
  152. $cfg_mainsite = $cfg_basehost;
  153. } else {
  154. $cfg_mainsite = '';
  155. }
  156. //模板的存放目录
  157. $cfg_templets_dir = $cfg_cmspath.'/theme';
  158. $cfg_templeturl = $cfg_mainsite.$cfg_templets_dir;
  159. $cfg_templets_skin = empty($cfg_df_style) ? $cfg_mainsite.$cfg_templets_dir."/templets" : $cfg_mainsite.$cfg_templets_dir."/$cfg_df_style";
  160. //cms安装目录的网址
  161. $cfg_cmsurl = $cfg_mainsite.$cfg_cmspath;
  162. //插件目录,这个目录是用于存放计数器、投票、评论等程序的必要动态程序
  163. $cfg_plus_dir = $cfg_cmspath.'/apps';
  164. $cfg_phpurl = $cfg_mainsite.$cfg_plus_dir;
  165. $cfg_static_dir = $cfg_cmspath.'/static';
  166. $cfg_staticurl = $cfg_mainsite.$cfg_static_dir;
  167. $cfg_mobile_dir = $cfg_cmspath.'/m';
  168. $cfg_mobileurl = $cfg_mainsite.$cfg_mobile_dir;
  169. $cfg_data_dir = $cfg_cmspath.'/data';
  170. $cfg_dataurl = $cfg_mainsite.$cfg_data_dir;
  171. //会员目录
  172. $cfg_member_dir = $cfg_cmspath.'/user';
  173. $cfg_memberurl = $cfg_mainsite.$cfg_member_dir;
  174. //专题列表的存放路径
  175. $cfg_special = $cfg_cmspath.'/a/special';
  176. $cfg_specialurl = $cfg_mainsite.$cfg_special;
  177. //附件目录
  178. $cfg_medias_dir = $cfg_cmspath.$cfg_medias_dir;
  179. $cfg_mediasurl = $cfg_mainsite.$cfg_medias_dir;
  180. //上传的普通图片的路径,建议按默认
  181. $cfg_image_dir = $cfg_medias_dir.'/allimg';
  182. //用户投稿图片存放目录
  183. $cfg_user_dir = $cfg_medias_dir.'/userup';
  184. //上传的软件目录
  185. $cfg_soft_dir = $cfg_medias_dir.'/soft';
  186. //上传的多媒体文件目录
  187. $cfg_other_medias = $cfg_medias_dir.'/media';
  188. //软件摘要信息,请不要删除,否则系统无法正确接收系统漏洞或升级信息
  189. $cfg_version = 'V6';
  190. $cfg_version_detail = '6.0.0'; //详细版本号
  191. $cfg_soft_lang = 'utf-8';
  192. $cfg_soft_public = 'base';
  193. $cfg_softname = '得得系统';
  194. $cfg_soft_enname = 'DedeV6';
  195. $cfg_soft_devteam = 'DedeBIZ';
  196. //文档的默认命名规则
  197. $art_shortname = $cfg_df_ext = '.html';
  198. $cfg_df_namerule = '{typedir}/{aid}'.$cfg_df_ext;
  199. //新建目录的权限,如果您使用别的属性,本程不保证程序能顺利在Linux或Unix系统运行
  200. if (isset($cfg_ftp_mkdir) && $cfg_ftp_mkdir == 'Y') {
  201. $cfg_dir_purview = '0755';
  202. } else {
  203. $cfg_dir_purview = 0755;
  204. }
  205. //会员是否使用精简模式
  206. $cfg_mb_lit = 'N';
  207. //特殊全局变量
  208. $_sys_globals['curfile'] = '';
  209. $_sys_globals['typeid'] = 0;
  210. $_sys_globals['typename'] = '';
  211. $_sys_globals['aid'] = 0;
  212. if (empty($cfg_addon_savetype)) {
  213. $cfg_addon_savetype = 'Ymd';
  214. }
  215. if ($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_usermail)) {
  216. $cfg_adminemail = $cfg_smtp_usermail;
  217. }
  218. //DedeBIZ商业化组件
  219. require_once(DEDEINC.'/libraries/dedebiz.class.php');
  220. //对全局分页传递参数进行过滤
  221. if (isset($GLOBALS['PageNo'])) {
  222. $GLOBALS['PageNo'] = intval($GLOBALS['PageNo']);
  223. }
  224. if (isset($GLOBALS['TotalResult'])) {
  225. $GLOBALS['TotalResult'] = intval($GLOBALS['TotalResult']);
  226. }
  227. if (!isset($cfg_NotPrintHead)) {
  228. if (PHP_SAPI != 'cli') {
  229. header("charset={$cfg_soft_lang}");
  230. }
  231. }
  232. //自动加载类库处理
  233. if (version_compare(PHP_VERSION, '7.2.0', '>=')) {
  234. require_once(DEDEINC.'/autoload7.inc.php');
  235. } else {
  236. require_once(DEDEINC.'/autoload.inc.php');
  237. }
  238. $cfg_biz_helpUrl = DEDEBIZURL."/help";
  239. $cfg_biz_gitUrl = DEDEBIZURL."/git";
  240. $cfg_biz_dedebizUrl = DEDEBIZURL;
  241. //引入数据库类
  242. if (!defined('MYSQL_BOTH')) {
  243. define('MYSQL_BOTH', MYSQLI_BOTH);
  244. }
  245. if (!defined('MYSQL_ASSOC')) {
  246. define('MYSQL_ASSOC', MYSQLI_ASSOC);
  247. }
  248. if (!defined('MYSQL_NUM')) {
  249. define('MYSQL_NUM', MYSQLI_NUM);
  250. }
  251. //全局常用函数
  252. require_once(DEDEINC.'/common.func.php');
  253. if ($GLOBALS['cfg_dbtype'] == 'mysql' || $GLOBALS['cfg_dbtype'] == 'mysqli') {
  254. require_once(DEDEINC.'/database/dedesqli.class.php');
  255. } else {
  256. require_once(DEDEINC.'/database/dedesqlite.class.php');
  257. }
  258. //载入小助手配置,并对其进行默认初始化
  259. $cfg_helper_autoload = array(
  260. 'charset', /* 编码小助手 */
  261. 'channelunit',/* 模型单元小助手 */
  262. 'string', /* 字符串小助手 */
  263. 'time', /* 日期小助手 */
  264. 'file', /* 文件小助手 */
  265. 'util', /* 单元小助手 */
  266. 'validate', /* 数据验证小助手 */
  267. 'filter', /* 过滤器小助手 */
  268. 'cookie', /* cookies小助手 */
  269. 'debug', /* 调试小助手 */
  270. 'archive', /* 文档小助手 */
  271. 'upload', /* 上传小助手 */
  272. 'extend', /* 扩展小助手 */
  273. 'code', /* 代码小助手 */
  274. );
  275. //初始化小助手
  276. helper($cfg_helper_autoload);
  277. ?>