If no extension 'other' is installed, 16 years is hard-coded the default. You should...
authorRoland Häder <roland@mxchange.org>
Thu, 11 Dec 2008 00:12:33 +0000 (00:12 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 11 Dec 2008 00:12:33 +0000 (00:12 +0000)
inc/databases.php
inc/functions.php

index cea2527..190978c 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
-define('CURR_SVN_REVISION', "618");
+define('CURR_SVN_REVISION', "619");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 6632433..1fa43f7 100644 (file)
@@ -1139,8 +1139,20 @@ function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
                // Get current year
                $YEAR = date('Y', time());
 
+               // Use configured min age or fixed?
+               if (GET_EXT_VERSION("other") >= "0.2.1") {
+                       // Configured
+                       $startYear = $YEAR - $_CONFIG['min_age'];
+               } else {
+                       // Fixed 16 years
+                       $startYear = $YEAR - 16;
+               }
+
+               // Calculate earliest year (100 years old people can still enter Internet???)
+               $minYear = $YEAR - 100;
+
                // Check if the default value is larger than minimum and bigger than actual year
-               if (($DEFAULT > 1930) && ($DEFAULT >= $YEAR)) {
+               if (($DEFAULT > $minYear) && ($DEFAULT >= $YEAR)) {
                        for ($idx = $YEAR; $idx < ($YEAR + 11); $idx++) {
                                $OUT .= "<OPTION value=\"".$idx."\"";
                                if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
@@ -1148,20 +1160,28 @@ function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
                        } // END - for
                } elseif ($DEFAULT == -1) {
                        // Current year minus 1
-                       for ($idx = 2003; $idx <= ($YEAR + 1); $idx++)
+                       for ($idx = $startYear; $idx <= ($YEAR + 1); $idx++)
                        {
                                $OUT .= "<OPTION value=\"".$idx."\">".$idx."</OPTION>\n";
                        }
                } else {
                        // Get current year and subtract the configured minimum age
-                       $OUT .= "<OPTION value=\"1929\">&lt;1930</OPTION>\n";
-                       $YEAR = date('Y', time()) - $_CONFIG['min_age'];
-                       for ($idx = 1930; $idx <= $YEAR; $idx++)
-                       {
+                       $OUT .= "<OPTION value=\"".($minYear - 1)."\">&lt;".$minYear."</OPTION>\n";
+                       // Calculate earliest year depending on extension version
+                       if (GET_EXT_VERSION("other") >= "0.2.1") {
+                               // Use configured minimum age
+                               $YEAR = date('Y', time()) - $_CONFIG['min_age'];
+                       } else {
+                               // Use fixed 16 years age
+                               $YEAR = date('Y', time()) - 16;
+                       }
+
+                       // Construct year selection list
+                       for ($idx = $minYear; $idx <= $YEAR; $idx++) {
                                $OUT .= "<OPTION value=\"".$idx."\"";
                                if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
                                $OUT .= ">".$idx."</OPTION>\n";
-                       }
+                       } // END - for
                }
                break;
 
@@ -1172,7 +1192,7 @@ function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
                        $OUT .= "<OPTION value=\"".$idx."\"";
                        if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
                        $OUT .= ">".$idx."</OPTION>\n";
-               }
+               } // END - for
                break;
 
        case "hour":
@@ -1181,7 +1201,7 @@ function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
                        $OUT .= "<OPTION value=\"".$idx."\"";
                        if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
                        $OUT .= ">".$idx."</OPTION>\n";
-               }
+               } // END - for
                break;
 
        case "yn":