More name cleanups
git-svn-id: http://svn.automattic.com/wordpress/trunk@1864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
10d0af0fb2
commit
88efcfd20d
|
@ -77,24 +77,19 @@ case '':
|
||||||
break;
|
break;
|
||||||
case 'upload':
|
case 'upload':
|
||||||
|
|
||||||
//Makes sure they choose a file
|
|
||||||
|
|
||||||
//print_r($_FILES);
|
|
||||||
//die();
|
|
||||||
|
|
||||||
|
|
||||||
$imgalt = basename( (isset($_POST['imgalt'])) ? $_POST['imgalt'] : '' );
|
$imgalt = basename( (isset($_POST['imgalt'])) ? $_POST['imgalt'] : '' );
|
||||||
|
|
||||||
$img1_name = (strlen($imgalt)) ? $imgalt : basename( $_FILES['img1']['name'] );
|
$img1_name = (strlen($imgalt)) ? $imgalt : basename( $_FILES['img1']['name'] );
|
||||||
|
$img1_name = preg_replace('/[^a-z0-9.]/i', '', $img1_name);
|
||||||
|
|
||||||
$img1_type = (strlen($imgalt)) ? $_POST['img1_type'] : $_FILES['img1']['type'];
|
$img1_type = (strlen($imgalt)) ? $_POST['img1_type'] : $_FILES['img1']['type'];
|
||||||
$imgdesc = htmlentities2($imgdesc);
|
$imgdesc = htmlentities2($imgdesc);
|
||||||
|
|
||||||
$pi = pathinfo($img1_name);
|
$pi = pathinfo($img1_name);
|
||||||
$imgtype = strtolower($pi['extension']);
|
$imgtype = strtolower($pi['extension']);
|
||||||
|
|
||||||
if (in_array($imgtype, $allowed_types) == false) {
|
if (in_array($imgtype, $allowed_types) == false)
|
||||||
die(sprintf(__('File %1$s of type %2$s is not allowed.') , $img1_name, $imgtype));
|
die(sprintf(__('File %1$s of type %2$s is not allowed.') , $img1_name, $imgtype));
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($imgalt)) {
|
if (strlen($imgalt)) {
|
||||||
$pathtofile = get_settings('fileupload_realpath')."/".$imgalt;
|
$pathtofile = get_settings('fileupload_realpath')."/".$imgalt;
|
||||||
|
|
Loading…
Reference in New Issue