".$locale['410'].""; } elseif ($status == "saveau") { $title = $locale['401']; $message = "".$locale['411'].""; } elseif ($status == "saveae") { $title = $locale['420']; $message = "".$locale['421']."
\n"; if ($error == 1) { $message = $locale['422']; } elseif ($error == 2) { $message = sprintf($locale['425'], parsebytesize($settings['photo_max_b'])); } elseif ($error == 3) { $message = $locale['424']; } elseif ($error == 4) { $message = sprintf($locale['423'], $settings['photo_max_w'], $settings['photo_max_h']); } } elseif ($status == "delt") { $title = $locale['402']; $message = "".$locale['412'].""; } elseif ($status == "dely") { $title = $locale['402']; $message = "".$locale['413'].""; } elseif ($status == "deln") { $title = $locale['402']; $message = "".$locale['414']."
\n".$locale['415']; } opentable($title); echo "
".$message."
\n"; closetable(); tablebreak(); } if (isset($_POST['cancel'])) { redirect(FUSION_SELF.$aidlink); } if ($action == "deletethumb") { $data = dbarray(dbquery("SELECT album_thumb,album_order FROM ".$db_prefix."photo_albums WHERE album_id='$album_id'")); $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_thumb='$album_thumb' WHERE album_id='$album_id'"); @unlink(PHOTOS.$data['album_thumb']); redirect(FUSION_SELF.$aidlink."&status=delt&album_id=$album_id"); } elseif ($action == "delete") { if (dbcount("(album_id)", "photos", "album_id='$album_id'")) { redirect(FUSION_SELF.$aidlink."&status=deln"); } else { $data = dbarray(dbquery("SELECT album_thumb,album_order FROM ".$db_prefix."photo_albums WHERE album_id='$album_id'")); $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_order=(album_order-1) WHERE album_order>'".$data['album_order']."'"); $result = dbquery("DELETE FROM ".$db_prefix."photo_albums WHERE album_id='$album_id'"); if ($data['album_thumb']) @unlink(PHOTOS.$data['album_thumb']); if (!SAFEMODE) rmdir(PHOTOS."album_".$album_id); redirect(FUSION_SELF.$aidlink."&status=dely"); } } elseif ($action == "mup") { if (!isNum($order)) fallback(FUSION_SELF.$aidlink); $data = dbarray(dbquery("SELECT album_id FROM ".$db_prefix."photo_albums WHERE album_order='$order'")); $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_order=album_order+1 WHERE album_id='".$data['album_id']."'"); $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_order=album_order-1 WHERE album_id='$album_id'"); $rowstart = $order > $settings['thumbs_per_page'] ? ((ceil($order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0"; redirect(FUSION_SELF.$aidlink."&rowstart=$rowstart"); } elseif ($action == "mdown") { if (!isNum($order)) fallback(FUSION_SELF.$aidlink); $data = dbarray(dbquery("SELECT album_id FROM ".$db_prefix."photo_albums WHERE album_order='$order'")); $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_order=album_order-1 WHERE album_id='".$data['album_id']."'"); $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_order=album_order+1 WHERE album_id='$album_id'"); $rowstart = $order > $settings['thumbs_per_page'] ? ((ceil($order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0"; redirect(FUSION_SELF.$aidlink."&rowstart=$rowstart"); } elseif (isset($_POST['save_album'])) { $error = ""; $album_title = stripinput($_POST['album_title']); $album_description = stripinput($_POST['album_description']); $album_access = isNum($_POST['album_access']) ? $_POST['album_access'] : "0"; $album_order = isNum($_POST['album_order']) ? $_POST['album_order'] : ""; if (!SAFEMODE && $action != "edit") { $result = dbarray(dbquery("SHOW TABLE STATUS LIKE '".$db_prefix."photo_albums'")); $album_id = $result['Auto_increment']; @mkdir(PHOTOS."album_".$album_id, 0755); @copy(IMAGES."index.php", PHOTOS."album_".$album_id."/index.php"); } if (is_uploaded_file($_FILES['album_pic_file']['tmp_name'])) { $album_types = array(".gif",".jpg",".jpeg",".png"); $album_pic = $_FILES['album_pic_file']; $album_ext = strtolower(strrchr($album_pic['name'],".")); if (!preg_match("/^[-0-9A-Z_\.\[\]\s]+$/i", $album_pic['name'])) { $error = 1; } elseif ($album_pic['size'] > $settings['photo_max_b']){ $error = 2; } elseif (!in_array($album_ext, $album_types)) { $error = 3; } else { @unlink(PHOTOS."temp".$album_ext); move_uploaded_file($album_pic['tmp_name'], PHOTOS."temp".$album_ext); chmod(PHOTOS."temp".$album_ext, 0644); $imagefile = @getimagesize(PHOTOS."temp".$album_ext); if ($imagefile[0] > $settings['photo_max_w'] || $imagefile[1] > $settings['photo_max_h']) { $error = 4; @unlink(PHOTOS."temp".$album_ext); } else { $album_thumb = image_exists(PHOTOS, $album_pic['name']); createthumbnail($imagefile[2], PHOTOS."temp".$album_ext, PHOTOS.$album_thumb, $settings['thumb_w'], $settings['thumb_h']); @unlink(PHOTOS."temp".$album_ext); } } } if (!$error) { if ($action == "edit") { $old_album_order = dbresult(dbquery("SELECT album_order FROM ".$db_prefix."photoalbums WHERE album_id='$album_id'"),0); if ($album_order > $old_album_order) { $result = dbquery("UPDATE ".$db_prefix."photoalbums SET album_order=(album_order-1) WHERE album_order>'$old_album_order' AND album_order<='$album_order'"); } elseif ($album_order < $old_album_order) { $result = dbquery("UPDATE ".$db_prefix."photoalbums SET album_order=(album_order+1) WHERE album_order<'$old_album_order' AND album_order>='$album_order'"); } $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_title='$album_title', album_description='$album_description',".(isset($album_thumb)?" album_thumb='$album_thumb',":"")." album_user='".$userdata['user_id']."', album_access='$album_access', album_order='$album_order' WHERE album_id='$album_id'"); $rowstart = $album_order > $settings['thumbs_per_page'] ? ((ceil($album_order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0"; redirect(FUSION_SELF.$aidlink."&status=saveau&rowstart=$rowstart"); } else { if (!$album_order) $album_order = dbresult(dbquery("SELECT MAX(album_order) FROM ".$db_prefix."photo_albums"), 0) + 1; $result = dbquery("UPDATE ".$db_prefix."photo_albums SET album_order=(album_order+1) WHERE album_order>='$album_order'"); $result = dbquery("INSERT INTO ".$db_prefix."photo_albums (album_title, album_description, album_thumb, album_user, album_access, album_order, album_datestamp) VALUES ('$album_title', '$album_description', '$album_thumb', '".$userdata['user_id']."', '$album_access', '$album_order', '".time()."')"); $rowstart = $album_order > $settings['thumbs_per_page'] ? ((ceil($album_order / $settings['thumbs_per_page'])-1)*$settings['thumbs_per_page']) : "0"; redirect(FUSION_SELF.$aidlink."&status=savean&rowstart=$rowstart"); } } else { redirect(FUSION_SELF.$aidlink."&status=saveae&error=$error"); } } else { if ($action == "edit"){ $result = dbquery("SELECT * FROM ".$db_prefix."photo_albums WHERE album_id='$album_id'"); $data = dbarray($result); $album_title = $data['album_title']; $album_description = $data['album_description']; $album_thumb = $data['album_thumb']; $album_access = $data['album_access']; $album_order = $data['album_order']; $formaction = FUSION_SELF.$aidlink."&action=edit&album_id=$album_id"; opentable($locale['401']); } else { $album_id = ""; $album_title = ""; $album_description = ""; $album_thumb = ""; $album_access = ""; $album_order = ""; $formaction = FUSION_SELF.$aidlink; opentable($locale['400']); } $access_opts = ""; $sel = ""; $user_groups = getusergroups(); while(list($key, $user_group) = each($user_groups)){ $sel = ($album_access == $user_group['0'] ? " selected" : ""); $access_opts .= "\n"; } echo "
\n\n\n
".$locale['440']."
".$locale['441']."
".$locale['442']."
".$locale['444']; if ($action && $album_thumb && file_exists(PHOTOS.$album_thumb)) { echo "

\n".$locale['470']."
album_thumb"; } else { echo ""; } echo "

\n"; if ($action) { echo "\n"; } echo "
\n
\n"; closetable(); } tablebreak(); opentable($locale['460']); $rows = dbcount("(album_id)", "photo_albums"); if ($rows) { $result = dbquery( "SELECT ta.*, tu.user_id,user_name FROM ".$db_prefix."photo_albums ta LEFT JOIN ".$db_prefix."users tu ON ta.album_user=tu.user_id ORDER BY album_order LIMIT $rowstart,".$settings['thumbs_per_page'] ); $counter = 0; $k = ($rowstart == 0 ? 1 : $rowstart + 1); echo "\n\n"; while ($data = dbarray($result)) { $up = ""; $down = ""; if ($rows != 1){ $orderu = $data['album_order'] - 1; $orderd = $data['album_order'] + 1; if ($k == 1){ $down = " ·\n".$locale[\n"; }elseif ($k < $rows){ $up = "".$locale[ ·\n"; $down = " ·\n".$locale[\n"; } else { $up = "".$locale[ ·\n"; } } if ($counter != 0 && ($counter % $settings['thumbs_per_row'] == 0)) echo "\n\n"; echo "\n"; $counter++; $k++; } echo "\n\n\n\n
\n"; echo "".$data['album_title']."

\n"; if ($data['album_thumb'] && file_exists(PHOTOS.$data['album_thumb'])){ echo "".$locale["; } else { echo $locale['462']; } echo "

\n".$up; echo "".$locale['469']." ·\n"; echo "".$locale['470']." ".$down; echo "

\n".$locale['463'].showdate("shortdate", $data['album_datestamp'])."
\n"; echo $locale['464']."".$data['user_name']."
\n"; echo $locale['465'].getgroupname($data['album_access'])."
\n"; echo $locale['466'].dbcount("(photo_id)", "photos", "album_id='".$data['album_id']."'")."

\n"; echo "
".$locale['480']."
\n"; if ($rows > $settings['thumbs_per_page']) echo "
\n".makePageNav($rowstart,$settings['thumbs_per_page'],$rows,3,FUSION_SELF.$aidlink."&")."\n
\n"; }else{ echo "
".$locale['481']."
\n"; } closetable(); echo "\n"; require_once BASEDIR."footer.php"; ?>