Changeset 27158


Ignore:
Timestamp:
02/04/14 12:02:38 (5 years ago)
Author:
mistic100
Message:

remove PHP < 5.2 code

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r27043 r27158  
    20192019function url_check_format($url) 
    20202020{ 
    2021   if (version_compare(PHP_VERSION, '5.2.0') >= 0) 
    2022   { 
    2023     return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false; 
    2024   } 
    2025   else 
    2026   { 
    2027     // http://mathiasbynens.be/demo/url-regex @imme_emosol 
    2028     return (bool)preg_match('@^https?://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', $url); 
    2029   } 
     2021  return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false; 
    20302022} 
    20312023 
     
    20382030function email_check_format($mail_address) 
    20392031{ 
    2040   if (version_compare(PHP_VERSION, '5.2.0') >= 0) 
    2041   { 
    2042     return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; 
    2043   } 
    2044   else 
    2045   { 
    2046     $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase 
    2047     $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 
    2048     $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 
    2049  
    2050     return (bool)preg_match($regex, $mail_address); 
    2051   } 
     2032  return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; 
    20522033} 
    20532034 
  • trunk/include/functions_user.inc.php

    r26461 r27158  
    940940    { 
    941941      $cookie = $user_id.'-'.$now.'-'.$key; 
    942       if (version_compare(PHP_VERSION, '5.2', '>=') ) 
    943       { 
    944         setcookie($conf['remember_me_name'], 
    945             $cookie, 
    946             time()+$conf['remember_me_length'], 
    947             cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure'), 
    948             ini_get('session.cookie_httponly') 
    949           ); 
    950       } 
    951       else 
    952       { 
    953         setcookie($conf['remember_me_name'], 
    954             $cookie, 
    955             time()+$conf['remember_me_length'], 
    956             cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure') 
    957           ); 
    958       } 
     942      setcookie($conf['remember_me_name'], 
     943        $cookie, 
     944        time()+$conf['remember_me_length'], 
     945        cookie_path(),ini_get('session.cookie_domain'),ini_get('session.cookie_secure'), 
     946        ini_get('session.cookie_httponly') 
     947        ); 
    959948    } 
    960949  } 
Note: See TracChangeset for help on using the changeset viewer.