$image = thumbnail($submissions_dir . $callback_data['photo_filename'], $gll_settings['thumb_w']); echo form_hidden("photo_filename", "", $callback_data['photo_filename']); } if ($callback_data['photo_thumb2'] && file_exists($submissions_dir_t . $callback_data['photo_thumb2'])) { $image = thumbnail($submissions_dir_t . $callback_data['photo_thumb2'], $gll_settings['thumb_w']); echo form_hidden("photo_thumb2", "", $callback_data['photo_thumb2']); } if ($callback_data['photo_thumb1'] && file_exists($submissions_dir_t . $callback_data['photo_thumb1'])) { $image = thumbnail($submissions_dir_t . $callback_data['photo_thumb1'], $gll_settings['thumb_w']); echo form_hidden("photo_thumb1", "", $callback_data['photo_thumb1']); } echo $image; echo "</div>\n"; } openside(""); echo form_select('album_id', $locale['photo_0003'], $callback_data['album_id'], array('options' => get_albumOpts(), 'inline' => TRUE)); echo form_button('publish', $locale['gallery_0158'], $locale['gallery_0158'], array('class' => 'btn-primary m-r-10')); closeside(); echo "</div></div>\n"; echo form_button('publish', $locale['gallery_0158'], $locale['gallery_0158'], array('class' => 'btn-primary m-r-10')); echo form_button('delete', $locale['gallery_0159'], $locale['gallery_0159'], array('class' => 'btn-warning m-r-10')); echo closeform(); } } } } else { $result = dbquery("SELECT\n\t\t\tts.submit_id, ts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_type='p' order by submit_datestamp desc\n\t\t\t"); $rows = dbrows($result); if ($rows > 0) { echo "<div class='well'>" . sprintf($locale['gallery_0151'], format_word($rows, $locale['fmt_submission'])) . "</div>\n"; echo "<table class='table table-striped'>\n";
} break; default: redirect(FUSION_SELF . $aidlink); } } } // delete album if (isset($_GET['action']) && $_GET['action'] == "delete" && isset($_GET['cat_id']) && isnum($_GET['cat_id'])) { $result = dbquery("select * from " . DB_PHOTO_ALBUMS . " where album_id='" . intval($_GET['cat_id']) . "'"); if (dbrows($result) > 0) { // album verified $albumData = dbarray($result); // photo existed if (dbcount("('photo_id')", DB_PHOTOS, "album_id = '" . intval($_GET['cat_id']) . "'")) { $list = get_albumOpts(); $albumArray[0] = $locale['album_0028']; foreach ($list as $album_id => $album_title) { $albumArray[$album_id] = sprintf($locale['album_0029'], $album_title); } // unset own album unset($albumArray[$_GET['cat_id']]); if (isset($_POST['confirm_delete'])) { $targetAlbum = form_sanitizer($_POST['target_album'], '0', 'target_album'); // Purge or move photos $photosResult = dbquery("SELECT * FROM " . DB_PHOTOS . " WHERE album_id = '" . intval($_GET['cat_id']) . "'"); if (dbrows($photosResult) > 0) { if ($targetAlbum > 0) { // move picture to $move_album $target_max_order = dbresult(dbquery("SELECT MAX(photo_order) FROM " . DB_PHOTOS . " WHERE album_id='" . intval($targetAlbum) . "'"), 0) + 1; while ($photo_data = dbarray($result)) {
function mass_photo_form() { global $locale, $aidlink, $gll_settings, $userdata; $albumRows = dbcount("(album_id)", DB_PHOTO_ALBUMS, multilang_table("PG") ? "album_language='" . LANGUAGE . "'" : ""); if ($albumRows) { if (isset($_POST['upload_photo'])) { $data['album_id'] = form_sanitizer($_POST['album_id'], 0, "album_id"); if (defender::safe()) { $upload = form_sanitizer($_FILES['photo_mass_image'], "", "photo_mass_image"); $success_upload = 0; $failed_upload = 0; if (!empty($upload)) { $total_files_uploaded = count($upload); for ($i = 0; $i < $total_files_uploaded; $i++) { $current_upload = $upload[$i]; if ($current_upload['error'] == 0) { $current_photos = array("album_id" => $data['album_id'], "photo_title" => $current_upload['image_name'], "photo_filename" => $current_upload['image_name'], "photo_thumb1" => $current_upload['thumb1_name'], "photo_thumb2" => $current_upload['thumb2_name'], "photo_datestamp" => time(), "photo_user" => $userdata['user_id'], "photo_order" => dbresult(dbquery("SELECT MAX(photo_order) FROM " . DB_PHOTOS . " where album_id='" . $data['album_id'] . "'"), 0) + 1); dbquery("\n\t\t\t\t\t\t\tinsert into " . DB_PHOTOS . "\n\t\t\t\t\t\t\t(" . implode(", ", array_keys($current_photos)) . ") values ('" . implode("','", array_values($current_photos)) . "')\n\t\t\t\t\t\t\t"); $success_upload++; } else { $failed_upload++; } } addNotice("success", sprintf($locale['photo_0021'], $success_upload)); if ($failed_upload) { addNotice("warning", sprintf($locale['photo_0021a'], $failed_upload)); } redirect(FUSION_SELF . $aidlink . "&album_id='" . $data['album_id']); } } } $upload_settings = array("upload_path" => IMAGES_G, "required" => TRUE, 'thumbnail_folder' => 'thumbs', 'thumbnail' => TRUE, 'thumbnail_w' => $gll_settings['thumb_w'], 'thumbnail_h' => $gll_settings['thumb_h'], 'thumbnail_suffix' => '_t1', 'thumbnail2' => TRUE, 'thumbnail2_w' => $gll_settings['photo_w'], 'thumbnail2_h' => $gll_settings['photo_h'], 'thumbnail2_suffix' => '_t2', 'max_width' => $gll_settings['photo_max_w'], 'max_height' => $gll_settings['photo_max_h'], 'max_byte' => $gll_settings['photo_max_b'], 'delete_original' => FALSE, "template" => "modern", "multiple" => TRUE, "inline" => TRUE, "error_text" => $locale['photo_0014']); echo openform("mass_form", "post", FUSION_REQUEST, array("enctype" => TRUE, "class" => "clearfix")); echo "<div class='well text-center'>\n" . $locale['photo_0019'] . "</div>\n"; echo form_select('album_id', $locale['photo_0003'], "", array("input_id" => "album", "options" => get_albumOpts(), "inline" => TRUE)); echo form_fileinput('photo_mass_image[]', $locale['photo_0004'], "", $upload_settings); echo "<div class='m-b-10 col-xs-12 col-sm-offset-3'>" . sprintf($locale['photo_0017'], parsebytesize($gll_settings['photo_max_b']), str_replace(',', ' ', ".jpg,.gif,.png"), $gll_settings['photo_max_w'], $gll_settings['photo_max_h']) . "</div>\n"; echo form_button("upload_photo", $locale['photo_0020'], $locale['photo_0020'], array("class" => "btn-primary")); echo closeform(); } else { echo "<div class='well m-t-20 text-center'>\n"; echo sprintf($locale['gallery_0012'], FUSION_SELF . $aidlink . "&section=album_form"); echo "</div>\n"; } }