cvs: smarty /libs/plugins function.html_select_date.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1071046221@cvsserver>
messju		Wed Dec 10 03:50:21 2003 EDT

  Modified files:              
    /smarty/libs/plugins	function.html_select_date.php 
  Log:
  fixed indetiation
  
  
Index: smarty/libs/plugins/function.html_select_date.php
diff -u smarty/libs/plugins/function.html_select_date.php:1.16 smarty/libs/plugins/function.html_select_date.php:1.17
--- smarty/libs/plugins/function.html_select_date.php:1.16	Sun Apr 20 17:12:00 2003
+++ smarty/libs/plugins/function.html_select_date.php	Wed Dec 10 03:50:21 2003
@@ -18,7 +18,7 @@
  *                and end year values. (Monte)
  *           - 1.2 added support for yyyy-mm-dd syntax for
  *                time value. (Jan Rosier)
- *           - 1.3 added support for choosing format for 
+ *           - 1.3 added support for choosing format for
  *                month values (Gary Loescher)
  *           - 1.3.1 added support for choosing format for
  *                day values (Marcus Bointon)
@@ -71,37 +71,37 @@
     $field_order      = 'MDY';
     /* String printed between the different fields. */
     $field_separator = "\n";
-	$time = time();
+    $time = time();
 
 
     extract($params);
 
-  	// If $time is not in format yyyy-mm-dd
-  	if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $time)) {
-  		// then $time is empty or unix timestamp or mysql timestamp
-  		// using smarty_make_timestamp to get an unix timestamp and
-  		// strftime to make yyyy-mm-dd
-  		$time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
-  	}
-  	// Now split this in pieces, which later can be used to set the select
-  	$time = explode("-", $time);
-  
-  	// make syntax "+N" or "-N" work with start_year and end_year
-  	if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
-  		if ($match[1] == '+') {
-  			$end_year = strftime('%Y') + $match[2];
-  		} else {
-  			$end_year = strftime('%Y') - $match[2];
-  		}
-  	}
-  	if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
-  		if ($match[1] == '+') {
-  			$start_year = strftime('%Y') + $match[2];
-  		} else {
-  			$start_year = strftime('%Y') - $match[2];
-  		}
-  	}
-  
+    // If $time is not in format yyyy-mm-dd
+    if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $time)) {
+        // then $time is empty or unix timestamp or mysql timestamp
+        // using smarty_make_timestamp to get an unix timestamp and
+        // strftime to make yyyy-mm-dd
+        $time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
+    }
+    // Now split this in pieces, which later can be used to set the select
+    $time = explode("-", $time);
+
+    // make syntax "+N" or "-N" work with start_year and end_year
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
+        if ($match[1] == '+') {
+            $end_year = strftime('%Y') + $match[2];
+        } else {
+            $end_year = strftime('%Y') - $match[2];
+        }
+    }
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
+        if ($match[1] == '+') {
+            $start_year = strftime('%Y') + $match[2];
+        } else {
+            $start_year = strftime('%Y') - $match[2];
+        }
+    }
+
     $field_order = strtoupper($field_order);
 
     $html_result = $month_result = $day_result = $year_result = "";
@@ -131,13 +131,13 @@
             $month_result .= ' ' . $all_extra;
         }
         $month_result .= '>'."\n";
-        
+
         $month_result .= smarty_function_html_options(array('output'     => $month_names,
                                                             'values'     => $month_values,
                                                             'selected'   => $month_values[$time[1]-1],
                                                             'print_result' => false),
                                                       $smarty);
-        
+
         $month_result .= '</select>';
     }
 
@@ -215,24 +215,24 @@
 
     // Loop thru the field_order field
     for ($i = 0; $i <= 2; $i++){
-      $c = substr($field_order, $i, 1);
-      switch ($c){
-        case 'D':
-            $html_result .= $day_result;
-            break;
-
-        case 'M':
-            $html_result .= $month_result;
-            break;
-
-        case 'Y':
-            $html_result .= $year_result;
-            break;
-      }
-      // Add the field seperator
-	  if($i != 2) {
-      	$html_result .= $field_separator;
-  	  }
+        $c = substr($field_order, $i, 1);
+        switch ($c){
+            case 'D':
+                $html_result .= $day_result;
+                break;
+
+            case 'M':
+                $html_result .= $month_result;
+                break;
+
+            case 'Y':
+                $html_result .= $year_result;
+                break;
+        }
+        // Add the field seperator
+        if($i != 2) {
+            $html_result .= $field_separator;
+        }
     }
 
     return $html_result;

-- 
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.