ok ich post am besten mal meine Profilansicht die wirklich arg modifiziert und geändert wurde. Da blick selbst ich nich mehr durch.
contents/user/memb_list.php
<?php
# Copyright by: Manuel Staechele
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: User :: '.$lang['listofmembers'];
$hmenu = $extented_forum_menu.'User <b> » </b> '.$lang['listofmembers'].$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1 );
$design->header();
if (( $menu->get(2) ? escape($menu->get(2), 'textarea') : 0 ) == asc ){
$name = '<a href="?user-name-desc">'.$lang['name'].'</a>';
}else{
$name = '<a href="?user-name-asc">'.$lang['name'].'</a>';
}
if (( $menu->get(2) ? escape($menu->get(2), 'textarea') : 0 ) == asc ){
$rang = '<a href="?user-spezrank-desc">'.$lang['rank'].'</a>';
}else{
$rang = '<a href="?user-spezrank-asc">'.$lang['rank'].'</a>';
}
if (( $menu->get(2) ? escape($menu->get(2), 'textarea') : 0 ) == asc){
$gruppe = '<a href="?user-recht1-desc">'.$lang['group'].'</a>';
}else{
$gruppe = '<a href="?user-recht1-asc">'.$lang['group'].'</a>';
}
if (( $menu->get(2) ? escape($menu->get(2), 'textarea') : 0 ) == asc){
$reg = '<a href="?user-regist1-desc">Dabei seit</a>';
}else{
$reg = '<a href="?user-regist1-asc">Dabei seit</a>';
}
if (( $menu->get(2) ? escape($menu->get(2), 'textarea') : 0 ) == asc){
$icq = '<a href="?user-icq-asc">'.$lang['icq'].'</a>';
}else{
$icq = '<a href="?user-icq-desc">'.$lang['icq'].'</a>';
}
if (( $menu->get(2) ? escape($menu->get(2), 'textarea') : 0 ) == asc){
$a = '<a href="?user-e-desc">Posts</a>';
}else{
$a = '<a href="?user-e-asc">Posts</a>';
}
$rei = escape($menu->get(1), 'textarea');
$nach =escape($menu->get(2), 'textarea');
$anz = @db_result(db_query("SELECT count(ID) FROM prefix_user"),0);
$limit = 50; // Limit
$page = ($menu->getA(3) == 'p' ? $menu->getE(3) : 1 );
$MPL = db_make_sites ($page , "" , $limit , '?user-'.$rei.'-'.$nach.'' , 'user' );
$anfang = ($page - 1) * $limit;
$tpl = new tpl ( 'user/memb_list.htm' );
$ar = array (
'oname' => $name,
'orank' => $rang,
'ogroup' => $gruppe,
'oicq' => $icq,
'oposts' => $a,
'oregtime' => $reg,
'anz' =>$anz,
'SITELINK' => $MPL
);
$tpl->set_ar_out($ar,0);
$aufab = ( $menu->get(2) ? escape($menu->get(2), 'textarea') : desc );
$sort1 = ( $menu->get(1) ? escape($menu->get(1), 'textarea') : "recht , posts" );
if ($sort1 == 'recht1'){
$sort2 = 'recht';
}else{
$sort2 = $sort1;
}
if ($sort2 == 'regist1'){
$sort3 = 'regist';
}else{
$sort3 = $sort2;
}
if ($sort3 == 'e'){
$sort = 'posts';
}else{
$sort = $sort3;
}
$class = '';
$erg = db_query("SELECT
llogin,
prefix_user.posts,
prefix_user.id,
prefix_grundrechte.name as recht_name,
regist,
prefix_user.staat,
prefix_user.icq,
prefix_user.geschlecht,
prefix_user.gebdatum,
prefix_user.name,
prefix_user.avatar,
prefix_user.status,
uf1.val AS feld1,
uf2.val AS feld2,
uf3.val AS feld3
FROM prefix_user
LEFT JOIN prefix_grundrechte ON prefix_user.recht = prefix_grundrechte.id
LEFT JOIN prefix_userfields uf1 ON prefix_user.id = uf1.uid AND uf1.fid = 21
LEFT JOIN prefix_userfields uf2 ON prefix_user.id = uf2.uid AND uf2.fid = 29
LEFT JOIN prefix_userfields uf3 ON prefix_user.id = uf3.uid AND uf3.fid = 30
ORDER by $sort $aufab
LIMIT ".$anfang.",".$limit);
while ($row = db_fetch_object($erg)) {
$abf1 = "SELECT * FROM prefix_online WHERE uid = '".$row->id."'";
$erg1 = db_query($abf1);
$row1 = db_fetch_assoc($erg1);
if(isset($row1['uid'])){
$online = '<img src="include/images/icons/on1.png" alt="online" border="0"/>';
}else{
$online = '<img src="include/images/icons/off2.png" alt="offline" border="0" />';
}
$icq1 = str_replace("-","",$row->icq);
$icq2 = str_replace(" ","",$icq1);
if (is_numeric($icq2) ){
$icq= '<a href="http://www.icq.com/whitepages/cmd.php?uin='.$icq2.'&action=add"><img src="http://web.icq.com/whitepages/online?icq='.$icq2.'&img=5" border="0"></a>';
}else{
$icq = '';
}
$ga = '';
$t1 = 0;
$t2 = 0;
$t3 = 0;
$age1=explode("-",$row->gebdatum);
$age2 = date("Y",time())-$age1[0];
$a=explode("-",$row->gebdatum);
$tag = $a[2];
$mon = $a[1];
$jah = $a[0];
if ($mon > date("m")){$t1 = 2;}
if ($mon == date("m")){$t1 = 1;}
if ($tag > date("d")){$t2 = 1;}
$t3 = ($t1 + $t2);
if ($t3 > 1){
$age = ($age2 -1);
}else{
$age = $age2;
}
if ($row->geschlecht == 0){
if ($row->gebdatum != 0000-00-00 ){
$ga.= $age;
}else{
$ga.= '';
}
}
elseif ($row->geschlecht == 1){
if ($row->gebdatum != 0000-00-00 ){
$ga.='<img src="include/images/icons/user.png" border="0"> - '.$age.'';
}else{
$ga.='<img src="include/images/icons/user.png" border="0"> - 00';
}
}
elseif ($row->geschlecht == 2){
if ($row->gebdatum != 0000-00-00 ){
$ga.='<img src="include/images/icons/user_female.png" border="0"> - '.$age.'';
}else{
$ga.='<img src="include/images/icons/user_female.png" border="0"> - 00';
}
}
if ($row->staat){
$flagg = '<img src="include/images/flags/'.$row->staat.'" alt="" border="0"> ';
}else{
$flagg = '';
}
$state['0']='<font size="-2"><font color="#CC0000">Inaktiv</font></font>';
$state['1']='<font size="-2"><font color="#008000">Aktiv</font></font>';
$state['2']='<font size="-2"><font color="#0000FF">Gesperrt</font></font>';
$anzna = round((time()-$row->llogin)/(24*60*60),0);
if ($anzna < 9) {
$aktiv = ' <img src="Bilder/kurz.gif" alt="Oft hier" border="0" width="16" height="16"> - ';
}elseif ($anzna < 20) {
$aktiv = '<img src="Bilder/mittel.gif" alt="Selten hier" border="0" width="16" height="16"> - ';
} else {
$aktiv = ' <img src="Bilder/lang.gif" alt="Sehr selten hier" border="0" width="16" height="16"> - ';
}
if (!empty($row->avatar) AND file_exists($row->avatar)) { $row->avatar = $row->avatar; }
elseif ($row->geschlecht == 1) {$row->avatar = 'include/images/avatars/male.png';}
elseif ($row->geschlecht == 2) {$row->avatar = 'include/images/avatars/female.png';}
else {$row->avatar = 'include/images/avatars/wurstegal.png';}
if ($class == 'Cmite') { $class = 'Cnorm'; } else { $class = 'Cmite'; }
$ar = array ( 'NAME' => $row->name,
'RANG' => userrang($row->posts,$row->id),
'AKTIV' => $aktiv,
'FLAGG' => $flagg,
'ICQ' => $icq,
'GA' => $ga,
'CLASS' => $class,
'POSTS' => $row->posts,
'UID' => $row->id,
'DATE' => date('<b>d.m.Y</b>- H:i',$row->llogin),
'ONLINE' => $online,
'STATUS' => $state[$row->status],
'FELD1' => $row->feld1,
'FELD2' => $row->feld2,
'FELD3' => $row->feld3,
'AVATA' => $row->avatar,
'GRUPE' => $row->recht_name
);
$tpl->set_ar_out($ar,1);
}
$tpl->set_out('filtername',$filtername ? $filtername : '',2);
$design->footer();
?>
contents/forum/show_posts.php
<?php
# Copyright by: Manuel Staechele
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
# check ob ein fehler aufgetreten ist.
check_forum_failure($forum_failure);
# toipc als gelesen markieren
$_SESSION['forumSEE'][$fid][$tid] = time();
$title = $allgAr['title'].' :: Forum :: '.$aktTopicRow['name'].' :: Beiträge zeigen';
$hmenu = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> » </b>'.aktForumCats($aktForumRow['kat']).'<b> » </b><a class="smalfont" href="index.php?forum-showtopics-'.$fid.'">'.$aktForumRow['name'].'</a><b> » </b>';
$hmenu .= $aktTopicRow['name'].$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);
$design->header();
# Topic Hits werden eins hochgesetzt.
db_query('UPDATE `prefix_topics` SET hit = hit + 1 WHERE id = "'.$tid.'"');
$erg = db_query("SELECT fid FROM `prefix_posts` WHERE tid = ".$tid);
$row = db_fetch_assoc($erg);
$newth = '<a href="index.php?forum-newtopic-'.$row['fid'].'"><img src="include/images/forum/newth.png" border="0"></a>';
# mehrere seiten fals gefordert
$limit = $allgAr['Fpanz']; // Limit
$page = ($menu->getA(3) == 'p' ? $menu->getE(3) : 1 );
$MPL = db_make_sites ($page , "WHERE tid = ".$tid , $limit , 'index.php?forum-showposts-'.$tid , 'posts' );
$anfang = ($page - 1) * $limit;
$antworten = '';
if (($aktTopicRow['stat'] == 1 AND $forum_rights['reply'] == TRUE) OR ($_SESSION['authright'] <= '-7' OR $forum_rights['mods'] == TRUE)) {
$antworten = '<a href="index.php?forum-newpost-'.$tid.'"><img src="include/images/forum/antw.png" border="0"></a>';
}
$class = 'Cmite';
$tpl = new tpl ( 'forum/showpost' );
$ar = array (
'SITELINK' => $MPL,
'tid' => $tid,
'ANTWORTEN' => $antworten,
'TOPICNAME' => $aktTopicRow['name'],
'HMENU' => $hmenu,
'NEWTH' => $newth
);
$tpl->set_ar_out($ar,0);
$i = $anfang +1;
$ges_ar = array ('wurstegal', 'maennlich', 'weiblich');
##################################
#Forenmod by matthias-schlich.de - Vorlage von Benjamin Rau
#Posts
$erg = db_query("SELECT geschlecht, ic1_grundrechte.name as gruppe, ic1_posts.id,txt,time,erstid,erst,sig,avatar,gebdatum,posts FROM `ic1_posts` LEFT JOIN ic1_user ON ic1_posts.erstid = ic1_user.id LEFT JOIN ic1_grundrechte ON ic1_grundrechte.id = ic1_user.recht WHERE tid = ".$tid." ORDER BY time LIMIT ".$anfang.",".$limit);
while($row = db_fetch_assoc($erg)) {
$class = ( $class == 'Cnorm' ? 'Cmite' : 'Cnorm' );
#
# Start RENOMMEE
#
$row['tid'] = $tid;
## Auslesen der Renopunkte für den Ersteller
$renopts = db_result(db_query("SELECT SUM(punkte) FROM `prefix_reno` WHERE uid = '".$row['erstid']."'"));
## Einträge zählen die auf Renopunkte passen
$countbild = db_result(db_query("SELECT count(bild) FROM `prefix_reno_set` WHERE '".$renopts."' >= `pmin` AND '".$renopts."' <= `pmax` "));
# Falls kein Bild vorhanden das passt.
if ($countbild == 0) { $bild = 1; } else {
# Bild ausgeben
$bild = db_result(db_query("SELECT bild FROM `prefix_reno_set` WHERE '".$renopts."' >= `pmin` AND '".$renopts."' <= `pmax`"));
}
$row['reno'] = '<img src="include/images/reno/'.$bild.'.png" border="0" \>';
## Abfragen ob Ersteller der User ist
if ($row['erstid'] == $_SESSION['authid']) {
$row['renovote'] = '';
$row['reno'] = '<a href="?renomy-'.$row['tid'].'"><img src="include/images/reno/'.$bild.'.png" border="0" \></a>';
} else {
$row['renovote'] = '<a href="?reno-'.$row['erstid'].'-'.$tid.'"><img src="Bilder/bewerten.gif" alt="Bewerten" border="0"></a></a>';
$row['reno'] = '<img src="include/images/reno/'.$bild.'.png" border="0" \>';
}
#
# ENDE RENOMMEE
#
$icq1 = str_replace("-","",$row['icq']);
$icq2 = str_replace(" ","",$icq1);
// icq abfrage
// 0 - keine ICQ abfrage
// 1 - ICQ standartbilder bei &design= kann man zwischen den 26 verschiedenen icq bildern wechseln
// 2 - für eigne ICQ Statsubilder
$own_pics = "1";
$icqdesign = "25";
if ($own_pics == "1") {
if (is_numeric($icq2) ){
$row['icq'] = '<a href="http://www.icq.com/whitepages/cmd.php?uin='.$icq2.'&action=add"><img src="http://web.icq.com/whitepages/online?web='.$icq2.'&img='.$icqdesign.'" border="0"></a>';
} else {$row['icq'] = '';}
}
elseif ($own_pics == "0"){
$row['icq'] = '';}
else{
if (is_numeric($icq2) ){
// Eigene ICQ-Bilder
$status = (icq_status($icq2));
if ($status == "1"){
$row['icq'] = '<a href="http://www.icq.com/whitepages/cmd.php?uin='.$icq2.'&action=add"><img src="include/images/forum/icqonline.png" border="0"></a>';
}elseif ($status == "0"){
$row['icq'] = '<a href="http://www.icq.com/whitepages/cmd.php?uin='.$icq2.'&action=add"><img src="include/images/forum/icqoffline.png" border="0"></a>';
}elseif ($status == "2"){
$row['icq'] = '<a href="http://www.icq.com/whitepages/cmd.php?uin='.$icq2.'&action=add"><img src="include/images/forum/icqinactive.png" border="0"></a>';
}else {$row['icq'] = '';}
}else {$row['icq'] = '';}
}
# define some vars.
$row['danke'] = '';
$row['THX'] = '';
$row['sig'] = ( empty($row['sig']) ? '' : '<br /><br><div style="border:0px #30180E solid;background:#E9E1C4;color:#30180E;padding:1px;margin:10px;"><center><hr style="width: 90%;" align="center">'.bbcode($row['sig']) );
$row['TID'] = $tid;
$row['class'] = $class;
$row['date'] = date ('d.m.Y - H:i:s', $row['time'] );
$row['delete'] = '';
$row['change'] = '';
if (file_exists($row['avatar'])) { $row['avatar'] = '<br /><br /><img src="'.$row['avatar'].'" alt="User Pic" border="0" /><br />'; }
elseif ($allgAr['forum_default_avatar']) { $row['avatar'] = '<br /><br /><img src="include/images/avatars/'.$ges_ar[$row['geschlecht']].'.jpg" alt="" border="0" /><br />'; }
else { $row['avatar'] = ''; }
$row['rang2'] = userrang ($row['posts'],$row['erstid']);
$rank_name = $row['rang2'];
$row['txt'] = (isset($_GET['such']) ? markword(bbcode ($row['txt']),$_GET['such']) : bbcode ($row['txt']) );
$row['i'] = $i;
$row['gb'] = (date("Ymd") === str_replace("-","",date("Y").substr($row['gebdatum'],4) ) ? $row['gb'] = "<br /><img src='Bilder/gbrose.gif' alt='Heute Geburtstag'>" : $row['gb'] = "" );
if ( $row['erstid'] != '' ) {
$user_row = db_fetch_assoc(db_query("SELECT posts,regist FROM prefix_user WHERE id = ".$row['erstid']));
$posts = $row['posts'];
$row['posts'] = 'Kämpfe: '.$row['posts'].'<br />';
if ( $posts == '' ) { $row['posts'] = 'Nicht registriert<br>';}
#Ranking Balken
#Grafiken definieren
$rank_01 = '<br><font size="-2"><i><font color="#5B2E00">Infanterie</font></i></font>';
$rank_02 = '<br><font size="-2"><i><font color="#623100">Kavalerie</font></i></font>';
$rank_03 = '<br><font size="-2"><i><font color="#623100">Elite Infanterie</font></i></font>';
$rank_04 = '<br><font size="-2"><i><font color="#623100">Elite Kavalerie</font></i></font>';
$rank_05 = '<br><font size="-2"><i><font color="#CC0000">Leibwache</font></i></font>';
#Bezugnehmen auf das Ranking des users
if ( $row['posts'] != '' ) {
$row['rang'] = $rank_name.'<br>';
if ($posts <= '20') { $row['rang'] .= $rank_01; }
elseif ($posts <= '40') { $row['rang'] .= $rank_02;}
elseif ($posts <= '80') { $row['rang'] .= $rank_03; }
elseif ($posts < '150') { $row['rang'] .= $rank_04; }
elseif ($posts >= '150') { $row['rang'] .= $rank_05; }
}
else {$row['rang'] .= ""; }
}
#User Details
if ( $posts != '' ) {
$abf1 = 'SELECT * FROM prefix_user where id = '.$row["erstid"];
$erg1 = db_query($abf1);
$user = db_fetch_object($erg1);
$zeit = date('d. M Y',$user->regist);
$llogin = date('d. M Y',$user->llogin);
$ort = $user->wohnort;
$www = $user->homepage;
$email = $user->opt_mail;
$pm = $user->opt_pm;
$land = $user->staat;
#Flagge
if ($land != '')
{$row['land'] = '<img src="include/images/flags/'.$land.'" >';}
else{$row['land'] = '';}
#Dabei seit
$row['details'] = "<br><br>Dabei seit: ".$zeit."<br>";
#Wohnort
if ($ort != ''){$row['details'] .= "Wohnort: ".$ort."<br>";}
#Homepage
if ($www != ''){$row['www'] = '<a href="'.$www.'" target="_blank"><img src="include/images/forum/www.png" border="0" alt="Website des Users besuchen"></a>';}
else{$row['www'] = '';}
#Letzter Login
$row['details'] .= "Letzter Login: ".$llogin."<br>";
#PM
if ($pm == '1'){
$row['pm'] = "<a href='?forum-privmsg-new=0&empfid=".$row['erstid']."'><img src='include/images/forum/pm.png' border='0' alt='Private Nachricht an den User senden'></a>";
}else{$row['pm'] = '';}
#email
if ($email == '1'){
$row['email'] = "<a href='?user-mail-".$row['erstid']."'><img src='include/images/forum/email.png' border='0' alt='E-Mail an den User senden'></a>";
}else{$row['email'] = '';}
}
else {
$row['details'] = "";
$row['land'] = '';
$row['pm'] = '';
$row['email'] = '';
$row['www'] = '';
}
if ( $posts != '' ) {
#User Online o Offline
$abf1 = "SELECT * FROM prefix_online where uid = ".$row['erstid'];
$erg1 = db_query($abf1);
$status = db_fetch_object($erg1);
if ($status->uid == $row['erstid']) {
$row['online'] = ' <img src="include/images/forum/uonline.png" border="0">'; }
else {
$row['online'] = ' <img src="include/images/forum/uoffline.png" border="0">'; }
}
else {$row['online'] = '';}
#
#Edit Ende
##################################
$row['page'] = $page;
if ( $row['posts'] != 0 ) {
$row['erst'] = '<a href="index.php?user-details-'.$row['erstid'].'"><b>'.$row['erst'].'</b></a>';
}
elseif ( $row['erstid'] == 0 ) {
$row['rang'] = 'Gast<br>';
}
if ($forum_rights['mods'] == TRUE AND $i>1) {
$row['delete'] = '<a href="index.php?forum-delpost-'.$tid.'-'.$row['id'].'">'.$lang['delete'].'</a>';
}
if ( $forum_rights['reply'] == TRUE AND loggedin() ) {
$row['change'] = ' <a href="index.php?forum-editpost-'.$tid.'-'.$row['id'].'">'.$lang['change'].'</a>';
}
$row['posts'] = ($row['posts']?'<br />'.$row['posts']:'').'<br />';
// Danke-Link anzeigen oder ausblenden falls user == ersteller oder Gast
if ($row['erstid'] == $_SESSION['authid'] or $_SESSION['authid'] == 0) {
$row['THX'] = '';
} else {
# Zufallszahl generieren um Missbrauch vorzubeugen
if (!isset($_SESSION['thx_rand']) OR empty($_SESSION['thx_rand'][$row['id']])) {
$_SESSION['thx_rand'][$row['id']] = rand(000,999);
}
$row['THX'] = '<a href="index.php?danke-'.$row['id'].'-'.$_SESSION['thx_rand'][$row['id']].'-'.$tid.'-'.$row['erstid'].'-'.$_SESSION['authid'].'-'.$_SESSION['authname'].'"><b>Sag Danke</b></a>';
}
// Ausgeben der Danke-Liste im Post
$thxcount = db_count_query("SELECT COUNT(id) FROM `prefix_danke` WHERE pid = ".$row['id']."");
if ($thxcount['thxcount'] >= 1) {
$row['danke'] .= '<hr><font size="-3"><img src="/Bilder/danke.jpg" alt="" border="0"><br></font></strong>';
$thx_qry = db_query("SELECT bedankername,bedankerid FROM `prefix_danke` WHERE pid = ".$row['id']."");
while ($thx_row = db_fetch_assoc($thx_qry)) {
$row['danke'] .= '<a href="index.php?user-details-'.$thx_row['bedankerid'].'"><font size="-2">'.$thx_row['bedankername'].'</font></a> ';
}
}
//Forumex - begin
$row['txt'] = FE_Vote2HTML($row['id'],$row['txt']);
//Forumex - end
$tpl->set_ar_out($row,1);
$i++;
}
$tpl->set_ar_out( array ( 'SITELINK' => $MPL, 'ANTWORTEN' => $antworten ) , 2 );
// anfang qpost
if (loggedin()) {
$dppk_time = time();
$time = time();
if (!isset($_SESSION['klicktime'])) { $_SESSION['klicktime'] = 0; }
$topic = '';
$txt = '';
$xnn = '';
if (isset($_POST['txt_qp'])) {
$txt = trim(escape($_POST['txt_qp'], 'textarea'));
}
$tpl = new tpl ('forum/qpost');
$ar = array (
'txt_qp' => escape_for_fields(unescape($txt)),
'tid' => $tid,
);
$tpl->set_ar_out($ar,1);
if (($_SESSION['klicktime'] + 150) > $dppk_time OR empty($txt) OR !empty($_POST['priview']) OR (empty($_POST['Gname']) AND !loggedin())) {
}
else
{
# save qpost
$_SESSION['klicktime'] = $dppk_time;
$design = new design ( $title , $hmenu, 1);
$design->header();
if (loggedin()) {
$uid = $_SESSION['authid'];
$erst = escape($_SESSION['authname'],'string');
db_query("UPDATE `prefix_user` set posts = posts+1 WHERE id = ".$uid);
} else {
$erst = $xnn;
$uid = 0;
}
db_query ("INSERT INTO `prefix_posts` (tid,fid,erst,erstid,time,txt) VALUES ( ".$tid.", ".$fid.", '".$erst."', ".$uid.", ".$time.", '".$txt."')");
$pid = db_last_id();
db_query("UPDATE `prefix_topics` SET last_post_id = ".$pid.", rep = rep + 1 WHERE id = ".$tid);
db_query("UPDATE `prefix_forums` SET posts = posts + 1, last_post_id = ".$pid." WHERE id = ".$fid );
$page = ceil ( ($aktTopicRow['rep']+1) / $allgAr['Fpanz'] );
# topic als gelesen markieren
$_SESSION['forumSEE'][$fid][$tid] = time();
wd ( array (
$lang['backtotopic'] => 'index.php?forum-showposts-'.$tid.'-p'.$page.'#'.$pid,
$lang['backtotopicoverview'] => 'index.php?forum-showtopics-'.$fid
) , $lang['createpostsuccessful'] , 3 );
}
}
$tpl = new tpl ( 'forum/showpost' );
// end qpost
if (loggedin()) {
if ($menu->get(3) == 'topicalert') {
if (1 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) {
db_query("DELETE FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid);
} else {
db_query("INSERT INTO prefix_topic_alerts (tid,uid) VALUES (".$tid.", ".$_SESSION['authid'].")");
}
}
echo 'Optionen:';
if (1 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) {
echo '<br />- <a href="index.php?forum-showposts-'.$tid.'-topicalert">'.$lang['nomailonreply'].'</a><br />';
} else {
echo '<br />- <a href="index.php?forum-showposts-'.$tid.'-topicalert">'.$lang['mailonreply'].'</a><br />';
}
}
if ( $forum_rights['mods'] == TRUE ) {
$tpl->set ( 'status', ($aktTopicRow['stat'] == 1 ? $lang['close'] : $lang['open'] ) );
$tpl->set ( 'festnorm', ($aktTopicRow['art'] == 0 ? $lang['fixedtopic'] : $lang['normaltopic'] ) );
$tpl->set('tid',$tid);
$tpl->out(3);
}
$design->footer();
?>
dann hab ichnoch die viel schwerer anzupassenden Datein aus der
includes/fung/allg.php
<?php
# Copyright by Manuel
# Support www.ilch.de
defined ('main') or die ( 'no direct access' );
##
###
####
##### W E I T E R L E I T U N G S F U N K T I O N
function wd ($wdLINK,$wdTEXT,$wdZEIT=3) {
global $lang;
if (!is_array($wdLINK)) {
$urls = '<a href="'.$wdLINK.'">'.$lang['forward2'].'</a>';
$wdURL = $wdLINK;
} else {
$urls = '';
$i = 0;
foreach($wdLINK as $k => $v) {
if ( $i == 0 ) {
$wdURL = $v;
}
$urls .= '<a href="'.$v.'">'.$k.'</a><br />';
$i++;
}
}
$tpl = new tpl ( 'weiterleitung.htm' );
$ar = array
(
'LINK' => $urls,
'URL' => $wdURL,
'ZEIT' => $wdZEIT,
'TEXT' => $wdTEXT
);
$tpl->set_ar_out ( $ar, 0 );
unset($tpl);
}
##
###
####
##### g e t R e c h t
function getrecht ($RECHT, $USERRECHT) {
if ( empty ( $USERRECHT ) ) {
return (false);
} else {
if($USERRECHT <= $RECHT) {
return (true);
} else {
return (false);
}
}
}
##
###
####
##### g e t U s e r N a m e
function get_n($uid) {
$row = db_fetch_object(db_query("SELECT name FROM prefix_user WHERE id = '".$uid."'"));
return $row->name;
}
##
###
####
##### wochentage sonntag 0 samstag 6
function wtage ($tag) {
$wtage = array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
return ($wtage[$tag]);
}
##
###
####
##### monate in deutsch
function getDmon ($mon) {
$monate = array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');
return($monate[$mon-1]);
}
##
###
####
##### a l l g e m e i n e s A r r a y
function getAllgAr () {
# v1 = schluessel
# v2 = wert
# v3 = feldtyp
# v4 = kurze beschreibung wenn n�tig
$ar = array();
$abf = "SELECT schl, wert FROM `prefix_config`";
$erg = db_query($abf);
while($row = db_fetch_assoc($erg) ) {
$ar[$row['schl']] = $row['wert'];
}
return $ar;
}
##
###
####
##### UserRang ermitteln
function userrang ($post,$uid) {
global $global_user_rang_array;
if (!isset($global_user_rang_array[$uid])) {
if (!isset($global_user_rang_array)) {
$global_user_rang_array = array();
}
if ( empty($uid) ) {
$rRang = 'Gast';
} else {
$rRang = @db_result(db_query("SELECT bez FROM prefix_user LEFT JOIN prefix_ranks ON prefix_ranks.id = prefix_user.spezrank WHERE prefix_user.id = ".$uid),0);
}
if ( empty($rRang) ) {
$post = ( $post == 0 ? 1 : $post );
$rRang = @db_result(db_query("SELECT bez FROM `prefix_ranks` WHERE spez = 0 AND min <= ".$post." ORDER BY min DESC LIMIT 1"),0);
} elseif ( $rRang != 'Gast' ) {
$rRang = '<b><font color="#008000">'.$rRang.'</font></b>';
}
$global_user_rang_array[$uid] = $rRang;
}
return ($global_user_rang_array[$uid]);
}
##
###
####
##### makiert suchwoerter
function markword($text,$such) {
$erg = '<span style="background-color: #EBF09B;">';
$erg .= $such."</span>";
$text = str_replace($such,$erg,$text);
return $text;
}
##
###
####
##### gibt die smiley lilste zurueck
function getsmilies () {
global $lang;
$zeilen = 3; $i = 0;
$b = '<script language="JavaScript" type="text/javascript">function moreSmilies () { var x = window.open("about:blank", "moreSmilies", "width=250,height=200,status=no,scrollbars=yes,resizable=yes"); ';
$a = '';
$erg = db_query('SELECT emo, ent, url FROM `prefix_smilies`');
while ($row = db_fetch_object($erg) ) {
$b .= 'x.document.write ("<a href=\"javascript:opener.put(\''.addslashes(addslashes($row->ent)).'\')\">");';
$b .= 'x.document.write ("<img style=\"border: 0px; padding: 5px;\" src=\"include/images/smiles/'.$row->url.'\" title=\"'.$row->emo.'\"></a>");';
if ($i<12) {
# float einbauen
if($i%$zeilen == 0 AND $i <> 0) { $a .= '<br /><br />'; }
$a .= '<a href="javascript:put(\''.addslashes($row->ent).'\')">';
$a .= '<img style="margin: 2px;" src="include/images/smiles/'.$row->url.'" border="0" title="'.$row->emo.'"></a>';
}
$i++;
}
$b .= ' x.document.write("<br /><br /><center><a href=\"javascript:window.close();\">'.$lang['close'].'</a></center>"); x.document.close(); }</script>';
if ($i>12) { $a .= '<br /><br /><center><a href="javascript:moreSmilies();">'.$lang['more'].'</a></center>'; }
$a = $b.$a;
return ($a);
}
##
###
####
##### generey key with x length
function genkey ( $anz ) {
$letterArray = array ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0');
$key = '';
for ($i=0;$i < $anz ; $i ++)
{
mt_srand((double)microtime()*1000000);
$zufallZahl = mt_rand(0,62);
$key .= $letterArray[$zufallZahl];
}
return ( $key );
}
function icmail ($mail,$bet,$txt, $from = '', $html=false) {
global $allgAr;
if ( $from == '' ) {
$from = $allgAr['allg_default_subject'].' <'.$allgAr['adminMail'].'>';
}
$from = preg_replace ("/\015\012|\015|\012/", "", $from);
$header = "From: ".$from."\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: ".($html?"text/html":"text/plain")."; charset=\"iso-8859-1\";\n";
$header .= "Content-Transfer-Encoding: 8bit";
$mail = escape_for_email($mail);
$bet = escape_for_email($bet,true);
$txt = str_replace("\r", "\n", str_replace("\r\n", "\n",$txt));
if ($allgAr['mail_smtp']) {
require_once('include/includes/func/smtp.php');
return smtpmail($mail, $bet ,$txt , $header );
} elseif ( mail ( $mail, $bet, $txt, $header) ) {
return ( true );
} else {
return ( false );
}
}
function html_enc_substr($text, $start, $length) {
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return(htmlentities(substr(strtr($text, $trans_tbl), $start, $length)));
}
function get_datum ($d) {
if (strpos($d,'.') !== FALSE) { $d = str_replace('.','-',$d); }
if (strpos($d,'/') !== FALSE) { $d = str_replace('/','-',$d); }
if (is_numeric(substr($d,-4))) {
list($t,$m,$j) = explode('-', $d);
} elseif (is_numeric(substr($d,0,4))) {
list($j,$m,$t) = explode('-', $d);
}
$d = $j.'-'.$m.'-'.$t;
return ($d);
}
function get_homepage ($h) {
$h = trim($h);
if (!empty($h) AND substr($h, 0, 7) != 'http://') {
$h = 'http://'.$h;
}
return ($h);
}
function get_wargameimg ($img) {
if (file_exists('include/images/wargames/'.$img.'.gif')) {
return ('<img src="include/images/wargames/'.$img.'.gif" alt="'.$img.'" border="0">');
} elseif (file_exists('include/images/wargames/'.$img.'.jpg')) {
return ('<img src="include/images/wargames/'.$img.'.jpg" alt="'.$img.'" border="0">');
} elseif (file_exists('include/images/wargames/'.$img.'.jpeg')) {
return ('<img src="include/images/wargames/'.$img.'.jpeg" alt="'.$img.'" border="0">');
} elseif (file_exists('include/images/wargames/'.$img.'.png')) {
return ('<img src="include/images/wargames/'.$img.'.png" alt="'.$img.'" border="0">');
}
return ('');
}
function iurlencode_help ($a) {
if (preg_match("/(http:|https:|ftp:)/", $a[0])) {
return ($a[0]);
}
return (rawurlencode($a[1]).substr($a[0], -1));
}
function iurlencode ($s) {
return (preg_replace_callback("/([^\/]+|\/[^\.])[\.\/]/", 'iurlencode_help', $s));
/*
$x = 'false';
if (preg_match ('/(http:|https:|ftp:)[^:]+:[^@]+@./', $s)) {
$x = preg_replace('/([^:]+:[^@]+@)./',"\\1",$s);
$s = str_replace($x,'',$s);
} elseif (substr($s, 0, 7) == 'http://') {
$s = substr ($s, 7);
$x = 'http://';
} elseif (substr($s, 0, 8) == 'https://') {
$s = substr ($s, 8);
$x = 'https://';
} elseif (substr($s, 0, 6) == 'ftp://') {
$s = substr ($s, 6);
$x = 'ftp://';
}
$a = explode('/', $s);
$r = '';
for ($i=0;$i<count($a);$i++) {
$r .= rawurlencode($a[$i]).'/';
}
if ($x !== 'false') {
$r = $x.$r;
}
$r = substr($r, 0, -1);
return ($r);
*/
}
# antispam
function chk_antispam ($m) {
global $allgAr;
if (is_numeric($allgAr['antispam']) AND has_right($allgAr['antispam'])) { return (true); }
if (isset($_POST['antispam']) AND isset($_POST['antispam_id']) AND isset($_SESSION['antispam'][$_POST['antispam_id']]) AND $_POST['antispam'] == $_SESSION['antispam'][$_POST['antispam_id']][$m]) {
unset ($_SESSION['antispam'][$_POST['antispam_id']]);
return (true);
}
return (false);
}
function get_antispam ($m, $t) {
global $allgAr;
if (is_numeric($allgAr['antispam']) AND has_right($allgAr['antispam'])) { return (''); }
if (!is_array($_SESSION['antispam'])) {
$_SESSION['antispam'] = array();
}
$_SESSION['antispam'][$m] = array();
mt_srand((double)microtime()*1000000);
$i1 = mt_rand (1,9);
$i2 = mt_rand (1,9);
$i3 = mt_rand (1,9);
$id = uniqid(mt_rand(), true);
$_SESSION['antispam'][$m] = array($i1, $i2, $i3);
$_SESSION['antispam'][$id][$m] = $i1.$i2.$i3;
$rs = '<span style="display: inline; width: 100px; vertical-align: middle; text-align: center; background-color: #D2BD99; border: 0px; padding: 2px; margin: 0px;"><img src="include/images/spam/z.php?m='.$m.'&w=0&'.session_name().'='.session_id().'" alt=""><img src="include/images/spam/z.php?m='.$m.'&w=1&'.session_name().'='.session_id().'" alt=""><img src="include/images/spam/z.php?m='.$m.'&w=2&'.session_name().'='.session_id().'" alt=""><input type="hidden" name="antispam_id" value="'.$id.'" /><input name="antispam" size="3" maxlength="3" style="background-color: #FFFFFF; border: 0px; margin: 0px; padding: 0px;" /></span>';
if ($t == 0) {
return ($rs);
} elseif ($t == 1) {
return ('<tr><td class="Cmite">Antispam</td><td class="Cnorm">'.$rs.'</td></tr>');
} elseif ($t > 10) {
return ('<label style="float:left; width: '.$t.'px; ">Antispam</label>'.$rs.'<br />');
} else {
return ('');
}
}
# antispam
// Funktion scandir für PHP 4
if (version_compare(phpversion(), '5.0.0') == -1) {
function scandir($dir)
{
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) $files[] = $filename;
sort($files);
return $files;
}
}
// Funktion, die die Größe aller Dateien im Ordner zusammenrechnet
function dirsize($dir)
{
if (!is_dir($dir)) {
return -1;
}
$size = 0;
$files = array_slice(scandir($dir), 2);
foreach ($files as $filenr => $file) {
if (is_dir($dir . $file)) {
$size += dirsize($dir . $file . '/');
} else {
$size += @filesize($dir . $file);
}
}
return $size;
}
//Rechnet bytes in KB oder MB um
function nicebytes($bytes){
if ($bytes<1000000) {
return round($bytes/1024,2).' KB';
} else {
return round($bytes/(1024*1024),2).' MB';
}
}
?>
includes/func/profilefields.php
<?php
# Copyright by Manuel
# Support www.ilch.de
defined ('main') or die ( 'no direct access' );
function profilefields_functions2 () {
$ar = array (
1 => 'Feld',
2 => 'Kategorie'
);
return ($ar);
}
function profilefields_functions () {
$ar = array (
1 => 'Feld',
2 => 'Kategorie',
3 => 'Angezeigt',
4 => 'Versteckt'
);
return ($ar);
}
# Felder zum aendern anzeigen.
function profilefields_change ($uid) {
$q = db_query("SELECT id, `show`, val FROM prefix_profilefields LEFT JOIN prefix_userfields ON prefix_userfields.fid = prefix_profilefields.id AND prefix_userfields.uid = ".$uid." WHERE func = 1 ORDER BY pos");
while ( $r = db_fetch_assoc($q)) {
echo '<label style="float:left; width:35%;">'.$r['show'].'</label><input type="text" name="profilefields['.$r['id'].']" value="'.$r['val'].'"><br />';
}
}
# Felder die uebermittelt wurden speichern.
function profilefields_change_save ($uid) {
$q = db_query("SELECT id, `show`, val FROM prefix_profilefields LEFT JOIN prefix_userfields ON prefix_userfields.fid = prefix_profilefields.id AND prefix_userfields.uid = ".$uid." WHERE func = 1 ORDER BY pos");
while ( $r = db_fetch_assoc($q)) {
if ( isset($_REQUEST['profilefields'][$r['id']]) ) { $v = $_REQUEST['profilefields'][$r['id']]; } else { $v = ''; }
if ( $r['val'] == '' AND $v != '' ) {
db_query("INSERT INTO prefix_userfields (fid,uid,val) VALUES (".$r['id'].",".$uid.",'".$v."')");
} elseif ( $r['val'] != '' AND $v == '' ) {
db_query("DELETE FROM prefix_userfields WHERE fid = ".$r['id']." AND uid = ".$uid);
} elseif ( $r['val'] != '' AND $v != '' AND $r['val'] != $v ) {
db_query("UPDATE prefix_userfields SET val = '".$v."' WHERE fid = ".$r['id']." AND uid = ".$uid);
}
}
}
# Diese Funktion Zeit ALLE Felder die der Benutzer im Adminbereich unter
# Profilefields sortieren kann an ... is eigentlich total easy ;-)...
function profilefields_show ($uid) {
$l = '';
$a = array ();
$q = db_query("SHOW COLUMNS FROM prefix_user");
while ($r = db_fetch_assoc($q)) {
$a[$r['Field']] = $r['Field'];
}
$q = db_query("SELECT id, `show`, func FROM prefix_profilefields WHERE func < 4 ORDER BY pos");
while ( $r = db_fetch_assoc($q)) {
if ( $r['func'] == 1 ) {
$str = @db_result ( db_query ("SELECT val FROM prefix_userfields WHERE uid = ".$uid." AND fid = ".$r['id']) , 0 );
$l .= '<tr><td class="Cmite">'.$r['show'].'</td><td class="Cnorm">'.$str.'</td></tr>';
} elseif ( $r['func'] == 2 ) {
$l .= '<tr><td class="Cdark" colspan="2"><b>'.$r['show'].'</b></td></tr>';
} elseif ( $r['func'] == 3 ) {
$str = '';
if (isset($a[$r['show']])) {
$str = @db_result ( db_query ("SELECT `".$r['show']."` FROM prefix_user WHERE id = ".$uid) , 0 );
}
if ( function_exists ( 'profilefields_show_spez_'.$r['show'] ) ) {
$l .= call_user_func ( 'profilefields_show_spez_'.$r['show'], $str, $uid );
} elseif ($r['show'] != 'opt_pm_popup') {
$l .= '<tr><td class="Cmite">'.ucfirst($r['show']).'</td><td class="Cnorm">'.$str.'</td></tr>';
}
}
}
return ( $l );
}
# hier kommen die speziellen funktionen hin...
##
###
function profilefields_show_spez_geschlecht ($value,$uid) {
global $lang;
$ar = array ( 0 => $lang['itdoesntmatter'], 1 => $lang['male'], 2 => $lang['female'] );
return ( profilefields_show_echo_standart ( $lang['sex'], $ar[$value] ) );
}
function profilefields_show_spez_status ($value,$uid) {
global $lang;
return ( profilefields_show_echo_standart ( $lang['status'], ($value?'<b>aktiv</b>':'<b>inaktiv</b>') ) );
}
function profilefields_show_spez_usergallery ($value,$uid) {
global $allgAr, $lang;
if ($allgAr['forum_usergallery'] == 1) {
return ( profilefields_show_echo_standart ( 'Usergallery', '<a href="index.php?user-usergallery-'.$uid.'">ansehen</a>' ) );
}
}
function profilefields_show_spez_homepage ($value,$uid) {
global $lang;
return ( profilefields_show_echo_standart ( $lang['homepage'], (empty($value)?'':'<a href="'.$value.'" target="_blank">'.$value.'</a>') ) );
}
function profilefields_show_spez_opt_mail ($value,$uid) {
global $lang;
return ( profilefields_show_echo_standart ( $lang['mail'], ($value?'<a href="index.php?user-mail-'.$uid.'">'.$lang['send'].'</a>':'') ) );
}
function profilefields_show_spez_opt_pm ($value,$uid) {
global $lang;
return ( profilefields_show_echo_standart ( $lang['privatemessages'], ($value?'<a href="index.php?forum-privmsg-new=0&empfid='.$uid.'">'.$lang['send'].'</a>':'') ) );
}
function profilefields_show_spez_sig ($value,$uid) {
global $lang;
return ( profilefields_show_echo_standart ( $lang['signature'], bbcode($value) ) );
}
function profilefields_show_spez_staat ($value,$uid) {
global $lang;
return ( profilefields_show_echo_standart ( $lang['state'], ((!empty($value) AND file_exists('include/images/flags/'.$value))?'<img src="include/images/flags/'.$value.'" alt="'.$value.'" title="'.$value.'" />':'') ) );
}
###
##
# help funcs
function get_nationality_array () {
$ar = array();
$o = opendir ( 'include/images/flags' );
while ( $f = readdir ( $o ) ) {
if ( $f != '.' AND $f != '..' ) {
$ar[$f] = str_replace('.gif','',$f);
}
}
asort($ar);
return ( $ar );
}
function profilefields_show_echo_standart ( $k, $v ) {
return ( '<tr><td class="Cmite">'.$k.'</td><td class="Cnorm">'.$v.'</td></tr>' );
}
# Funktion by Nacht Wolf
function get_uhr_array () {
$av = array();
$op = opendir ( 'include/images/uhr' );
while ( $fo = readdir ( $op ) ) {
if ( $fo != '.' AND $fo != '..' ) {
$av[$fo] = $fo;
}
}
return ( $av );
}
?>
includes/func/user.php
<?php
# hier werden alle user spezifischen funktionen
# definert...
function user_identification () {
user_auth();
user_login_check();
user_update_database();
user_check_url_rewrite();
}
function user_auth () {
debug ('user - auth gestartet'. session_id());
$cn = session_und_cookie_name();
if (!user_key_in_db()
OR !isset($_SESSION['authid'])
OR (isset($_SESSION['authsess']) AND $_SESSION['authsess'] != $cn)) {
debug ('user - nicht in db oder nicht authid');
user_set_guest_vars();
user_set_user_online ();
# wenn cn cookie vorhanden
# dann checken ob er sich damit einloggen darf
if (isset($_COOKIE[$cn])) {
user_auto_login_check();
}
# gruppen, und modulzugehoerigkeit setzten
user_set_grps_and_modules();
}
}
function user_check_url_rewrite() {
global $allgAr;
if ( !loggedin() AND $allgAr['show_session_id'] == 0 ) {
# loescht die sessionid von allen urls
# auch urls wie formulare usw. damit
# suchmaschienen bots nicht iritiert sind ;)
# output_reset_rewrite_vars ist eine php funktion
# nicht unnoetig dannach suchen ;) ...
output_reset_rewrite_vars ();
}
}
function user_update_database () {
$dif = date('Y-m-d H:i:s', time() - 7200);
db_query("UPDATE prefix_online SET uptime = now() WHERE sid = '".session_id()."'");
db_query("DELETE FROM prefix_online WHERE uptime < '". $dif."'");
if ( loggedin() ) {
db_query("UPDATE prefix_user SET llogin = '".time()."' WHERE id = '".$_SESSION['authid']."'");
}
}
function user_set_user_online () {
global $allgAr;
if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_online WHERE sid = '".session_id()."'"),0) ) {
db_query("INSERT INTO prefix_online (sid,uptime,ipa) VALUES ('".session_id()."',now(),'".getip()."')");
}
$_SESSION['authgfx'] = $allgAr['gfx'];
}
function user_key_in_db() {
if ( 1 == db_result(db_query("SELECT COUNT(*) FROM prefix_online WHERE sid = '".session_id()."'"),0) ) {
return ( true );
} else {
return ( false );
}
}
function session_und_cookie_name () {
return (md5(dirname($_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]).DBPREF));
}
function user_login_check () {
if ( isset ($_POST['user_login_sub']) AND isset ($_POST['name']) AND isset ($_POST['pass']) ) {
debug ('posts vorhanden');
$name = escape($_POST['name'], 'string');
if ($name != $_POST['name'] OR strlen($_POST['name']) > 15) {
return false;
}
$erg = db_query("SELECT name,id,recht,pass,llogin, template FROM prefix_user WHERE name = BINARY '".$name."'");
if ( db_num_rows($erg) == 1 ) {
debug ('user gefunden');
$row = db_fetch_assoc($erg);
if ( $row['pass'] == md5($_POST['pass']) ) {
debug ('passwort stimmt ... '.$row['name']);
$_SESSION['authname'] = $row['name'];
$_SESSION['authid'] = $row['id'];
$_SESSION['authright'] = $row['recht'];
$_SESSION['lastlogin'] = $row['llogin'];
$_SESSION['authgfx'] = $row['template'];
debug("Templates: ".$row['template']);
$_SESSION['authsess'] = session_und_cookie_name();
db_query("UPDATE prefix_online SET uid = ".$_SESSION['authid']." WHERE sid = '".session_id()."'");
setcookie($_SESSION['authsess'], $row['id'].'='.$row['pass'] , time() + 31104000, "/" );
user_set_grps_and_modules();
return (true);
}
}
global $menu;
$menu->set_url (0, 'user');
$menu->set_url (1, 'login');
}
return ( false );
}
function user_auto_login_check () {
$cn = session_und_cookie_name();
$dat = explode('=',$_COOKIE[$cn]);
$id = $pw = 0;
if (isset($dat[0])) { $id = escape($dat[0], 'integer'); }
if (isset($dat[1])) { $pw = $dat[1]; }
debug (' pw ' . $pw );
debug (' id ' . $id );
$erg = db_query("SELECT name,id,recht,pass,llogin, template FROM prefix_user WHERE id = ".$id);
if (db_num_rows($erg) == 1) {
debug ('benutzer gefunden');
$row = db_fetch_assoc($erg);
if ($row['pass'] == $pw) {
debug ('passwoerter stimmen');
debug ($row['name']);
$_SESSION['authname'] = $row['name'];
$_SESSION['authid'] = $row['id'];
$_SESSION['authright'] = $row['recht'];
$_SESSION['lastlogin'] = $row['llogin'];
$_SESSION['authgfx'] = $row['template'];
debug("Templates: ".$row['template']);
$_SESSION['authsess'] = $cn;
db_query("UPDATE prefix_online SET uid = ".$_SESSION['authid']." WHERE sid = '".session_id()."'");
setcookie($cn, $row['id'].'='.$row['pass'], time() + 31104000, "/" );
return (true);
}
}
user_logout ();
return (false);
}
function user_set_guest_vars() {
$_SESSION['authname'] = 'Gast';
$_SESSION['authid'] = 0;
$_SESSION['authright'] = 0;
$_SESSION['lastlogin'] = time();
$_SESSION['authgrp'] = array();
$_SESSION['authmod'] = array();
$_SESSION['authsess'] = session_und_cookie_name();
}
function user_markallasread () {
$_SESSION['lastlogin'] = time();
}
function user_logout () {
#global $allgAr;
#$_SESSION = array();
#$_SESSION['authgfx'] = $allgAr['gfx'];
user_set_guest_vars();
db_query("UPDATE prefix_online SET uid = ".$_SESSION['authid']." WHERE sid = '".session_id()."'");
setcookie(session_und_cookie_name(), "", time()-999999999999, "/" );
#if (isset($_COOKIE[session_name()])) {
# setcookie(session_name(), '', time()-99999999999931104000, '/');
#}
#setcookie(session_und_cookie_name(), "", time()-999999999999, "/" );
#session_destroy();
}
function user_set_grps_and_modules () {
$_SESSION['authgrp'] = array();
$_SESSION['authmod'] = array();
if ( loggedin() ) {
$erg = db_query("SELECT gid FROM prefix_groupusers WHERE uid = ".$_SESSION['authid']);
while ( $row = db_fetch_assoc ( $erg ) ) {
$_SESSION['authgrp'][$row['gid']] = TRUE;
}
$erg = db_query("SELECT DISTINCT url
FROM prefix_modulerights
left join prefix_modules on prefix_modules.id = prefix_modulerights.mid
WHERE uid = ".$_SESSION['authid']);
while ( $row = db_fetch_assoc ( $erg ) ) {
$_SESSION['authmod'][$row['url']] = TRUE;
}
}
}
function loggedin () {
if ( has_right(-1) ) { return ( true ); } else { return ( false ); }
}
function is_admin () {
if ( has_right(-9) ) { return ( true ); } else { return ( false ); }
}
function is_coadmin () {
if ( has_right(-8) ) { return ( true ); } else { return ( false ); }
}
function is_siteadmin ($m = NULL) {
if ( has_right(-7) ) { return ( true ); }
if ( !is_null($m) AND has_right(NULL, $m)) { return (true); }
return ( false );
}
# diese funktion liefert immer true wenn es ein admin ist.
# wenn kein kein admin wird geprueft ob der user
# entweder ein angegebenes recht oder in einer angegebene
# gruppe ist. oder ob er fals angegben das modulrecht hat.
# wenn eines von diesen 3 kriterien stimmt wird true ansonsten
# wenn keins uebereinstimmt false zurueck gegeben.
function has_right ($recht,$modul = '') {
if ( !is_array($recht) AND !is_null($recht) ) {
$recht = array ( $recht );
}
if ( $_SESSION['authright'] == -9 ) {
return ( true );
}
if ( !is_null($recht) ) {
foreach ( $recht as $v ) {
if ( ($v <= 0 AND $v >= $_SESSION['authright'] ) OR (isset($_SESSION['authgrp'][$v]) AND $_SESSION['authgrp'][$v] === true) ) {
return (true);
}
}
}
if ( !empty($modul) AND isset($_SESSION['authmod'][$modul]) AND $_SESSION['authmod'][$modul] === true ) {
return ( true );
}
return (false);
}
### admin
# wenn der 2. parameter weggelassen wird oder auf true gesetzt wird
# dann wird ein login formular angezeigt, wenn der user kein admin ist.
# wird der parameter auf false gesetzt wird das login formular nicht angezeigt.
# erste parameter ist das menu objekt...
function user_has_admin_right (&$menu,$sl=true) {
if ( $_SESSION['authright'] <= -8 ) { # co leader...
return ( true );
} else {
$uri_to_check1 = $menu->get(0);
$uri_to_check2 = $menu->get(1);
if ( count($_SESSION['authmod']) < 1 OR !loggedin() ) {
if ( $sl === true ) {
if ( !loggedin() ) {
$tpl = new tpl ( 'user/login.htm' );
$tpl->set_out('WDLINK','admin.php',0);
} else {
echo '<strong>Keine Berechtigung!</strong> <a href="index.php">Startseite</a>';
}
}
return ( false );
} elseif ( (isset($_SESSION['authmod'][$uri_to_check1]) AND $_SESSION['authmod'][$uri_to_check1] == true)
OR (isset($_SESSION['authmod'][$uri_to_check1.'-'.$uri_to_check2]) AND $_SESSION['authmod'][$uri_to_check1.'-'.$uri_to_check2] == true) ) {
return ( true );
} elseif ( count($_SESSION['authmod']) > 0 AND loggedin() ) {
if ( $sl === true ) {
foreach($_SESSION['authmod'] as $k => $v ) { $x = $k; break; }
$x = explode('-',$x);
$menu->set_url (0, $x[0]);
if ( isset($x[1]) ) {
$menu->set_url (1, $x[1]);
}
}
return ( true );
}
}
return ( false );
}
function user_regist ($name, $mail, $pass, $icq, $homepage, $geschlecht, $gebdatum, $sig) {
global $allgAr, $lang;
$erg = db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'");
if (db_num_rows($erg) > 0) {
return (false);
}
if ( $allgAr['forum_regist_user_pass'] == 0 ) {
$new_pass = genkey(8);
} else {
$new_pass = $pass;
}
$md5_pass = md5($new_pass);
$confirmlinktext = '';
# confirm insert in confirm tb not confirm insert in user tb
if ( $allgAr['forum_regist_confirm_link'] == 1 ) {
# confirm link + text ... bit of shit put it in languages file
$page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
$id = md5 (uniqid (rand()));
$confirmlinktext = "\n".$lang['registconfirm']."\n\n".sprintf($lang['registconfirmlink'], $page, $id );
db_query("INSERT INTO prefix_usercheck (`check`,name,email,pass,datime,ak,icq,homepage,geschlecht,signatur,gebdatum)
VALUES ('".$id."','".$name."','".$mail."','".$md5_pass."',NOW(),1,'".$icq."','".$homepage."','".$geschlecht."','".$sig."','".$gebdatum."')");
} else {
db_query("INSERT INTO prefix_user (name,pass,recht,regist,llogin,email,status,opt_mail,opt_pm,icq,homepage,geschlecht,sig,gebdatum)
VALUES('".$name."','".$md5_pass."',-1,'".time()."','".time()."','".$mail."',1,1,1,'".$icq."','".$homepage."','".$geschlecht."','".$sig."','".$gebdatum."')");
$userid = db_last_id();
}
$regmail = sprintf($lang['registemail'],$name, $confirmlinktext, $name, $new_pass);
icmail($mail,'Anmeldung',$regmail); # email an user
return (true);
}
function user_remove($uid){
$row = @db_fetch_object(db_query("SELECT recht,avatar FROM prefix_user WHERE id = ".$uid));
if ( $uid <> 1 AND ($_SESSION['authid'] == $uid OR $_SESSION['authid'] == 1 OR (is_coadmin() AND $_SESSION['authright'] < $row->recht))) {
db_query("DELETE FROM prefix_user WHERE id = ".$uid);
db_query("DELETE FROM prefix_userfields WHERE uid = ".$uid);
db_query("DELETE FROM prefix_groupusers WHERE uid = ".$uid);
db_query("DELETE FROM prefix_modulerights WHERE uid = ".$uid);
db_query("DELETE FROM prefix_pm WHERE eid = ".$uid);
db_query("DELETE FROM prefix_online WHERE uid = ".$uid);
//Usergallery entfernen
$sql = db_query("SELECT id,endung FROM prefix_usergallery WHERE uid = ".$uid);
while( $r = db_fetch_object($sql) ){
@unlink("include/images/usergallery/img_$r->id.$r->endung");
@unlink("include/images/usergallery/img_thumb_$r->id.$r->endung");
}
db_query("DELETE FROM prefix_usergallery WHERE uid = ".$uid);
//Avatar
@unlink($row->avatar);
}
}
// Last User
function last_user($uid){
$lb = db_fetch_object(db_query("SELECT last_bes, last_user_time FROM prefix_user WHERE id = ".$uid));
$lba = explode('#',$lb->last_bes);
$lbt = explode('#',$lb->last_user_time);
$name = '';
foreach ($lba as $k => $v) {
if ($v < 1) { continue; }
$besname = @db_result($sql = db_query("SELECT name FROM prefix_user WHERE id = ".$v),0,0);
$besstaat = @db_result($sql,0,1);
$time = date("d.m.Y um H:i",$lbt[$k]);
$name .= "<div><a href=\"index.php?user-details-$v\" target=\"_self\" title=\"besucht am $time Uhr\">$besname</a></div>";
}
return($name);
}
function sendpm ($sid,$eid,$ti,$te,$status = 0) {
$page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
// Testen, ob Array. Sonst umwandeln.
if (!is_array($eid)) {
$eid = Array( $eid );
}
// Alle Emfänger durchlaufen
foreach ($eid AS $empf){
// PM schreiben und ID speichern
db_query("INSERT INTO `prefix_pm` (`sid`,`eid`,`time`,`titel`,`txt`,`status`) VALUES (".$sid.",".$empf.",'".time()."','".$ti."','".$te."',".$status.")");
$last_id = db_last_id();
// Alle Zeiten der letzten PMs abfragen, die nach dem letzten Login des Empfängers verschickt wurden
$erg = db_query("SELECT `b`.`time` FROM `prefix_user` AS `a` LEFT JOIN `prefix_pm` AS `b` ON `a`.`id` = `b`.`eid` AND `b`.`id` != ".$last_id." WHERE `a`.`id` = ".$empf." AND `a`.`llogin` < `b`.`time`");
// Wenn keine PM gefunden wurde, Email schreiben
if( db_num_rows( $erg ) == 0 ){
// Email-Adresse abfragen und Email verschicken
$mail = db_result(db_query("SELECT `email` FROM `prefix_user` WHERE `id` = ".$empf),0);
if (!empty($mail)) { icmail($mail,"Du hast eine neue Nachricht","Hallo,\ndu hast eben eine Neue Nachricht mit dem Betreff '".$ti."' bekommen. Diese Nachricht kannst du nun unter folgender Adresse mit Deinen Logindaten aufrufen: ".$page."?forum-privmsg-showmsg-".$last_id."\n\nWir wünschen Dir noch einen schönen Tag!"); }
}
}
}
?>
Das wären halt die wo ich nie im leben hinbekommen würde. Ich denke das die html Datein dann etwas einfacher wären. Darum wäre ich sehr froh wenn es ne Art Tutorial geben würde wo was reinkommt von dem Punktemodul 1.10
LG