index.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. // ShowDoc安装脚本
  3. // install Showdoc
  4. //
  5. // --------
  6. // 如果你能在浏览器中看到本句话,则证明你没有安装好PHP运行环境。请先安装好PHP运行环境
  7. // --------
  8. include("common.php");
  9. // 检测PHP环境
  10. if(version_compare(PHP_VERSION,'5.3.0','<')) die(L('require_php_version'));
  11. if(file_exists('./install.lock') && $f = file_get_contents("./install.lock")){
  12. echo L("lock").'<br>';
  13. exit();
  14. }
  15. $go = 1 ;
  16. //检测文件权限
  17. if(!new_is_writeable("./")){
  18. //本安装目录需要写入lock文件
  19. echo L("not_writable_install").'<br>';
  20. $go = 0;
  21. }
  22. if(!new_is_writeable("../Public/Uploads")){
  23. echo L("not_writable_upload").'<br>';
  24. $go = 0;
  25. }
  26. if(!new_is_writeable("../server/Application/Runtime")){
  27. echo L("not_writable_server_runtime").'<br>';
  28. $go = 0;
  29. }
  30. //检查扩展
  31. if(!extension_loaded("gd")){
  32. echo '请安装php-gd<br>';
  33. $go = 0;
  34. }
  35. /*
  36. if(!extension_loaded("mcrypt")){
  37. echo '请安装php-mcrypt<br>';
  38. $go = 0;
  39. }
  40. */
  41. if(!extension_loaded("mbstring")){
  42. echo '请安装php-mbstring<br>';
  43. $go = 0;
  44. }
  45. if(!extension_loaded("zlib")){
  46. echo '请安装php-zlib<br>';
  47. $go = 0;
  48. }
  49. if(!extension_loaded("PDO") && !extension_loaded("pdo") ){
  50. echo '请安装php-pdo<br>';
  51. $go = 0;
  52. }
  53. /*if(extension_loaded("sqlite") || extension_loaded("sqlite3")){
  54. echo '请安装php-sqlite<br>';
  55. $go = 0;
  56. }
  57. */
  58. if (!$go) {
  59. exit();
  60. }
  61. ?>
  62. <!DOCTYPE html>
  63. <html lang="en">
  64. <head>
  65. <meta charset="utf-8">
  66. <title> ShowDoc</title>
  67. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  68. <meta name="description" content="">
  69. <meta name="author" content="">
  70. <style type="text/css">
  71. html,body{
  72. margin:0 0 ;
  73. padding:0 0 ;
  74. }
  75. .container{
  76. display: -webkit-flex; /* Safari */
  77. display: flex;
  78. height:100%;
  79. width:100%;
  80. position: absolute;
  81. }
  82. .flex-item{
  83. display: -webkit-inline-flex;
  84. display: inline-flex;
  85. justify-content:center; /*水平居中*/
  86. align-items: center; /*垂直居中*/
  87. }
  88. .left{
  89. width: 50%;
  90. background-color:#F59064;
  91. /* background-image: linear-gradient(to right, red, white); */
  92. height:100%;
  93. }
  94. .right{
  95. width: 50%;
  96. background-color:#87CEEB;
  97. /* background-image: linear-gradient(to left, black , white); */
  98. height:100% ;
  99. }
  100. .text{
  101. font-size:30px;
  102. cursor:pointer ;
  103. }
  104. </style>
  105. </head>
  106. <body>
  107. <div class="container">
  108. <div class="flex-item left">
  109. <div class="text" id="en">
  110. Language : English &nbsp; →
  111. </div>
  112. </div>
  113. <div class="flex-item right">
  114. <div class="text" id="zh">
  115. 语言 :中文 &nbsp; →
  116. </div>
  117. </div>
  118. </div> <!-- /container -->
  119. </body>
  120. </html>
  121. <script>
  122.  document.getElementById("en").onclick = function(){
  123. toInstall("en");
  124. }
  125. document.getElementById("zh").onclick = function(){
  126. toInstall("zh");
  127. }
  128. function toInstall (lang){
  129. //创建异步对象
  130. var xhr = new XMLHttpRequest();
  131. xhr.open("GET","ajax.php?lang="+lang,true);
  132. xhr.send();
  133. xhr.onreadystatechange = function () {
  134. // 这步为判断服务器是否正确响应
  135. if (xhr.readyState == 4 && xhr.status == 200) {
  136. var json = JSON.parse(xhr.responseText) ;
  137. // console.log(json);
  138. if(json.error_code === 0){
  139. window.location.href = "../web/";
  140. }else{
  141. alert(json.error_message)
  142. }
  143. }
  144. };
  145. }
  146. </script>