/*--------------------------------------------+ | PHP-Fusion 6 - Content Management System | |---------------------------------------------| | author: Nick Jones (Digitanium) ?2002-2005 | | web: http://www.php-fusion.co.uk | | email: nick@php-fusion.co.uk | |---------------------------------------------| | Released under the terms and conditions of | | the GNU General Public License (Version 2) | +---------------------------------------------+ | Photo Gallery coded by CrappoMan | | email: simonpatterson@dsl.pipex.com | +--------------------------------------------*/ require_once "../../maincore.php"; require_once BASEDIR."subheader.php"; require_once BASEDIR."side_left.php"; include LOCALE.LOCALESET."admin/main.php"; include LOCALE.LOCALESET."admin/photos.php"; if (file_exists(INFUSIONS."member_photo_upload/locale/".$settings['locale'].".php")) { include INFUSIONS."member_photo_upload/locale/".$settings['locale'].".php"; } else { include INFUSIONS."member_photo_upload/locale/English.php"; } function builduseroptionlist($selected_user_id=1){ global $db_prefix; $user_option_list=""; $levels = array_reverse(array(1=>USER1, USER2, USER3, USER4), true); $modlevel = $levels[$modlevel]; foreach($levels as $level=>$modlevel){ $uresult=dbquery("SELECT * FROM ".$db_prefix."users WHERE user_mod='$level' ORDER BY user_name"); if(dbrows($uresult)>0){ $user_option_list.=""; } } return $user_option_list; } if(!iMEMBER){ opentable($locale['402']); echo $locale['MUP_004']."\n"; closetable(); }elseif(isset($_POST['btn_cancel'])){ fallback(FUSION_SELF."?album_id=".$album_id); }elseif(($action == "deletephotopic") && isset($photo_id)) { if(file_exists(PHOTOS.$photo_id.".jpg")) unlink(PHOTOS.$photo_id.".jpg"); if(file_exists(PHOTOS.$photo_id."t.jpg")) unlink(PHOTOS.$photo_id."t.jpg"); fallback(FUSION_SELF."?action=editphoto&photo_id=".$photo_id); }elseif($action=="deletephoto"){ if(isset($photo_id)){ $data=dbarray(dbquery("SELECT album_id, photo_order FROM ".$db_prefix."photos WHERE photo_id='$photo_id'")); $album_id=$data['album_id']; $photo_order=$data['photo_order']; $result=dbquery("UPDATE ".$db_prefix."photos SET photo_order=(photo_order-1) WHERE photo_order>'$photo_order'"); $result=dbquery("DELETE FROM ".$db_prefix."photos WHERE photo_id='$photo_id'"); if(file_exists(PHOTOS.$photo_id.".jpg")) unlink(PHOTOS.$photo_id.".jpg"); fallback(FUSION_SELF."?album_id=".$album_id); } }elseif(isset($_POST['btn_save_photo'])){ $photo_title=stripinput($photo_title); $result=dbquery("SELECT photo_title FROM ".$db_prefix."photos WHERE photo_title='$photo_title' AND photo_id<>'$photo_id' AND album_id='$album_id'"); if(dbrows($result)!=0){ $error=$locale['422']; }else{ $error=""; if($action=="editphoto"){ if($photo_order<$photo_order2){ $result=dbquery("UPDATE ".$db_prefix."photos SET photo_order=(photo_order+1) WHERE photo_order>='$photo_order' AND photo_order<'$photo_order2'"); }elseif($photo_order>$photo_order2){ $result=dbquery("UPDATE ".$db_prefix."photos SET photo_order=(photo_order-1) WHERE photo_order>'$photo_order2' AND photo_order<='$photo_order'"); } $result=dbquery("UPDATE ".$db_prefix."photos SET album_id='$album_id',photo_title='$photo_title',photo_date='".time()."', user_id='$photo_added_by',photo_order='$photo_order' WHERE photo_id='$photo_id'"); }else{ if($photo_order==""){ $photo_order=dbresult(dbquery("SELECT MAX(photo_order) FROM ".$db_prefix."photos WHERE album_id='$album_id'"),0)+1; }else{ $result=dbquery("UPDATE ".$db_prefix."photos SET photo_order=(photo_order+1) WHERE photo_order>='$photo_order' AND album_id='$album_id'"); } $result=dbquery("INSERT INTO ".$db_prefix."photos VALUES ('','$album_id','$photo_title','".time()."','".$userdata['user_id']."','0','$photo_order')"); } $photo_id=dbresult(dbquery("SELECT photo_id FROM ".$db_prefix."photos WHERE photo_title='$photo_title' AND album_id='$album_id'"),0); if(is_uploaded_file($_FILES['photo_pic_file']['tmp_name'])){ if($_FILES['photo_pic_file']['size']>=$settings['album_max_b']){ $error=sprintf($locale['423'], $settings['album_max_b']); }elseif(!$imageFile=@getImageSize($_FILES['photo_pic_file']['tmp_name'])){ $error=$locale['424']; }elseif($imageFile[2]<>2){ $error=$locale['425']; }elseif($imageFile[0]>2000||$imageFile[1]>2000){ $error=sprintf($locale['426'], $settings['album_max_w'], $settings['album_max_h']); }else{ if(file_exists(PHOTOS.$photo_id.".jpg")) unlink(PHOTOS.$photo_id.".jpg"); if(file_exists(PHOTOS.$photo_id."t.jpg")) unlink(PHOTOS.$photo_id."t.jpg"); move_uploaded_file($_FILES['photo_pic_file']['tmp_name'], PHOTOS.$photo_id.".jpg"); chmod(PHOTOS.$photo_id.".jpg",0644); createThumbnail(PHOTOS.$photo_id.".jpg",PHOTOS.$photo_id."t.jpg",$settings['thumb_image_w'],$settings['thumb_image_h']); } } } if($error<>""){ opentable($locale['420']); echo"
".$locale['421']."
$error