Move email_templates

This commit is contained in:
markjcrane
2017-12-17 08:56:59 +00:00
parent fc7ab309a4
commit 0eee87d6c8
8 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
<?php
//application details
$apps[$x]['name'] = 'Email Templates';
$apps[$x]['uuid'] = '8173e738-2523-46d5-8943-13883befd2fd';
$apps[$x]['category'] = '';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en-us'] = '';
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = 'email_template_view';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'email_template_add';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'email_template_edit';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'email_template_delete';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'email_template_all';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
//Email Templates
$y = 2;
$apps[$x]['db'][$y]['table']['name'] = 'v_email_templates';
$apps[$x]['db'][$y]['table']['parent'] = '';
$z = 0;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'email_template_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'] = 'domain_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'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_language';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the language.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_category';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the category.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_subcategory';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the subcategory.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_subject';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the template subject.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_body';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the template body.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Set the status of the template.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the description.';
$z++;
?>

View File

@@ -0,0 +1,344 @@
<?php
//Email Templates
$text['title-email_templates']['en-us'] = 'Email Templates';
$text['title-email_templates']['ar-eg'] = '';
$text['title-email_templates']['de-at'] = '';
$text['title-email_templates']['de-ch'] = '';
$text['title-email_templates']['de-de'] = '';
$text['title-email_templates']['es-cl'] = '';
$text['title-email_templates']['es-mx'] = '';
$text['title-email_templates']['fr-ca'] = '';
$text['title-email_templates']['fr-fr'] = '';
$text['title-email_templates']['he-il'] = '';
$text['title-email_templates']['it-it'] = '';
$text['title-email_templates']['nl-nl'] = '';
$text['title-email_templates']['pl-pl'] = '';
$text['title-email_templates']['pt-br'] = '';
$text['title-email_templates']['pt-pt'] = '';
$text['title-email_templates']['ro-ro'] = '';
$text['title-email_templates']['ru-ru'] = '';
$text['title-email_templates']['sv-se'] = '';
$text['title-email_templates']['uk-ua'] = '';
$text['title-email_template']['en-us'] = 'Email Template';
$text['title-email_template']['ar-eg'] = '';
$text['title-email_template']['de-at'] = '';
$text['title-email_template']['de-ch'] = '';
$text['title-email_template']['de-de'] = '';
$text['title-email_template']['es-cl'] = '';
$text['title-email_template']['es-mx'] = '';
$text['title-email_template']['fr-ca'] = '';
$text['title-email_template']['fr-fr'] = '';
$text['title-email_template']['he-il'] = '';
$text['title-email_template']['it-it'] = '';
$text['title-email_template']['nl-nl'] = '';
$text['title-email_template']['pl-pl'] = '';
$text['title-email_template']['pt-br'] = '';
$text['title-email_template']['pt-pt'] = '';
$text['title-email_template']['ro-ro'] = '';
$text['title-email_template']['ru-ru'] = '';
$text['title-email_template']['sv-se'] = '';
$text['title-email_template']['uk-ua'] = '';
$text['title_description-email_template']['en-us'] = '';
$text['title_description-email_template']['ar-eg'] = '';
$text['title_description-email_template']['de-at'] = '';
$text['title_description-email_template']['de-ch'] = '';
$text['title_description-email_template']['de-de'] = '';
$text['title_description-email_template']['es-cl'] = '';
$text['title_description-email_template']['es-mx'] = '';
$text['title_description-email_template']['fr-ca'] = '';
$text['title_description-email_template']['fr-fr'] = '';
$text['title_description-email_template']['he-il'] = '';
$text['title_description-email_template']['it-it'] = '';
$text['title_description-email_template']['nl-nl'] = '';
$text['title_description-email_template']['pl-pl'] = '';
$text['title_description-email_template']['pt-br'] = '';
$text['title_description-email_template']['pt-pt'] = '';
$text['title_description-email_template']['ro-ro'] = '';
$text['title_description-email_template']['ru-ru'] = '';
$text['title_description-email_template']['sv-se'] = '';
$text['title_description-email_template']['uk-ua'] = '';
$text['label-template_language']['en-us'] = 'Language';
$text['label-template_language']['ar-eg'] = '';
$text['label-template_language']['de-at'] = '';
$text['label-template_language']['de-ch'] = '';
$text['label-template_language']['de-de'] = '';
$text['label-template_language']['es-cl'] = '';
$text['label-template_language']['es-mx'] = '';
$text['label-template_language']['fr-ca'] = '';
$text['label-template_language']['fr-fr'] = '';
$text['label-template_language']['he-il'] = '';
$text['label-template_language']['it-it'] = '';
$text['label-template_language']['nl-nl'] = '';
$text['label-template_language']['pl-pl'] = '';
$text['label-template_language']['pt-br'] = '';
$text['label-template_language']['pt-pt'] = '';
$text['label-template_language']['ro-ro'] = '';
$text['label-template_language']['ru-ru'] = '';
$text['label-template_language']['sv-se'] = '';
$text['label-template_language']['uk-ua'] = '';
$text['description-template_language']['en-us'] = 'Enter the language.';
$text['description-template_language']['ar-eg'] = '';
$text['description-template_language']['de-at'] = '';
$text['description-template_language']['de-ch'] = '';
$text['description-template_language']['de-de'] = '';
$text['description-template_language']['es-cl'] = '';
$text['description-template_language']['es-mx'] = '';
$text['description-template_language']['fr-ca'] = '';
$text['description-template_language']['fr-fr'] = '';
$text['description-template_language']['he-il'] = '';
$text['description-template_language']['it-it'] = '';
$text['description-template_language']['nl-nl'] = '';
$text['description-template_language']['pl-pl'] = '';
$text['description-template_language']['pt-br'] = '';
$text['description-template_language']['pt-pt'] = '';
$text['description-template_language']['ro-ro'] = '';
$text['description-template_language']['ru-ru'] = '';
$text['description-template_language']['sv-se'] = '';
$text['description-template_language']['uk-ua'] = '';
$text['label-template_category']['en-us'] = 'Category';
$text['label-template_category']['ar-eg'] = '';
$text['label-template_category']['de-at'] = '';
$text['label-template_category']['de-ch'] = '';
$text['label-template_category']['de-de'] = '';
$text['label-template_category']['es-cl'] = '';
$text['label-template_category']['es-mx'] = '';
$text['label-template_category']['fr-ca'] = '';
$text['label-template_category']['fr-fr'] = '';
$text['label-template_category']['he-il'] = '';
$text['label-template_category']['it-it'] = '';
$text['label-template_category']['nl-nl'] = '';
$text['label-template_category']['pl-pl'] = '';
$text['label-template_category']['pt-br'] = '';
$text['label-template_category']['pt-pt'] = '';
$text['label-template_category']['ro-ro'] = '';
$text['label-template_category']['ru-ru'] = '';
$text['label-template_category']['sv-se'] = '';
$text['label-template_category']['uk-ua'] = '';
$text['description-template_category']['en-us'] = 'Select the category.';
$text['description-template_category']['ar-eg'] = '';
$text['description-template_category']['de-at'] = '';
$text['description-template_category']['de-ch'] = '';
$text['description-template_category']['de-de'] = '';
$text['description-template_category']['es-cl'] = '';
$text['description-template_category']['es-mx'] = '';
$text['description-template_category']['fr-ca'] = '';
$text['description-template_category']['fr-fr'] = '';
$text['description-template_category']['he-il'] = '';
$text['description-template_category']['it-it'] = '';
$text['description-template_category']['nl-nl'] = '';
$text['description-template_category']['pl-pl'] = '';
$text['description-template_category']['pt-br'] = '';
$text['description-template_category']['pt-pt'] = '';
$text['description-template_category']['ro-ro'] = '';
$text['description-template_category']['ru-ru'] = '';
$text['description-template_category']['sv-se'] = '';
$text['description-template_category']['uk-ua'] = '';
$text['label-template_subcategory']['en-us'] = 'Subcategory';
$text['label-template_subcategory']['ar-eg'] = '';
$text['label-template_subcategory']['de-at'] = '';
$text['label-template_subcategory']['de-ch'] = '';
$text['label-template_subcategory']['de-de'] = '';
$text['label-template_subcategory']['es-cl'] = '';
$text['label-template_subcategory']['es-mx'] = '';
$text['label-template_subcategory']['fr-ca'] = '';
$text['label-template_subcategory']['fr-fr'] = '';
$text['label-template_subcategory']['he-il'] = '';
$text['label-template_subcategory']['it-it'] = '';
$text['label-template_subcategory']['nl-nl'] = '';
$text['label-template_subcategory']['pl-pl'] = '';
$text['label-template_subcategory']['pt-br'] = '';
$text['label-template_subcategory']['pt-pt'] = '';
$text['label-template_subcategory']['ro-ro'] = '';
$text['label-template_subcategory']['ru-ru'] = '';
$text['label-template_subcategory']['sv-se'] = '';
$text['label-template_subcategory']['uk-ua'] = '';
$text['description-template_subcategory']['en-us'] = 'Enter the subcategory.';
$text['description-template_subcategory']['ar-eg'] = '';
$text['description-template_subcategory']['de-at'] = '';
$text['description-template_subcategory']['de-ch'] = '';
$text['description-template_subcategory']['de-de'] = '';
$text['description-template_subcategory']['es-cl'] = '';
$text['description-template_subcategory']['es-mx'] = '';
$text['description-template_subcategory']['fr-ca'] = '';
$text['description-template_subcategory']['fr-fr'] = '';
$text['description-template_subcategory']['he-il'] = '';
$text['description-template_subcategory']['it-it'] = '';
$text['description-template_subcategory']['nl-nl'] = '';
$text['description-template_subcategory']['pl-pl'] = '';
$text['description-template_subcategory']['pt-br'] = '';
$text['description-template_subcategory']['pt-pt'] = '';
$text['description-template_subcategory']['ro-ro'] = '';
$text['description-template_subcategory']['ru-ru'] = '';
$text['description-template_subcategory']['sv-se'] = '';
$text['description-template_subcategory']['uk-ua'] = '';
$text['label-template_subject']['en-us'] = 'Subject';
$text['label-template_subject']['ar-eg'] = '';
$text['label-template_subject']['de-at'] = '';
$text['label-template_subject']['de-ch'] = '';
$text['label-template_subject']['de-de'] = '';
$text['label-template_subject']['es-cl'] = '';
$text['label-template_subject']['es-mx'] = '';
$text['label-template_subject']['fr-ca'] = '';
$text['label-template_subject']['fr-fr'] = '';
$text['label-template_subject']['he-il'] = '';
$text['label-template_subject']['it-it'] = '';
$text['label-template_subject']['nl-nl'] = '';
$text['label-template_subject']['pl-pl'] = '';
$text['label-template_subject']['pt-br'] = '';
$text['label-template_subject']['pt-pt'] = '';
$text['label-template_subject']['ro-ro'] = '';
$text['label-template_subject']['ru-ru'] = '';
$text['label-template_subject']['sv-se'] = '';
$text['label-template_subject']['uk-ua'] = '';
$text['description-template_subject']['en-us'] = 'Enter the template subject.';
$text['description-template_subject']['ar-eg'] = '';
$text['description-template_subject']['de-at'] = '';
$text['description-template_subject']['de-ch'] = '';
$text['description-template_subject']['de-de'] = '';
$text['description-template_subject']['es-cl'] = '';
$text['description-template_subject']['es-mx'] = '';
$text['description-template_subject']['fr-ca'] = '';
$text['description-template_subject']['fr-fr'] = '';
$text['description-template_subject']['he-il'] = '';
$text['description-template_subject']['it-it'] = '';
$text['description-template_subject']['nl-nl'] = '';
$text['description-template_subject']['pl-pl'] = '';
$text['description-template_subject']['pt-br'] = '';
$text['description-template_subject']['pt-pt'] = '';
$text['description-template_subject']['ro-ro'] = '';
$text['description-template_subject']['ru-ru'] = '';
$text['description-template_subject']['sv-se'] = '';
$text['description-template_subject']['uk-ua'] = '';
$text['label-template_body']['en-us'] = 'Body';
$text['label-template_body']['ar-eg'] = '';
$text['label-template_body']['de-at'] = '';
$text['label-template_body']['de-ch'] = '';
$text['label-template_body']['de-de'] = '';
$text['label-template_body']['es-cl'] = '';
$text['label-template_body']['es-mx'] = '';
$text['label-template_body']['fr-ca'] = '';
$text['label-template_body']['fr-fr'] = '';
$text['label-template_body']['he-il'] = '';
$text['label-template_body']['it-it'] = '';
$text['label-template_body']['nl-nl'] = '';
$text['label-template_body']['pl-pl'] = '';
$text['label-template_body']['pt-br'] = '';
$text['label-template_body']['pt-pt'] = '';
$text['label-template_body']['ro-ro'] = '';
$text['label-template_body']['ru-ru'] = '';
$text['label-template_body']['sv-se'] = '';
$text['label-template_body']['uk-ua'] = '';
$text['description-template_body']['en-us'] = 'Enter the template body.';
$text['description-template_body']['ar-eg'] = '';
$text['description-template_body']['de-at'] = '';
$text['description-template_body']['de-ch'] = '';
$text['description-template_body']['de-de'] = '';
$text['description-template_body']['es-cl'] = '';
$text['description-template_body']['es-mx'] = '';
$text['description-template_body']['fr-ca'] = '';
$text['description-template_body']['fr-fr'] = '';
$text['description-template_body']['he-il'] = '';
$text['description-template_body']['it-it'] = '';
$text['description-template_body']['nl-nl'] = '';
$text['description-template_body']['pl-pl'] = '';
$text['description-template_body']['pt-br'] = '';
$text['description-template_body']['pt-pt'] = '';
$text['description-template_body']['ro-ro'] = '';
$text['description-template_body']['ru-ru'] = '';
$text['description-template_body']['sv-se'] = '';
$text['description-template_body']['uk-ua'] = '';
$text['label-template_enabled']['en-us'] = 'Enabled';
$text['label-template_enabled']['ar-eg'] = '';
$text['label-template_enabled']['de-at'] = '';
$text['label-template_enabled']['de-ch'] = '';
$text['label-template_enabled']['de-de'] = '';
$text['label-template_enabled']['es-cl'] = '';
$text['label-template_enabled']['es-mx'] = '';
$text['label-template_enabled']['fr-ca'] = '';
$text['label-template_enabled']['fr-fr'] = '';
$text['label-template_enabled']['he-il'] = '';
$text['label-template_enabled']['it-it'] = '';
$text['label-template_enabled']['nl-nl'] = '';
$text['label-template_enabled']['pl-pl'] = '';
$text['label-template_enabled']['pt-br'] = '';
$text['label-template_enabled']['pt-pt'] = '';
$text['label-template_enabled']['ro-ro'] = '';
$text['label-template_enabled']['ru-ru'] = '';
$text['label-template_enabled']['sv-se'] = '';
$text['label-template_enabled']['uk-ua'] = '';
$text['description-template_enabled']['en-us'] = 'Set the status of the template.';
$text['description-template_enabled']['ar-eg'] = '';
$text['description-template_enabled']['de-at'] = '';
$text['description-template_enabled']['de-ch'] = '';
$text['description-template_enabled']['de-de'] = '';
$text['description-template_enabled']['es-cl'] = '';
$text['description-template_enabled']['es-mx'] = '';
$text['description-template_enabled']['fr-ca'] = '';
$text['description-template_enabled']['fr-fr'] = '';
$text['description-template_enabled']['he-il'] = '';
$text['description-template_enabled']['it-it'] = '';
$text['description-template_enabled']['nl-nl'] = '';
$text['description-template_enabled']['pl-pl'] = '';
$text['description-template_enabled']['pt-br'] = '';
$text['description-template_enabled']['pt-pt'] = '';
$text['description-template_enabled']['ro-ro'] = '';
$text['description-template_enabled']['ru-ru'] = '';
$text['description-template_enabled']['sv-se'] = '';
$text['description-template_enabled']['uk-ua'] = '';
$text['label-template_description']['en-us'] = 'Description';
$text['label-template_description']['ar-eg'] = '';
$text['label-template_description']['de-at'] = '';
$text['label-template_description']['de-ch'] = '';
$text['label-template_description']['de-de'] = '';
$text['label-template_description']['es-cl'] = '';
$text['label-template_description']['es-mx'] = '';
$text['label-template_description']['fr-ca'] = '';
$text['label-template_description']['fr-fr'] = '';
$text['label-template_description']['he-il'] = '';
$text['label-template_description']['it-it'] = '';
$text['label-template_description']['nl-nl'] = '';
$text['label-template_description']['pl-pl'] = '';
$text['label-template_description']['pt-br'] = '';
$text['label-template_description']['pt-pt'] = '';
$text['label-template_description']['ro-ro'] = '';
$text['label-template_description']['ru-ru'] = '';
$text['label-template_description']['sv-se'] = '';
$text['label-template_description']['uk-ua'] = '';
$text['description-template_description']['en-us'] = 'Enter the description.';
$text['description-template_description']['ar-eg'] = '';
$text['description-template_description']['de-at'] = '';
$text['description-template_description']['de-ch'] = '';
$text['description-template_description']['de-de'] = '';
$text['description-template_description']['es-cl'] = '';
$text['description-template_description']['es-mx'] = '';
$text['description-template_description']['fr-ca'] = '';
$text['description-template_description']['fr-fr'] = '';
$text['description-template_description']['he-il'] = '';
$text['description-template_description']['it-it'] = '';
$text['description-template_description']['nl-nl'] = '';
$text['description-template_description']['pl-pl'] = '';
$text['description-template_description']['pt-br'] = '';
$text['description-template_description']['pt-pt'] = '';
$text['description-template_description']['ro-ro'] = '';
$text['description-template_description']['ru-ru'] = '';
$text['description-template_description']['sv-se'] = '';
$text['description-template_description']['uk-ua'] = '';
?>

View File

@@ -0,0 +1,18 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = 'Email Templates';
$apps[$x]['menu'][0]['title']['es-cl'] = '';
$apps[$x]['menu'][0]['title']['fr-fr'] = '';
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
$apps[$x]['menu'][0]['title']['pl'] = '';
$apps[$x]['menu'][0]['title']['sv-se'] = '';
$apps[$x]['menu'][0]['title']['uk'] = '';
$apps[$x]['menu'][0]['title']['de-at'] = '';
$apps[$x]['menu'][0]['uuid'] = '5e548de3-ff1a-44e4-a2e6-f3917dac85a3';
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/email_templates/email_templates.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//$apps[$x]['menu'][0]['groups'][] = 'admin';
?>

View File

@@ -0,0 +1,64 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('email_template_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete the data
if (strlen($id)>0) {
//delete email_template
$sql = "delete from v_email_templates ";
$sql .= "where email_template_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//delete the message
messages::add($text['message-delete']);
//redirect the user
header('Location: email_templates.php');
?>

View File

@@ -0,0 +1,301 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('email_template_add') || permission_exists('email_template_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$email_template_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (is_array($_POST)) {
$domain_uuid = check_str($_POST["domain_uuid"]);
$template_language = check_str($_POST["template_language"]);
$template_category = check_str($_POST["template_category"]);
$template_subcategory = check_str($_POST["template_subcategory"]);
$template_subject = check_str($_POST["template_subject"]);
$template_body = check_str($_POST["template_body"]);
$template_enabled = check_str($_POST["template_enabled"]);
$template_description = check_str($_POST["template_description"]);
}
//process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the uuid from the POST
if ($action == "update") {
$email_template_uuid = check_str($_POST["email_template_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($template_language) == 0) { $msg .= $text['message-required']." ".$text['label-template_language']."<br>\n"; }
if (strlen($template_category) == 0) { $msg .= $text['message-required']." ".$text['label-template_category']."<br>\n"; }
//if (strlen($template_subcategory) == 0) { $msg .= $text['message-required']." ".$text['label-template_subcategory']."<br>\n"; }
if (strlen($template_subject) == 0) { $msg .= $text['message-required']." ".$text['label-template_subject']."<br>\n"; }
if (strlen($template_body) == 0) { $msg .= $text['message-required']." ".$text['label-template_body']."<br>\n"; }
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (strlen($template_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-template_enabled']."<br>\n"; }
//if (strlen($template_description) == 0) { $msg .= $text['message-required']." ".$text['label-template_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add the email_template_uuid
if (strlen($_POST["email_template_uuid"]) == 0) {
$email_template_uuid = uuid();
$_POST["email_template_uuid"] = $email_template_uuid;
}
//prepare the array
$array['email_templates'][0] = $_POST;
//save to the data
$database = new database;
$database->app_name = 'email_templates';
$database->app_uuid = null;
if (strlen($email_template_uuid) > 0) {
$database->uuid($email_template_uuid);
}
$database->save($array);
$message = $database->message;
//debug info
//echo "<pre>";
//print_r($message);
//echo "</pre>";
//exit;
//redirect the user
if (isset($action)) {
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
}
if ($action == "update") {
$_SESSION["message"] = $text['message-update'];
}
header('Location: email_template_edit.php?id='.$email_template_uuid);
return;
}
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
$email_template_uuid = check_str($_GET["id"]);
$sql = "select * from v_email_templates ";
$sql .= "where email_template_uuid = '$email_template_uuid' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
$template_language = $row["template_language"];
$template_category = $row["template_category"];
$template_subcategory = $row["template_subcategory"];
$template_subject = $row["template_subject"];
$template_body = $row["template_body"];
$template_enabled = $row["template_enabled"];
$template_description = $row["template_description"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-email_template']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='email_templates.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-template_language']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='template_language' maxlength='255' value=\"$template_language\">\n";
echo "<br />\n";
echo $text['description-template_language']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-template_category']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='template_category' maxlength='255' value=\"$template_category\">\n";
echo "<br />\n";
echo $text['description-template_category']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-template_subcategory']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='template_subcategory' maxlength='255' value=\"$template_subcategory\">\n";
echo "<br />\n";
echo $text['description-template_subcategory']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-template_subject']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='template_subject' maxlength='255' value=\"$template_subject\">\n";
echo "<br />\n";
echo $text['description-template_subject']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-template_body']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <textarea class='formfld' name='template_body' rows='8' style='width: 100%'>$template_body</textarea>\n";
echo "<br />\n";
echo $text['description-template_body']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-domain']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <select class='formfld' name='domain_uuid'>\n";
if (strlen($domain_uuid) == 0) {
echo " <option value='' selected='selected'>".$text['label-global']."</option>\n";
}
else {
echo " <option value=''>".$text['label-global']."</option>\n";
}
foreach ($_SESSION['domains'] as $row) {
if ($row['domain_uuid'] == $domain_uuid) {
echo " <option value='".$row['domain_uuid']."' selected='selected'>".$row['domain_name']."</option>\n";
}
else {
echo " <option value='".$row['domain_uuid']."'>".$row['domain_name']."</option>\n";
}
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-domain_uuid']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-template_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <select class='formfld' name='template_enabled'>\n";
echo " <option value=''></option>\n";
if ($template_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($template_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-template_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-template_description']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='template_description' maxlength='255' value=\"$template_description\">\n";
echo "<br />\n";
echo $text['description-template_description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='email_template_uuid' value='$email_template_uuid'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,272 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('email_template_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the action
if (is_array($_POST["email_templates"])) {
$email_templates = $_POST["email_templates"];
foreach($email_templates as $row) {
if ($row['action'] == 'delete') {
$action = 'delete';
break;
}
}
}
//delete the email_templates
if (permission_exists('email_template_delete')) {
if ($action == "delete") {
//download
$obj = new email_templates;
$obj->delete($email_templates);
//delete message
messages::add($text['message-delete']);
}
}
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = strtolower(check_str($_GET["search"]));
if (strlen($search) > 0) {
$sql_search = " (";
$sql_search .= " lower(template_language) like '%".$search."%' ";
$sql_search .= " or template_category like '%".$search."%' ";
$sql_search .= " or template_subcategory like '%".$search."%' ";
//$sql_search .= " or template_subject like '%".$search."%' ";
//$sql_search .= " or template_body like '%".$search."%' ";
$sql_search .= " or template_enabled like '%".$search."%' ";
$sql_search .= " or lower(template_description) like '%".$search."%' ";
$sql_search .= ") ";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(email_template_uuid) as num_rows from v_email_templates ";
if ($_GET['show'] == "all" && permission_exists('email_template_all')) {
if (isset($sql_search)) {
$sql .= "where ".$sql_search;
}
} else {
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (isset($sql_search)) {
$sql .= "and ".$sql_search;
}
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}
else {
$num_rows = '0';
}
}
//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, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_email_templates ";
if ($_GET['show'] == "all" && permission_exists('email_template_all')) {
if (isset($sql_search)) {
$sql .= "where ".$sql_search;
}
} else {
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (isset($sql_search)) {
$sql .= "and ".$sql_search;
}
}
if (strlen($order_by) == 0) {
$sql .= "order by template_language asc ";
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//define the checkbox_toggle function
echo "<script type=\"text/javascript\">\n";
echo " function checkbox_toggle(item) {\n";
echo " var inputs = document.getElementsByTagName(\"input\");\n";
echo " for (var i = 0, max = inputs.length; i < max; i++) {\n";
echo " if (inputs[i].type === 'checkbox') {\n";
echo " if (document.getElementById('checkbox_all').checked == true) {\n";
echo " inputs[i].checked = true;\n";
echo " }\n";
echo " else {\n";
echo " inputs[i].checked = false;\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo "</script>\n";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-email_templates']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
if (permission_exists('email_template_all')) {
if ($_GET['show'] == 'all') {
echo " <input type='hidden' name='show' value='all'>";
}
else {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='email_templates.php?show=all';\">\n";
}
}
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<form method='post' action=''>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <th style='width:30px;'>\n";
echo " <input type='checkbox' name='checkbox_all' id='checkbox_all' value='' onclick=\"checkbox_toggle();\">\n";
echo " </th>\n";
if ($_GET['show'] == "all" && permission_exists('email_template_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, '', '', $param);
}
echo th_order_by('template_language', $text['label-template_language'], $order_by, $order);
echo th_order_by('template_category', $text['label-template_category'], $order_by, $order);
echo th_order_by('template_subcategory', $text['label-template_subcategory'], $order_by, $order);
//echo th_order_by('domain_uuid', $text['label-domain_uuid'], $order_by, $order);
echo th_order_by('template_enabled', $text['label-template_enabled'], $order_by, $order);
echo th_order_by('template_description', $text['label-template_description'], $order_by, $order);
echo " <td class='list_control_icons'>";
if (permission_exists('email_template_add')) {
echo " <a href='email_template_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo " </td>\n";
echo "<tr>\n";
if (is_array($result)) {
$x = 0;
foreach($result as $row) {
if (permission_exists('email_template_edit')) {
$tr_link = "href='email_template_edit.php?id=".$row['email_template_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='align: center; padding: 3px 3px 0px 8px;'>\n";
echo " <input type='checkbox' name=\"email_templates[$x][checked]\" id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('chk_all_".$x."').checked = false; }\">\n";
echo " <input type='hidden' name=\"email_templates[$x][email_template_uuid]\" value='".$row['email_template_uuid']."' />\n";
echo " </td>\n";
if ($_GET['show'] == "all" && permission_exists('email_template_all')) {
echo " <td valign='top' class='".$row_style[$c]."'>".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."</td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>".$row['template_language']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['template_category']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['template_subcategory']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['template_subject']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['template_body']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_uuid']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['template_enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['template_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('email_template_edit')) {
echo "<a href='email_template_edit.php?id=".$row['email_template_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('email_template_delete')) {
echo "<button type='submit' class='btn btn-default list_control_icon' name=\"email_templates[$x][action]\" alt='".$text['button-delete']."' value='delete'><span class='glyphicon glyphicon-remove'></span></button>";
}
echo " </td>\n";
echo "</tr>\n";
$x++;
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='8' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('email_template_add')) {
echo "<a href='email_template_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</form>\n";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,75 @@
<?php
/**
* call_recordings class
*
* @method null download
*/
if (!class_exists('email_templates')) {
class email_templates {
public $db;
/**
* Called when the object is created
*/
public function __construct() {
//connect to the database if not connected
if (!$this->db) {
require_once "resources/classes/database.php";
$database = new database;
$database->connect();
$this->db = $database->db;
}
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* delete email_templates
*/
public function delete($email_templates) {
if (permission_exists('email_template_delete')) {
//delete multiple email_templates
if (is_array($email_templates)) {
//get the action
foreach($email_templates as $row) {
if ($row['action'] == 'delete') {
$action = 'delete';
break;
}
}
//delete the checked rows
if ($action == 'delete') {
foreach($email_templates as $row) {
if ($row['checked'] == 'true') {
$sql = "delete from v_email_templates ";
$sql .= "where email_template_uuid = '".$row['email_template_uuid']."'; ";
$this->db->query($sql);
unset($sql);
}
}
unset($email_templates);
}
}
}
} //end the delete function
} //end the class
}
/*
$obj = new email_templates;
$obj->delete();
*/
?>

View File

@@ -0,0 +1,90 @@
<?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"]);
}
?>