diff options
author | mistic100 <mistic@piwigo.org> | 2014-02-04 11:02:38 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-02-04 11:02:38 +0000 |
commit | 922de9a63d4d503b275813cce6b9d3682d1b2a25 (patch) | |
tree | de98199db67020ff8b725703582789de2e84242a /include | |
parent | f286327ad680a5321d7fa77314f0b44f4823eb31 (diff) |
remove PHP < 5.2 code
git-svn-id: http://piwigo.org/svn/trunk@27158 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/functions.inc.php | 23 | ||||
-rw-r--r-- | include/functions_user.inc.php | 23 |
2 files changed, 8 insertions, 38 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index a08bd94b4..acb68ac58 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -2018,15 +2018,7 @@ function mobile_theme() */ function url_check_format($url) { - if (version_compare(PHP_VERSION, '5.2.0') >= 0) - { - return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false; - } - else - { - // http://mathiasbynens.be/demo/url-regex @imme_emosol - return (bool)preg_match('@^https?://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', $url); - } + return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false; } /** @@ -2037,18 +2029,7 @@ function url_check_format($url) */ function email_check_format($mail_address) { - if (version_compare(PHP_VERSION, '5.2.0') >= 0) - { - return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; - } - else - { - $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase - $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name - $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; - - return (bool)preg_match($regex, $mail_address); - } + return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; } /** diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 896c175f0..5bd06c3be 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -939,23 +939,12 @@ function log_user($user_id, $remember_me) if ($key!==false) { $cookie = $user_id.'-'.$now.'-'.$key; - if (version_compare(PHP_VERSION, '5.2', '>=') ) - { - setcookie($conf['remember_me_name'], - $cookie, - time()+$conf['remember_me_length'], - cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure'), - ini_get('session.cookie_httponly') - ); - } - else - { - setcookie($conf['remember_me_name'], - $cookie, - time()+$conf['remember_me_length'], - cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure') - ); - } + setcookie($conf['remember_me_name'], + $cookie, + time()+$conf['remember_me_length'], + cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure'), + ini_get('session.cookie_httponly') + ); } } else |