Move notifications to the core directory

This commit is contained in:
Mark Crane
2014-07-12 01:26:06 +00:00
parent 135741c237
commit 0845b790ef
5 changed files with 0 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
<?php
//application details
$apps[$x]['name'] = "Notifications";
$apps[$x]['uuid'] = "e746fbcb-f67f-4e0e-ab64-c414c01fac11";
$apps[$x]['category'] = "Switch";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Configure notification preferences.";
$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'] = "";
//menu details
$apps[$x]['menu'][0]['title']['en-us'] = "Notifications";
$apps[$x]['menu'][0]['title']['es-cl'] = "";
$apps[$x]['menu'][0]['title']['de-de'] = "";
$apps[$x]['menu'][0]['title']['de-ch'] = "";
$apps[$x]['menu'][0]['title']['de-at'] = "";
$apps[$x]['menu'][0]['title']['fr-fr'] = "";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "f8d65f91-0f4a-405a-b5ac-24cb3c4f10ba";
$apps[$x]['menu'][0]['parent_uuid'] = "02194288-6d56-6d3e-0b1a-d53a2bc10788";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/notifications/notification_edit.php";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = "v_notifications";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "notification_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "project_notifications";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
?>
+54
View File
@@ -0,0 +1,54 @@
<?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>
*/
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
if ($domains_processed == 1) {
//update the notifications table
$sql = "select count(*) as num_rows from v_notifications ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
$sql = "insert into v_notifications ";
$sql .= "(";
$sql .= "notification_uuid, ";
$sql .= "project_notifications ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'false' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
}
}
}
?>
+158
View File
@@ -0,0 +1,158 @@
<?php
$text['title-notifications']['en-us'] = "Notifications";
$text['title-notifications']['es-cl'] = "Notificaciones";
$text['title-notifications']['pt-pt'] = "Notificações";
$text['title-notifications']['fr-fr'] = "Notifications";
$text['header-notifications']['en-us'] = "Notifications";
$text['header-notifications']['es-cl'] = "Notificaciones";
$text['header-notifications']['pt-pt'] = "Notificações";
$text['header-notifications']['fr-fr'] = "Notifications";
$text['description-notifications']['en-us'] = "Set notification preferences for FusionPBX project-related communication and other local system alerts.";
$text['description-notifications']['es-cl'] = "Definición de las preferencias de notificación de la comunicación relacionada con el proyecto FusionPBX y otras alertas del sistema local.";
$text['description-notifications']['pt-pt'] = "Definir preferências de notificação para a comunicação relacionada com o projecto FusionPBX e outros alertas do sistema local.";
$text['description-notifications']['fr-fr'] = "Definición de las preferencias de notificación de la comunicación relacionada con el proyecto FusionPBX y otras alertas del sistema local.";
$text['label-project_notifications']['en-us'] = "Project Notifications";
$text['label-project_notifications']['es-cl'] = "Proyecto Notificaciones";
$text['label-project_notifications']['pt-pt'] = "Projeto Notificações";
$text['label-project_notifications']['fr-fr'] = "Notifications Projet";
$text['description-project_notifications']['en-us'] = "Enable FusionPBX project notifications.";
$text['description-project_notifications']['es-cl'] = "Habilitar las notificaciones de proyectos FusionPBX.";
$text['description-project_notifications']['pt-pt'] = "Ativar notificações de projetos FusionPBX.";
$text['description-project_notifications']['fr-fr'] = "Ativar notificações de projetos FusionPBX.";
$text['label-project_security']['en-us'] = "Security";
$text['label-project_security']['es-cl'] = "Segurança";
$text['label-project_security']['pt-pt'] = "Segurança";
$text['label-project_security']['fr-fr'] = "Sécurité";
$text['description-project_security']['en-us'] = "Receive notifications of security updates.";
$text['description-project_security']['es-cl'] = "Recibir notificaciones de actualizaciones de seguridad.";
$text['description-project_security']['pt-pt'] = "Receber notificações de atualizações de segurança.";
$text['description-project_security']['fr-fr'] = "Receber notificações de atualizações de segurança.";
$text['label-project_releases']['en-us'] = "Releases";
$text['label-project_releases']['es-cl'] = "Estrenos";
$text['label-project_releases']['pt-pt'] = "Lançamentos";
$text['label-project_releases']['fr-fr'] = "Communiqués";
$text['description-project_releases']['en-us'] = "Receive notifications when new stable version of FusionPBX are released and available for download.";
$text['description-project_releases']['es-cl'] = "Reciba notificaciones cuando una nueva versión estable de FusionPBX se liberan y disponible para su descarga.";
$text['description-project_releases']['pt-pt'] = "Receba notificações quando nova versão estável do FusionPBX são liberados e disponíveis para download.";
$text['description-project_releases']['fr-fr'] = "Recevez des alertes lorsque la nouvelle version stable de FusionPBX sont libérés et disponibles pour le téléchargement.";
$text['label-project_events']['en-us'] = "Events";
$text['label-project_events']['es-cl'] = "Eventos";
$text['label-project_events']['pt-pt'] = "Eventos";
$text['label-project_events']['fr-fr'] = "événements";
$text['description-project_events']['en-us'] = "Receive notifications of upcoming FusionPBX training classes, convention booths, and other events related to the project.";
$text['description-project_events']['es-cl'] = "Recibir notificaciones de próximas clases FusionPBX formación, cabinas de convenciones y otros eventos relacionados con el proyecto.";
$text['description-project_events']['pt-pt'] = "Receber notificações de futuras aulas FusionPBX formação, cabines de convenções e outros eventos relacionados ao projeto.";
$text['description-project_events']['fr-fr'] = "Recevoir des notifications de venir les classes FusionPBX de formation, des stands de congrès et d'autres événements liés au projet.";
$text['label-project_news']['en-us'] = "News";
$text['label-project_news']['es-cl'] = "Noticias";
$text['label-project_news']['pt-pt'] = "Notícia";
$text['label-project_news']['fr-fr'] = "Nouvelles";
$text['description-project_news']['en-us'] = "Receive notifications of general FusionPBX related news and information.";
$text['description-project_news']['es-cl'] = "Recibir notificaciones de noticias FusionPBX relacionadas e información general.";
$text['description-project_news']['pt-pt'] = "Receber notificações de notícias e informações gerais FusionPBX relacionados.";
$text['description-project_news']['fr-fr'] = "Recevoir des notifications de nouvelles et d'information générale FusionPBX liés.";
$text['option-enabled']['en-us'] = "Enabled";
$text['option-enabled']['es-cl'] = "Activado";
$text['option-enabled']['pt-pt'] = "Ativado";
$text['option-enabled']['fr-fr'] = "Activé";
$text['option-disabled']['en-us'] = "Disabled";
$text['option-disabled']['es-cl'] = "Discapacitado";
$text['option-disabled']['pt-pt'] = "Inválido";
$text['option-disabled']['fr-fr'] = "Handicapés";
$text['label-project_notification_method']['en-us'] = "Method";
$text['label-project_notification_method']['es-cl'] = "Método";
$text['label-project_notification_method']['pt-pt'] = "Método";
$text['label-project_notification_method']['fr-fr'] = "Méthode";
// $text['option-ticker']['en-us'] = "Ticker";
// $text['option-ticker']['es-cl'] = "";
// $text['option-ticker']['pt-pt'] = "";
// $text['option-ticker']['fr-fr'] = "";
$text['option-email']['en-us'] = "Email";
$text['option-email']['es-cl'] = "Email";
$text['option-email']['pt-pt'] = "Email";
$text['option-email']['fr-fr'] = "Email";
// $text['option-text']['en-us'] = "Text/SMS";
// $text['option-text']['es-cl'] = "Texto/SMS";
// $text['option-text']['pt-pt'] = "Texto/SMS";
// $text['option-text']['fr-fr'] = "Texte/SMS";
$text['description-project_notification_method']['en-us'] = "Select the desired method of communication.";
$text['description-project_notification_method']['es-cl'] = "Seleccione el método deseado de la comunicación.";
$text['description-project_notification_method']['pt-pt'] = "Seleccione o método desejado de comunicação.";
$text['description-project_notification_method']['fr-fr'] = "Sélectionnez la méthode souhaitée de communication.";
$text['label-project_notification_recipient']['en-us'] = "Recipient";
$text['label-project_notification_recipient']['es-cl'] = "Beneficiario";
$text['label-project_notification_recipient']['pt-pt'] = "Beneficiário";
$text['label-project_notification_recipient']['fr-fr'] = "Destinataire";
$text['description-project_notification_recipient']['en-us'] = "Enter the desired Email Address for the recipient.";
$text['description-project_notification_recipient']['es-cl'] = "Introduzca la deseada dirección de correo electrónico del destinatario.";
$text['description-project_notification_recipient']['pt-pt'] = "Digite o endereço de email desejado para o destinatário.";
$text['description-project_notification_recipient']['fr-fr'] = "Entrez l'adresse e-mail souhaitée pour le destinataire.";
$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-failed']['en-us'] = "Update Failed - Contact Support";
$text['message-failed']['es-cl'] = "Update Error - Contact Support";
$text['message-failed']['pt-pt'] = "Falha na atualização - Contato com o suporte";
$text['message-failed']['fr-fr'] = "Mise à jour a échoué - Contacter le support technique";
$text['message-no_channels']['en-us'] = "No Channels Enabled";
$text['message-no_channels']['es-cl'] = "No hay canales habilitados";
$text['message-no_channels']['pt-pt'] = "Não há canais habilitados";
$text['message-no_channels']['fr-fr'] = "Pas de canaux activés";
$text['message-invalid_recipient']['en-us'] = "Invalid Notification Recipient";
$text['message-invalid_recipient']['es-cl'] = "Inválido destinatario de la notificación";
$text['message-invalid_recipient']['pt-pt'] = "Inválido Notificação Destinatário";
$text['message-invalid_recipient']['fr-fr'] = "Notification invalide bénéficiaire";
$text['message-demographics_submitted']['en-us'] = "Demographics Submitted";
$text['message-demographics_submitted']['es-cl'] = "Demografía Enviado";
$text['message-demographics_submitted']['pt-pt'] = "Demografia Submetido";
$text['message-demographics_submitted']['fr-fr'] = "Démographie Soumis";
$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['message-disclaimer']['en-us'] = "<u>Disclosure</u>: Enabling Project Notifications is consent to the collection of <i>anonymous</i> and <i>general</i> demographic information about your installation environment. Information requested consists of the following: 1) FusionPBX version, 2) PHP version, 3) web server and version, 4) voice switch version, 5) database type and version, 6) operating system platform and version, and 7) public IP address. If you do not wish for this information to be submitted, simply leave Project Notifications disabled, and no information will be submitted about your system.";
$text['message-disclaimer']['es-cl'] = "<u>Divulgación</u>: Habilitación del proyecto Notificaciones es el consentimiento a la recopilación de <i>anónimo</i> y <i>generales</i> la información demográfica sobre su entorno de instalación. La información solicitada se compone de los siguientes: 1) FusionPBX versión, 2) la versión de PHP, 3) del servidor web y la versión 4) Versión conmutador de voz, 5) el tipo de base de datos y la versión 6) plataforma de sistema operativo y versión, y 7) IP pública dirección. Si usted no desea que esta información sea presentada, simplemente deje de Proyecto Notificaciones deshabilitado, y ninguna información se presentará sobre su sistema.";
$text['message-disclaimer']['pt-pt'] = "<u>Divulgação</u>: A habilitação do projeto Notificações é o consentimento para a coleta de <i>anônimo</i> e <i>geral</i> informações demográficas sobre o seu ambiente de instalação. As informações solicitadas consiste no seguinte: 1) versão FusionPBX, 2) versão PHP, 3) servidor web e versão, 4) versão interruptor de voz, 5) Tipo de banco de dados e versão, 6) plataforma de sistema operacional e versão, e 7) IP público endereço. Se você não deseja que esta informação ser submetida, basta deixar Projeto Notificações desativada, e nenhuma informação será apresentada sobre o sistema.";
$text['message-disclaimer']['fr-fr'] = "<u>Divulgation</u>: Activation des notifications projet est consentement à la collecte de <i>anonyme</i> et <i>générale</i> des informations démographiques sur l'environnement d'installation. Les informations demandées se compose de ce qui suit: 1) FusionPBX version 2) version de PHP, 3) le serveur web et la version 4) Version commutateur vocal, 5) type de base de données et la version 6) plate-forme de système d'exploitation et sa version, et 7) IP publique adresse. Si vous ne souhaitez pas que cette information soit présentée, laissez simplement Notifications projet désactivé, et aucune information ne sera soumis à votre système.";
$text['message-demographics']['en-us'] = "<u>Note</u>: To help the FusionPBX project by submitting the demographic information described above <i>without</i> subscribing to Project Notifications, simply ";
$text['message-demographics']['es-cl'] = "<u>Nota</u>: Para ayudar al proyecto FusionPBX presentando la información demográfica descrita anteriormente sin necesidad de suscribirse a Project Notificaciones, haga ";
$text['message-demographics']['pt-pt'] = "<u>Nota</u>: Para ajudar o projeto FusionPBX, apresentando as informações demográficas descrito acima sem a assinatura do Projeto Notificações, basta ";
$text['message-demographics']['fr-fr'] = "<u>Remarque</u>: Pour aider le projet FusionPBX en soumettant l'information démographique décrit ci-dessus, sans souscrire au Projet Notifications, ";
$text['message-demographics_click_here']['en-us'] = "click here";
$text['message-demographics_click_here']['es-cl'] = "clic aquí";
$text['message-demographics_click_here']['pt-pt'] = "clicar aqui";
$text['message-demographics_click_here']['fr-fr'] = "cliquez ici";
?>
+470
View File
@@ -0,0 +1,470 @@
<?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>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (if_group('superadmin')) {
//access granted
}
else {
echo "access denied";
exit;
}
// add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
// retrieve software uuid
$sql = "select software_uuid, software_url, software_version from v_software";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$software_uuid = $row["software_uuid"];
$software_url = $row["software_url"];
$software_version = $row["software_version"];
break; // limit to 1 row
}
}
unset($sql, $prep_statement);
if (count($_REQUEST) > 0) {
// prepare demographic information **********************************************
// fusionpbx version
$software_ver = $software_version;
// php version
$php_ver = phpversion();
// webserver name & version
$web_server = $_SERVER['SERVER_SOFTWARE'];
// switch version
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_result = event_socket_request($fp, 'api version');
}
$switch_ver = trim($switch_result);
// database name & version
switch ($db_type) {
case "pgsql" : $db_ver_query = "select version() as db_ver;"; break;
case "mysql" : $db_ver_query = "select version() as db_ver;"; break;
case "sqlite" : $db_ver_query = "select sqlite_version() as db_ver;"; break;
}
$prep_statement = $db->prepare($db_ver_query);
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$database_version = $row["db_ver"];
break; // limit to 1 row
}
}
unset($db_ver_query, $prep_statement);
$db_ver = $database_version;
// operating system name & version
$os_platform = PHP_OS;
$os_info_1 = php_uname("a");
if ($os_platform == "Linux") {
$os_info_2 = shell_exec("cat /etc/*{release,version}");
$os_info_2 .= shell_exec("lsb_release -d -s");
}
else if (substr(strtoupper($os_platform), 0, 3) == "WIN") {
$os_info_2 = trim(shell_exec("ver"));
}
// **************************************************************************
// check for demographic only submit
if (isset($_GET["demo"])) {
// update remote server record with new values
$url = "https://".$software_url."/app/notifications/notifications_manage.php";
$url .= "?demo";
$url .= "&id=".$software_uuid;
$url .= "&software_ver=".urlencode($software_ver);
$url .= "&php_ver=".urlencode($php_ver);
$url .= "&web_server=".urlencode($web_server);
$url .= "&switch_ver=".urlencode($switch_ver);
$url .= "&db_type=".urlencode($db_type);
$url .= "&db_ver=".urlencode($db_ver);
$url .= "&os_platform=".urlencode($os_platform);
$url .= "&os_info_1=".urlencode($os_info_1);
$url .= "&os_info_2=".urlencode($os_info_2);
if (function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);
}
else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) {
$response = file_get_contents($url);
}
// parse response
$response = json_decode($response, true);
if ($response['result'] == 'submitted') {
// set message
$_SESSION["message"] = $text['message-demographics_submitted'];
}
header("Location: notification_edit.php");
exit;
}
// retrieve submitted values
$project_notifications = check_str($_POST["project_notifications"]);
$project_security = check_str($_POST["project_security"]);
$project_releases = check_str($_POST["project_releases"]);
$project_events = check_str($_POST["project_events"]);
$project_news = check_str($_POST["project_news"]);
$project_notification_method = check_str($_POST["project_notification_method"]);
$project_notification_recipient = check_str($_POST["project_notification_recipient"]);
// get local project notification participation flag
$sql = "select project_notifications from v_notifications";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$current_project_notifications = $row["project_notifications"];
break; // limit to 1 row
}
}
unset($sql, $prep_statement);
// check if remote record should be removed
if ($project_notifications == 'false') {
if ($current_project_notifications == 'true') {
// remove remote server record
$url = "https://".$software_url."/app/notifications/notifications_manage.php?id=".$software_uuid."&action=delete";
if (function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);
}
else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) {
$response = file_get_contents($url);
}
// parse response
$response = json_decode($response, true);
if ($response['result'] == 'deleted') {
// set local project notification participation flag to false
$sql = "update v_notifications set project_notifications = 'false'";
$db->exec(check_sql($sql));
unset($sql);
}
}
// redirect
$_SESSION["message"] = $text['message-update'];
header("Location: notification_edit.php");
exit;
}
// check for invalid values
if ($project_notifications == 'true') {
if (
($project_notification_method == 'email' && !valid_email($project_notification_recipient)) ||
($project_notification_method == 'email' && $project_notification_recipient == '')
) {
$_SESSION["postback"] = $_POST;
$_SESSION["message"] = $text['message-invalid_recipient'];
header("Location: notification_edit.php");
exit;
}
}
// update remote server record with new values
$url = "https://".$software_url."/app/notifications/notifications_manage.php";
$url .= "?id=".$software_uuid;
$url .= "&security=".$project_security;
$url .= "&releases=".$project_releases;
$url .= "&events=".$project_events;
$url .= "&news=".$project_news;
$url .= "&method=".$project_notification_method;
$url .= "&recipient=".urlencode($project_notification_recipient);
$url .= "&software_ver=".urlencode($software_ver);
$url .= "&php_ver=".urlencode($php_ver);
$url .= "&web_server=".urlencode($web_server);
$url .= "&switch_ver=".urlencode($switch_ver);
$url .= "&db_type=".urlencode($db_type);
$url .= "&db_ver=".urlencode($db_ver);
$url .= "&os_platform=".urlencode($os_platform);
$url .= "&os_info_1=".urlencode($os_info_1);
$url .= "&os_info_2=".urlencode($os_info_2);
if (function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);
}
else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) {
$response = file_get_contents($url);
}
// parse response
$response = json_decode($response, true);
if ($response['result'] == 'updated' || $response['result'] == 'inserted') {
// set local project notification participation flag to true
$sql = "update v_notifications set project_notifications = 'true'";
$db->exec(check_sql($sql));
unset($sql);
// set message
$_SESSION["message"] = $text['message-update'];
if (
$project_security == 'false' &&
$project_releases == 'false' &&
$project_events == 'false' &&
$project_news == 'false'
) {
$_SESSION["message"] = $_SESSION["message"]." - ".$text['message-no_channels'];
}
// redirect
header("Location: notification_edit.php");
exit;
}
}
// check postback session
if (!isset($_SESSION["postback"])) {
// check local project notification participation flag
$sql = "select project_notifications from v_notifications";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$setting["project_notifications"] = $row["project_notifications"];
break; // limit to 1 row
}
}
unset($sql, $prep_statement);
// if participation enabled
if ($setting["project_notifications"] == 'true') {
// get current project notification preferences
$url = "https://".$software_url."/app/notifications/notifications_manage.php?id=".$software_uuid;
if (function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);
}
else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) {
$response = file_get_contents($url);
}
// parse response
$setting = json_decode($response, true);
$setting["project_notifications"] = 'true';
}
}
else {
// load postback variables
$setting = fix_postback($_SESSION["postback"]);
unset($_SESSION["postback"]);
}
require_once "resources/header.php";
$document['title'] = $text['title-notifications'];
// show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br />";
echo "<form method='post' name='frm' action=''>\n";
echo "<table cellpadding='6' cellspacing='0' width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td align='left' nowrap='nowrap'><b>".$text['header-notifications']."</b><br><br></td>\n";
echo " <td align='right'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " <br><br>";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['description-notifications']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width='30%' class='vncellreq' valign='top' align='left' nowrap>\n";
echo $text['label-project_notifications']."\n";
echo " </td>\n";
echo " <td width='70%' class='vtable' align='left'>\n";
echo " <select name='project_notifications' class='formfld' style='width: auto;' onchange=\"$('#notification_channels').slideToggle();\">\n";
echo " <option value='false' ".(($setting["project_notifications"] == 'false') ? "selected='selected'" : null).">".$text['option-disabled']."</option>\n";
echo " <option value='true' ".(($setting["project_notifications"] == 'true') ? "selected='selected'" : null).">".$text['option-enabled']."</option>\n";
echo " </select><br />\n";
echo $text['description-project_notifications']."\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<div id='notification_channels' ".(($setting["project_notifications"] != 'true') ? "style='display: none;'" : null).">\n";
echo "<table cellpadding='6' cellspacing='0' width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo $text['label-project_security']."\n";
echo " </td>\n";
echo " <td width='70%' class='vtable' align='left'>\n";
echo " <select name='project_security' class='formfld' style='width: auto;'>\n";
echo " <option value='false' ".(($setting["project_security"] == 'false') ? "selected='selected'" : null).">".$text['option-disabled']."</option>\n";
echo " <option value='true' ".(($setting["project_security"] == 'true') ? "selected='selected'" : null).">".$text['option-enabled']."</option>\n";
echo " </select><br />\n";
echo $text['description-project_security']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
echo $text['label-project_releases']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <select name='project_releases' class='formfld' style='width: auto;'>\n";
echo " <option value='false' ".(($setting["project_releases"] == 'false') ? "selected='selected'" : null).">".$text['option-disabled']."</option>\n";
echo " <option value='true' ".(($setting["project_releases"] == 'true') ? "selected='selected'" : null).">".$text['option-enabled']."</option>\n";
echo " </select><br />\n";
echo $text['description-project_releases']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo $text['label-project_events']."\n";
echo " </td>\n";
echo " <td width='70%' class='vtable' align='left'>\n";
echo " <select name='project_events' class='formfld' style='width: auto;'>\n";
echo " <option value='false' ".(($setting["project_events"] == 'false') ? "selected='selected'" : null).">".$text['option-disabled']."</option>\n";
echo " <option value='true' ".(($setting["project_events"] == 'true') ? "selected='selected'" : null).">".$text['option-enabled']."</option>\n";
echo " </select><br />\n";
echo $text['description-project_events']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
echo $text['label-project_news']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <select name='project_news' class='formfld' style='width: auto;'>\n";
echo " <option value='false' ".(($setting["project_news"] == 'false') ? "selected='selected'" : null).">".$text['option-disabled']."</option>\n";
echo " <option value='true' ".(($setting["project_news"] == 'true') ? "selected='selected'" : null).">".$text['option-enabled']."</option>\n";
echo " </select><br />\n";
echo $text['description-project_news']."\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "<table cellpadding='6' cellspacing='0' width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo $text['label-project_notification_method']."\n";
echo " </td>\n";
echo " <td width='70%' class='vtable' align='left'>\n";
echo " <select name='project_notification_method' class='formfld' style='width: auto;'>\n";
echo " <option value='email' ".(($setting["project_notification_method"] == 'email') ? "selected='selected'" : null).">".$text['option-email']."</option>\n";
echo " </select><br />\n";
echo $text['description-project_notification_method']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='vncellreq' valign='top' align='left' nowrap>\n";
echo $text['label-project_notification_recipient']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='project_notification_recipient' maxlength='50' value='".$setting["project_notification_recipient"]."'><br />\n";
echo $text['description-project_notification_recipient']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td colspan='2' class='vtable' style='padding: 15px;' align='right'>\n";
echo " ".$text['message-disclaimer']."\n";
echo " <br /><br />\n";
echo " ".$text['message-demographics']." <a href='?demo'>".$text['message-demographics_click_here']."</a>.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table cellpadding='6' cellspacing='0' width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td align='right'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>\n";
echo "</form>\n";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br /><br />";
// include the footer
require_once "resources/footer.php";
?>
+50
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'] );
}
?>