}
// Version number
-$EXT_VERSION = "0.2.0";
+$EXT_VERSION = "0.2.1";
// Auto-set extension version
if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1");
switch ($EXT_LOAD_MODE)
{
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Bei fehlerhafter Mail während der Bestätigung kann wahlweise zur Hauptseite weitergeleitet oder auf die eingestellte Ablehnungsseite umgeleitet werden.";
break;
+
+ case "0.2.1": // SQL queries for v0.2.1
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` `min_age` TINYINT(3) UNSIGNED NOT NULL DEFAULT 16";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Minimumalter ist nun konfigurierbar.";
+ break;
}
break;
}
//
function GET_LANGUAGE() {
- if (!empty($_GET['mx_lang'])) {
- // Accept only first 2 chars
- $lang = substr($_GET['mx_lang'], 0, 2);
- } else {
- // Do nothing
- $lang = "";
- }
+ global $cacheArray;
// Set default return value to default language from config
$ret = DEFAULT_LANG;
- // Check GET variable and cookie
- if (!empty($lang)) {
+ // Init variable
+ $lang = "";
+
+ // Is the variable set
+ if (!empty($_GET['mx_lang'])) {
+ // Accept only first 2 chars
+ $lang = substr($_GET['mx_lang'], 0, 2);
+ } elseif (isset($cacheArray['language'])) {
+ // Use cached
+ $ret = $cacheArray['language'];
+ } elseif (!empty($lang)) {
// Check if main language file does exist
if (FILE_READABLE(PATH."inc/language/".$lang.".php")) {
// Okay found, so let's update cookies
// Fixes a warning before the session has the mx_lang constant
if (empty($ret)) $ret = DEFAULT_LANG;
}
+
+ // Cache entry
+ $cacheArray['language'] = $ret;
+
+ // Return value
return $ret;
}
//
$array = $dummy;
}
//
-function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0")
-{
- global $MONTH_DESCR; $OUT = "";
- if ($type == "yn")
- {
+function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
+ global $MONTH_DESCR, $_CONFIG;
+ $OUT = "";
+
+ if ($type == "yn") {
// This is a yes/no selection only!
if ($id > 0) $prefix .= "[".$id."]";
$OUT .= " <SELECT name=\"".$prefix."\" class=\"register_select\" size=\"1\">\n";
- }
- else
- {
+ } else {
// Begin with regular selection box here
if (!empty($prefix)) $prefix .= "_";
$type2 = $type;
if ($id > 0) $type2 .= "[".$id."]";
$OUT .= " <SELECT name=\"".strtolower($prefix.$type2)."\" class=\"register_select\" size=\"1\">\n";
}
- switch ($type)
- {
+
+ switch ($type) {
case "day": // Day
- for ($idx = 1; $idx < 32; $idx++)
- {
+ for ($idx = 1; $idx < 32; $idx++) {
$OUT .= "<OPTION value=\"".$idx."\"";
if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</OPTION>\n";
- }
+ } // END - for
break;
case "month": // Month
- foreach ($MONTH_DESCR as $month => $descr)
- {
+ foreach ($MONTH_DESCR as $month => $descr) {
$OUT .= "<OPTION value=\"".$month."\"";
if ($DEFAULT == $month) $OUT .= " selected=\"selected\"";
$OUT .= ">".$descr."</OPTION>\n";
- }
+ } // END - for
break;
case "year": // Year
$YEAR = date('Y', time());
// Check if the default value is larger than minimum and bigger than actual year
- if (($DEFAULT > 1930) && ($DEFAULT >= $YEAR))
- {
- for ($idx = $YEAR; $idx < ($YEAR + 11); $idx++)
- {
+ if (($DEFAULT > 1930) && ($DEFAULT >= $YEAR)) {
+ for ($idx = $YEAR; $idx < ($YEAR + 11); $idx++) {
$OUT .= "<OPTION value=\"".$idx."\"";
if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</OPTION>\n";
- }
- }
- elseif ($DEFAULT == -1)
- {
+ } // END - for
+ } elseif ($DEFAULT == -1) {
// Current year minus 1
for ($idx = 2003; $idx <= ($YEAR + 1); $idx++)
{
$OUT .= "<OPTION value=\"".$idx."\">".$idx."</OPTION>\n";
}
- }
- else
- {
- // Get current year and subtract 16 (for erotic content)
+ } else {
+ // Get current year and subtract the configured minimum age
$OUT .= "<OPTION value=\"1929\"><1930</OPTION>\n";
- $YEAR = date('Y', time()) - 16;
+ $YEAR = date('Y', time()) - $_CONFIG['min_age'];
for ($idx = 1930; $idx <= $YEAR; $idx++)
{
$OUT .= "<OPTION value=\"".$idx."\"";
// Check wether a boolean constant is set
// Taken from user comments in PHP documentation for function constant()
function isBooleanConstantAndTrue($constName) { // : Boolean
- global $constCache;
+ global $cacheArray;
// Failed by default
$res = false;
// In cache?
- if (isset($constCache[$constName])) {
+ if (isset($cacheArray['const'][$constName])) {
// Use cache
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$constName."-CACHE!<br />\n";
- $res = $constCache[$constName];
+ $res = $cacheArray['const'][$constName];
} else {
// Check constant
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$constName."-RESOLVE!<br />\n";
if (defined($constName)) $res = (constant($constName) === true);
// Set cache
- $constCache[$constName] = $res;
+ $cacheArray['const'][$constName] = $res;
}
//* DEBUG: */ var_dump($res);
}
// Check wether a session variable is set
-function isSessionVariableSet($var) {
+function isSessionVariableSet ($var) {
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):var={$var}<br />\n";
return (isset($_SESSION[$var]));
}
// Returns wether the value of the session variable or NULL if not set
-function get_session($var) {
+function get_session ($var) {
global $cacheArray;
// Default is not found! ;-)
// Is the variable there or cached values?
if (isset($cacheArray['session'][$var])) {
// Get cached value (skips a lot SQL_ESCAPE() calles!
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$var."-CACHE!<br />\n";
$value = $cacheArray['session'][$var];
} elseif (isSessionVariableSet($var)) {
// Then get it secured!
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ".$var."-RESOLVE!<br />\n";
$value = SQL_ESCAPE($_SESSION[$var]);
// Cache the value
-<FORM action="{!URL!}/modules.php?module=admin&what=config_other"
- method="POST">
-<TABLE border="0" cellspacing="0" cellpadding="0" align="center"
- width="520" class="admin_table dashed">
-
+<FORM action="{!URL!}/modules.php?module=admin&what=config_other" method="POST">
+<TABLE border="0" cellspacing="0" cellpadding="0" align="center" width="520" class="admin_table dashed">
<TR>
<TD colspan="5" height="7" class="seperator admin_title"> </TD>
</TR>
<TR>
<TD width="10" class="seperator"> </TD>
<TD align="right" width="340">
- {--ADMIN_OPTION_ACTIVATE_EXCHANGE--}:</TD>
+ {--ADMIN_OPTION_ACTIVATE_EXCHANGE--}:
+ </TD>
+ <TD width="10" class="seperator"> </TD>
+ <TD>
+ <INPUT type="text" name="activate_xchange" class="admin_normal" size="10" maxlength="10" value="{--_CFG_ACT_SYSTEM--}" />
+ </TD>
+ <TD width="10" class="seperator"> </TD>
+ </TR>
+
+ <TR>
+ <TD colspan="5" height="7" class="seperator"> </TD>
+ </TR>
+
+ <TR>
+ <TD width="10" class="seperator"> </TD>
+ <TD align="right" width="340">
+ {--ADMIN_OPTION_MINIMUM_AGE--}:
+ </TD>
<TD width="10" class="seperator"> </TD>
- <TD><INPUT type="text" name="activate_xchange"
- class="admin_normal" size="10" maxlength="10"
- value="{--_CFG_ACT_SYSTEM--}"></TD>
+ <TD>
+ <INPUT type="text" name="min_age" class="admin_normal" size="3" maxlength="3" value="{--_CFG_MIN_AGE--}" />
+ </TD>
<TD width="10" class="seperator"> </TD>
</TR>