From 42b24ce507747d168c88d18acedd47071e593352 Mon Sep 17 00:00:00 2001 From: Che Kun Date: Thu, 12 Jun 2014 20:59:16 +0800 Subject: [PATCH 1/9] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4ee9029..e58ac43 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # DiliCMS +## This Project is no longer maintained! 此项目已停止更新。 + 欢迎使用DiliCMS,DiliCMS是无业务逻辑的,面向CodeIgniter开发者的自由灵活的系统,致力于为开发者提供最简单,灵活,实用的后台CMS系统。 ## 安装方法 From 3143db3d3ee31ca28b313d74c5413a27adf39a8d Mon Sep 17 00:00:00 2001 From: Che Kun Date: Tue, 9 Sep 2014 12:29:24 +0800 Subject: [PATCH 2/9] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e58ac43..4ee9029 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # DiliCMS -## This Project is no longer maintained! 此项目已停止更新。 - 欢迎使用DiliCMS,DiliCMS是无业务逻辑的,面向CodeIgniter开发者的自由灵活的系统,致力于为开发者提供最简单,灵活,实用的后台CMS系统。 ## 安装方法 From bbecd8e3d33a0c1a35185c24b1478632b737457f Mon Sep 17 00:00:00 2001 From: chekun <234267695@qq.com> Date: Thu, 13 Nov 2014 17:50:53 +0800 Subject: [PATCH 3/9] remove relavent database.php --- admin/config/database.php | 95 --------------------------------- application/config/database.php | 95 --------------------------------- 2 files changed, 190 deletions(-) delete mode 100755 admin/config/database.php delete mode 100755 application/config/database.php diff --git a/admin/config/database.php b/admin/config/database.php deleted file mode 100755 index 834aad9..0000000 --- a/admin/config/database.php +++ /dev/null @@ -1,95 +0,0 @@ -load->library('platform'); -} - -$active_group = get_instance()->platform->get_type(); -$active_record = TRUE; - -$db['default']['hostname'] = 'localhost'; -$db['default']['username'] = 'root'; -$db['default']['password'] = 'root'; -$db['default']['database'] = 'dilicms'; -$db['default']['dbdriver'] = 'mysql'; -$db['default']['dbprefix'] = 'dili_'; -$db['default']['pconnect'] = FALSE; -$db['default']['db_debug'] = TRUE; -$db['default']['cache_on'] = FALSE; -$db['default']['cachedir'] = ''; -$db['default']['char_set'] = 'utf8'; -$db['default']['dbcollat'] = 'utf8_general_ci'; -$db['default']['swap_pre'] = ''; -$db['default']['autoinit'] = TRUE; -$db['default']['stricton'] = FALSE; - -if ($active_group == 'sae') -{ - //SAE数据库设置 - $db['sae']['hostname'] = SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT; - $db['sae']['username'] = SAE_MYSQL_USER; - $db['sae']['password'] = SAE_MYSQL_PASS; - $db['sae']['database'] = SAE_MYSQL_DB; - $db['sae']['dbdriver'] = 'mysql'; - $db['sae']['dbprefix'] = 'dili_'; - $db['sae']['pconnect'] = FALSE; - $db['sae']['db_debug'] = TRUE; - $db['sae']['cache_on'] = FALSE; - $db['sae']['cachedir'] = ''; - $db['sae']['char_set'] = 'utf8'; - $db['sae']['dbcollat'] = 'utf8_general_ci'; - $db['sae']['swap_pre'] = ''; - $db['sae']['autoinit'] = TRUE; - $db['sae']['stricton'] = FALSE; -} - - - -/* End of file database.php */ -/* Location: ./application/config/database.php */ diff --git a/application/config/database.php b/application/config/database.php deleted file mode 100755 index 834aad9..0000000 --- a/application/config/database.php +++ /dev/null @@ -1,95 +0,0 @@ -load->library('platform'); -} - -$active_group = get_instance()->platform->get_type(); -$active_record = TRUE; - -$db['default']['hostname'] = 'localhost'; -$db['default']['username'] = 'root'; -$db['default']['password'] = 'root'; -$db['default']['database'] = 'dilicms'; -$db['default']['dbdriver'] = 'mysql'; -$db['default']['dbprefix'] = 'dili_'; -$db['default']['pconnect'] = FALSE; -$db['default']['db_debug'] = TRUE; -$db['default']['cache_on'] = FALSE; -$db['default']['cachedir'] = ''; -$db['default']['char_set'] = 'utf8'; -$db['default']['dbcollat'] = 'utf8_general_ci'; -$db['default']['swap_pre'] = ''; -$db['default']['autoinit'] = TRUE; -$db['default']['stricton'] = FALSE; - -if ($active_group == 'sae') -{ - //SAE数据库设置 - $db['sae']['hostname'] = SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT; - $db['sae']['username'] = SAE_MYSQL_USER; - $db['sae']['password'] = SAE_MYSQL_PASS; - $db['sae']['database'] = SAE_MYSQL_DB; - $db['sae']['dbdriver'] = 'mysql'; - $db['sae']['dbprefix'] = 'dili_'; - $db['sae']['pconnect'] = FALSE; - $db['sae']['db_debug'] = TRUE; - $db['sae']['cache_on'] = FALSE; - $db['sae']['cachedir'] = ''; - $db['sae']['char_set'] = 'utf8'; - $db['sae']['dbcollat'] = 'utf8_general_ci'; - $db['sae']['swap_pre'] = ''; - $db['sae']['autoinit'] = TRUE; - $db['sae']['stricton'] = FALSE; -} - - - -/* End of file database.php */ -/* Location: ./application/config/database.php */ From 01ada9dd19aa14e823edf290b718a0faea8c1e49 Mon Sep 17 00:00:00 2001 From: chekun <234267695@qq.com> Date: Thu, 13 Nov 2014 17:51:28 +0800 Subject: [PATCH 4/9] add database.example.php --- shared/config/database.example.php | 95 ++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 shared/config/database.example.php diff --git a/shared/config/database.example.php b/shared/config/database.example.php new file mode 100644 index 0000000..3393a4c --- /dev/null +++ b/shared/config/database.example.php @@ -0,0 +1,95 @@ +load->library('platform'); +} + +$active_group = get_instance()->platform->get_type(); +$active_record = TRUE; + +$db['default']['hostname'] = '{HOSTNAME}'; +$db['default']['username'] = '{USERNAME}'; +$db['default']['password'] = '{PASSWORD}'; +$db['default']['database'] = '{DATABASE}'; +$db['default']['dbdriver'] = 'mysql'; +$db['default']['dbprefix'] = '{PREFIX}'; +$db['default']['pconnect'] = FALSE; +$db['default']['db_debug'] = TRUE; +$db['default']['cache_on'] = FALSE; +$db['default']['cachedir'] = ''; +$db['default']['char_set'] = 'utf8'; +$db['default']['dbcollat'] = 'utf8_general_ci'; +$db['default']['swap_pre'] = ''; +$db['default']['autoinit'] = TRUE; +$db['default']['stricton'] = FALSE; + +if ($active_group == 'sae') +{ + //SAE数据库设置 + $db['sae']['hostname'] = SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT; + $db['sae']['username'] = SAE_MYSQL_USER; + $db['sae']['password'] = SAE_MYSQL_PASS; + $db['sae']['database'] = SAE_MYSQL_DB; + $db['sae']['dbdriver'] = 'mysql'; + $db['sae']['dbprefix'] = 'dili_'; + $db['sae']['pconnect'] = FALSE; + $db['sae']['db_debug'] = TRUE; + $db['sae']['cache_on'] = FALSE; + $db['sae']['cachedir'] = ''; + $db['sae']['char_set'] = 'utf8'; + $db['sae']['dbcollat'] = 'utf8_general_ci'; + $db['sae']['swap_pre'] = ''; + $db['sae']['autoinit'] = TRUE; + $db['sae']['stricton'] = FALSE; +} + + + +/* End of file database.php */ +/* Location: ./application/config/database.php */ From 3645b9fcf875e4667f091ebaaac0f7ac5989dd1b Mon Sep 17 00:00:00 2001 From: chekun <234267695@qq.com> Date: Thu, 13 Nov 2014 17:52:08 +0800 Subject: [PATCH 5/9] ignore database.php --- .gitignore | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 15f4dcc..6f27572 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .idea # ignore database config -!admin/config/database.php -!application/config/database.php +!shared/config/database.php # ignore all settings -shared/settings/* \ No newline at end of file +shared/settings/* From d33582622637d0b1c4fbeb20f757c2de048969ff Mon Sep 17 00:00:00 2001 From: chekun <234267695@qq.com> Date: Thu, 13 Nov 2014 18:13:55 +0800 Subject: [PATCH 6/9] hack ci --- system/database/DB.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/database/DB.php b/system/database/DB.php index 8314d3b..a26b909 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -30,9 +30,9 @@ function &DB($params = '', $active_record_override = NULL) if (is_string($params) AND strpos($params, '://') === FALSE) { // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php')) + if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = DILICMS_SHARE_PATH.'config/'.ENVIRONMENT.'/database.php')) { - if ( ! file_exists($file_path = APPPATH.'config/database.php')) + if ( ! file_exists($file_path = DILICMS_SHARE_PATH.'config/database.php')) { show_error('The configuration file database.php does not exist.'); } @@ -159,4 +159,4 @@ function &DB($params = '', $active_record_override = NULL) /* End of file DB.php */ -/* Location: ./system/database/DB.php */ \ No newline at end of file +/* Location: ./system/database/DB.php */ From c15b2c22a60718c476fa11aeb2bd83913605cb2e Mon Sep 17 00:00:00 2001 From: chekun <234267695@qq.com> Date: Thu, 13 Nov 2014 18:14:16 +0800 Subject: [PATCH 7/9] one database.php ok --- .gitignore | 2 +- admin/config/database_template.php | 95 ------------------------------ install/config/database.php | 2 +- install/controllers/install.php | 40 +++++++++---- 4 files changed, 32 insertions(+), 107 deletions(-) delete mode 100755 admin/config/database_template.php diff --git a/.gitignore b/.gitignore index 6f27572..2a1797f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .idea # ignore database config -!shared/config/database.php +shared/config/database.php # ignore all settings shared/settings/* diff --git a/admin/config/database_template.php b/admin/config/database_template.php deleted file mode 100755 index 6191882..0000000 --- a/admin/config/database_template.php +++ /dev/null @@ -1,95 +0,0 @@ -load->library('platform'); -} - -$active_group = get_instance()->platform->get_type(); -$active_record = TRUE; - -$db['default']['hostname'] = '{HOSTNAME}'; -$db['default']['username'] = '{USERNAME}'; -$db['default']['password'] = '{PASSWORD}'; -$db['default']['database'] = '{DATABASE}'; -$db['default']['dbdriver'] = 'mysql'; -$db['default']['dbprefix'] = '{PREFIX}'; -$db['default']['pconnect'] = FALSE; -$db['default']['db_debug'] = TRUE; -$db['default']['cache_on'] = FALSE; -$db['default']['cachedir'] = ''; -$db['default']['char_set'] = 'utf8'; -$db['default']['dbcollat'] = 'utf8_general_ci'; -$db['default']['swap_pre'] = ''; -$db['default']['autoinit'] = TRUE; -$db['default']['stricton'] = FALSE; - -if ($active_group == 'sae') -{ - //SAE数据库设置 - $db['sae']['hostname'] = SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT; - $db['sae']['username'] = SAE_MYSQL_USER; - $db['sae']['password'] = SAE_MYSQL_PASS; - $db['sae']['database'] = SAE_MYSQL_DB; - $db['sae']['dbdriver'] = 'mysql'; - $db['sae']['dbprefix'] = 'dili_'; - $db['sae']['pconnect'] = FALSE; - $db['sae']['db_debug'] = TRUE; - $db['sae']['cache_on'] = FALSE; - $db['sae']['cachedir'] = ''; - $db['sae']['char_set'] = 'utf8'; - $db['sae']['dbcollat'] = 'utf8_general_ci'; - $db['sae']['swap_pre'] = ''; - $db['sae']['autoinit'] = TRUE; - $db['sae']['stricton'] = FALSE; -} - - - -/* End of file database.php */ -/* Location: ./application/config/database.php */ diff --git a/install/config/database.php b/install/config/database.php index fb6ce20..08ddf2d 100755 --- a/install/config/database.php +++ b/install/config/database.php @@ -17,7 +17,7 @@ | ['password'] The password used to connect to the database | ['database'] The name of the database you want to connect to | ['dbdriver'] The database type. ie: mysql. Currently supported: - mysql, mysqli, postgre, odbc, mssql, sqlite, oci8 + mysql, mysqli, postgre, odbc, mssql, sqlite, oci8 | ['dbprefix'] You can add an optional prefix, which will be added | to the table name when using the Active Record class | ['pconnect'] TRUE/FALSE - Whether to use a persistent connection diff --git a/install/controllers/install.php b/install/controllers/install.php index 9019aa8..8899abc 100644 --- a/install/controllers/install.php +++ b/install/controllers/install.php @@ -1,6 +1,6 @@ load->view('install'); } @@ -25,8 +25,8 @@ public function platform() { $data['is_config_ok'] = FALSE; @include BASEPATH.'../shared/config/platform.php'; - if (isset($running_platform) AND - is_array($running_platform) AND + if (isset($running_platform) AND + is_array($running_platform) AND isset($running_platform['type']) AND isset($running_platform['storage'])) { @@ -63,7 +63,7 @@ public function environment() public function database() { - $step = $this->input->post('step', TRUE); + $step = $this->input->post('step', TRUE); $platform = '普通平台'; if (is_sae()) { @@ -100,13 +100,33 @@ public function database() { $search_array = array('{HOSTNAME}', '{USERNAME}', '{PASSWORD}', '{DATABASE}', '{PREFIX}'); $replace_array = array($config['hostname'], $config['username'], $config['password'], $config['database'], $config['dbprefix']); - $database_config = str_replace($search_array, $replace_array, @file_get_contents(BASEPATH.'../admin/config/database_template.php')); - @file_put_contents(BASEPATH.'../admin/config/database.php', $database_config); - @file_put_contents(BASEPATH.'../application/config/database.php', $database_config); + $database_config = str_replace($search_array, $replace_array, @file_get_contents(BASEPATH.'../shared/config/database.example.php')); + //创建database.php + $database_config_file = BASEPATH.'../shared/config/database.php'; + if (! file_exists($database_config_file) and ! touch($database_config_file)) { + echo json_encode(array( + 'status' => 0, + 'messages' => array('额,没有权限创建shared/config/database.php文件!') + )); + return; + } + if (FALSE === file_put_contents($database_config_file, $database_config)) { + echo json_encode(array( + 'status' => 0, + 'messages' => array('额,没有权限将数据写入shared/config/database.php文件!') + )); + return; + } $database_config = str_replace("get_instance()->platform->get_type()", "PLATFORM", $database_config); - @file_put_contents(BASEPATH.'../install/config/database.php', $database_config); + if (FALSE === file_put_contents(BASEPATH.'../install/config/database.php', $database_config)) { + echo json_encode(array( + 'status' => 0, + 'messages' => array('额,没有权限将数据写入install/config/database.php文件!') + )); + return; + } } - + echo json_encode(array( 'status' => 1, 'messages' => array('所在平台: '.$platform, '数据库连接: Success') From d746700f049b766f36ac74e0b39e1c9b3e724e8d Mon Sep 17 00:00:00 2001 From: chekun <234267695@qq.com> Date: Thu, 13 Nov 2014 19:07:58 +0800 Subject: [PATCH 8/9] fix bug --- install/config/autoload.php | 4 +- install/config/database.php | 95 ------------------------------ install/controllers/install.php | 8 --- shared/config/database.example.php | 2 +- 4 files changed, 3 insertions(+), 106 deletions(-) delete mode 100755 install/config/database.php diff --git a/install/config/autoload.php b/install/config/autoload.php index 0c1f8a4..4478bbd 100755 --- a/install/config/autoload.php +++ b/install/config/autoload.php @@ -37,7 +37,7 @@ | */ -$autoload['packages'] = array(); +$autoload['packages'] = array(DILICMS_SHARE_PATH); /* @@ -113,4 +113,4 @@ /* End of file autoload.php */ -/* Location: ./application/config/autoload.php */ \ No newline at end of file +/* Location: ./application/config/autoload.php */ diff --git a/install/config/database.php b/install/config/database.php deleted file mode 100755 index 08ddf2d..0000000 --- a/install/config/database.php +++ /dev/null @@ -1,95 +0,0 @@ -load->library('platform'); -} - -$active_group = PLATFORM; -$active_record = TRUE; - -$db['default']['hostname'] = 'localhost'; -$db['default']['username'] = 'root'; -$db['default']['password'] = 'root'; -$db['default']['database'] = 'dilicms'; -$db['default']['dbdriver'] = 'mysql'; -$db['default']['dbprefix'] = 'dili_'; -$db['default']['pconnect'] = FALSE; -$db['default']['db_debug'] = TRUE; -$db['default']['cache_on'] = FALSE; -$db['default']['cachedir'] = ''; -$db['default']['char_set'] = 'utf8'; -$db['default']['dbcollat'] = 'utf8_general_ci'; -$db['default']['swap_pre'] = ''; -$db['default']['autoinit'] = TRUE; -$db['default']['stricton'] = FALSE; - -if ($active_group == 'sae') -{ - //SAE数据库设置 - $db['sae']['hostname'] = SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT; - $db['sae']['username'] = SAE_MYSQL_USER; - $db['sae']['password'] = SAE_MYSQL_PASS; - $db['sae']['database'] = SAE_MYSQL_DB; - $db['sae']['dbdriver'] = 'mysql'; - $db['sae']['dbprefix'] = 'dili_'; - $db['sae']['pconnect'] = FALSE; - $db['sae']['db_debug'] = TRUE; - $db['sae']['cache_on'] = FALSE; - $db['sae']['cachedir'] = ''; - $db['sae']['char_set'] = 'utf8'; - $db['sae']['dbcollat'] = 'utf8_general_ci'; - $db['sae']['swap_pre'] = ''; - $db['sae']['autoinit'] = TRUE; - $db['sae']['stricton'] = FALSE; -} - - - -/* End of file database.php */ -/* Location: ./application/config/database.php */ diff --git a/install/controllers/install.php b/install/controllers/install.php index 8899abc..6d7dd04 100644 --- a/install/controllers/install.php +++ b/install/controllers/install.php @@ -117,14 +117,6 @@ public function database() )); return; } - $database_config = str_replace("get_instance()->platform->get_type()", "PLATFORM", $database_config); - if (FALSE === file_put_contents(BASEPATH.'../install/config/database.php', $database_config)) { - echo json_encode(array( - 'status' => 0, - 'messages' => array('额,没有权限将数据写入install/config/database.php文件!') - )); - return; - } } echo json_encode(array( diff --git a/shared/config/database.example.php b/shared/config/database.example.php index 3393a4c..5555030 100644 --- a/shared/config/database.example.php +++ b/shared/config/database.example.php @@ -45,7 +45,7 @@ | the active record class */ -if ( ! class_exists('Platform') AND ! function_exists('is_sae')) +if ( ! class_exists('Platform')) { get_instance()->load->library('platform'); } From f8a01370f74f9e769b61ed8e729f53efce4b7208 Mon Sep 17 00:00:00 2001 From: chekun <234267695@qq.com> Date: Thu, 13 Nov 2014 19:13:00 +0800 Subject: [PATCH 9/9] add changelog --- CHANGELOG.md | 12 ++++++++++-- shared/settings/index.html | 18 +++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc3432c..9302b70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # DiliCMS更新日志 +## 版本号 2.3.2 + +> 2014年11月13日 更新内容 + +- 数据库配置文件单一化 +- 加强安装时文件写入权限的判断 +- 修复安装无法创建管理员帐号的问题 + ## 版本号 2.3.1 > 2014年3月21日 更新内容 @@ -138,7 +146,7 @@ > 2012年8月13日 更新内容 - 1.升级CI内核到2.1.2。 -- 2.目录重构,前后台分离。 +- 2.目录重构,前后台分离。 - 3.新增package:shared。 - 4.合并插件目录和自定义字段目录到extensions目录下。 - 5.代码重写,更规范,更方便阅读。 @@ -206,4 +214,4 @@ ## Version V1.0 beta1 -> 2011年6月28日 正式发布 \ No newline at end of file +> 2011年6月28日 正式发布 diff --git a/shared/settings/index.html b/shared/settings/index.html index 065d2da..c942a79 100755 --- a/shared/settings/index.html +++ b/shared/settings/index.html @@ -1,10 +1,10 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + \ No newline at end of file