Moved SQL Query to its own repo

This commit is contained in:
markjcrane 2019-12-10 18:13:59 +00:00
parent e89539ddce
commit e8439f86f4
19 changed files with 0 additions and 2469 deletions

View File

@ -1,38 +0,0 @@
<?php
//application details
$apps[$x]['name'] = "SQL";
$apps[$x]['uuid'] = "7102e551-155a-4c88-b028-f8f669c682b5";
$apps[$x]['category'] = "System";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "1.0";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Provides a conventient way to SQL commands.";
$apps[$x]['description']['ar-eg'] = "";
$apps[$x]['description']['de-at'] = "Bietet eine praktische Möglichkeit system, PHP, Switch und SQL Befehle aus zu führen.";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-de'] = "Bietet eine praktische Möglichkeit system, PHP, Switch und SQL Befehle aus zu führen.";
$apps[$x]['description']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$apps[$x]['description']['es-mx'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$apps[$x]['description']['fr-ca'] = "Il offre un mode d'exécuter des commandes du système, PHP ou switch.";
$apps[$x]['description']['fr-fr'] = "Offre un mode pour exécuter des commandes système, PHP ou switch.";
$apps[$x]['description']['he-il'] = "";
$apps[$x]['description']['it-it'] = "";
$apps[$x]['description']['nl-nl'] = "Voorzie in een makelijke maniet om systeem, PHP, centrale en SQL commando's uit te voeren.";
$apps[$x]['description']['pl-pl'] = "";
$apps[$x]['description']['pt-br'] = "";
$apps[$x]['description']['pt-pt'] = "Ofereçe uma forma conveniente para executar comandos de sistema, PHP e switch.";
$apps[$x]['description']['ro-ro'] = "";
$apps[$x]['description']['ru-ru'] = "";
$apps[$x]['description']['sv-se'] = "";
$apps[$x]['description']['uk-ua'] = "";
//permission details
$y=0;
$apps[$x]['permissions'][$y]['name'] = "sql_query";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "06493580-9131-ce57-23cd-d42d69dd8526";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
?>

View File

@ -1,544 +0,0 @@
<?php
#This file was last reorganized on 19th of September 2017 08:54:24 AM UTC
$text['title-databases']['en-us'] = "Databases";
$text['title-databases']['ar-eg'] = "";
$text['title-databases']['de-at'] = "Datenbanken"; //copied from de-de
$text['title-databases']['de-ch'] = "Datenbanken"; //copied from de-de
$text['title-databases']['de-de'] = "Datenbanken";
$text['title-databases']['es-cl'] = "Bases de datos";
$text['title-databases']['es-mx'] = "Bases de datos"; //copied from es-cl
$text['title-databases']['fr-ca'] = "Bases de données"; //copied from fr-fr
$text['title-databases']['fr-fr'] = "Bases de données";
$text['title-databases']['he-il'] = "";
$text['title-databases']['it-it'] = "Database";
$text['title-databases']['nl-nl'] = "Databases";
$text['title-databases']['pl-pl'] = "Bazy danych";
$text['title-databases']['pt-br'] = "Base de dados";
$text['title-databases']['pt-pt'] = "Bases de Dados";
$text['title-databases']['ro-ro'] = "";
$text['title-databases']['ru-ru'] = "Базы даных";
$text['title-databases']['sv-se'] = "Databaser";
$text['title-databases']['uk-ua'] = "Бази даних";
$text['title-sql_query']['en-us'] = "SQL Query";
$text['title-sql_query']['ar-eg'] = "";
$text['title-sql_query']['de-at'] = "Befehl"; //copied from de-de
$text['title-sql_query']['de-ch'] = "Befehl"; //copied from de-de
$text['title-sql_query']['de-de'] = "Befehl";
$text['title-sql_query']['es-cl'] = "Comando";
$text['title-sql_query']['es-mx'] = "Comando"; //copied from es-cl
$text['title-sql_query']['fr-ca'] = "Commande"; //copied from fr-fr
$text['title-sql_query']['fr-fr'] = "Commande";
$text['title-sql_query']['he-il'] = "";
$text['title-sql_query']['it-it'] = "Comando";
$text['title-sql_query']['nl-nl'] = "Commando";
$text['title-sql_query']['pl-pl'] = "Polecenie";
$text['title-sql_query']['pt-br'] = "Comando"; //copied from pt-pt
$text['title-sql_query']['pt-pt'] = "Comando";
$text['title-sql_query']['ro-ro'] = "";
$text['title-sql_query']['ru-ru'] = "Команды";
$text['title-sql_query']['sv-se'] = "Kommando";
$text['title-sql_query']['uk-ua'] = "Команди";
$text['option-result_type_view']['en-us'] = "View";
$text['option-result_type_view']['ar-eg'] = "";
$text['option-result_type_view']['de-at'] = "Ansicht"; //copied from de-de
$text['option-result_type_view']['de-ch'] = "Ansicht"; //copied from de-de
$text['option-result_type_view']['de-de'] = "Ansicht";
$text['option-result_type_view']['es-cl'] = "Ver";
$text['option-result_type_view']['es-mx'] = "Ver"; //copied from es-cl
$text['option-result_type_view']['fr-ca'] = "Voir"; //copied from fr-fr
$text['option-result_type_view']['fr-fr'] = "Voir";
$text['option-result_type_view']['he-il'] = "";
$text['option-result_type_view']['it-it'] = "Mostra";
$text['option-result_type_view']['nl-nl'] = "Bekijk";
$text['option-result_type_view']['pl-pl'] = "Widok";
$text['option-result_type_view']['pt-br'] = "Visualizar";
$text['option-result_type_view']['pt-pt'] = "Ver";
$text['option-result_type_view']['ro-ro'] = "";
$text['option-result_type_view']['ru-ru'] = "Просмотр";
$text['option-result_type_view']['sv-se'] = "Granska";
$text['option-result_type_view']['uk-ua'] = "Перегляд";
$text['option-result_type_insert']['en-us'] = "SQL";
$text['option-result_type_insert']['ar-eg'] = "";
$text['option-result_type_insert']['de-at'] = "SQL"; //copied from de-de
$text['option-result_type_insert']['de-ch'] = "SQL"; //copied from de-de
$text['option-result_type_insert']['de-de'] = "SQL";
$text['option-result_type_insert']['es-cl'] = "SQL";
$text['option-result_type_insert']['es-mx'] = "SQL"; //copied from es-cl
$text['option-result_type_insert']['fr-ca'] = "SQL"; //copied from fr-fr
$text['option-result_type_insert']['fr-fr'] = "SQL";
$text['option-result_type_insert']['he-il'] = "";
$text['option-result_type_insert']['it-it'] = "SQL";
$text['option-result_type_insert']['nl-nl'] = "SQL";
$text['option-result_type_insert']['pl-pl'] = "SQL";
$text['option-result_type_insert']['pt-br'] = "SQL"; //copied from pt-pt
$text['option-result_type_insert']['pt-pt'] = "SQL";
$text['option-result_type_insert']['ro-ro'] = "";
$text['option-result_type_insert']['ru-ru'] = "SQL";
$text['option-result_type_insert']['sv-se'] = "SQL";
$text['option-result_type_insert']['uk-ua'] = "SQL ";
$text['option-result_type_csv']['en-us'] = "CSV";
$text['option-result_type_csv']['ar-eg'] = "";
$text['option-result_type_csv']['de-at'] = "CSV"; //copied from de-de
$text['option-result_type_csv']['de-ch'] = "CSV"; //copied from de-de
$text['option-result_type_csv']['de-de'] = "CSV";
$text['option-result_type_csv']['es-cl'] = "CSV";
$text['option-result_type_csv']['es-mx'] = "CSV"; //copied from es-cl
$text['option-result_type_csv']['fr-ca'] = "CSV"; //copied from fr-fr
$text['option-result_type_csv']['fr-fr'] = "CSV";
$text['option-result_type_csv']['he-il'] = "";
$text['option-result_type_csv']['it-it'] = "CSV";
$text['option-result_type_csv']['nl-nl'] = "CSV";
$text['option-result_type_csv']['pl-pl'] = "CSV";
$text['option-result_type_csv']['pt-br'] = "CSV"; //copied from pt-pt
$text['option-result_type_csv']['pt-pt'] = "CSV";
$text['option-result_type_csv']['ro-ro'] = "";
$text['option-result_type_csv']['ru-ru'] = "CSV";
$text['option-result_type_csv']['sv-se'] = "CSV";
$text['option-result_type_csv']['uk-ua'] = "CSV ";
$text['label-table']['en-us'] = "Table";
$text['label-table']['ar-eg'] = "";
$text['label-table']['de-at'] = "Tabelle"; //copied from de-de
$text['label-table']['de-ch'] = "Tabelle"; //copied from de-de
$text['label-table']['de-de'] = "Tabelle";
$text['label-table']['es-cl'] = "Tabla";
$text['label-table']['es-mx'] = "Tabla"; //copied from es-cl
$text['label-table']['fr-ca'] = "Table"; //copied from fr-fr
$text['label-table']['fr-fr'] = "Table";
$text['label-table']['he-il'] = "";
$text['label-table']['it-it'] = "Tabella";
$text['label-table']['nl-nl'] = "Tabel";
$text['label-table']['pl-pl'] = "Tabela";
$text['label-table']['pt-br'] = "Tabela"; //copied from pt-pt
$text['label-table']['pt-pt'] = "Tabela";
$text['label-table']['ro-ro'] = "";
$text['label-table']['ru-ru'] = "Таблица";
$text['label-table']['sv-se'] = "TAbell";
$text['label-table']['uk-ua'] = "Таблиця";
$text['label-switch']['en-us'] = "Switch";
$text['label-switch']['ar-eg'] = "";
$text['label-switch']['de-at'] = "Switch"; //copied from de-de
$text['label-switch']['de-ch'] = "Switch"; //copied from de-de
$text['label-switch']['de-de'] = "Switch";
$text['label-switch']['es-cl'] = "Comando de switch";
$text['label-switch']['es-mx'] = "Comando de switch"; //copied from es-cl
$text['label-switch']['fr-ca'] = "Commande CLI Freeswitch"; //copied from fr-fr
$text['label-switch']['fr-fr'] = "Commande CLI Freeswitch";
$text['label-switch']['he-il'] = "";
$text['label-switch']['it-it'] = "Switch Telefonico";
$text['label-switch']['nl-nl'] = "Telefoon centrale";
$text['label-switch']['pl-pl'] = "PBX";
$text['label-switch']['pt-br'] = "Comando Freeswitch ";
$text['label-switch']['pt-pt'] = "Comando Freeswitch";
$text['label-switch']['ro-ro'] = "";
$text['label-switch']['ru-ru'] = "Команды CLI Freeswitch";
$text['label-switch']['sv-se'] = "Switch";
$text['label-switch']['uk-ua'] = "FreeSwitch";
$text['label-shell']['en-us'] = "Shell";
$text['label-shell']['ar-eg'] = "";
$text['label-shell']['de-at'] = "Shell"; //copied from de-de
$text['label-shell']['de-ch'] = "Shell"; //copied from de-de
$text['label-shell']['de-de'] = "Shell";
$text['label-shell']['es-cl'] = "Terminal de Comandos";
$text['label-shell']['es-mx'] = "Terminal de Comandos"; //copied from es-cl
$text['label-shell']['fr-ca'] = "Commande Shell"; //copied from fr-fr
$text['label-shell']['fr-fr'] = "Commande Shell";
$text['label-shell']['he-il'] = "";
$text['label-shell']['it-it'] = "Shell";
$text['label-shell']['nl-nl'] = "Shell";
$text['label-shell']['pl-pl'] = "Powłoka (shell)";
$text['label-shell']['pt-br'] = "Comando Shell ";
$text['label-shell']['pt-pt'] = "Comando Shell";
$text['label-shell']['ro-ro'] = "";
$text['label-shell']['ru-ru'] = "Консоль";
$text['label-shell']['sv-se'] = "Shell";
$text['label-shell']['uk-ua'] = "Консоль";
$text['label-results']['en-us'] = "Results";
$text['label-results']['ar-eg'] = "";
$text['label-results']['de-at'] = "Ergebnisse"; //copied from de-de
$text['label-results']['de-ch'] = "Ergebnisse"; //copied from de-de
$text['label-results']['de-de'] = "Ergebnisse";
$text['label-results']['es-cl'] = "Resultados";
$text['label-results']['es-mx'] = "Resultados"; //copied from es-cl
$text['label-results']['fr-ca'] = "Résultats"; //copied from fr-fr
$text['label-results']['fr-fr'] = "Résultats";
$text['label-results']['he-il'] = "";
$text['label-results']['it-it'] = "Risultati";
$text['label-results']['nl-nl'] = "Resultaten";
$text['label-results']['pl-pl'] = "Rezultaty";
$text['label-results']['pt-br'] = "Resultados"; //copied from pt-pt
$text['label-results']['pt-pt'] = "Resultados";
$text['label-results']['ro-ro'] = "";
$text['label-results']['ru-ru'] = "Результаты";
$text['label-results']['sv-se'] = "Resultat";
$text['label-results']['uk-ua'] = "Результати";
$text['label-result_type']['en-us'] = "Result";
$text['label-result_type']['ar-eg'] = "";
$text['label-result_type']['de-at'] = "Ergebnis"; //copied from de-de
$text['label-result_type']['de-ch'] = "Ergebnis"; //copied from de-de
$text['label-result_type']['de-de'] = "Ergebnis";
$text['label-result_type']['es-cl'] = "Resultado";
$text['label-result_type']['es-mx'] = "Resultado"; //copied from es-cl
$text['label-result_type']['fr-ca'] = "Résultat"; //copied from fr-fr
$text['label-result_type']['fr-fr'] = "Résultat";
$text['label-result_type']['he-il'] = "";
$text['label-result_type']['it-it'] = "Risultato";
$text['label-result_type']['nl-nl'] = "Resultaat";
$text['label-result_type']['pl-pl'] = "Rezultat";
$text['label-result_type']['pt-br'] = "Resultado"; //copied from pt-pt
$text['label-result_type']['pt-pt'] = "Resultado";
$text['label-result_type']['ro-ro'] = "";
$text['label-result_type']['ru-ru'] = "Результат";
$text['label-result_type']['sv-se'] = "Resultat";
$text['label-result_type']['uk-ua'] = "Результат";
$text['label-response']['en-us'] = "Response";
$text['label-response']['ar-eg'] = "";
$text['label-response']['de-at'] = "Antwort"; //copied from de-de
$text['label-response']['de-ch'] = "Antwort"; //copied from de-de
$text['label-response']['de-de'] = "Antwort";
$text['label-response']['es-cl'] = "Respuesta";
$text['label-response']['es-mx'] = "Respuesta"; //copied from es-cl
$text['label-response']['fr-ca'] = "Réponse"; //copied from fr-fr
$text['label-response']['fr-fr'] = "Réponse";
$text['label-response']['he-il'] = "";
$text['label-response']['it-it'] = "Risposta";
$text['label-response']['nl-nl'] = "Antwoord";
$text['label-response']['pl-pl'] = "Odpowiedź";
$text['label-response']['pt-br'] = "Resposta"; //copied from pt-pt
$text['label-response']['pt-pt'] = "Resposta";
$text['label-response']['ro-ro'] = "";
$text['label-response']['ru-ru'] = "Ответ";
$text['label-response']['sv-se'] = "Respons";
$text['label-response']['uk-ua'] = "Відповідь";
$text['label-reset']['en-us'] = "Reset";
$text['label-reset']['ar-eg'] = "إعادة تعيين";
$text['label-reset']['de-at'] = "Zurücksetzen"; //copied from de-de
$text['label-reset']['de-ch'] = "Zurücksetzen"; //copied from de-de
$text['label-reset']['de-de'] = "Zurücksetzen";
$text['label-reset']['es-cl'] = "Reajustar";
$text['label-reset']['es-mx'] = "Reajustar"; //copied from es-cl
$text['label-reset']['fr-ca'] = "Remettre"; //copied from fr-fr
$text['label-reset']['fr-fr'] = "Remettre";
$text['label-reset']['he-il'] = "אפס";
$text['label-reset']['it-it'] = "Resetta";
$text['label-reset']['nl-nl'] = "Reset";
$text['label-reset']['pl-pl'] = "Resetuj";
$text['label-reset']['pt-br'] = "Restabelecer"; //copied from pt-pt
$text['label-reset']['pt-pt'] = "Restabelecer";
$text['label-reset']['ro-ro'] = "Inițializare";
$text['label-reset']['ru-ru'] = "Сбросить";
$text['label-reset']['sv-se'] = "Återställ";
$text['label-reset']['uk-ua'] = "Скинути";
$text['label-records']['en-us'] = "Records";
$text['label-records']['ar-eg'] = "";
$text['label-records']['de-at'] = "Einträge"; //copied from de-de
$text['label-records']['de-ch'] = "Einträge"; //copied from de-de
$text['label-records']['de-de'] = "Einträge";
$text['label-records']['es-cl'] = "Archivos";
$text['label-records']['es-mx'] = "Archivos"; //copied from es-cl
$text['label-records']['fr-ca'] = "Enregistrements"; //copied from fr-fr
$text['label-records']['fr-fr'] = "Enregistrements";
$text['label-records']['he-il'] = "";
$text['label-records']['it-it'] = "Dati";
$text['label-records']['nl-nl'] = "Vastlegging";
$text['label-records']['pl-pl'] = "Dokumentacja";
$text['label-records']['pt-br'] = "Registros"; //copied from pt-pt
$text['label-records']['pt-pt'] = "Registros";
$text['label-records']['ro-ro'] = "";
$text['label-records']['ru-ru'] = "Записи";
$text['label-records']['sv-se'] = "Uppgifter";
$text['label-records']['uk-ua'] = "документація";
$text['label-sql']['en-us'] = "SQL";
$text['label-sql']['ar-eg'] = "";
$text['label-sql']['de-at'] = "SQL"; //copied from de-de
$text['label-sql']['de-ch'] = "SQL"; //copied from de-de
$text['label-sql']['de-de'] = "SQL";
$text['label-sql']['es-cl'] = "SQL";
$text['label-sql']['es-mx'] = "SQL"; //copied from es-cl
$text['label-sql']['fr-ca'] = "SQL"; //copied from fr-fr
$text['label-sql']['fr-fr'] = "SQL";
$text['label-sql']['he-il'] = "";
$text['label-sql']['it-it'] = "SQL";
$text['label-sql']['nl-nl'] = "SQL";
$text['label-sql']['pl-pl'] = "SQL";
$text['label-sql']['pt-br'] = "SQL"; //copied from pt-pt
$text['label-sql']['pt-pt'] = "SQL";
$text['label-sql']['ro-ro'] = "";
$text['label-sql']['ru-ru'] = "SQL";
$text['label-sql']['sv-se'] = "SQL";
$text['label-sql']['uk-ua'] = "SQL";
$text['label-php']['en-us'] = "PHP";
$text['label-php']['ar-eg'] = "";
$text['label-php']['de-at'] = "PHP"; //copied from de-de
$text['label-php']['de-ch'] = "PHP"; //copied from de-de
$text['label-php']['de-de'] = "PHP";
$text['label-php']['es-cl'] = "Comando PHP";
$text['label-php']['es-mx'] = "Comando PHP"; //copied from es-cl
$text['label-php']['fr-ca'] = "Commande PHP"; //copied from fr-fr
$text['label-php']['fr-fr'] = "Commande PHP";
$text['label-php']['he-il'] = "";
$text['label-php']['it-it'] = "PHP";
$text['label-php']['nl-nl'] = "PHP";
$text['label-php']['pl-pl'] = "PHP";
$text['label-php']['pt-br'] = "Comandos PHP ";
$text['label-php']['pt-pt'] = "Comandos PHP";
$text['label-php']['ro-ro'] = "";
$text['label-php']['ru-ru'] = "Команды PHP";
$text['label-php']['sv-se'] = "PHP";
$text['label-php']['uk-ua'] = "PHP";
$text['label-execute']['en-us'] = "Execute Command";
$text['label-execute']['ar-eg'] = "";
$text['label-execute']['de-at'] = "Befehl Ausführen"; //copied from de-de
$text['label-execute']['de-ch'] = "Befehl Ausführen"; //copied from de-de
$text['label-execute']['de-de'] = "Befehl Ausführen";
$text['label-execute']['es-cl'] = "Ejecutar Comando";
$text['label-execute']['es-mx'] = "Ejecutar Comando"; //copied from es-cl
$text['label-execute']['fr-ca'] = "Executer la Commande"; //copied from fr-fr
$text['label-execute']['fr-fr'] = "Executer la Commande";
$text['label-execute']['he-il'] = "";
$text['label-execute']['it-it'] = "Esegui Comando";
$text['label-execute']['nl-nl'] = "Voer commando uit";
$text['label-execute']['pl-pl'] = "Wykonywanie poleceń";
$text['label-execute']['pt-br'] = "Executar";
$text['label-execute']['pt-pt'] = "Executar Comando";
$text['label-execute']['ro-ro'] = "";
$text['label-execute']['ru-ru'] = "Выполнить команду";
$text['label-execute']['sv-se'] = "Utför Kommando";
$text['label-execute']['uk-ua'] = "Виконання команд";
$text['label-error']['en-us'] = "Error";
$text['label-error']['ar-eg'] = "";
$text['label-error']['de-at'] = "Fehler"; //copied from de-de
$text['label-error']['de-ch'] = "Fehler"; //copied from de-de
$text['label-error']['de-de'] = "Fehler";
$text['label-error']['es-cl'] = "Error";
$text['label-error']['es-mx'] = "Error"; //copied from es-cl
$text['label-error']['fr-ca'] = "Erreur"; //copied from fr-fr
$text['label-error']['fr-fr'] = "Erreur";
$text['label-error']['he-il'] = "";
$text['label-error']['it-it'] = "Errore";
$text['label-error']['nl-nl'] = "Fout";
$text['label-error']['pl-pl'] = "Błąd";
$text['label-error']['pt-br'] = "Erro"; //copied from pt-pt
$text['label-error']['pt-pt'] = "Erro";
$text['label-error']['ro-ro'] = "";
$text['label-error']['ru-ru'] = "Ошибка";
$text['label-error']['sv-se'] = "Fel";
$text['label-error']['uk-ua'] = "Помилка";
$text['header-databases']['en-us'] = "Databases";
$text['header-databases']['ar-eg'] = "";
$text['header-databases']['de-at'] = "Datenbanken"; //copied from de-de
$text['header-databases']['de-ch'] = "Datenbanken"; //copied from de-de
$text['header-databases']['de-de'] = "Datenbanken";
$text['header-databases']['es-cl'] = "Bases de datos";
$text['header-databases']['es-mx'] = "Bases de datos"; //copied from es-cl
$text['header-databases']['fr-ca'] = "Bases de données"; //copied from fr-fr
$text['header-databases']['fr-fr'] = "Bases de données";
$text['header-databases']['he-il'] = "";
$text['header-databases']['it-it'] = "Database";
$text['header-databases']['nl-nl'] = "Databases";
$text['header-databases']['pl-pl'] = "Bazy danych";
$text['header-databases']['pt-br'] = "Base de dados";
$text['header-databases']['pt-pt'] = "Bases de Dados";
$text['header-databases']['ro-ro'] = "";
$text['header-databases']['ru-ru'] = "База Данных";
$text['header-databases']['sv-se'] = "Databaser";
$text['header-databases']['uk-ua'] = "Бази даних";
$text['description-switch']['en-us'] = "Switch CLI. View valid commands with: 'help'.";
$text['description-switch']['ar-eg'] = "";
$text['description-switch']['de-at'] = "Um eine Liste der gültigen Befehle zu erhalten tippen Sie: 'help'"; //copied from de-de
$text['description-switch']['de-ch'] = "Um eine Liste der gültigen Befehle zu erhalten tippen Sie: 'help'"; //copied from de-de
$text['description-switch']['de-de'] = "Um eine Liste der gültigen Befehle zu erhalten tippen Sie: 'help'";
$text['description-switch']['es-cl'] = "Para un listado de comandos válidos use: help";
$text['description-switch']['es-mx'] = "Para un listado de comandos válidos use: help"; //copied from es-cl
$text['description-switch']['fr-ca'] = "Pour la liste des commandes valides, utiliser : help"; //copied from fr-fr
$text['description-switch']['fr-fr'] = "Pour la liste des commandes valides, utiliser : help";
$text['description-switch']['he-il'] = "";
$text['description-switch']['it-it'] = "CLI Sqitch Telefonico. Visualizza comandi validi con: 'help'.";
$text['description-switch']['nl-nl'] = "Centrale CLI, bekijk geldige commando's met: 'help'.";
$text['description-switch']['pl-pl'] = "Aby uzyskać listę poprawnych poleceń użyj pomocy";
$text['description-switch']['pt-br'] = "Para verificar a lista de comandos válidos utilize: Ajuda";
$text['description-switch']['pt-pt'] = "Para uma lista dos comandos válidos utilize: help";
$text['description-switch']['ro-ro'] = "";
$text['description-switch']['ru-ru'] = "Switch CLI.Для получения списка доступных команд, используйте:'help'.";
$text['description-switch']['sv-se'] = "För en lista med giltiga kommandon använd: help";
$text['description-switch']['uk-ua'] = "Для перегляду списку команд виконайте команду: help";
$text['description-shell']['en-us'] = "Execute system commands.";
$text['description-shell']['ar-eg'] = "";
$text['description-shell']['de-at'] = "System Befehle ausführen"; //copied from de-de
$text['description-shell']['de-ch'] = "System Befehle ausführen"; //copied from de-de
$text['description-shell']['de-de'] = "System Befehle ausführen";
$text['description-shell']['es-cl'] = "Comandos de sistema";
$text['description-shell']['es-mx'] = "Comandos de sistema"; //copied from es-cl
$text['description-shell']['fr-ca'] = "Commande Système"; //copied from fr-fr
$text['description-shell']['fr-fr'] = "Commande Système";
$text['description-shell']['he-il'] = "";
$text['description-shell']['it-it'] = "Esegui comandi di sistema.";
$text['description-shell']['nl-nl'] = "Voer systeem commando's uit.";
$text['description-shell']['pl-pl'] = "Polecenia systemowe.";
$text['description-shell']['pt-br'] = "Comando do sistema";
$text['description-shell']['pt-pt'] = "Comandos do sistema.";
$text['description-shell']['ro-ro'] = "";
$text['description-shell']['ru-ru'] = "Выполните системные команды.";
$text['description-shell']['sv-se'] = "System Kommandon.";
$text['description-shell']['uk-ua'] = "Системні команди";
$text['description-sql']['en-us'] = "Execute statements against the database.";
$text['description-sql']['ar-eg'] = "";
$text['description-sql']['de-at'] = "Abfragen gegen die Datenbank ausführen."; //copied from de-de
$text['description-sql']['de-ch'] = "Abfragen gegen die Datenbank ausführen."; //copied from de-de
$text['description-sql']['de-de'] = "Abfragen gegen die Datenbank ausführen.";
$text['description-sql']['es-cl'] = "Ejecutar instrucciones de consulta contra la base de datos.";
$text['description-sql']['es-mx'] = "Ejecutar instrucciones de consulta contra la base de datos."; //copied from es-cl
$text['description-sql']['fr-ca'] = "Exécuter les instructions de requête contre la base de données."; //copied from fr-fr
$text['description-sql']['fr-fr'] = "Exécuter les instructions de requête contre la base de données.";
$text['description-sql']['he-il'] = "";
$text['description-sql']['it-it'] = "Esegui istruzioni sul database.";
$text['description-sql']['nl-nl'] = "Voer instructies uit op de database.";
$text['description-sql']['pl-pl'] = "Wykonać polecenie zapytania do bazy danych.";
$text['description-sql']['pt-br'] = "Executar instruções de consulta no banco de dados."; //copied from pt-pt
$text['description-sql']['pt-pt'] = "Executar instruções de consulta no banco de dados.";
$text['description-sql']['ro-ro'] = "";
$text['description-sql']['ru-ru'] = "Выполнение запросов для базы данных.";
$text['description-sql']['sv-se'] = "Utför fråge uttalanden mot databasen.";
$text['description-sql']['uk-ua'] = "Виконання операторів запитів до бази даних.";
$text['description-php']['en-us'] = "Execute PHP commands. See: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['ar-eg'] = "";
$text['description-php']['de-at'] = "PHP Befehle ausführen. Benutzen Sie folgenden Link als PHP Referenz: <a href='http://php.net/manual/>PHP Manual</a>"; //copied from de-de
$text['description-php']['de-ch'] = "PHP Befehle ausführen. Benutzen Sie folgenden Link als PHP Referenz: <a href='http://php.net/manual/>PHP Manual</a>"; //copied from de-de
$text['description-php']['de-de'] = "PHP Befehle ausführen. Benutzen Sie folgenden Link als PHP Referenz: <a href='http://php.net/manual/>PHP Manual</a>";
$text['description-php']['es-cl'] = "Utilice el siguiente enlace como referencia para PHP: <a href='http://php.net/manual/' target='_blank'>Manual PHP</a>";
$text['description-php']['es-mx'] = "Utilice el siguiente enlace como referencia para PHP: <a href='http://php.net/manual/' target='_blank'>Manual PHP</a>"; //copied from es-cl
$text['description-php']['fr-ca'] = "Utiliser le lien suivant comme référence pour le PHP: <a href='http://php.net/manual/' target='_blank'>Manuel PHP</a>"; //copied from fr-fr
$text['description-php']['fr-fr'] = "Utiliser le lien suivant comme référence pour le PHP: <a href='http://php.net/manual/' target='_blank'>Manuel PHP</a>";
$text['description-php']['he-il'] = "";
$text['description-php']['it-it'] = "Esegue comandi PHP. Vedi: <a href='http://php.net/manual/' target='_blank'>Manuale PHP</a>";
$text['description-php']['nl-nl'] = "Voer PHP commando's uit. Zie: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['pl-pl'] = "Aby użyć odniesienia do PHP kliknij na ten link: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['pt-br'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>"; //copied from pt-pt
$text['description-php']['pt-pt'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['ro-ro'] = "";
$text['description-php']['ru-ru'] = "Выполнение PHP команд. Смотрите: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['sv-se'] = "Använd följande länk som en referens gällande PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['uk-ua'] = "Посилання на довідку PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-sql_query']['en-us'] = "Provides a conventient way to execute SQL commands.";
$text['description-sql_query']['ar-eg'] = "";
$text['description-sql_query']['de-at'] = "Bietet die Möglichkeit SQL Befehle auszuführen."; //copied from de-de
$text['description-sql_query']['de-ch'] = "Bietet die Möglichkeit SQL Befehle auszuführen."; //copied from de-de
$text['description-sql_query']['de-de'] = "Bietet die Möglichkeit SQL Befehle auszuführen.";
$text['description-sql_query']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$text['description-sql_query']['es-mx'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch."; //copied from es-cl
$text['description-sql_query']['fr-ca'] = "Fournir un moyen pour executer des commandes système, PHP et switch. "; //copied from fr-fr
$text['description-sql_query']['fr-fr'] = "Fournir un moyen pour executer des commandes système, PHP et switch. ";
$text['description-sql_query']['he-il'] = "";
$text['description-sql_query']['it-it'] = "Fornisce un facile sistema per eseguire i comandi di sistema, PHP, SQL e dello Switch.";
$text['description-sql_query']['nl-nl'] = "Voorzie in een makkelijke manier om opdrachten uit te voeren voor: systeem, PHP, centrale en SQL";
$text['description-sql_query']['pl-pl'] = "Ta funkcja zapewnia dogodny sposób wykonywania poleceń systemowych, PHP oraz switch.";
$text['description-sql_query']['pt-br'] = "Utilize facilmente a execução de comandos do sistema, PHP e switch ";
$text['description-sql_query']['pt-pt'] = "Oferece uma maneira fácil de executar comandos de sistema, PHP, e switch.";
$text['description-sql_query']['ro-ro'] = "";
$text['description-sql_query']['ru-ru'] = "Обеспечивает удобный способ выполнения команд системы, PHP, FreeSwitch и SQL.";
$text['description-sql_query']['sv-se'] = "Erbjuder ett smidigt sätt att köra system, PHP och switch kommandon.";
$text['description-sql_query']['uk-ua'] = "Забезпечує зручний спосіб виконати команди PHP, switch, а також системні команди";
$text['description-databases']['en-us'] = "Select the database to execute SQL query statements against.";
$text['description-databases']['ar-eg'] = "";
$text['description-databases']['de-at'] = "Wählen Sie die Datenbank für die SQL Abfrage aus."; //copied from de-de
$text['description-databases']['de-ch'] = "Wählen Sie die Datenbank für die SQL Abfrage aus."; //copied from de-de
$text['description-databases']['de-de'] = "Wählen Sie die Datenbank für die SQL Abfrage aus.";
$text['description-databases']['es-cl'] = "Seleccione la base de datos para ejecutar la consulta SQL.";
$text['description-databases']['es-mx'] = "Seleccione la base de datos para ejecutar la consulta SQL."; //copied from es-cl
$text['description-databases']['fr-ca'] = "Choisir la base de données utilisée par la requête SQL."; //copied from fr-fr
$text['description-databases']['fr-fr'] = "Choisir la base de données utilisée par la requête SQL.";
$text['description-databases']['he-il'] = "";
$text['description-databases']['it-it'] = "Selezionare il database sul quale eseguire query SQL.";
$text['description-databases']['nl-nl'] = "Kies de database waatop het SQL statment uitgevoerd moet worden.";
$text['description-databases']['pl-pl'] = "Informacje o bazie danych.";
$text['description-databases']['pt-br'] = "Informações sobre a base de dados";
$text['description-databases']['pt-pt'] = "Escolha a base de dados a utilizar.";
$text['description-databases']['ro-ro'] = "";
$text['description-databases']['ru-ru'] = "Выберите базу данных для выполнения SQL-запросов.";
$text['description-databases']['sv-se'] = "Välj databas att använda för SQL Fråga.";
$text['description-databases']['uk-ua'] = "Інформація про базу даних.";
$text['button-select_database']['en-us'] = "Select Database";
$text['button-select_database']['ar-eg'] = "";
$text['button-select_database']['de-at'] = "Datenbank auswählen"; //copied from de-de
$text['button-select_database']['de-ch'] = "Datenbank auswählen"; //copied from de-de
$text['button-select_database']['de-de'] = "Datenbank auswählen";
$text['button-select_database']['es-cl'] = "Seleccionar Base de Datos";
$text['button-select_database']['es-mx'] = "Seleccionar Base de Datos"; //copied from es-cl
$text['button-select_database']['fr-ca'] = "Choisir la Base de données"; //copied from fr-fr
$text['button-select_database']['fr-fr'] = "Choisir la Base de données";
$text['button-select_database']['he-il'] = "";
$text['button-select_database']['it-it'] = "Selezionare Database";
$text['button-select_database']['nl-nl'] = "Kies database";
$text['button-select_database']['pl-pl'] = "Wybierz bazę danych";
$text['button-select_database']['pt-br'] = "Selecionar base de dados";
$text['button-select_database']['pt-pt'] = "Seleccionar Base de Dados";
$text['button-select_database']['ro-ro'] = "";
$text['button-select_database']['ru-ru'] = "Выберите Базу Данных";
$text['button-select_database']['sv-se'] = "Välj Databas";
$text['button-select_database']['uk-ua'] = "Вибрати БД";
$text['button-manage']['en-us'] = "Manage";
$text['button-manage']['ar-eg'] = "";
$text['button-manage']['de-at'] = "Verwalten"; //copied from de-de
$text['button-manage']['de-ch'] = "Verwalten"; //copied from de-de
$text['button-manage']['de-de'] = "Verwalten";
$text['button-manage']['es-cl'] = "Administrar";
$text['button-manage']['es-mx'] = "Administrar"; //copied from es-cl
$text['button-manage']['fr-ca'] = "Gérer"; //copied from fr-fr
$text['button-manage']['fr-fr'] = "Gérer";
$text['button-manage']['he-il'] = "";
$text['button-manage']['it-it'] = "Gestione";
$text['button-manage']['nl-nl'] = "Beheer";
$text['button-manage']['pl-pl'] = "Zarządzaj";
$text['button-manage']['pt-br'] = "Gerenciar";
$text['button-manage']['pt-pt'] = "Gerir";
$text['button-manage']['ro-ro'] = "";
$text['button-manage']['ru-ru'] = "Управление";
$text['button-manage']['sv-se'] = "Hantera";
$text['button-manage']['uk-ua'] = "Керувати";
$text['button-backup']['en-us'] = "Backup";
$text['button-backup']['ar-eg'] = "";
$text['button-backup']['de-at'] = "Sichern"; //copied from de-de
$text['button-backup']['de-ch'] = "Sichern"; //copied from de-de
$text['button-backup']['de-de'] = "Sichern";
$text['button-backup']['es-cl'] = "Respaldar";
$text['button-backup']['es-mx'] = "Respaldar"; //copied from es-cl
$text['button-backup']['fr-ca'] = "Sauvegarder"; //copied from fr-fr
$text['button-backup']['fr-fr'] = "Sauvegarder";
$text['button-backup']['he-il'] = "";
$text['button-backup']['it-it'] = "Backup";
$text['button-backup']['nl-nl'] = "Backup";
$text['button-backup']['pl-pl'] = "Kopia Zapasowa";
$text['button-backup']['pt-br'] = "Backup"; //copied from pt-pt
$text['button-backup']['pt-pt'] = "Backup";
$text['button-backup']['ro-ro'] = "";
$text['button-backup']['ru-ru'] = "Резервное Копирование";
$text['button-backup']['sv-se'] = "Backup";
$text['button-backup']['uk-ua'] = "Резервна копія";
?>

View File

@ -1,29 +0,0 @@
<?php
$y=0;
$apps[$x]['menu'][$y]['title']['en-us'] = "SQL Query";
$apps[$x]['menu'][$y]['title']['ar-eg'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "Befehle";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "Befehle";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Comando";
$apps[$x]['menu'][$y]['title']['es-mx'] = "Comando";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "Command";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Commande";
$apps[$x]['menu'][$y]['title']['he-il'] = "";
$apps[$x]['menu'][$y]['title']['it-it'] = "Comando";
$apps[$x]['menu'][$y]['title']['nl-nl'] = "Commando";
$apps[$x]['menu'][$y]['title']['pl-pl'] = "Polecenie";
$apps[$x]['menu'][$y]['title']['pt-br'] = "Comandos";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Comandos";
$apps[$x]['menu'][$y]['title']['ro-ro'] = "";
$apps[$x]['menu'][$y]['title']['ru-ru'] = "Выполнение команд";
$apps[$x]['menu'][$y]['title']['sv-se'] = "Kommando";
$apps[$x]['menu'][$y]['title']['uk-ua'] = "Команди";
$apps[$x]['menu'][$y]['uuid'] = "bb3ab92d-c329-42b6-9753-b6ea88d5e700";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "internal";
$apps[$x]['menu'][$y]['path'] = "/app/sql_query/sql_query.php";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

View File

@ -1,90 +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>
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
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>

View File

@ -1,157 +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>
Portions created by the Initial Developer are Copyright (C) 2008-2014
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//disabled
echo "access denied";
exit;
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permisions
if (permission_exists('exec_sql_backup')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//pdo database connection
if (strlen($_REQUEST['id']) > 0) {
require_once "sql_query_pdo.php";
}
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$x = 0;
foreach ($config_list as &$config_path) {
include($config_path);
$x++;
}
//define a function that checks if the field exists
function field_exists($apps, $table_name, $field_name) {
$result = false;
foreach ($apps as &$row) {
$tables = $row["db"];
foreach ($tables as &$table) {
if ($table['table'] == $table_name) {
foreach ($table["fields"] as &$field) {
if ($field['deprecated'] != "true") {
if (is_array($field["name"])) {
if ($field["name"]["text"] == $field_name) {
$result = true;
break;
}
}
else {
if ($field["name"] == $field_name) {
$result = true;
break;
}
}
}
}
}
}
}
return $result;
}
//set the headers
header('Content-type: application/octet-binary');
header('Content-Disposition: attachment; filename=database_backup.sql');
//get the list of tables
if ($db_type == "sqlite") {
$sql = "select name from sqlite_master ";
$sql .= "where type='table' ";
$sql .= "order by name;";
}
if ($db_type == "pgsql") {
$sql = "select table_name as name ";
$sql .= "from information_schema.tables ";
$sql .= "where table_schema='public' ";
$sql .= "and table_type='BASE TABLE' ";
$sql .= "order by table_name ";
}
if ($db_type == "mysql") {
$sql = "show tables";
}
$database = new database;
$result_1 = $database->select($sql, null, 'all');
unset($sql);
if (is_array($result_1) && @sizeof($result_1) != 0) {
foreach ($result_1 as &$row_1) {
$row_1 = array_values($row_1);
$table_name = $row_1[0];
//get the table data
$sql = "select * from ".$table_name;
$database = new database;
$result_2 = $database->select($sql, null, 'all');
unset($sql);
foreach ($result_2[0] as $key => $value) {
if ($row_1[$column] != "db") {
if (field_exists($apps, $table_name, $key)) {
$column_array[] = $key;
}
}
}
$column_array_count = count($column_array);
foreach ($result_2 as &$row_2) {
foreach ($column_array as $column) {
$columns[] = $column;
$values[] = $row_2[$column] != '' ? "'".check_str($row_2[$column])."'" : 'null';
}
$sql = "insert into ".$table_name." (";
$sql .= implode(', ', $columns);
$sql .= ") values ( ";
$sql .= implode(', ', $values);
$sql .= ");";
echo $sql."\n";
unset($columns, $values);
}
unset($result_2, $row_2);
unset($column_array);
}
}
unset($result_1, $row_1);
?>

View File

@ -1,501 +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>
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>
*/
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (if_group("superadmin")) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//show errors
ini_set('display_errors', '1');
//error_reporting (E_ALL); // Report everything
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
//define the db file exists function
function db_field_exists ($tmp_array, $column) {
$result = false;
foreach ($tmp_array as &$row) {
if ($row[0] == $column) {
$result = true;
}
return $result;
}
}
//db_field_exists ($result_dest, $column)
//destination info
//set the domain_uuid
$dest_domain_uuid = '1';
//set the database type
$db_dest_type = 'mysql'; //sqlite, mysql, pgsql, others with a manually created PDO connection
//sqlite: the dbfilename and db_file_path are automatically assigned however the values can be overidden by setting the values here.
//$dbfilename = 'fusionpbx.db'; //host name/ip address + '.db' is the default database filename
//$db_file_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure'; //the path is determined by a php variable
//mysql: database connection information
$db_host = '127.0.0.1'; //set the host only if the database is not local
$db_port = '3306';
$db_name = 'fusionpbx';
$db_username = 'fusionpbx';
$db_password = '';
$db_create_username = 'root';
$db_create_password = '';
//pgsql: database connection information
//$db_host = ''; //set the host only if the database is not local
//$db_port = '';
//$db_name = '';
//$db_username = '';
//$db_password = '';
//$db_create_username = '';
//$db_create_password = '';
//load data into the database
//create the sqlite database
if ($db_dest_type == "sqlite") {
//sqlite database will be created when the config.php is loaded and only if the database file does not exist
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/sqlite.sql';
$file_contents = file_get_contents($filename);
unset($filename);
try {
$db_dest = new PDO('sqlite:'.$db_filepath.'/'.$db_filename); //sqlite 3
//$db_dest = new PDO('sqlite::memory:'); //sqlite 3
$db_dest->beginTransaction();
}
catch (PDOException $error) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
die();
}
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
//loop line by line through all the lines of sql code
$stringarray = explode("\n", $file_contents);
$x = 0;
foreach($stringarray as $sql) {
try {
if(stristr($sql, 'CREATE TABLE') === FALSE) {
//not found do not execute
}
else {
//execute create table sql strings
$db_dest->query($sql);
}
}
catch (PDOException $error) {
echo $text['label-error'].": " . $error->getMessage() . " sql: $sql<br/>";
}
$x++;
}
unset ($file_contents, $sql);
$db_dest->commit();
}
//create the postgres database
if ($db_dest_type == "pgsql") {
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql';
$file_contents = file_get_contents($filename);
//if $db_create_username provided, attempt to create new PG role and database
if (strlen($db_create_username) > 0) {
//create the database connection
try {
if (strlen($db_port) == 0) { $db_port = "5432"; }
if (strlen($db_host) > 0) {
$db_dest = new PDO("pgsql:host={$db_host} port={$db_port} user={$db_create_username} password={$db_create_password} dbname=template1");
} else {
$db_dest = new PDO("pgsql:host=localhost port={$db_port} user={$db_create_username} password={$db_create_password} dbname=template1");
}
} catch (PDOException $error) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
die();
}
//create the database, user, grant perms
$db_dest->exec("CREATE DATABASE {$db_name}");
$db_dest->exec("CREATE USER {$db_username} WITH PASSWORD '{$db_password}'");
$db_dest->exec("GRANT ALL ON {$db_name} TO {$db_username}");
//close database connection_aborted
$db_dest = null;
}
//open database connection with $db_name
try {
if (strlen($db_port) == 0) { $db_port = "5432"; }
if (strlen($db_host) > 0) {
$db_dest = new PDO("pgsql:host={$db_host} port={$db_port} dbname={$db_name} user={$db_username} password={$db_password}");
} else {
$db_dest = new PDO("pgsql:host=localhost port={$db_port} user={$db_username} password={$db_password} dbname={$db_name}");
}
}
catch (PDOException $error) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
die();
}
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
//loop line by line through all the lines of sql code
$stringarray = explode("\n", $file_contents);
$x = 0;
foreach($stringarray as $sql) {
if (strlen($sql) > 3) {
try {
if(stristr($sql, 'CREATE TABLE') === FALSE) {
//not found do not execute
}
else {
//execute create table sql strings
$db_dest->query($sql);
}
}
catch (PDOException $error) {
echo $text['label-error'].": " . $error->getMessage() . " sql: $sql<br/>";
die();
}
}
$x++;
}
unset ($file_contents, $sql);
}
//create the mysql database
if ($db_dest_type == "mysql") {
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql';
$file_contents = file_get_contents($filename);
//database connection
try {
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
//if both host and port are empty use the unix socket
if (strlen($db_create_username) == 0) {
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;charset=utf8;", $db_username, $db_password);
}
else {
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;charset=utf8;", $db_create_username, $db_create_password); }
}
else {
if (strlen($db_port) == 0) {
//leave out port if it is empty
if (strlen($db_create_username) == 0) {
$db_dest = new PDO("mysql:host=$db_host;charset=utf8;", $db_username, $db_password);
}
else {
$db_dest = new PDO("mysql:host=$db_host;charset=utf8;", $db_create_username, $db_create_password);
}
}
else {
if (strlen($db_create_username) == 0) {
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;charset=utf8;", $db_username, $db_password);
}
else {
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;charset=utf8;", $db_create_username, $db_create_password);
}
}
}
$db_dest->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db_dest->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
//create the table, user and set the permissions only if the db_create_username was provided
if (strlen($db_create_username) > 0) {
//select the mysql database
try {
$db_dest->query("USE mysql;");
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
//create user and set the permissions
try {
$tmp_sql = "CREATE USER '".$db_username."'@'%' IDENTIFIED BY '".$db_password."'; ";
$db_dest->query($tmp_sql);
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
//set account to unlimitted use
try {
$tmp_sql = "GRANT USAGE ON * . * TO '".$db_username."'@'localhost' ";
$tmp_sql .= "IDENTIFIED BY '".$db_password."' ";
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
$db_dest->query($tmp_sql);
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
//create the database and set the create user with permissions
try {
$tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$db_name."; ";
$db_dest->query($tmp_sql);
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
//set user permissions
try {
$db_dest->query("GRANT ALL PRIVILEGES ON ".$db_name.".* TO '".$db_username."'@'%'; ");
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
//make the changes active
try {
$tmp_sql = "FLUSH PRIVILEGES; ";
$db_dest->query($tmp_sql);
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
} //if (strlen($db_create_username) > 0)
//select the database
try {
$db_dest->query("USE ".$db_name.";");
}
catch (PDOException $error) {
if ($v_debug) {
print $text['label-error'].": " . $error->getMessage() . "<br/>";
}
}
//add the defaults data into the database
//replace \r\n with \n then explode on \n
$file_contents = str_replace("\r\n", "\n", $file_contents);
//loop line by line through all the lines of sql code
$stringarray = explode("\n", $file_contents);
$x = 0;
foreach($stringarray as $sql) {
if (strlen($sql) > 3) {
try {
if(stristr($sql, 'CREATE TABLE') === FALSE) {
//not found do not execute
}
else {
//execute create table sql strings
$db_dest->query($sql);
}
}
catch (PDOException $error) {
//echo "error on line $x: " . $error->getMessage() . " sql: $sql<br/>";
//die();
}
}
$x++;
}
unset ($file_contents, $sql);
}
//get the list of tables
if ($db_dest_type == "sqlite") {
$sql = "SELECT name FROM sqlite_master ";
$sql .= "WHERE type='table' ";
$sql .= "order by name;";
}
if ($db_dest_type == "pgsql") {
$sql = "select table_name as name ";
$sql .= "from information_schema.tables ";
$sql .= "where table_schema='public' ";
$sql .= "and table_type='BASE TABLE' ";
$sql .= "order by table_name ";
}
if ($db_dest_type == "mysql") {
$sql = "show tables";
}
//get the default schema structure
$prep_statement = $db_dest->prepare(check_sql($sql));
$prep_statement->execute();
$result_dest = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//clean the content from the table
foreach ($result_dest as &$row) {
$table_name = $row[0];
$sql = 'delete from '.$table_name;
//$db_dest->query($sql);
}
//add data into each table
foreach ($result_dest as &$row) {
//get the table name
$table_name = $row[0];
//$table_name = 'v_extensions';
//$db_dest_type = "sqlite";
//get the table source data
$destination_column_array='';
unset($destination_column_array);
if ($db_dest_type == "sqlite") {
$tmp_sql = "PRAGMA table_info($table_name);";
}
if ($db_dest_type == "pgsql") {
}
if ($db_dest_type == "mysql") {
$tmp_sql = "show columns from $table_name;";
}
if (strlen($tmp_sql) > 0) {
$prep_statement_2 = $db_dest->prepare(check_sql($tmp_sql));
//$prep_statement_2 = $db->prepare(check_sql($tmp_sql));
if ($prep_statement_2) {
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_ASSOC);
}
else {
echo "<b>".$text['label-error'].":</b>\n";
echo "<pre>\n";
print_r($db_dest->errorInfo());
echo "</pre>\n";
}
$x = 0;
foreach ($result2 as $row2) {
if ($db_dest_type == "sqlite") {
$destination_column_array[$x] = $row2['name'];
}
if ($db_dest_type == "mysql") {
$destination_column_array[$x] = $row2['Field'];
}
if ($db_dest_type == "pgsql") {
}
$x++;
}
/*
$x = 0;
foreach ($result2[0] as $key => $value) {
if ($db_dest_type == "sqlite" && $key == "name") {
$destination_column_array[$x] = $key;
}
$x++;
}
*/
$destination_column_array_count = count($destination_column_array);
}
unset($prep_statement_2, $result2);
//echo "<pre>\n";
//print_r($destination_column_array);
//echo "</pre>\n";
//get the table source data
$tmp_sql = "select * from $table_name";
if (strlen($tmp_sql) > 0) {
$prep_statement_2 = $db->prepare(check_sql($tmp_sql));
if ($prep_statement_2) {
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_ASSOC);
}
else {
echo "<b>".$text['label-error'].":</b>\n";
echo "<pre>\n";
print_r($db->errorInfo());
echo "</pre>\n";
}
$x = 0;
foreach ($result2[0] as $key => $value) {
$column_array[$x] = $key;
$x++;
}
foreach ($result2 as &$row) {
//build the sql query string
if (substr($table_name, 0, 2) == 'v_') {
$sql = "INSERT INTO $table_name (";
$x = 1;
foreach ($destination_column_array as $column) {
if ($x < $destination_column_array_count) {
$sql .= "".$column.", ";
}
else {
$sql .= "".$column."";
}
$x++;
}
$sql .= ") ";
$sql .= "VALUES( ";
$x = 1;
foreach ($destination_column_array as $column) {
if ($x < $destination_column_array_count) {
//if ($column == "domain_uuid") {
// $sql .= "'".$dest_domain_uuid."',";
//}
//else {
$sql .= "'".check_str($row[$column])."', ";
//}
}
else {
//if ($column == "domain_uuid") {
// $sql .= "'".$dest_domain_uuid."'";
//}
//else {
$sql .= "'".check_str($row[$column])."'";
//}
}
$x++;
}
$sql .= ");\n";
}
//add the sql into the destination database
echo $sql."<br />\n";
$db_dest->query($sql);
}
}
}
?>

View File

@ -1,392 +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>
Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//permissions
if (permission_exists('sql_query')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
// load editor preferences/defaults
$setting_size = ($_SESSION["editor"]["font_size"]["text"] != '') ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = ($_SESSION["editor"]["theme"]["text"] != '') ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
$setting_invisibles = ($_SESSION["editor"]["invisibles"]["boolean"] != '') ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
$setting_indenting = ($_SESSION["editor"]["indent_guides"]["boolean"] != '') ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
$setting_numbering = ($_SESSION["editor"]["line_numbers"]["boolean"] != '') ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
//get the html values and set them as variables
$code = trim($_POST["code"]);
$command = trim($_POST["command"]);
//check the captcha
$command_authorized = false;
if (strlen($code) > 0) {
if (strtolower($_SESSION['captcha']) == strtolower($code)) {
$command_authorized = true;
}
}
//set editor moder
$mode = 'sql';
//show the header
require_once "resources/header.php";
$document['title'] = $text['title-sql_query'];
//pdo database connection
require_once "sql_query_pdo.php";
//scripts and styles
?>
<script language="JavaScript" type="text/javascript">
function submit_check() {
document.getElementById('command').value = editor.getSession().getValue();
if (document.getElementById('mode').value == 'sql') {
$('#frm').prop('target', 'iframe').prop('action', 'sql_query_result.php?code='+ document.getElementById('code').value);
}
else {
if (document.getElementById('command').value == '') {
focus_editor();
return false;
}
$('#frm').prop('target', '').prop('action', '');
}
return true;
}
function toggle_option(opt) {
switch (opt) {
case 'numbering': toggle_option_do('showLineNumbers'); toggle_option_do('fadeFoldWidgets'); break;
case 'invisibles': toggle_option_do('showInvisibles'); break;
case 'indenting': toggle_option_do('displayIndentGuides'); break;
}
focus_editor();
}
function toggle_option_do(opt_name) {
var opt_val = editor.getOption(opt_name);
editor.setOption(opt_name, ((opt_val) ? false : true));
}
function insert_clip(before, after) {
var selected_text = editor.session.getTextRange(editor.getSelectionRange());
editor.insert(before + selected_text + after);
focus_editor();
}
function focus_editor() {
editor.focus();
}
function set_handler(handler) {
switch (handler) {
case 'sql':
document.getElementById('description').innerHTML = "<?php echo $text['description-sql'];?>";
editor.getSession().setMode('ace/mode/sql');
$('#mode option[value=sql]').prop('selected',true);
$('#response').hide();
break;
default:
break;
}
focus_editor();
}
function reset_editor() {
editor.getSession().setValue('');
$('#iframe').prop('src','');
focus_editor();
}
</script>
<style>
img.control {
cursor: pointer;
width: auto;
height: 23px;
border: none;
opacity: 0.5;
}
img.control:hover {
opacity: 1.0;
}
div#editor {
box-shadow: 0 3px 10px #333;
text-align: left;
width: 100%;
height: calc(100% - 30px);
font-size: 12px;
}
</style>
<?php
//generate the captcha image
$_SESSION['captcha'] = generate_password(7, 2);
$captcha = new captcha;
$captcha->code = $_SESSION['captcha'];
$image_base64 = $captcha->image_base64();
//show the header
echo "<form method='post' name='frm' id='frm' action='exec.php' style='margin: 0;' onsubmit='return submit_check();'>\n";
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
echo " <tr>";
echo " <td valign='top' align='left' width='50%'>";
echo " <b>".$text['title-sql_query']."</b>\n";
echo " </td>";
echo " <td valign='top' align='right' nowrap='nowrap'>";
//add the captcha
echo " <img src=\"data:image/png;base64, ".$image_base64."\" /><input type='text' class='txt' style='width: 150px; margin-left: 15px;' name='code' id='code' value=''>\n";
echo " &nbsp; &nbsp; &nbsp;\n";
//sql controls
echo " <span class='sql_controls'>";
//echo " ".$text['label-table']."<br />";
echo " <select name='table_name' id='table_name' class='formfld'>\n";
echo " <option value=''></option>\n";
switch ($db_type) {
case 'sqlite': $sql = "select name from sqlite_master where type='table' order by name;"; break;
case 'pgsql': $sql = "select table_name as name from information_schema.tables where table_schema='public' and table_type='BASE TABLE' order by table_name"; break;
case 'mysql': $sql = "show tables"; break;
}
$database = new database;
$result = $database->select($sql, null, 'all');
if (is_array($result) && @sizeof($result) != 0) {
foreach ($result as &$row) {
$row = array_values($row);
echo " <option value='".escape($row[0])."'>".escape($row[0])."</option>\n";
}
}
unset($sql, $result, $row);
echo " </select>\n";
//echo " <br /><br />\n";
//echo " ".$text['label-result_type']."<br />";
echo " <select name='sql_type' id='sql_type' class='formfld'>\n";
echo " <option value=''>".$text['option-result_type_view']."</option>\n";
echo " <option value='csv'>".$text['option-result_type_csv']."</option>\n";
echo " <option value='inserts'>".$text['option-result_type_insert']."</option>\n";
echo " </select>\n";
echo " </span>";
echo " <input type='button' class='btn' style='margin-top: 0px;' title=\"".$text['button-execute']." [Ctrl+Enter]\" value=\" ".$text['button-execute']." \" onclick=\"$('form#frm').submit();\">";
echo " <input type='button' class='btn' style='margin-top: 0px;' title=\"\" value=\" ".$text['button-reset']." \" onclick=\"reset_editor();\">";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td colspan='2'>\n";
echo $text['description-sql_query']."\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>";
echo "<br>";
//html form
echo "<input type='hidden' name='id' value='".escape($_REQUEST['id'])."'>\n"; //sql db id
echo "<textarea name='command' id='command' style='display: none;'></textarea>";
echo "<table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>\n";
echo " <tr>";
echo " <td style='width: 280px;' valign='top' nowrap>";
echo " <table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>";
if (permission_exists('edit_view') && file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/")) {
echo " <tr>";
echo " <td valign='top' height='100%'>";
echo " <iframe id='clip_list' src='".PROJECT_PATH."/app/edit/clip_list.php' style='border: none; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; height: calc(100% - 2px); width: calc(100% - 15px);'></iframe>\n";
echo " </td>";
echo " </tr>";
}
echo " </table>";
echo " </td>";
echo " <td valign='top' style='height: 400px;'>"
?>
<table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>
<tr>
<td valign='middle' style='padding: 0 6px;' width='100%'><span id='description'><?php echo $text['description-'.$handler]; ?></span></td>
<td valign='middle' style='padding: 0;'><img src='resources/images/blank.gif' style='width: 1px; height: 30px; border: none;'></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_numbering.png' title='Toggle Line Numbers' class='control' onclick="toggle_option('numbering');"></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_invisibles.png' title='Toggle Invisibles' class='control' onclick="toggle_option('invisibles');"></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_indenting.png' title='Toggle Indent Guides' class='control' onclick="toggle_option('indenting');"></td>
<!--<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_replace.png' title='Show Find/Replace [Ctrl+H]' class='control' onclick="editor.execCommand('replace');"></td>-->
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_goto.png' title='Show Go To Line' class='control' onclick="editor.execCommand('gotoline');"></td>
<td valign='middle' style='padding-left: 10px;'>
<select id='mode' style='height: 23px;' onchange="editor.getSession().setMode((this.options[this.selectedIndex].value == 'php') ? {path:'ace/mode/php', inline:true} : 'ace/mode/' + this.options[this.selectedIndex].value); focus_editor();">
<?php
$modes['php'] = 'PHP';
$modes['css'] = 'CSS';
$modes['html'] = 'HTML';
$modes['javascript'] = 'JS';
$modes['json'] = 'JSON';
$modes['ini'] = 'Conf';
$modes['lua'] = 'Lua';
$modes['text'] = 'Text';
$modes['xml'] = 'XML';
$modes['sql'] = 'SQL';
foreach ($modes as $value => $label) {
$selected = $value == $mode ? 'selected' : null;
echo "<option value='".$value."' ".$selected.">".escape($label)."</option>\n";
}
?>
</select>
</td>
<td valign='middle' style='padding-left: 4px;'>
<select id='size' style='height: 23px;' onchange="document.getElementById('editor').style.fontSize = this.options[this.selectedIndex].value; focus_editor();">
<?php
$sizes = explode(',','9px,10px,11px,12px,14px,16px,18px,20px');
if (!in_array($setting_size, $sizes)) {
echo "<option value='".$setting_size."'>".escape($setting_size)."</option>\n";
echo "<option value='' disabled='disabled'></option>\n";
}
foreach ($sizes as $size) {
$selected = ($size == $setting_size) ? 'selected' : null;
echo "<option value='".$size."' ".$selected.">".escape($size)."</option>\n";
}
?>
</select>
</td>
<td valign='middle' style='padding-left: 4px; padding-right: 0px;'>
<select id='theme' style='height: 23px;' onchange="editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();">
<?php
$themes['Light']['chrome']= 'Chrome';
$themes['Light']['clouds']= 'Clouds';
$themes['Light']['crimson_editor']= 'Crimson Editor';
$themes['Light']['dawn']= 'Dawn';
$themes['Light']['dreamweaver']= 'Dreamweaver';
$themes['Light']['eclipse']= 'Eclipse';
$themes['Light']['github']= 'GitHub';
$themes['Light']['iplastic']= 'IPlastic';
$themes['Light']['solarized_light']= 'Solarized Light';
$themes['Light']['textmate']= 'TextMate';
$themes['Light']['tomorrow']= 'Tomorrow';
$themes['Light']['xcode']= 'XCode';
$themes['Light']['kuroir']= 'Kuroir';
$themes['Light']['katzenmilch']= 'KatzenMilch';
$themes['Light']['sqlserver']= 'SQL Server';
$themes['Dark']['ambiance']= 'Ambiance';
$themes['Dark']['chaos']= 'Chaos';
$themes['Dark']['clouds_midnight']= 'Clouds Midnight';
$themes['Dark']['cobalt']= 'Cobalt';
$themes['Dark']['idle_fingers']= 'idle Fingers';
$themes['Dark']['kr_theme']= 'krTheme';
$themes['Dark']['merbivore']= 'Merbivore';
$themes['Dark']['merbivore_soft']= 'Merbivore Soft';
$themes['Dark']['mono_industrial']= 'Mono Industrial';
$themes['Dark']['monokai']= 'Monokai';
$themes['Dark']['pastel_on_dark']= 'Pastel on dark';
$themes['Dark']['solarized_dark']= 'Solarized Dark';
$themes['Dark']['terminal']= 'Terminal';
$themes['Dark']['tomorrow_night']= 'Tomorrow Night';
$themes['Dark']['tomorrow_night_blue']= 'Tomorrow Night Blue';
$themes['Dark']['tomorrow_night_bright']= 'Tomorrow Night Bright';
$themes['Dark']['tomorrow_night_eighties']= 'Tomorrow Night 80s';
$themes['Dark']['twilight']= 'Twilight';
$themes['Dark']['vibrant_ink']= 'Vibrant Ink';
foreach ($themes as $optgroup => $theme) {
echo "<optgroup label='".$optgroup."'>\n";
foreach ($theme as $value => $label) {
$selected = strtolower($label) == strtolower($setting_theme) ? 'selected' : null;
echo "<option value='".$value."' ".$selected.">".escape($label)."</option>\n";
}
echo "</optgroup>\n";
}
?>
</select>
</td>
</tr>
</table>
<div id='editor'><?php echo $command; ?></div>
<?php
echo " </td>";
echo " </tr>\n";
echo "</table>";
echo "</form>";
echo "<br /><br />";
?>
<script type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/ace/ace.js" charset="utf-8"></script>
<script type="text/javascript">
//load ace editor
var editor = ace.edit("editor");
editor.setOptions({
mode: 'ace/mode/<?php echo $mode;?>',
theme: 'ace/theme/'+document.getElementById('theme').options[document.getElementById('theme').selectedIndex].value,
selectionStyle: 'text',
cursorStyle: 'smooth',
showInvisibles: <?php echo $setting_invisibles;?>,
displayIndentGuides: <?php echo $setting_indenting;?>,
showLineNumbers: <?php echo $setting_numbering;?>,
showGutter: true,
scrollPastEnd: true,
fadeFoldWidgets: <?php echo $setting_numbering;?>,
showPrintMargin: false,
highlightGutterLine: false,
useSoftTabs: false
});
<?php if ($mode == 'php') { ?>
editor.getSession().setMode({path:'ace/mode/php', inline:true});
<?php } ?>
document.getElementById('editor').style.fontSize='<?php echo escape($setting_size);?>';
focus_editor();
//keyboard shortcut to execute command
<?php key_press('ctrl+enter', 'down', 'window', null, null, "$('form#frm').submit();", false); ?>
//remove certain keyboard shortcuts
editor.commands.bindKey("Ctrl-T", null); //disable transpose letters - prefer new browser tab
editor.commands.bindKey("Ctrl-F", null); //disable find - control broken with bootstrap
editor.commands.bindKey("Ctrl-H", null); //disable replace - control broken with bootstrap
</script>
<?php
//sql result
echo "<span id='sql_response'>";
//echo "<b>".$text['label-results']."</b>\n";
//echo "<br /><br />\n";
echo "<iframe name='iframe' id='iframe' style='width: calc(100% - 3px); height: 500px; background-color: #fff; border: 0px solid #c0c0c0;'></iframe>\n";
echo "</span>";
//show the footer
require_once "resources/footer.php";
?>

View File

@ -1,131 +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>
Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('exec_sql')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//add the header and title
require_once "resources/header.php";
$document['title'] = $text['title-databases'];
//include paging
require_once "resources/paging.php";
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-databases']."</b></td>\n";
echo " <td width='50%' align='right'>";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location.href='exec.php';\" value='".$text['button-back']."'>\n";
if (if_group("superadmin")) {
echo " <input type='button' class='btn' alt='".$text['button-manage']."' onclick=\"document.location.href='/core/databases/databases.php';\" value='".$text['button-manage']."'>\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['description-databases'].".<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
//prepare to page the results
$sql = "select count(*) from v_databases ";
$database = new database;
$num_rows = $database->select($sql, null, 'column');
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = str_replace('count(*)', '*', $sql);
$sql .= order_by($order_by, $order);
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, null, 'all');
unset($sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('database_type', $text['label-type'], $order_by, $order);
echo th_order_by('database_host', $text['label-host'], $order_by, $order);
echo th_order_by('database_name', $text['label-name'], $order_by, $order);
echo th_order_by('database_description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons' style='width: 25px;'>&nbsp;</td>\n";
echo "<tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
foreach($result as $row) {
$tr_link = "href='exec.php?id=".escape($row['database_uuid'])."'";
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['database_type'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['database_host'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='exec.php?id=".escape($row['database_uuid'])."'>".escape($row['database_name'])."</a>&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".escape($row['database_description'])."&nbsp;</td>\n";
echo " <td class='list_control_icons' style='width: 25px;'>";
echo " <a href='exec.php?id=".escape($row['database_uuid'])."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>\n";
echo " </td>\n";
echo "</tr>\n";
$c = ($c == 0) ? 1 : 0;
}
}
unset($result, $row);
echo "</table>";
echo "<br><br>";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,242 +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>
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>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('exec_sql')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the default values
if (isset($db_file_path) > 0) {
$db_path = $db_file_path;
$db_name = $dbfilename;
}
//get the db connection information
if (is_uuid($_REQUEST['id'])) {
$sql = "select * from v_databases ";
$sql .= "where database_uuid = :database_uuid ";
$parameters['database_uuid'] = $_REQUEST['id'];
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$db_type = $row["database_type"];
$db_host = $row["database_host"];
$db_port = $row["database_port"];
$db_name = $row["database_name"];
$db_username = $row["database_username"];
$db_password = $row["database_password"];
$db_path = $row["database_path"];
}
unset($sql, $parameters, $row);
}
//unset the database connection
unset($db);
if (!function_exists('get_db_field_names')) {
function get_db_field_names($db, $table, $db_name='fusionpbx') {
$query = sprintf('SELECT * FROM %s LIMIT 1', $table);
foreach ($db->query($query, PDO::FETCH_ASSOC) as $row) {
return array_keys($row);
}
// if we're still here, we need to try something else
$fields = array();
$driver = $db->getAttribute(PDO::ATTR_DRIVER_NAME);
if ($driver == 'sqlite') {
$query = sprintf("Pragma table_info(%s);", $table);
$stmt = $db->prepare($query);
$result = $stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_NAMED);
//printf('<pre>%s</pre>', print_r($rows, true));
$row_count = count($rows);
//printf('<pre>%s</pre>', print_r($rows, true));
for ($i = 0; $i < $row_count; $i++) {
array_push($fields, $rows[$i]['name']);
}
return $fields;
} else {
$query = sprintf("SELECT * FROM information_schema.columns
WHERE table_schema='%s' AND table_name='%s';"
, $db_name, $table
);
$stmt = $db->prepare($query);
$result = $stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_NAMED);
$row_count = count($rows);
//printf('<pre>%s</pre>', print_r($rows, true));
for ($i = 0; $i < $row_count; $i++) {
array_push($fields, $rows[$i]['COLUMN_NAME']);
}
return $fields;
}
}
}
if ($db_type == "sqlite") {
if (!function_exists('phpmd5')) {
function phpmd5($string) {
return md5($string);
}
}
if (!function_exists('php_unix_timestamp')) {
function php_unix_timestamp($string) {
return strtotime($string);
}
}
if (!function_exists('phpnow')) {
function phpnow() {
return date("Y-m-d H:i:s");
}
}
if (!function_exists('php_left')) {
function php_left($string, $num) {
return substr($string, 0, $num);
}
}
if (!function_exists('php_right')) {
function php_right($string, $num) {
return substr($string, (strlen($string)-$num), strlen($string));
}
}
if (!function_exists('php_sqlite_data_type')) {
function php_sqlite_data_type($string, $field) {
//get the string between the start and end characters
$start = '(';
$end = ')';
$ini = stripos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = stripos($string,$end,$ini) - $ini;
$string = substr($string,$ini,$len);
$str_data_type = '';
$string_array = explode(',', $string);
foreach($string_array as $lnvalue) {
$fieldlistarray = explode (" ", $value);
unset($fieldarray, $string, $field);
}
return $str_data_type;
}
} //end function
//database connection
try {
//$db = new PDO('sqlite2:example.db'); //sqlite 2
//$db = new PDO('sqlite::memory:'); //sqlite 3
$db = new PDO('sqlite:'.realpath($db_path).'/'.$db_name); //sqlite 3
//add additional functions to SQLite so that they are accessible inside SQL
//bool PDO::sqliteCreateFunction ( string function_name, callback callback [, int num_args] )
$db->sqliteCreateFunction('md5', 'phpmd5', 1);
$db->sqliteCreateFunction('unix_timestamp', 'php_unix_timestamp', 1);
$db->sqliteCreateFunction('now', 'phpnow', 0);
$db->sqliteCreateFunction('sqlitedatatype', 'php_sqlite_data_type', 2);
$db->sqliteCreateFunction('strleft', 'php_left', 2);
$db->sqliteCreateFunction('strright', 'php_right', 2);
}
catch (PDOException $error) {
print "error: " . $error->getMessage() . "<br/>";
die();
}
} //end if db_type sqlite
if ($db_type == "mysql") {
//database connection
try {
//mysql pdo connection
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
//if both host and port are empty use the unix socket
$db = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;dbname=$db_name", $db_username, $db_password);
}
else {
if (strlen($db_port) == 0) {
//leave out port if it is empty
$db = new PDO("mysql:host=$db_host;dbname=$db_name;", $db_username, $db_password, array(
PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION
));
}
else {
$db = new PDO("mysql:host=$db_host;port=$db_port;dbname=$db_name;", $db_username, $db_password, array(
PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION
));
}
}
}
catch (PDOException $error) {
print "error: " . $error->getMessage() . "<br/>";
die();
}
} //end if db_type mysql
if ($db_type == "pgsql") {
//database connection
try {
if (strlen($db_host) > 0) {
if (strlen($db_port) == 0) { $db_port = "5432"; }
$db = new PDO("pgsql:host=$db_host port=$db_port dbname=$db_name user=$db_username password=$db_password");
}
else {
$db = new PDO("pgsql:dbname=$db_name user=$db_username password=$db_password");
}
}
catch (PDOException $error) {
print "error: " . $error->getMessage() . "<br/>";
die();
}
} //end if db_type pgsql
if ($db_type == "odbc") {
//database connection
try {
unset($db);
$db = new PDO("odbc:$db_name", "$db_username", "$db_password");
}
catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
} //end if db_type odbc
?>

View File

@ -1,345 +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>
Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('exec_sql')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//pdo database connection
if (strlen($_REQUEST['id']) > 0) {
require_once "sql_query_pdo.php";
}
//check the captcha
$code = trim($_REQUEST["code"]);
$command_authorized = false;
if (strtolower($_SESSION['captcha']) == strtolower($code)) {
$command_authorized = true;
}
if (!$command_authorized) {
//catpcha invalid
exit;
}
//get allowed table names
switch ($db_type) {
case 'sqlite': $sql = "select name from sqlite_master where type='table' order by name;"; break;
case 'pgsql': $sql = "select table_name as name from information_schema.tables where table_schema='public' and table_type='BASE TABLE' order by table_name"; break;
case 'mysql': $sql = "show tables"; break;
}
$database = new database;
$rows = $database->select($sql, null, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$tables[] = $row['name'];
}
}
unset($sql, $rows, $row);
//show the content
if (is_array($_POST)) {
$sql_type = trim($_POST["sql_type"]);
$sql_cmd = trim($_POST["command"]);
$table_name = trim($_POST["table_name"]);
$header = "<html>\n";
$header .= "<head>\n";
$header .= "<style type='text/css'>\n";
$header .= "\n";
$header .= "body {\n";
$header .= " font-family: arial;\n";
$header .= " font-size: 12px;\n";
$header .= " color: #444;\n";
$header .= "}\n";
$header .= "\n";
$header .= "th {\n";
$header .= " border-top: 1px solid #444;\n";
$header .= " border-bottom: 1px solid #444;\n";
$header .= " color: #fff;\n";
$header .= " font-size: 12px;\n";
$header .= " font-family: arial;\n";
$header .= " font-weight: bold;\n";
$header .= " background-color: #777;\n";
$header .= " padding: 4px 7px;\n";
$header .= " text-align: left;\n";
$header .= "}\n";
$header .= "\n";
$header .= ".row_style0 {\n";
$header .= " background-color: #eee;\n";
$header .= " border-bottom: 1px solid #999;\n";
$header .= " border-left: 1px solid #fff;\n";
$header .= " font-size: 12px;\n";
$header .= " color: #444;\n";
$header .= " text-align: left;\n";
$header .= " padding: 4px 7px;\n";
$header .= " text-align: left;\n";
$header .= " vertical-align: top;\n";
$header .= "}\n";
$header .= "\n";
$header .= ".row_style0 a:link{ color:#444; }\n";
$header .= ".row_style0 a:visited{ color:#444; }\n";
$header .= ".row_style0 a:hover{ color:#444; }\n";
$header .= ".row_style0 a:active{ color:#444; }\n";
$header .= "\n";
$header .= ".row_style1 {\n";
$header .= " border-bottom: 1px solid #999;\n";
$header .= " border-left: 1px solid #eee;\n";
$header .= " background-color: #fff;\n";
$header .= " font-size: 12px;\n";
$header .= " color: #444;\n";
$header .= " text-align: left;\n";
$header .= " padding: 4px 7px;\n";
$header .= " text-align: left;\n";
$header .= " vertical-align: top;\n";
$header .= "}\n";
$header .= "</style>";
$header .= "</head>\n";
$header .= "<body style='margin: 0; padding: 8;'>\n";
$footer = "<body>\n";
$footer .= "<html>\n";
if ($sql_type == '') {
echo $header;
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//determine queries to run and show
if ($sql_cmd != '') { $sql_array = array_filter(explode(";", $sql_cmd)); }
if ($table_name != '' && in_array($table_name, $tables)) { $sql_array[] = "select * from ".$table_name; }
$show_query = (sizeof($sql_array) > 1) ? true : false;
if (is_array($sql_array)) foreach($sql_array as $sql_index => $sql) {
$sql = trim($sql);
if (sizeof($sql_array) > 1 || $show_query) {
if ($sql_index > 0) { echo "<br /><br /><br />"; }
echo "<span style='display: block; font-family: monospace; padding: 8px; color: green; background-color: #eefff0;'>".escape($sql).";</span><br />";
}
$database = new database;
$result = $database->execute($sql, null, 'all');
$message = $database->message;
if ($message['message'] == 'OK' && $message['code'] == 200) {
echo "<b>".$text['label-records'].": ".count($result)."</b>";
echo "<br /><br />\n";
}
else {
echo "<b>".$text['label-error']."</b>";
echo "<br /><br />\n";
echo $message['message'].' ['.$message['code']."]<br />\n";
if (is_array($message['error']) && @sizeof($message['error']) != 0) {
foreach ($message['error'] as $error) {
echo "<pre>".$error."</pre><br /><br />\n";
}
}
}
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
$x = 0;
if (is_array($result[0])) {
echo "<thead>\n";
echo " <tr>\n";
foreach ($result[0] as $key => $value) {
echo "<th>".escape($key)."</th>\n";
$column_array[$x++] = $key;
}
echo " </tr>\n";
echo "</thead>\n";
}
$x = 1;
if (is_array($result)) {
echo "<tbody>\n";
foreach ($result as &$row) {
if ($x++ > 1000) { break; }
echo "<tr>\n";
if (is_array($column_array)) {
foreach ($column_array as $column_index => $column) {
echo "<td class='".$row_style[$c]."' ".(($column_index == 0) ? "style='border-left: none;'" : null).">".escape($row[$column])."&nbsp;</td>\n";
}
}
echo "</tr>\n";
$c = ($c == 0) ? 1 : 0;
}
echo "</tbody>\n";
}
echo "</table>\n";
echo "<br>\n";
unset($result, $column_array);
}
echo $footer;
}
if ($sql_type == "inserts") {
echo $header;
$sql = trim($sql);
//get the table data
$sql = (strlen($sql_cmd) == 0 && in_array($table_name, $tables)) ? "select * from ".$table_name : $sql_cmd;
if (strlen($sql) > 0) {
$database = new database;
$result = $database->execute($sql);
$message = $database->message;
if ($message['message'] != 'OK' || $message['code'] != 200) {
echo "<b>".$text['label-error']."</b>";
echo "<br /><br />\n";
echo $message['message'].' ['.$message['code']."]<br />\n";
if (is_array($message['error']) && @sizeof($message['error']) != 0) {
foreach ($message['error'] as $error) {
echo "<pre>".$error."</pre><br /><br />\n";
}
}
exit;
}
$x = 0;
if (is_array($result[0])) {
foreach ($result[0] as $key => $value) {
$column_array[$x++] = $key;
}
}
$column_array_count = count($column_array);
if (is_array($result)) {
foreach ($result as $index => &$row) {
echo "<div style='font-family: monospace; border-bottom: 1px solid #ccc; padding-bottom: 8px; ".($index != 0 ? 'padding-top: 8px;' : null)."'>\n";
echo "insert into ".$table_name." (";
if (is_array($column_array)) {
foreach ($column_array as $column) {
if ($column != "menuid" && $column != "menuparentid") {
$columns[] = $column;
}
}
}
if (is_array($columns) && sizeof($columns) > 0) {
echo implode(', ', $columns);
}
echo ") values (";
if (is_array($column_array)) {
foreach ($column_array as $column) {
if ($column != "menuid" && $column != "menuparentid") {
$values[] = $row[$column] != '' ? "'".escape($row[$column])."'" : 'null';
}
}
}
if (is_array($values) && sizeof($values) > 0) {
echo implode(', ', $values);
}
echo ");\n";
echo "</div>\n";
unset($columns, $values);
}
}
}
echo $footer;
}
if ($sql_type == "csv") {
//set the headers
header('Content-type: application/octet-binary');
if (strlen($sql_cmd) > 0) {
header('Content-Disposition: attachment; filename=data.csv');
}
else if (in_array($table_name, $tables)) {
header('Content-Disposition: attachment; filename='.$table_name.'.csv');
}
//get the table data
if (strlen($sql_cmd) > 0) {
$sql = $sql_cmd;
}
else if (in_array($table_name, $tables)) {
$sql = "select * from ".$table_name;
}
if (strlen($sql) > 0) {
$database = new database;
$result = $database->execute($sql);
$message = $database->message;
if ($message['message'] != 'OK' || $message['code'] != 200) {
echo "<b>".$text['label-error']."</b>";
echo "<br /><br />\n";
echo $message['message'].' ['.$message['code']."]<br />\n";
if (is_array($message['error']) && @sizeof($message['error']) != 0) {
foreach ($message['error'] as $error) {
echo "<pre>".$error."</pre><br /><br />\n";
}
}
exit;
}
//build the column array
$x = 0;
if (is_array($result[0])) {
foreach ($result[0] as $key => $value) {
$column_array[$x] = $key;
$x++;
}
}
//column names
echo '"'.implode('","', $column_array).'"'."\r\n";
//column values
if (is_array($result)) {
foreach ($result as &$row) {
$x = 1;
foreach ($column_array as $column) {
echo '"'.$row[$column].'"'.($x++ < count($column_array) ? ',' : null);
}
echo "\n";
}
}
}
}
}
?>