<?php
/*-------------------------------------------------------+
| Guestbook Infusion 4.12
| Author: Sebastian Schüssler (slaughter)
| Download:
| http://basti2web.de
+--------------------------------------------------------+
| Filename: functions_seo.php
| Version: 4.12
| Author: Sebastian Schüssler (slaughter)
+--------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
define("GB_SEO", ($gb_config['gb_seo_active'] == 1) ? 1 : 0);
if(!defined("GB_SEO_URL1")) define("GB_SEO_URL1", "guestbook");
if(!defined("GB_SEO_URL2")) define("GB_SEO_URL2", "guestbook-entry");
if(!defined("GB_SEO_URL3")) define("GB_SEO_URL3", "guestbook_");
// PHPF-Page-Nav modified by Basti for SEO Url-Rewrite
function makepagenav_seo($start, $count, $total, $range = 0, $link = "") {
global $locale;
if ($link == "") { $link = $locale['linkname']; }
$pg_cnt = ceil($total / $count);
if ($pg_cnt <= 1) { return ""; }
$idx_back = $start - $count;
$idx_next = $start + $count;
$cur_page = ceil(($start + 1) / $count);
$res = $locale['global_092']." ".$cur_page.$locale['global_093'].$pg_cnt.": ";
if($idx_back >= 0) {
if($cur_page > ($range + 1)) {
$res .= "<a href='".GB_SEO_URL1.".html'>1</a>...";
}
}
$idx_fst = max($cur_page - $range, 1);
$idx_lst = min($cur_page + $range, $pg_cnt);
if ($range == 0) {
$idx_fst = 1;
$idx_lst = $pg_cnt;
}
for ($i = $idx_fst; $i <= $idx_lst; $i++) {
$offset_page = ($i - 1) * $count;
if ($i == $cur_page) {
$res .= "<span><strong>".$i."</strong></span>";
} else {
if($offset_page == '0') {
$res .= "<a href='".GB_SEO_URL1.".html'>".$i."</a>";
} else {
$res .= "<a href='".$link."".$offset_page.".html'>".$i."</a>";
}
}
}
if ($idx_next < $total) {
if ($cur_page < ($pg_cnt - $range)) {
$res .= "...<a href='".$link."".($pg_cnt - 1) * $count.".html'>".$pg_cnt."</a>\n";
}
}
return "<div class='pagenav'>\n".$res."</div>\n";
}
?>