Project

General

Profile

« Previous | Next » 

Revision 1454

Added by DarkViper almost 13 years ago

in /framework/functions.php::media_filename - replace whitespaces by _
/upgrade-script.php - some small fixes

View differences:

functions.php
682 682
	require_once(WB_PATH.'/framework/functions-utf8.php');
683 683
	$string = entities_to_7bit($string);
684 684
	// Now remove all bad characters
685
	$bad = array(
686
	'\'', // '
687
	'"', // "
688
	'`', // `
689
	'!', // !
690
	'@', // @
691
	'#', // #
692
	'$', // $
693
	'%', // %
694
	'^', // ^
695
	'&', // &
696
	'*', // *
697
	'=', // =
698
	'+', // +
699
	'|', // |
700
	'/', // /
701
	'\\', // \
702
	';', // ;
703
	':', // :
704
	',', // ,
705
	'?' // ?
706
	);
685
	$bad = array('\'','"','`','!','@','#','$','%','^','&','*','=','+','|','/','\\',';',':',',','?');
707 686
	$string = str_replace($bad, '', $string);
708 687
	// replace multiple dots in filename to single dot and (multiple) dots at the end of the filename to nothing
709
	$string = preg_replace(array('/\.+/', '/\.+$/'), array('.', ''), $string);
688
	$string = preg_replace(array('/\.+/', '/\.+$/', '/\s/'), array('.', '', '_'), $string);
710 689
	// Clean any page spacers at the end of string
711 690
	$string = trim($string);
712 691
	// Finally, return the cleaned string

Also available in: Unified diff