diff --git a/install/ajax.php b/install/ajax.php new file mode 100644 index 0000000..a0d9848 --- /dev/null +++ b/install/ajax.php @@ -0,0 +1,99 @@ +'配置值' + 'DB_TYPE' => 'Sqlite', + 'DB_NAME' => './Sqlite/showdoc.db.php', + 'LANG_SWITCH_ON' => true, // 开启语言包功能 + 'LANG_AUTO_DETECT' => false, // 自动侦测语言 开启多语言功能后有效 + 'DEFAULT_LANG' => '{$DEFAULT_LANG}', // 默认语言 + 'LANG_LIST' => 'zh-cn,en-us', // 允许切换的语言列表 用逗号分隔 + 'VAR_LANGUAGE' => 'l', // 默认语言切换变量 +);"; + + $ret = file_put_contents("../server/Application/Home/Conf/config.php", $config); + return $ret ; +} + +function write_js_lang(){ + $lang = $_REQUEST['lang'] ? $_REQUEST['lang'] :"zh"; + if ($lang == 'en') { + replace_file_content("../web/index.html","zh-cn","en") ; + replace_file_content("../web_src/index.html","zh-cn","en") ; + } + +} + +function replace_file_content($file , $from ,$to ){ + $content = file_get_contents($file); + $content2 = str_replace($from,$to,$content); + if ($content2) { + file_put_contents($file,$content2); + } +} diff --git a/install/common.php b/install/common.php new file mode 100644 index 0000000..1f21e53 --- /dev/null +++ b/install/common.php @@ -0,0 +1,78 @@ +$error_code,"message"=>$message)); + exit(); +} \ No newline at end of file diff --git a/install/database.php b/install/database.php new file mode 100644 index 0000000..7a4f240 --- /dev/null +++ b/install/database.php @@ -0,0 +1,212 @@ +'; + exit(); +} + +$go = 1 ; + +//检测文件权限 +if(!new_is_writeable("./")){ + echo L("not_writable_install").'
'; + $go = 0; +} +if(!new_is_writeable("../Public/Uploads")){ + echo L("not_writable_upload").'
'; + $go = 0; +} + +if(!new_is_writeable("../server/Application/Runtime")){ + echo L("not_writable_server_runtime").'
'; + $go = 0; +} + +if(!new_is_writeable("../server/Application/Common/Conf/config.php")){ + echo L("not_writable_config").'
'; + $go = 0; +} +if(!new_is_writeable("../server/Application/Home/Conf/config.php")){ + echo L("not_writable_home_config").'
'; + $go = 0; +} + +if ($cur_lang == 'en') { + if(!new_is_writeable("../web/index.html")){ + echo L("not_writable_web_docconfig").'
'; + $go = 0; + } + + if(!new_is_writeable("../web_src/index.html")){ + echo L("not_writable_web_src_docconfig").'
'; + $go = 0; + } +} + + +//检查扩展 +if(!extension_loaded("gd")){ + echo '请安装php-gd
'; + $go = 0; +} +/* +if(!extension_loaded("mcrypt")){ + echo '请安装php-mcrypt
'; + $go = 0; +} +*/ +if(!extension_loaded("mbstring")){ + echo '请安装php-mbstring
'; + $go = 0; +} + +if(!extension_loaded("zlib")){ + echo '请安装php-zlib
'; + $go = 0; +} + +if(!extension_loaded("PDO") && !extension_loaded("pdo") ){ + echo '请安装php-pdo
'; + $go = 0; +} + +/*if(extension_loaded("sqlite") || extension_loaded("sqlite3")){ + echo '请安装php-sqlite
'; + $go = 0; +} +*/ + +if (!$go) { + exit(); +} + + + +?> + + + + + + ShowDoc + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +           +
+
+ +
+ + + + + + + + diff --git a/install/index.php b/install/index.php new file mode 100644 index 0000000..ce4adec --- /dev/null +++ b/install/index.php @@ -0,0 +1,57 @@ + + + + + + + ShowDoc + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + + + + + diff --git a/install/lang.en.php b/install/lang.en.php new file mode 100644 index 0000000..b106bf8 --- /dev/null +++ b/install/lang.en.php @@ -0,0 +1,38 @@ +'Install ShowDoc', + "use_sqlite"=>'Use Sqlite Database', + "use_mysql"=>'Use Mysql Database', + "server_address"=>'Server address (e.g: localhost)', + "server_port"=>'Port(e.g:3306)', + "db_name"=>'Database Name(e.g:showdoc)', + "db_user"=>'Database Username', + "db_password"=>' Database Password', + "sqlite_tips"=>'Sqlite has supported by PHP and you just need to click the Go buttun', + "go"=>'Go', + "install_success_help"=>'Installation success!The password of the default administrator account is showdoc/123456 ,After login, you can see the management backstage access in the upper right corner.In addition, it is strongly recommended to modify the administrator password .
More help :https://www.showdoc.cc/help-en', + "home"=>'Website Home', + "FAQ"=>'FAQ', + + + "lock"=>'ShowDoc has been installed!If you want to reinstall,please delete file /install/install.lock ', + "not_writable_install"=>' Directory install is not writable !', + "not_writable_upload"=>'Directory Public/Uploads/ is not writable !', + "not_writable_runtime"=>'Directory server/Application/Runtime is not writable !', + "not_writable_server_runtime"=>'Directory server/Application/Runtime is not writable !', + "not_writable_config"=>'File server/Application/Common/Conf/config.php is not writable !', + "not_writable_home_config"=>'File server/Application/Home/Conf/config.php is not writable !', + "not_writable_sqlite"=>'Directory Sqlite is not writable !', + "not_writable_sqlite_db"=>'File Sqlite/showdoc.db.php is not writable !', + "not_writable_web_docconfig"=>'File web/index.html is not writable !', + "not_writable_web_src_docconfig"=>'File web_src/index.html is not writable !', + "install_success"=>'Installation success!Please delete the /install directory, avoid the script to be executed again', + "install_config_not_writable"=>'Fail to write config file ', + "db_wrong"=>'Database connection error', + "db_has_data"=>'Database tables already exists,please clear up and try again', + "create_table_fail"=>'Fail to create table', + "install_config_not_writable"=>'Fail to write config file', + + "require_php_version" => "require PHP > 5.3.0 ", + ); diff --git a/install/lang.zh.php b/install/lang.zh.php new file mode 100644 index 0000000..a0c204e --- /dev/null +++ b/install/lang.zh.php @@ -0,0 +1,38 @@ +'安装ShowDoc', + "use_sqlite"=>'使用Sqlite数据库', + "use_mysql"=>'使用Mysql数据库', + "server_address"=>'服务器地址,一般为localhost', + "server_port"=>'端口,一般为3306', + "db_name"=>'数据库名,建议数据库名为showdoc', + "db_user"=>'数据库用户名', + "db_password"=>'数据库密码', + "sqlite_tips"=>'PHP内置支持Sqlite数据库,你无须再配置数据库,直接点击开始即可', + "go"=>'开始', + "install_success_help"=>'安装成功!默认管理员账户密码是showdoc/123456。登录后,在右上角可以看到管理后台入口。此外,强烈建议修改管理员初始密码。若再遇到问题,可参考ShowDoc帮助文档:https://www.showdoc.cc/help', + "home"=>'进入网站首页', + "FAQ"=>'常见问题', + + + "lock"=>'本程序已经安装过!如果要解除安装锁定,则可删除install目录下的install.lock文件后再重新访问本页面', + "not_writable_install"=>'请赋予 install 目录以可写权限!', + "not_writable_upload"=>'请赋予 Public/Uploads/ 目录以可写权限!', + "not_writable_runtime"=>'请赋予 server/Application/Runtime 目录以可写权限!', + "not_writable_server_runtime"=>'请赋予 server/Application/Runtime 目录以可写权限!', + "not_writable_config"=>'请赋予 server/Application/Common/Conf/config.php 文件以可写权限!', + "not_writable_home_config"=>'请赋予 server/Application/Home/Conf/config.php 文件以可写权限!
(如果你确定赋予了文件权限但却一直看到此信息,则可考虑关闭selinux试试)', + "not_writable_sqlite"=>'请赋予 Sqlite 目录以可写权限!', + "not_writable_sqlite_db"=>'请赋予 Sqlite/showdoc.db.php 以可写权限!', + "not_writable_web_docconfig"=>'请赋予 web/index.html 以可写权限!', + "not_writable_web_src_docconfig"=>'请赋予 web_src/index.html 以可写权限!', + "install_success"=>'安装成功!建议删除install目录,以免安装脚本被再次执行。', + "install_config_not_writable"=>'安装失败,配置文件写入错误!', + "db_wrong"=>'数据库链接错误,请检查配置信息是否填写正确', + "db_has_data"=>'检测到该数据库已经存在数据。请清理后再重试', + "create_table_fail"=>'创建数据库表失败!', + "install_config_not_writable"=>'安装失败,配置文件写入错误!', + + "require_php_version" => "需要PHP5.3.0以上版本", + ); \ No newline at end of file diff --git a/install/non_interactive.php b/install/non_interactive.php new file mode 100644 index 0000000..365407d --- /dev/null +++ b/install/non_interactive.php @@ -0,0 +1,69 @@ +'配置值' + 'DB_TYPE' => 'Sqlite', + 'DB_NAME' => './Sqlite/showdoc.db.php', + 'LANG_SWITCH_ON' => true, // 开启语言包功能 + 'LANG_AUTO_DETECT' => false, // 自动侦测语言 开启多语言功能后有效 + 'DEFAULT_LANG' => '{$DEFAULT_LANG}', // 默认语言 + 'LANG_LIST' => 'zh-cn,en-us', // 允许切换的语言列表 用逗号分隔 + 'VAR_LANGUAGE' => 'l', // 默认语言切换变量 +);"; + + $ret = file_put_contents("../server/Application/Home/Conf/config.php", $config); + return $ret ; +} + +function write_js_lang(){ + $lang = $_REQUEST['lang'] ? $_REQUEST['lang'] :"zh"; + if ($lang == 'en') { + replace_file_content("../web/index.html","zh-cn","en") ; + replace_file_content("../web_src/index.html","zh-cn","en") ; + } + +} + +function replace_file_content($file , $from ,$to ){ + $content = file_get_contents($file); + $content2 = str_replace($from,$to,$content); + if ($content2) { + file_put_contents($file,$content2); + } +}