Parcourir la source

新增项目设置,新增开放API

star7th il y a 8 ans
Parent
commit
f447deadf4
60 fichiers modifiés avec 1785 ajouts et 33 suppressions
  1. 9 1
      Application/Home/Controller/ItemController.class.php
  2. 12 0
      Application/Home/Controller/UpdateController.class.php
  3. 1 1
      Application/Home/Model/ItemModel.class.php
  4. 5 1
      Application/Home/Model/UserTokenModel.class.php
  5. 1 0
      Application/Home/View/Common/footer.html
  6. 1 0
      Application/Home/View/Common/header.html
  7. 490 0
      Application/Home/View/Item/setting.html
  8. 19 11
      Application/Home/View/Item/show_regular.html
  9. 6 1
      Public/css/item/show.css
  10. 46 0
      Public/css/tab-tpl.css
  11. 1 0
      Public/layer/layer.js
  12. 1 0
      Public/layer/mobile/layer.js
  13. 0 0
      Public/layer/mobile/need/layer.css
  14. BIN
      Public/layer/skin/default/icon-ext.png
  15. BIN
      Public/layer/skin/default/icon.png
  16. 0 0
      Public/layer/skin/default/layer.css
  17. BIN
      Public/layer/skin/default/loading-0.gif
  18. BIN
      Public/layer/skin/default/loading-1.gif
  19. BIN
      Public/layer/skin/default/loading-2.gif
  20. BIN
      Sqlite/showdoc.db.php
  21. 1 1
      composer.json
  22. 1 1
      index.php
  23. 4 0
      install/ajax.php
  24. 6 0
      install/database.php
  25. 8 7
      install/lang.en.php
  26. 10 9
      install/lang.zh.php
  27. 1 0
      server/Application/Api/Common/index.html
  28. 38 0
      server/Application/Api/Conf/config.php
  29. 1 0
      server/Application/Api/Conf/index.html
  30. 5 0
      server/Application/Api/Conf/tags.php
  31. 143 0
      server/Application/Api/Controller/BaseController.class.php
  32. 276 0
      server/Application/Api/Controller/ItemController.class.php
  33. 91 0
      server/Application/Api/Controller/MemberController.class.php
  34. 1 0
      server/Application/Api/Controller/index.html
  35. 17 0
      server/Application/Api/Model/BaseModel.class.php
  36. 182 0
      server/Application/Api/Model/ItemModel.class.php
  37. 41 0
      server/Application/Api/Model/ItemTokenModel.class.php
  38. 48 0
      server/Application/Api/Model/UserModel.class.php
  39. 34 0
      server/Application/Api/Model/UserTokenModel.class.php
  40. 1 0
      server/Application/Api/Model/index.html
  41. 1 0
      server/Application/Api/View/index.html
  42. 1 0
      server/Application/Api/index.html
  43. 196 0
      server/Application/Common/Common/function.php
  44. 1 0
      server/Application/Common/Common/index.html
  45. 35 0
      server/Application/Common/Conf/config.php
  46. 1 0
      server/Application/Common/Conf/index.html
  47. 1 0
      server/Application/Common/index.html
  48. 1 0
      server/Application/Home/Common/index.html
  49. 4 0
      server/Application/Home/Conf/config.php
  50. 1 0
      server/Application/Home/Conf/index.html
  51. 8 0
      server/Application/Home/Controller/IndexController.class.php
  52. 1 0
      server/Application/Home/Controller/index.html
  53. 1 0
      server/Application/Home/Model/index.html
  54. 1 0
      server/Application/Home/View/index.html
  55. 1 0
      server/Application/Home/index.html
  56. 1 0
      server/Application/README.md
  57. 1 0
      server/Application/Runtime/index.html
  58. 1 0
      server/Application/index.html
  59. 1 0
      server/README.md
  60. 26 0
      server/index.php

+ 9 - 1
Application/Home/Controller/ItemController.class.php

@@ -83,7 +83,7 @@ class ItemController extends BaseController {
                 }
                 return ;
             }
-                        if ($item_id > 0 ) {
+            if ($item_id > 0 ) {
                 $data = array(
                     "item_name" => $item_name ,
                     "item_domain" => $item_domain ,
@@ -433,5 +433,13 @@ class ItemController extends BaseController {
         $this->sendResult($items);
     }
 
+    public function setting(){
+        $login_user = $this->checkLogin();
+        $item_id = I("item_id/d");  
+        $uid = $login_user['uid'] ;
+        $this->checkItemPermn($uid , $item_id) ; 
+        $this->assign("item_id",$item_id);
+        $this->display();
+    }
 
 }

+ 12 - 0
Application/Home/Controller/UpdateController.class.php

@@ -150,6 +150,18 @@ class UpdateController extends BaseController {
         )";
         D("UserToken")->execute($sql);
 
+        //创建item_token表
+        $sql = "CREATE TABLE IF NOT EXISTS `item_token` (
+        `id`  INTEGER PRIMARY KEY ,
+        `item_id` int(11) NOT NULL DEFAULT '0' ,
+        `api_key` CHAR(200) NOT NULL UNIQUE ,
+        `api_token` CHAR(200) NOT NULL ,
+        `addtime` int(11) NOT NULL DEFAULT '0' ,
+        `last_check_time` int(11) NOT NULL DEFAULT '0' 
+        )";
+        D("UserToken")->execute($sql);
+
+
 
         echo 'OK!';
     }

+ 1 - 1
Application/Home/Model/ItemModel.class.php

@@ -46,7 +46,7 @@ class ItemModel extends BaseModel {
         unset($json);
         if ($item) {
             if ($item['item_domain']) {
-                $item2 = D("Item")->where("item_domain = '$item[item_domain]'  ")->find();
+                $item2 = D("Item")->where("item_domain = '%s'  ".array($item['item_domain']))->find();
                 if ($item2) {
                     //个性域名已经存在
                     return false;

+ 5 - 1
Application/Home/Model/UserTokenModel.class.php

@@ -25,6 +25,10 @@ class UserTokenModel extends BaseModel {
 	}
 
 	public function getToken($token){
-		return $this->where("token='$token'")->find();
+		return $this->where("token='%s'",array($token))->find();
+	}
+
+	public function setLastTime($token){
+		return $this->where("token='%s'",array($token))->save(array("last_check_time"=>time()));
 	}
 }

+ 1 - 0
Application/Home/View/Common/footer.html

@@ -2,6 +2,7 @@
 	<script src="__PUBLIC__/js/common/jquery.min.js"></script>
     <script src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script>
     <script src="__PUBLIC__/js/common/showdoc.js?v=1.1"></script>
+    <script src="__PUBLIC__/layer/layer.js"></script>
     <div style="display:none">
     	{:C("STATS_CODE")}
     </div>

+ 1 - 0
Application/Home/View/Common/header.html

@@ -12,6 +12,7 @@
       var DocConfig = {
           host: window.location.origin,
           app: "{:U('/')}",
+          server: "server/index.php?s=",
           pubile:"__PUBLIC__",
       }
 

+ 490 - 0
Application/Home/View/Item/setting.html

@@ -0,0 +1,490 @@
+<include file="Common/header" />
+
+<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/tab-tpl.css?v=1">
+<style type="text/css">
+.member-desc{
+  width: 300px;
+  margin: 0 auto;
+}
+
+</style>
+<div class="tab-header"></div>
+<div class="container tab-doc-container">
+ <div class="tab-doc-title-box">
+  <span  class="dn"></span>
+  <h3 >项目设置 &nbsp;&nbsp;<small><a href="javascript:history.go(-1)">返回</a></small></h3>
+</div>
+<div class="tab-doc-body" >
+
+  <div class="tab-doc-content" >
+    <ul class="nav nav-tabs" id="myTab">
+      <li><a href="#base-info" data-toggle="tab">基础信息</a></li>
+      <li><a href="#member" data-toggle="tab">成员管理</a></li>
+      <li><a href="#adv-seting" data-toggle="tab">高级设置</a></li>
+      <li><a href="#item-api" data-toggle="tab">开放API</a></li>
+    </ul>
+
+    <div class="tab-content">
+      <div class="tab-pane" id="base-info" >
+        <form class="form-horizontal">
+         <div class="control-group">
+          <label class="control-label" for="">项目名:</label>
+          <div class="controls">
+            <input type="text" id="item_name" placeholder="">
+          </div>
+        </div>
+        <div class="control-group">
+          <label class="control-label" for="">项目描述:</label>
+          <div class="controls">
+            <input type="text" id="item_description" placeholder="">
+          </div>
+        </div>
+        <div class="control-group" style="display:none">
+          <label class="control-label" for="">个性域名:</label>
+          <div class="controls">
+            <input type="text" id="item_domain" placeholder="">
+          </div>
+        </div>
+        <div class="control-group">
+          <label class="control-label" for="inputPassword">访问密码:</label>
+          <div class="controls">
+            <input type="password" id="password" placeholder="(可选)私有项目请设置访问密码">
+          </div>
+        </div>
+        <div class="control-group">
+          <div class="controls">
+            <button type="submit" id="item_save" class="btn">保存</button>
+          </div>
+        </div>
+      </form>
+    </div>
+
+    <div class="tab-pane" id="member">
+      <p><button  id="add-member-btn" class="btn ">新增成员</button></p>
+      <table class="table table-hover">
+        <thead>
+          <tr>
+            <th style="width:80px;">用户名</th>
+            <th style="width:80px;">添加时间</th>
+            <th style="width:80px;">权限</th>
+            <th style="width:80px;">操作</th>
+
+          </tr>
+        </thead>
+        <tbody id="member-list">
+
+        </tbody>
+      </table>
+
+    </div>
+    <div class="tab-pane" id="adv-seting">
+      <div style="width:300px;margin:0 auto;padding-top:20px;">
+        <p><button  id="attorn-btn" class="btn ">转让</button></p>
+        <p><small>你可以将项目转让给他人</small></p>
+        <hr>
+        <p><button  id="delete-item-btn" class="btn btn-danger">删除</button></p>
+        <p><small>删除后将不可恢复</small></p>
+        <hr> 
+      </div>
+
+    </div>
+    <div class="tab-pane" id="item-api">
+        <form class="form-horizontal">
+         <div class="control-group">
+          <label class="control-label" for="">api_key:</label>
+          <div class="controls">
+            <!-- <input type="text" id="api_key" style="width:260px;" placeholder="" disabled> -->
+            <code id="api_key" ></code>
+          </div>
+        </div>
+        <div class="control-group">
+          <label class="control-label" for="">api_token:</label>
+          <div class="controls">
+            <!-- <input type="text" id="api_token" placeholder="" style="width:260px;" disabled> -->
+            <code id="api_token" ></code>
+          </div>
+        </div>
+        <div class="control-group">
+          <div class="controls">
+            <button type="submit" id="reset_api_token" class="btn">重新生成api_token</button>
+          </div>
+        </div>
+      </form>
+      <div style="width:450px;margin:0 auto;padding-top:20px;">
+        <p>showdoc开放文档编辑的API,供使用者更加方便地操作文档数据。利用开放API,你可以自动化地完成很多事</p>
+        <p>关于API详细用法,请参考我们的<a href="https://www.showdoc.cc/page/102098" target="_blank">API文档</a></p>
+        <hr> 
+      </div>
+    </div>
+  </div>
+
+</div>
+
+</div>
+
+<input type="hidden" id="item_id" value="{$item_id}">
+
+
+<!-- 转让项目的弹窗 -->
+<div id="attorn-modal" class="modal hide fade">
+  <div class="">
+    <div class="modal-header">
+      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+      <h4>转让项目</h4>
+    </div>
+    <div class="">
+      <form class="form-horizontal">
+        <div class="control-group">
+          <label class="control-label" for="inputEmail">{$Think.Lang.username}</label>
+          <div class="controls">
+            <input type="text" id="attorn_username" placeholder="{$Think.Lang.receiver_name}" value="">
+          </div>
+        </div>
+        <div class="control-group">
+          <label class="control-label" for="inputEmail">{$Think.Lang.verify_identity}</label>
+          <div class="controls">
+            <input type="password" id="attorn_password" placeholder="{$Think.Lang.your_password}" value="">
+          </div>
+        </div>
+        <div class="control-group">
+          <div class="controls">
+            <button type="submit" class="btn" id="attorn_save">{$Think.Lang.attorn}</button>
+          </div>
+        </div>
+      </form>
+
+    </div>
+  </div>
+
+  <div class="modal-footer">
+    <a href="#" class="btn exist-attorn" data-dismiss="modal" aria-hidden="true" >{$Think.Lang.close}</a>
+  </div>
+</div>
+
+<!-- 删除项目的弹窗 -->
+<div id="delete-item-modal" class="modal hide fade">
+  <div class="">
+    <div class="modal-header">
+      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+      <h4>删除项目</h4>
+    </div>
+    <div class="">
+      <form class="form-horizontal">
+        <div class="control-group">
+          <label class="control-label" for="inputEmail">{$Think.Lang.verify_identity}</label>
+          <div class="controls">
+            <input type="password" id="delete_item_password" placeholder="{$Think.Lang.your_password}" value="">
+          </div>
+        </div>
+        <div class="control-group">
+          <div class="controls">
+            <button type="submit" class="btn" id="delete_item_save">{$Think.Lang.delete}</button>
+          </div>
+        </div>
+      </form>
+
+    </div>
+  </div>
+
+  <div class="modal-footer">
+    <a href="#" class="btn exist-attorn" data-dismiss="modal" aria-hidden="true" >{$Think.Lang.close}</a>
+  </div>
+</div>
+
+<!-- 添加成员的弹窗 -->
+<div id="member-modal" class="modal hide fade">
+  <!-- 编辑框 -->
+  <div class="">
+    <div class="modal-header">
+    <h4>{$Think.Lang.new_member}</h4>
+    </div>
+    <div class="">
+        <form class="form-horizontal">
+          <div class="control-group">
+            <label class="control-label" for="inputEmail">{$Think.Lang.username}</label>
+            <div class="controls">
+              <input type="text" id="member_username" placeholder="{$Think.Lang.username}" value="">
+            </div>
+          </div>
+          <div class="control-group">
+            <div class="controls">
+              <label class="checkbox">
+                <input type="checkbox" id="member_group_id">{$Think.Lang.member_group_id}
+              </label>
+            </div>
+          </div>
+          <div class="control-group">
+            <div class="controls">
+              <button type="submit" class="btn" id="member_save">{$Think.Lang.save}</button>
+            </div>
+          </div>
+        </form>
+        <div class="member-desc">
+          <p>权限说明:
+            <br>默认成员可以新建/编辑项目页面,删除时将只能删除自己新建/编辑的页面。
+            <br>勾选只读属性后,该成员对所有页面都只能查看,无法新增/编辑/删除</p>
+        </div>
+        
+    </div>
+  </div>
+  <div class="modal-footer">
+    <a href="#" class="btn " data-dismiss="modal" aria-hidden="true">{$Think.Lang.close}</a>
+  </div>
+</div>
+
+
+<include file="Common/footer" />
+<script type="text/javascript">
+$(function(){
+  $('a[data-toggle="tab"]').on('shown', function (e) {
+          //e.target // activated tab
+          //e.relatedTarget // previous tab
+          console.log($(e.target).attr("href"));
+        })
+
+    //展示第一个tab
+    $("#myTab a:first").tab("show");
+
+    var item_id = $("#item_id").val() ;
+
+    
+
+    //获取基础信息
+    get_base_info() ;
+    function get_base_info(){
+      $.get(
+        DocConfig.server+"/api/item/detail",
+        {"item_id":item_id},
+        function(data){
+          if (data.error_code === 0 ) {
+            //console.log(data.data);
+            $("#item_name").val(data.data.item_name);
+            $("#item_description").val(data.data.item_description);
+            $("#item_domain").val(data.data.item_domain);
+            $("#password").val(data.data.password);
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+
+        );
+    }
+
+    //保存项目基础信息
+    $("#item_save").click(function(){
+
+      var item_name = $("#item_name").val();
+      var item_description = $("#item_description").val();
+      var item_domain = $("#item_domain").val();
+      var password = $("#password").val();
+      $.post(
+        DocConfig.server+"/api/item/update",
+        {"item_id":item_id,"item_name":item_name,"item_description":item_description,"item_domain":item_domain,"password":password},
+        function(data){
+          if (data.error_code === 0 ) {
+            layer.msg('保存成功',{"time":1000});
+            get_base_info() ;
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+        );
+
+      return false;
+    });
+
+    //点击转让按钮,弹出modal
+    $("#attorn-btn").click(function(){
+      $('#attorn-modal').modal({
+        "backdrop":'static'
+      });
+    });
+
+    //监听转让
+    $("#attorn_save").click(function(){
+      var username = $("#attorn_username").val();
+      var password = $("#attorn_password").val();
+      $.post(
+        DocConfig.server+"/api/item/attorn",
+        {"username": username ,"item_id": item_id , "password": password  },
+        function(data){
+          if (data.error_code == 0) {
+            layer.msg('转让成功,正在跳转回主页..',{"time":3000});
+            //跳转
+            setTimeout(function(){
+              window.location.href="?s=/home/item/index";
+            },3000)
+            
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+
+        );
+      return false;
+    });
+
+    //删除项目
+    $("#delete-item-btn").click(function(){
+      $('#delete-item-modal').modal({
+        "backdrop":'static'
+      });
+    });
+
+    //监听删除
+    $("#delete_item_save").click(function(){
+      var password = $("#delete_item_password").val();
+      $.post(
+        DocConfig.server+"/api/item/delete",
+        {"item_id": item_id , "password": password  },
+        function(data){
+          if (data.error_code == 0) {
+            layer.msg('删除成功,正在跳转回主页..',{"time":3000});
+            //跳转
+            setTimeout(function(){
+              window.location.href="?s=/home/item/index";
+            },3000)
+            
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+
+        );
+      return false;
+    });
+
+    //点击添加成员,弹出modal
+    $("#add-member-btn").click(function(){
+      $('#member-modal').modal({
+        "backdrop":'static'
+      });
+    });
+
+
+    //获取成员列表
+    get_member_list();
+    function get_member_list(){
+      $.get(
+        DocConfig.server+"/api/member/getList",
+        {"item_id":item_id},
+        function(data){
+          $("#member-list").html('');
+          if (data.error_code === 0 ) {
+            //console.log(data.data);
+            var json = data.data ;
+            if (json.length > 0 ) {
+              for (var i = 0; i < json.length; i++) {
+                var html = '<tr>'
+                  +'<td><div class="type-parent">'+json[i].username+'</div></td>'
+                  +'<td><div class="type-parent">'+json[i].addtime+'</div></td>'
+                  +'<td><div class="type-parent">'+json[i].member_group+'</div></td>'
+                  +'<td><a href="#" class="member-delete" data-id="'+json[i].item_member_id+'">删除</a></td>'
+                +'</tr>';
+                $("#member-list").append(html);
+                
+              };
+
+            };
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+
+        );
+    }
+
+    //添加成员
+    $("#member_save").click(function(){
+      var username = $("#member_username").val();
+      var member_group_id = $("#member_group_id").is(':checked') ? 0 : 1 ;
+      $.post(
+        DocConfig.server+"/api/member/save",
+        {"item_id": item_id , "username": username ,"member_group_id":member_group_id  },
+        function(data){
+          if (data.error_code == 0) {
+            $('#member-modal').modal('hide');
+            $("#member_username").val('');
+            $("#member_group_id").removeAttr("checked");
+            layer.msg('添加成功',{"time":1000});
+            get_member_list();
+            
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+
+        );
+      return false;
+    });
+
+    //删除成员
+    $("#member-list").on("click",'.member-delete',function(){
+      if (!confirm("确定删除成员吗")) { return false;};
+      var item_member_id = $(this).data("id");
+        $.post(
+          DocConfig.server+"/api/member/delete",
+          {"item_id": item_id , "item_member_id": item_member_id  },
+          function(data){
+            if (data.error_code == 0) {
+              layer.msg('删除成功',{"time":1000});
+              get_member_list();
+              
+            }else{
+              layer.alert(data.error_message);
+            }
+          },
+          "json"
+
+          );
+      return false;
+    })
+
+    //获取item api_key信息
+    get_api_info() ;
+    function get_api_info(){
+      $.get(
+        DocConfig.server+"/api/item/getKey",
+        {"item_id":item_id},
+        function(data){
+          if (data.error_code === 0 ) {
+            //console.log(data.data);
+            $("#api_key").html(data.data.api_key);
+            $("#api_token").html(data.data.api_token);
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+
+        );
+    }
+
+    $("#reset_api_token").click(function(){
+      $.post(
+        DocConfig.server+"/api/item/resetKey",
+        {"item_id":item_id},
+        function(data){
+          if (data.error_code === 0 ) {
+            //console.log(data.data);
+            $("#api_key").html(data.data.api_key);
+            $("#api_token").html(data.data.api_token);
+          }else{
+            layer.alert(data.error_message);
+          }
+        },
+        "json"
+
+        );
+      return false;
+    });
+
+  });
+</script>
+

+ 19 - 11
Application/Home/View/Item/show_regular.html

@@ -1,6 +1,5 @@
 <include file="Common/header" />
-<link rel="stylesheet" href="__PUBLIC__/css/item/show.css?1.1d.1thdddef" />
-
+<link rel="stylesheet" href="__PUBLIC__/css/item/show.css?1.1d.1thdddefg" />
 
 <div class="doc-head row" >
   <div class="left "><h2>{$item.item_name}</h2></div>
@@ -20,10 +19,7 @@
              <li><a href="{:U('Home/Item/word',array('item_id'=>$item['item_id']))}">{$Think.Lang.export}</a></li>
 
              <if condition="$ItemCreator">
-              <li><a href="{:U('Home/Item/add',array('item_id'=>$item['item_id']))}">{$Think.Lang.update_info}</a></li>          
-              <li><a href="{:U('Home/Member/edit',array('item_id'=>$item['item_id']))}">{$Think.Lang.manage_members}</a></li>
-              <li><a href="{:U('Home/Attorn/index',array('item_id'=>$item['item_id']))}">{$Think.Lang.attorn}</a></li>
-              <li><a href="{:U('Home/Item/delete',array('item_id'=>$item['item_id']))}">{$Think.Lang.delete}</a></li>
+              <li><a href="{:U('Home/Item/setting',array('item_id'=>$item['item_id']))}">项目设置</a></li>          
             </if>
 
             <li><a href="{:U('Home/Item/index')}">{$Think.Lang.goback}</a></li>
@@ -116,10 +112,22 @@
       <div class='page-edit-link pull-right hide'>
         <ul class="inline">
           <if condition="$ItemPermn">
-            <li><a href="" id="share-page" title="{$Think.Lang.share_address_to_your_friends}">{$Think.Lang.share}</a></li>
-            <li><a href="" id="copy-link" title="{$Think.Lang.copy_interface_to_new}">{$Think.Lang.copy}</a></li>
-            <li><a href="" id="edit-link" title="{$Think.Lang.edit_interface}">{$Think.Lang.edit}</a></li>
-            <li><a href="" title="{$Think.Lang.delete_interface}" onclick="return confirm('{$Think.Lang.comfirm_delete}');return false;" id="delete-link">{$Think.Lang.delete}</a></li>
+            <li><a class="btn btn-link" href="" id="share-page" title="{$Think.Lang.share_address_to_your_friends}">{$Think.Lang.share}</a></li>
+                  <li><a class="btn btn-link" href="" id="edit-link" title="{$Think.Lang.edit_interface}">{$Think.Lang.edit}</a></li>
+            <li>
+              <div class="btn-group">
+                  <a class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#">
+                    更多              <span class="caret"></span>
+                  </a>
+                <ul class="dropdown-menu">
+                <!-- dropdown menu links -->
+                  <li><a href="" id="copy-link" title="{$Think.Lang.copy_interface_to_new}">{$Think.Lang.copy}</a></li>
+
+                  <li><a href="" title="{$Think.Lang.delete_interface}" onclick="return confirm('{$Think.Lang.comfirm_delete}');return false;" id="delete-link">{$Think.Lang.delete}</a></li>
+
+                </ul>
+              </div>
+            </li>
           <else />
             <li></li>
             <li></li>
@@ -173,4 +181,4 @@
 <script src="__PUBLIC__/js/jquery.hotkeys.js"></script>
 <script src="__PUBLIC__/jquery.zclip/jquery.zclip.js"></script>
 
-<script src="__PUBLIC__/js/item/show.js?v=1.2121"></script>
+<script src="__PUBLIC__/js/item/show.js?v=1.21212345678"></script>

+ 6 - 1
Public/css/item/show.css

@@ -139,7 +139,12 @@
   .doc-right{ width: 1600px;} 
 }
 
-
+.page-edit-link .btn-link{
+  padding-right: 4px;
+  padding-left: 4px;
+  margin-right: 0px;
+  margin-left: 0px;
+}
 
 
 

+ 46 - 0
Public/css/tab-tpl.css

@@ -0,0 +1,46 @@
+body{
+    background: #F1F0F1;
+    height: auto;
+    overflow: auto;
+    margin: 0 auto;
+}
+
+.tab-doc-content{
+  
+    padding: 11px 0 90px 0;
+    overflow: hidden;
+    font-size: 11pt;
+    line-height: 1.7;
+    color: #333;
+}
+.tab-doc-body{
+  background-color: #fff;
+  width: 600px;
+  margin: 0 auto;
+}
+
+.tab-doc-container {
+    position: static;
+    -webkit-box-shadow: 0px 1px 6px #ccc;
+    -moz-box-shadow: 0px 1px 6px #ccc;
+    -ms-box-shadow: 0px 1px 6px #ccc;
+    -o-box-shadow: 0px 1px 6px #ccc;
+    box-shadow: 0px 1px 6px #ccc;
+    background-color: #fff;
+    border-bottom: 1px solid #d9d9d9;
+    margin-bottom: 20px;
+    width: 800px;
+    min-height: 500px;
+}
+
+.tab-header{
+  height: 40px;
+}
+
+.tab-doc-title-box{
+    height: auto;
+    margin: 30px 100px 10px 100px;
+    width: auto;
+    /*border-bottom: 1px solid #ebebeb;*/
+    padding-bottom: 10px;
+}

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 0
Public/layer/layer.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 0
Public/layer/mobile/layer.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
Public/layer/mobile/need/layer.css


BIN
Public/layer/skin/default/icon-ext.png


BIN
Public/layer/skin/default/icon.png


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
Public/layer/skin/default/layer.css


BIN
Public/layer/skin/default/loading-0.gif


BIN
Public/layer/skin/default/loading-1.gif


BIN
Public/layer/skin/default/loading-2.gif


BIN
Sqlite/showdoc.db.php


+ 1 - 1
composer.json

@@ -5,7 +5,7 @@
     "description": "ShowDoc is a tool greatly applicable for an IT team to share documents online",
     "keywords": ["showdoc","documents","Api"],
     "homepage": "https://github.com/star7th/showdoc",
-    "version":"v1.2.6",
+    "version":"v1.3.0",
     "license": "Apache-2.0",
     "authors": [
         {

+ 1 - 1
index.php

@@ -15,7 +15,7 @@
 if(version_compare(PHP_VERSION,'5.3.0','<'))  die('require PHP > 5.3.0 !');
 
 // 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
-//define('APP_DEBUG',True);
+define('APP_DEBUG',True);
 
 // 定义应用目录
 define('APP_PATH','./Application/');

+ 4 - 0
install/ajax.php

@@ -22,6 +22,10 @@ if(!new_is_writeable("../Application/Runtime")){
 	ajax_out(L("not_writable_runtime"),10095);
 }
 
+if(!new_is_writeable("../server/Application/Runtime")){
+    ajax_out(L("not_writable_server_runtime"),10095);
+}
+
 if(!new_is_writeable("../Application/Common/Conf/config.php")){
 	ajax_out(L("not_writable_config"),10094);
 }

+ 6 - 0
install/database.php

@@ -32,6 +32,12 @@ if(!new_is_writeable("../Application/Runtime")){
   echo L("not_writable_runtime").'<br>';
   $go = 0;
 }
+
+if(!new_is_writeable("../server/Application/Runtime")){
+  echo L("not_writable_server_runtime").'<br>';
+  $go = 0;
+}
+
 if(!new_is_writeable("../Application/Common/Conf/config.php")){
   echo L("not_writable_config").'<br>';
   $go = 0;

+ 8 - 7
install/lang.en.php

@@ -17,13 +17,14 @@ return array(
 
   
   "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 !',
+  "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_server_runtime"=>'Directory server/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',

+ 10 - 9
install/lang.zh.php

@@ -16,15 +16,16 @@ return array(
   "FAQ"=>'常见问题',
 
 
-  "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 文件以可写权限!<br>(如果你确定赋予了文件权限但却一直看到此信息,则可考虑关闭selinux试试)',
-  "not_writable_sqlite"=>'请赋予 /Sqlite 目录以可写权限!',
-  "not_writable_sqlite_db"=>'请赋予 /Sqlite/showdoc.db.php 以可写权限!',
-  "install_success"=>'安装成功!建议删除/install目录,以免安装脚本被再次执行。',
+  "lock"=>'本程序已经安装过!如果要解除安装锁定,则可删除install目录下的install.lock文件后再重新访问本页面',
+  "not_writable_install"=>'请赋予 install 目录以可写权限!',
+  "not_writable_upload"=>'请赋予 Public/Uploads/ 目录以可写权限!',
+  "not_writable_runtime"=>'请赋予 Application/Runtime 目录以可写权限!',
+  "not_writable_server_runtime"=>'请赋予 server/Application/Runtime 目录以可写权限!',
+  "not_writable_config"=>'请赋予 Application/Common/Conf/config.php 文件以可写权限!',
+  "not_writable_home_config"=>'请赋予 Application/Home/Conf/config.php 文件以可写权限!<br>(如果你确定赋予了文件权限但却一直看到此信息,则可考虑关闭selinux试试)',
+  "not_writable_sqlite"=>'请赋予 Sqlite 目录以可写权限!',
+  "not_writable_sqlite_db"=>'请赋予 Sqlite/showdoc.db.php 以可写权限!',
+  "install_success"=>'安装成功!建议删除install目录,以免安装脚本被再次执行。',
   "install_config_not_writable"=>'安装失败,配置文件写入错误!',
   "db_wrong"=>'数据库链接错误,请检查配置信息是否填写正确',
   "db_has_data"=>'检测到该数据库已经存在数据。请清理后再重试',

+ 1 - 0
server/Application/Api/Common/index.html

@@ -0,0 +1 @@
+ 

+ 38 - 0
server/Application/Api/Conf/config.php

@@ -0,0 +1,38 @@
+<?php 
+return array(
+	//'配置项'=>'配置值'
+    'LANG_SWITCH_ON' => true,   // 开启语言包功能
+    'LANG_AUTO_DETECT' => true, // 自动侦测语言 开启多语言功能后有效
+    'DEFAULT_LANG' => 'zh-cn', // 默认语言
+    'LANG_LIST'        => 'zh-cn,en-us', // 允许切换的语言列表 用逗号分隔
+    'VAR_LANGUAGE'     => 'l', // 默认语言切换变量
+	//错误信息配置
+	'error_codes' => array(
+
+		//通用性错误 :'错误代码'=>'英文描述'
+		10101 => '未知错误',				//未知错误导致请求接口失败(可能是参数缺失等问题)
+		10102 => '你尚未登录',			//你尚未登录
+		10103 => '没有权限',			//权限不够
+
+		//用户类错误
+		10201 => 'Username has exist',				//用户名已经存在
+		10202 => 'The email has exist',				//注册邮箱已经存在
+		10204 => 'Username or password is wrong',	//用户名或者密码错误
+		10205 => 'Wrong mobile format',				//错误的手机号码格式
+		10206 => 'captcha wrong or expired',		//验证码错误或者过期
+		10207 => ' There is no such name',		//该昵称不存在
+		10208 => ' 密码错误',		
+		10209 => ' 该用户不存在或者尚未注册',		
+
+		//项目类错误
+		10301 => '没有项目访问权限',		
+		10302 => '没有项目管理权限',		
+		10303 => '不是项目创建者',		
+		10304 => '个性域名已经存在',		
+		10305 => '个性域名只能是字母或数字的组合',		
+		10306 => 'api_key 或 api_token 不匹配',		
+
+		
+		),
+	'API_LOG' => false ,  //是否开启API请求日志记录。如果开启,则记录每一个API请求的参数和返回结果,会生成很多日志
+);

+ 1 - 0
server/Application/Api/Conf/index.html

@@ -0,0 +1 @@
+ 

+ 5 - 0
server/Application/Api/Conf/tags.php

@@ -0,0 +1,5 @@
+<?php
+return array(
+    // 添加下面一行定义即可
+    'app_begin' => array('Behavior\CheckLangBehavior'),
+);

+ 143 - 0
server/Application/Api/Controller/BaseController.class.php

@@ -0,0 +1,143 @@
+<?php
+namespace Api\Controller;
+use Think\Controller;
+class BaseController extends Controller {
+
+	public function checkLogin($redirect = true){
+		if ( ! session("login_user")) {
+			$cookie_token = cookie('cookie_token');
+			if ($cookie_token) {
+				$ret = D("UserToken")->getToken($cookie_token);
+				if ($ret && $ret['token_expire'] > time() ) {
+					D("UserToken")->setLastTime($cookie_token);
+					$login_user = D("User")->where("uid = $ret[uid]")->find();
+					unset($ret['password']);
+					session("login_user" , $login_user);
+					return $login_user ;
+				}
+			}
+			if ($redirect) {
+				$this->sendError(10102);
+				exit();
+			}
+		}else{
+			return  session("login_user") ;
+		}
+	}
+
+	/**
+	 * 返回json结果
+	 */
+	protected function sendResult($array){
+		if (isset($array['error_code'])) {
+			$result['error_code'] = $array['error_code'] ;
+			$result['error_message'] = $array['error_message'] ;
+		}
+		else{
+			$result['error_code'] = 0 ;
+			$result['data'] = $array ;
+		}
+		//header('Access-Control-Allow-Origin: *');//允许跨域请求
+		echo json_encode($result);
+
+		//如果开启API调试模式,则记录请求参数和返回结果
+		if (C('API_LOG')) {
+			$info = '';
+			$info .= "\n\n【★★★★★★★★★★★】";
+			$info .= "\n请求接口:".MODULE_NAME  ."/".CONTROLLER_NAME."/".ACTION_NAME."";
+			$info .= "\n请求".'$_REQUEST'.":\n";
+			$info .= json_encode($_REQUEST);
+			$info .= "\n返回结果:\n";
+			$info .= json_encode($result)."\n";	
+			$info .= "【★★★★★★★★★★★】\n";		
+			\Think\log::record($info , 'INFO');
+		}
+
+	}
+
+	//返回错误提示
+	protected function sendError($error_code , $error_message = ''){
+		$error_code = $error_code ? $error_code : 10103 ;
+		if (!$error_message) {
+			$error_codes = C("error_codes");
+			foreach ($error_codes as $key => $value) {
+				if ($key == $error_code ) {
+					$error_message = $value ;
+				}
+			}
+		}
+		$array['error_code'] = $error_code;
+		$array['error_message'] = $error_message ;
+		$this->sendResult($array);
+	}
+
+	//判断某用户是否有项目管理权限(项目成员member_group_id为1,以及 项目创建者)
+	protected function checkItemPermn($uid , $item_id){
+
+		if (!$uid) {
+			return false;
+		}
+
+		if (session("mamage_item_".$item_id)) {
+			return true;
+		}
+
+		$item = D("Item")->where("item_id = '%d' ",array($item_id))->find();
+		if ($item['uid'] && $item['uid'] == $uid) {
+			session("mamage_item_".$item_id , 1 );
+			return true;
+		}
+		$ItemMember = D("ItemMember")->where("item_id = '%d' and uid = '%d' and member_group_id = 1 ",array($item_id,$uid))->find();
+		if ($ItemMember) {
+			session("mamage_item_".$item_id , 1 );
+			return true;
+		}
+		return false;
+	}
+
+	//判断某用户是否为项目创建者
+	protected function checkItemCreator($uid , $item_id){
+		if (!$uid) {
+			return false;
+		}
+		if (session("creat_item_".$item_id)) {
+			return true;
+		}
+
+		$item = D("Item")->where("item_id = '%d' ",array($item_id))->find();
+		if ($item['uid'] && $item['uid'] == $uid) {
+			session("creat_item_".$item_id , 1 );
+			return true;
+		}
+		return false;
+	}
+
+	//判断某用户是否有项目访问权限(公开项目的话所有人可访问,私有项目则项目成员、项目创建者和访问密码输入者可访问)
+	protected function checkItemVisit($uid , $item_id, $refer_url= ''){
+		if (session("visit_item_".$item_id)) {
+			return true;
+		}
+
+		if ($this->checkItemCreator($uid , $item_id)) {
+			session("visit_item_".$item_id , 1 );
+			return true;
+		}
+
+		$ItemMember = D("ItemMember")->where("item_id = '%d' and uid = '%d'  ",array($item_id,$uid))->find();
+		if ($ItemMember) {
+			session("visit_item_".$item_id , 1 );
+			return true;
+		}
+
+		$item = D("Item")->where("item_id = '%d' ",array($item_id))->find();
+		if ($item['password']) {
+			return false;
+		}else{
+			session("visit_item_".$item_id , 1 );
+			return true;
+		}
+
+	}
+
+
+}

+ 276 - 0
server/Application/Api/Controller/ItemController.class.php

@@ -0,0 +1,276 @@
+<?php
+namespace Api\Controller;
+use Think\Controller;
+class ItemController extends BaseController {
+
+    //项目详情
+    public function detail(){
+        $login_user = $this->checkLogin();
+        $item_id = I("item_id/d");  
+        $uid = $login_user['uid'] ;
+        if(!$this->checkItemCreator($uid , $item_id)){
+            $this->sendError(10303);
+            return ;
+        }  
+        $items  = D("Item")->where("item_id = '$item_id' ")->find();
+        $items = $items ? $items : array();
+        $this->sendResult($items);
+    }
+
+    //更新项目信息
+    public function update(){
+        $login_user = $this->checkLogin();
+        $item_id = I("item_id/d");  
+        $item_name = I("item_name");  
+        $item_description = I("item_description");  
+        $item_domain = I("item_domain");  
+        $password = I("password");
+        $uid = $login_user['uid'] ;
+        if(!$this->checkItemCreator($uid , $item_id)){
+            $this->sendError(10303);
+            return ;
+        }
+
+        if ($item_domain) {
+            
+            if(!ctype_alnum($item_domain) ||  is_numeric($item_domain) ){
+                //echo '个性域名只能是字母或数字的组合';exit;
+                $this->sendError(10305);
+                return false;
+            }
+
+            $item = D("Item")->where("item_domain = '%s' and item_id !='%s' ",array($item_domain,$item_id))->find();
+            if ($item) {
+                //个性域名已经存在
+                $this->sendError(10304);
+                return false;
+            }
+        }
+        $save_data = array(
+            "item_name" => $item_name ,
+            "item_description" => $item_description ,
+            "item_domain" => $item_domain ,
+            "password" => $password ,
+            );
+        $items  = D("Item")->where("item_id = '$item_id' ")->save($save_data);
+        $items = $items ? $items : array();
+        $this->sendResult($items);  
+    }
+
+    //转让项目
+    public function attorn(){
+        $login_user = $this->checkLogin();
+
+        $username = I("username");
+        $item_id = I("item_id/d");
+        $password = I("password");
+
+        $item  = D("Item")->where("item_id = '$item_id' ")->find();
+
+        if(!$this->checkItemCreator($login_user['uid'] , $item['item_id'])){
+            $this->sendError(10303);
+            return ;
+        }
+
+        if(! D("User")-> checkLogin($item['username'],$password)){
+            $this->sendError(10208);
+            return ;
+        }
+
+        $member = D("User")->where(" username = '%s' ",array($username))->find();
+
+        if (!$member) {
+            $this->sendError(10209);
+            return ;
+        }
+
+        $data['username'] = $member['username'] ;
+        $data['uid'] = $member['uid'] ;
+        
+
+        $id = D("Item")->where(" item_id = '$item_id' ")->save($data);
+
+        $return = D("Item")->where("item_id = '$item_id' ")->find();
+
+        if (!$return) {
+            $this->sendError(10101);
+        }
+
+        $this->sendResult($return);
+    }
+
+    //删除项目
+    public function delete(){
+        $login_user = $this->checkLogin();
+
+        $item_id = I("item_id/d");
+        $password = I("password");
+
+        $item  = D("Item")->where("item_id = '$item_id' ")->find();
+
+        if(!$this->checkItemCreator($login_user['uid'] , $item['item_id'])){
+            $this->sendError(10303);
+            return ;
+        }
+
+        if(! D("User")-> checkLogin($item['username'],$password)){
+            $this->sendError(10208);
+            return ;
+        }
+
+
+        D("Page")->where("item_id = '$item_id' ")->delete();
+        D("Catalog")->where("item_id = '$item_id' ")->delete();
+        D("PageHistory")->where("item_id = '$item_id' ")->delete();
+        D("ItemMember")->where("item_id = '$item_id' ")->delete();
+        $return = D("Item")->where("item_id = '$item_id' ")->delete();
+
+        if (!$return) {
+            $this->sendError(10101);
+        }else{
+        }
+
+        $this->sendResult($return);
+    }
+
+    public function getKey(){
+        $login_user = $this->checkLogin();
+
+        $item_id = I("item_id/d");
+
+        $item  = D("Item")->where("item_id = '$item_id' ")->find();
+
+        if(!$this->checkItemCreator($login_user['uid'] , $item['item_id'])){
+            $this->sendError(10303);
+            return ;
+        }
+
+        $item_token  = D("ItemToken")->getTokenByItemId($item_id);
+        if (!$item_token) {
+            $this->sendError(10101);
+        }
+        $this->sendResult($item_token);
+
+    }
+
+    public function resetKey(){
+
+        $login_user = $this->checkLogin();
+
+        $item_id = I("item_id/d");
+
+        $item  = D("Item")->where("item_id = '$item_id' ")->find();
+
+        if(!$this->checkItemCreator($login_user['uid'] , $item['item_id'])){
+            $this->sendError(10303);
+            return ;
+        }
+
+        $ret = D("ItemToken")->where("item_id = '$item_id' ")->delete();
+
+        if ($ret) {
+            $this->getKey();
+        }else{
+            $this->sendError(10101);
+        }
+    }
+
+    public function updateByApi(){
+        $api_key = I("api_key");
+        $api_token = I("api_token");
+        $cat_name = I("cat_name");
+        $cat_name_sub = I("cat_name_sub");
+        $page_title = I("page_title");
+        $page_content = I("page_content");
+        $s_number = I("s_number") ? I("s_number") : 99;
+
+        $ret = D("ItemToken")->getTokenByKey($api_key);
+        if ($ret && $ret['api_token'] == $api_token) {
+            $item_id = $ret['item_id'] ;
+            D("ItemToken")->setLastTime($item_id);
+        }else{
+            $this->sendError(10306);
+            return false;
+        }
+
+        //如果传送了二级目录
+        if ($cat_name) {
+            $cat_name_array = D("Catalog")->where(" item_id = '$item_id' and level = 2 and cat_name = '%s' ",array($cat_name))->find();
+            //如果不存在则新建
+            if (!$cat_name_array) {
+                $add_data = array(
+                    "cat_name" => $cat_name, 
+                    "item_id" => $item_id, 
+                    "addtime" => time(),
+                    "level" => 2 
+                    );
+                D("Catalog")->add($add_data);
+                $cat_name_array = D("Catalog")->where(" item_id = '$item_id' and level = 2 and cat_name = '%s' ",array($cat_name))->find();
+            }
+        }
+
+        //如果传送了三级目录
+        if ($cat_name_sub) {
+            $cat_name_sub_array = D("Catalog")->where(" item_id = '$item_id' and level = 3 and cat_name = '%s' ",array($cat_name_sub))->find();
+            //如果不存在则新建
+            if (!$cat_name_sub_array) {
+                $add_data = array(
+                    "cat_name" => $cat_name_sub, 
+                    "item_id" => $item_id, 
+                    "parent_cat_id" => $cat_name_array['cat_id'], 
+                    "addtime" => time(),
+                    "level" => 3 
+                    );
+                D("Catalog")->add($add_data);
+                $cat_name_sub_array = D("Catalog")->where(" item_id = '$item_id' and level = 3 and cat_name = '%s' ",array($cat_name_sub))->find();
+            }
+        }
+
+        //目录id
+        $cat_id = 0 ;
+        if ($cat_name_array && $cat_name_array['cat_id'] > 0 ) {
+            $cat_id = $cat_name_array['cat_id'] ;
+        }
+
+        if ($cat_name_sub_array && $cat_name_sub_array['cat_id'] > 0 ) {
+            $cat_id = $cat_name_sub_array['cat_id'] ;
+        }
+
+        if ($page_content) {
+            $page_array = D("Page")->where(" item_id = '$item_id'  and cat_id = '$cat_id'  and page_title ='%s' ",array($page_title))->find();
+            //如果不存在则新建
+            if (!$page_array) {
+                $add_data = array(
+                    "author_username" => "from_api", 
+                    "item_id" => $item_id, 
+                    "cat_id" => $cat_id, 
+                    "page_title" => $page_title, 
+                    "page_content" => $page_content, 
+                    "s_number" => $s_number, 
+                    "addtime" => time(),
+                    );
+                $page_id = D("Page")->add($add_data);
+            }else{
+                $page_id = $page_array['page_id'] ;
+                $update_data = array(
+                    "author_username" => "from_api", 
+                    "item_id" => $item_id, 
+                    "cat_id" => $cat_id, 
+                    "page_title" => $page_title, 
+                    "page_content" => $page_content, 
+                    "s_number" => $s_number, 
+                    );
+                D("Page")->where(" page_id = '$page_id' ")->save($update_data);
+            }
+        }
+
+        if ($page_id) {
+            $ret = D("Page")->where(" page_id = '$page_id' ")->find();
+            $this->sendResult($ret);
+        }else{
+            $this->sendError(10101);
+        }
+
+
+    }
+}

+ 91 - 0
server/Application/Api/Controller/MemberController.class.php

@@ -0,0 +1,91 @@
+<?php
+namespace Api\Controller;
+use Think\Controller;
+class MemberController extends BaseController {
+
+
+    //保存
+    public function save(){ 
+        $member_group_id =  I("member_group_id/d");
+        $item_id = I("item_id/d");  
+        $login_user = $this->checkLogin();
+        $uid = $login_user['uid'] ;
+        if(!$this->checkItemCreator($uid , $item_id)){
+            $this->sendError(10303);
+            return ;
+        } 
+
+        $username = I("username");
+        $member = D("User")->where(" username = '%s' ",array($username))->find();
+
+        if (!$member) {
+            $this->sendError(10209);
+            return ;
+        }
+
+        $data['username'] = $member['username'] ;
+        $data['uid'] = $member['uid'] ;
+        $data['item_id'] = $item_id ;
+        $data['member_group_id'] = $member_group_id ;
+        $data['addtime'] = time() ;
+        
+
+        $id = D("ItemMember")->add($data);
+        $return = D("ItemMember")->where(" item_member_id = '$id' ")->find();
+
+        if (!$return) {
+            $this->sendError(10101);
+        }else{
+            $this->sendResult($return);
+        }
+        
+    }
+
+    //获取成员列表
+    public function getList(){
+        $item_id = I("item_id/d");  
+        $login_user = $this->checkLogin();
+        $uid = $login_user['uid'] ;
+        if(!$this->checkItemCreator($uid , $item_id)){
+            $this->sendError(10303);
+            return ;
+        } 
+        if ($item_id > 0 ) {
+            $ret = D("ItemMember")->where(" item_id = '$item_id' ")->order(" addtime asc  ")->select();
+        }
+        if ($ret) {
+            foreach ($ret as $key => &$value) {
+                $value['addtime'] = date("Y-m-d H:i:s",$value['addtime']);
+                $value['member_group'] = $value['member_group_id'] == 1 ? "编辑" :"只读"; 
+            }
+        }
+        $this->sendResult($ret);
+    }
+
+    //删除成员
+    public function delete(){
+        $item_id = I("item_id/d");  
+        $login_user = $this->checkLogin();
+        $uid = $login_user['uid'] ;
+        if(!$this->checkItemCreator($uid , $item_id)){
+            $this->sendError(10303);
+            return ;
+        } 
+        $item_member_id = I("item_member_id/d");
+
+        if ($item_member_id) {
+            $member_array = D("ItemMember")->where(" item_id = '%d' and item_member_id = '%d'  ",array($item_id,$item_member_id))->find();
+            $ret = D("ItemMember")->where(" item_id = '%d' and item_member_id = '%d'  ",array($item_id,$item_member_id))->delete();
+
+        }
+        if ($ret) {
+           $this->sendResult($ret);
+        }else{
+            $this->sendError(10101);
+        }
+    }
+
+
+
+
+}

+ 1 - 0
server/Application/Api/Controller/index.html

@@ -0,0 +1 @@
+ 

+ 17 - 0
server/Application/Api/Model/BaseModel.class.php

@@ -0,0 +1,17 @@
+<?php
+namespace Api\Model;
+use Think\Model;
+/**
+ *
+ *        
+ *        
+ */
+class BaseModel extends Model {
+    // 自动验证 //默认,验证条件:0存在字段就进行验证 , 验证时间:1新增/编辑 数据时候验证
+    protected $_validate = array ();
+    // 自动填充 //默认 新增数据的时候处理
+    protected $_auto = array ();
+    // 只读字段,插入后不能通过save更新
+    protected $readonlyField = array ();
+    
+}

+ 182 - 0
server/Application/Api/Model/ItemModel.class.php

@@ -0,0 +1,182 @@
+<?php
+namespace Api\Model;
+use Api\Model\BaseModel;
+
+class ItemModel extends BaseModel {
+
+    public function export($item_id){
+        $item = D("Item")->where("item_id = '$item_id' ")->field(" item_type, item_name ,item_description,password ")->find();
+        //获取所有父目录id为0的页面
+        $pages = D("Page")->where("cat_id = '0' and item_id = '$item_id' ")->field(" page_title ,page_content,s_number,page_comments ")->order(" `s_number` asc  ")->select();
+        //获取所有二级目录
+        $catalogs = D("Catalog")->where("item_id = '$item_id' and level = 2  ")->field("cat_id, cat_name ,level,s_number ")->order(" `s_number` asc  ")->select();
+        if ($catalogs) {
+            foreach ($catalogs as $key => &$catalog) {
+                //该二级目录下的所有子页面
+                $temp = D("Page")->where("cat_id = '$catalog[cat_id]' ")->field(" page_title ,page_content,s_number,page_comments ")->order(" `s_number` asc  ")->select();
+                $catalog['pages'] = $temp ? $temp: array();
+                //该二级目录下的所有子目录
+                $temp = D("catalog")->where("parent_cat_id = '$catalog[cat_id]' ")->field(" cat_id,cat_name ,level,s_number ")->order(" `s_number` asc  ")->select();
+                $catalog['catalogs'] = $temp ? $temp: array();
+                if($catalog['catalogs']){
+                    //获取所有三级目录的子页面
+                    foreach ($catalog['catalogs'] as $key3 => &$catalog3) {
+                        //该二级目录下的所有子页面
+                        $temp = D("Page")->where("cat_id = '$catalog3[cat_id]' ")->field(" page_title ,page_content,s_number,page_comments ")->order(" `s_number` asc  ")->select();
+                        $catalog3['pages'] = $temp ? $temp: array();
+                        unset($catalog3['cat_id']);
+                    }                        
+                }
+                unset($catalog['cat_id']);               
+            }
+        }
+        $item['pages'] = array(
+            "pages" =>$pages,
+            "catalogs" =>$catalogs,
+            );
+        unset($pages);
+        unset($catalogs);
+        $item['members'] = D("ItemMember")->where("item_id = '$item_id' ")->field(" member_group_id ,uid,username ")->select();
+        return  json_encode($item);
+        
+    }
+    public function import($json,$uid,$item_name= '',$item_description= '',$item_password = '',$item_domain = ''){
+        $userInfo = D("User")->userInfo($uid);
+        $item = json_decode($json ,1 );
+        unset($json);
+        if ($item) {
+            if ($item['item_domain']) {
+                $item2 = D("Item")->where("item_domain = '%s'  ".array($item['item_domain']))->find();
+                if ($item2) {
+                    //个性域名已经存在
+                    return false;
+                }
+                if(!ctype_alnum($item_domain) ||  is_numeric($item_domain) ){
+                    //echo '个性域名只能是字母或数字的组合';exit;
+                    return false;
+                }
+            }else{
+                $item['item_domain'] = '';
+            }
+            $item_data = array(
+                "item_name"=>$item_name ? $item_name :$item['item_name'],
+                "item_domain"=>$item_domain ? $item_domain :$item['item_domain'],
+                "item_type"=>$item['item_type'],
+                "item_description"=>$item_description ? $item_description :$item['item_description'],
+                "password"=>$item_password ? $item_password :$item['password'],
+                "uid"=>$userInfo['uid'],
+                "username"=>$userInfo['username'],
+                "addtime"=>time(),
+                );
+            $item_id = D("Item")->add($item_data);
+        }
+        if ($item['pages']) {
+            //父页面们(一级目录)
+            if ($item['pages']['pages']) {
+                foreach ($item['pages']['pages'] as $key => &$value) {
+                    $page_data = array(
+                        "author_uid"=>$userInfo['uid'],
+                        "author_username"=>$userInfo['username'],
+                        "page_title" =>$value['page_title'],
+                        "page_content" =>$value['page_content'],
+                        "s_number" =>$value['s_number'],
+                        "page_comments" =>$value['page_comments'],
+                        "item_id" => $item_id,
+                        "cat_id" => 0 ,
+                        "addtime" =>time(),
+                        );
+                    D("Page")->add($page_data);
+                    unset($page_data);
+                }
+                unset($item['pages']['pages']);
+            }
+            //二级目录
+            if ($item['pages']['catalogs']) {
+                foreach ($item['pages']['catalogs'] as $key => &$value) {
+                    $catalog_data = array(
+                        "cat_name" => $value['cat_name'],
+                        "level" => $value['level'],
+                        "s_number" => $value['s_number'],
+                        "item_id" => $item_id,
+                        "addtime" =>time(),
+                        );
+                    $cat_id = D("Catalog")->add($catalog_data);
+                    //二级目录的页面们
+                    if ($value['pages']) {
+                        foreach ($value['pages'] as $key2 => &$value2) {
+                            $page_data = array(
+                                "author_uid"=>$userInfo['uid'],
+                                "author_username"=>$userInfo['username'],
+                                "page_title" =>$value2['page_title'],
+                                "page_content" =>$value2['page_content'],
+                                "s_number" =>$value2['s_number'],
+                                "page_comments" =>$value2['page_comments'],
+                                "item_id" => $item_id,
+                                "cat_id" => $cat_id ,
+                                "addtime" =>time(),
+                                );
+                            D("Page")->add($page_data);
+                            unset($page_data);
+                            unset($value2);
+                        }
+                    }
+                    //判断是否存在三级目录
+                    if ($value['catalogs']) {
+                            foreach ($value['catalogs'] as $key3 => &$value3) {
+                                $catalog_data = array(
+                                    "cat_name" => $value3['cat_name'],
+                                    "level" => $value3['level'],
+                                    "s_number" => $value3['s_number'],
+                                    "parent_cat_id" => $cat_id,
+                                    "item_id" => $item_id,
+                                    "addtime" =>time(),
+                                    );
+                                $cat_id2 = D("Catalog")->add($catalog_data);
+                                //三级目录的页面们
+                                if ($value3['pages']) {
+                                    foreach ($value3['pages'] as $key4 => &$value4) {
+                                        $page_data = array(
+                                            "author_uid"=>$userInfo['uid'],
+                                            "author_username"=>$userInfo['username'],
+                                            "page_title" =>$value4['page_title'],
+                                            "page_content" =>$value4['page_content'],
+                                            "s_number" =>$value4['s_number'],
+                                            "page_comments" =>$value4['page_comments'],
+                                            "item_id" => $item_id,
+                                            "cat_id" => $cat_id2 ,
+                                            "addtime" =>time(),
+                                            );
+                                        D("Page")->add($page_data);
+                                        unset($page_data);
+                                        unset($value4);
+                                    }
+                                }
+                             unset($value3);
+                            }
+                    }
+                    unset($value);
+                }
+                 
+            }
+        }
+
+        if ($item['members']) {
+            foreach ($item['members'] as $key => $value) {
+                $member_data = array(
+                    "member_group_id"=>$value['member_group_id'],
+                    "uid"=>$value['uid'],
+                    "username"=>$value['username'],
+                    "item_id"=>$item_id,
+                    "addtime"=>time(),
+                    );
+                D("ItemMember")->add($member_data);
+            }
+        }
+        return $item_id;
+    }
+
+    public function copy($item_id,$uid,$item_name= '',$item_description= '',$item_password = '',$item_domain){
+        return $this->import($this->export($item_id),$uid,$item_name,$item_description,$item_password,$item_domain);
+    }
+    
+}

+ 41 - 0
server/Application/Api/Model/ItemTokenModel.class.php

@@ -0,0 +1,41 @@
+<?php
+namespace Api\Model;
+use Api\Model\BaseModel;
+/**
+ * 
+ * @author star7th      
+ */
+class ItemTokenModel extends BaseModel {
+
+	public function createToken($item_id){
+		$api_key = md5(md5($item_id.microtime().rand()."showdoc")."srffsrfgr".rand()).rand();
+		$api_token = md5(md5($item_id.microtime().rand()."showdoc")."rgrhbtgd34".rand()).rand();
+		$data['item_id'] = $item_id ;
+		$data['api_key'] = $api_key ;
+		$data['api_token'] = $api_token ;
+		$data['addtime'] = time() ;
+		$ret = $this->add($data);
+		if ($ret) {
+			return $ret ;
+		}
+		return false ;
+	}
+
+	public function getTokenByItemId($item_id){
+		$item_token = $this->where("item_id='$item_id'")->find();
+		if (!$item_token) {
+			$this->createToken($item_id);
+			$item_token = $this->where("item_id='$item_id'")->find();
+		}
+		return $item_token ;
+	}
+
+	public function getTokenByKey($api_key){
+		$item_token = $this->where("api_key='%s'",array($api_key))->find();
+		return $item_token ;
+	}
+
+	public function setLastTime($item_id){
+		return $this->where("item_id='$item_id'")->save(array("last_check_time"=>time()));
+	}
+}

+ 48 - 0
server/Application/Api/Model/UserModel.class.php

@@ -0,0 +1,48 @@
+<?php
+namespace Api\Model;
+use Api\Model\BaseModel;
+
+class UserModel extends BaseModel {
+
+    /**
+     * 用户名是否已经存在
+     * 
+     */
+    public function isExist($username){
+        return  $this->where("username = '%s'",array($username))->find();
+    }
+
+    /**
+     * 注册新用户
+     * 
+     */
+    public function register($username,$password){
+        $password = md5(base64_encode(md5($password)).'576hbgh6');
+        return $this->add(array('username'=>$username ,'password'=>$password , 'reg_time'=>time()));
+    }
+
+    //修改用户密码
+    public function updatePwd($uid, $password){
+        $password = md5(base64_encode(md5($password)).'576hbgh6');
+        return $this->where("uid ='%d' ",array($uid))->save(array('password'=>$password));   
+    }
+
+    /**
+     * 返回用户信息
+     * @return 
+     */
+    public function userInfo($uid){
+        return  $this->where("uid = '%d'",array($uid))->find();
+    }
+
+    /**
+     *@param username:登录名  
+     *@param password 登录密码   
+     */
+    
+    public function checkLogin($username,$password){
+        $password = md5(base64_encode(md5($password)).'576hbgh6');
+        $where=array($username,$password,$username,$password);
+        return $this->where("( username='%s'  and password='%s' ) ",$where)->find();
+    }
+}

+ 34 - 0
server/Application/Api/Model/UserTokenModel.class.php

@@ -0,0 +1,34 @@
+<?php
+namespace Api\Model;
+use Api\Model\BaseModel;
+/**
+ * 
+ * @author star7th      
+ */
+class UserTokenModel extends BaseModel {
+
+	public function createToken($uid,$token_expire = 0 ){
+		$token_expire = $token_expire > 0  ? (time() + $token_expire ) : (time() + 60*60*24*90 );
+		$token = md5(md5($uid.$token_expire.time().rand()."showdoc")."thyjhhyhhvxdtr6kiykyn");
+		$data['uid'] = $uid ;
+		$data['token'] = $token ;
+		$data['token_expire'] = $token_expire ;
+		$data['ip'] = getIPaddress() ;
+		$data['addtime'] = time() ;
+		$ret = $this->add($data);
+		if ($ret) {
+			//删除过期的token 
+			$this->where( "token_expire < ".time() )->delete();
+			return $token ;
+		}
+		return false ;
+	}
+
+	public function getToken($token){
+		return $this->where("token='%s'",array($token))->find();
+	}
+
+	public function setLastTime($token){
+		return $this->where("token='%s'",array($token))->save(array("last_check_time"=>time()));
+	}
+}

+ 1 - 0
server/Application/Api/Model/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/Api/View/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/Api/index.html

@@ -0,0 +1 @@
+ 

+ 196 - 0
server/Application/Common/Common/function.php

@@ -0,0 +1,196 @@
+<?php
+
+
+/**
+ * 获得当前的域名
+ *
+ * @return  string
+ */
+function get_domain()
+{
+    /* 协议 */
+    $protocol = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
+
+    /* 域名或IP地址 */
+    if (isset($_SERVER['HTTP_X_FORWARDED_HOST']))
+    {
+        $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
+    }
+    elseif (isset($_SERVER['HTTP_HOST']))
+    {
+        $host = $_SERVER['HTTP_HOST'];
+    }
+    else
+    {
+        /* 端口 */
+        if (isset($_SERVER['SERVER_PORT']))
+        {
+            $port = ':' . $_SERVER['SERVER_PORT'];
+
+            if ((':80' == $port && 'http://' == $protocol) || (':443' == $port && 'https://' == $protocol))
+            {
+                $port = '';
+            }
+        }
+        else
+        {
+            $port = '';
+        }
+
+        if (isset($_SERVER['SERVER_NAME']))
+        {
+            $host = $_SERVER['SERVER_NAME'] . $port;
+        }
+        elseif (isset($_SERVER['SERVER_ADDR']))
+        {
+            $host = $_SERVER['SERVER_ADDR'] . $port;
+        }
+    }
+
+    return $protocol . $host;
+}
+
+/**
+ * 获得网站的URL地址
+ *
+ * @return  string
+ */
+function site_url()
+{
+    return get_domain() . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'));
+}
+
+
+//导出称word
+function output_word($data,$fileName=''){
+
+    if(empty($data)) return '';
+
+    $data = '
+        <html xmlns:v="urn:schemas-microsoft-com:vml"
+        xmlns:o="urn:schemas-microsoft-com:office:office"
+        xmlns:w="urn:schemas-microsoft-com:office:word"
+        xmlns="http://www.w3.org/TR/REC-html40">
+        <head><meta http-equiv=Content-Type content="text/html;  
+        charset=utf-8">
+        <style type="text/css">
+            table  
+            {  
+                border-collapse: collapse;
+                border: none;  
+                width: 100%;  
+            }  
+            td  
+            {  
+                border: solid #CCC 1px;  
+            }  
+            .codestyle{
+                word-break: break-all;
+                background:silver;mso-highlight:silver;
+            }
+        </style>
+        <meta name=ProgId content=Word.Document>
+        <meta name=Generator content="Microsoft Word 11">
+        <meta name=Originator content="Microsoft Word 11">
+        <xml><w:WordDocument><w:View>Print</w:View></xml></head>
+        <body>'.$data.'</body></html>';
+    
+    $filepath = tmpfile();
+    $data = str_replace("<thead>\n<tr>","<thead><tr style='background-color: rgb(0, 136, 204); color: rgb(255, 255, 255);'>",$data);
+    $data = str_replace("<pre><code>","<table width='100%' class='codestyle'><pre><code>",$data);
+    $data = str_replace("</code></pre>","</code></pre></table>",$data);
+    $len = strlen($data);
+    fwrite($filepath, $data);
+    header("Content-type: application/octet-stream");
+    header("Content-Disposition: attachment; filename={$fileName}.doc");
+    header('Content-Description: File Transfer');
+    header('Content-Type: application/octet-stream');
+    header('Content-Disposition: attachment; filename='.$fileName.'.doc');
+    header('Content-Transfer-Encoding: binary');
+    header('Expires: 0');
+    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+    header('Pragma: public');
+    header('Content-Length: ' . $len);
+    rewind($filepath);
+    echo fread($filepath,$len);
+}
+
+
+function clear_runtime($path = RUNTIME_PATH){  
+    //给定的目录不是一个文件夹  
+    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;  
+}
+
+//获取ip
+function getIPaddress(){
+    $IPaddress='';
+    if (isset($_SERVER)){
+        if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
+            $IPaddress = $_SERVER["HTTP_X_FORWARDED_FOR"];
+        } else if (isset($_SERVER["HTTP_CLIENT_IP"])) {
+            $IPaddress = $_SERVER["HTTP_CLIENT_IP"];
+        } else {
+            $IPaddress = $_SERVER["REMOTE_ADDR"];
+        }
+    } else {
+        if (getenv("HTTP_X_FORWARDED_FOR")){
+            $IPaddress = getenv("HTTP_X_FORWARDED_FOR");
+        } else if (getenv("HTTP_CLIENT_IP")) {
+            $IPaddress = getenv("HTTP_CLIENT_IP");
+        } else {
+            $IPaddress = getenv("REMOTE_ADDR");
+        }
+    }
+    return $IPaddress;
+
+}
+
+/**
+ * POST 请求
+ *
+ * @param string $url           
+ * @param array $param          
+ * @return string content
+ */
+function http_post($url, $param) {
+    $oCurl = curl_init ();
+    if (stripos ( $url, "https://" ) !== FALSE) {
+        curl_setopt ( $oCurl, CURLOPT_SSL_VERIFYPEER, FALSE );
+        curl_setopt ( $oCurl, CURLOPT_SSL_VERIFYHOST, false );
+    }
+    if (is_string ( $param )) {
+        $strPOST = $param;
+    } else {
+        $aPOST = array ();
+        foreach ( $param as $key => $val ) {
+            $aPOST [] = $key . "=" . urlencode ( $val );
+        }
+        $strPOST = join ( "&", $aPOST );
+    }
+    curl_setopt ( $oCurl, CURLOPT_URL, $url );
+    curl_setopt ( $oCurl, CURLOPT_RETURNTRANSFER, 1 );
+    curl_setopt ( $oCurl, CURLOPT_POST, true );
+    curl_setopt ( $oCurl, CURLOPT_POSTFIELDS, $strPOST );
+    $sContent = curl_exec ( $oCurl );
+    curl_close ( $oCurl );
+    return $sContent;
+}

+ 1 - 0
server/Application/Common/Common/index.html

@@ -0,0 +1 @@
+ 

+ 35 - 0
server/Application/Common/Conf/config.php

@@ -0,0 +1,35 @@
+<?php
+return array(
+    //'配置项'=>'配置值'
+    //使用sqlite数据库
+    'DB_TYPE'   => 'Sqlite', 
+    'DB_NAME'   => '../Sqlite/showdoc.db.php', 
+    //showdoc不再支持mysql http://www.showdoc.cc/help?page_id=31990
+    'DB_HOST'   => 'localhost',
+    'DB_USER'   => 'showdoc', 
+    'DB_PWD'    => 'showdoc123456',
+    'DB_PORT'   => 3306, // 端口
+    'DB_PREFIX' => '', // 数据库表前缀
+    'DB_CHARSET'=> 'utf8', // 字符集
+    'DB_DEBUG'  =>  TRUE, // 数据库调试模式 开启后可以记录SQL日志
+    'URL_HTML_SUFFIX' => '',//url伪静态后缀
+    'URL_MODEL' => 3 ,//URL兼容模式
+    'URL_CASE_INSENSITIVE'=>true,
+    'SHOW_ERROR_MSG'        =>  true,    // 显示错误信息,这样在部署模式下也能显示错误
+    'STATS_CODE' =>'',  //可选,统计代码
+    'TMPL_CACHE_ON' => false,//禁止模板编译缓存
+    'HTML_CACHE_ON' => false,//禁止静态缓存
+    //上传文件到七牛的配置
+    'UPLOAD_SITEIMG_QINIU' => array(
+                    'maxSize' => 5 * 1024 * 1024,//文件大小
+                    'rootPath' => './',
+                    'saveName' => array ('uniqid', ''),
+                    'driver' => 'Qiniu',
+                    'driverConfig' => array (
+                            'secrectKey' => '', 
+                            'accessKey' => '',
+                            'domain' => '',
+                            'bucket' => '', 
+                        )
+                    ),
+);

+ 1 - 0
server/Application/Common/Conf/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/Common/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/Home/Common/index.html

@@ -0,0 +1 @@
+ 

+ 4 - 0
server/Application/Home/Conf/config.php

@@ -0,0 +1,4 @@
+<?php
+return array(
+	//'配置项'=>'配置值'
+);

+ 1 - 0
server/Application/Home/Conf/index.html

@@ -0,0 +1 @@
+ 

+ 8 - 0
server/Application/Home/Controller/IndexController.class.php

@@ -0,0 +1,8 @@
+<?php
+namespace Home\Controller;
+use Think\Controller;
+class IndexController extends Controller {
+    public function index(){
+        $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p><br/>版本 V{$Think.version}</div><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
+    }
+}

+ 1 - 0
server/Application/Home/Controller/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/Home/Model/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/Home/View/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/Home/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/README.md

@@ -0,0 +1 @@
+项目目录

+ 1 - 0
server/Application/Runtime/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/Application/index.html

@@ -0,0 +1 @@
+ 

+ 1 - 0
server/README.md

@@ -0,0 +1 @@
+server后台主要提供API给前台操作。由于历史原因,并不是很多接口都在server目录下。旧的就不管了,新的接口都会写到这里来

+ 26 - 0
server/index.php

@@ -0,0 +1,26 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// 应用入口文件
+
+// 检测PHP环境
+if(version_compare(PHP_VERSION,'5.3.0','<'))  die('require PHP > 5.3.0 !');
+
+// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
+//define('APP_DEBUG',True);
+
+// 定义应用目录
+define('APP_PATH','./Application/');
+
+// 引入ThinkPHP入口文件
+require '../ThinkPHP/ThinkPHP.php';
+
+// 亲^_^ 后面不需要任何代码了 就是如此简单

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff