if ($config['cache'] == 'on') { $popHashes = popularHashesCache(); $filename = $config['basedir'] . '/themes/cache/hot.txt'; $data = file_get_contents($filename); $posts = json_decode($data); $totalvideos = count($posts); $posts = sliceArray($pagingstart, $posts); //echo '<pre>'; //print_r($posts); //exit; } else { $query1 = "SELECT count(DISTINCT A.PID) as total from posts A, members B where A.active='1' AND A.USERID=B.USERID AND A.phase>'1' order by A.htime desc limit {$config['maximum_results']}"; $query2 = "SELECT A.*, B.username from posts A, members B where A.active='1' AND A.USERID=B.USERID AND A.phase>'1' order by A.htime desc limit {$pagingstart}, {$config['items_per_page']}"; $executequery1 = $conn->Execute($query1); $totalvideos = $executequery1->fields['total']; $popHashes = popularHashes(); } $infinity_paging = $config['infinity_paging']; if ($infinity_paging == "1") { $templateselect = "index.tpl"; if ($totalvideos > 0) { if ($totalvideos <= $config['maximum_results']) { $total = $totalvideos; } else { $total = $config['maximum_results']; } $toppage = ceil($total / $config['items_per_page']); if ($toppage == 0) { $xpage = $toppage + 1; } else { $xpage = $toppage;
function tagsFileCreate() { global $config; $max_tags = $config['api_max_tags']; $tags_array = array(); $tags_file = $config['basedir'] . '/tag/cache/tags.txt'; if (file_exists($tags_file)) { unlink($tags_file); } $tags = popularHashes(0); // 0 -> get all $loop_end = count($tags) > $max_tags ? $max_tags : count($tags); for ($i = 0; $i < $loop_end; $i++) { $new_tags[$i] = $tags[$i]; } $new_tags = json_encode($new_tags); file_put_contents($tags_file, $new_tags); return $tags_file; }