$id = str_replace("#", "", $id); } $id = (int) $id; $date = date("Ymd"); //Load post_table data and the previous next values in array. 0 previous, 1 next. $post_data = $post->show($id); //Check if data exists in array, if so, kinda ignore it. if ($post_data == "" || is_null($post_data)) { header('Location: index.php?page=post&s=list'); exit; } $prev_next = $post->prev_next($id); if (!is_dir("{$main_cache_dir}" . "" . "\\cache/{$id}")) { $cache->create_page_cache("cache/{$id}"); } $data = $cache->load("cache/" . $id . "/post.cache"); if ($data !== false) { echo str_replace("f6ca1c7d5d00a2a3fb4ea2f7edfa0f96a6d09c11717f39facabad2d724f16fbb", $domain, $data); flush(); $tcount = 1; } else { ob_start(); $tags = mb_trim(html_entity_decode($post_data['tags'], ENT_QUOTES, "UTF-8")); $ttags = explode(" ", $tags); $rating = $post_data['rating']; $lozerisdumb = "- " . str_replace('_', ' ', str_replace('"', '\\"', $tags)); $pg = "post"; require "includes/header.php"; echo '<div id="content"><div id="post-view">'; if (intval($post_data['width']) > 1000) { echo '<div class="status-notice" style="" id="resized_notice">
$no_cache = true; } } else { if (!is_dir("{$main_cache_dir}" . "" . "search_cache/")) { mkdir("{$main_cache_dir}" . "" . "search_cache"); } $tags = $new_tag_cache; if (isset($_GET['pid']) && is_numeric($_GET['pid']) && $_GET['pid'] > 0) { $page = $_GET['pid'] / $limit + 1; } else { $page = 0; } $cache = new cache(); $no_cache = true; if (is_dir("{$main_cache_dir}" . "" . "search_cache/" . $tags . "/") && file_exists("{$main_cache_dir}" . "" . "search_cache/" . $tags . "/" . $page . ".html")) { $data = $cache->load("search_cache/" . $tags . "/" . $page . ".html"); echo $data; $numrows = 1; $no_cache = false; } } } //No images found if ($numrows == 0) { print '</ul></div></div></div><div class="content"><div style="margin-left: 15px;"><h1>No posts matched your search.</h1>'; } else { if (isset($_GET['pid']) && $_GET['pid'] != "" && is_numeric($_GET['pid']) && $_GET['pid'] >= 0) { $page = $db->real_escape_string($_GET['pid']); } else { $page = 0; }
//Load post_table data and the previous next values in array. 0 previous, 1 next. $post_data = $post->show($id); //Check if data exists in array, if so, kinda ignore it. if ($post_data == "" || is_null($post_data)) { if ($api_type == 'json') { print '{"offset":"0","count":"0",posts":[]}'; } else { print '<?xml version="1.0" encoding="UTF-8"?><posts offset="0" count="0"></posts>'; } 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>';
<?php define('TIPASK_ROOT', dirname(__FILE__)); require TIPASK_ROOT . '/config.php'; require TIPASK_ROOT . '/lib/db.class.php'; require TIPASK_ROOT . '/lib/global.func.php'; require TIPASK_ROOT . '/lib/cache.class.php'; define('TIME', time()); /*��ʼ����ݿ����*/ $db = new db(DB_HOST, DB_USER, DB_PW, DB_NAME, DB_CHARSET, DB_CONNECT); /*��ȡ���û���*/ $cache = new cache($db); $setting = $cache->load('setting'); /*��ѹ��get����*/ @extract($_GET, EXTR_SKIP); if (!$setting['passport_open']) { exit('Passport disabled!'); } elseif ($verify != md5($action . $userdb . $forward . $setting['passport_key'])) { exit('Illegal request!'); } parse_str(strcode($userdb, $setting['passport_key'], 'DECODE'), $member); $member['cookietime'] = $member['cktime'] ? $member['cktime'] - TIME : 0; if ($action == 'login') { $member['username'] = preg_replace("/(c:\\con\\con\$|[%,\\*\"\\s\t\\<\\>\\&])/i", "", $member['username']); if (strlen($member['username']) > 20) { $member['username'] = substr($member['username'], 0, 20); } if (empty($member['time']) || empty($member['username']) || empty($member['password'])) { exit('Lack of required parameters!'); } elseif ($setting['passport_expire'] && TIME - $member['time'] > $setting['passport_expire']) { exit('Request expired!');
<?php include 'cache.php'; cache::$html_dir = 'test/html/'; cache::$php_dir = 'test/php/'; function test($string1 = '', $string2 = '') { echo $string1 . "<br />\n"; echo $string2 . "<br />\n"; } echo 'Saving data...'; echo '<hr />'; // Saving cache from function cache::buildFromFunction('html', 'gen', 'first', 'test', array('kernel', 'web')); // Saving cache directly from var $myData = 'All data that you need'; cache::buildFromString('html', 'gen', 'second', $myData); // Saving PHP /*cache::buildFromString('php', 'gen', 'FirstPHP', '<?php echo "See arrayzone.com?"; ?>');*/ // LOADING echo '<h1>Loading data</h1>'; // Load simple html cache::load('html', 'gen', 'first', 3600); // Load PHP (with 50 min maximum of life) if (!cache::load('php', 'gen', 'FirstPHP', 1)) { // Saving PHP again cache::buildFromString('php', 'gen', 'FirstPHP', '<?php echo "See arrayzone.com?"; ?>'); // And loading the last builded cache::loadLast(); }
if ($tag_count > 1 || strtolower($new_tag_cache) == "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) { $no_cache = false; } else { if (!is_dir("{$main_cache_dir}" . "" . "api_cache/" . $new_tag_cache . "/")) { @mkdir("{$main_cache_dir}" . "" . "api_cache/" . $new_tag_cache . "/"); } $no_cache = true; } } else { if (!is_dir("{$main_cache_dir}" . "" . "api_cache/")) { mkdir("{$main_cache_dir}" . "" . "api_cache"); } $tags = $new_tag_cache; $no_cache = true; if (is_dir("{$main_cache_dir}" . "" . "api_cache/" . $tags . "/") && file_exists("{$main_cache_dir}" . "" . "api_cache/" . $tags . "/" . $page . "." . $api_type)) { $data = $cache->load("api_cache/" . $tags . "/" . $page . "." . $api_type); echo $data; $numrows = 1; $no_cache = false; } } } //No images found if ($numrows == 0) { if ($api_type == 'json') { print '{"offset":"' . $page . '","count":"0",posts":[]}'; } else { print '<?xml version="1.0" encoding="UTF-8"?><posts offset="' . $page . '" count="0"></posts>'; } } else { if (!isset($_GET['tags']) || isset($_GET['tags']) && $_GET['tags'] == "all" || isset($_GET['tags']) && $_GET['tags'] == "") {