define('SERVER_URL', "http://www.mxchange.org");
// Current SVN revision
-define('CURR_SVN_REVISION', "721");
+define('CURR_SVN_REVISION', "722");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
$NOTES = "";
$INC_POOL = array();
- // By default we have no failtures
+ // By default we have no failures
$EXT_REPORTS_FAILURE = false;
// Does this extension exists?
// Switch back to register mode
$EXT_LOAD_MODE = "register";
- // Remains true if extension registration reports no failtures
+ // Remains true if extension registration reports no failures
$test = ($test && !$EXT_REPORTS_FAILURE);
// Does everthing before wents ok?
}
// Version of this extension
-$EXT_VERSION = "0.7.1";
+$EXT_VERSION = "0.7.2";
// 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.1", "0.2", "0.3", "0.3.1", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1", "0.6.2", "0.6.3", "0.6.4", "0.6.5", "0.6.6", "0.6.7", "0.6.8", "0.6.9", "0.7.0", "0.7.1");
+$EXT_VER_HISTORY = array("0.0", "0.1", "0.2", "0.3", "0.3.1", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1", "0.6.2", "0.6.3", "0.6.4", "0.6.5", "0.6.6", "0.6.7", "0.6.8", "0.6.9", "0.7.0", "0.7.1", "0.7.2");
switch ($EXT_LOAD_MODE)
{
break;
case "0.7.0": // SQL queries for v0.7.0
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD login_failtures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD last_failture TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'";
-
// Update notes (these will be set as task text!)
- $UPDATE_NOTES = "Fehlgeschlagene Login-Versuche werden nun mitgezählt und der letzte vermerkt.";
+ $UPDATE_NOTES = "Veraltetes Update.";
break;
case "0.7.1": // SQL queries for v0.7.1
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Filter hinzugefügt und ist von <strong>sql_patches</strong> abhängig.";
break;
+
+ case "0.7.2": // SQL queries for v0.7.2
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP login_failtures";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP last_failture";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD login_failures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD last_failure TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Schreibweise korregiert.";
+ break;
}
break;
}
// Version number
-$EXT_VERSION = "0.6.0";
+$EXT_VERSION = "0.6.1";
// Auto-set extension version
if (!isset($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", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.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", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9", "0.6.0", "0.6.1");
switch ($EXT_LOAD_MODE)
{
break;
case "0.4.7": // SQL queries for v0.4.7
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD login_failtures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD last_failture TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'";
-
// Update notes (these will be set as task text!)
- $UPDATE_NOTES = "Fehlgeschlagene Login-Versuche werden nun mitgezählt und der letzte vermerkt.";
+ $UPDATE_NOTES = "Veraltetes Update.";
break;
case "0.4.8": // SQL queries for v0.4.8
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Benutzungsstatistik eingebaut. Das Zählen der Filterverwendungen sollte <strong>ausschliesslich</strong> zu Debugging-Zwecken eingesetzt werden.";
break;
+
+ case "0.6.1": // SQL queries for v0.6.1
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP login_failtures";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP last_failture";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD login_failures BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD last_failure TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Falsche Schreibweise korregiert.";
+ break;
}
break;
// Init filters
REGISTER_FILTER('init', 'UPDATE_LOGIN_DATA');
- // Login failtures handler
+ // Login failures handler
REGISTER_FILTER('post_youhere_line', 'CALL_HANDLER_LOGIN_FAILTURES');
// Filters for pre-extension-registration
RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
}
-// Filter for calling the handler for login failtures
+// Filter for calling the handler for login failures
function FILTER_CALL_HANDLER_LOGIN_FAILTURES ($data) {
// Init content
$content = $data;
// Handle failed logins here if not in guest
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):type={$data['type']},action={$GLOBALS['action']},what={$GLOBALS['what']},lvl={$data['access_level']}<br />\n";
if ((($data['type'] == "what") || ($data['type'] == "action") && ((!isset($GLOBALS['what'])) || ($GLOBALS['what'] == "overview") || ($GLOBALS['what'] == getConfig('index_home')))) && ($data['access_level'] != "guest") && ((GET_EXT_VERSION("sql_patches") >= "0.4.7") || (GET_EXT_VERSION("admins") >= "0.7.0"))) {
- // Handle failture
+ // Handle failure
$content['content'] .= HANDLE_LOGIN_FAILTURES($data['access_level']);
} // END - if
$OUT = "";
// Is the session data set?
- if ((isSessionVariableSet('mxchange_'.$accessLevel.'_failtures')) && (isSessionVariableSet('mxchange_'.$accessLevel.'_last_fail'))) {
+ if ((isSessionVariableSet('mxchange_'.$accessLevel.'_failures')) && (isSessionVariableSet('mxchange_'.$accessLevel.'_last_fail'))) {
// Ignore zero values
- if (get_session('mxchange_'.$accessLevel.'_failtures') > 0) {
- // Non-guest has login failtures found, get both data and prepare it for template
+ if (get_session('mxchange_'.$accessLevel.'_failures') > 0) {
+ // Non-guest has login failures found, get both data and prepare it for template
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):accessLevel={$accessLevel}<br />\n";
$content = array(
- 'login_failtures' => get_session('mxchange_'.$accessLevel.'_failtures'),
- 'last_failture' => MAKE_DATETIME(get_session('mxchange_'.$accessLevel.'_last_fail'), "2")
+ 'login_failures' => get_session('mxchange_'.$accessLevel.'_failures'),
+ 'last_failure' => MAKE_DATETIME(get_session('mxchange_'.$accessLevel.'_last_fail'), "2")
);
// Load template
- $OUT = LOAD_TEMPLATE("login_failtures", true, $content);
+ $OUT = LOAD_TEMPLATE("login_failures", true, $content);
} // END - if
// Reset session data
- set_session('mxchange_'.$accessLevel.'_failtures', "");
+ set_session('mxchange_'.$accessLevel.'_failures', "");
set_session('mxchange_'.$accessLevel.'_last_fail', "");
} // END - if
// Is the admins extension updated? (should be!)
if (GET_EXT_VERSION("admins") >= "0.3") $ADD .= ", default_acl AS def_acl";
if (GET_EXT_VERSION("admins") >= "0.6.7") $ADD .= ", la_mode";
- if (GET_EXT_VERSION("admins") >= "0.7.0") $ADD .= ", login_failtures, UNIX_TIMESTAMP(last_failture) AS last_failture";
+ if (GET_EXT_VERSION("admins") >= "0.7.2") $ADD .= ", login_failures, UNIX_TIMESTAMP(last_failure) AS last_failure";
// Return it
return $ADD;
// Cookies not setable!
$URL = "modules.php?module=index&what=login&login=".CODE_NO_COOKIES;
}
- } elseif (GET_EXT_VERSION("sql_patches") >= "0.4.7") {
+ } elseif (GET_EXT_VERSION("sql_patches") >= "0.6.1") {
// Update failture counter
- SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET login_failtures=login_failtures+1,last_failture=NOW() WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET login_failures=login_failures+1,last_failure=NOW() WHERE userid=%s LIMIT 1",
array($uid), __FILE__, __LINE__);
// Wrong password!
// Include more admins data?
if (GET_EXT_VERSION("admins") >= "0.7.0") {
// Load them here
- $data['login_failtures'] = $cacheArray['admins']['login_failtures'][$aid];
- $data['last_failture'] = $cacheArray['admins']['last_failture'][$aid];
+ $data['login_failures'] = $cacheArray['admins']['login_failures'][$aid];
+ $data['last_failure'] = $cacheArray['admins']['last_failure'][$aid];
} // END - if
} elseif (!EXT_IS_ACTIVE("cache")) {
// Add extra data via filter now
$data['password'] = generateHash($password);
// Do we have 0.7.0 of admins or later?
- // Remmeber login failtures if available
- if (GET_EXT_VERSION("admins") >= "0.7.0") {
+ // Remmeber login failures if available
+ if (GET_EXT_VERSION("admins") >= "0.7.2") {
// Store it in session
- set_session('mxchange_admin_failtures', $data['login_failtures']);
- set_session('mxchange_admin_last_fail', $data['last_failture']);
+ set_session('mxchange_admin_failures', $data['login_failures']);
+ set_session('mxchange_admin_last_fail', $data['last_failure']);
- // Update password and reset login failtures
- SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET password='%s',login_failtures=0,last_failture='0000-00-00 00:00:00' WHERE id=%s LIMIT 1",
+ // Update password and reset login failures
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET password='%s',login_failures=0,last_failure='0000-00-00 00:00:00' WHERE id=%s LIMIT 1",
array($data['password'], $aid), __FILE__, __LINE__);
} else {
// Update password
} // END - if
}
- // Count login failture if admins extension version is 0.7.0+
+ // Count login failure if admins extension version is 0.7.0+
if (($ret == "pass") && (GET_EXT_VERSION("admins") >= "0.7.0")) {
// Update counter
- SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET login_failtures=login_failtures+1,last_failture=NOW() WHERE id=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET login_failures=login_failures+1,last_failure=NOW() WHERE id=%s LIMIT 1",
array($aid), __FILE__, __LINE__);
// Rebuild cache
function LOGIN_ADMIN ($adminLogin, $passHash) {
global $cacheInstance;
- // Reset failture counter on matching admins version
+ // Reset failure counter on matching admins version
if ((GET_EXT_VERSION("admins") >= "0.7.0") && ((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == ""))) {
// Reset counter on out-dated sql_patches version
- SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET login_failtures=0,last_failture='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET login_failures=0,last_failure='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
array($adminLogin), __FILE__, __LINE__);
// Rebuild cache
$MSG = "<strong>{!VALIDATING_LOGIN!}</strong>";
if (!empty($GLOBALS['userid']) && (isSessionVariableSet('u_hash'))) {
- // Login failtures are supported since 0.4.7
+ // Login failures are supported since 0.4.7
// Do we have 0.4.7 of sql_patches or later?
$ADD = "";
- if (GET_EXT_VERSION("sql_patches") >= "0.4.7") {
+ if (GET_EXT_VERSION("sql_patches") >= "0.6.1") {
// Load them here
- $ADD = ", login_failtures, UNIX_TIMESTAMP(last_failture) AS last_failture";
+ $ADD = ", login_failures, UNIX_TIMESTAMP(last_failure) AS last_failure";
} // END - if
// Get theme from profile
// Change to new theme
set_session('mxchange_theme', $data['curr_theme']);
- // Remmeber login failtures if available
- if (GET_EXT_VERSION("sql_patches") >= "0.4.7") {
- // Reset login failtures
+ // Remmeber login failures if available
+ if (GET_EXT_VERSION("sql_patches") >= "0.6.1") {
+ // Reset login failures
SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data
-SET login_failtures=0, last_failture='0000-00-00 00:00:00'
+SET login_failures=0, last_failure='0000-00-00 00:00:00'
WHERE userid=%s
LIMIT 1",
array($GLOBALS['userid']), __FILE__, __LINE__);
// Store it in session
- set_session('mxchange_member_failtures', $data['login_failtures']);
- set_session('mxchange_member_last_fail', $data['last_failture']);
+ set_session('mxchange_member_failures', $data['login_failures']);
+ set_session('mxchange_member_last_fail', $data['last_failure']);
} // END - if
// Bonus is not given by default ;-)
<div style="width:100%" align="center">
-<div class="login_failtures">
- <div class="login_failture_header">
+<div class="login_failures">
+ <div class="login_failure_header">
Warnung!
</div>
- Letzten <strong>$content[login_failtures]</strong> Loginversuche waren
- fehlgeschlagen, der letzte war am <strong>$content[last_failture]</strong>
+ Letzten <strong>$content[login_failures]</strong> Loginversuche waren
+ fehlgeschlagen, der letzte war am <strong>$content[last_failure]</strong>
</div>
</div>
font-weight : bold;
}
-.login_failture_header {
+
+.login_failure_header {
text-align : center;
background-color : #EEEEFF;
font-weight : bold;
}
-.login_failtures {
+.login_failures {
text-align : center;
width : 400px;
}
font-weight : bold;
}
-.login_failture_header {
+.login_failure_header {
text-align : center;
background-color : #ddeedd;
font-weight : bold;
}
-.login_failtures {
+.login_failures {
text-align : center;
width : 400px;
}
font-weight : bold;
}
-.login_failture_header {
+.login_failure_header {
text-align : center;
background-color : #DDDDAA;
font-weight : bold;
}
-.login_failtures {
+.login_failures {
text-align : center;
width : 400px;
}