Browse Source

Moved hot desking to the fusionpbx apps directory. It has been replaced both something far better and so this version considered deprecated.

markjcrane 10 năm trước cách đây
mục cha
commit
90c0e174e8

+ 37 - 0
hot_desking/app_config.php

@@ -0,0 +1,37 @@
+<?php
+
+	//application details
+		$apps[$x]['name'] = "Hot Desking";
+		$apps[$x]['uuid'] = "f4ae30f0-68ff-46d2-afd3-34caff2887c9";
+		$apps[$x]['category'] = "Switch";;
+		$apps[$x]['subcategory'] = "";
+		$apps[$x]['version'] = "";
+		$apps[$x]['license'] = "Mozilla Public License 1.1";
+		$apps[$x]['url'] = "http://www.fusionpbx.com";
+		$apps[$x]['description']['en-us'] = "Login into hot desking with an ID and your voicemail password to direct your calls to a remote extension. Then make and receive calls as if you were at your extension.";
+		$apps[$x]['description']['es-cl'] = "Ingrese en un escritorio con un ID y la contaseña para direccionar las llamadas a una extensión remota. Hace y recibe llamadas";
+		$apps[$x]['description']['es-mx'] = "Firmarse en un escritorio con un ID y la contaseña para direccionar las llamadas a una extensión remota. Hace y recibe llamadas";
+		$apps[$x]['description']['de-de'] = "";
+		$apps[$x]['description']['de-ch'] = "";
+		$apps[$x]['description']['de-at'] = "";
+		$apps[$x]['description']['fr-fr'] = "S'identifier au bureau avec un ID et un mot de passe pour diriger touts les appels vers autre poste. Passer et recevoir appels."; 
+		$apps[$x]['description']['fr-ca'] = "S'identifier au bureau avec un ID et la mot de passe pour diriger touts les appels vers autre bureau lointain.  Faites et recevoyez appels.";
+		$apps[$x]['description']['fr-ch'] = "";
+		$apps[$x]['description']['pt-pt'] = "Habilitar o escritório remoto recorrendo a um ID e à password do correio de voz para encaminhar as chamadas para uma extensão remota. Em seguida, fazer e receber ligações como se estivesse a utilizar a sua extensão.";
+		$apps[$x]['description']['pt-br'] = "";
+
+	//permission details
+		$apps[$x]['permissions'][0]['name'] = "hot_desk_view";
+		$apps[$x]['permissions'][0]['menu']['uuid'] = "baa57691-37d4-4c7d-b227-f2929202b480";
+		$apps[$x]['permissions'][0]['groups'][] = "superadmin";
+
+		$apps[$x]['permissions'][1]['name'] = "hot_desk_add";
+		$apps[$x]['permissions'][1]['groups'][] = "superadmin";
+
+		$apps[$x]['permissions'][2]['name'] = "hot_desk_edit";
+		$apps[$x]['permissions'][2]['groups'][] = "superadmin";
+
+		$apps[$x]['permissions'][3]['name'] = "hot_desk_delete";
+		$apps[$x]['permissions'][3]['groups'][] = "superadmin";
+
+?>

+ 246 - 0
hot_desking/app_languages.php

@@ -0,0 +1,246 @@
+<?php
+
+$text['title-hot_desking']['en-us'] = "Hot Desking";
+$text['title-hot_desking']['es-cl'] = "Escritorio Remoto";
+$text['title-hot_desking']['pt-pt'] = "Escritório Remoto";
+$text['title-hot_desking']['fr-fr'] = "Itinérance";
+$text['title-hot_desking']['pt-br'] = "Escritório remoto";
+$text['title-hot_desking']['sv-se'] = "Hot Desking ";
+$text['title-hot_desking']['pl'] = "Gorące biurka";
+$text['title-hot_desking']['de-at'] = "Mobiler Arbeitsplatz";
+
+$text['message-update']['en-us'] = "Update Completed";
+$text['message-update']['es-cl'] = "Actualización Completada";
+$text['message-update']['pt-pt'] = "Actualização Efectuada";
+$text['message-update']['fr-fr'] = "Mis à jour";
+$text['message-update']['pt-br'] = "Atualização Efetuada";
+$text['message-update']['sv-se'] = "Uppdatering Klar ";
+$text['message-update']['pl'] = "Zaktualizowano poprawnie";
+$text['message-update']['de-at'] = "Aktualisierung durchgeführt";
+
+$text['message-unique']['en-us'] = "The Unique ID is not unique.  Please provide a numeric ID not already in use by a different extension.";
+$text['message-unique']['es-cl'] = "El ID no es único. Por favor ingrese un ID numérico que no este asignado actualmente a una extensión diferente.";
+$text['message-unique']['pt-pt'] = "O ID único não é único. Por favor indique um ID numérico que ainda não esteja em utilização noutra extensão.";
+$text['message-unique']['fr-fr'] = "Le 'Unique ID' n'est pas unique. Merci d'indiquer un identifiant numérique n'étant pas déjà utilisé par une autre extension.";
+$text['message-unique']['pt-br'] = "O ID informado já esta sendo utilizado, favor informar outro ID.";
+$text['message-unique']['sv-se'] = "Det unika ID:t är inte unikt. Ange ett numeriskt ID som inte redan används av någon annan anknytning. ";
+$text['message-unique']['pl'] = "Ten identyfikator nie jest unikalny. Proszę podać numeryczne ID, które nie  już używane przez inny numer wewnętrzny.";
+$text['message-unique']['de-at'] = "Die Eindeutige ID existiert bereits. Bitte geben Sie eine Numerische ID an, die noch einer anderen Nebenstelle zugewiesen wurde.";
+
+$text['message-required']['en-us'] = "Please provide: ";
+$text['message-required']['es-cl'] = "Por favor ingrese: ";
+$text['message-required']['pt-pt'] = "Por favor indique: ";
+$text['message-required']['fr-fr'] = "Merci d'indiquer: ";
+$text['message-required']['pt-br'] = "Por favor Indique:";
+$text['message-required']['sv-se'] = "Var god uppge: ";
+$text['message-required']['pl'] = "Wpisz:";
+$text['message-required']['de-at'] = "Bitte geben Sie folgendes an:";
+
+$text['message-delete']['en-us'] = "Delete Completed";
+$text['message-delete']['es-cl'] = "Eliminación Completada";
+$text['message-delete']['pt-pt'] = "Remoção Efectuada";
+$text['message-delete']['fr-fr'] = "Supprimé";
+$text['message-delete']['pt-br'] = "Remoção Efetuada";
+$text['message-delete']['sv-se'] = "Borttagning Klar ";
+$text['message-delete']['pl'] = "Usunięto poprawnie";
+$text['message-delete']['de-at'] = "Erfolgreich gelöscht";
+
+$text['message-add']['en-us'] = "Add Completed";
+$text['message-add']['es-cl'] = "Agregar Completado";
+$text['message-add']['pt-pt'] = "Adição Efectuada";
+$text['message-add']['fr-fr'] = "Ajouté";
+$text['message-add']['pt-br'] = "Criação Efetuada";
+$text['message-add']['sv-se'] = "Tillagd ";
+$text['message-add']['pl'] = "Dodano poprawnie";
+$text['message-add']['de-at'] = "Erfolgreich hinzugefügt";
+
+$text['label-voicemail_password']['en-us'] = "Voicemail Password";
+$text['label-voicemail_password']['es-cl'] = "Contraseña de correo de voz";
+$text['label-voicemail_password']['pt-pt'] = "Password do Correio de Voz";
+$text['label-voicemail_password']['fr-fr'] = "Mot de passe de la messagerie";
+$text['label-voicemail_password']['pt-br'] = "Senha do correio de voz";
+$text['label-voicemail_password']['sv-se'] = "Röstbrevlåda Lösenord ";
+$text['label-voicemail_password']['pl'] = "Hasło poczty głosowej";
+$text['label-voicemail_password']['de-at'] = "Mailbox Passwort";
+
+$text['label-unique_id']['en-us'] = "Unique ID";
+$text['label-unique_id']['es-cl'] = "ID Único";
+$text['label-unique_id']['pt-pt'] = "ID Único";
+$text['label-unique_id']['fr-fr'] = "Unique ID";
+$text['label-unique_id']['pt-br'] = "ID Único";
+$text['label-unique_id']['sv-se'] = "Unikt ID ";
+$text['label-unique_id']['pl'] = "Unikalne ID";
+$text['label-unique_id']['de-at'] = "Eindeutige ID";
+
+$text['label-forward_to']['en-us'] = "Forward To";
+$text['label-forward_to']['es-cl'] = "Dirigir A";
+$text['label-forward_to']['pt-pt'] = "Encaminhar Para";
+$text['label-forward_to']['fr-fr'] = "Renvoyé vers";
+$text['label-forward_to']['pt-br'] = "Encaminhar para";
+$text['label-forward_to']['sv-se'] = "Vidarekoppla Till ";
+$text['label-forward_to']['pl'] = "Przekieruj na";
+$text['label-forward_to']['de-at'] = "Weiterleiten An";
+
+$text['label-extension']['en-us'] = "Extension";
+$text['label-extension']['es-cl'] = "Extensión";
+$text['label-extension']['pt-pt'] = "Extensão";
+$text['label-extension']['fr-fr'] = "Extension";
+$text['label-extension']['pt-br'] = "Ramal";
+$text['label-extension']['sv-se'] = "Anknytning ";
+$text['label-extension']['pl'] = "Numer wewnętrzny";
+$text['label-extension']['de-at'] = "Nebenstelle";
+
+$text['label-dial_string']['en-us'] = "Dial String";
+$text['label-dial_string']['es-cl'] = "Cadena de Marcado";
+$text['label-dial_string']['pt-pt'] = "Dial String";
+$text['label-dial_string']['fr-fr'] = "numérotation";
+$text['label-dial_string']['pt-br'] = "Dial String";
+$text['label-dial_string']['sv-se'] = "Ringa Sträng ";
+$text['label-dial_string']['pl'] = "Opcje polecenia DIAL";
+$text['label-dial_string']['de-at'] = "Wahl Zeichenkette";
+
+$text['label-description']['en-us'] = "Description";
+$text['label-description']['es-cl'] = "Descripción";
+$text['label-description']['pt-pt'] = "Descrição";
+$text['label-description']['fr-fr'] = "Description";
+$text['label-description']['pt-br'] = "Descrição";
+$text['label-description']['sv-se'] = "Beskrivning ";
+$text['label-description']['pl'] = "Opis";
+$text['label-description']['de-at'] = "Beschreibung";
+
+$text['header-message']['en-us'] = "Message";
+$text['header-message']['es-cl'] = "Mensaje";
+$text['header-message']['pt-pt'] = "Mensagem";
+$text['header-message']['fr-fr'] = "Message";
+$text['header-message']['pt-br'] = "Mensagem";
+$text['header-message']['sv-se'] = "Meddelande ";
+$text['header-message']['pl'] = "Wiadomość";
+$text['header-message']['de-at'] = "Nachricht";
+
+$text['header-hot_desking']['en-us'] = "Hot Desking";
+$text['header-hot_desking']['es-cl'] = "Escritorio Remoto";
+$text['header-hot_desking']['pt-pt'] = "Escritório Remoto";
+$text['header-hot_desking']['fr-fr'] = "Itinérance";
+$text['header-hot_desking']['pt-br'] = "Escritório remoto";
+$text['header-hot_desking']['sv-se'] = "Hot Desking ";
+$text['header-hot_desking']['pl'] = "Gorące biurka (Hot desking)";
+$text['header-hot_desking']['de-at'] = "Mobiler Arbeitsplatz";
+
+$text['description-voicemail_password']['en-us'] = "Enter the voicemail password here.";
+$text['description-voicemail_password']['es-cl'] = "Ingrese la contraseña del correo de voz aquí.";
+$text['description-voicemail_password']['pt-pt'] = "Introduza a password do correio de voz aqui.";
+$text['description-voicemail_password']['fr-fr'] = "Insérer le Mot de passe de la messagerie ici.";
+$text['description-voicemail_password']['pt-br'] = "Introduza uma senha númerica para o correio de voz aqui";
+$text['description-voicemail_password']['sv-se'] = "Ange det numeriska röstbrevlåde-lösenordet här. ";
+$text['description-voicemail_password']['pl'] = "Dodaj numeryczne hasło poczty głosowej";
+$text['description-voicemail_password']['de-at'] = "Geben Sie das numerische Mailbox Passwort an.";
+
+$text['description-unique_id']['en-us'] = "A unique NUMERIC ID to identify the extension and domain.";
+$text['description-unique_id']['es-cl'] = "Un ID numérico único para identificar la extensión y dominio.";
+$text['description-unique_id']['pt-pt'] = "Um ID único numérico para identificar a extensão e o domínio.";
+$text['description-unique_id']['fr-fr'] = "Un Identifiant numérique Unique afin d'identifier l'extension et le domaine.";
+$text['description-unique_id']['pt-br'] = "Um ID numérico para identificar a extensão do dominio";
+$text['description-unique_id']['sv-se'] = "Ett unikt NUMERISKT ID för att indetifiera anknytning och domän. ";
+$text['description-unique_id']['pl'] = "Unikalne numeryczne ID identyfikujące numer wew oraz domenę.";
+$text['description-unique_id']['de-at'] = "Eine numerische ID zur eindeutigen Identifikation der Nebenstelle und Domain.";
+
+$text['description-password']['en-us'] = "Password";
+$text['description-password']['es-cl'] = "Contraseña";
+$text['description-password']['pt-pt'] = "Password";
+$text['description-password']['fr-fr'] = "Mot de passe";
+$text['description-password']['pt-br'] = "Introduza a senha";
+$text['description-password']['sv-se'] = "Lösenord ";
+$text['description-password']['pl'] = "Hasło";
+$text['description-password']['de-at'] = "Geben Sie das Passwort ein.";
+
+$text['description-hot_desking']['en-us'] = "Log in to hot desking with a unique ID and your voicemail password to direct your calls to a remote extension. Then, make and receive calls as if you were at your extension.";
+$text['description-hot_desking']['es-cl'] = "Ingrese en un escritorio con un ID y la contaseña para direccionar las llamadas a una extensión remota. Hace y recibe llamadas";
+$text['description-hot_desking']['pt-pt'] = "Habilite o escritório remoto recorrendo a um ID único e à sua password do correio de voz para encaminhar as suas chamadas para uma extensão remota. Depois, faça e receba chamadas como se estivesse na sua extensão.";
+$text['description-hot_desking']['fr-fr'] = "Se connecter à l'itinérance avec votre Identifiant et votre mot de passe de messagerie pour rediriger vos appels vers une extensions distante. Alors, passez et recevez des appels comme si vous étiez sur votre extensions. ";
+$text['description-hot_desking']['pt-br'] = "Habilite o escritório remoto recorrendo a um ID único e à sua senha do correio de voz para encaminhar as suas chamadas para uma extensão remota. Depois, faça e receba chamadas como se estivesse na sua extensão. ";
+$text['description-hot_desking']['sv-se'] = "Logg ain på Hot Desking med ett unikt ID och ditt röstbrevlåde lösenord för att vidarebefordra dina samtal till en annan anknytning. Ring och svara sedan som om du var på din egna anknytning.";
+$text['description-hot_desking']['pl'] = "Aby kierować połączenia do zdalnego numeru wewnętrznego zaloguj się do Gorących Biurek z unikalnym ID i hasłem poczty głosowej. Następnie, dzwoń i odbieraj rozmowy, tak jak z własnego telefonu.";
+$text['description-hot_desking']['de-at'] = "Melden Sie sich mit Ihrer Eindeutigen ID und dem Mailbox Passwort beim mobilen Arbeitsplatz an um alle Anrufe an eine andere Nebenstelle umzuleiten. Sie können von dieser Nebenstelle dann telefonieren, als wäre es Ihre eigene.";
+
+$text['description-extension-edit']['en-us'] = "Extension number.";
+$text['description-extension-edit']['es-cl'] = "Número de Extensión.";
+$text['description-extension-edit']['pt-pt'] = "Número da Extensão.";
+$text['description-extension-edit']['fr-fr'] = "Numéro d'extension.";
+$text['description-extension-edit']['pt-br'] = "Edite o número da extensão";
+$text['description-extension-edit']['sv-se'] = "Anknytningsnummer";
+$text['description-extension-edit']['pl'] = "Numer wewnętrzny";
+$text['description-extension-edit']['de-at'] = "Nebenstellen Nummer";
+
+$text['description-extension-add']['en-us'] = "Select the extension number.";
+$text['description-extension-add']['es-cl'] = "Seleccione el número de extensión.";
+$text['description-extension-add']['pt-pt'] = "Escolha o número da extensão.";
+$text['description-extension-add']['fr-fr'] = "Choisir le numéro d'extension.";
+$text['description-extension-add']['pt-br'] = "Adicione o número da extensão";
+$text['description-extension-add']['sv-se'] = "Välj anknytningsnummer";
+$text['description-extension-add']['pl'] = "Wybierz numer wew";
+$text['description-extension-add']['de-at'] = "Wählen Sie die Nebenstellen Nummer.";
+
+$text['description-dial_string']['en-us'] = "Location of the endpoint.";
+$text['description-dial_string']['es-cl'] = "Localización del extremo.";
+$text['description-dial_string']['pt-pt'] = "Localização do terminal.";
+$text['description-dial_string']['fr-fr'] = "Localisation de l'équipement.";
+$text['description-dial_string']['pt-br'] = "Lolicação do ponto final";
+$text['description-dial_string']['sv-se'] = "Plats för enheten.";
+$text['description-dial_string']['pl'] = "Lokalizacja klienta SIP";
+$text['description-dial_string']['de-at'] = "Standort des Endgeräts";
+
+$text['confirm-delete']['en-us'] = "Do you really want to delete this?";
+$text['confirm-delete']['es-cl'] = "¿Realmente desea eliminar esto?";
+$text['confirm-delete']['pt-pt'] = "Deseja realmente remover isto?";
+$text['confirm-delete']['fr-fr'] = "Voulez-vous vraiment supprimer cela?";
+$text['confirm-delete']['pt-br'] = "Deseja realmente remover isto?";
+$text['confirm-delete']['sv-se'] = "Vill du verkligen ta bort detta?";
+$text['confirm-delete']['pl'] = "Czy na pewno chcesz to usunąć?";
+$text['confirm-delete']['de-at'] = "Wollen Sie das wirklich löschen?";
+
+$text['button-save']['en-us'] = "Save";
+$text['button-save']['es-cl'] = "Guardar";
+$text['button-save']['pt-pt'] = "Guardar";
+$text['button-save']['fr-fr'] = "Sauvegarder";
+$text['button-save']['pt-br'] = "Salvar";
+$text['button-save']['sv-se'] = "Spara";
+$text['button-save']['pl'] = "Zachowaj";
+$text['button-save']['de-at'] = "Speichern";
+
+$text['button-edit']['en-us'] = "Edit";
+$text['button-edit']['es-cl'] = "Editar";
+$text['button-edit']['pt-pt'] = "Editar";
+$text['button-edit']['fr-fr'] = "Editer";
+$text['button-edit']['pt-br'] = "Editar";
+$text['button-edit']['sv-se'] = "Editera";
+$text['button-edit']['pl'] = "Edytuj";
+$text['button-edit']['de-at'] = "Bearbeiten";
+
+$text['button-delete']['en-us'] = "Delete";
+$text['button-delete']['es-cl'] = "Eliminar";
+$text['button-delete']['pt-pt'] = "Remover";
+$text['button-delete']['fr-fr'] = "Supprimer";
+$text['button-delete']['pt-br'] = "Remover";
+$text['button-delete']['sv-se'] = "Ta Bort";
+$text['button-delete']['pl'] = "Usuń";
+$text['button-delete']['de-at'] = "Löschen";
+
+$text['button-back']['en-us'] = "Back";
+$text['button-back']['es-cl'] = "Volver";
+$text['button-back']['pt-pt'] = "Voltar";
+$text['button-back']['fr-fr'] = "Retour";
+$text['button-back']['pt-br'] = "Voltar";
+$text['button-back']['sv-se'] = "Tillbaka";
+$text['button-back']['pl'] = "Wróć";
+$text['button-back']['de-at'] = "Zurück";
+
+$text['button-add']['en-us'] = "Add";
+$text['button-add']['es-cl'] = "Agregar";
+$text['button-add']['pt-pt'] = "Adicionar";
+$text['button-add']['fr-fr'] = "Ajouter";
+$text['button-add']['pt-br'] = "Adicionar";
+$text['button-add']['sv-se'] = "Lägg Till";
+$text['button-add']['pl'] = "Dodaj";
+$text['button-add']['de-at'] = "Hinzufügen";
+
+?>

+ 19 - 0
hot_desking/app_menu.php

@@ -0,0 +1,19 @@
+<?php
+
+$apps[$x]['menu'][0]['title']['en-us'] = "Hot Desking";
+$apps[$x]['menu'][0]['title']['es-cl'] = "Escritorio remoto";
+$apps[$x]['menu'][0]['title']['es-mx'] = "Escritorio remoto";
+$apps[$x]['menu'][0]['title']['fr-fr'] = "Itinérance";
+$apps[$x]['menu'][0]['title']['fr-ca'] = "Bureau Lointain";
+$apps[$x]['menu'][0]['title']['pt-pt'] = "Escritório Remoto";
+$apps[$x]['menu'][0]['title']['pt-br'] = "Escritório remoto";
+$apps[$x]['menu'][0]['title']['sv-se'] = "Hot Desking ";
+$apps[$x]['menu'][0]['title']['pl'] = "Gorące biurka";
+$apps[$x]['menu'][0]['title']['de-at'] = "Mobiler Arbeitsplatz";
+$apps[$x]['menu'][0]['uuid'] = "baa57691-37d4-4c7d-b227-f2929202b480";
+$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
+$apps[$x]['menu'][0]['category'] = "internal";
+$apps[$x]['menu'][0]['path'] = "/app/hot_desking/index.php";
+$apps[$x]['menu'][0]['groups'][] = "superadmin";
+
+?>

+ 81 - 0
hot_desking/extension_delete.php

@@ -0,0 +1,81 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2015
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+include "root.php";
+require_once "resources/require.php";
+require_once "resources/check_auth.php";
+if (permission_exists('extension_delete')) {
+	//access granted
+}
+else {
+	echo "access denied";
+	exit;
+}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the id
+	if (count($_GET) > 0) {
+		$id = check_str($_GET["id"]);
+	}
+
+//delete the hot desking information
+	if (strlen($id) > 0) {
+		$sql = "update v_extensions set ";
+		$sql .= "unique_id = null, ";
+		$sql .= "dial_user = null, ";
+		$sql .= "dial_domain = null, ";
+		$sql .= "dial_string = null ";
+		$sql .= "where domain_uuid = '$domain_uuid' ";
+		$sql .= "and extension_uuid = '$id' ";
+		$prep_statement = $db->prepare(check_sql($sql));
+		$prep_statement->execute();
+		unset($prep_statement, $sql);
+	}
+
+//get the extension
+	$sql = "select extension from v_extensions ";
+	$sql .= "where domain_uuid = '$domain_uuid' ";
+	$sql .= "and extension_uuid = '$id' ";
+	$prep_statement = $db->prepare(check_sql($sql));
+	$prep_statement->execute();
+	$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+	foreach ($result as &$row) {
+		$extension = $row["extension"];
+	}
+	unset ($prep_statement);
+
+//clear the cache
+	$cache = new cache;
+	$cache->delete("directory:".$extension."@".$_SESSION['domain_name']);
+
+//redirect the user
+	$_SESSION["message"] = $text['message-delete'];
+	header("Location: index.php");
+	return;
+
+?>

+ 327 - 0
hot_desking/extension_edit.php

@@ -0,0 +1,327 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Copyright (C) 2008-2015 All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+	Luis Daniel Lucio Quiroz <[email protected]>
+*/
+include "root.php";
+require_once "resources/require.php";
+require_once "resources/check_auth.php";
+if (permission_exists('extension_add') || permission_exists('extension_edit')) {
+	//access granted
+}
+else {
+	echo "access denied";
+	exit;
+}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//set the action as an add or an update
+	if (isset($_REQUEST["id"])) {
+		$action = "update";
+		$extension_uuid = check_str($_REQUEST["id"]);
+	}
+	else {
+		$action = "add";
+	}
+
+//get the http values and set them as php variables
+	if (count($_POST) > 0) {
+		//get the values from the HTTP POST and save them as PHP variables
+		$extension_uuid = check_str($_POST["extension_uuid"]);
+		$unique_id = check_str($_POST["unique_id"]);
+		$vm_password = check_str($_POST["vm_password"]);
+		$dial_string = check_str($_POST["dial_string"]);
+	}
+
+if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+
+	//check for all required data
+		if (strlen($extension_uuid) == 0) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; }
+		if (strlen($unique_id) == 0) { $msg .= $text['message-required'].$text['label-unique_id']."<br>\n"; }
+	//get the number of rows in v_extensions
+		$sql = "select count(*) as num_rows from v_extensions ";
+		$sql .= "where unique_id = '".$unique_id."' and ";
+		$sql .= "extension_uuid <> '".$extension_uuid."'";
+		$prep_statement = $db->prepare(check_sql($sql));
+		if ($prep_statement) {
+			$prep_statement->execute();
+			$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+			if ($row['num_rows'] > 0) {
+				$msg .= $text['message-unique']."<br>\n";
+			}
+		}
+		unset($prep_statement, $result);
+		if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
+			require_once "resources/header.php";
+			require_once "resources/persist_form_var.php";
+			echo "<div align='center'>\n";
+			echo "<table><tr><td>\n";
+			echo $msg."<br />";
+			echo "</td></tr></table>\n";
+			persistformvar($_POST);
+			echo "</div>\n";
+			require_once "resources/footer.php";
+			return;
+		}
+
+	//set the default user context
+		if (if_group("superadmin")) {
+			//allow a user assigned to super admin to change the user_context
+		}
+		else {
+			//if the user_context was not set then set the default value
+			if (strlen($user_context) == 0) {
+				if (count($_SESSION["domains"]) > 1) {
+					$user_context = $_SESSION['domain_name'];
+				}
+				else {
+					$user_context = "default";
+				}
+			}
+		}
+
+	//add or update the database
+	if ($_POST["persistformvar"] != "true") {
+
+		//get the extension
+			$sql = "select * from v_extensions ";
+			$sql .= "where domain_uuid = '$domain_uuid' ";
+			$sql .= "and extension_uuid = '$extension_uuid' ";
+			$prep_statement = $db->prepare(check_sql($sql));
+			$prep_statement->execute();
+			$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+			foreach ($result as &$row) {
+				$extension = $row["extension"];
+				$number_alias = $row["number_alias"];
+			}
+			unset ($prep_statement);
+
+		//update the extension and voicemail
+			if (($action == "add" && permission_exists('extension_add')) || ($action == "update" && permission_exists('extension_edit'))) {
+				//update the extension
+					$sql = "update v_extensions set ";
+					$sql .= "unique_id = '$unique_id' ";
+					$sql .= "where domain_uuid = '$domain_uuid' ";
+					$sql .= "and extension_uuid = '$extension_uuid'";
+					$db->exec(check_sql($sql));
+					unset($sql);
+
+				//update the voicemail
+					if (strlen($vm_password) > 0) {
+						$sql = "update v_voicemails set ";
+						$sql .= "voicemail_password = '$vm_password' ";
+						$sql .= "where domain_uuid = '$domain_uuid' ";
+						if (is_numeric($extension)) {
+							$sql .= "and voicemail_id = '$extension'";
+						}
+						else {
+							$sql .= "and voicemail_id = '$number_alias'";
+						}
+						$db->exec(check_sql($sql));
+						unset($sql);
+					}
+			}
+
+		//clear the cache
+			$cache = new cache;
+			$cache->delete("directory:".$extension."@".$_SESSION['domain_name']);
+
+		//set message and redirect user
+			if ($action == "add") {
+				$_SESSION["message"] = $text['message-add'];
+			}
+			if ($action == "update") {
+				$_SESSION["message"] = $text['message-update'];
+			}
+			header("Location: index.php");
+			return;
+
+	} //if ($_POST["persistformvar"] != "true")
+} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
+
+//pre-populate the form
+	if ($_POST["persistformvar"] != "true") {
+		//get the extension data
+			$sql = "select * from v_extensions ";
+			$sql .= "where domain_uuid = '$domain_uuid' ";
+			$sql .= "and extension_uuid = '$extension_uuid' ";
+			$prep_statement = $db->prepare(check_sql($sql));
+			$prep_statement->execute();
+			$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+			foreach ($result as &$row) {
+				$extension = $row["extension"];
+				$dial_string = $row["dial_string"];
+				$unique_id = $row["unique_id"];
+			}
+			unset ($prep_statement);
+
+		//get the voicemail data
+			$sql = "select * from v_voicemails ";
+			$sql .= "where domain_uuid = '$domain_uuid' ";
+			if (is_numeric($extension)) {
+				$sql .= "and voicemail_id = '$extension' ";
+			}
+			else {
+				$sql .= "and voicemail_id = '$number_alias' ";
+			}
+			//$sql .= "and voicemail_enabled = 'true' ";
+			$prep_statement = $db->prepare(check_sql($sql));
+			$prep_statement->execute();
+			$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+			foreach ($result as &$row) {
+				$vm_password = $row["voicemail_password"];
+			}
+			unset ($prep_statement);
+	}
+
+//set the defaults
+	if (strlen($limit_max) == 0) { $limit_max = '5'; }
+
+//begin the page content
+	require_once "resources/header.php";
+
+	echo "<script type=\"text/javascript\" language=\"JavaScript\">\n";
+	echo "\n";
+	echo "function enable_change(enable_over) {\n";
+	echo "	var endis;\n";
+	echo "	endis = !(document.iform.enable.checked || enable_over);\n";
+	echo "	document.iform.range_from.disabled = endis;\n";
+	echo "	document.iform.range_to.disabled = endis;\n";
+	echo "}\n";
+	echo "\n";
+	echo "function show_advanced_config() {\n";
+	echo "	document.getElementById(\"show_advanced_box\").innerHTML='';\n";
+	echo "	aodiv = document.getElementById('show_advanced');\n";
+	echo "	aodiv.style.display = \"block\";\n";
+	echo "}\n";
+	echo "\n";
+	echo "function hide_advanced_config() {\n";
+	echo "	document.getElementById(\"show_advanced_box\").innerHTML='';\n";
+	echo "	aodiv = document.getElementById('show_advanced');\n";
+	echo "	aodiv.style.display = \"none\";\n";
+	echo "}\n";
+	echo "</script>";
+
+	echo "<form method='post' name='frm' action=''>\n";
+	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+	echo "<tr>\n";
+	echo "	<td width='30%' nowrap='nowrap' align='left' valign='top'>\n";
+	echo "		<b>".$text['header-hot_desking']."</b>\n";
+	echo "	</td>\n";
+	echo "	<td width='70%' align='right' valign='top'>\n";
+	echo "		<input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='index.php'\" value='".$text['button-back']."'>\n";
+	echo "		<input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
+	echo "	</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "    ".$text['label-extension']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' align='left'>\n";
+	if ($action == "add") {
+		echo "<select id=\"extension_uuid\" name=\"extension_uuid\" class='formfld' \">\n";
+		echo "<option value=''></option>\n";
+		$sql = "select extension, extension_uuid, description FROM v_extensions ";
+		$sql .= "where domain_uuid = '$domain_uuid' ";
+		$sql .= "order by extension asc ";
+		$prep_statement = $db->prepare(check_sql($sql));
+		$prep_statement->execute();
+		$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+		$result_count = count($result);
+		if ($result_count > 0) {
+			foreach($result as $row) {
+				if ($extension_uuid == $row['extension_uuid']) {
+					echo "<option value=\"".$row['extension_uuid']."\" selected>".$row['extension']." ".$row['description']."</option>\n";
+				}
+				else {
+					echo "<option value=\"".$row['extension_uuid']."\">".$row['extension']." ".$row['description']."</option>\n";
+				}
+			}
+		}
+		unset($sql, $result, $result_count);
+		echo  "</select><br />\n";
+		echo $text['description-extension-add']."\n";
+	}
+	if ($action == "update") {
+		echo "    $extension<br />\n";
+		echo $text['description-extension-edit']."\n";
+	}
+	echo "<br />\n";
+
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "    ".$text['label-unique_id']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' align='left'>\n";
+	echo "    <input class='formfld' type='number' name='unique_id' autocomplete='off' maxlength='255' min='0' step='1' required='required' value=\"$unique_id\">\n";
+	echo "<br />\n";
+	echo $text['description-unique_id']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	if ($action == "update") {
+		echo "<tr>\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "    ".$text['label-voicemail_password']."\n";
+		echo "</td>\n";
+		echo "<td class='vtable' align='left'>\n";
+		echo "    <input class='formfld' type='password' name='vm_password' id='vm_password' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='255' value='$vm_password'>\n";
+		echo "    <br />\n";
+		echo "    ".$text['description-voicemail_password']."\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+
+		echo "<tr>\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "    ".$text['label-dial_string']."\n";
+		echo "</td>\n";
+		echo "<td class='vtable' align='left'>\n";
+		echo "    <input class='formfld' type='text' name='dial_string' maxlength='255' value=\"$dial_string\">\n";
+		echo "<br />\n";
+		echo $text['description-dial_string']."\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+
+		echo "<input type='hidden' name='extension_uuid' maxlength='255' value=\"$extension_uuid\">\n";
+	}
+
+	echo "<tr>\n";
+	echo "<td colspan='2' align='right'>\n";
+	echo "	<br>";
+	echo "	<input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "</table>";
+	echo "<br><br>";
+	echo "</form>";
+
+require_once "resources/footer.php";
+?>

+ 176 - 0
hot_desking/index.php

@@ -0,0 +1,176 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+include "root.php";
+require_once "resources/require.php";
+require_once "resources/check_auth.php";
+if (permission_exists('extension_view')) {
+	//access granted
+}
+else {
+	echo "access denied";
+	exit;
+}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//includes and title
+	require_once "resources/header.php";
+	$document['title'] = $text['title-hot_desking'];
+	require_once "resources/paging.php";
+
+//get the http values and set them as variables
+	if (isset($_GET["order_by"])) {
+		$order_by = check_str($_GET["order_by"]);
+		$order = check_str($_GET["order"]);
+	}
+
+//show the content
+	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
+	echo "  <tr>\n";
+	echo "	<td align='left'><b>".$text['header-hot_desking']."</b><br>\n";
+	echo "		".$text['description-hot_desking']."\n";
+	echo "	</td>\n";
+	echo "  </tr>\n";
+	echo "</table>\n";
+	echo "<br />";
+
+	//get the number of rows in v_extensions
+		$sql = "select count(*) as num_rows from v_extensions ";
+		$sql .= "where domain_uuid = '$domain_uuid' ";
+		$sql .= "and unique_id is not null ";
+		$prep_statement = $db->prepare(check_sql($sql));
+		if ($prep_statement) {
+			$prep_statement->execute();
+			$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+			if ($row['num_rows'] > 0) {
+				$num_rows = $row['num_rows'];
+			}
+			else {
+				$num_rows = '0';
+			}
+		}
+		unset($prep_statement, $result);
+
+	//prepare to page the results
+		$rows_per_page = 150;
+		$param = "";
+		if (!isset($_GET['page'])) { $_GET['page'] = 0; }
+		$_GET['page'] = check_str($_GET['page']);
+		list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
+		$offset = $rows_per_page * $_GET['page'];
+
+	//get the extension list
+		$sql = "select * from v_extensions ";
+		$sql .= "where domain_uuid = '$domain_uuid' ";
+		$sql .= "and unique_id is not null ";
+		if (isset($order_by)) {
+			$sql .= "order by $order_by $order ";
+		}
+		else {
+			$sql .= "order by extension asc ";
+		}
+		$sql .= " limit $rows_per_page offset $offset ";
+		$prep_statement = $db->prepare(check_sql($sql));
+		$prep_statement->execute();
+		$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+		$result_count = count($result);
+		unset ($prep_statement, $sql);
+
+		$c = 0;
+		$row_style["0"] = "row_style0";
+		$row_style["1"] = "row_style1";
+
+		echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+		echo "<tr>\n";
+		echo th_order_by('extension', $text['label-extension'], $order_by, $order);
+		echo th_order_by('unique_id', $text['label-unique_id'], $order_by, $order);
+		echo th_order_by('dial_user', $text['label-forward_to'], $order_by, $order);
+		echo th_order_by('description', $text['label-description'], $order_by, $order);
+		echo "<td class='list_control_icons'>";
+		if (permission_exists('extension_add')) {
+			echo "<a href='extension_edit.php' alt='".$text['message-add']."'>$v_link_label_add</a>";
+		}
+		echo "</td>\n";
+		echo "</tr>\n";
+
+		if ($result_count > 0) {
+			foreach($result as $row) {
+				$tr_link = (permission_exists('extension_edit')) ? "href='extension_edit.php?id=".$row['extension_uuid']."'" : null;
+				echo "<tr ".$tr_link.">\n";
+				echo "	<td valign='top' class='".$row_style[$c]."'>";
+				if (permission_exists('extension_edit')) {
+					echo "<a href='extension_edit.php?id=".$row['extension_uuid']."'>".$row['extension']."</a>";
+				}
+				else {
+					echo $row['extension'];
+				}
+				echo "	</td>\n";
+				echo "	<td valign='top' class='".$row_style[$c]."'>".$row['unique_id']."&nbsp;</td>\n";
+				if (strlen($row['dial_user']) > 0) {
+					echo "	<td valign='top' class='".$row_style[$c]."'>".$row['dial_user']."@".$row['dial_domain']."&nbsp;</td>\n";
+				}
+				else {
+					echo "	<td valign='top' class='".$row_style[$c]."'>&nbsp;</td>\n";
+				}
+				echo "	<td valign='top' class='row_stylebg' width='30%'>".$row['description']."&nbsp;</td>\n";
+				echo "	<td class='list_control_icons'>";
+				if (permission_exists('extension_edit')) {
+					echo "<a href='extension_edit.php?id=".$row['extension_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
+				}
+				if (permission_exists('extension_delete')) {
+					echo "<a href='extension_delete.php?id=".$row['extension_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
+				}
+				echo "	</td>\n";
+				echo "</tr>\n";
+				if ($c==0) { $c=1; } else { $c=0; }
+			} //end foreach
+			unset($sql, $result, $row_count);
+		} //end if results
+
+		echo "<tr>\n";
+		echo "<td colspan='6' align='left'>\n";
+		echo "	<table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
+		echo "	<tr>\n";
+		echo "		<td width='33.3%' nowrap>&nbsp;</td>\n";
+		echo "		<td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
+		echo "		<td class='list_control_icons'>";
+		if (permission_exists('extension_add')) {
+			echo 		"<a href='extension_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
+		}
+		echo "		</td>\n";
+		echo "	</tr>\n";
+		echo "	</table>\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+
+		echo "</table>";
+		echo "<br><br>";
+
+//show the footer
+	require_once "resources/footer.php";
+?>

+ 8 - 0
hot_desking/resources/switch/conf/dialplan/470_hot-desk-login.xml

@@ -0,0 +1,8 @@
+<context name="{v_context}">
+	<extension name="hot-desk-login" number="*072" continue="false" app_uuid="89aec992-e3bb-43a1-a64b-ca70800e30fd" enabled="false">
+		<condition field="destination_number" expression="^\*072$" >
+			<action application="set" data="direction=in" />
+			<action application="lua" data="dial_string.lua" />
+		</condition>
+	</extension>
+</context>

+ 8 - 0
hot_desking/resources/switch/conf/dialplan/475_hot-desk-logout.xml

@@ -0,0 +1,8 @@
+<context name="{v_context}">
+	<extension name="hot-desk-logout" number="*073" continue="false" app_uuid="97e920d9-dddc-458f-bae0-837a48c3f401" enabled="false">
+		<condition field="destination_number" expression="^\*073$" >
+			<action application="set" data="direction=out" />
+			<action application="lua" data="dial_string.lua" />
+		</condition>
+	</extension>
+</context>

+ 50 - 0
hot_desking/root.php

@@ -0,0 +1,50 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+// make sure the PATH_SEPARATOR is defined
+	if (!defined("PATH_SEPARATOR")) {
+		if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
+	}
+
+// make sure the document_root is set
+	$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
+	$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
+	$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
+	//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
+	//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
+	//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
+
+// if the project directory exists then add it to the include path otherwise add the document root to the include path
+	if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
+		if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
+		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
+	}
+	else {
+		if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
+		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
+	}
+
+?>