';
if($page!=1) $page_link .= " « ‹";
if($page>=6) $page_link .= " ...";
if($page+4>=$pages) $pagex=$pages;
else $pagex=$page+4;
for($i=$page-4 ; $i<=$pagex ; $i++) {
if($i<=0) $i=1;
if($i==$page) $page_link .= " $i";
else $page_link .= " $i";
}
if(($pages-$page)>=5) $page_link .= " ...";
if($page!=$pages) $page_link .= " › »";
$page_link .= "";
return $page_link;
}
function str_break($str, $maxlen) {
$nobr = 0;
$len = strlen($str);
for ($i = 0; $i<$len; $i++) {
// Überprüfen ob ein das Zeichen ein möglicher Zeilenubruch ist
if (($str[$i]!=' ') && ($str[$i]!='-') && ($str[$i]!="\n")) $nobr++;
else {
$nobr = 0; // Zeichen ist Trennzeichen - Zähler zurücksetzen
if($maxlen+$i>$len) {
// Ist der Rest kürzer als $maxlen, muss er nicht mehr überprüft werden
$str_br .= substr($str, $i);
break;
}
}
// Wenn die Zeichenkette ohne Trennzeichen länger als zulässig ist
// wird ein Trennzeichen eingefügt und der Zähler zurückgesetzt
if ($nobr>$maxlen) {
$str_br .= '-'.$str[$i];
$nobr = 1;
} else $str_br .= $str[$i];
}
return $str_br;
}
// -- BB CODE -- //
systeminc('func/bbcode');
function cleartext($text,$bbcode=true) {
$text=getinput($text);
$text=strip_tags($text);
$text=smileys($text);
$text=insertlinks($text);
$text=flags($text);
if($bbcode) $text=replacement($text);
$text=nl2br($text);
return $text;
}
function htmloutput($text) {
$text=smileys($text);
$text=insertlinks($text);
$text=flags($text);
$text=replacement($text);
$text=stripslashes($text);
$text=nl2br($text);
return $text;
}
function clearfromtags($text) {
$text=getinput($text);
$text=strip_tags($text);
$text=nl2br($text);
return $text;
}
function getinput($text) {
$text=stripslashes($text);
$text=htmlspecialchars($text);
return $text;
}
function isonline($userID) {
$ergebnis=safe_query("SELECT site FROM ".PREFIX."whoisonline WHERE userID='$userID'");
$anz=mysql_num_rows($ergebnis);
if($anz) {
$ds=mysql_fetch_array($ergebnis);
return 'online @ '.$ds[site].'';
}
else return 'offline';
}
// -- GALLERY -- //
systeminc('func/gallery');
// LOGIN
$login_per_cookie = false;
if(isset($_COOKIE['ws_auth']) AND !isset($_SESSION['ws_auth'])) {
$login_per_cookie = true;
$_SESSION['ws_auth'] = $_COOKIE['ws_auth'];
}
systeminc('login');
if($login_per_cookie) {
$ll=mysql_fetch_array(safe_query("SELECT lastlogin FROM ".PREFIX."user WHERE userID='$userID'"));
$_SESSION['ws_lastlogin'] = $ll[lastlogin];
}
// BANNED
$banned=safe_query("SELECT userID, banned FROM ".PREFIX."user WHERE userID='$userID' OR ip='$ip'");
while($db=mysql_fetch_array($banned)) {
if($db[banned]) system_error('You have been banished.',0);
}
// WHO IS - WAS ONLINE
$timeout=5; // 1 sekunde
$deltime = time()-($timeout*60); // IS 1m
$wasdeltime = time()-(60*60*24); // WAS 24h
safe_query("UPDATE ".PREFIX."user SET ip='$ip' WHERE userID='$userID'");
safe_query("DELETE FROM ".PREFIX."whoisonline WHERE time < '$deltime'"); // IS ONLINE
safe_query("DELETE FROM ".PREFIX."whowasonline WHERE time < '$wasdeltime'"); // WAS ONLINE
// SITE VARIABLE
$site = $_GET['site'];
if($closed AND !isanyadmin($userID)) {
$dl=mysql_fetch_array(safe_query("SELECT * FROM `".PREFIX."lock` LIMIT 0,1"));
$reason = $dl[reason];
$time = $dl[time];
showlock($reason, $time);
}
//HELP MODE
systeminc('help');
//WHOISONLINE
if($userID!='') {
// IS ONLINE
if(mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."whoisonline WHERE userID='$userID'"))) {
safe_query("UPDATE ".PREFIX."whoisonline SET time='".time()."', site='$site' WHERE userID='$userID'");
safe_query("UPDATE ".PREFIX."user SET lastlogin='".time()."' WHERE userID='$userID'");
}
else safe_query("INSERT INTO ".PREFIX."whoisonline (time, userID, nickname, site) VALUES ('".time()."', '$userID', '".mysql_escape_string(getnickname($userID))."', '$site')");
// WAS ONLINE
if(mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."whowasonline WHERE userID='$userID'")))
safe_query("UPDATE ".PREFIX."whowasonline SET time='".time()."', site='$site' WHERE userID='$userID'");
else safe_query("INSERT INTO ".PREFIX."whowasonline (time, userID, nickname, site) VALUES ('".time()."', '$userID', '".mysql_escape_string(getnickname($userID))."', '$site')");
}
else {
$anz = mysql_num_rows(safe_query("SELECT ip FROM ".PREFIX."whoisonline WHERE ip='$ip'"));
if($anz) safe_query("UPDATE ".PREFIX."whoisonline SET time='".time()."', site='$site' WHERE ip='$ip'");
else safe_query("INSERT INTO ".PREFIX."whoisonline (time, ip, site) VALUES ('".time()."','$ip', '$site')");
}
// COUNTER
$time = time();
$date = date("d.m.Y", $time);
$deltime = $time-(3600*24);
safe_query("DELETE FROM ".PREFIX."counter_iplist WHERE del<".$deltime);
$anz=mysql_num_rows(safe_query("SELECT ip FROM ".PREFIX."counter_iplist WHERE ip='".$ip."'"));
if(!$anz) {
safe_query("UPDATE ".PREFIX."counter SET hits=hits+1");
safe_query("INSERT INTO ".PREFIX."counter_iplist (dates, del, ip) VALUES ('".$date."', '".$time."', '".$ip."')");
$anz2=mysql_num_rows(safe_query("SELECT dates FROM ".PREFIX."counter_stats WHERE dates='".$date."'"));
if(!$anz2) safe_query("INSERT INTO `".PREFIX."counter_stats` (`dates`, `count`) VALUES ('".$date."', '1')");
else safe_query("UPDATE ".PREFIX."counter_stats SET count=count+1 WHERE dates='".$date."'");
}
$cur=mysql_fetch_array(safe_query("SELECT count(*) FROM ".PREFIX."whoisonline"));
$max=mysql_fetch_array(safe_query("SELECT maxonline FROM ".PREFIX."counter LIMIT 0,1"));
if($cur[0] > $max['maxonline']) safe_query("UPDATE ".PREFIX."counter SET maxonline='".$cur[0]."'");
//Country list
unset($countries);
$ergebnis = safe_query("SELECT * FROM `".PREFIX."countries` ORDER BY country");
while($ds = mysql_fetch_array($ergebnis)) {
$countries .= '';
}
?>