
automatic realms insertion
Hello
for some years some people were asking for creating/inserting plugin without searching a own realms, and we have seen several problem of duplicate realms.
Now I have inserted in my plugins a function to calculate a new realm.
Could you add a such function in the PA. ? (yours or mine, it does not matter)
here my code: inserted in setup.php.
Code:
define("pluginREALMPLUGINproposition", "70");
function configmanager_search_realms($therealmtitle,$therealmproposition) {
global $user_auth_realms, $user_auth_realm_filenames;
$search_realm=$therealmproposition;
if (isset($user_auth_realms)) {
$firstnotin=$therealmproposition;
while (array_key_exists($firstnotin,$user_auth_realms)) {
$firstnotin = $firstnotin + 1;
}
if (array_key_exists($therealmproposition,$user_auth_realms) && ($user_auth_realms[$therealmproposition]==$therealmtitle)) {
$search_realm=$therealmproposition;
} else {
$search_realm=$firstnotin;
}
}
return $search_realm;
}
.....
function configmanager_config_arrays () {
...
$newrealm=configmanager_search_realms($myrealmtitle,pluginREALMPLUGINproposition);
$user_auth_realms[$newrealm]=$myrealmtitle;