You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
218 lines
6.4 KiB
218 lines
6.4 KiB
<?php
|
|
/*
|
|
*
|
|
* @copyright (c) 2009 animegame.eu
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
|
*
|
|
*/
|
|
|
|
include_once(ROOT_PATH.'/include/defines.inc.php');
|
|
include_once(ROOT_PATH.'/include/usergroup.inc.php');
|
|
include_once(ROOT_PATH.'/include/config/settings.inc.php');
|
|
|
|
defineIfNotDefined('GROUP_COLOR_SUPPORTER', 'gold');
|
|
defineIfNotDefined('GROUP_COLOR_GAMEMASTER', 'lime');
|
|
defineIfNotDefined('GROUP_COLOR_DEVELOPER', 'orange');
|
|
defineIfNotDefined('GROUP_COLOR_CREATIVE', 'red');
|
|
|
|
// Diese Funktion muss in ein Darstellungspackage hinein und muss noch verlegt werden, Gestaltung in css-Datei
|
|
|
|
/**
|
|
* use generateUserLinkByID instead
|
|
* @deprecated
|
|
*/
|
|
function displayUserLink($userid, $username = NULL, $clanpre = NULL, $clansu = NULL){
|
|
// backwards compat!!
|
|
return displayUserLinkByID($userid);
|
|
}
|
|
|
|
/**
|
|
* use generateUserNameByID instead
|
|
* @deprecated
|
|
*/
|
|
function displayUserNameByID($userid, $showClanTags = TRUE){
|
|
return generateUserNameByID($userid, $showClanTags);
|
|
}
|
|
|
|
function generateUserNameByID($userid, $showClanTags = TRUE){
|
|
if($userid === null){return '';}
|
|
|
|
$groups = getUserGroups($userid);
|
|
|
|
$sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff from user left join clan on user.clan = clan.id where user.id = '.$userid;
|
|
$user_info = mysql_fetch_assoc(mysql_query($sql));
|
|
if(isUserInGroup($groups, WERBUNG_AN)){
|
|
if(isUserInGroup($groups, ADMIN)){
|
|
$color = 'style="color:'.GROUP_COLOR_GAMEMASTER.'"';
|
|
} else if(isUserInGroup($groups, ENTWICKLER)){
|
|
$color = 'style="color:'.GROUP_COLOR_DEVELOPER.'"';
|
|
} else if(isUserInGroup($groups, DESIGNER)){
|
|
$color = 'style="color:'.GROUP_COLOR_CREATIVE.'"';
|
|
} else {
|
|
$color = 'style="color:'.GROUP_COLOR_SUPPORTER.'"';
|
|
}
|
|
} else{
|
|
$color = '';
|
|
}
|
|
|
|
$nickname = $user_info['nickname'];
|
|
if($user_info['clanz_pre'] !== NULL && $user_info['clanz_pre'] != '' && $showClanTags) {
|
|
$nickname = '<span style="color:'.$GLOBALS['COLOR_CLAN_TAG'].'">'.$user_info['clanz_pre'] . '</span> ' . $nickname;
|
|
}
|
|
if($user_info['clanz_suff'] !== NULL && $user_info['clanz_suff'] != '' && $showClanTags) {
|
|
$nickname = $nickname . ' <span style="color:'.$GLOBALS['COLOR_CLAN_TAG'].'">' . $user_info['clanz_suff'] . '</span>';
|
|
}
|
|
|
|
if($color == ''){
|
|
return $nickname;
|
|
} else{
|
|
return '<span '.$color.'>'.$nickname.'</span>';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* use generateUserLinkByID instead
|
|
* @deprecated
|
|
*/
|
|
function displayUserLinkByID($userid, $showClanTags = TRUE){
|
|
return generateUserLinkByID($userid, $showClanTags);
|
|
}
|
|
|
|
function generateUserLinkByID($userid, $showClanTags = TRUE){
|
|
return '<a href="index.php?as=info&user_id='.$userid.'">'.displayUserNameByID($userid, $showClanTags).'</a>';
|
|
}
|
|
|
|
|
|
function displayClanLink($clanid, $clanname = NULL){
|
|
if($clanname === NULL) {
|
|
$qry = mysql_query('SELECT clanname FROM clan WHERE id = ' . $clanid);
|
|
$row = mysql_fetch_assoc($qry);
|
|
$clanname = $row['clanname'];
|
|
}
|
|
return '<a href="index.php?as=clan/clan_info&clan_id='.$clanid.'">'.$clanname.'</a>';
|
|
}
|
|
|
|
function displayHistoryBackLink(){
|
|
return '<a href="javascript:history.back()" id="content">zurück</a>';
|
|
}
|
|
|
|
function displayIndexBackLink(){
|
|
return '<a href="index.php">zurück</a>';
|
|
}
|
|
|
|
function displayCharLink($charid, $charname, $img = NULL, $clanpre = NULL, $clansu = NULL){
|
|
if($clanpre !== NULL && $clansu !== NULL){
|
|
$charname = $clanpre.' '.$charname.' '.$clansu;
|
|
}
|
|
if($img === NULL){
|
|
return '<a href="index.php?as=info&charm=1&char_id='.$charid.'">'.$charname.'</a>';
|
|
} else{
|
|
return '<a href="index.php?as=info&charm=1&char_id='.$charid.'">'.$charname.'<br><img src="'.$img.'" border="0" width="75" height="75"></a>';
|
|
}
|
|
}
|
|
|
|
function displayItemLink($tablename, $itemid, $itemname){
|
|
if($itemname != 'Geheim!'){
|
|
return '<a href="index.php?as=info&charm=2&group='.$tablename.'&item_id='.$itemid.'">'.$itemname.'</a>';
|
|
}
|
|
return $itemname;
|
|
}
|
|
|
|
function displayAuktionsLink($kategorie,$itemnamepart,$itemname,$entriesPerSite,$pageNumber,$maxPrice){
|
|
return '<a href="index.php?as=auktion&kategorie='.$kategorie.'&itemname='.$itemnamepart.'&entries='.$entriesPerSite.'&maxpreis='.$maxPrice.'">Hier Klicken um Auktionen des Items '.$itemname.' anzeigen zu lassen!</a>';
|
|
}
|
|
|
|
// Soll die alte displayPagelinks ersetzen
|
|
function displayPagelinksNew($entriesPerPage, $totalEntries, $aktualPage, $url){
|
|
$maxPages = ceil($totalEntries/$entriesPerPage);
|
|
return displayPagelinks($aktualPage, $maxPages, $url);
|
|
}
|
|
|
|
function displayPagelinks($aktualPage, $maxPages, $url){
|
|
// Erstmal die link vorher/nachher
|
|
$vorher = '<td align="left" width="0">vorherige Seite</td>';
|
|
$nachher = '<td align="right" width="0">nächste Seite</td>';
|
|
$puffer = '';
|
|
$search = array('/###PAGE###/','/###LABEL###/');
|
|
|
|
if(0 < $aktualPage){
|
|
$vorher = '<td align="left" width="0">'.preg_replace($search,array($aktualPage-1,'vorherige Seite'),$url).'</td>';
|
|
}
|
|
if($maxPages-1 > $aktualPage){
|
|
$nachher = '<td align="right" width="0">'.preg_replace($search,array($aktualPage+1,'nächste Seite'),$url).'</td>';
|
|
}
|
|
|
|
$normalStep = 1;
|
|
$width=0;
|
|
if($maxPages > 50){
|
|
$normalStep = 10;
|
|
$width = 5;
|
|
} else if($maxPages > 30){
|
|
$normalStep = 5;
|
|
$width = 15;
|
|
}
|
|
$min = $aktualPage-$width+1;
|
|
$max = $aktualPage+$width+1;
|
|
for($i=1;$i<=$maxPages;$i++){
|
|
if($i == 1 || $i%$normalStep == 0 || $i >= $min && $i <= $max){
|
|
$puffer.='<td align="center">'.preg_replace($search,Array($i-1,$i),$url).'</td>';
|
|
}
|
|
}
|
|
return '<table width="100%" cellpadding="0" cellspacing="0"><tr>'.$vorher.$puffer.$nachher.'</tr></table>';
|
|
}
|
|
|
|
function displayMoney($value){
|
|
return number_format($value,0,'','.').' ¥';
|
|
}
|
|
|
|
function displayCount($value){
|
|
return number_format($value,0,'','.');
|
|
}
|
|
|
|
function generateTimerHtml($timerId, $timeInSeconds, $htmlOnExpire) {
|
|
?>
|
|
<span id='timer_<?php echo $timerId; ?>'>
|
|
<?php
|
|
if($timeInSeconds <= 0){
|
|
echo $htmlOnExpire;
|
|
} else{
|
|
?>
|
|
<script type='text/javascript'>
|
|
v=new Date();
|
|
var ht=document.getElementById('timer_<?php echo $timerId; ?>');
|
|
function t(){
|
|
n=new Date();
|
|
s=<?php echo $timeInSeconds; ?>-Math.round((n.getTime()-v.getTime())/1000.);
|
|
m=0;
|
|
h=0;
|
|
if(s<0){
|
|
ht.innerHTML="<?php echo $htmlOnExpire; ?>"
|
|
} else {
|
|
if(s>59){
|
|
m=Math.floor(s/60);s=s-m*60
|
|
}
|
|
if(m>59){
|
|
h=Math.floor(m/60);m=m-h*60
|
|
}
|
|
if(s<10){
|
|
s='0'+s
|
|
}
|
|
if(m<10){
|
|
m='0'+m
|
|
}
|
|
ht.innerHTML=h+':'+m+':'+s
|
|
}
|
|
window.setTimeout('t();',950);
|
|
}
|
|
window.onload=t;
|
|
</script>
|
|
<?php
|
|
}
|
|
?>
|
|
</span>
|
|
<?php
|
|
}
|
|
|
|
|
|
?>
|