case 'no': $q = 0; break; default: $q = 0; break; } Database::get()->query("UPDATE auth SET auth_default = ?d WHERE auth_id = ?d", $q, $auth); } $auth_methods = get_auth_active_methods(); if (empty($auth)) { $tool_content .= "<div class='alert alert-info'><label>{$langMethods}</label>"; if ($auth_methods) { $tool_content .= "<ul>"; foreach ($auth_methods as $k => $v) { $c = count_auth_users($v); if ($c != 0) { $lc = "<a href='listusers.php?fname=&lname=&am=&user_type=0&auth_type={$v}&reg_flag=1&user_registered_at=&verified_mail=3&email=&uname=&department=0'>{$c}</a>"; if ($v != 1) { $l = " - <a href='auth_change.php?auth={$v}'>{$langAuthChangeUser}</a>"; } else { $l = ""; } } else { $lc = 0; $l = ""; } $tool_content .= "<li>" . get_auth_info($v) . " ({$langNbUsers}: {$lc}{$l})</li>"; } $tool_content .= "</ul>"; }
} elseif (isset($_GET['p'])) {// modify primary authentication method if ($_GET['p'] == 1) { Database::get()->query("UPDATE auth SET auth_default = 1 WHERE auth_default <> 0"); Database::get()->query("UPDATE auth SET auth_default = 2 WHERE auth_id = ?d", $auth); Session::Messages($langPrimaryAuthTypeChanged, 'alert-success'); } else { Database::get()->query("UPDATE auth SET auth_default = 1 WHERE auth_id = ?d", $auth); Session::Messages($langSecondaryAuthTypeChanged, 'alert-success'); } redirect_to_home_page('modules/admin/auth.php'); } } else { $auth_active_ids = get_auth_active_methods(); $tool_content .= "<div class='alert alert-info'><label>$langMethods</label><ul>"; foreach ($auth_ids as $auth_id => $auth_name) { $auth_count = count_auth_users($auth_id); $auth_active = in_array($auth_id, $auth_active_ids); if ($auth_count > 0 or $auth_active) { $auth_search_link = ($auth_count == 0)? '0': "<a href='listusers.php?fname=&lname=&am=&user_type=0&auth_type=$auth_id&reg_flag=1&user_registered_at=&verified_mail=3&email=&uname=&department=0'>$auth_count</a>"; if ($auth_id != 1 and $auth_count > 0) { $auth_change_link = " - <a href='auth_change.php?auth=$auth_id'>$langAuthChangeUser</a>"; } else { $auth_change_link = ''; } if (!$auth_active) { $auth_warn = "<br><span class='label label-warning'>$langAuthWarnInactive</span>"; } else { $auth_warn = ''; } $tool_content .= "<li>" . get_auth_info($auth_id) . " ($langNbUsers: $auth_search_link$auth_change_link)$auth_warn</li>";