group-categorys';
if($_GET['action']=="add") {
echo'
';
}
elseif($_GET['action']=="edit") {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery_groups WHERE groupID='".$_GET['groupID']."'");
$ds=mysql_fetch_array($ergebnis);
echo'';
}
else {
echo'
';
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery_groups ORDER BY sort");
echo'';
}
}
//part: gallerys
elseif($_GET['part'] == "gallerys") {
if($_POST['save']) {
safe_query("INSERT INTO ".PREFIX."gallery ( name, date, groupID ) values( '".$_POST['name']."', '".time()."', '".$_POST['group']."' ) ");
$id = mysql_insert_id();
}
elseif($_POST['saveedit']) {
safe_query("UPDATE ".PREFIX."gallery SET name='".$_POST['name']."', groupID='".$_POST['group']."' WHERE galleryID='".$_POST['galleryID']."'");
}
elseif($_POST['saveftp']) {
$dir = '../images/gallery/';
$comment = $_POST['comment'];
$name = $_POST['name'];
$i=0;
foreach($_POST['pictures'] as $picture) {
$typ = getimagesize($dir.$picture);
switch ($typ[2]) {
case 1: $typ = '.gif'; break;
case 2: $typ = '.jpg'; break;
}
if($name[$i]) $insertname = $name[$i];
else $insertname = $picture;
safe_query("INSERT INTO ".PREFIX."gallery_pictures ( galleryID, name, comment, comments) VALUES ('".$_POST['galleryID']."', '".$insertname."', '".$comment[$i]."', '".$_POST['comments']."' )");
$insertid = mysql_insert_id();
copy($dir.$picture, $dir.'large/'.$insertid.$typ);
$galclass->savethumb($dir.'large/'.$insertid.$typ, $dir.'thumb/'.$insertid.'.jpg');
@unlink($dir.$picture);
$i++;
}
}
elseif($_POST['saveform']) {
$dir = '../images/gallery/';
$picture = $_FILES[picture];
if($picture[name] != "") {
if($_POST['name']) $insertname = $_POST['name'];
else $insertname = $picture[name];
safe_query("INSERT INTO ".PREFIX."gallery_pictures ( galleryID, name, comment, comments) VALUES ('".$_POST['galleryID']."', '".$insertname."', '".$_POST['comment']."', '".$_POST['comments']."' )");
$insertid = mysql_insert_id();
$typ = getimagesize($picture[tmp_name]);
switch ($typ[2]) {
case 1: $typ = '.gif'; break;
case 2: $typ = '.jpg'; break;
}
move_uploaded_file($picture[tmp_name], $dir.'large/'.$insertid.$typ);
$galclass->savethumb($dir.'large/'.$insertid.$typ, $dir.'thumb/'.$insertid.'.jpg');
}
}
elseif($_GET['delete']) {
//SQL
if(safe_query("DELETE FROM ".PREFIX."gallery WHERE galleryID='".$_GET['galleryID']."'")) {
//FILES
$ergebnis=safe_query("SELECT picID FROM ".PREFIX."gallery_pictures WHERE galleryID='".$_GET['galleryID']."'");
while($ds=mysql_fetch_array($ergebnis)) {
@unlink('../images/gallery/'.$_GET['galleryID'].'/thumb/'.$ds[picID].'.jpg'); //thumbnails
$path = '../images/gallery/'.$_GET['galleryID'].'/large/';
if(file_exists($path.$ds[picID].'.jpg')) $path = $path.$ds[picID].'.jpg';
else $path = $path.$ds[picID].'.gif';
@unlink($path); //large
safe_query("DELETE FROM ".PREFIX."comments WHERE parentID='".$ds[picID]."' AND type='ga'");
}
safe_query("DELETE FROM ".PREFIX."gallery_pictures WHERE galleryID='".$_GET['galleryID']."'");
}
}
echo'Gallerys
';
if($_GET['action']=="add") {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery_groups");
$groups = '';
echo'
Upload your images to "http://'.$hp_url.'/images/gallery" via FTP to add files.';
}
elseif($_GET['action']=="edit") {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery_groups");
$groups = '';
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery WHERE galleryID='".$_GET['galleryID']."'");
$ds=mysql_fetch_array($ergebnis);
$groups = str_replace('value="'.$ds[groupID].'"','value="'.$ds[groupID].'" selected',$groups);
echo'';
}
elseif($_GET['action']=="upload") {
$dir = '../images/gallery/';
if($_POST['upload'] == "ftp") {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery_groups WHERE groupID='".$_GET['groupID']."'");
$ds=mysql_fetch_array($ergebnis);
echo'';
} elseif($_POST['upload'] == "form" OR $_GET['upload'] == "form") {
if($_GET['upload'] == "form") $id=$_GET['galleryID'];
echo'';
}
}
else {
echo'
';
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery WHERE userID='0'");
echo'Pagegalleries
';
$ergebnis=safe_query("SELECT * FROM ".PREFIX."gallery WHERE userID!='0'");
echo'Usergalleries
';
}
}
?>