Extension - Add: Remove auto-generate extension users.

This commit is contained in:
Nate
2020-02-18 06:17:27 -07:00
parent 5f5a4f5509
commit 63d0582864
2 changed files with 11 additions and 82 deletions

View File

@@ -2609,26 +2609,6 @@ $text['description-accountcode']['ru-ru'] = "Введите здесь код с
$text['description-accountcode']['sv-se'] = "Ange 'account code' här.";
$text['description-accountcode']['uk-ua'] = "";
$text['checkbox-range']['en-us'] = "Auto-generate user with extension as login name";
$text['checkbox-range']['ar-eg'] = "";
$text['checkbox-range']['de-at'] = "Benutzer automatisch anlegen (Nebenstelle als Login Name)"; //copied from de-de
$text['checkbox-range']['de-ch'] = "Benutzer automatisch anlegen (Nebenstelle als Login Name)"; //copied from de-de
$text['checkbox-range']['de-de'] = "Benutzer automatisch anlegen (Nebenstelle als Login Name)";
$text['checkbox-range']['es-cl'] = "Generar automáticamente usuario con su nombre de inicio de sesión como extensión";
$text['checkbox-range']['es-mx'] = "Generar automáticamente usuario con su nombre de inicio de sesión como extensión"; //copied from es-cl
$text['checkbox-range']['fr-ca'] = "Auto-générer l'usager avec l'extension comme ID de login"; //copied from fr-fr
$text['checkbox-range']['fr-fr'] = "Auto-générer l'usager avec l'extension comme ID de login";
$text['checkbox-range']['he-il'] = "";
$text['checkbox-range']['it-it'] = "Genera automaticamente l'utente con l'interno come login.";
$text['checkbox-range']['nl-nl'] = "Genereer een usernaam met met toestel als loginnaam.";
$text['checkbox-range']['pl-pl'] = " Wygeneruj użytkownika z numerem wewnętrznym jako login.";
$text['checkbox-range']['pt-br'] = "Gerar automaticamente o usuário com o ramal como nome de login";
$text['checkbox-range']['pt-pt'] = "Geração Automática do utilizador com a extensão como nome de login";
$text['checkbox-range']['ro-ro'] = "";
$text['checkbox-range']['ru-ru'] = "Автоматическая генерация Пользователю Внутреннего Номера Логина и Имени";
$text['checkbox-range']['sv-se'] = "Auto-generera användare med anknytning som inloggningsnamn.";
$text['checkbox-range']['uk-ua'] = "";
$text['button-call_routing']['en-us'] = "Call Routing";
$text['button-call_routing']['ar-eg'] = "توجيه الدعوة";
$text['button-call_routing']['de-at'] = "Call Routing"; //copied from de-de
@@ -2649,4 +2629,4 @@ $text['button-call_routing']['ru-ru'] = "Маршрутизация Вызово
$text['button-call_routing']['sv-se'] = "Call Routing";
$text['button-call_routing']['uk-ua'] = "маршрутизація викликів";
?>
?>

View File

@@ -103,7 +103,6 @@
$voicemail_local_after_email = $_POST["voicemail_local_after_email"];
$user_context = $_POST["user_context"];
$range = $_POST["range"];
$autogen_users = $_POST["autogen_users"];
$missed_call_app = $_POST["missed_call_app"];
$missed_call_data = $_POST["missed_call_data"];
$toll_allow = $_POST["toll_allow"];
@@ -269,23 +268,6 @@
break;
}
//add the user to the database
$user_email = '';
if ($_SESSION["users"]["unique"]["text"] != "global") {
if ($autogen_users == "true") {
$auto_user = $extension;
for ($i=1; $i<=$range; $i++) {
$user_last_name = $auto_user;
$user_password = generate_password();
user_add($auto_user, $user_password, $user_email);
$generated_users[$i]['username'] = $auto_user;
$generated_users[$i]['password'] = $user_password;
$auto_user++;
}
unset($auto_user);
}
}
//build the data array
if (!isset($range)) { $range = 1; }
for ($i=0; $i<$range; $i++) {
@@ -610,50 +592,20 @@
}
}
//show the action and redirect the user
//set the message and redirect
if ($action == "add") {
message::add($text['message-add']);
//prepare for alternating the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the action and redirect the user
if (!is_array($generated_users) || count($generated_users) == 0) {
//action add
header("Location: extension_edit.php?id=".$extension_uuid);
}
else {
//auto-generate user with extension as login name
require_once "resources/header.php";
echo "<br />\n";
echo "<div align='center'>\n";
echo " <table width='40%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td colspan='2'><strong>New User Accounts</strong></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <th>Username</th>\n";
echo " <th>Password</th>\n";
echo " </tr>\n";
foreach ($generated_users as $tmp_user) {
echo " <tr>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$tmp_user['username']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$tmp_user['password']."</td>\n";
echo " </tr>\n";
}
$c = $c ? 0 : 1;
echo " </table>";
echo "</div>\n";
require_once "resources/footer.php";
}
exit;
message::add($text['message-add']);
}
if ($action == "update") {
message::add($text['message-update']);
header("Location: extension_edit.php?id=".$extension_uuid.(is_numeric($page) ? '&page='.$page : null));
return;
}
if ($range > 1) {
header("Location: extensions.php");
}
else {
header("Location: extension_edit.php?id=".$extension_uuid.(is_numeric($page) ? '&page='.$page : null));
}
exit;
}
}
@@ -971,10 +923,7 @@
echo " <option value='5000'>5000</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-range']."<br />\n";
if ($_SESSION["user"]["unique"]["text"] != "global") {
echo "<input type=\"checkbox\" name=\"autogen_users\" value=\"true\"> ".$text['checkbox-range']."<br>\n";
}
echo $text['description-range']."\n";
echo "</td>\n";
echo "</tr>\n";
}