/** * Return an array with all navigation link * * @param integer $id The id of the actual strip * @param integer $last The last id of the strip cache * @param Lang $lang The Lang object use for the actual user * @return array An array with the navigation link : array(first, last, previous, next, gallery) */ function getNavigation($id, $last, Lang $lang) { $url = Config::getUrl() . '/' . Config::getIndex() . '?id='; $nav_lang = ''; if (isset($_GET['lang'])) { $nav_lang = '&lang=' . $lang; } $return[0] = $url . '0' . $nav_lang; $return[1] = $url . $last . $nav_lang; if ($id != 0) { $return[2] = $url . ($id - 1) . $nav_lang; } else { $return[2] = $url . '0' . $nav_lang; } if ($id != $last) { $return[3] = $url . ($id + 1) . $nav_lang; } else { $return[3] = $url . $last . $nav_lang; } $return[4] = Config::getUrl() . '/' . Config::getGallery() . '?page=' . floor($id / Config::getThumbsPerPage()) . '&limit=' . Config::getThumbsPerPage() . $nav_lang; return $return; }
//Launch Cron Cron::exec(); // Obtain the Config $config = new Config(); // Obtain the cache $cache = Cache::getCache(); // Obtain the id asked $last = Cache::getLastId(); // Obtain the limit if (isset($_GET['limit']) && is_numeric($_GET['limit'])) { $limit = $_GET['limit']; if ($limit <= 0 || $limit > $last + 1) { $limit = Config::getThumbsPerPage(); } } else { $limit = Config::getThumbsPerPage(); } // Obtain the page $last_page = (int) ($last / $limit); if (isset($_GET['page']) && is_numeric($_GET['page'])) { $page = $_GET['page']; if ($page < 0 || $page > $last_page) { $page = $last_page; } } else { $page = $last_page; } // Obtain the list of strip $begin = $page * $limit; $end = $begin + $limit; if ($end > $last + 1) {