Project

General

Profile

« Previous | Next » 

Revision 1457

Added by Dietmar almost 13 years ago

Preparing 2.8.2 stable, last tests

View differences:

save_group.php
29 29
	$group_id = $_POST['group_id'];
30 30
}
31 31

  
32
$admin_header = false;
33
// Tells script to update when this page was last updated
34
$update_when_modified = true;
32 35
// Include WB admin wrapper script
33
$update_when_modified = true; // Tells script to update when this page was last updated
34 36
require(WB_PATH.'/modules/admin.php');
35 37

  
36 38
if (!$admin->checkFTAN())
37 39
{
38
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
39
	exit();
40
	$admin->print_header();
41
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
40 42
}
43
$admin->print_header();
41 44

  
42 45
// Include WB functions file
43 46
require(WB_PATH.'/framework/functions.php');
44 47

  
45
// Vagroup_idate all fields
48
// Validate all fields
46 49
if($admin->get_post('title') == '')
47 50
{
48 51
	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_group.php?page_id='.$page_id.'&section_id='.$section_id.'&group_id='.$admin->getIDKEY($group_id));
......
57 60
$database->query("UPDATE ".TABLE_PREFIX."mod_news_groups SET title = '$title', active = '$active' WHERE group_id = '$group_id'");
58 61

  
59 62
// Check if the user uploaded an image or wants to delete one
60
if(isset($_FILES['image']['tmp_name']) AND $_FILES['image']['tmp_name'] != '')
61
{
63
if(isset($_FILES['image']['tmp_name']) AND $_FILES['image']['tmp_name'] != '') {
62 64
	// Get real filename and set new filename
63 65
	$filename = $_FILES['image']['name'];
66
	$file_image_type = $_FILES['image']['type'];
64 67
	$new_filename = WB_PATH.MEDIA_DIRECTORY.'/.news/image'.$group_id.'.jpg';
65 68
	// Make sure the image is a jpg file
66 69
	$file4=substr($filename, -4, 4);
70

  
71
	switch ($file_image_type) :
72
		case 'image/jpeg' :
73
		case 'image/pjpeg' :
74
		case 'image/png' :
75
		case 'image/x-png' :
76
		break;
77
		default:
78
			$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG',ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
79
		break;
80
	endswitch;
81

  
82
/*
67 83
	if(($file4 != '.jpg')and($file4 != '.JPG')and($file4 != '.png')and($file4 != '.PNG') and ($file4 !='jpeg') and ($file4 != 'JPEG'))
68 84
    {
69
		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG a');
85
		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG',ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
70 86
	} elseif(
71 87
	(($_FILES['image']['type']) != 'image/jpeg' AND mime_content_type($_FILES['image']['tmp_name']) != 'image/jpg')
72 88
	and
73 89
	(($_FILES['image']['type']) != 'image/png' AND mime_content_type($_FILES['image']['tmp_name']) != 'image/png')
74 90
	){
75
		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG b');
91
		$admin->print_error($MESSAGE['GENERIC']['FILE_TYPE'].' JPG (JPEG) or PNG',ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
76 92
	}
93
*/
94

  
77 95
	// Make sure the target directory exists
78 96
	make_dir(WB_PATH.MEDIA_DIRECTORY.'/.news');
79 97
	// Upload image
......
112 130

  
113 131
// Print admin footer
114 132
$admin->print_footer();
115

  
116
?>
117 133

  

Also available in: Unified diff