Beispiel #1
0
    }
    exit;
}
$prev_next = $post->prev_next($id);
if (!is_dir("{$main_cache_dir}" . "" . "\\api_cache/{$id}")) {
    $cache->create_page_cache("cache/{$id}");
}
$data = $cache->load("api_cache/" . $id . "/post." . $api_type . ".cache");
if ($data !== false) {
    echo str_replace("f6ca1c7d5d00a2a3fb4ea2f7edfa0f96a6d09c11717f39facabad2d724f16fbb", $domain, $data);
    flush();
} else {
    ob_start();
    if ($api_type == 'json') {
        header('Content-type: application/json');
        $posts = array(createPostObject($post_data));
        $postsArr = array('offset' => 0, 'count' => 1, 'posts' => $posts);
        echo json_encode($postsArr);
    } else {
        header('Content-type: text/xml');
        $posts = '<?xml version="1.0" encoding="UTF-8"?><posts offset="0" count="1">' . "\r\n";
        $posts .= createPostXML($post_data);
        $posts .= '</posts>';
        echo $posts;
    }
    $data = '';
    $data = ob_get_contents();
    ob_end_clean();
    $cache->save("cache/" . $id . "/post." . $api_type . ".cache", $data);
    echo str_replace("f6ca1c7d5d00a2a3fb4ea2f7edfa0f96a6d09c11717f39facabad2d724f16fbb", $domain, $data);
}
Beispiel #2
0
 } else {
     if ($no_cache === true || $tag_count > 1 || strpos(strtolower($new_tag_cache), "user:"******"rating:") !== false || substr($new_tag_cache, 0, 1) == "-" || strpos(strtolower($new_tag_cache), "*") !== false || strpos(strtolower($new_tag_cache), "parent:") !== false) {
         $query = $query . " LIMIT {$page}, {$limit}";
     }
 }
 if (!isset($_GET['tags']) || $no_cache === true || $tag_count > 1 || strtolower($_GET['tags']) == "all" || strpos(strtolower($new_tag_cache), "user:"******"rating:") !== false || substr($new_tag_cache, 0, 1) == "-" || strpos(strtolower($new_tag_cache), "*") !== false || strpos(strtolower($new_tag_cache), "parent:") !== false) {
     if ($no_cache === true) {
         ob_start();
     }
     $result = $db->query($query) or die($db->error);
     if ($api_type == 'json') {
         header('Content-type: application/json');
         $posts = array();
         $i = 0;
         while ($row = $result->fetch_assoc()) {
             $posts[$i++] = createPostObject($row);
         }
         $postsArr = array('offset' => $page, 'count' => $numrows, 'posts' => $posts);
         $result->free_result();
         echo json_encode($postsArr);
     } else {
         header('Content-type: text/xml');
         $posts = '<?xml version="1.0" encoding="UTF-8"?><posts offset="' . $page . '" count="' . $numrows . '">' . "\r\n";
         while ($row = $result->fetch_assoc()) {
             $posts .= createPostXML($row);
         }
         $posts .= '</posts>';
         echo $posts;
     }
 }
 //Cache doesn't exist for search, make one.