config.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <?php
  2. /**
  3. * ZenTaoPHP的config文件。如果更改配置,不要直接修改该文件,复制到my.php修改相应的值。
  4. * The config file of zentaophp. Don't modify this file directly, copy the item to my.php and change it.
  5. *
  6. * The author disclaims copyright to this source code. In place of
  7. * a legal notice, here is a blessing:
  8. *
  9. * May you do good and not evil.
  10. * May you find forgiveness for yourself and forgive others.
  11. * May you share freely, never taking more than you give.
  12. */
  13. /* 保证在命令行环境也能运行。Make sure to run in ztcli env. */
  14. if(!class_exists('config')){class config{}}
  15. if(!function_exists('getWebRoot')){function getWebRoot(){}}
  16. /* 基本设置。Basic settings. */
  17. $config->version = '22.1'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
  18. $config->liteVersion = '1.2'; // 迅捷版版本。 The version of Lite.
  19. $config->charset = 'UTF-8'; // ZenTaoPHP的编码。 The encoding of ZenTaoPHP.
  20. $config->cookieLife = time() + 2592000; // Cookie的生存时间。The cookie life time.
  21. $config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php.
  22. $config->webRoot = ''; // URL根目录。 The root path of the url.
  23. $config->customSession = false; // 是否开启自定义session的存储路径。Whether custom the session save path.
  24. $config->edition = 'open'; // 设置系统的edition,可选值:open|biz|max。Set edition, optional: open|biz|max.
  25. $config->tabSession = false; // 是否开启浏览器新标签独立session.
  26. $config->clientCache = false; // 是否开启客户端缓存。Whether enable client cache or not.
  27. /* 框架路由相关设置。Routing settings. */
  28. $config->requestType = 'PATH_INFO'; // 请求类型:PATH_INFO|PATHINFO2|GET。 The request type: PATH_INFO|PATH_INFO2|GET.
  29. $config->requestFix = '-'; // PATH_INFO和PATH_INFO2模式的分隔符。 The divider in the url when PATH_INFO|PATH_INFO2.
  30. $config->moduleVar = 'm'; // 请求类型为GET:模块变量名。 requestType=GET: the module var name.
  31. $config->methodVar = 'f'; // 请求类型为GET:模块变量名。 requestType=GET: the method var name.
  32. $config->viewVar = 't'; // 请求类型为GET:视图变量名。 requestType=GET: the view var name.
  33. $config->sessionVar = 'zentaosid'; // 请求类型为GET:session变量名。 requestType=GET: the session var name.
  34. $config->views = ',html,json,mhtml,xhtml,'; // 支持的视图类型。 Supported view formats.
  35. $config->visions = ',rnd,lite,or,'; // 支持的界面类型。 Supported vision formats.
  36. /* ZIN 设置。 ZIN settings. */
  37. $config->zin = new stdclass();
  38. $config->clientCache = true; // 启用客户端缓存。
  39. $config->morphUpdate = true; // 平滑更新。
  40. /* 支持的主题和语言。Supported themes and languages. */
  41. $config->themes['default'] = 'default';
  42. $config->langs['zh-cn'] = '简体';
  43. $config->langs['zh-tw'] = '繁體';
  44. $config->langs['en'] = 'English';
  45. //$config->langs['vi'] = 'Tiếng Việt';
  46. //$config->langs['ja'] = '日本語';
  47. /* 设备类型视图文件前缀。The prefix for view file for different device. */
  48. $config->devicePrefix['mhtml'] = '';
  49. $config->devicePrefix['xhtml'] = 'x.';
  50. /* 默认值设置。Default settings. */
  51. $config->default = new stdclass();
  52. $config->default->view = 'html'; //默认视图。 Default view.
  53. $config->default->lang = 'en'; //默认语言。 Default language.
  54. $config->default->theme = 'default'; //默认主题。 Default theme.
  55. $config->default->module = 'index'; //默认模块。 Default module.
  56. $config->default->method = 'index'; //默认方法。 Default method.
  57. /* 数据库设置。Database settings. */
  58. $config->db = new stdclass();
  59. $config->slaveDB = new stdclass();
  60. $config->db->persistent = false; // 是否为持续连接。 Pconnect or not.
  61. $config->db->driver = 'mysql'; // 目前只支持MySQL数据库。Must be MySQL. Don't support other database server yet.
  62. $config->db->encoding = 'UTF8'; // 数据库编码。 Encoding of database.
  63. $config->db->strictMode = true; // 默认开启MySQL的严格模式。 Turn on the strict mode of MySQL.
  64. $config->db->prefix = 'zt_'; // 数据库表名前缀。 The prefix of the table name.
  65. $config->db->enableSqlite = false; // 是否启用SQLite Enable SQLite or not.
  66. $config->slaveDBList = array(); // 支持多个从库。 Support multiple slave dbs.
  67. $config->enableDuckdb = false;
  68. $config->metricDB = new stdclass();
  69. $config->metricDB->type = 'mysql'; // 度量计算数据库类型。 The type of metric database.
  70. /* 可用域名后缀列表。Domain postfix lists. */
  71. $config->domainPostfix = "|com|com.cn|com.hk|com.tw|com.vc|edu.cn|es|";
  72. $config->domainPostfix .= "|eu|fm|gov.cn|gs|hk|im|in|info|jp|kr|la|me|";
  73. $config->domainPostfix .= "|mobi|my|name|net|net.cn|org|org.cn|pk|pro|";
  74. $config->domainPostfix .= "|sg|so|tel|tk|to|travel|tv|tw|uk|us|ws|";
  75. $config->domainPostfix .= "|ac.cn|bj.cn|sh.cn|tj.cn|cq.cn|he.cn|sn.cn|";
  76. $config->domainPostfix .= "|sx.cn|nm.cn|ln.cn|jl.cn|hl.cn|js.cn|zj.cn|";
  77. $config->domainPostfix .= "|ah.cn|fj.cn|jx.cn|sd.cn|ha.cn|hb.cn|hn.cn|";
  78. $config->domainPostfix .= "|gd.cn|gx.cn|hi.cn|sc.cn|gz.cn|yn.cn|gs.cn|pub|pw|";
  79. $config->domainPostfix .= "|qh.cn|nx.cn|xj.cn|tw.cn|hk.cn|mo.cn|xz.cn|xyz|wang|";
  80. $config->domainPostfix .= "|ae|asia|biz|cc|cd|cm|cn|co|co.jp|co.kr|co.uk|";
  81. $config->domainPostfix .= "|top|ren|club|space|tm|website|cool|company|city|email|";
  82. $config->domainPostfix .= "|market|software|ninja|bike|today|life|co.il|io|";
  83. $config->domainPostfix .= "|mn|ph|ps|tl|uz|vn|co.nz|cz|gg|gl|gr|je|md|me.uk|org.uk|pl|si|sx|vg|ag|";
  84. $config->domainPostfix .= "|bz|cl|ec|gd|gy|ht|lc|ms|mx|pe|tc|vc|ac|bi|mg|mu|sc|as|com.sb|cx|ki|nf|sh|";
  85. $config->domainPostfix .= "|rocks|social|co.com|bio|reviews|link|sexy|us.com|consulting|moda|desi|";
  86. $config->domainPostfix .= "|menu|info|events|webcam|dating|vacations|flights|cruises|global|ca|guru|";
  87. $config->domainPostfix .= "|futbol|rentals|dance|lawyer|attorney|democrat|republican|actor|condos|immobilien|";
  88. $config->domainPostfix .= "|villas|foundation|expert|works|tools|watch|zone|bargains|agency|best|solar|";
  89. $config->domainPostfix .= "|farm|pics|photo|marketing|holiday|gift|buzz|guitars|trade|construction|";
  90. $config->domainPostfix .= "|international|house|coffee|florist|rich|ceo|camp|education|repair|win|site|";
  91. /* Config for Content-Security-Policy. */
  92. $config->CSPs = array();
  93. $config->CSPs[] = "form-action 'self';connect-src 'self'";
  94. /* Config for kanban col setting */
  95. $config->colWidth = 264;
  96. $config->minColWidth = 264;
  97. $config->maxColWidth = 384;
  98. /* 系统框架配置。Framework settings. */
  99. $config->framework = new stdclass();
  100. $config->framework->autoConnectDB = true; // 是否自动连接数据库。 Whether auto connect database or not.
  101. $config->framework->multiLanguage = true; // 是否启用多语言功能。 Whether enable multi language or not.
  102. $config->framework->multiTheme = true; // 是否启用多风格功能。 Whether enable multi theme or not.
  103. $config->framework->multiSite = false; // 是否启用多站点模式。 Whether enable multi site mode or not.
  104. $config->framework->extensionLevel = 1; // 0=>无扩展,1=>公共扩展,2=>站点扩展 0=>no extension, 1=> common extension, 2=> every site has it's extension.
  105. $config->framework->jsWithPrefix = false; // js::set()输出的时候是否增加前缀。 When us js::set(), add prefix or not.
  106. $config->framework->filterBadKeys = true; // 是否过滤不合要求的键值。 Whether filter bad keys or not.
  107. $config->framework->filterTrojan = true; // 是否过滤木马攻击代码。 Whether strip trojan code or not.
  108. $config->framework->filterXSS = true; // 是否过滤XSS攻击代码。 Whether strip xss code or not.
  109. $config->framework->filterParam = 2; // 1=>默认过滤,2=>开启过滤参数功能。0=>default filter 2=>Whether strip param.
  110. $config->framework->purifier = true; // 是否对数据做purifier处理。 Whether purifier data or not.
  111. $config->framework->logDays = 14; // 日志文件保存的天数。 The days to save log files.
  112. $config->framework->autoRepairTable = true;
  113. $config->framework->autoLang = false;
  114. $config->framework->filterCSRF = true;
  115. $config->framework->setCookieSecure = true;
  116. $config->framework->sendXCTO = true; // Send X-Content-Type-Options header.
  117. $config->framework->sendXXP = true; // Send X-XSS-Protection header.
  118. $config->framework->sendHSTS = true; // Send HTTP Strict Transport Security header.
  119. $config->framework->sendRP = true; // Send Referrer-Policy header.
  120. $config->framework->sendXPCDP = true; // Send X-Permitted-Cross-Domain-Policies header.
  121. $config->framework->sendXDO = true; // Send X-Download-Options header.
  122. $config->framework->detectDevice['zh-cn'] = true; // 在zh-cn语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
  123. $config->framework->detectDevice['zh-tw'] = true; // 在zh-tw语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
  124. $config->framework->detectDevice['en'] = true; // 在en语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
  125. $config->framework->detectDevice['de'] = true; // 在de语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
  126. $config->framework->detectDevice['fr'] = true; // 在fr语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
  127. $config->framework->detectDevice['vi'] = true; // 在vi语言情况下,是否启用设备检测功能。 Whether enable device detect or not.
  128. /* IP white list settings.*/
  129. $config->ipWhiteList = '*';
  130. $config->xFrameOptions = 'SAMEORIGIN';
  131. /* Switch for zentao features. */
  132. $config->features = new stdclass();
  133. $config->features->apiGetModel = false;
  134. $config->features->apiSQL = false;
  135. $config->features->cronSystemCall = false;
  136. $config->features->checkClient = true;
  137. /* 文件上传设置。 Upload settings. */
  138. $config->file = new stdclass();
  139. $config->file->dangers = 'php,php3,php4,phtml,php5,jsp,py,rb,asp,aspx,ashx,asa,cer,cdx,aspl,shtm,shtml,html,htm';
  140. $config->file->allowed = 'txt,doc,docx,dot,wps,wri,pdf,ppt,pptx,xls,xlsx,ett,xlt,xlsm,csv,jpg,jpeg,png,psd,gif,ico,bmp,swf,avi,rmvb,rm,mp3,mp4,3gp,flv,mov,movie,rar,zip,bz,bz2,tar,gz,mpp,rp,pdm,vsdx,vsd,sql,xmind,mm';
  141. $config->file->storageType = 'fs'; // fs or s3
  142. /* 文档多人协同配置。 Document Hocus Pocus. */
  143. $config->docHocuspocus = new stdclass();
  144. $config->docHocuspocus->enable = false;
  145. $config->docHocuspocus->http = 'http://127.0.0.1:1234';
  146. $config->docHocuspocus->websocket = 'ws://127.0.0.1:1234';
  147. /* Upload settings. */
  148. $config->allowedTags = '<p><span><h1><h2><h3><h4><h5><em><u><strong><br><ol><ul><li><img><a><b><font><hr><pre><div><table><td><th><tr><tbody><embed><style><s>';
  149. $config->accountRule = '|^[a-zA-Z0-9_]{1}[a-zA-Z0-9_\.]{1,}[a-zA-Z0-9_]{1}$|';
  150. $config->checkVersion = true; // Auto check for new version or not.
  151. /* Set the wide window size and timeout(ms). */
  152. $config->wideSize = 1400;
  153. $config->timeout = 30000;
  154. $config->maxCount = 500;
  155. $config->moreLinks = array();
  156. /* Docker Compose设置。 */
  157. $config->inCompose = strtolower((string)getenv('PROVIDER')) == 'docker';
  158. /* 渠成平台设置。CNE Api settings. */
  159. $config->inQuickon = strtolower((string)getenv('IN_QUICKON')) == 'true';
  160. $config->inContainer = strtolower((string)getenv('IS_CONTAINER')) == 'true' || strtolower((string)getenv('IN_CONTAINER')) == 'true';
  161. $config->k8space = getenv('NS_SYSTEM') ? getenv('NS_SYSTEM') : 'quickon-system';
  162. $config->k8sAppSpace = getenv('NS_APP') ? getenv('NS_APP') : 'quickon-app';
  163. $config->demoAccounts = ''; // 用于演示的账号列表,该账号安装的应用30钟后会自动删除。 In account list for demo, app instance of demo will be removed in 30 minutes.
  164. $config->demoAppLife = 30; // Demo安装的应用实例存续时长(分钟)。The minutes life of instance which demo account installed.
  165. $config->CNE = new stdclass();
  166. $config->CNE->api = new stdclass();
  167. $config->CNE->api->host = getenv('CNE_API_HOST');
  168. $config->CNE->api->auth = 'X-Auth-Token';
  169. $config->CNE->api->token = getenv('CNE_API_TOKEN'); // Please set token in my.php.
  170. $config->CNE->api->headers = array('Content-Type: application/json');
  171. $config->CNE->api->channel = 'stable';
  172. $config->CNE->app = new stdclass;
  173. $config->CNE->app->domain = 'dev.haogs.cn';
  174. $config->cloud = new stdclass;
  175. $config->cloud->api = new stdclass;
  176. $config->cloud->api->host = getenv('CLOUD_API_HOST');
  177. $config->cloud->api->auth = 'X-Auth-Token';
  178. $config->cloud->api->token = getenv('CLOUD_API_TOKEN'); // Please set token in my.php.
  179. $config->cloud->api->headers = array('Content-Type: application/json');
  180. $config->cloud->api->channel = getenv('CLOUD_DEFAULT_CHANNEL') ? getenv('CLOUD_DEFAULT_CHANNEL') : 'stable';
  181. $config->cloud->api->switchChannel = false;
  182. /* 配置参数过滤。Filter param settings. */
  183. $filterConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'filter.php';
  184. if(file_exists($filterConfig)) include $filterConfig;
  185. /* 引用数据库的配置。 Include the database config file. */
  186. $dbConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'db.php';
  187. if(file_exists($dbConfig)) include $dbConfig;
  188. /* 读取环境变量的配置。 Read the env config. */
  189. if($config->inContainer || $config->inQuickon)
  190. {
  191. $webRoot = getenv('ZT_WEB_ROOT') ? trim(getenv('ZT_WEB_ROOT'), '/') : '';
  192. $config->installed = strtolower((string)getenv('ZT_INSTALLED')) == 'true';
  193. $config->debug = (int)getenv('ZT_DEBUG');
  194. $config->requestType = getenv('ZT_REQUEST_TYPE');
  195. $config->timezone = getEnvData('ZT_TIMEZONE', 'Asia/Shanghai');
  196. $config->db->driver = getenv('ZT_DB_DRIVER');
  197. $config->db->host = getenv('ZT_DB_HOST');
  198. $config->db->port = getenv('ZT_DB_PORT');
  199. $config->db->name = getenv('ZT_DB_NAME');
  200. $config->db->user = getenv('ZT_DB_USER');
  201. $config->db->encoding = getenv('ZT_DB_ENCODING');
  202. $config->db->password = getenv('ZT_DB_PASSWORD');
  203. $config->db->prefix = getenv('ZT_DB_PREFIX');
  204. $config->webRoot = $webRoot ? "/{$webRoot}/" : '/';
  205. $config->default->lang = getEnvData('ZT_DEFAULT_LANG', 'zh-cn');
  206. }
  207. /* 引用自定义的配置。 Include the custom config file. */
  208. $myConfigRoot = (defined('RUN_MODE') and in_array(RUN_MODE, array('test', 'uitest'))) ? dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'config' : dirname(__FILE__);
  209. $myConfig = $myConfigRoot . DIRECTORY_SEPARATOR . 'my.php';
  210. if(file_exists($myConfig)) include $myConfig;
  211. /* 禅道配置文件。zentaopms settings. */
  212. $zentaopmsConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'zentaopms.php';
  213. if(file_exists($zentaopmsConfig)) include $zentaopmsConfig;
  214. /* 禅道userview配置文件。zentaopms userview settings. */
  215. $userViewConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'userview.php';
  216. if(file_exists($userViewConfig)) include $userViewConfig;
  217. /* 数据表格操作配置文件。dtable actions settings. */
  218. $actionsMapConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'actionsmap.php';
  219. if(file_exists($actionsMapConfig)) include $actionsMapConfig;
  220. /* 引用缓存的配置。 Include the cache config file. */
  221. $cacheConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cache.php';
  222. if(file_exists($cacheConfig)) include $cacheConfig;
  223. /* Include extension config files. */
  224. $extConfigFiles = glob(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ext/*.php');
  225. if($extConfigFiles) foreach($extConfigFiles as $extConfigFile) include $extConfigFile;
  226. /* Set version. */
  227. if($config->edition != 'open')
  228. {
  229. $config->version = $config->edition . $config->{$config->edition . 'Version'};
  230. if($config->edition != 'max') unset($config->maxVersion);
  231. if($config->edition != 'ipd') unset($config->ipdVersion);
  232. }
  233. else
  234. {
  235. unset($config->bizVersion);
  236. unset($config->maxVersion);
  237. unset($config->ipdVersion);
  238. }
  239. if($config->db->driver == 'mysql')
  240. {
  241. if($config->db->encoding != 'utf8mb4') $config->db->encoding = 'utf8mb4';
  242. if(!isset($config->db->collation)) $config->db->collation = '';
  243. if(strpos($config->db->collation, $config->db->encoding) !== 0) $config->db->collation = '';
  244. }
  245. /* 配置禅道工作空间。Zentao workspace settings. */
  246. $config->noWorkspace = false;