site_name} - Gallery", "../"); $gallery_db = $main_settings->components[$main_settings->components_keys['Personal Gallery']]->db_name; $item = new gallery_item; $item->load($_GET['item_id']); $item->inc_downloads(); header ("Location: {$main_settings->working_directory}$item->file_name"); die(); } // Create if ( (isset($_GET['action'])) && ($_GET['action'] == "create") ) { load_all("gallery",10,true,false, "{$main_settings->site_name} - Gallery", "../"); $gallery_db = $main_settings->components[$main_settings->components_keys['Personal Gallery']]->db_name; $dir_name = getcwd(); $dir_name .= "/gallery/" . $_POST['category']; if (!is_dir($dir_name)) { mkdir($dir_name); } if ( (isset($_GET['exist'])) && ($_GET['exist'] == "true")) { $file_name_base = basename($file_name, ".jpg"); $file_name = stripslashes($file_name); copy($file_name, "gallery/{$category}/{$file_name_base}.jpg"); $small_thumb_base = basename($small_thumb); $small_thumb = stripslashes($small_thumb); copy($small_thumb, "gallery/{$category}/{$small_thumb_base}"); unlink($small_thumb); $small_thumb = "gallery/{$category}/{$small_thumb_base}"; $img_size = getimagesize($file_name); $resx = $img_size[0]; $resy = $img_size[1]; $file_size = filesize($file_name); make_thumb($file_name, 25, $file_name_base . "_medthumb", $dir_name, 300); $med_thumb = $file_name_base . "_medthumb.jpg"; unlink($file_name); $file_name = "gallery/{$category}/{$file_name_base}.jpg"; $med_thumb = "gallery/{$category}/{$med_thumb}"; //File Upload } else { $new_file_name = $_FILES['file_name']['name']; $med_thumb_name = explode(".", $new_file_name); $file_size = $_FILES['file_name']['size']; $file_dir_name = $dir_name . "/" . $new_file_name; move_uploaded_file($_FILES['file_name']['tmp_name'], $file_dir_name) or die("File transfer error [{$_FILES['file_name']['tmp_name']}, $file_dir_name]"); //die("File transfer error [{$_FILES['file_name']['tmp_name']}, $file_dir_name]"); $img_size = getimagesize($file_dir_name); $resx = $img_size[0]; $resy = $img_size[1]; make_thumb($file_dir_name, 25, $med_thumb_name[0] . "_medthumb", $dir_name, 300); $med_thumb = $med_thumb_name[0] . "_medthumb.jpg"; if ( (isset($_POST['auto_thumb'])) && ($_POST['auto_thumb'] == 1) ) { make_thumb($file_dir_name, 25, $med_thumb_name[0] . "_smallthumb", $dir_name, 150); $small_thumb = $med_thumb_name[0] . "_smallthumb.jpg"; $small_thumb = "gallery/{$_POST['category']}/{$small_thumb}"; } else { if ( isset($_FILES['small_thumb']['name']) ) { $new_small_thumb_name = $_FILES['small_thumb']['name']; $small_thumb_dir_name = $dir_name . "/" . $new_small_thumb_name; move_uploaded_file($_FILES['small_thumb']['tmp_name'], $small_thumb_dir_name) or die("File transfer error [{$_FILES['small_thumb']['tmp_name']}, $dir_name]"); $small_thumb = "gallery/{$_POST['category']}/{$new_small_thumb_name}"; } } $file_name = "gallery/{$_POST['category']}/{$new_file_name}"; $med_thumb = "gallery/{$_POST['category']}/{$med_thumb}"; } $date_added = time(); $date_modified = 0; $uid = 2; $owner_id = $main_user->id; $_POST['description'] = filter($_POST['description'], 1); $sql = " INSERT INTO $gallery_db (id, owner_id, title, description, resx, resy, file_size, file_name, med_thumb, small_thumb, file_type, category, project_group, date_added, date_modified, version) VALUES (\"0\", \"$owner_id\", \"{$_POST['title']}\", '{$_POST['description']}', \"$resx\", \"$resy\", \"$file_size\", \"$file_name\", \"$med_thumb\", \"$small_thumb\", \"{$_POST['file_type']}\", \"{$_POST['category']}\", \"{$_POST['project_group']}\", \"$date_added\", \"$date_modified\", \"{$_POST['version']}\") "; $result = database_query($sql); header ("Location: gallery.php?action=manage"); die(); } if ( (isset($_GET['action'])) && ($_GET['action'] == "edit_final") ) { load_all("gallery",10,true,false, "{$main_settings->site_name} - Gallery", "../"); $gallery_db = $main_settings->components[$main_settings->components_keys['Personal Gallery']]->db_name; $date_modified = time(); $sql = "UPDATE $gallery_db SET title = \"{$_POST['title']}\", description = \"{$_POST['description']}\", file_type = \"{$_POST['file_type']}\", category = \"{$_POST['category']}\", project_group = \"{$_POST['project_group']}\", date_modified = \"$date_modified\", version = \"{$_POST['version']}\" WHERE id = {$_GET['item_id']} "; $result = database_query($sql); header ("Location: gallery.php?action=manage"); die(); } load_all("gallery",0,false,true, "{$main_settings->site_name} - Gallery", "../"); $gallery_db = $main_settings->components[$main_settings->components_keys['Personal Gallery']]->db_name; $gallery_component_id = $main_settings->components[$main_settings->components_keys['Personal Gallery']]->id; if ( (isset($_GET['item_id'])) && ($_GET['item_id'] != NULL) ) { $item = new gallery_item; $item->load($_GET['item_id']); } ?> $main_settings->site_name Gallery"; botheader(); topcontent(); if ( (isset($_GET['action'])) && ($_GET['action'] == "details") ){ $item->detail_view(); botcontent(); echo "
"; show_comments_block($gallery_component_id, $item->id, "gallery/gallery.php?action=details&item_id={$item->id}"); } if ( (isset($_GET['action'])) && ($_GET['action'] == "delete") ) { $sql = "DELETE FROM $gallery_db WHERE id = \"{$_GET['item_id']}\""; $result = database_query($sql); echo "Gallery item #{$_GET['item_id']} deleted
"; } if ( (isset($_GET['action'])) && ($_GET['action'] == "manage") ) { echo "Add new gallery item
\n"; echo "Add new gallery item from existing file\n"; echo "

\n"; echo "Stats(Hide\n"; echo "| Show)\n"; echo "
\n"; gallery_stats(); echo "
\n"; } if ( (isset($_GET['action'])) && ($_GET['action'] == "stats") ) { gallery_stats(); } if ( (isset($_GET['action'])) && ($_GET['action'] == "new") ) { show_item_create(); } if ( (isset($_GET['action'])) && ($_GET['action'] == "new_exist") ) { show_item_create_exist(); } if ( (isset($_GET['action'])) && ($_GET['action'] == "edit") ) { $item->show_item_edit(); } if ( (isset($_GET['action'])) && ($_GET['action'] == "view_all") ) { echo "

"; echo "Entire Gallery"; echo "

"; echo "

"; show_all_gallery(); echo "

"; } if ( (isset($_GET['action'])) && ($_GET['action'] == "category") ) { echo "

"; echo "{$_GET['which']}"; echo "

"; echo "

"; show_all_category($_GET['which']); echo "

"; } if ( (isset($_GET['action'])) && ($_GET['action'] == "group") ) { echo "

"; echo "Project Group: $which"; echo "

"; echo "

"; show_all_group($which); echo "

"; } if ( !(isset($_GET['action'])) ) { echo "

"; echo "Recent Additions"; echo "

"; echo "

"; show_recent_gallery(6); echo "
"; echo "
"; echo "[View all]"; echo "
"; echo "
"; echo "

"; echo "

"; show_categories(3); } if ( !((isset($_GET['action'])) && ($_GET['action'] == "details")) ){ botcontent(); } include("botpage.inc"); ?>