cvs: smarty /libs/plugins shared.make_timestamp.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1065864831@cvsserver>
messju		Sat Oct 11 05:33:51 2003 EDT

  Modified files:              
    /smarty/libs/plugins	shared.make_timestamp.php 
  Log:
  tightened check for YYYYMMDDHHMMSS-format. thanks konstantin for
  pointing this out.
  
  removed a few tabs.
  
  
  
Index: smarty/libs/plugins/shared.make_timestamp.php
diff -u smarty/libs/plugins/shared.make_timestamp.php:1.4 smarty/libs/plugins/shared.make_timestamp.php:1.5
--- smarty/libs/plugins/shared.make_timestamp.php:1.4	Sun Apr 20 17:12:13 2003
+++ smarty/libs/plugins/shared.make_timestamp.php	Sat Oct 11 05:33:50 2003
@@ -23,7 +23,7 @@
         return $time;
 
     // is mysql timestamp format of YYYYMMDDHHMMSS?
-    if (is_numeric($string) && strlen($string) == 14) {
+    if (preg_match('/^\d{14}$/', $string)) {
         $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),
                substr($string,4,2),substr($string,6,2),substr($string,0,4));
 
@@ -33,9 +33,9 @@
     // couldn't recognize it, try to return a time
     $time = (int) $string;
     if ($time > 0)
-		return $time;
-	else
-		return time();
+        return $time;
+    else
+        return time();
 }
 
 /* vim: set expandtab: */

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.