get.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. //获取article内容
  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. $collectionId = $_GET["collection_id"];
  12. $redis = redis_connect();
  13. $article = new Article($redis);
  14. $power = $article->getPower($_GET["id"],$collectionId);
  15. if($power<10){
  16. $output = array();
  17. $output["title"]="error";
  18. $output["subtitle"]="No Power For Read";
  19. $output["summary"]="";
  20. $output["content"]="该资源不是公开资源。您**没有**阅读权限。";
  21. $output["owner"]="";
  22. $output["username"]=array("username"=>"","nickname"=>"");
  23. $output["status"]="";
  24. echo json_encode($output, JSON_UNESCAPED_UNICODE);
  25. exit;
  26. }
  27. #查询权限结束
  28. /*
  29. PDO_Connect(""._FILE_DB_USER_ARTICLE_);
  30. $id=$_GET["id"];
  31. $query = "SELECT * FROM article WHERE id = ? ";
  32. $Fetch = PDO_FetchRow($query,array($id));
  33. */
  34. $Fetch = $article->getInfo($_GET["id"]);
  35. if($Fetch){
  36. $Fetch["content"] = $article->getContent($_GET["id"]);
  37. $userinfo = new UserInfo();
  38. $user = $userinfo->getName($Fetch["owner"]);
  39. $Fetch["username"] = $user;
  40. echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
  41. exit;
  42. }
  43. }
  44. echo json_encode(array(), JSON_UNESCAPED_UNICODE);
  45. ?>