From ed9e95a268dbaea932b703fe4e8653615befcc27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 11 Dec 2008 00:12:33 +0000 Subject: [PATCH] If no extension 'other' is installed, 16 years is hard-coded the default. You should NOT edit this instead install 'other'! --- inc/databases.php | 2 +- inc/functions.php | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index cea25276ce..190978cee9 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -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); diff --git a/inc/functions.php b/inc/functions.php index 66324337f6..1fa43f7be0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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 .= "\n"; } } else { // Get current year and subtract the configured minimum age - $OUT .= "\n"; - $YEAR = date('Y', time()) - $_CONFIG['min_age']; - for ($idx = 1930; $idx <= $YEAR; $idx++) - { + $OUT .= "\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 .= "