get.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. if(isset($_GET["collection_id"])){
  12. $collectionId = $_GET["collection_id"];
  13. }
  14. else{
  15. $collectionId = "";
  16. }
  17. $redis = redis_connect();
  18. $article = new Article($redis);
  19. $power = $article->getPower($_GET["id"],$collectionId);
  20. if($power<10){
  21. $output = array();
  22. $output["title"]="Sorry对不起";
  23. $output["subtitle"]="No Power For Read<br>没有阅读权限";
  24. $output["summary"]="";
  25. $output["content"]="This is a **private** rescouce, reading need special <guide gid='power_set'><b>power</b></guide>.<br>该资源是**私密**资源,阅读需要<guide gid='power_set'><b>权限</b></guide>。";
  26. $output["owner"]="";
  27. $output["username"]=array("username"=>"","nickname"=>"");
  28. $output["status"]="";
  29. echo json_encode($output, JSON_UNESCAPED_UNICODE);
  30. exit;
  31. }
  32. #查询权限结束
  33. /*
  34. PDO_Connect(""._FILE_DB_USER_ARTICLE_);
  35. $id=$_GET["id"];
  36. $query = "SELECT * FROM article WHERE id = ? ";
  37. $Fetch = PDO_FetchRow($query,array($id));
  38. */
  39. $Fetch = $article->getInfo($_GET["id"]);
  40. if($Fetch){
  41. $Fetch["content"] = $article->getContent($_GET["id"]);
  42. $userinfo = new UserInfo();
  43. $user = $userinfo->getName($Fetch["owner"]);
  44. $Fetch["username"] = $user;
  45. echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
  46. exit;
  47. }
  48. }
  49. echo json_encode(array(), JSON_UNESCAPED_UNICODE);
  50. ?>