diff options
author | Eric <eric@piwigo.org> | 2009-08-17 16:21:09 +0000 |
---|---|---|
committer | Eric <eric@piwigo.org> | 2009-08-17 16:21:09 +0000 |
commit | bac7567b5c5a994642cede7fd0c4298e0b2d2389 (patch) | |
tree | 970329898f5be8a89cb265222e15b6c0d5deef8c | |
parent | 3aeef9ac266d304115b62442ace9fa8513646b97 (diff) |
PHP 5.3 compatibility - Deprecated functions were replace as follows :
ereg() -> preg_match()
ereg_replace() -> preg_replace()
eregi() -> preg_match() with the 'i' modifier
eregi_replace() -> preg_replace() with the 'i' modifier
set_magic_quotes_runtime() -> No more usefull. Fixed it by adding "@" prefix.
git-svn-id: http://piwigo.org/svn/trunk@3747 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/thumbnail.php | 4 | ||||
-rw-r--r-- | include/common.inc.php | 2 | ||||
-rw-r--r-- | include/functions_user.inc.php | 4 | ||||
-rw-r--r-- | install.php | 2 | ||||
-rw-r--r-- | tools/create_listing_file.php | 4 | ||||
-rw-r--r-- | upload.php | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/admin/thumbnail.php b/admin/thumbnail.php index 46e42c33e..635110303 100644 --- a/admin/thumbnail.php +++ b/admin/thumbnail.php @@ -231,11 +231,11 @@ if (isset($_POST['submit'])) $infos = array(); // checking criteria - if (!ereg('^[0-9]{2,3}$', $_POST['width']) or $_POST['width'] < 10) + if (!preg_match('/^[0-9]{2,3}$/', $_POST['width']) or $_POST['width'] < 10) { array_push($page['errors'], l10n('tn_err_width').' 10'); } - if (!ereg('^[0-9]{2,3}$', $_POST['height']) or $_POST['height'] < 10) + if (!preg_match('/^[0-9]{2,3}$/', $_POST['height']) or $_POST['height'] < 10) { array_push($page['errors'], l10n('tn_err_height').' 10'); } diff --git a/include/common.inc.php b/include/common.inc.php index 448d28ae1..925855a19 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -28,7 +28,7 @@ $t1 = explode( ' ', microtime() ); $t2 = explode( '.', $t1[0] ); $t2 = $t1[1].'.'.$t2[1]; -set_magic_quotes_runtime(0); // Disable magic_quotes_runtime +@set_magic_quotes_runtime(0); // Disable magic_quotes_runtime // // addslashes to vars if magic_quotes_gpc is off this is a security diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 3ead0e820..98a417ecb 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -75,11 +75,11 @@ function register_user($login, $password, $mail_address, { array_push($errors, l10n('reg_err_login1')); } - if (ereg("^.* $", $login)) + if (preg_match('/^.* $/', $login)) { array_push($errors, l10n('reg_err_login2')); } - if (ereg("^ .*$", $login)) + if (preg_match('/^ .*$/', $login)) { array_push($errors, l10n('reg_err_login3')); } diff --git a/install.php b/install.php index daf521913..95ed6347e 100644 --- a/install.php +++ b/install.php @@ -72,7 +72,7 @@ function execute_sqlfile($filepath, $replaced, $replacing) } } -set_magic_quotes_runtime(0); // Disable magic_quotes_runtime +@set_magic_quotes_runtime(0); // Disable magic_quotes_runtime // // addslashes to vars if magic_quotes_gpc is off this is a security // precaution to prevent someone trying to break out of a SQL statement. diff --git a/tools/create_listing_file.php b/tools/create_listing_file.php index 88c5975a5..7e57ef752 100644 --- a/tools/create_listing_file.php +++ b/tools/create_listing_file.php @@ -203,7 +203,7 @@ function pwg_check_graphics() $info = gd_info(); // Backup GD major version - $pwg_conf['gd_version_full'] = ereg_replace('[[:alpha:][:space:]()]+', '', $info['GD Version']); + $pwg_conf['gd_version_full'] = preg_replace('/[[:alpha:][:space:]()]+/', '', $info['GD Version']); list($pwg_conf['gd_version_major']) = preg_split('/[.]+/', $pwg_conf['gd_version_full']); // Backup input/output format support @@ -1087,7 +1087,7 @@ function pwg_test_exit() else { $info = gd_info(); - $gd_full_version = ereg_replace('[[:alpha:][:space:]()]+', '', $info['GD Version']); + $gd_full_version = preg_replace('/[[:alpha:][:space:]()]+/', '', $info['GD Version']); list($gd_version) = preg_split('/[.]+/', $gd_full_version); $g_message .= ' <h3>Image generation</h3>'."\n"; diff --git a/upload.php b/upload.php index 3cbd1f8cd..d1cffa25d 100644 --- a/upload.php +++ b/upload.php @@ -57,7 +57,7 @@ function validate_upload( $temp_name, $my_max_file_size, $result = array(); $result['error'] = array(); - //echo $_FILES['picture']['name']."<br>".$temp_name; + //echo $_FILES['picture']['name']."<br />".$temp_name; $extension = get_extension( $_FILES['picture']['name'] ); if (!in_array($extension, $conf['picture_ext'])) { @@ -188,7 +188,7 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) ) { array_push( $error, l10n('upload_filenotfound') ); } - if ( !ereg( "([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)", + if ( !preg_match( '/([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)/', $_POST['mail_address'] ) ) { array_push( $error, l10n('reg_err_mail_address') ); |