<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// Delete Existing Photo
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_photo.gif" width="28" height="22"> '.$MsgText[3][62];
	$BrowserTitle = $MsgText[3][62];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/photos.html">'.$MsgText[3][2].'</a> > '.$MsgText[3][62];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		$Arguments3 = intval($Arguments3);
		
		
		$query55 = "select * from `".$Settings['DBPrefix']."pg-Images` where RecordNumber='".$Arguments3."' limit 1";
		$result55 = mysql_query($query55) or die (mysql_error());
		$row55 = mysql_fetch_array($result55);
		
		$query55 = "select MinLevel,MinEditLevel from `".$Settings['DBPrefix']."pg-Galleries` where RecordNumber='".$row55['GalleryNumber']."' limit 1";
		$result55 = mysql_query($query55) or die (mysql_error());
		$row55 = mysql_fetch_array($result55);
		
		
		if ($Permissions[301] == 'y' && $row55['MinLevel'] <= $UserLevel && $row55['MinEditLevel'] <= $UserLevel) {
		
		
			$query = "select * from `".$Settings['DBPrefix']."pg-Settings`";
			$result = mysql_query($query) or die (mysql_error());
			while ($row = mysql_fetch_array($result)) {
				$pgSettings[$row['Name']] = $row['Value'];
			}
			
			if ($pgSettings['StorageLocationHTTP'] == '') {
				$pgSettings['StorageLocationHTTP'] = $BaseURL.'/pg_images';
			}
			if ($pgSettings['StorageLocationLocal'] == '') {
				$pgSettings['StorageLocationLocal'] = './pg_images';
			}
			
			
			
			if (substr($pgSettings['StorageLocationHTTP'],0,1) == '/') {
				$ImageBaseHTTP = $BaseURL.$pgSettings['StorageLocationHTTP'];
			}
			else {
				$ImageBaseHTTP = $pgSettings['StorageLocationHTTP'];
			}
		
		
	
			$PageContents = '<br>';
			
												
			$query55 = "select * from `".$Settings['DBPrefix']."pg-Images` where RecordNumber='".$Arguments3."' limit 1";
			$result55 = mysql_query($query55) or die (mysql_error());
			
			if (mysql_num_rows($result55) > 0) {
				
				
				$Extensions[1] = '.gif';
				$Extensions[2] = '.jpg';
				$Extensions[3] = '.png';
			
				$ThumbExtensions[1] = '-thumb.gif';
				$ThumbExtensions[2] = '-thumb.jpg';
				$ThumbExtensions[3] = '-thumb.png';
				
					
				$row55 = mysql_fetch_array($result55);
				
				
				if ($row55['ImageTitle'] == '') {
					$row55['ImageTitle'] = '(No Title)';
				}
				
				
				$PageContents .= '<b>'.$MsgText[3][49].' "'.$row55['ImageTitle'].'" ?</b><br><a href="'.$MainURL.'/photos/image/'.$row55['RecordNumber'].'.html" target="_blank"><img src="'.$ImageBaseHTTP.'/'.$row55['FileName'].$ThumbExtensions[$row55['FileType']].'" alt="'.$row55['ImageTitle'].'" border="0"></a><br><br><br><br><form action="'.$MainURL.'/admin/photos_delete_confirm" method="post">
<input type="hidden" name="RecordNumber" value="'.$row55['RecordNumber'].'">
<input type="submit" value="'.$MsgText[0][237].'" style="'.$FormStyle.'"><br><br><br><input type="button" value="'.$MsgText[0][238].'" onClick="window.location.href=\''.$MainURL.'/admin/photos.html\'" style="'.$FormStyle.'"></form>';
				
		
			}
			else {
				$PageContents .= '<br>['.$MsgText[3][63].']<br>';
			}
	
				
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

	// ========================================================================================




?>
