3 or ($member_db[1] != 1 and $action == "doimagedelete")){ msg("error", "Access Denied", "You don't have permission to manage images"); }
$allowed_extensions = array("gif", "jpg", "png", "bmp", "jpe", "jpeg");
// ********************************************************************************
// Show Images List
// ********************************************************************************
if($action != "doimagedelete")
{
if($action == "quick")
{
echo"
Insert Image
";
}else{ echoheader("images","Manage Images"); }
if($subaction == "upload")
{
if(!$image){ $image = $HTTP_POST_FILES['image']['tmp_name']; }
if(!$image_name){ $image_name = $HTTP_POST_FILES['image']['name']; }
$image_name = str_replace(" ", "_", $image_name);
$img_name_arr = explode(".",$image_name);
$type = end($img_name_arr);
if($image_name == ""){ $img_result = "
No File Specified For Upload !!!"; }
elseif( !isset($overwrite) and file_exists($config_path_image_upload."/".$image_name)){ $img_result = "
Image already exist !!!";}
elseif( !(in_array($type, $allowed_extensions) or in_array(strtolower($type), $allowed_extensions)) ){
$img_result = "
This type of file is not allowed !!!";
}
else
{
@copy($image, $config_path_image_upload."/".$image_name) or $img_result = "Couldn't copy image to server
Check if file_uploads is allowed in the php.ini file of your server";
if(file_exists($config_path_image_upload."/".$image_name))
{
$img_result = "
Image was uploaded";
if($action == "quick"){
$img_result .= " [insert it]";
}
}//if file is uploaded succesfully
}
}
echo"';
if($action != "quick"){ echofooter(); }
}
// ********************************************************************************
// Delete Image
// ********************************************************************************
elseif($action == "doimagedelete")
{
if(!isset($images)){ msg("info","No Images selected","You must select images to be deleted.", "$PHP_SELF?mod=images"); }
// if(!file_exists($config_path_image_upload."/".$image) or !$image){ msg("error","Error !!!","Could not delete image", "$PHP_SELF?mod=images"); }
foreach($images as $image){
unlink($config_path_image_upload."/".$image) or print("Could not delete image $file");
}
msg("info","Image(s) Deleted","The image was successfully deleted.", "$PHP_SELF?mod=images");
}
?>