Hallo liebe Ilcher,
ich hab jetzt ein wenig herumprobiert aber leider schaff ich es nicht so wie ich gern möchte.
Kann sich jemand erbarmen und mir helfen das ich die Usergallerie Übersicht zentriert in eine Art Tabelle bekomme ?
Danke vielmals LG
<?php
# Copyright by: Manuel
# Support: www.ilch.de
# Kommentar Mod by OloX
# www.dms-gaming.com [+] mairu.ilch.net
defined ('main') or die ( 'no direct access' );
if ($allgAr['forum_usergallery'] == 0) { exit(); }
$uid = escape($menu->get(2), 'integer');
$img_per_site = $allgAr['gallery_imgs_per_site'];
$img_per_line = $allgAr['gallery_imgs_per_line'];
# zeige alle gallery
if (empty($uid)) {
$title = $allgAr['title'].' :: Users :: Gallery';
$hmenu = $extented_forum_menu.'<a class="smalfont" href="?user">Users</a><b> » </b>Gallery'.$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);
$design->header();
$i = 0;
$class = 'Cmite';
$x = '';
if (loggedin()) {
$x .= '<br><br><a href="index.php?user-usergallery-'.$_SESSION['authid'].'"><b> <p align="center"><a href="index.php?news"><b></b><center><div style="border:0px #140905 solid;background:#140905;color:#DFC49B;padding:2px;"><font size="-2"><a href="/index.php?user-usergallery"><b><font color="#FAECD1"></b>Usergallerie Übersicht</font></a> </font></font></div></center></font></a></p> ';
}
$erg = db_query("SELECT uid, prefix_user.name as uname, COUNT(*) as anz FROM prefix_usergallery LEFT JOIN prefix_user ON prefix_usergallery.uid = prefix_user.id GROUP BY uid, uname ORDER BY anz DESC");
while ($r = db_fetch_assoc($erg)) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$x .= '<center> <div class="'.$class.'" style="float:left; padding: 10px; width:96px; margin:2 auto;"><a href="index.php?user-usergallery-'.$r['uid'].'"><b>'.$r['uname'].'</b><br /><span class="smalfont">Bildergallerie <br>Anzahl: <b>'.$r['anz'].'</b></span></a></a></div></div>';
if ( $i <> 0 AND ($i % 5 ) == 0 ) { $x .= '<br />'; }
}
$tpl = new tpl ( 'user/gallery');
$tpl->set_out('x',$x,4);
$design->footer();
exit();
}
# user gallery zeigen
$uname = db_result(db_query("SELECT name FROM prefix_user WHERE id = ".$uid),0,0);
$title = $allgAr['title'].' :: Users :: Gallery';
$hmenu = $extented_forum_menu.'<a class="smalfont" href="index.php?user">Users</a><b> » </b><a class="smalfont" href="?user-usergallery">Gallery</a><b> » </b>von <a class="smalfont" href="?user-usergallery-'.$uid.'">'.$uname.'</a>'.$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);
$design->header();
if ($_SESSION['authright'] >= -1 ) {
echo '<font size="+1"><b><center>Nur für Mitglieder</b></font><br>Bitte lasse Dich freischalten.</center>';
$design->footer(1);
}
$tpl = new tpl ('user/gallery');
$tpl->set('uid', $uid);
$tpl->set('uname', $uname);
# bild loeschen...
if ($menu->getA(4) == 'd' AND is_numeric($menu->getE(4)) AND loggedin() AND (is_siteadmin() OR $uid == $_SESSION['authid'])) {
$delid = escape($menu->getE(4), 'integer');
$x = @db_result(db_query("SELECT endung FROM prefix_usergallery WHERE uid = ".$uid." AND id = ".$delid),0,0);
if (!empty($x)) {
@unlink ( 'include/images/usergallery/img_thumb_'.$delid.'.'.$x );
@unlink ( 'include/images/usergallery/img_'.$delid.'.'.$x );
@unlink ( 'include/images/usergallery/img_norm'.$delid.'.'.$x );
@db_query("DELETE FROM prefix_usergallery WHERE uid = ".$uid." AND id = ".$delid);
@db_query("DELETE FROM prefix_koms WHERE uid = ".$delid." AND cat = 'USERGIMG'");
}
}
# bild hochladen
if (!empty($_FILES['file']['name']) AND is_writeable('include/images/usergallery') AND loggedin() AND $uid == $_SESSION['authid'] AND substr ( ic_mime_type($_FILES['file']['tmp_name']) , 0 , 6 ) == 'image/') {
require_once('include/includes/func/gallery.php');
$size = @getimagesize ($_FILES['file']['tmp_name']);
$fende = preg_replace("/.+\.([a-zA-Z]+)$/", "\\1", $_FILES['file']['name']);
$fende = strtolower($fende);
if (!empty($_FILES['file']['name']) AND $size[0] > 10 AND $size[1] > 10 AND ($size[2] == 2 OR $size[2] == 3 OR $size[2] == 1) AND ($fende == 'gif' OR $fende == 'jpg' OR $fende == 'jpeg' OR $fende == 'png')) {
$name = $_FILES['file']['name'];
$tmp = explode('.',$name);
$tm1 = count($tmp) -1;
$endung = escape($tmp[$tm1], 'string');
unset($tmp[$tm1]);
$name = escape(implode('',$tmp), 'string');
$besch = escape($_POST['text'], 'string');
$id = db_result(db_query("SHOW TABLE STATUS FROM `". DBDATE ."` LIKE 'prefix_usergallery'"),0,'Auto_increment');
$bild_url = 'include/images/usergallery/img_'.$id.'.'.$endung;
if (@move_uploaded_file ($_FILES['file']['tmp_name'], $bild_url)) {
@chmod($bild_url, 0777);
db_query("INSERT INTO prefix_usergallery (uid,name,endung,besch) VALUES (".$uid.",'".$name."','".$endung."','".$besch."')");
$bild_thumb = 'include/images/usergallery/img_thumb_'.$id.'.'.$endung;
$bild_norm = 'include/images/usergallery/img_norm_'.$id.'.'.$endung;
create_thumb ($bild_url, $bild_norm , ($allgAr['gallery_normal_width']-64));
create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
@chmod($bild_thumb, 0777);
@chmod($bild_norm, 0777);
echo '<div style="border:0px #140905 solid;background:#F9E9CA;color:#DFC49B;padding:5px;"><b><font color="#005E00">Bild '.$name.'.'.$endung.' erfolgreich hochgeladen</font></div></b>
<br>';
$page = $_SERVER["HTTP_HOST"]. dirname($_SERVER["SCRIPT_NAME"]);
echo '<div style="border:0px #140905 solid;background:#140905;color:#DFC49B;padding:5px;"><b>Bildlink: </b><a target="_blank" href="http://'.$page.'/'.$bild_url.'"><font color="#F2CE8A">http://'.$page.'/'.$bild_url.'</font></a><br />';
echo '<b>Oder klein: </b><a target="_blank" href="http://'.$page.'/'.$bild_thumb.'"><font color="#F2CE8A">http://'.$page.'/'.$bild_thumb.'</font></a></div><br>';
}
}
}
if ($menu->get(3) == 'show' && is_numeric($menu->get(4)) ) {
$picid = escape($menu->get(4), 'integer');
$q = db_query("SELECT `a`.`name`, `a`.`besch`, `a`.`endung`, `a`.`id` AS `id`, `a`.`uid` AS `uid`, `b`.`name` AS `uname`
FROM `prefix_usergallery` AS `a`
LEFT JOIN `prefix_user` `b` ON `a`.`uid` = `b`.`id`
WHERE `a`.`id` = ".$picid);
if ( db_num_rows($q) > 0 ) {
$r = db_fetch_assoc($q);
if ($r['uid'] == $menu->get(2)) {
#comment eintragen
$insertmsg = '';
if ((loggedin() or isset($_POST['name'])) and !empty($_POST['text']) and $antispam = chk_antispam('usergallery')) {
if (loggedin()) {
$name = $_SESSION['authname'];
} else {
$name = escape($_POST['name'],'string');
if (db_count_query('SELECT COUNT(*) FROM `prefix_user` WHERE `name` = "'.$name.'"')) {
$insertmsg .= 'Der Name ist bereits für einen registrierten User vergeben';
}
}
if (empty($insertmsg)) {
$text = escape($_POST['text'],'string');
db_query("INSERT INTO `prefix_koms` (`name`,`text`,`uid`,`cat`) VALUES ('".$name."','".$text."',".$r['id'].",'USERGIMG')");
if ($r['uid'] != $_SESSION['authid'] && true) {
$host = '[url]http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'].'?user-usergallery-'.$r['uid'].'-show-'.$r['id'].'[/url]';
$text = "Hallo %s!\n\n %s hat einen Kommentar zu einem Bild ( %s ) geschrieben.\nUm direkt zu dem Foto zu kommen, nutze einfach den unten stehenden Link:\n%s\n\n Viel Spaß!";
$ttext = sprintf($text,$r['uname'],$_SESSION['authname'],$r['besch'],$host);
sendpm (1, $r['uid'], 'Neue Kommentare zu Deinen Bildern',$ttext, -1);
}
}
} elseif (isset($_POST['subugalkom']) and !$antispam) {
$insertmsg .= 'Falscher Antispam';
}
#comment loeschen
if (isset($_GET['delete']) && ( is_siteadmin() or $r['uid'] == $_SESSION['authid'] ) ) {
db_query("DELETE FROM `prefix_koms` WHERE `id` = ".escape($_GET['delete'], 'integer'));
}
#comment zeigen
if (!empty($insertmsg)) {
$insertmsg = '<span style="color:red;">'.$insertmsg.'</span><br />';
}
$pAr = array();
$picQ = db_query("SELECT `id` FROM `prefix_usergallery` WHERE `uid` = ".$r['uid']." ORDER BY `id` DESC");
while ($picr = db_fetch_assoc($picQ)) {
$pAr[] = $picr['id'];
}
$picArKey = array_search($r['id'], $pAr);
$prevPicId = ($picArKey > 0) ? $pAr[$picArKey - 1] : false;
$nextPicId = ($picArKey < (count($pAr) - 1)) ? $pAr[$picArKey + 1] : false;
$prevLink = !is_bool($prevPicId) ? '<a href="index.php?user-usergallery-'.$r['uid'].'-show-'.$prevPicId.'">« Vorheriges Bild</a>' : '';
$nextLink = !is_bool($nextPicId) ? '<a href="index.php?user-usergallery-'.$r['uid'].'-show-'.$nextPicId.'">Nächstes Bild »</a>' : '';
$path = 'include/images/usergallery/';
$exNorm = ( file_exists($path.'img_norm_'.$r['id'].'.'.$r['endung']) ? true : false );
$ar = array (
'besch' => $r['besch'],
'endung' => $r['endung'],
'img' => ( $exNorm ? 'img_norm_'.$r['id'].'.'.$r['endung'] : 'img_'.$r['id'].'.'.$r['endung']),
'style' => ( $exNorm ? '' : ' style="width:'. ($allgAr['gallery_normal_width']-64) .'px;"'),
'id' => $r['id'],
'userid' => $r['uid'],
'uname' => $_SESSION['authname'],
'antispam' => get_antispam('usergallery', 0),
'text' => ( isset($_POST['text']) && !$antispam ? escape($_POST['text'],'string') : '' ),
'insertmsg' => $insertmsg,
'nextpic' => $nextLink,
'prevpic' => $prevLink
);
$tpl->set_ar_out($ar,5);
$class = 'Cnorm';
$erg = db_query("SELECT `id`, `name`, `text` FROM `prefix_koms` WHERE `uid` = ".$r['id']." AND `cat` = 'USERGIMG' ORDER BY `id` DESC");
while ($row = db_fetch_assoc($erg)) {
$class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite');
$row['class'] = $class;
$row['text'] = bbcode ($row['text']);
if (is_siteadmin() OR $r['uid'] == $_SESSION['authid']) {
$row['text'] .= '<a href="index.php?user-usergallery-'.$r['uid'].'-show-'.$r['id'].'&delete='.$row['id'].'"><img src="include/images/icons/del.gif" border="0" title="löschen" alt="löschen" /></a>';
}
$tpl->set_ar_out($row,6);
}
$tpl->out(7);
} else {
echo 'Es ist ein Fehler aufgetreten.';
}
} else {
echo 'Es ist ein Fehler aufgetreten.';
}
} else {
# bilder abfragen
$limit = $img_per_site;
$page = ($menu->getA(3) == 'p' ? $menu->getE(3) : 1 );
$MPL = db_make_sites ($page , '' , $limit , 'index.php?user-usergallery-'.$uid , "usergallery WHERE uid = ".$uid);
$anfang = ($page - 1) * $limit;
$erg = db_query("SELECT `a`.*, `a`.`id` AS `id`, `a`.`uid` AS `picuid`, count(`b`.`id`) AS `comms`
FROM `prefix_usergallery` AS `a`
LEFT JOIN `prefix_koms` AS `b` ON `b`.`uid` = `a`.`id` AND `b`.`cat` = 'USERGIMG'
WHERE `a`.`uid` = ".$uid." GROUP BY `a`.`id`, `a`.`besch`, `a`.`name`
ORDER BY `a`.`id` DESC LIMIT ".$anfang.",".$limit);
$tpl->set('imgperline', $allgAr['gallery_imgs_per_line']);
$tpl->set('MPL',$MPL);
$tpl->out(0); $class = 'Cnorm';
$i = 0;
if ( db_num_rows($erg) > 0 ) {
while($row = db_fetch_assoc($erg) ) {
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$row['class'] = $class;
$row['besch'] = unescape($row['besch']);
if (loggedin() AND (is_siteadmin() OR $uid == $_SESSION['authid'])) {
$row['besch'] .= '<a href="index.php?user-usergallery-'.$uid.'-p'.$page.'-d'.$row['id'].'"><img src="include/images/icons/del.gif" border="0" alt="löschen" title="löschen" /></a>';
}
$row['width'] = round( 100 / $img_per_line );
if ( $i <> 0 AND ($i % $img_per_line ) == 0 ) { echo '</tr><tr>'; }
$tpl->set_ar_out($row,1);
$i++;
}
if ( $i % $img_per_line <> 0 ) {
$anzahl = $img_per_line - ($i % $img_per_line);
for($x=1;$x<=$anzahl;$x++){
echo '<td class="'.$class.'"></td>';
}
}
}
$tpl->out(2);
# bilder abfragen
echo '<br><div style="border:0px #140905 solid;background:#140905;color:#DFC49B;padding:5px;"><center><a href="index.php?user-usergallery"><b></b><font size="+1"><a href="/index.php?user-usergallery"><b><font color="#FAECD1"></b><b>Zur Bildergallerie</b></font></a></font></font></div></font></font></a></p></center>';
# bild hochladen
if (is_writeable('include/images/usergallery') AND loggedin() AND $uid == $_SESSION['authid']) {
$tpl->out(3);
}
}
$design->footer();
?>
Zuletzt modifiziert von webork am 03.02.2011 - 18:56:24