Ignore:
Timestamp:
Jan 20, 2014 9:42:13 PM (10 years ago)
Author:
anonymous
Message:

Removed use of requireAccessClearance(). Adjusted sequence of sslOn() and requireLogin(). Added ACL::requireAllow() method. Added arguments to SortOrder::set(). Changed behavior of Validator::validateStrDate(). Added use of Validator::validateStrDate() to module maker templates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Validator.inc.php

    r415 r457  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    2424 * Validator.inc.php
    2525 *
    26  * The Validator class provides a methods for validating input against different criteria. 
     26 * The Validator class provides a methods for validating input against different criteria.
    2727 * All functions return true if the input passes the test.
    2828 *
     
    192192            return VALIDATE_EMAIL_REGEX_FAIL;
    193193        }
    194        
     194
    195195        // We have a match! Here are the captured subpatterns, on which further tests are run.
    196         // The part before the @. 
     196        // The part before the @.
    197197        $local = $e_parts[2];
    198198
    199         // The part after the @. 
     199        // The part after the @.
    200200        // If domain is an IP [XXX.XXX.XXX.XXX] strip off the brackets.
    201201        $domain = $e_parts[3]{0} == '[' ? mb_substr($e_parts[3], 1, -1) : $e_parts[3];
     
    225225    {
    226226        $app =& App::getInstance();
    227        
    228         if ('' == trim($val)) {
     227
     228        if (is_string($val) && '' === trim($val)) {
    229229            // Don't be too bothered about empty strings.
    230230            return true;
     
    232232
    233233        $timestamp = strtotime($val);
    234         // Return values change between php4 and php5.
    235         if ('' != trim($val) && ($timestamp === -1 || $timestamp === false)) {
     234        if (!$timestamp || $timestamp < 1) {
    236235            return false;
    237236        } else {
     
    239238        }
    240239    }
    241 
    242240
    243241    /**
     
    279277                 break;
    280278         }
    281          
     279
    282280         if ('' != $regex && !preg_match($regex, $cc_num)) {
    283281             // Invalid format.
     
    324322            return false;
    325323        }
    326        
     324
    327325        if (is_array($_FILES[$form_name]['name'])) {
    328326            foreach($_FILES[$form_name]['name'] as $f) {
     
    336334            }
    337335        }
    338        
     336
    339337        return true;
    340338    }
Note: See TracChangeset for help on using the changeset viewer.