Browse Source

Improve e-hentai API

spaghetti 8 years ago
parent
commit
83375cc309
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      sections/ajax/doujin.php

+ 7
- 3
sections/ajax/doujin.php View File

16
   json_die("failure", "Invalid URL");
16
   json_die("failure", "Invalid URL");
17
 }
17
 }
18
 
18
 
19
-if ($Cache->get_value('doujin_json_'.$gid) && false) {
19
+if ($Cache->get_value('doujin_json_'.$gid)) {
20
   json_die("success", $Cache->get_value('doujin_json_'.$gid));
20
   json_die("success", $Cache->get_value('doujin_json_'.$gid));
21
 } else {
21
 } else {
22
 
22
 
39
   $tags = array();
39
   $tags = array();
40
   $lang = NULL;
40
   $lang = NULL;
41
   $circle = NULL;
41
   $circle = NULL;
42
+  $censored = true;
42
   foreach ($json["tags"] as $tag) {
43
   foreach ($json["tags"] as $tag) {
43
     if (strpos($tag, ':') !== false) {
44
     if (strpos($tag, ':') !== false) {
44
       list($namespace, $tag) = explode(':', $tag);
45
       list($namespace, $tag) = explode(':', $tag);
50
       $lang = empty($lang) ? ucfirst($tag) : $lang;
51
       $lang = empty($lang) ? ucfirst($tag) : $lang;
51
     } else if ($namespace == "group") {
52
     } else if ($namespace == "group") {
52
       $circle = empty($circle) ? ucfirst($tag) : $circle;
53
       $circle = empty($circle) ? ucfirst($tag) : $circle;
54
+    } else if ($tag == "uncensored") {
55
+      $censored = false;
53
     } else {
56
     } else {
54
       if ($namespace) { $tag = $tag.':'.$namespace; }
57
       if ($namespace) { $tag = $tag.':'.$namespace; }
55
       array_push($tags, str_replace(' ', '.', $tag));
58
       array_push($tags, str_replace(' ', '.', $tag));
58
 
61
 
59
   $json_str = array(
62
   $json_str = array(
60
     'id' => $gid,
63
     'id' => $gid,
61
-    'title' => $json['title'],
62
-    'title_jp' => $json['title_jpn'],
64
+    'title' => html_entity_decode($json['title'], ENT_QUOTES),
65
+    'title_jp' => html_entity_decode($json['title_jpn'], ENT_QUOTES),
63
     'artists' => $artists,
66
     'artists' => $artists,
64
     'circle' => $circle,
67
     'circle' => $circle,
68
+    'censored' => $censored,
65
     'year' => NULL,
69
     'year' => NULL,
66
     'tags' => $tags,
70
     'tags' => $tags,
67
     'lang' => $lang,
71
     'lang' => $lang,

Loading…
Cancel
Save