mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-04 02:43:48 +00:00
New Project Notifications feature, collect installation demographics.
This commit is contained in:
58
app/notifications/app_config.php
Normal file
58
app/notifications/app_config.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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/notifications_edit.php";
|
||||
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = "notifications_edit";
|
||||
$apps[$x]['permissions'][0]['menu']['uuid'] = "f8d65f91-0f4a-405a-b5ac-24cb3c4f10ba";
|
||||
$apps[$x]['permissions'][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
app/notifications/app_defaults.php
Normal file
54
app/notifications/app_defaults.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
137
app/notifications/app_languages.php
Normal file
137
app/notifications/app_languages.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?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 critical security updates.";
|
||||
$text['description-project_security']['es-cl'] = "Recibir notificaciones de actualizaciones de seguridad críticas.";
|
||||
$text['description-project_security']['pt-pt'] = "Receber notificações de atualizações críticas de segurança.";
|
||||
$text['description-project_security']['fr-fr'] = "Receber notificações de atualizações críticas 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 or Phone Number recipient.";
|
||||
$text['description-project_notification_recipient']['es-cl'] = "Introduzca la deseada correo electrónico o número de teléfono del destinatario.";
|
||||
$text['description-project_notification_recipient']['pt-pt'] = "Digite o endereço de email desejado ou número de telefone do destinatário.";
|
||||
$text['description-project_notification_recipient']['fr-fr'] = "Entrez l'adresse e-mail souhaitée ou bénéficiaire d'un numéro de téléphone.";
|
||||
|
||||
$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-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['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 FusionPBX Project Notifications implies 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 (only for approximating your geographical location). Any information collected will not be used to contact you individually, and will not be selectively shared with any 3rd party. 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 to the developers of FusionPBX.";
|
||||
$text['message-disclaimer']['es-cl'] = "";
|
||||
$text['message-disclaimer']['pt-pt'] = "";
|
||||
$text['message-disclaimer']['fr-fr'] = "";
|
||||
?>
|
||||
404
app/notifications/notifications_edit.php
Normal file
404
app/notifications/notifications_edit.php
Normal file
@@ -0,0 +1,404 @@
|
||||
<?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 (permission_exists("notifications_edit")) {
|
||||
//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);
|
||||
|
||||
// process submitted values
|
||||
if (count($_POST) > 0) {
|
||||
|
||||
// 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"]);
|
||||
|
||||
// check if remote record should be removed
|
||||
if ( $project_notifications == 'false' || (
|
||||
$project_security == 'false' &&
|
||||
$project_releases == 'false' &&
|
||||
$project_events == 'false' &&
|
||||
$project_news == 'false'
|
||||
)
|
||||
) {
|
||||
|
||||
// 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: notifications_edit.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// check for invalid recipient
|
||||
if (
|
||||
$project_notifications == 'true' &&
|
||||
(($project_notification_method == 'email' && !valid_email($project_notification_recipient)) ||
|
||||
($project_notification_method == 'email' && $project_notification_recipient == '') ||
|
||||
($project_notification_method == 'text' && $project_notification_recipient == '')
|
||||
)) {
|
||||
$_SESSION["message"] = $text['message-invalid_recipient'];
|
||||
header("Location: notifications_edit.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// collect 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"));
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
|
||||
// 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);
|
||||
// echo $url."<br><br>";
|
||||
// exit;
|
||||
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);
|
||||
|
||||
// redirect
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: notifications_edit.php");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$project_notifications = $row["project_notifications"];
|
||||
break; // limit to 1 row
|
||||
}
|
||||
}
|
||||
unset($sql, $prep_statement);
|
||||
|
||||
// if participation enabled
|
||||
if ($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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
require_once "resources/header.php";
|
||||
$page["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'>";
|
||||
if (permission_exists('notifications_edit')) {
|
||||
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 class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo $text['label-project_notifications']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " <select name='project_notifications' class='formfld' style='width: auto;'>\n";
|
||||
echo " <option value='false' ".(($project_notifications == 'false') ? "selected='selected'" : null).">".$text['option-disabled']."</option>\n";
|
||||
echo " <option value='true' ".(($project_notifications == 'true') ? "selected='selected'" : null).">".$text['option-enabled']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-project_notifications']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo $text['label-project_security']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <td 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>\n";
|
||||
echo " <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>\n";
|
||||
echo " <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>\n";
|
||||
echo " <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>\n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-project_news']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo $text['label-project_notification_method']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
//echo " <select name='project_notification_method' class='formfld' style='width: auto;' onchange=\"(this.selectedIndex != 0) ? document.getElementById('tr_project_notification_recipient').style.display='' : document.getElementById('tr_project_notification_recipient').style.display='none';\">\n";
|
||||
echo " <select name='project_notification_method' class='formfld' style='width: auto;'>\n";
|
||||
//echo " <option value='ticker' ".(($setting["project_notification_method"] == 'ticker') ? "selected='selected'" : null).">".$text['option-ticker']."</option>\n";
|
||||
echo " <option value='email' ".(($setting["project_notification_method"] == 'email') ? "selected='selected'" : null).">".$text['option-email']."</option>\n";
|
||||
//echo " <option value='text' ".(($setting["project_notification_method"] == 'text') ? "selected='selected'" : null).">".$text['option-text']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-project_notification_method']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
//echo " <tr id='tr_project_notification_recipient' ".(($project_notification_method != 'ticker') ? "style='display: none;'" : null).">\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"]."'>\n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-project_notification_recipient']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
if (permission_exists('notifications_edit')) {
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' 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 "<br><br>";
|
||||
echo "<div align='left'>".$text['message-disclaimer']."</div>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
// include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
50
app/notifications/root.php
Normal file
50
app/notifications/root.php
Normal 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'] );
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user