Hallo Outi77,
Danke für die schnelle Antwort. Hatte ich auch geschaut. Nur da hat keine Änderung statt gefunden. Sprich, alles wie vorher. Keine neuen Kategorien. Das einzige was neu ist, ist im Adminmenü unter Download "User-Uploads freischalten".
hier mal die galleryupl.php
<?php
// Copyright by: Manuel Staechele
// Support: www.ilch.de
defined ('main') or die ('no direct access');
require_once('include/includes/func/gallery.php');
// Recht fürs Uploaden
$uploadRight = - 1; //-1 User ... -9 Admin
$uploadExtensions = array('jpg', 'jpeg', 'png', 'gif'); //erlaubte Dateiendungen
$uploadImageSize = 1000000; //Bytes maximale Dateigröße
function upload_picture($cat) {
global $allgAr, $uploadExtensions, $uploadImageSize;
$msg = '';
if (!empty($_FILES['file']['name'])) {
$name = $_FILES['file']['name'];
$pathinfo = pathinfo($_FILES['file']['name']);
if (!in_array(strtolower($pathinfo['extension']), $uploadExtensions)) {
$msg .= 'Unerlaubte Dateiendung.';
}
if ($_FILES['file']['size'] > $uploadImageSize) {
$msg .= 'Datei größer als die maximale Größe von '.$uploadImageSize.' Bytes';
}
$besch = escape($_POST['besch'], 'string');
$id = db_result(db_query("SHOW TABLE STATUS FROM `" . DBDATE . "` LIKE 'prefix_gallery_imgs'"), 0, 'Auto_increment');
$bild_url = 'include/images/gallery/img_' . $id . '.' . $endung;
if (empty($msg) and @move_uploaded_file ($_FILES['file']['tmp_name'], $bild_url)) {
@chmod($bild_url, 0777);
db_query("INSERT INTO prefix_gallery_imgs (cat,datei_name,endung,besch) VALUES ($cat,'" . $name . "','" . $endung . "','" . $besch . "')");
$msg .= 'Datei ' . $name . '.' . $endung . ' erfolgreich hochgeladen<br />';
$bild_thumb = 'include/images/gallery/img_thumb_' . $id . '.' . $endung;
$bild_norm = 'include/images/gallery/img_norm_' . $id . '.' . $endung;
create_thumb ($bild_url, $bild_thumb, $allgAr['gallery_preview_width']);
@chmod($bild_thumb, 0777);
create_thumb ($bild_url, $bild_norm , $allgAr['gallery_normal_width']);
@chmod($bild_norm, 0777);
return true;
} elseif (empty($msg)) {
$msg .= 'Fehler beim Upload aufgetreten';
}
}
return $msg;
}
$tpl = new tpl('gallery_upload');
if ($_SESSION['authright'] <= $uploadRight AND $menu->get(1) == 'iframe') {
$sql = db_query("SELECT cat, id FROM prefix_gallery_cats WHERE cat < 0 AND uploader = {$_SESSION['authid']} GROUP BY cat ORDER BY cat DESC");
$anz1 = $anz2 = $cat = 0;
$tmp = 'anz' . abs(@db_result($sql, 0, 0));
$$tmp = 1;
$cat = @db_result($sql, 0, 1);
unset($tmp);
if ($anz2 == 1 AND $cat > 0) {
$uploading = 0;
$styles = file_exists('include/designs/' . $_SESSION['authgfx'] . '/style.css') ? '<link rel="stylesheet" type="text/css" href="include/designs/' . $_SESSION['authgfx'] . '/style.css" />' : '';
if ($_POST['uploading'] == '1') {
$error = upload_picture($cat);
if ($error === true) {
$uploading = 2;
$error = 'korrekt hochgeladen.';
} else {
$uploading = 3;
}
$tpl->set('error',$error);
}
$tpl->set('uploading', $uploading);
$tpl->set_out('styles', $styles, 5);
} else {
die('error');
}
exit();
}
$title = $allgAr['title'] . ' :: Galleryupload';
$hmenu = 'Galleryupload';
$design = new design ($title , $hmenu);
$design->header();
if ($_SESSION['authright'] > $uploadRight) {
echo 'Nur für registrierte Benutzer.<br />';
} else {
$sql = db_query("SELECT cat, id FROM prefix_gallery_cats WHERE cat < 0 AND uploader = {$_SESSION['authid']} GROUP BY cat ORDER BY cat DESC");
$anz1 = $anz2 = $cat = 0;
$tmp = 'anz' . abs(@db_result($sql, 0, 0));
$$tmp = 1;
$cat = @db_result($sql, 0, 1);
unset($tmp);
if (isset($_POST['subnew'])) {
$name = escape($_POST['name'], 'string');
$desc = escape($_POST['besch'], 'string');
db_query("INSERT INTO prefix_gallery_cats (cat,name,besch,uploader,recht) VALUES (-2,'$name','$desc',{$_SESSION['authid']},0)");
$cat = db_last_id();
$anz2 = 1;
} elseif (isset($_POST['subedit'])) {
$name = escape($_POST['name'], 'string');
$desc = escape($_POST['besch'], 'string');
db_query("UPDATE prefix_gallery_cats SET name = '$name', besch = '$desc' WHERE uploader = {$_SESSION['authid']} AND cat = -2");
} elseif (isset($_POST['close'])) {
if (db_count_query("SELECT COUNT(*) FROM prefix_gallery_imgs WHERE cat = $cat") > 0) {
db_query("UPDATE prefix_gallery_cats SET cat = -1 WHERE uploader = {$_SESSION['authid']} AND cat = -2");
sendpm($_SESSION['authid'], 1, 'Gallerykategorie zum Freischalten', 'Ich habe eine Kategorie zum Freischalten hochgeladen.', - 1);
$anz1 = 1;
$anz2 = $cat = 0;
} else {
$msg .= 'Es muss mindestens ein Bild in der Kategorie sein.<br />';
}
} elseif (isset($_POST['upload']) AND count($_FILES['file']['name']) > 0) {
$msg .= upload_picture($cat);
} elseif (isset($_POST['pictochange'])) {
$pic = escape($_POST['pictochange'], 'integer');
$besch = escape($_POST['besch'], 'string');
if (db_query("UPDATE prefix_gallery_imgs SET besch = '$besch' WHERE id = $pic AND cat = $cat")) {
$msg .= 'Beschreibung geändert.<br />';
} else {
$msg .= 'Fehler beim Beschreibung ändern.<br />';
}
} elseif ($menu->getA(1) == 'd') {
$pic = $menu->getE(1);
$r2 = db_fetch_assoc(db_query("SELECT id,endung FROM prefix_gallery_imgs WHERE id = $pic AND cat = $cat"));
db_query("DELETE FROM prefix_gallery_imgs WHERE id = $pic AND cat = $cat");
@unlink ('include/images/gallery/img_' . $r2['id'] . '.' . $r2['endung']);
@unlink ('include/images/gallery/img_thumb_' . $r2['id'] . '.' . $r2['endung']);
@unlink ('include/images/gallery/img_norm_' . $r2['id'] . '.' . $r2['endung']);
$msg .= 'Bild gelöscht.<br />';
} elseif (isset($_POST['delkat'])) {
$sql = db_query("SELECT id,endung FROM prefix_gallery_imgs WHERE cat = $cat");
while ($r2 = db_fetch_assoc($sql)) {
@unlink ('include/images/gallery/img_' . $r2['id'] . '.' . $r2['endung']);
@unlink ('include/images/gallery/img_thumb_' . $r2['id'] . '.' . $r2['endung']);
@unlink ('include/images/gallery/img_norm_' . $r2['id'] . '.' . $r2['endung']);
}
db_query("DELETE FROM prefix_gallery_imgs WHERE cat = $cat");
db_query("DELETE FROM prefix_gallery_cats WHERE id = $cat AND cat = -2");
$anz1 = $anz2 = $cat = 0;
}
// Ausgabe
$tpl->set('exts', implode(', ', $uploadExtensions));
$tpl->set('maxsize', $uploadImageSize);
$tpl->out(0);
if (($anz1 == 0 AND $anz2 == 0) OR $menu->get(1) == 'chcat') {
// Kategorie anlegen
if ($menu->get(1) == 'chcat') {
$out = db_fetch_assoc(db_query("SELECT name, besch FROM prefix_gallery_cats WHERE cat = -2 AND uploader = " . $_SESSION['authid']));
$out['submit'] = 'subedit';
} else {
$out = array('name' => '', 'besch' => '', 'submit' => 'subnew');
}
$tpl->set_ar_out($out, 1);
} elseif ($anz2 == 1) {
// Hochladen
$out = db_fetch_assoc(db_query("SELECT name, besch FROM prefix_gallery_cats WHERE cat = -2 AND uploader = " . $_SESSION['authid']));
$out['msg'] = empty($msg) ? '' : '<b>Meldungen:</b> ' . $msg . '<br /><br />';
$tpl->set_ar_out($out, 2);
// Vorhandene Bilder
$sql = db_query("SELECT * FROM prefix_gallery_imgs WHERE cat = $cat ORDER BY id");
while ($r = db_fetch_assoc($sql)) {
$r['width'] = $allgAr['gallery_preview_width'] + 30;
$r['height'] = $allgAr['gallery_preview_width'] + 5;
$r['besch'] = str_replace("'", "\'", $r['besch']);
$tpl->set_ar_out($r, 3);
}
$tpl->out(4);
} elseif ($anz1 == 1) {
// Kategorie muss erst freigeschaltet werden
echo 'Hochgeladene Kategorie muss erst von einem Administrator freigeschaltet werden.<br />';
}
}
$design->footer();
?>
und hier die gallery_upload.htm
Du kannst hier <u>eine</u> Kategorie anlegen und danach Bilder in diese Kategorie hochladen.<br />
Wenn du damit fertig bist, kannst sie dann schließen, damit sie von einem Administrator begutachtet und freigeschaltet werden kann.<br />
Erst wenn sie von einem Administrator freigeschaltet wurde, kannst du eine neue Kategorie anlegen.<br /><br />
<strong>Beschränkungen:</strong>
<ul>
<li>erlaubte Dateiendungen: {exts}</li>
<li>maximale Dateigröße: {maxsize} Bytes</li>
</ul>
<br />
{EXPLODE}
<form action="index.php?galleryupl" method="post">
<table class="border" cellpadding="3" cellspacing="1" border="0">
<tr class="Chead">
<td colspan="2"><b>Gallery Kategorien</b></td>
<tr>
<td class="Cmite">Name</td>
<td class="Cnorm"><input type="text" name="name" value="{name}" size="50" /></td>
</tr><tr>
<td class="Cmite">Beschreibung</td>
<td class="Cnorm"><textarea cols="50" rows="3" name="besch">{besch}</textarea></td>
</tr>
<tr class="Cmite">
<td></td>
<td><input type="submit" value="Absenden" name="{submit}" /></td>
</tr>
</table>
</form>
{EXPLODE}
<script>
function addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+, NS6 and Mozilla
// By Scott Andrew
{
if (elm.addEventListener){
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent){
var r = elm.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be removed");
}
}
var uploadPictures;
var NumberOfPictures = 0;
var errors = 0;
function del ( id1 ) {
return confirm ( "Dieses Bild wirklich löschen?" );
}
function edit ( besch, id1 ) {
var x = prompt ( "Bitte die neue Beschreibung eingeben!", besch);
if ( x ) {
document.changedesc.pictochange.value = id1;
document.changedesc.besch.value = x;
document.changedesc.submit();
}
}
function addFileToList(opt) {
var i = frames['gu_if_'+NumberOfPictures];
var anz = NumberOfPictures;
var file = i.document.forms[0].file;
if (file.value != '') {
var besch = document.getElementById('gu_besch');
i.document.forms[0].besch.value = besch.value;
var td = document.getElementById('list_pics');
var span = document.createElement('div');
span.setAttribute('id','list_pic_'+anz);
var text = document.createTextNode(file.value+' ');
var img = document.createElement('img');
img.src = 'include/images/icons/del.gif';
img.alt = 'löschen';
span.appendChild(text);
span.appendChild(img);
td.appendChild(span);
addEvent(img,'click',function () { delFromList(anz); },false);
addIframe();
besch.value = '';
} else if (opt != true) {
alert('Erst ein Datei und Beschreibung festlegen und dann auf weiteres Bild hinzufügen klicken.');
}
}
function delFromList(id) {
var span = document.getElementById('list_pic_'+id);
span.parentNode.removeChild(span);
var ifr = document.getElementById('gu_if_'+id);
ifr.parentNode.removeChild(ifr);
for (var i = id + 1; i < NumberOfPictures; i++) {
document.getElementById('list_pic_'+i).setAttribute('id','list_pic_'+(i-1));
document.getElementById('gu_if_'+i).setAttribute('id','gu_if_'+(i-1));
}
document.getElementById('gu_if_'+NumberOfPictures).setAttribute('id','gu_if_'+(NumberOfPictures-1));
NumberOfPictures--;
}
function uploadPics() {
if (NumberOfPictures > 0) {
var iForm = frames['gu_if_'+NumberOfPictures].document.forms[0];
var uploadingStatus = iForm.uploading.value;
var uplImg = document.getElementById('list_pic_'+NumberOfPictures).lastChild;
if (uploadingStatus == 0) {
iForm.uploading.value = 1;
iForm.submit();
uplImg.src = 'include/images/icons/upload.gif';
} else if (uploadingStatus == 3) {
uplImg.title = iForm.error.value;
uplImg.src = 'include/images/icons/nop.gif';
NumberOfPictures--;
errors++;
} else if (uploadingStatus == 2) {
uplImg.src = 'include/images/icons/ok.gif';
NumberOfPictures--;
}
} else if (NumberOfPictures == 0) {
clearInterval(uploadPictures);
if (errors == 0) {
document.location.href = 'index.php?galleryupl';
} else {
var td = document.getElementById('list_pics');
var div = document.createElement('div');
var newTN = document.createTextNode('Es sind Fehler aufgetreten, sie können sich die Fehlermeldungen anschauen, indem sie mit der Maus über die Daumen fahren. ');
var link = document.createElement('a');
var linkText = document.createTextNode('Seite neu laden');
link.href = 'index.php?galleryupl';
link.appendChild(linkText);
div.appendChild(newTN);
div.appendChild(document.createElement('br'));
div.appendChild(link);
div.style.marginTop = '15px';
td.appendChild(div);
}
}
}
function prepareUpload() {
addFileToList(true);
document.getElementById('gu_besch').disabled = true;
document.getElementById('gu_add').disabled = true;
var sub = document.getElementById('gu_submit');
sub.disabled = true;
sub.value = 'Lade Bilder hoch ...';
sub.style.backgroundColor = 'red';
NumberOfPictures--;
uploadPictures = setInterval('uploadPics();',500);
}
function addIframe() {
if (NumberOfPictures > 0) {
var oi = document.getElementById('gu_if_'+NumberOfPictures);
oi.style.width = '0px';
oi.style.height = '0px';
}
NumberOfPictures++;
var i = document.createElement('iframe');
i.src = 'index.php?galleryupl-iframe';
i.name='gu_if_'+NumberOfPictures;
i.id='gu_if_'+NumberOfPictures;
i.frameBorder = '0';
i.scrolling='no';
i.style.width='217px';
i.style.height='20px';
document.getElementById('iframes').appendChild(i);
}
function setIframes() {
var td = document.getElementById('iframes').innerHTML = '';
addIframe(1);
var sub = document.getElementById('gu_submit');
var btn = document.createElement('input');
btn.type = 'button';
btn.value = 'Bild(er) hochladen';
sub.parentNode.replaceChild(btn,sub);
btn.setAttribute('id','gu_submit');
addEvent(btn,'click',prepareUpload);
var td = document.getElementById('list_pics');
td.parentNode.style.display = '';
td.parentNode.style.height = '';
}
addEvent(window,'load',setIframes);
</script>
<form action="index.php?galleryupl" method="post" name="changedesc"><input type="hidden" name="pictochange" value="0" /><input type="hidden" name="besch" value="" /></form>
<form action="index.php?galleryupl" method="post" enctype="multipart/form-data" id="gu_form">
{msg}
<table border="0" cellpadding="5" cellspacing="1" class="border" width="100%">
<tr class="Chead">
<td colspan="2"><b>Kategoriedetails</b></td>
</tr>
<tr class="Cnorm"><td>Name:</td><td>{name}</td></tr>
<tr class="Cnorm"><td>Beschreibung:</td><td>{besch}</td></tr>
<tr class="Cnorm"><td colspan="2" align="center">
<input type="button" onclick="window.location.href='index.php?galleryupl-chcat';" value="Kategorie ändern" />
<input type="submit" name="close" value="Kategorie schließen und zum Freischalten freigeben" onclick="return confirm ( 'Wirklich zum Freischalten freigeben?\nDu kannst dann keine weiteren Bilder hochladen, bis die Kategorie freigeschaltet wurde.' );" />
<input type="submit" name="delkat" value="Kategorie und alle Bilder darin löschen" onclick="return confirm ( 'Wirklich alle Bilder und die Kategorie löschen?' );" />
</td></tr>
<tr class="Chead">
<td colspan="2"><b>Bilder hochladen</b></td>
</tr><tr class="Cmite">
<td>Bild:</td><td id="iframes"><input size="35" type="file" name="file" id="gu_file" /></td>
</tr><tr class="Cmite">
<td>Beschreibung:</td><td><input type="text" name="besch" value="" id="gu_besch" size="50" /></td>
</tr>
<tr class="Cmite" style="height:0px; display:none;"><td colspan="2" id="list_pics"></td></tr>
<tr>
<td colspan="2" align="center" class="Cmite">
<input type="submit" id="gu_submit" name="upload" value="Bild(er) hochladen" />
<input type="button" id="gu_add" onclick="addFileToList();" value="weiteres Bild hinzufügen" />
</td>
</tr>
<tr class="Chead">
<td colspan="2"><b>hochgeladene Bilder</b></td>
</tr><tr class="Cmite"><td colspan="2">{EXPLODE}
<div style="float: left; width:{width}px; height:{height}px; overflow:hidden;">
<table>
<tr><td rowspan="2"><a href="include/images/gallery/img_{id}.{endung}" target="_blank"><img border="0" title="{datei_name} |---| {besch}" alt="{datei_name}" src="include/images/gallery/img_thumb_{id}.{endung}" /></a></td>
<td height="20"><a href="index.php?galleryupl-d{id}" onclick="return del({id});"><img src="include/images/icons/del.gif" border="0" title="löschen" alt="löschen"></a></td></tr>
<tr><td valign="top"><a href="javascript:void(0);" onclick="edit('{besch}',{id});"><img src="include/images/icons/edit.gif" title="ändern" border="0" alt="ändern"></a></td></tr>
</table>
</div>
{EXPLODE}</td></tr>
</table>
</form>
{EXPLODE}
<?xml version="1.0" encoding="iso-8859-2"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Iframe Uploader</title>
{styles}
</head>
<body class="Cmite" style="background-image:url();">
<form action="index.php?galleryupl-iframe" method="post" enctype="multipart/form-data">
<input style="position:absolute; top:0px; left:0px; height:20px;" type="file" name="file" id="gu_file" />
<input type="hidden" name="besch" value="" />
<input type="hidden" name="uploading" value="{uploading}" />
<input type="hidden" name="error" value="{error}" />
</form>
</body>
</html>
ich glaube da sist nicht "Galerie Upload 1.1". Weil da kann ich nur in forhandene Verzeichnisse hin einfügen. Vieleicht weiss ja Jemand Rat.
MfG heinz2
Zuletzt modifiziert von heinz2 am 21.07.2015 - 22:51:49