Explorar el Código

Merge branch 'develop'

star7th hace 10 años
padre
commit
c9e212da69

+ 1 - 2
Application/Common/Conf/config.php

@@ -19,10 +19,9 @@ return array(
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTE_RULES'=>array(
     'URL_ROUTE_RULES'=>array(
         ':id\d'               => 'Home/Item/Show?item_id=:1',
         ':id\d'               => 'Home/Item/Show?item_id=:1',
-        ':domain\s$'               => 'Home/Item/Show?item_domain=:1',//item的个性域名
+		':domain\s$'               => 'Home/Item/Show?item_domain=:1',//item的个性域名
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
     ),
     ),
     'URL_CASE_INSENSITIVE'=>true,
     'URL_CASE_INSENSITIVE'=>true,
     'SHOW_ERROR_MSG'        =>  true,    // 显示错误信息,这样在部署模式下也能显示错误
     'SHOW_ERROR_MSG'        =>  true,    // 显示错误信息,这样在部署模式下也能显示错误
-
 );
 );

+ 2 - 2
Application/Home/Conf/config.php

@@ -1,8 +1,8 @@
-<?php
+<?php 
 return array(
 return array(
 	//'配置项'=>'配置值'
 	//'配置项'=>'配置值'
     'LANG_SWITCH_ON' => true,   // 开启语言包功能
     'LANG_SWITCH_ON' => true,   // 开启语言包功能
-    'LANG_AUTO_DETECT' => true, // 自动侦测语言 开启多语言功能后有效
+    'LANG_AUTO_DETECT' => false, // 自动侦测语言 开启多语言功能后有效
     'DEFAULT_LANG' => 'zh-cn', // 默认语言
     'DEFAULT_LANG' => 'zh-cn', // 默认语言
     'LANG_LIST'        => 'zh-cn,en-us', // 允许切换的语言列表 用逗号分隔
     'LANG_LIST'        => 'zh-cn,en-us', // 允许切换的语言列表 用逗号分隔
     'VAR_LANGUAGE'     => 'l', // 默认语言切换变量
     'VAR_LANGUAGE'     => 'l', // 默认语言切换变量

+ 14 - 0
Application/Home/Controller/IndexController.class.php

@@ -6,6 +6,20 @@ class IndexController extends BaseController {
     	$this->checkLogin(false);
     	$this->checkLogin(false);
     	$login_user = session("login_user");
     	$login_user = session("login_user");
     	$this->assign("login_user" ,$login_user);
     	$this->assign("login_user" ,$login_user);
+    	if (LANG_SET == 'en-us') {
+    		$demo_url = "http://www.showdoc.cc/demo-en";
+    		$help_url = "http://www.showdoc.cc/help-en";
+    		$creator_url = "https://github.com/star7th";
+    	}
+    	else{
+    		$demo_url = "http://www.showdoc.cc/demo";
+    		$help_url = "http://www.showdoc.cc/help";
+    		$creator_url = "http://blog.star7th.com/";
+    	}
+    	$this->assign("demo_url" ,$demo_url);
+    	$this->assign("help_url" ,$help_url);
+    	$this->assign("creator_url" ,$creator_url);
+
         $this->display();
         $this->display();
     }
     }
 }
 }

+ 22 - 3
Application/Home/Controller/ItemController.class.php

@@ -24,9 +24,18 @@ class ItemController extends BaseController {
             $this->assign("items" , $items);
             $this->assign("items" , $items);
             $this->assign("show_user" , $show_user);
             $this->assign("show_user" , $show_user);
             $this->assign("login_user" , $login_user);
             $this->assign("login_user" , $login_user);
-            $this->display();
+            
+        }
+        if (LANG_SET == 'en-us') {
+            $help_url = "http://www.showdoc.cc/help-en";
+        }
+        else{
+            $help_url = "http://www.showdoc.cc/help";
         }
         }
 
 
+        $this->assign("help_url" , $help_url);
+        $this->display();
+
     }
     }
 
 
     //新建项目
     //新建项目
@@ -43,7 +52,7 @@ class ItemController extends BaseController {
 			$item_domain = I("item_domain");
 			$item_domain = I("item_domain");
 
 
             if ($item_domain) {
             if ($item_domain) {
-                $item = D("Item")->where("item_domain = '$item_domain' ")->find();
+                $item = D("Item")->where("item_domain = '$item_domain' and item_id !='$item_id' ")->find();
                 if ($item) {
                 if ($item) {
                     //个性域名已经存在
                     //个性域名已经存在
                     $this->message(L('domain_already_exists'));
                     $this->message(L('domain_already_exists'));
@@ -141,12 +150,22 @@ class ItemController extends BaseController {
                 }
                 }
             }
             }
         }
         }
-        $share_url = get_domain().__APP__.'/'.$item_id;
+
+        $domain = $item['item_domain'] ? $item['item_domain'] : $item['item_id'];
+        $share_url = get_domain().__APP__.'/'.$domain;
 
 
         $ItemPermn = $this->checkItemPermn($uid , $item_id) ;
         $ItemPermn = $this->checkItemPermn($uid , $item_id) ;
 
 
         $ItemCreator = $this->checkItemCreator($uid , $item_id);
         $ItemCreator = $this->checkItemCreator($uid , $item_id);
 
 
+        if (LANG_SET == 'en-us') {
+            $help_url = "http://www.showdoc.cc/help-en";
+        }
+        else{
+            $help_url = "http://www.showdoc.cc/help";
+        }
+
+        $this->assign("help_url" , $help_url);
         $this->assign("current_page_id" , $current_page_id);
         $this->assign("current_page_id" , $current_page_id);
         $this->assign("keyword" , $keyword);
         $this->assign("keyword" , $keyword);
         $this->assign("ItemPermn" , $ItemPermn);
         $this->assign("ItemPermn" , $ItemPermn);

+ 3 - 3
Application/Home/View/Index/index.html

@@ -43,15 +43,15 @@
 		      data-slide="next">&rsaquo;</a>
 		      data-slide="next">&rsaquo;</a>
 		</div>
 		</div>
 		<p class="text-center">
 		<p class="text-center">
-			<a class="btn btn-primary  btn-large" href="http://doc.star7th.com/2" target="_blank">Demo</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-			<a class="btn  btn-large" href="http://doc.star7th.com/3" target="_blank" >{$Think.Lang.help}&nbsp;<i class="icon-circle-arrow-right"></i></a>
+			<a class="btn btn-primary  btn-large" href="{$demo_url}" target="_blank">Demo</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+			<a class="btn  btn-large" href="{$help_url}" target="_blank" >{$Think.Lang.help}&nbsp;<i class="icon-circle-arrow-right"></i></a>
 		</p>
 		</p>
 
 
       <hr>
       <hr>
 
 
 
 
       <div class="footer">
       <div class="footer">
-        <p>&copy; Created By <a href="http://blog.star7th.com/" target="_blank"> Star7th</a></p>
+        <p>&copy; Created By <a href="{$creator_url}" target="_blank">Star7th</a></p>
       </div>
       </div>
 
 
     </div> <!-- /container -->
     </div> <!-- /container -->

+ 1 - 1
Application/Home/View/Item/show.html

@@ -33,7 +33,7 @@
 
 
       <if condition="! $login_user">
       <if condition="! $login_user">
         <li ><a href="{:U('Home/User/login')}">{$Think.Lang.login_or_register}</a></li>
         <li ><a href="{:U('Home/User/login')}">{$Think.Lang.login_or_register}</a></li>
-        <li ><a href="http://doc.star7th.com/3" target="_blank">{$Think.Lang.about_showdoc}</a></li>
+        <li ><a href="{$help_url}" target="_blank">{$Think.Lang.about_showdoc}</a></li>
         <else />
         <else />
         <li><a href="{:U('Home/Item/index')}">{$Think.Lang.my_item}</a></li>
         <li><a href="{:U('Home/Item/index')}">{$Think.Lang.my_item}</a></li>
       </if>
       </if>

+ 1 - 1
Application/Home/View/Item/showbyuid.html

@@ -34,7 +34,7 @@
           </if>
           </if>
           
           
           
           
-          <li><a href="http://doc.star7th.com/3" target="_blank">{$Think.Lang.about_showdoc}</a></li>
+          <li><a href="{$help_url}" target="_blank">{$Think.Lang.about_showdoc}</a></li>
 
 
         </ul>
         </ul>
         </div>
         </div>

+ 5 - 5
README.md

@@ -1,4 +1,4 @@
-## 中文版教程:http://doc.star7th.com/3
+## 中文版教程:http://www.showdoc.cc/help
 ***
 ***
 ### What is ShowDoc ?
 ### What is ShowDoc ?
 
 
@@ -12,15 +12,15 @@ ShowDoc is a tool greatly applicable for an IT team to share documents online. I
 
 
 ### What can it be used for?
 ### What can it be used for?
 
 
-- #### API Document ( [Demo](http://doc.star7th.com/3276))
+- #### API Document ( [Demo](http://www.showdoc.cc/demo-en))
  
  
  With the development of mobile Internet, BaaS (Backend as a Service) becomes more and more popular. The Server end provides API, and the APP end or Webpage frontend can invoke data conveniently. Using ShowDoc can compile exquisite API documents in a very fast and convenient way.
  With the development of mobile Internet, BaaS (Backend as a Service) becomes more and more popular. The Server end provides API, and the APP end or Webpage frontend can invoke data conveniently. Using ShowDoc can compile exquisite API documents in a very fast and convenient way.
 
 
-- #### Data Dictionary ( [Demo](http://doc.star7th.com/3276))
+- #### Data Dictionary ( [Demo](http://www.showdoc.cc/demo-en))
  
  
  A good Data Dictionary can easily exhibit database structure to other people, such as definition of each field and the like.
  A good Data Dictionary can easily exhibit database structure to other people, such as definition of each field and the like.
 
 
-- #### Explanation Document ( [Demo](http://doc.star7th.com/3097))
+- #### Explanation Document ( [Demo](http://www.showdoc.cc/help-en))
  
  
  You can absolutely use ShowDoc to compile the explanation documents for some tools, as well as to compile some technical specifications explanation documents for the team to look up.
  You can absolutely use ShowDoc to compile the explanation documents for some tools, as well as to compile some technical specifications explanation documents for the team to look up.
  
  
@@ -61,7 +61,7 @@ ShowDoc is a tool greatly applicable for an IT team to share documents online. I
 ### Deploy It to Your Own Server
 ### Deploy It to Your Own Server
  - ShowDoc Deploy Manual
  - ShowDoc Deploy Manual
   
   
-     Please refer to:[http://doc.star7th.com/3097&page_id=16975](http://doc.star7th.com/3097&page_id=16975)
+     Please refer to:[http://www.showdoc.cc/help-en?page_id=16975](http://www.showdoc.cc/help-en?page_id=16975)
   
   
 
 
 ### Copyright 
 ### Copyright 

+ 46 - 73
install/ajax.php

@@ -5,36 +5,40 @@
 ini_set("display_errors", "Off");
 ini_set("display_errors", "Off");
 error_reporting(E_ALL | E_STRICT);
 error_reporting(E_ALL | E_STRICT);
 header("Content-type: text/html; charset=utf-8"); 
 header("Content-type: text/html; charset=utf-8"); 
-
+include("common.php");
 if($f = file_get_contents("./install.lock")){
 if($f = file_get_contents("./install.lock")){
-	ajax_out("本程序已经安装过!如果要解除安装锁定,则可删除/install目录下的install.lock文件后再重新访问本页面",10099);
+	ajax_out(L("lock"),10099);
 }
 }
 
 
 if(!new_is_writeable("./")){
 if(!new_is_writeable("./")){
-	ajax_out("请赋予 /install 目录以可写权限!",10098);
+	ajax_out(L("not_writable_install"),10098);
 }
 }
 
 
 if(!new_is_writeable("../Public/Uploads")){
 if(!new_is_writeable("../Public/Uploads")){
-	ajax_out("请赋予 /Public/Uploads/ 目录以可写权限!",10098);
+	ajax_out(L("not_writable_upload"),10098);
 }
 }
 
 
 if(!new_is_writeable("../Application/Runtime")){
 if(!new_is_writeable("../Application/Runtime")){
-	ajax_out("请赋予 /Application/Runtime 目录以可写权限!",10095);
+	ajax_out(L("not_writable_runtime"),10095);
 }
 }
 
 
 if(!new_is_writeable("../Application/Common/Conf/config.php")){
 if(!new_is_writeable("../Application/Common/Conf/config.php")){
-	ajax_out("请赋予 /Application/Common/Conf/config.php 文件以可写权限!",10094);
+	ajax_out(L("not_writable_config"),10094);
+}
+
+if(!new_is_writeable("../Application/Home/Conf/config.php")){
+	ajax_out(L("not_writable_home_config"),10098);
 }
 }
 
 
 
 
 $db_type = $_POST["db_type"] ?  $_POST["db_type"] :"sqlite";
 $db_type = $_POST["db_type"] ?  $_POST["db_type"] :"sqlite";
 if ($db_type == "sqlite") {
 if ($db_type == "sqlite") {
 	if(!new_is_writeable("../Sqlite")){
 	if(!new_is_writeable("../Sqlite")){
-		ajax_out("请赋予 /Sqlite 目录以可写权限!",10097);
+		ajax_out(L("not_writable_sqlite"),10097);
 	}
 	}
 
 
 	if(!new_is_writeable("../Sqlite/showdoc.db.php")){
 	if(!new_is_writeable("../Sqlite/showdoc.db.php")){
-		ajax_out("请赋予 /Sqlite/showdoc.db.php 以可写权限!",10096);
+		ajax_out(L("not_writable_sqlite_db"),10096);
 	}
 	}
     user_sqlite();
     user_sqlite();
 }
 }
@@ -43,6 +47,7 @@ elseif ($db_type == "mysql") {
 }
 }
 function user_sqlite(){
 function user_sqlite(){
         clear_runtime();//清除缓存
         clear_runtime();//清除缓存
+        write_home_config();
         $config = 
         $config = 
 <<<EOD
 <<<EOD
 <?php
 <?php
@@ -66,6 +71,7 @@ return array(
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTE_RULES'=>array(
     'URL_ROUTE_RULES'=>array(
         ':id\d'               => 'Home/Item/Show?item_id=:1',
         ':id\d'               => 'Home/Item/Show?item_id=:1',
+		':domain\s$'               => 'Home/Item/Show?item_domain=:1',//item的个性域名
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
     ),
     ),
     'URL_CASE_INSENSITIVE'=>true,
     'URL_CASE_INSENSITIVE'=>true,
@@ -74,10 +80,10 @@ return array(
 EOD;
 EOD;
         $ret = file_put_contents("../Application/Common/Conf/config.php", $config);
         $ret = file_put_contents("../Application/Common/Conf/config.php", $config);
         if ($ret) {
         if ($ret) {
-        	file_put_contents("./install.lock","http://doc.star7th.com/");
-            ajax_out("安装成功!建议删除/install目录,以免安装脚本被再次执行。");
+        	file_put_contents("./install.lock","http://www.showdoc.cc/");
+            ajax_out(L("install_success"));
         }else{
         }else{
-            ajax_out("安装失败,配置文件写入错误!",10001);
+            ajax_out(L("install_config_not_writable"),10001);
         }
         }
 }
 }
 
 
@@ -94,23 +100,25 @@ function user_mysql(){
 
 
         $con = mysqli_connect($db_host,$db_user,$db_password,$db_name,$db_port);
         $con = mysqli_connect($db_host,$db_user,$db_password,$db_name,$db_port);
         if (!$con ) {
         if (!$con ) {
-           ajax_out("数据库链接错误,请检查配置信息是否填写正确",10002);
+           ajax_out(L("db_wrong"),10002);
            exit();
            exit();
         }
         }
         mysqli_query($con, "SET NAMES UTF8");
         mysqli_query($con, "SET NAMES UTF8");
         $row = mysqli_fetch_array(mysqli_query($con, " SELECT COUNT(*) FROM user "));
         $row = mysqli_fetch_array(mysqli_query($con, " SELECT COUNT(*) FROM user "));
         
         
         if ($row) {
         if ($row) {
-           ajax_out("检测到该数据库已经存在数据。请清理后再重试",10003);
+           ajax_out(L("db_has_data"),10003);
            exit();
            exit();
         }
         }
         
         
         //开始导入mysql数据库 
         //开始导入mysql数据库 
         $ret = import_mysql($con);
         $ret = import_mysql($con);
         if (!$ret) {
         if (!$ret) {
-           ajax_out("创建数据库表失败!",10004);
+           ajax_out(L("create_table_fail"),10004);
            exit();
            exit();
-        }       
+        }
+
+        write_home_config();
 
 
         $config = "<?php ";
         $config = "<?php ";
         $config .= "
         $config .= "
@@ -134,6 +142,7 @@ return array(
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTE_RULES'=>array(
     'URL_ROUTE_RULES'=>array(
         ':id\d'               => 'Home/Item/Show?item_id=:1',
         ':id\d'               => 'Home/Item/Show?item_id=:1',
+		':domain\s$'               => 'Home/Item/Show?item_domain=:1',//item的个性域名
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
     ),
     ),
     'URL_CASE_INSENSITIVE'=>true,
     'URL_CASE_INSENSITIVE'=>true,
@@ -143,44 +152,13 @@ return array(
 
 
 
 
         if ($ret) {
         if ($ret) {
-        	file_put_contents("./install.lock","http://doc.star7th.com/");
-            ajax_out("安装成功!建议删除/install目录,以免安装脚本被再次执行。");
+        	file_put_contents("./install.lock","http://www.showdoc.cc/");
+            ajax_out(L("install_success"));
         }else{
         }else{
-            ajax_out("安装失败,配置文件写入错误!",10001);
+            ajax_out(L("install_config_not_writable"),10001);
         }
         }
 }
 }
 
 
-
-function ajax_out($message,$error_code = 0){
-        echo json_encode(array("error_code"=>$error_code,"message"=>$message));
-        exit();
-}
-
-function clear_runtime($path = "../Application/Runtime"){  
-    //给定的目录不是一个文件夹  
-    if(!is_dir($path)){  
-        return null;  
-    }  
-  
-    $fh = opendir($path);  
-    while(($row = readdir($fh)) !== false){  
-        //过滤掉虚拟目录  
-        if($row == '.' || $row == '..'|| $row == 'index.html'){  
-            continue;  
-        }  
-  
-        if(!is_dir($path.'/'.$row)){
-            unlink($path.'/'.$row);  
-        }  
-        clear_runtime($path.'/'.$row);  
-          
-    }  
-    //关闭目录句柄,否则出Permission denied  
-    closedir($fh);    
-    return true;  
-} 
-
-
 function import_mysql($con){
 function import_mysql($con){
 
 
 	//创建目录表
 	//创建目录表
@@ -206,6 +184,7 @@ function import_mysql($con){
 	`uid` int(10) NOT NULL DEFAULT '0',
 	`uid` int(10) NOT NULL DEFAULT '0',
 	`username` varchar(50) NOT NULL DEFAULT '',
 	`username` varchar(50) NOT NULL DEFAULT '',
 	`password` varchar(50) NOT NULL DEFAULT '',
 	`password` varchar(50) NOT NULL DEFAULT '',
+	`item_domain` varchar(50) NOT NULL DEFAULT '',
 	`addtime` int(11) NOT NULL DEFAULT '0',
 	`addtime` int(11) NOT NULL DEFAULT '0',
 	`last_update_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后更新时间',
 	`last_update_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后更新时间',
 	PRIMARY KEY (`item_id`),
 	PRIMARY KEY (`item_id`),
@@ -287,30 +266,24 @@ function import_mysql($con){
 
 
 }
 }
 
 
-/**
- * 判断 文件/目录 是否可写(取代系统自带的 is_writeable 函数)
- *
- * @param string $file 文件/目录
- * @return boolean
- */
-function new_is_writeable($file) {
-	if (is_dir($file)){
-		$dir = $file;
-		if ($fp = @fopen("$dir/test.txt", 'w')) {
-			@fclose($fp);
-			@unlink("$dir/test.txt");
-			$writeable = 1;
-		} else {
-			$writeable = 0;
-		}
-	} else {
-		if ($fp = @fopen($file, 'a+')) {
-			@fclose($fp);
-			$writeable = 1;
-		} else {
-			$writeable = 0;
-		}
+function write_home_config(){
+	$lang = $_REQUEST['lang'] ? $_REQUEST['lang'] :"zh";
+	if ($lang == 'en') {
+		$DEFAULT_LANG = 'en-us';
+	}else{
+		$DEFAULT_LANG = 'zh-cn';
 	}
 	}
+        $config = "<?php ";
+        $config .= "
+return array(
+	//'配置项'=>'配置值'
+    '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("../Application/Home/Conf/config.php", $config);
 
 
-	return $writeable;
 }
 }

+ 75 - 0
install/common.php

@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * 判断语言
+ */
+
+function lang(){
+  $lang = $_REQUEST['lang'] ? $_REQUEST['lang'] :"zh";
+  return include("lang.".$lang.".php");
+}
+
+
+function L($field){
+  if (!isset($GLOBALS['lang'])) {
+      $GLOBALS['lang'] = lang();
+  }
+  return $GLOBALS['lang'][$field] ;
+}
+
+/**
+ * 判断 文件/目录 是否可写(取代系统自带的 is_writeable 函数)
+ *
+ * @param string $file 文件/目录
+ * @return boolean
+ */
+function new_is_writeable($file) {
+  if (is_dir($file)){
+    $dir = $file;
+    if ($fp = @fopen("$dir/test.txt", 'w')) {
+      @fclose($fp);
+      @unlink("$dir/test.txt");
+      $writeable = 1;
+    } else {
+      $writeable = 0;
+    }
+  } else {
+    if ($fp = @fopen($file, 'a+')) {
+      @fclose($fp);
+      $writeable = 1;
+    } else {
+      $writeable = 0;
+    }
+  }
+
+  return $writeable;
+}
+
+function clear_runtime($path = "../Application/Runtime"){  
+    //给定的目录不是一个文件夹  
+    if(!is_dir($path)){  
+        return null;  
+    }  
+  
+    $fh = opendir($path);  
+    while(($row = readdir($fh)) !== false){  
+        //过滤掉虚拟目录  
+        if($row == '.' || $row == '..'|| $row == 'index.html'){  
+            continue;  
+        }  
+  
+        if(!is_dir($path.'/'.$row)){
+            unlink($path.'/'.$row);  
+        }  
+        clear_runtime($path.'/'.$row);  
+          
+    }  
+    //关闭目录句柄,否则出Permission denied  
+    closedir($fh);    
+    return true;  
+} 
+
+function ajax_out($message,$error_code = 0){
+        echo json_encode(array("error_code"=>$error_code,"message"=>$message));
+        exit();
+}

+ 111 - 0
install/database.php

@@ -0,0 +1,111 @@
+<?php
+// ShowDoc安装脚本
+// install Showdoc
+// 
+// --------
+// 	如果你能在浏览器中看到本句话,则证明你没有安装好PHP运行环境。请先安装好PHP运行环境
+// --------
+include("common.php");
+$cur_lang = $_REQUEST['lang'] ? $_REQUEST['lang'] :"zh";
+
+?>
+
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title> ShowDoc</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link href="../Public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+    <style type="text/css">
+    @charset "utf-8";
+	body {
+		font:14px/1.5 "Microsoft Yahei","微软雅黑",Tahoma,Arial,Helvetica,STHeiti;
+	}
+    </style>
+
+  </head>
+  <body>
+<link rel="stylesheet" href="../Public/css/login.css" />
+
+    <div class="container">
+
+      <form class="form-signin" method="post">
+        <h3 class="form-signin-heading"><?php echo L("install_title");?></h3>
+        <br>
+        <div>
+	        <select id="db_type">
+	        	<option value="sqlite"><?php echo L("use_sqlite");?></option>
+	        	<option value="mysql"><?php echo L("use_mysql");?></option>
+	        </select>
+        </div>
+        <br>
+        <div class="mysql-info" style="display:none">
+	        <input type="text" class="input-block-level"  name="db_host" id = "db_host" placeholder="<?php echo L("server_address");?>">
+	        <input type="text" class="input-block-level"  name="db_port" id = "db_port"  placeholder="<?php echo L("server_port");?>">
+	        <input type="text" class="input-block-level"  name="db_name" id = "db_name"  placeholder="<?php echo L("db_name");?>">
+	        <input type="text" class="input-block-level"  name="db_user" id = "db_user"  placeholder="<?php echo L("db_user");?>">
+	        <input type="text" class="input-block-level"  name="db_password" id = "db_password"  placeholder="<?php echo L("db_password");?>">
+        </div>
+        <div class="sqlite_tips" ><?php echo L("sqlite_tips");?></div>
+        <input type="hidden" value="<?php echo $cur_lang;?>" id="lang">
+        <br>
+        <div>
+        	 <button class="btn btn-large btn-primary " id="start" type="submit"><?php echo L("go");?>&nbsp;&nbsp;<i class="icon-circle-arrow-right"></i></button>
+          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.showdoc.cc/help?page_id=16118" target="_blank"><?php echo L("FAQ");?></a>
+        </div>
+      </form>
+
+    </div> <!-- /container -->
+
+    
+	<script src="../Public/js/common/jquery.min.js"></script>
+    <script src="../Public/bootstrap/js/bootstrap.min.js"></script>
+  </body>
+</html> 
+
+ <script type="text/javascript">
+ $(function(){
+ 	$("#db_type").change(function(){
+ 		if ($("#db_type").val() == 'mysql') {
+      $(".mysql-info").show();
+ 			$(".sqlite_tips").hide();
+ 		};
+ 		if ($("#db_type").val() == 'sqlite') {
+      $(".mysql-info").hide();
+      $(".sqlite_tips").show();
+ 		};
+ 	});
+
+ 	$("#start").click(function(){
+ 		var db_type = $("#db_type").val();
+ 		var db_host = $("#db_host").val();
+ 		var db_port = $("#db_port").val();
+ 		var db_name = $("#db_name").val();
+    var db_user = $("#db_user").val();
+ 		var lang = $("#lang").val();
+ 		var db_password = $("#db_password").val();
+ 		$.post(
+ 			'ajax.php',
+ 			{"lang":lang,"db_type":db_type,"db_host":db_host,"db_port":db_port,"db_name":db_name,"db_user":db_user,"db_password":db_password},
+ 			function(data){
+ 				if (data.error_code === 0) {
+ 					//安装成功
+			 		//alert(data.message);
+          var text = '<div><?php echo L("install_success_help");?></div><br>';
+			 		 text += '<div><a href="../" ><?php echo L("home");?></a></div>';
+           $(".form-signin").html(text);
+ 				}else{
+ 					alert(data.message);
+ 				}
+ 			},
+ 			"json"
+
+ 			);
+
+ 		return false;
+ 	});
+ });
+</script>

+ 7 - 58
install/index.php

@@ -5,6 +5,7 @@
 // --------
 // --------
 // 	如果你能在浏览器中看到本句话,则证明你没有安装好PHP运行环境。请先安装好PHP运行环境
 // 	如果你能在浏览器中看到本句话,则证明你没有安装好PHP运行环境。请先安装好PHP运行环境
 // --------
 // --------
+include("common.php");
 
 
 ?>
 ?>
 
 
@@ -30,29 +31,20 @@
 
 
     <div class="container">
     <div class="container">
 
 
-      <form class="form-signin" method="post">
-        <h3 class="form-signin-heading">安装ShowDoc</h3>
+      <form class="form-signin" method="get" action="database.php">
+        <h3 class="form-signin-heading">选择语言<br>(Choose language)</h3>
         <br>
         <br>
         <div>
         <div>
-	        <select id="db_type">
-	        	<option value="sqlite">使用Sqlite数据库</option>
-	        	<option value="mysql">使用Mysql数据库</option>
+	        <select id="db_type" name="lang">
+	        	<option value="zh">中文</option>
+	        	<option value="en">English</option>
 	        </select>
 	        </select>
         </div>
         </div>
         <br>
         <br>
-        <div class="mysql-info" style="display:none">
-	        <input type="text" class="input-block-level"  name="db_host" id = "db_host" placeholder="服务器地址,一般为localhost">
-	        <input type="text" class="input-block-level"  name="db_port" id = "db_port"  placeholder="端口,一般为3306">
-	        <input type="text" class="input-block-level"  name="db_name" id = "db_name"  placeholder="数据库名,建议数据库名为showdoc">
-	        <input type="text" class="input-block-level"  name="db_user" id = "db_user"  placeholder="数据库用户名">
-	        <input type="text" class="input-block-level"  name="db_password" id = "db_password"  placeholder="数据库密码">
-        </div>
-
-        <div class="sqlite_tips" >PHP内置支持Sqlite数据库,你无须再配置数据库,直接点击开始即可</div>
 
 
         <br>
         <br>
         <div>
         <div>
-        	 <button class="btn btn-large btn-primary " id="start" type="submit">开始&nbsp;&nbsp;<i class="icon-circle-arrow-right"></i></button>
+        	 <button class="btn btn-large btn-primary " id="start" type="submit">ok&nbsp;&nbsp;<i class="icon-circle-arrow-right"></i></button>
         </div>
         </div>
       </form>
       </form>
 
 
@@ -63,46 +55,3 @@
     <script src="../Public/bootstrap/js/bootstrap.min.js"></script>
     <script src="../Public/bootstrap/js/bootstrap.min.js"></script>
   </body>
   </body>
 </html> 
 </html> 
-
- <script type="text/javascript">
- $(function(){
- 	$("#db_type").change(function(){
- 		if ($("#db_type").val() == 'mysql') {
-      $(".mysql-info").show();
- 			$(".sqlite_tips").hide();
- 		};
- 		if ($("#db_type").val() == 'sqlite') {
-      $(".mysql-info").hide();
-      $(".sqlite_tips").show();
- 		};
- 	});
-
- 	$("#start").click(function(){
- 		var db_type = $("#db_type").val();
- 		var db_host = $("#db_host").val();
- 		var db_port = $("#db_port").val();
- 		var db_name = $("#db_name").val();
- 		var db_user = $("#db_user").val();
- 		var db_password = $("#db_password").val();
- 		$.post(
- 			'ajax.php',
- 			{"db_type":db_type,"db_host":db_host,"db_port":db_port,"db_name":db_name,"db_user":db_user,"db_password":db_password},
- 			function(data){
- 				if (data.error_code === 0) {
- 					//安装成功
-			 		//alert(data.message);
-          var text = '<div>安装成功!建议删除/install目录,以免安装脚本被再次执行。若再遇到问题,可参考ShowDoc帮助文档:<a href="http://doc.star7th.com/3" target="_blank">http://doc.star7th.com/3</a></div><br>';
-			 		 text += '<div><a href="../" >进入网站首页</a></div>';
-           $(".form-signin").html(text);
- 				}else{
- 					alert(data.message);
- 				}
- 			},
- 			"json"
-
- 			);
-
- 		return false;
- 	});
- });
-</script>

+ 34 - 0
install/lang.en.php

@@ -0,0 +1,34 @@
+<?php
+return array(
+  //index.php
+  "install_title"=>'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!Please delete the /install directory, avoid the script to be executed again.<br><a href="http://www.showdoc.cc/help-en" target="_blank">http://www.showdoc.cc/help-en</a>',
+  "home"=>'Website Home',
+  "FAQ"=>'FAQ',
+
+  //ajax.php
+  "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 /Application/Runtime is not writable !',
+  "not_writable_config"=>'File /Application/Common/Conf/config.php is not writable !',
+  "not_writable_home_config"=>'File /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 !',
+  "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',
+
+  );

+ 34 - 0
install/lang.zh.php

@@ -0,0 +1,34 @@
+<?php
+return array(
+  //index.php
+  "install_title"=>'安装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"=>'安装成功!建议删除/install目录,以免安装脚本被再次执行。若再遇到问题,可参考ShowDoc帮助文档:<a href="http://www.showdoc.cc/help" target="_blank">http://www.showdoc.cc/help</a>',
+  "home"=>'进入网站首页',
+  "FAQ"=>'常见问题',
+
+  //ajax.php
+  "lock"=>'本程序已经安装过!如果要解除安装锁定,则可删除/install目录下的install.lock文件后再重新访问本页面',
+  "not_writable_install"=>'请赋予 /install 目录以可写权限!',
+  "not_writable_upload"=>'请赋予 /Public/Uploads/ 目录以可写权限!',
+  "not_writable_runtime"=>'请赋予 /Application/Runtime 目录以可写权限!',
+  "not_writable_config"=>'请赋予 /Application/Common/Conf/config.php 文件以可写权限!',
+  "not_writable_home_config"=>'请赋予 /Application/Home/Conf/config.php 文件以可写权限!',
+  "not_writable_sqlite"=>'请赋予 /Sqlite 目录以可写权限!',
+  "not_writable_sqlite_db"=>'请赋予 /Sqlite/showdoc.db.php 以可写权限!',
+  "install_success"=>'安装成功!建议删除/install目录,以免安装脚本被再次执行。',
+  "install_config_not_writable"=>'安装失败,配置文件写入错误!',
+  "db_wrong"=>'数据库链接错误,请检查配置信息是否填写正确',
+  "db_has_data"=>'检测到该数据库已经存在数据。请清理后再重试',
+  "create_table_fail"=>'创建数据库表失败!',
+  "install_config_not_writable"=>'安装失败,配置文件写入错误!',
+
+  );