Changeset 457 for trunk/lib/Validator.inc.php
- Timestamp:
- Jan 20, 2014 9:42:13 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Validator.inc.php
r415 r457 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 24 24 * Validator.inc.php 25 25 * 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. 27 27 * All functions return true if the input passes the test. 28 28 * … … 192 192 return VALIDATE_EMAIL_REGEX_FAIL; 193 193 } 194 194 195 195 // 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 @. 197 197 $local = $e_parts[2]; 198 198 199 // The part after the @. 199 // The part after the @. 200 200 // If domain is an IP [XXX.XXX.XXX.XXX] strip off the brackets. 201 201 $domain = $e_parts[3]{0} == '[' ? mb_substr($e_parts[3], 1, -1) : $e_parts[3]; … … 225 225 { 226 226 $app =& App::getInstance(); 227 228 if ( ''== trim($val)) {227 228 if (is_string($val) && '' === trim($val)) { 229 229 // Don't be too bothered about empty strings. 230 230 return true; … … 232 232 233 233 $timestamp = strtotime($val); 234 // Return values change between php4 and php5. 235 if ('' != trim($val) && ($timestamp === -1 || $timestamp === false)) { 234 if (!$timestamp || $timestamp < 1) { 236 235 return false; 237 236 } else { … … 239 238 } 240 239 } 241 242 240 243 241 /** … … 279 277 break; 280 278 } 281 279 282 280 if ('' != $regex && !preg_match($regex, $cc_num)) { 283 281 // Invalid format. … … 324 322 return false; 325 323 } 326 324 327 325 if (is_array($_FILES[$form_name]['name'])) { 328 326 foreach($_FILES[$form_name]['name'] as $f) { … … 336 334 } 337 335 } 338 336 339 337 return true; 340 338 }
Note: See TracChangeset
for help on using the changeset viewer.