get.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. //获取article内容
  3. include("../log/pref_log.php");
  4. require_once "../config.php";
  5. require_once "../public/_pdo.php";
  6. require_once '../public/function.php';
  7. require_once '../ucenter/function.php';
  8. require_once '../redis/function.php';
  9. require_once "../article/function.php";
  10. if(isset($_GET["id"])){
  11. //查询权限
  12. if(isset($_GET["collection_id"])){
  13. $collectionId = $_GET["collection_id"];
  14. }
  15. else{
  16. $collectionId = "";
  17. }
  18. $redis = redis_connect();
  19. $article = new Article($redis);
  20. $power = $article->getPower($_GET["id"],$collectionId);
  21. if($power<10){
  22. $output = array();
  23. $output["title"]="Sorry对不起";
  24. $output["subtitle"]="No Power For Read<br>没有阅读权限";
  25. $output["summary"]="";
  26. $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>。";
  27. $output["owner"]="";
  28. $output["username"]=array("username"=>"","nickname"=>"");
  29. $output["status"]="";
  30. echo json_encode($output, JSON_UNESCAPED_UNICODE);
  31. exit;
  32. }
  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. PrefLog();
  46. ?>