get.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. //查询term字典
  3. require_once "../path.php";
  4. require_once "../public/_pdo.php";
  5. require_once '../public/function.php';
  6. require_once '../ucenter/function.php';
  7. require_once '../redis/function.php';
  8. require_once "../article/function.php";
  9. if(isset($_GET["id"])){
  10. //查询权限
  11. $redis = redis_connect();
  12. $article = new Article($redis);
  13. $power = $article->getPower($_GET["id"]);
  14. if($power<10){
  15. $output = array();
  16. $output["title"]="error";
  17. $output["subtitle"]="No Power For Read";
  18. $output["summary"]="";
  19. $output["content"]="该资源不是公开资源。您**没有**阅读权限。";
  20. $output["owner"]="";
  21. $output["username"]=array("username"=>"","nickname"=>"");
  22. $output["status"]="";
  23. echo json_encode($output, JSON_UNESCAPED_UNICODE);
  24. exit;
  25. }
  26. #查询权限结束
  27. /*
  28. PDO_Connect(""._FILE_DB_USER_ARTICLE_);
  29. $id=$_GET["id"];
  30. $query = "SELECT * FROM article WHERE id = ? ";
  31. $Fetch = PDO_FetchRow($query,array($id));
  32. */
  33. $Fetch = $article->getInfo($_GET["id"]);
  34. if($Fetch){
  35. $Fetch["content"] = $article->getContent($_GET["id"]);
  36. $userinfo = new UserInfo();
  37. $user = $userinfo->getName($Fetch["owner"]);
  38. $Fetch["username"] = $user;
  39. echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
  40. exit;
  41. }
  42. }
  43. echo json_encode(array(), JSON_UNESCAPED_UNICODE);
  44. ?>