Merge pull request #1252 from mafoo/Install_Rewrite

Install rewrite
This commit is contained in:
FusionPBX 2015-11-25 07:35:50 -08:00
commit e16cd92558
18 changed files with 3458 additions and 2323 deletions

View File

@ -0,0 +1,28 @@
<?php
//application details
$apps[$x]['name'] = "Install";
$apps[$x]['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f";
$apps[$x]['category'] = "Core";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Install the fuisionPBX system or add new switches";
$apps[$x]['description']['es-cl'] = "";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "";
$apps[$x]['description']['fr-ca'] = "";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "";
$apps[$x]['description']['pt-br'] = "";
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = "install";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
?>

View File

@ -0,0 +1,568 @@
<?php
$text['title-install_first_time']['en-us'] = "First Time Install";
$text['title-install_first_time']['es-cl'] = "";
$text['title-install_first_time']['pt-pt'] = "";
$text['title-install_first_time']['fr-fr'] = "";
$text['title-install_first_time']['pt-br'] = "";
$text['title-install_first_time']['pl'] = "";
$text['title-install_first_time']['sv-se'] = "";
$text['title-install_first_time']['uk'] = "";
$text['title-install_first_time']['de-at'] = "";
$text['title-install_first_time']['ar-eg'] = "";
$text['title-detected_configuration']['en-us'] = "Detected Configuration";
$text['title-detected_configuration']['es-cl'] = "";
$text['title-detected_configuration']['pt-pt'] = "";
$text['title-detected_configuration']['fr-fr'] = "";
$text['title-detected_configuration']['pt-br'] = "";
$text['title-detected_configuration']['pl'] = "";
$text['title-detected_configuration']['sv-se'] = "";
$text['title-detected_configuration']['uk'] = "";
$text['title-detected_configuration']['de-at'] = "";
$text['title-detected_configuration']['ar-eg'] = "";
$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']['pl'] = "Zaktualizowano poprawnie";
$text['message-update']['sv-se'] = "Uppdatering Klar";
$text['message-update']['uk'] = "Оновлення завершено";
$text['message-update']['de-at'] = "Aktualisierung durchgeführt";
$text['message-update']['ar-eg'] = "اكتمال التحديث";
$text['message-required']['en-us'] = "Please provide: ";
$text['message-required']['es-cl'] = "Por favor indique: ";
$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']['pl'] = "Wpisz:";
$text['message-required']['sv-se'] = "Var god uppge:";
$text['message-required']['uk'] = "Будь ласка, вкажіть:";
$text['message-required']['de-at'] = "Bitte geben Sie folgendes an:";
$text['message-required']['ar-eg'] = "من فضلك أدخل";
$text['message-message']['en-us'] = "Message";
$text['message-message']['es-cl'] = "Mensaje";
$text['message-message']['pt-pt'] = "Mensagem";
$text['message-message']['fr-fr'] = "Message";
$text['message-message']['pt-br'] = "Mensagem";
$text['message-message']['pl'] = "Wiadomość";
$text['message-message']['sv-se'] = "Meddelande";
$text['message-message']['uk'] = "Повідомлення";
$text['message-message']['de-at'] = "Nachricht";
$text['message-message']['ar-eg'] = "رسالة";
$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']['pl'] = "Usunięto poprawnie";
$text['message-delete']['sv-se'] = "Borttagning Klar";
$text['message-delete']['uk'] = "Видалено";
$text['message-delete']['de-at'] = "Erfolgreich gelöscht";
$text['message-delete']['ar-eg'] = "تم المسح";
$text['label-ft-install']['en-us'] = "First Time Install";
$text['description-ft-install']['en-us'] = "Perform all actions for a First Time Install";
$text['label-add-switch']['en-us'] = "Add a new switch";
$text['description-add-switch']['en-us'] = "Add a new switch";
$text['label-select_language']['en-us'] = "Language";
$text['label-select_language']['es-cl'] = "";
$text['label-select_language']['pt-pt'] = "";
$text['label-select_language']['fr-fr'] = "";
$text['label-select_language']['pt-br'] = "";
$text['label-select_language']['pl'] = "";
$text['label-select_language']['sv-se'] = "";
$text['label-select_language']['uk'] = "";
$text['label-select_language']['de-at'] = "";
$text['label-select_language']['ar-eg'] = "";
$text['label-event_host']['en-us'] = "Host/IP";
$text['label-event_host']['es-cl'] = "";
$text['label-event_host']['pt-pt'] = "";
$text['label-event_host']['fr-fr'] = "";
$text['label-event_host']['pt-br'] = "";
$text['label-event_host']['pl'] = "";
$text['label-event_host']['sv-se'] = "";
$text['label-event_host']['uk'] = "";
$text['label-event_host']['de-at'] = "";
$text['label-event_host']['ar-eg'] = "";
$text['label-event_port']['en-us'] = "Port";
$text['label-event_port']['es-cl'] = "Puerto";
$text['label-event_port']['pt-pt'] = "Porto";
$text['label-event_port']['fr-fr'] = "Port";
$text['label-event_port']['pt-br'] = "Porta";
$text['label-event_port']['pl'] = "Port";
$text['label-event_port']['sv-se'] = "Port";
$text['label-event_port']['uk'] = "Порт";
$text['label-event_port']['de-at'] = "Port";
$text['label-event_port']['ar-eg'] = "منفذ";
$text['label-event_password']['en-us'] = "Password";
$text['label-event_password']['es-cl'] = "Contreseña";
$text['label-event_password']['pt-pt'] = "Palavra-Chave";
$text['label-event_password']['fr-fr'] = "Mot de Passe";
$text['label-event_password']['pt-br'] = "Senha";
$text['label-event_password']['pl'] = "Hasło";
$text['label-event_password']['sv-se'] = "Lösenord";
$text['label-event_password']['uk'] = "Пароль";
$text['label-event_password']['de-at'] = "Passwort";
$text['label-event_password']['ar-eg'] = "كلمة السر";
$text['label-username']['en-us'] = "Username";
$text['label-username']['es-cl'] = "Nombre de usuario";
$text['label-username']['pt-pt'] = "Utilizador";
$text['label-username']['fr-fr'] = "Utilisateur";
$text['label-username']['pt-br'] = "Nome do Usuário";
$text['label-username']['pl'] = "Użytkownik";
$text['label-username']['sv-se'] = "Användarnamn";
$text['label-username']['uk'] = "Ім’я користувача";
$text['label-username']['de-at'] = "Benutzername";
$text['label-username']['ar-eg'] = "اسم المستخدم";
$text['label-type']['en-us'] = "Type";
$text['label-type']['es-cl'] = "Tipo";
$text['label-type']['pt-pt'] = "Tipo";
$text['label-type']['fr-fr'] = "Type";
$text['label-type']['pt-br'] = "Tipo";
$text['label-type']['pl'] = "Typ";
$text['label-type']['sv-se'] = "Typ";
$text['label-type']['uk'] = "Тип";
$text['label-type']['de-at'] = "Typ";
$text['label-type']['ar-eg'] = "النوع";
$text['label-port']['en-us'] = "Port";
$text['label-port']['es-cl'] = "Puerto";
$text['label-port']['pt-pt'] = "Porto";
$text['label-port']['fr-fr'] = "Port";
$text['label-port']['pt-br'] = "Porta";
$text['label-port']['pl'] = "Port";
$text['label-port']['sv-se'] = "Port";
$text['label-port']['uk'] = "Порт";
$text['label-port']['de-at'] = "Port";
$text['label-port']['ar-eg'] = "منفذ";
$text['label-path']['en-us'] = "Path";
$text['label-path']['es-cl'] = "Ruta";
$text['label-path']['pt-pt'] = "Caminho";
$text['label-path']['fr-fr'] = "Chemin";
$text['label-path']['pt-br'] = "Caminho";
$text['label-path']['pl'] = "Ścieżka";
$text['label-path']['sv-se'] = "Sökväg";
$text['label-path']['uk'] = "Шлях";
$text['label-path']['de-at'] = "Pfad";
$text['label-path']['ar-eg'] = "";
$text['label-password']['en-us'] = "Password";
$text['label-password']['es-cl'] = "Contreseña";
$text['label-password']['pt-pt'] = "Palavra-Chave";
$text['label-password']['fr-fr'] = "Mot de Passe";
$text['label-password']['pt-br'] = "Senha";
$text['label-password']['pl'] = "Hasło";
$text['label-password']['sv-se'] = "Lösenord";
$text['label-password']['uk'] = "Пароль";
$text['label-password']['de-at'] = "Passwort";
$text['label-password']['ar-eg'] = "كلمة السر";
$text['label-name']['en-us'] = "Name";
$text['label-name']['es-cl'] = "Nombre";
$text['label-name']['pt-pt'] = "Nome";
$text['label-name']['fr-fr'] = "Nom";
$text['label-name']['pt-br'] = "Nome";
$text['label-name']['pl'] = "Nazwa";
$text['label-name']['sv-se'] = "Namn";
$text['label-name']['uk'] = "Назва";
$text['label-name']['de-at'] = "Name";
$text['label-name']['ar-eg'] = "الأسم";
$text['label-host']['en-us'] = "Host";
$text['label-host']['es-cl'] = "Host";
$text['label-host']['pt-pt'] = "Máquina";
$text['label-host']['fr-fr'] = "Hôte";
$text['label-host']['pt-br'] = "Máquina";
$text['label-host']['pl'] = "Host";
$text['label-host']['sv-se'] = "Värd";
$text['label-host']['uk'] = "Хост";
$text['label-host']['de-at'] = "Host";
$text['label-host']['ar-eg'] = "مضيف";
$text['label-driver']['en-us'] = "Driver";
$text['label-driver']['es-cl'] = "Controlador";
$text['label-driver']['pt-pt'] = "Driver";
$text['label-driver']['fr-fr'] = "Driver";
$text['label-driver']['pt-br'] = "Driver";
$text['label-driver']['pl'] = "Sterownik";
$text['label-driver']['sv-se'] = "Drivrutin";
$text['label-driver']['uk'] = "Драйвер";
$text['label-driver']['de-at'] = "Treiber";
$text['label-driver']['ar-eg'] = "";
$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']['pl'] = "Opis";
$text['label-description']['sv-se'] = "Beskrivning";
$text['label-description']['uk'] = "Опис";
$text['label-description']['de-at'] = "Beschreibung";
$text['label-description']['ar-eg'] = "الوصف";
$text['header-install']['en-us'] = "Install";
$text['header-install']['es-cl'] = "";
$text['header-install']['pt-pt'] = "";
$text['header-install']['fr-fr'] = "";
$text['header-install']['pt-br'] = "";
$text['header-install']['pl'] = "";
$text['header-install']['sv-se'] = "";
$text['header-install']['uk'] = "";
$text['header-install']['de-at'] = "";
$text['header-install']['ar-eg'] = "";
$text['header-select_language']['en-us'] = "Select Language";
$text['header-select_language']['es-cl'] = "";
$text['header-select_language']['pt-pt'] = "";
$text['header-select_language']['fr-fr'] = "";
$text['header-select_language']['pt-br'] = "";
$text['header-select_language']['pl'] = "";
$text['header-select_language']['sv-se'] = "";
$text['header-select_language']['uk'] = "";
$text['header-select_language']['de-at'] = "";
$text['header-select_language']['ar-eg'] = "";
$text['header-event_socket']['en-us'] = "Event Socket Configuration";
$text['header-event_socket']['es-cl'] = "";
$text['header-event_socket']['pt-pt'] = "";
$text['header-event_socket']['fr-fr'] = "";
$text['header-event_socket']['pt-br'] = "";
$text['header-event_socket']['pl'] = "";
$text['header-event_socket']['sv-se'] = "";
$text['header-event_socket']['uk'] = "";
$text['header-event_socket']['de-at'] = "";
$text['header-event_socket']['ar-eg'] = "";
$text['header-config_detail']['en-us'] = "Admin Configuration";
$text['header-config_detail']['es-cl'] = "";
$text['header-config_detail']['pt-pt'] = "";
$text['header-config_detail']['fr-fr'] = "";
$text['header-config_detail']['pt-br'] = "";
$text['header-config_detail']['pl'] = "";
$text['header-config_detail']['sv-se'] = "";
$text['header-config_detail']['uk'] = "";
$text['header-config_detail']['de-at'] = "";
$text['header-config_detail']['ar-eg'] = "";
$text['header-config_database']['en-us'] = "Database Configuration";
$text['header-config_database']['es-cl'] = "";
$text['header-config_database']['pt-pt'] = "";
$text['header-config_database']['fr-fr'] = "";
$text['header-config_database']['pt-br'] = "";
$text['header-config_database']['pl'] = "";
$text['header-config_database']['sv-se'] = "";
$text['header-config_database']['uk'] = "";
$text['header-config_database']['de-at'] = "";
$text['header-config_database']['ar-eg'] = "";
$text['header-installing']['en-us'] = "Executing Install";
$text['header-installing']['es-cl'] = "";
$text['header-installing']['pt-pt'] = "";
$text['header-installing']['fr-fr'] = "";
$text['header-installing']['pt-br'] = "";
$text['header-installing']['pl'] = "";
$text['header-installing']['sv-se'] = "";
$text['header-installing']['uk'] = "";
$text['header-installing']['de-at'] = "";
$text['header-installing']['ar-eg'] = "";
$text['description-event_host']['en-us'] = "Enter the event socket host name/IP.";
$text['description-event_host']['es-cl'] = "";
$text['description-event_host']['pt-pt'] = "";
$text['description-event_host']['fr-fr'] = "";
$text['description-event_host']['pt-br'] = "";
$text['description-event_host']['pl'] = "";
$text['description-event_host']['sv-se'] = "";
$text['description-event_host']['uk'] = "";
$text['description-event_host']['de-at'] = "";
$text['description-event_host']['ar-eg'] = "";
$text['description-event_port']['en-us'] = "Enter the event socket port number.";
$text['description-event_port']['es-cl'] = "";
$text['description-event_port']['pt-pt'] = "";
$text['description-event_port']['fr-fr'] = "";
$text['description-event_port']['pt-br'] = "";
$text['description-event_port']['pl'] = "";
$text['description-event_port']['sv-se'] = "";
$text['description-event_port']['uk'] = "";
$text['description-event_port']['de-at'] = "";
$text['description-event_port']['ar-eg'] = "";
$text['description-event_password']['en-us'] = "Enter the event socket password.";
$text['description-event_password']['es-cl'] = "";
$text['description-event_password']['pt-pt'] = "";
$text['description-event_password']['fr-fr'] = "";
$text['description-event_password']['pt-br'] = "";
$text['description-event_password']['pl'] = "";
$text['description-event_password']['sv-se'] = "";
$text['description-event_password']['uk'] = "";
$text['description-event_password']['de-at'] = "";
$text['description-event_password']['ar-eg'] = "";
$text['description-username']['en-us'] = "Enter the database username.";
$text['description-username']['es-cl'] = "Ingrese el nombre de usuario de la base de datos.";
$text['description-username']['pt-pt'] = "Introduza o utilizador da base de dados.";
$text['description-username']['fr-fr'] = "Entrer le nom d'utilisateur de la Base de données.";
$text['description-username']['pt-br'] = "Insira o nome do usuário";
$text['description-username']['pl'] = "Wprowadź nazwę użytkownika";
$text['description-username']['sv-se'] = "Ange databasen användarnamn här.";
$text['description-username']['uk'] = "Введіть ім’я користувача бази даних";
$text['description-username']['de-at'] = "Geben Sie den Datenbank Benutzernamen an.";
$text['description-username']['ar-eg'] = "أدخل اسم المستخدم هنا";
$text['description-type']['en-us'] = "Select the database type.";
$text['description-type']['es-cl'] = "Seleccione el tipo de base de datos";
$text['description-type']['pt-pt'] = "Escolha o tipo de base de dados.";
$text['description-type']['fr-fr'] = "Choisir le type de Base de données.";
$text['description-type']['pt-br'] = "Introduza o tipo de definição.";
$text['description-type']['pl'] = "Wprowadź rodzaj bazy danych";
$text['description-type']['sv-se'] = "Välj databastyp";
$text['description-type']['uk'] = "Виберіть тип бази даних";
$text['description-type']['de-at'] = "Wählen Sie den Datenbank Typ.";
$text['description-type']['ar-eg'] = "إختر نوع قاعدة البيانات";
$text['description-port']['en-us'] = "Enter the port number.";
$text['description-port']['es-cl'] = "Ingrese el número del puerto.";
$text['description-port']['pt-pt'] = "Introduza o número do porto.";
$text['description-port']['fr-fr'] = "Entrer le numéro de port.";
$text['description-port']['pt-br'] = "Insira o número da porta";
$text['description-port']['pl'] = "Wprowadź numer portu";
$text['description-port']['sv-se'] = "Ange portnummer";
$text['description-port']['uk'] = "Введіть номер порта";
$text['description-port']['de-at'] = "Geben Sie die Port Nummer an.";
$text['description-port']['ar-eg'] = "أدخل رقم المنفذ";
$text['description-path']['en-us'] = "Enter the database file path (SQLite only).";
$text['description-path']['es-cl'] = "Ingrese la ruta al archivo de datos (solo SQLite).";
$text['description-path']['pt-pt'] = "Introduza o caminho da base de dados (apenas SQLite)";
$text['description-path']['fr-fr'] = "Entrer le chemin du fichier Base de données (Spécifique SQLite).";
$text['description-path']['pt-br'] = "Insira o caminho da base de dados (SQLite)";
$text['description-path']['pl'] = "Wprowadź ścieżkę do pliku bazy danych (tylko SQLite)";
$text['description-path']['sv-se'] = "Ange databasens sökväg (gäller endast SQLite).";
$text['description-path']['uk'] = "Вкажіть шлях до файлу бази даних (тільки SQLite).";
$text['description-path']['de-at'] = "Geben Sie den Datenbank Pfad an (nur für SQLite).";
$text['description-path']['ar-eg'] = "";
$text['description-password']['en-us'] = "Enter the database password.";
$text['description-password']['es-cl'] = "Ingrese la contraseña de la base de datos.";
$text['description-password']['pt-pt'] = "Introduza a palavra-chave da base de dados.";
$text['description-password']['fr-fr'] = "Entrer le mot de passe pour la Base de données.";
$text['description-password']['pt-br'] = "Introduza a senha";
$text['description-password']['pl'] = "Wpisz hasło";
$text['description-password']['sv-se'] = "Ange databasens lösenord.";
$text['description-password']['uk'] = "Введіть пароль бази даних.";
$text['description-password']['de-at'] = "Geben Sie das Datenbank Passwort ein.";
$text['description-password']['ar-eg'] = "أدخل الرقم السري الخاص بقاعدة البيانات";
$text['description-name']['en-us'] = "Enter the database name.";
$text['description-name']['es-cl'] = "Ingrese el nombre de la base de datos.";
$text['description-name']['pt-pt'] = "Introduza o nome da base de dados.";
$text['description-name']['fr-fr'] = "Entrer le nom de la Base de données.";
$text['description-name']['pt-br'] = "Insira o nome do menu";
$text['description-name']['pl'] = "Wprowadź nazwę bazy danych.";
$text['description-name']['sv-se'] = "Ange databasens namn.";
$text['description-name']['uk'] = "Введіть ім'я бази даних.";
$text['description-name']['de-at'] = "Geben Sie den Namen der Datenbank an";
$text['description-name']['ar-eg'] = "أدخل إسم قاعدة البيانات";
$text['description-host']['en-us'] = "Enter the host name.";
$text['description-host']['es-cl'] = "Ingrese el nombre de host";
$text['description-host']['pt-pt'] = "Introduza o nome da máquina.";
$text['description-host']['fr-fr'] = "Entrer le nom de l'hôte.";
$text['description-host']['pt-br'] = "Insira o nome da máquina ";
$text['description-host']['pl'] = "Wprowadź nazwę hosta.";
$text['description-host']['sv-se'] = "Ange värdnamnet";
$text['description-host']['uk'] = "Введіть ім'я хоста.";
$text['description-host']['de-at'] = "Geben Sie den Host Namen ein.";
$text['description-host']['ar-eg'] = "أدخل إسم المضيف";
$text['description-driver']['en-us'] = "Select the database driver.";
$text['description-driver']['es-cl'] = "Seleccione un controlador de base de datos.";
$text['description-driver']['pt-pt'] = "Escolha o driver da base de dados";
$text['description-driver']['fr-fr'] = "Choisir le driver de la Base de données.";
$text['description-driver']['pt-br'] = "Escolha o driver da base de dados";
$text['description-driver']['pl'] = "Wybierz sterownik bazy danych.";
$text['description-driver']['sv-se'] = "Välj databas drivrutin.";
$text['description-driver']['uk'] = "Виберіть драйвер бази даних.";
$text['description-driver']['de-at'] = "Wählen Sie den Datenbank Treiber.";
$text['description-driver']['ar-eg'] = "";
$text['description-description']['en-us'] = "Enter a description for this database, if desired.";
$text['description-description']['es-cl'] = "Ingrese una descripción para esta base de datos, opcional.";
$text['description-description']['pt-pt'] = "Introduza a descrição para a base de dados (opcional).";
$text['description-description']['fr-fr'] = "Entrer une description pour cette Base de données. (optionnel)";
$text['description-description']['pt-br'] = "Insira a descrição, caso desejar";
$text['description-description']['pl'] = "Wprowadź opis bazy danych (opcjonalne)";
$text['description-description']['sv-se'] = "Fyll i en beskrivning för denna databas, om nödvändigt.";
$text['description-description']['uk'] = "Введіть опис, якщо це необхідно.";
$text['description-description']['de-at'] = "Falls gewünscht, geben Sie eine Beschreibung an.";
$text['description-description']['ar-eg'] = "";
$text['description-install']['en-us'] = "Select the action below you wish to perform.";
$text['description-install']['es-cl'] = "Seleccione las accion a continuación que desea realizar.";
$text['description-install']['pt-pt'] = "Selecione as ações abaixo você deseja executar."; //action signular needed
$text['description-install']['fr-fr'] = "Sélectionnez les action ci-dessous que vous souhaitez effectuer.";
$text['description-install']['pt-br'] = "Seleciona as ações abaixo que deseja executar "; //action signular needed
$text['description-install']['pl'] = "Wybierz opcje, które chcesz wykonać."; //action signular needed
$text['description-install']['sv-se'] = "Välj de åtgärder nedan som du vill utföra."; //action signular needed
$text['description-install']['uk'] = "Виберіть об’єкти для оновлення"; //action signular needed
$text['description-install']['de-at'] = "Wählen Sie eine Aktion."; //action signular needed
$text['description-database-edit']['en-us'] = "Database connection information.";
$text['description-database-edit']['es-cl'] = "Información de conexión a base de datos.";
$text['description-database-edit']['pt-pt'] = "Informação da ligação à base de dados.";
$text['description-database-edit']['fr-fr'] = "Informations de connexion à la Base";
$text['description-database-edit']['pt-br'] = "Informações da ligação na base de dados";
$text['description-database-edit']['pl'] = "Informacje o połączeniach z bazą danych.";
$text['description-database-edit']['sv-se'] = "Information om Databasanslutning";
$text['description-database-edit']['uk'] = "інформація про підключення до бази даних.";
$text['description-database-edit']['de-at'] = "Datenbank Verbindungs Information.";
$text['description-database-edit']['ar-eg'] = "بيانات الإتصال الخاص بقاعدة البيانات";
$text['description-database-add']['en-us'] = "Database connection information.";
$text['description-database-add']['es-cl'] = "Información de conexión a base de datos.";
$text['description-database-add']['pt-pt'] = "Informação da ligação à base de dados.";
$text['description-database-add']['fr-fr'] = "Informations de connexion à la Base.";
$text['description-database-add']['pt-br'] = "Informações da ligação na base de dados";
$text['description-database-add']['pl'] = "Informacje o połączeniach z bazą danych.";
$text['description-database-add']['sv-se'] = "Information om Databasanslutning";
$text['description-database-add']['uk'] = "інформація про підключення до бази даних.";
$text['description-database-add']['de-at'] = "Datenbank Verbindungs Information.";
$text['description-database-add']['ar-eg'] = "بيانات الإتصال الخاص بقاعدة البيانات";
$text['description-select_language']['en-us'] = "Please select the language you want to use";
$text['description-select_language']['es-cl'] = "";
$text['description-select_language']['pt-pt'] = "";
$text['description-select_language']['fr-fr'] = "";
$text['description-select_language']['pt-br'] = "";
$text['description-select_language']['pl'] = "";
$text['description-select_language']['sv-se'] = "";
$text['description-select_language']['uk'] = "";
$text['description-select_language']['de-at'] = "";
$text['description-select_language']['ar-eg'] = "";
$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']['pl'] = "Czy na pewno chcesz to usunąć?";
$text['confirm-delete']['sv-se'] = "Vill du verkligen ta bort detta?";
$text['confirm-delete']['uk'] = "Ви дійсно бажаєте це видалити?";
$text['confirm-delete']['de-at'] = "Wollen Sie das wirklich löschen?";
$text['confirm-delete']['ar-eg'] = "هل تريد حقا مسح هذا؟";
$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']['pl'] = "Zachowaj";
$text['button-save']['sv-se'] = "Spara";
$text['button-save']['uk'] = "Зберегти";
$text['button-save']['de-at'] = "Speichern";
$text['button-save']['ar-eg'] = "حفظ";
$text['button-next']['en-us'] = "Next";
$text['button-next']['es-cl'] = "";
$text['button-next']['pt-pt'] = "";
$text['button-next']['fr-fr'] = "";
$text['button-next']['pt-br'] = "";
$text['button-next']['pl'] = "";
$text['button-next']['sv-se'] = "";
$text['button-next']['uk'] = "";
$text['button-next']['de-at'] = "";
$text['button-next']['ar-eg'] = "";
$text['button-detect']['en-us'] = "Detect Configuration";
$text['button-detect']['es-cl'] = "";
$text['button-detect']['pt-pt'] = "";
$text['button-detect']['fr-fr'] = "";
$text['button-detect']['pt-br'] = "";
$text['button-detect']['pl'] = "";
$text['button-detect']['sv-se'] = "";
$text['button-detect']['uk'] = "";
$text['button-detect']['de-at'] = "";
$text['button-detect']['ar-eg'] = "";
$text['button-select']['en-us'] = "Select";
$text['button-select']['es-cl'] = "";
$text['button-select']['pt-pt'] = "";
$text['button-select']['fr-fr'] = "";
$text['button-select']['pt-br'] = "";
$text['button-select']['pl'] = "";
$text['button-select']['sv-se'] = "";
$text['button-select']['uk'] = "";
$text['button-select']['de-at'] = "";
$text['button-select']['ar-eg'] = "";
$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']['pl'] = "Edytuj";
$text['button-edit']['sv-se'] = "Editera";
$text['button-edit']['uk'] = "Редагувати";
$text['button-edit']['de-at'] = "Bearbeiten";
$text['button-edit']['ar-eg'] = "تعديل";
$text['button-delete']['en-us'] = "Delete";
$text['button-delete']['es-cl'] = "Eliminar";
$text['button-delete']['pt-pt'] = "Remover";
$text['button-delete']['fr-fr'] = "Supprimé";
$text['button-delete']['pt-br'] = "Remover";
$text['button-delete']['pl'] = "Usuń";
$text['button-delete']['sv-se'] = "Ta Bort";
$text['button-delete']['uk'] = "Видалити";
$text['button-delete']['de-at'] = "Löschen";
$text['button-delete']['ar-eg'] = "مسح";
$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']['pl'] = "Wróć";
$text['button-back']['sv-se'] = "Tillbaka";
$text['button-back']['uk'] = "Назад";
$text['button-back']['de-at'] = "Zurück";
$text['button-back']['ar-eg'] = "رجوع";
$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']['pl'] = "Dodaj";
$text['button-add']['sv-se'] = "Lägg Till";
$text['button-add']['uk'] = "Додати";
$text['button-add']['de-at'] = "Hinzufügen";
$text['button-add']['ar-eg'] = "اضافة";
$text['button-install_execute']['en-us'] = "Execute";
$text['button-install_execute']['es-cl'] = "Ejecutar";
$text['button-install_execute']['pt-pt'] = "Executar";
$text['button-install_execute']['fr-fr'] = "Exécuter";
$text['button-install_execute']['pt-br'] = "Executar";
$text['button-install_execute']['pl'] = "Wykonaj";
$text['button-install_execute']['sv-se'] = "Kör";
$text['button-install_execute']['uk'] = "Виконати";
$text['button-install_execute']['de-at'] = "Ausführen";
?>

10
core/install/app_menu.php Normal file
View File

@ -0,0 +1,10 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Install";
$apps[$x]['menu'][0]['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f";
$apps[$x]['menu'][0]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/core/install/index.php";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

102
core/install/index.php Normal file
View File

@ -0,0 +1,102 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//detect install state
$first_time_install = true;
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
$first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux
$first_time_install = false;
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
$first_time_install = false;
}
if($first_time_install) {
header("Location: ".PROJECT_PATH."/core/install/install_first_time.php");
exit;
}
require_once "resources/check_auth.php";
if (!if_group("superadmin")) {
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-install'];
echo "<b>".$text['header-install']."</b>";
echo "<br><br>";
echo $text['description-install'];
echo "<br><br>";
echo "<form name='frm' method='post' action='/core/install/install_first_time.php'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td width='30%' class='vncell'>\n";
echo " <input id='do_ft-install' type='submit' class='btn' value='".$text['label-ft-install']."'/>";
echo " </td>\n";
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
echo " <label for='do_ft-install'>";
echo " ".$text['description-ft-install'];
echo " </label>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
echo "<form name='frm' method='post' action='/core/install/install_add_switch.php'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td width='30%' class='vncell'>\n";
echo " <input id='do_add-switch' type='submit' class='btn' value='".$text['label-add-switch']."'/>";
echo " </td>\n";
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
echo " <label for='do_add-switch'>";
echo " ".$text['description-add-switch'];
echo " </label>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
echo "<br><br>";
echo "<p>WiP</p>";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -0,0 +1,378 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
require_once "resources/functions.php";
require_once "resources/classes/text.php";
//initialize varibles we are going to use
$event_host = '';
$event_port = '';
$event_password = '';
$install_language = 'en-us';
$admin_username = '';
$admin_password = '';
$install_default_country = 'US';
$install_template_name = '';
$domain_name = '';
$db_type = '';
$db_path = '';
$db_host = '';
$db_port = '';
$db_name = '';
$db_username = '';
$db_password = '';
$db_create_username = '';
$db_create_password = '';
//detect the iso country code from the locale
//TBD $locale = Locale::getDefault();
$timezone = 'UTC';
if (is_link('/etc/localtime')) {
// Mac OS X (and older Linuxes)
// /etc/localtime is a symlink to the
// timezone in /usr/share/zoneinfo.
$filename = readlink('/etc/localtime');
if (strpos($filename, '/usr/share/zoneinfo/') === 0) {
$timezone = substr($filename, 20);
}
} elseif (file_exists('/etc/timezone')) {
// Ubuntu / Debian.
$data = file_get_contents('/etc/timezone');
if ($data) {
$timezone = $data;
}
} elseif (file_exists('/etc/sysconfig/clock')) {
// RHEL / CentOS
$data = parse_ini_file('/etc/sysconfig/clock');
if (!empty($data['ZONE'])) {
$timezone = $data['ZONE'];
}
}
date_default_timezone_set($timezone);
//detect install state
$first_time_install = true;
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
$first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux
$first_time_install = false;
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
$first_time_install = false;
}
if(!$first_time_install) {
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!if_group("superadmin")) {
echo "access denied";
exit;
}
}
$install_step = '';
$return_install_step = '';
if (count($_POST)>0) {
$install_language = check_str($_POST["install_language"]);
$install_step = check_str($_POST["install_step"]);
$return_install_step = check_str($_POST["return_install_step"]);
if(isset($_POST["event_host"])){
$event_host = check_str($_POST["event_host"]);
$event_port = check_str($_POST["event_port"]);
$event_password = check_str($_POST["event_password"]);
}
if(isset($_POST["db_type"])){
$db_type = $_POST["db_type"];
$admin_username = $_POST["admin_username"];
$admin_password = $_POST["admin_password"];
$install_default_country = $_POST["install_default_country"];
$install_template_name = $_POST["install_template_name"];
$domain_name = $_POST["domain_name"];
}
}
if(!$install_step) { $install_step = 'select_language'; }
$_SESSION['domain']['language']['code'] = $install_language;
//add multi-lingual support
$language = new text;
$text = $language->get();
//set a default template
$default_template = 'enhanced';
if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) {
$default_template = $_SESSION['domain']['template']['name'];
}
//set a default enviroment if first_time
if($first_time_install){
//initialize some varibles to cut down on warnings
$_SESSION['message'] = '';
$v_link_label_play = '';
$v_link_label_pause = '';
$default_login = 0;
$onload = '';
}
//get the contents of the template and save it to the template variable
$template = file_get_contents($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes/'.$default_template.'/template.php');
//buffer the content
ob_end_clean(); //clean the buffer
ob_start();
$messages = array();
if (!extension_loaded('PDO')) {
$messages[] = "<b>PHP PDO was not detected</b>. Please install it before proceeding";
}
echo "<div align='center'>\n";
$msg = '';
//make sure the includes directory is writable so the config.php file can be written.
if (!is_writable($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/pdo.php")) {
$messages[] = "<b>Write access to ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."</b> and its sub-directories are required during the install.";
}
//test for selinux
if (file_exists('/usr/sbin/getenforce')) {
$enforcing;
exec('getenforce', $enforcing);
if($enforcing[0] == 'Enforcing'){
$messages[] = "<b>SELinux is enabled and enforcing</b> you must have a policy installed to let the webserver connect to the switch event socket<br/>".
"<sm>You can use the following to find what ports are allowed<pre>semanage port -l | grep '^http_port_t'</pre></sm>";
}
}
//action code
if($return_install_step == 'config_detail'){
//check for all required data
$existing_errors = count($messages);
if (strlen($admin_username) == 0) { $messages[] = "Please provide the Admin Username"; }
if (strlen($admin_password) == 0) { $messages[] = "Please provide the Admin Password"; }
elseif (strlen($admin_password) < 5) { $messages[] = "Please provide an Admin Password that is 5 or more characters.<br>\n"; }
if ( count($messages) > $existing_errors) { $install_step = 'config_detail'; }
}
if($install_step =='execute')
{
//start the rocket launch!
//set the max execution time to 1 hour
ini_set('max_execution_time',3600);
}
//display messages
if (count($messages)>0) {
echo "<br />\n";
echo "<div align='center'>\n";
echo "<table width='75%'>\n";
echo "<tr>\n";
echo "<th align='left'>Messages</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong><ul>\n";
foreach ($messages as $message){
echo "<li>$message</li>\n";
}
echo "</ul></strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
//includes and title
$document['title'] = $text['title-install_first_time'];
//view code
if($install_step == 'select_language'){
include "resources/page_parts/install_select_language.php";
echo "<form method='post' name='frm' action=''>\n";
echo " <input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo " <input type='hidden' name='return_install_step' value='select_language'/>\n";
echo " <input type='hidden' name='install_step' value='detect_config'/>\n";
echo " <div style='text-align:right'>\n";
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
echo " </div>\n";
echo "</form>\n";
}elseif($install_step == 'detect_config'){
include "resources/page_parts/install_event_socket.php";
if($detect_ok){
echo "<form method='post' name='frm' action=''>\n";
echo " <input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo " <input type='hidden' name='return_install_step' value='detect_config'/>\n";
echo " <input type='hidden' name='install_step' value='config_detail'/>\n";
echo " <input type='hidden' name='event_host' value='$event_host'/>\n";
echo " <input type='hidden' name='event_port' value='$event_port'/>\n";
echo " <input type='hidden' name='event_password' value='$event_password'/>\n";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
echo " </div>\n";
echo "</form>\n";
}
}
elseif($install_step == 'config_detail'){
if(!$domain_name){
//get the domain
$domain_array = explode(":", $_SERVER["HTTP_HOST"]);
$domain_name = $domain_array[0];
}
include "resources/page_parts/install_config_detail.php";
}
elseif($install_step == 'config_database'){
include "resources/page_parts/install_config_database.php";
}
elseif($install_step == 'execute'){
echo "<p><b>".$text['header-installing']."</b></p>\n";
//$protocol = 'http';
//if($_SERVER['HTTPS']) { $protocol = 'https'; }
//echo "<iframe src='$protocol://$domain_name/core/install/install_first_time.php' style='border:solid 1px #000;width:100%;height:auto'></iframe>";
require_once "core/install/resources/classes/detect_switch.php";
$switch_detect = new detect_switch($event_host, $event_port, $event_password);
$detect_ok = true;
try {
$switch_detect->detect();
} catch(Exception $e){
echo "<p>Failed to detect confgiuration detect_switch reported: " . $e->getMessage() . "</p>\n";
$detect_ok = false;
}
if($detect_ok){
$install_ok = true;
echo "<pre style='text-align:left;'>\n";
function error_handler($err_severity, $errstr, $errfile, $errline ) {
if (0 === error_reporting()) { return false;}
switch($err_severity)
{
case E_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_PARSE: throw new Exception ($errstr . " in $errfile line: $errline");
case E_CORE_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_COMPILE_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_USER_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
case E_STRICT: throw new Exception ($errstr . " in $errfile line: $errline");
case E_RECOVERABLE_ERROR: throw new Exception ($errstr . " in $errfile line: $errline");
default: return false;
}
}
#set_error_handler("error_handler");
try {
require_once "resources/classes/install_fusionpbx.php";
$fusionPBX = new install_fusionpbx($domain_name, null, $switch_detect);
$domain_uuid = $fusionPBX->domain_uuid();
//$fusionPBX->debug = true;
$fusionPBX->admin_username = $admin_username;
$fusionPBX->admin_password = $admin_password;
$fusionPBX->default_country = $install_default_country;
$fusionPBX->install_language = $install_language;
$fusionPBX->template_name = $install_template_name;
foreach($_POST as $key=>$value){
if(substr($key,0,3) == "db_"){
$fusionPBX->$key = $value;
}
}
$fusionPBX->install();
require_once "resources/classes/install_switch.php";
$switch = new install_switch($domain_name, $domain_uuid, $switch_detect);
//$switch->debug = true;
$switch->install();
}catch(Exception $e){
echo "</pre>\n";
echo "<p><b>Failed to install</b><br/>" . $e->getMessage() . "</p>\n";
try {
require_once "resources/classes/install_fusionpbx.php";
$fusionPBX = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
$fusionPBX->remove_config();
}catch(Exception $e){
echo "<p><b>Failed to remove config:</b> " . $e->getMessage() . "</p>\n";
}
$install_ok = false;
}
restore_error_handler();
if($install_ok){
echo "</pre>\n";
header("Location: ".PROJECT_PATH."/logout.php");
$_SESSION['message'] = 'Install complete';
}else{
echo "<form method='post' name='frm' action=''>\n";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='button' onclick=\"location.reload(true);\">".$text['button-install_execute']."</button>\n";
echo " </div>\n";
echo "</form>\n";
}
}
}else{
echo "<p>Unkown install_step '$install_step'</p>\n";
}
if($first_time_install){
//grab the default theme
$set_session_theme = 1;
$domains_processed = 1;
include "themes/enhanced/app_defaults.php";
unset($set_session_theme, $domains_processed);
//initialize some defaults so we can be 'logged in'
$_SESSION['username'] = 'first_time_install';
$_SESSION['permissions'][]['permission_name'] = 'superadmin';
$_SESSION['menu'] = '';
}
// add the content to the template and then send output
$body = ob_get_contents(); //get the output from the buffer
ob_end_clean(); //clean the buffer
//replace known used constants
$body = str_replace ("<!--{project_path}-->", PROJECT_PATH, $body); //defined in /resources/menu.php
ob_start();
eval('?>' . $template . '<?php ');
$template = ob_get_contents(); //get the output from the buffer
ob_end_clean(); //clean the buffer
$custom_head = '';
$output = str_replace ("<!--{title}-->", $document['title'], $template); //<!--{title}--> defined in each individual page
$output = str_replace ("<!--{head}-->", $custom_head, $output); //<!--{head}--> defined in each individual page
$output = str_replace ("<!--{menu}-->", $_SESSION["menu"], $output); //defined in /resources/menu.php
$output = str_replace ("<!--{project_path}-->", PROJECT_PATH, $output); //defined in /resources/menu.php
$pos = strrpos($output, "<!--{body}-->");
if ($pos === false) {
$output = $body; //if tag not found just show the body
}
else {
//replace the body
$output = str_replace ("<!--{body}-->", $body, $output);
}
echo $output;
unset($output);
?>

View File

@ -0,0 +1,146 @@
<?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 <markjcrane@fusionpbx.com>
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
require_once "root.php";
require_once "resources/classes/EventSocket.php";
//define the install class
class detect_switch {
// cached data
protected $_folders;
// version information
protected $_major;
protected $_minor;
// folders
protected $_base_dir = '';
protected $_cache_dir = '';
protected $_certs_dir = '';
protected $_conf_dir = '';
protected $_db_dir = '';
protected $_external_ssl_dir = '';
protected $_grammar_dir = '';
protected $_htdocs_dir = '';
protected $_internal_ssl_dir = '';
protected $_log_dir = '';
protected $_mod_dir = '';
protected $_recordings_dir = '';
protected $_run_dir = '';
protected $_script_dir = '';
protected $_sounds_dir = '';
protected $_storage_dir = '';
protected $_temp_dir = '';
public function major() { return $this->_major; }
public function minor() { return $this->_minor; }
public function version() { return $this->_major.".".$this->_minor; }
public function base_dir() { return $this->_base_dir; }
public function cache_dir() { return $this->_cache_dir; }
public function certs_dir() { return $this->_certs_dir; }
public function conf_dir() { return $this->_conf_dir; }
public function db_dir() { return $this->_db_dir; }
public function external_ssl_dir() { return $this->_external_ssl_dir; }
public function grammar_dir() { return $this->_grammar_dir; }
public function htdocs_dir() { return $this->_htdocs_dir; }
public function internal_ssl_dir() { return $this->_internal_ssl_dir; }
public function log_dir() { return $this->_log_dir; }
public function mod_dir() { return $this->_mod_dir; }
public function recordings_dir() { return $this->_recordings_dir; }
public function run_dir() { return $this->_run_dir; }
public function script_dir() { return $this->_script_dir; }
public function sounds_dir() { return $this->_sounds_dir; }
public function storage_dir() { return $this->_storage_dir; }
public function temp_dir() { return $this->_temp_dir; }
public function get_folders() { return $this->_folders; }
// event socket
public $event_host = 'localhost';
public $event_port = '8021';
public $event_password = 'ClueCon';
protected $event_socket;
public function __construct($event_host, $event_port, $event_password) {
if($event_host){ $this->event_host = $event_host; }
if($event_port){ $this->event_port = $event_port; }
if($event_password){ $this->event_password = $event_password; }
$this->connect_event_socket();
if(!$this->event_socket){
$this->detect_event_socket();
}
$this->_folders = preg_grep ('/.*_dir$/', get_class_methods('detect_switch') );
sort( $this->_folders );
}
protected function detect_event_socket() {
//perform searches for user's config here
}
public function detect() {
$this->connect_event_socket();
if(!$this->event_socket){
throw new Exception('Failed to use event socket');
}
$FS_Version = $this->event_socket_request('api version');
preg_match("/FreeSWITCH Version (\d+)\.(\d(?:\.\d+)?)/", $FS_Version, $matches);
$this->_major = $matches[1];
$this->_minor = $matches[2];
$FS_Vars = $this->event_socket_request('api global_getvar');
foreach (explode("\n",$FS_Vars) as $FS_Var){
preg_match("/(\w+_dir)=(.*)/", $FS_Var, $matches);
if(count($matches) > 0 and property_exists($this, "_" . $matches[1])){
$field = "_" . $matches[1];
$this->$field = $matches[2];
}
}
}
protected function connect_event_socket(){
$esl = new EventSocket;
if ($esl->connect($this->event_host, $this->event_port, $this->event_password)) {
$this->event_socket = $esl->reset_fp();
return true;
}
return false;
}
protected function event_socket_request($cmd) {
$esl = new EventSocket($this->event_socket);
$result = $esl->request($cmd);
$esl->reset_fp();
return $result;
}
public function restart_switch() {
$this->connect_event_socket();
if(!$this->event_socket){
throw new Exception('Failed to use event socket');
}
$this->event_socket_request('api fsctl shutdown restart elegant');
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
<?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 <markjcrane@fusionpbx.com>
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the install class
class install_switch {
protected $domain_uuid;
protected $domain_name;
protected $detect_switch;
public $debug = false;
function __construct($domain_name, $domain_uuid, $detect_switch) {
if(!is_a($detect_switch, 'detect_switch')){
throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)');
}
$this->domain_uuid = $domain_uuid;
$this->domain = $domain_name;
$this->detect_switch = $detect_switch;
}
//utility Functions
function write_debug($message) {
if($this->debug){
echo "$message\n";
}
}
function write_progress($message) {
echo "$message\n";
}
//$options '-n' --no-clobber
protected function recursive_copy($src, $dst, $options = '') {
if (file_exists('/bin/cp')) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') {
//copy -R recursive, preserve attributes for SUN
$cmd = 'cp -Rp '.$src.'/* '.$dst;
} else {
//copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss
$cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst;
}
$this->write_debug($cmd);
exec ($cmd);
}
elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
exec("copy /L '$src' '$dst'");
}
else {
$dir = opendir($src);
if (!$dir) {
if (!mkdir($src, 0755, true)) {
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
}
}
if (!is_dir($dst)) {
if (!mkdir($dst, 0755, true)) {
throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
}
}
//This looks wrong, essentially if we can't use /bin/cp it manually fils dirs, not correct
$scripts_dir_target = $_SESSION['switch']['scripts']['dir'];
$scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) {
if (
substr_count($file_path_source, '/..') == 0 &&
substr_count($file_path_source, '/.') == 0 &&
substr_count($file_path_source, '/.svn') == 0 &&
substr_count($file_path_source, '/.git') == 0
) {
if ($dst != $src.'/resources/config.lua') {
$this->write_debug($file_path_source.' ---> '.$dst);
copy($file_path_source, $dst);
chmod($dst, 0755);
}
}
}
while(false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src.'/'.$file)) {
$this->recursive_copy($src.'/'.$file, $dst.'/'.$file);
}
else {
//copy only missing files -n --no-clobber
if (strpos($options,'-n') !== false) {
if (!file_exists($dst.'/'.$file)) {
$this->write_debug("copy(".$src."/".$file.", ".$dst."/".$file.")");
copy($src.'/'.$file, $dst.'/'.$file);
}
}
else {
copy($src.'/'.$file, $dst.'/'.$file);
}
}
}
}
closedir($dir);
}
}
protected function recursive_delete($dir) {
if (file_exists('/bin/rm')) {
$this->write_debug('rm -Rf '.$dir.'/*');
exec ('rm -Rf '.$dir.'/*');
}
elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
$this->write_debug("del /S /F /Q '$dir'");
exec("del /S /F /Q '$dir'");
}
else {
foreach (glob($dir) as $file) {
if (is_dir($file)) {
$this->write_debug("rm dir: ".$file);
$this->recursive_delete("$file/*");
rmdir($file);
} else {
$this->write_debug("delete file: ".$file);
unlink($file);
}
}
}
clearstatcache();
}
protected function backup_dir($dir, $backup_name){
if (!is_readable($dir)) {
throw new Exception("backup_dir() source directory '".$dir."' does not exist.");
}
$dst_tar = join( DIRECTORY_SEPARATOR, array(sys_get_temp_dir(), "$backup_name.tar"));
//pharData is the correct ay to do it, but it keeps creating incomplete archives
//$tar = new PharData($dst_tar);
//$tar->buildFromDirectory($dir);
$this->write_debug("backing up to $dst_tar");
if (file_exists('/bin/tar')) {
exec('tar -cvf ' .$dst_tar. ' -C '.$dir .' .');
}else{
$this->write_debug('WARN: old config could not be compressed');
$dst_dir = join( DIRECTORY_SEPARATOR, array(sys_get_temp_dir(), "$backup_name"));
recursive_copy($dir, $dst_dir);
}
}
function install() {
$this->copy_conf();
$this->copy_scripts();
//tell freeswitch to restart
$this->write_progress("Restarting switch");
$this->detect_switch->restart_switch();
}
function upgrade() {
$this->copy_scripts();
}
function copy_conf() {
$this->write_progress("Copying Config");
//make a backup of the config
if (file_exists($this->detect_switch->conf_dir())) {
$this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config');
$this->recursive_delete($this->detect_switch->conf_dir());
}
//make sure the conf directory exists
if (!is_dir($this->detect_switch->conf_dir())) {
if (!mkdir($this->detect_switch->conf_dir(), 0774, true)) {
throw new Exception("Failed to create the switch conf directory '".$this->detect_switch->conf_dir()."'. ");
}
}
//copy resources/templates/conf to the freeswitch conf dir
if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){
$src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf";
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf";
}
$dst_dir = $this->detect_switch->conf_dir();
if (is_readable($dst_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
unset($src_dir, $dst_dir);
}
$fax_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->storage_dir(), 'fax'));
if (!is_readable($fax_dir)) { mkdir($fax_dir,0777,true); }
$voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->storage_dir(), 'voicemail'));
if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,0777,true); }
//create the dialplan/default.xml for single tenant or dialplan/domain.xml
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/dialplan")) {
$dialplan = new dialplan;
$dialplan->domain_uuid = $this->domain_uuid;
$dialplan->domain = $this->domain_name;
$dialplan->switch_dialplan_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->conf_dir(), "/dialplan"));
$dialplan->restore_advanced_xml();
if($this->_debug){
print_r($dialplan->result, $message);
$this->write_debug($message);
}
}
//write the xml_cdr.conf.xml file
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/xml_cdr")) {
xml_cdr_conf_xml();
}
//write the switch.conf.xml file
if (file_exists($this->detect_switch->conf_dir())) {
switch_conf_xml();
}
}
function copy_scripts() {
$this->write_progress("Copying Scripts");
if (file_exists($this->detect_switch->script_dir())) {
if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){
$src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts';
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
}
$dst_dir = $this->detect_switch->script_dir();
if (is_readable($this->detect_switch->script_dir())) {
$this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']);
unset($src_dir, $dst_dir);
}
chmod($dst_dir, 0774);
}
}
}
?>

View File

@ -0,0 +1,250 @@
<?php
$iso_countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',
'AG' => 'Antigua And Barbuda',
'AR' => 'Argentina',
'AM' => 'Armenia',
'AW' => 'Aruba',
'AU' => 'Australia',
'AT' => 'Austria',
'AZ' => 'Azerbaijan',
'BS' => 'Bahamas',
'BH' => 'Bahrain',
'BD' => 'Bangladesh',
'BB' => 'Barbados',
'BY' => 'Belarus',
'BE' => 'Belgium',
'BZ' => 'Belize',
'BJ' => 'Benin',
'BM' => 'Bermuda',
'BT' => 'Bhutan',
'BO' => 'Bolivia',
'BA' => 'Bosnia And Herzegovina',
'BW' => 'Botswana',
'BV' => 'Bouvet Island',
'BR' => 'Brazil',
'IO' => 'British Indian Ocean Territory',
'BN' => 'Brunei Darussalam',
'BG' => 'Bulgaria',
'BF' => 'Burkina Faso',
'BI' => 'Burundi',
'KH' => 'Cambodia',
'CM' => 'Cameroon',
'CA' => 'Canada',
'CV' => 'Cape Verde',
'KY' => 'Cayman Islands',
'CF' => 'Central African Republic',
'TD' => 'Chad',
'CL' => 'Chile',
'CN' => 'China',
'CX' => 'Christmas Island',
'CC' => 'Cocos (Keeling) Islands',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CG' => 'Congo',
'CD' => 'Congo, Democratic Republic',
'CK' => 'Cook Islands',
'CR' => 'Costa Rica',
'CI' => 'Cote D\'Ivoire',
'HR' => 'Croatia',
'CU' => 'Cuba',
'CY' => 'Cyprus',
'CZ' => 'Czech Republic',
'DK' => 'Denmark',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'EC' => 'Ecuador',
'EG' => 'Egypt',
'SV' => 'El Salvador',
'GQ' => 'Equatorial Guinea',
'ER' => 'Eritrea',
'EE' => 'Estonia',
'ET' => 'Ethiopia',
'FK' => 'Falkland Islands (Malvinas)',
'FO' => 'Faroe Islands',
'FJ' => 'Fiji',
'FI' => 'Finland',
'FR' => 'France',
'GF' => 'French Guiana',
'PF' => 'French Polynesia',
'TF' => 'French Southern Territories',
'GA' => 'Gabon',
'GM' => 'Gambia',
'GE' => 'Georgia',
'DE' => 'Germany',
'GH' => 'Ghana',
'GI' => 'Gibraltar',
'GR' => 'Greece',
'GL' => 'Greenland',
'GD' => 'Grenada',
'GP' => 'Guadeloupe',
'GU' => 'Guam',
'GT' => 'Guatemala',
'GG' => 'Guernsey',
'GN' => 'Guinea',
'GW' => 'Guinea-Bissau',
'GY' => 'Guyana',
'HT' => 'Haiti',
'HM' => 'Heard Island & Mcdonald Islands',
'VA' => 'Holy See (Vatican City State)',
'HN' => 'Honduras',
'HK' => 'Hong Kong',
'HU' => 'Hungary',
'IS' => 'Iceland',
'IN' => 'India',
'ID' => 'Indonesia',
'IR' => 'Iran, Islamic Republic Of',
'IQ' => 'Iraq',
'IE' => 'Ireland',
'IM' => 'Isle Of Man',
'IL' => 'Israel',
'IT' => 'Italy',
'JM' => 'Jamaica',
'JP' => 'Japan',
'JE' => 'Jersey',
'JO' => 'Jordan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya',
'KI' => 'Kiribati',
'KR' => 'Korea',
'KW' => 'Kuwait',
'KG' => 'Kyrgyzstan',
'LA' => 'Lao People\'s Democratic Republic',
'LV' => 'Latvia',
'LB' => 'Lebanon',
'LS' => 'Lesotho',
'LR' => 'Liberia',
'LY' => 'Libyan Arab Jamahiriya',
'LI' => 'Liechtenstein',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'MO' => 'Macao',
'MK' => 'Macedonia',
'MG' => 'Madagascar',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'MV' => 'Maldives',
'ML' => 'Mali',
'MT' => 'Malta',
'MH' => 'Marshall Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MU' => 'Mauritius',
'YT' => 'Mayotte',
'MX' => 'Mexico',
'FM' => 'Micronesia, Federated States Of',
'MD' => 'Moldova',
'MC' => 'Monaco',
'MN' => 'Mongolia',
'ME' => 'Montenegro',
'MS' => 'Montserrat',
'MA' => 'Morocco',
'MZ' => 'Mozambique',
'MM' => 'Myanmar',
'NA' => 'Namibia',
'NR' => 'Nauru',
'NP' => 'Nepal',
'NL' => 'Netherlands',
'AN' => 'Netherlands Antilles',
'NC' => 'New Caledonia',
'NZ' => 'New Zealand',
'NI' => 'Nicaragua',
'NE' => 'Niger',
'NG' => 'Nigeria',
'NU' => 'Niue',
'NF' => 'Norfolk Island',
'MP' => 'Northern Mariana Islands',
'NO' => 'Norway',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PW' => 'Palau',
'PS' => 'Palestinian Territory, Occupied',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PH' => 'Philippines',
'PN' => 'Pitcairn',
'PL' => 'Poland',
'PT' => 'Portugal',
'PR' => 'Puerto Rico',
'QA' => 'Qatar',
'RE' => 'Reunion',
'RO' => 'Romania',
'RU' => 'Russian Federation',
'RW' => 'Rwanda',
'BL' => 'Saint Barthelemy',
'SH' => 'Saint Helena',
'KN' => 'Saint Kitts And Nevis',
'LC' => 'Saint Lucia',
'MF' => 'Saint Martin',
'PM' => 'Saint Pierre And Miquelon',
'VC' => 'Saint Vincent And Grenadines',
'WS' => 'Samoa',
'SM' => 'San Marino',
'ST' => 'Sao Tome And Principe',
'SA' => 'Saudi Arabia',
'SN' => 'Senegal',
'RS' => 'Serbia',
'SC' => 'Seychelles',
'SL' => 'Sierra Leone',
'SG' => 'Singapore',
'SK' => 'Slovakia',
'SI' => 'Slovenia',
'SB' => 'Solomon Islands',
'SO' => 'Somalia',
'ZA' => 'South Africa',
'GS' => 'South Georgia And Sandwich Isl.',
'ES' => 'Spain',
'LK' => 'Sri Lanka',
'SD' => 'Sudan',
'SR' => 'Suriname',
'SJ' => 'Svalbard And Jan Mayen',
'SZ' => 'Swaziland',
'SE' => 'Sweden',
'CH' => 'Switzerland',
'SY' => 'Syrian Arab Republic',
'TW' => 'Taiwan',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania',
'TH' => 'Thailand',
'TL' => 'Timor-Leste',
'TG' => 'Togo',
'TK' => 'Tokelau',
'TO' => 'Tonga',
'TT' => 'Trinidad And Tobago',
'TN' => 'Tunisia',
'TR' => 'Turkey',
'TM' => 'Turkmenistan',
'TC' => 'Turks And Caicos Islands',
'TV' => 'Tuvalu',
'UG' => 'Uganda',
'UA' => 'Ukraine',
'AE' => 'United Arab Emirates',
'GB' => 'United Kingdom',
'US' => 'United States',
'UM' => 'United States Outlying Islands',
'UY' => 'Uruguay',
'UZ' => 'Uzbekistan',
'VU' => 'Vanuatu',
'VE' => 'Venezuela',
'VN' => 'Viet Nam',
'VG' => 'Virgin Islands, British',
'VI' => 'Virgin Islands, U.S.',
'WF' => 'Wallis And Futuna',
'EH' => 'Western Sahara',
'YE' => 'Yemen',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
);
?>

View File

@ -0,0 +1,251 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
echo "<form method='post' name='frm' action=''>\n";
echo "<input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo "<input type='hidden' name='return_install_step' value='config_database'/>\n";
echo "<input type='hidden' name='install_step' value='execute'/>\n";
echo "<input type='hidden' name='event_host' value='$event_host'/>\n";
echo "<input type='hidden' name='event_port' value='$event_host'/>\n";
echo "<input type='hidden' name='event_password' value='$event_password'/>\n";
echo "<input type='hidden' name='db_type' value='$db_type'/>\n";
echo "<input type='hidden' name='admin_username' value='$admin_username'/>\n";
echo "<input type='hidden' name='admin_password' value='$admin_password'/>\n";
echo "<input type='hidden' name='install_default_country' value='$install_default_country'/>\n";
echo "<input type='hidden' name='install_template_name' value='$install_template_name'/>\n";
echo "<input type='hidden' name='domain_name' value='$domain_name'/>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-config_database']."</b></td>\n";
echo "<td width='70%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
if ($db_type == "sqlite") {
echo "<tr>\n";
echo "<td class='vncell' 'valign='top' align='left' nowrap>\n";
echo " Database Filename\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_name' maxlength='255' value=\"$db_name\"><br />\n";
echo " Set the database filename. The file extension should be '.db'.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' 'valign='top' align='left' nowrap>\n";
echo " Database Directory\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_path' maxlength='255' value=\"$db_path\"><br />\n";
echo " Set the path to the database directory.\n";
echo "</td>\n";
echo "</tr>\n";
}
if ($db_type == "mysql") {
//set defaults
if (strlen($db_host) == 0) { $db_host = 'localhost'; }
if (strlen($db_port) == 0) { $db_port = '3306'; }
//if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; }
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Host\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_host' maxlength='255' value=\"$db_host\"><br />\n";
echo " Enter the host address for the database server.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Database Port\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_port' maxlength='255' value=\"$db_port\"><br />\n";
echo " Enter the port number. It is optional if the database is using the default port.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Name\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_name' maxlength='255' value=\"$db_name\"><br />\n";
echo " Enter the name of the database.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_username' maxlength='255' value=\"$db_username\"><br />\n";
echo " Enter the database username. \n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_password' maxlength='255' value=\"$db_password\"><br />\n";
echo " Enter the database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_username' maxlength='255' value=\"$db_create_username\"><br />\n";
echo " Optional, this username is used to create the database, a database user and set the permissions. \n";
echo " By default this username is 'root' however it can be any account with permission to add a database, user, and grant permissions. \n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_password' maxlength='255' value=\"$db_create_password\"><br />\n";
echo " Enter the create database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
}
if ($db_type == "pgsql") {
if (strlen($db_host) == 0) { $db_host = 'localhost'; }
if (strlen($db_port) == 0) { $db_port = '5432'; }
if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; }
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Host\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_host' maxlength='255' value=\"$db_host\"><br />\n";
echo " Enter the host address for the database server.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Database Port\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_port' maxlength='255' value=\"$db_port\"><br />\n";
echo " Enter the port number. It is optional if the database is using the default port.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Name\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_name' maxlength='255' value=\"$db_name\"><br />\n";
echo " Enter the name of the database.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_username' maxlength='255' value=\"$db_username\"><br />\n";
echo " Enter the database username.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_password' maxlength='255' value=\"$db_password\"><br />\n";
echo " Enter the database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_username' maxlength='255' value=\"$db_create_username\"><br />\n";
echo " Optional, this username is used to create the database, a database user and set the permissions. \n";
echo " By default this username is 'pgsql' however it can be any account with permission to add a database, user, and grant permissions. \n";
echo " Leave blank if the user and empty database already exist and you do not want them created. \n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Create Database Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='db_create_password' maxlength='255' value=\"$db_create_password\"><br />\n";
echo " Enter the create database password.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='submit'>".$text['button-install_execute']."</button>\n";
echo " </div>\n";
echo "</form>\n";
?>

View File

@ -0,0 +1,147 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
echo "<form method='post' name='frm' action=''>\n";
echo "<input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo "<input type='hidden' name='return_install_step' value='config_detail'/>\n";
echo "<input type='hidden' name='install_step' value='config_database'/>\n";
echo "<input type='hidden' name='event_host' value='$event_host'/>\n";
echo "<input type='hidden' name='event_port' value='$event_host'/>\n";
echo "<input type='hidden' name='event_password' value='$event_password'/>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-config_detail']."</b></td>\n";
echo "<td width='70%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Username\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='admin_username' maxlength='255' value=\"$admin_username\"><br />\n";
echo " Enter the username to use when logging in with the browser.<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Password\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='admin_password' maxlength='255' value=\"$admin_password\"><br />\n";
echo " Enter the password to use when logging in with the browser.<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Country\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select id='install_default_country' name='install_default_country' class='formfld' style=''>\n";
require "resources/countries.php";
foreach ($countries as $iso_code => $country ){
if($iso_code == $install_default_country){
echo " <option value='$iso_code' selected='selected'>".$country['country']."</option>\n";
}else{
echo " <option value='$iso_code'>".$country['country']."</option>\n";
}
}
echo " </select>\n";
echo " <br />\n";
echo " Select ISO country code used to initialize calling contry code variables.<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td width='20%' class=\"vncellreq\" align='left' nowrap='nowrap'>\n";
echo " Theme: \n";
echo " </td>\n";
echo " <td class=\"vtable\" align='left'>\n";
echo " <select id='install_template_name' name='install_template_name' class='formfld' style=''>\n";
echo " <option value=''></option>\n";
//add all the themes to the list
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
while (false !== ($dir_name = readdir($handle))) {
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && $dir_name != "flags" && is_readable($theme_dir.'/'.$dir_name)) {
$dir_label = str_replace('_', ' ', $dir_name);
$dir_label = str_replace('-', ' ', $dir_label);
if ($dir_name == 'enhanced') {
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
}
else {
echo " <option value='$dir_name'>$dir_label</option>\n";
}
}
}
closedir($handle);
}
echo " </select>\n";
echo " <br />\n";
echo " Select a theme to set as the default.<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Domain name\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value=\"$domain_name\"><br />\n";
echo " Enter the default domain name. \n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Database Type\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='db_type' id='db_type' class='formfld' id='form_tag' onchange='db_type_onchange();'>\n";
if (extension_loaded('pdo_pgsql')) { echo " <option value='pgsql'>postgresql</option>\n"; }
if (extension_loaded('pdo_mysql')) { echo " <option value='mysql'>mysql</option>\n"; }
if (extension_loaded('pdo_sqlite')) { echo " <option value='sqlite' selected='selected'>sqlite</option>\n"; } //set sqlite as the default
echo " </select><br />\n";
echo " Select the database type.\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo " <div style='text-align:right'>\n";
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
echo " </div>\n";
echo "</form>\n";
?>

View File

@ -0,0 +1,129 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
//fetch the values
require_once "core/install/resources/classes/detect_switch.php";
$switch_detect = new detect_switch($event_host, $event_port, $event_password);
//$switch_detect->event_port = 2021;
$detect_ok = true;
try {
$switch_detect->detect();
} catch(Exception $e){
$messages[] = "Failed to detect confgiuration detect_switch reported: " . $e->getMessage();
$detect_ok = false;
}
echo "<form method='post' name='frm' action=''>\n";
echo "<input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
echo "<input type='hidden' name='install_step' value='detect_config'/>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' align='left' nowrap><b>".$text['header-event_socket']."</b><br><br></td>\n";
echo "<td width='70%' align='right'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-detect']."'/>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-event_host']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='event_host' maxlength='255' value=\"".$switch_detect->event_host."\" onchange='JavaScript:disable_next()'/>\n";
echo "<br />\n";
echo $text['description-event_host']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-event_port']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='event_port' maxlength='255' value=\"".$switch_detect->event_port."\" onchange='JavaScript:disable_next()'/>\n";
echo "<br />\n";
echo $text['description-event_port']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-event_password']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='password' name='event_password' maxlength='255' value=\"".$switch_detect->event_password."\" onchange='JavaScript:disable_next()'/>\n";
echo "<br />\n";
echo $text['description-event_password']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
if($detect_ok){
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td colspan='4' align='left' nowrap><b>".$text['title-detected_configuration']."</b><br><br></td>\n";
echo "</tr>\n";
$id = 0;
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
echo "Switch version\n";
echo "</td>\n";
echo "<td class='vtable' width='35%' align='left'>\n";
echo " ".$switch_detect->version()."\n";
echo "</td>\n";
echo "</tr>\n";
foreach ($switch_detect->get_folders() as $folder)
{
if($id % 2 == 0){ echo "<tr>\n"; }
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
echo $folder."\n";
echo "</td>\n";
echo "<td class='vtable' width='35%' align='left'>\n";
echo " ".$switch_detect->$folder()."\n";
echo "</td>\n";
if($id % 2 == 1){ echo "</tr>\n"; }
$id++;
}
if($id % 2 == 1){ echo "</tr>\n"; }
echo "</table>";
}
?><script type='text/javascript'>
function disable_next() {
document.getElementById("next").style.display = 'none';
}
</script>

View File

@ -0,0 +1,69 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Matthew Vale <github@mafoo.org>
*/
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%' align='left' nowrap><b>".$text['header-select_language']."</b><br><br></td>\n";
echo "<td width='70%' align='right'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-select']."'/>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-select_language']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<fieldset class='container'>";
foreach($_SESSION['app']['languages'] as $lang_code){
echo "<fieldset class='container'>";
echo " <label class='radio' style='width:200px;'>";
echo "<input type='radio' name='install_language' value='$lang_code' id='lang_$lang_code' onchange='JavaScript:disable_next()'";
if($lang_code == $_SESSION['domain']['language']['code'])
{
echo " checked='checked'";
}
echo "/>";
echo "<img src='<!--{project_path}-->/themes/flags/$lang_code.png' alt='$lang_code'/>&nbsp;".$text["language-$lang_code"];
echo "</label>\n";
echo "</fieldset>";
}
echo "</fieldset>";
echo "<br />\n";
echo $text['description-select_language']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br><br>";
echo "</form>";
?><script type='text/javascript'>
function disable_next() {
document.getElementById("next").style.display = 'none';
}
</script>

50
core/install/root.php Normal file
View File

@ -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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// 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'] );
}
?>

View File

@ -41,7 +41,7 @@ include "root.php";
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
//bsd
} else {
header("Location: ".PROJECT_PATH."/resources/install.php");
header("Location: ".PROJECT_PATH."/core/install/install_first_time.php");
exit;
}

View File

@ -1,207 +0,0 @@
<?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 <markjcrane@fusionpbx.com>
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
//define the install class
class install {
var $result;
var $domain_uuid;
var $domain;
var $switch_conf_dir;
var $switch_scripts_dir;
var $switch_sounds_dir;
//$options '-n' --no-clobber
public function recursive_copy($src, $dst, $options = '') {
if (file_exists('/bin/cp')) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') {
//copy -R recursive, preserve attributes for SUN
$cmd = 'cp -Rp '.$src.'/* '.$dst;
} else {
//copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss
$cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst;
}
exec ($cmd);
//echo $cmd."\n";
}
else {
$dir = opendir($src);
if (!$dir) {
if (!mkdir($src, 0755, true)) {
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
}
}
if (!is_dir($dst)) {
if (!mkdir($dst, 0755, true)) {
throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
}
}
$scripts_dir_target = $_SESSION['switch']['scripts']['dir'];
$scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) {
if (
substr_count($file_path_source, '/..') == 0 &&
substr_count($file_path_source, '/.') == 0 &&
substr_count($file_path_source, '/.svn') == 0 &&
substr_count($file_path_source, '/.git') == 0
) {
if ($dst != $src.'/resources/config.lua') {
//echo $file_path_source.' ---> '.$dst.'<br>';
copy($file_path_source, $dst);
chmod($dst, 0755);
}
}
}
while(false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src.'/'.$file)) {
$this->recursive_copy($src.'/'.$file, $dst.'/'.$file);
}
else {
//copy only missing files -n --no-clobber
if (strpos($options,'-n') !== false) {
if (!file_exists($dst.'/'.$file)) {
copy($src.'/'.$file, $dst.'/'.$file);
//echo "copy(".$src."/".$file.", ".$dst."/".$file.");<br />\n";
}
}
else {
copy($src.'/'.$file, $dst.'/'.$file);
}
}
}
}
closedir($dir);
}
}
function recursive_delete($dir) {
if (file_exists('/bin/rm')) {
exec ('rm -Rf '.$dir.'/*');
}
else {
foreach (glob($dir) as $file) {
if (is_dir($file)) {
$this->recursive_delete("$file/*");
rmdir($file);
//echo "rm dir: ".$file."\n";
} else {
//echo "delete file: ".$file."\n";
unlink($file);
}
}
}
clearstatcache();
}
function copy() {
$this->copy_scripts();
//$this->copy_sounds();
}
function copy_conf() {
if (file_exists($this->switch_conf_dir)) {
//make a backup copy of the conf directory
$src_dir = $this->switch_conf_dir;
$dst_dir = $this->switch_conf_dir.'.orig';
if (is_readable($src_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
$this->recursive_delete($src_dir);
}
else {
if ($src_dir != "/conf") {
mkdir($src_dir, 0774, true);
}
}
//make sure the conf directory exists
if (!is_dir($this->switch_conf_dir)) {
if (!mkdir($this->switch_conf_dir, 0774, true)) {
throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. ");
}
}
//copy resources/templates/conf to the freeswitch conf dir
if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){
$src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf";
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf";
}
$dst_dir = $this->switch_conf_dir;
if (is_readable($dst_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
}
//print_r($install->result);
}
}
// added /examples/ into the string
function copy_scripts() {
if (file_exists($this->switch_scripts_dir)) {
if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){
$src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts';
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
}
$dst_dir = $this->switch_scripts_dir;
if (is_readable($this->switch_scripts_dir)) {
$this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']);
unset($src_dir, $dst_dir);
}
chmod($dst_dir, 0774);
}
}
//function copy_sounds() {
// if (file_exists($this->switch_sounds_dir)) {
// if (file_exists('/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/')){
// $src_dir = '/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/';
// changes the output dir for testing
// $dst_dir = $this->switch_sounds_dir.'/en/us/fusionpbx/custom/';
// }
// else {
// $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/';
// $dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/';
// }
// $this->recursive_copy($src_dir, $dst_dir, "-n");
// if (is_readable($this->switch_sounds_dir)) {
// $this->recursive_copy($src_dir, $dst_dir);
// chmod($dst_dir, 0664);
// }
// }
//}
}
//how to use the class
//$install = new install;
//$install->domain_uuid = $domain_uuid;
//$install->switch_conf_dir = $switch_conf_dir;
//$install->switch_scripts_dir = $switch_scripts_dir;
//$install->switch_sounds_dir = $switch_sounds_dir;
//$install->copy();
//print_r($install->result);
?>

File diff suppressed because it is too large Load Diff

View File

@ -282,7 +282,7 @@ input.btn:hover, input.button:hover, img.list_control_icon:hover, button:hover {
cursor: pointer;
}
input.txt, textarea.txt, select.txt, .formfld {
input.txt, textarea.txt, select.txt, .formfld, label.radio {
font-family: arial;
font-size: 12px;
color: #000;
@ -311,6 +311,16 @@ input.txt:focus, .formfld:focus {
box-shadow: 0 0 5px #cddaf0;
}
fieldset.container {
border:none;
padding:0;
margin:1px;
display:inline-block;
}
label.radio
{
display:block;
}
/* removes spinners (increment/decrement controls) inside input fields */
input[type=number] { -moz-appearance: textfield; }
::-webkit-inner-spin-button { -webkit-appearance: none; }
@ -1424,7 +1434,7 @@ if (strlen($_SESSION['message']) > 0) {
<?php
// check for background image
if (isset($_SESSION['theme']['background_image_enabled']['boolean']) and $_SESSION['theme']['background_image_enabled']['boolean'] == 'true') {
if (isset($_SESSION['theme']['enable_background_images']['boolean']) and $_SESSION['theme']['enable_background_images']['boolean'] == 'true') {
// background image is enabled
$image_extensions = array('jpg','jpeg','png','gif');