// Check ACL for menu combination
function ADMINS_CHECK_ACL($act, $wht) {
- global $cacheArray, $_CONFIG, $cacheInstance;
+ global $cacheArray, $cacheInstance;
// If action is login or logout allow allways!
$default = "allow";
if (($act == "login") || ($act == "logout")) return true;
}
if ($lines == 1) {
// Count cache hits
- if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ incrementConfigEntry('cache_hits');
break;
}
}
// Update admin account
if ($default == "allow") {
// Allow changing default ACL
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET
login='%s'".$ADD.",
email='%s',
default_acl='%s',
), __FILE__, __LINE__);
} else {
// Do not allow it here
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET
login='%s'".$ADD.",
email='%s',
la_mode='%s'
// Delete only when it's not your own account!
if (($del == 1) && (GET_CURRENT_ADMIN_ID() != $id)) {
// Rewrite his tasks to all admins
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin=0 WHERE assigned_admin=%s",
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin=0 WHERE assigned_admin=%s",
array($id), __FILE__, __LINE__);
// Remove account
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
- array($id), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
+ array($id), __FILE__, __LINE__);
// Purge cache
CACHE_PURGE_ADMIN_MENU($id);
LOAD_TEMPLATE("admin_list_admins");
}
+// Filter for adding extra data to the query
+function FILTER_ADD_EXTRA_SQL_DATA () {
+ // Init extra data
+ $ADD = "";
+
+ // 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";
+
+ // Return it
+ return $ADD;
+}
+
//
?>