diff --git a/app/access_controls/root.php b/app/access_controls/root.php
index 899238f027..4728665dd8 100644
--- a/app/access_controls/root.php
+++ b/app/access_controls/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/adminer/root.php b/app/adminer/root.php
index 899238f027..4728665dd8 100644
--- a/app/adminer/root.php
+++ b/app/adminer/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/backup/root.php b/app/backup/root.php
index 899238f027..4728665dd8 100755
--- a/app/backup/root.php
+++ b/app/backup/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/call_block/root.php b/app/call_block/root.php
index 899238f027..4728665dd8 100644
--- a/app/call_block/root.php
+++ b/app/call_block/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/call_broadcast/call_broadcast_edit.php b/app/call_broadcast/call_broadcast_edit.php
index f8276c97b8..c43991bd42 100644
--- a/app/call_broadcast/call_broadcast_edit.php
+++ b/app/call_broadcast/call_broadcast_edit.php
@@ -65,7 +65,7 @@ else {
if (if_group("superadmin")){
$broadcast_accountcode = check_str($_POST["broadcast_accountcode"]);
}
- elseif (if_group("admin") && file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ elseif (if_group("admin") && file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
$sql_accountcode = "SELECT COUNT(*) as count FROM v_billings WHERE domain_uuid = '".$_SESSION['domain_uuid']."' AND type_value='".$_POST["accountcode"]."'";
$prep_statement_accountcode = $db->prepare(check_sql($sql_accountcode));
$prep_statement_accountcode->execute();
@@ -277,7 +277,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo $text['description-accountcode']."\n";
echo "\n";
echo "\n";
- }elseif (if_group("admin") && file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ }elseif (if_group("admin") && file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
$sql_accountcode = "SELECT type_value FROM v_billings WHERE domain_uuid = '".$_SESSION['domain_uuid']."'";
echo "
\n";
diff --git a/app/call_broadcast/root.php b/app/call_broadcast/root.php
index 899238f027..4728665dd8 100644
--- a/app/call_broadcast/root.php
+++ b/app/call_broadcast/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/call_center_active/root.php b/app/call_center_active/root.php
index 899238f027..4728665dd8 100644
--- a/app/call_center_active/root.php
+++ b/app/call_center_active/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php
index 81ce4acbfb..f9e5168856 100644
--- a/app/call_centers/call_center_queue_edit.php
+++ b/app/call_centers/call_center_queue_edit.php
@@ -266,7 +266,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
- $_SESSION["message"] = $text['message-add'];
+ //set the message
+ $_SESSION["message"] = $text['message-add'];
} //if ($action == "add")
if ($action == "update") {
diff --git a/app/call_centers/root.php b/app/call_centers/root.php
index 899238f027..4728665dd8 100644
--- a/app/call_centers/root.php
+++ b/app/call_centers/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/call_flows/root.php b/app/call_flows/root.php
index 899238f027..4728665dd8 100644
--- a/app/call_flows/root.php
+++ b/app/call_flows/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php
index f0ce961c96..0c5dd53241 100644
--- a/app/calls/call_edit.php
+++ b/app/calls/call_edit.php
@@ -79,7 +79,6 @@ else {
$sql .= "and extension = 'disabled' ";
}
}
- $sql .= "and enabled = 'true' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
diff --git a/app/calls/root.php b/app/calls/root.php
index 899238f027..4728665dd8 100644
--- a/app/calls/root.php
+++ b/app/calls/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/calls_active/root.php b/app/calls_active/root.php
index 899238f027..4728665dd8 100644
--- a/app/calls_active/root.php
+++ b/app/calls_active/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/click_to_call/root.php b/app/click_to_call/root.php
index 899238f027..4728665dd8 100644
--- a/app/click_to_call/root.php
+++ b/app/click_to_call/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/conference_centers/conference_room_edit.php b/app/conference_centers/conference_room_edit.php
index 9170244163..9b56e6f619 100644
--- a/app/conference_centers/conference_room_edit.php
+++ b/app/conference_centers/conference_room_edit.php
@@ -141,7 +141,7 @@ else {
}
//delete the user
- if ($_GET["a"] == "delete" && permission_exists('conference_room_add') && permission_exists('conference_room_edit')) {
+ if ($_GET["a"] == "delete" && permission_exists('conference_room_delete')) {
if (strlen($_REQUEST["meeting_user_uuid"]) > 0) {
//set the variables
$meeting_user_uuid = check_str($_REQUEST["meeting_user_uuid"]);
@@ -473,8 +473,28 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$enabled = $row["enabled"];
$description = $row["description"];
}
- unset ($prep_statement);
- }
+ unset ($prep_statement, $sql);
+ }
+
+//get the users array
+ $sql = "SELECT * FROM v_users ";
+ $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "order by username asc ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement, $sql);
+
+//get the users assigned to this meeting
+ $sql = "SELECT * FROM v_users as u, v_meeting_users as m ";
+ $sql .= "where u.user_uuid = m.user_uuid ";
+ $sql .= "and m.domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "and m.meeting_uuid = '$meeting_uuid' ";
+ $sql .= "order by u.username asc ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $meeting_users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement, $sql);
//set default profile
if (strlen($profile) == 0) { $profile = 'default'; }
@@ -572,56 +592,40 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ";
if (if_group("superadmin") || if_group("admin")) {
-
- echo " ";
- echo " ".$text['label-users']." ";
- echo " ";
- if ($action == "update") {
- echo " \n";
- $sql = "SELECT * FROM v_users as u, v_meeting_users as m ";
- $sql .= "where u.user_uuid = m.user_uuid ";
- $sql .= "and m.domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and m.meeting_uuid = '$meeting_uuid' ";
- $sql .= "order by u.username asc ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- $result_count = count($result);
- foreach($result as $field) {
- echo " \n";
- echo " ".$field['username']." \n";
- echo " \n";
- if ($result_count > 1) {
- echo " $v_link_label_delete \n";
+ echo " ";
+ echo " ".$text['label-users']." ";
+ echo " ";
+ if ($action == "update") {
+ echo " \n";
+ foreach($meeting_users as $field) {
+ echo " \n";
+ echo " ".$field['username']." \n";
+ echo " \n";
+ if (permission_exists('conference_room_delete')) {
+ echo " $v_link_label_delete \n";
+ }
+ echo " \n";
+ echo " \n";
}
- echo " \n";
- echo " \n";
+ echo "
\n";
}
- echo "
\n";
- }
-
- echo " \n";
- $sql = "SELECT * FROM v_users ";
- $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "order by username asc ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- echo " \n";
- echo " \n";
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- foreach($result as $field) {
- echo " ".$field['username']." \n";
- }
- echo " ";
- if ($action == "update") {
- echo " \n";
- }
- unset($sql, $result);
- echo " \n";
- echo " ".$text['description-users']."\n";
- echo " ";
- echo " ";
-
+ echo " \n";
+ if (permission_exists('conference_room_add')) {
+ echo " \n";
+ echo " \n";
+ foreach($users as $field) {
+ echo " ".$field['username']." \n";
+ }
+ echo " ";
+ if ($action == "update") {
+ echo " \n";
+ }
+ unset($users);
+ echo " \n";
+ }
+ echo " ".$text['description-users']."\n";
+ echo " ";
+ echo " ";
}
if (permission_exists('conference_room_profile')) {
diff --git a/app/conference_centers/root.php b/app/conference_centers/root.php
index 899238f027..4728665dd8 100644
--- a/app/conference_centers/root.php
+++ b/app/conference_centers/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/conferences/root.php b/app/conferences/root.php
index 899238f027..4728665dd8 100644
--- a/app/conferences/root.php
+++ b/app/conferences/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/conferences_active/root.php b/app/conferences_active/root.php
index 899238f027..4728665dd8 100644
--- a/app/conferences_active/root.php
+++ b/app/conferences_active/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/contacts/app_config.php b/app/contacts/app_config.php
index de26c0be08..0d2323ec06 100644
--- a/app/contacts/app_config.php
+++ b/app/contacts/app_config.php
@@ -102,6 +102,22 @@
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
+ $apps[$x]['permissions'][$y]['name'] = "contact_user_view";
+ $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+ $apps[$x]['permissions'][$y]['groups'][] = "admin";
+ $y++;
+ $apps[$x]['permissions'][$y]['name'] = "contact_user_add";
+ $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+ $apps[$x]['permissions'][$y]['groups'][] = "admin";
+ $y++;
+ $apps[$x]['permissions'][$y]['name'] = "contact_user_edit";
+ $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+ $apps[$x]['permissions'][$y]['groups'][] = "admin";
+ $y++;
+ $apps[$x]['permissions'][$y]['name'] = "contact_user_delete";
+ $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+ $apps[$x]['permissions'][$y]['groups'][] = "admin";
+ $y++;
$apps[$x]['permissions'][$y]['name'] = "contact_email_view";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
@@ -294,7 +310,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
- $y = 1; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_addresses";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_address_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
@@ -374,7 +390,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";
$z++;
- $y = 2; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_phones";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_phone_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
@@ -438,7 +454,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";
$z++;
- $y = 3; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_notes";
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "id";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "contacts_note_id";
@@ -496,7 +512,44 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
- $y = 4; //table array index
+ $y++; //table array index
+ $apps[$x]['db'][$y]['table'] = "v_contact_users";
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_user_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";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $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";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_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_contacts";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "contact_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "user_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_users";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "user_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_groups";
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "contact_group_uuid";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "contact_groups_uuid";
@@ -534,7 +587,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
- $y = 5; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_settings";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_setting_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
@@ -585,7 +638,7 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
- $y = 6; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_relations";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_relation_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
@@ -622,7 +675,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
- $y = 7; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_emails";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_email_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
@@ -666,7 +719,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the email description.";
$z++;
- $y = 8; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_urls";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_url_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
@@ -714,7 +767,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the URL description.";
$z++;
- $y = 9; //table array index
+ $y++; //table array index
$apps[$x]['db'][$y]['table'] = 'v_contact_times';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
diff --git a/app/contacts/app_defaults.php b/app/contacts/app_defaults.php
index ad1094ffcc..5a03ed8ea4 100644
--- a/app/contacts/app_defaults.php
+++ b/app/contacts/app_defaults.php
@@ -2,183 +2,217 @@
if ($domains_processed == 1) {
- require_once "resources/classes/schema.php";
-
//populate new phone_label values, phone_type_* values
- $obj = new schema;
- $obj->db = $db;
- $obj->db_type = $db_type;
- $obj->schema();
- $field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists
- if ($field_exists) {
- //add multi-lingual support
- $language = new text;
- $text = $language->get();
+ $obj = new schema;
+ $obj->db = $db;
+ $obj->db_type = $db_type;
+ $obj->schema();
+ $field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists
+ if ($field_exists) {
+ //add multi-lingual support
+ $language = new text;
+ $text = $language->get();
- // populate phone_type_* values
- $sql = "update v_contact_phones set phone_type_voice = '1' ";
- $sql .= "where phone_type = 'home' ";
- $sql .= "or phone_type = 'work' ";
- $sql .= "or phone_type = 'voice' ";
- $sql .= "or phone_type = 'voicemail' ";
- $sql .= "or phone_type = 'cell' ";
- $sql .= "or phone_type = 'pcs' ";
- $db->exec(check_sql($sql));
- unset($sql);
- $sql = "update v_contact_phones set phone_type_fax = '1' where phone_type = 'fax'";
- $db->exec(check_sql($sql));
- unset($sql);
- $sql = "update v_contact_phones set phone_type_video = '1' where phone_type = 'video'";
- $db->exec(check_sql($sql));
- unset($sql);
- $sql = "update v_contact_phones set phone_type_text = '1' where phone_type = 'cell' or phone_type = 'pager'";
- $db->exec(check_sql($sql));
- unset($sql);
+ // populate phone_type_* values
+ $sql = "update v_contact_phones set phone_type_voice = '1' ";
+ $sql .= "where phone_type = 'home' ";
+ $sql .= "or phone_type = 'work' ";
+ $sql .= "or phone_type = 'voice' ";
+ $sql .= "or phone_type = 'voicemail' ";
+ $sql .= "or phone_type = 'cell' ";
+ $sql .= "or phone_type = 'pcs' ";
+ $db->exec(check_sql($sql));
+ unset($sql);
- // migrate phone_type values to phone_label, correct case and make multilingual where appropriate
- $default_phone_types = array('home','work','pref','voice','fax','msg','cell','pager','modem','car','isdn','video','pcs');
- $default_phone_labels = array($text['option-home'],$text['option-work'],'Pref','Voice',$text['option-fax'],$text['option-voicemail'],$text['option-mobile'],$text['option-pager'],'Modem','Car','ISDN','Video','PCS');
- foreach ($default_phone_types as $index => $old) {
- $new = $default_phone_labels[$index];
- $sql = "update v_contact_phones set phone_label = '".$new."' where phone_type = '".$old."'";
+ $sql = "update v_contact_phones set phone_type_fax = '1' where phone_type = 'fax'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+
+ $sql = "update v_contact_phones set phone_type_video = '1' where phone_type = 'video'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+
+ $sql = "update v_contact_phones set phone_type_text = '1' where phone_type = 'cell' or phone_type = 'pager'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+
+ // migrate phone_type values to phone_label, correct case and make multilingual where appropriate
+ $default_phone_types = array('home','work','pref','voice','fax','msg','cell','pager','modem','car','isdn','video','pcs');
+ $default_phone_labels = array($text['option-home'],$text['option-work'],'Pref','Voice',$text['option-fax'],$text['option-voicemail'],$text['option-mobile'],$text['option-pager'],'Modem','Car','ISDN','Video','PCS');
+ foreach ($default_phone_types as $index => $old) {
+ $new = $default_phone_labels[$index];
+ $sql = "update v_contact_phones set phone_label = '".$new."' where phone_type = '".$old."'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ }
+
+ // empty phone_type field to prevent confusion in the future
+ $sql = "update v_contact_phones set phone_type = null";
$db->exec(check_sql($sql));
unset($sql);
}
-
- // empty phone_type field to prevent confusion in the future
- $sql = "update v_contact_phones set phone_type = null";
- $db->exec(check_sql($sql));
- unset($sql);
- }
- unset($obj);
+ unset($obj);
//populate primary email from deprecated field in v_contact table
- $obj = new schema;
- $obj->db = $db;
- $obj->db_type = $db_type;
- $obj->schema();
- $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists
- if ($field_exists) {
- // get email records
- $sql = "select * from v_contacts where contact_email is not null and contact_email != ''";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- $result_count = count($result);
- unset ($prep_statement, $sql);
- if ($result_count > 0) {
- foreach($result as $row) {
- $sql = "insert into v_contact_emails ";
- $sql .= "(";
- $sql .= "domain_uuid, ";
- $sql .= "contact_uuid, ";
- $sql .= "contact_email_uuid, ";
- $sql .= "email_primary, ";
- $sql .= "email_address";
- $sql .= ")";
- $sql .= "values ";
- $sql .= "(";
- $sql .= "'".$row['domain_uuid']."', ";
- $sql .= "'".$row['contact_uuid']."', ";
- $sql .= "'".uuid()."', ";
- $sql .= "1, ";
- $sql .= "'".$row['contact_email']."' ";
- $sql .= ")";
- $db->exec(check_sql($sql));
- unset($sql);
+ $obj = new schema;
+ $obj->db = $db;
+ $obj->db_type = $db_type;
+ $obj->schema();
+ $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists
+ if ($field_exists) {
+ // get email records
+ $sql = "select * from v_contacts where contact_email is not null and contact_email != ''";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ $result_count = count($result);
+ unset ($prep_statement, $sql);
+ if ($result_count > 0) {
+ foreach($result as $row) {
+ $sql = "insert into v_contact_emails ";
+ $sql .= "(";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "contact_email_uuid, ";
+ $sql .= "email_primary, ";
+ $sql .= "email_address";
+ $sql .= ")";
+ $sql .= "values ";
+ $sql .= "(";
+ $sql .= "'".$row['domain_uuid']."', ";
+ $sql .= "'".$row['contact_uuid']."', ";
+ $sql .= "'".uuid()."', ";
+ $sql .= "1, ";
+ $sql .= "'".$row['contact_email']."' ";
+ $sql .= ")";
+ $db->exec(check_sql($sql));
+ unset($sql);
- //verify and remove value from old field
- $sql2 = "select email_address from v_contact_emails ";
- $sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
- $sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
- $sql2 .= "and email_address = '".$row['contact_email']."' ";
- $prep_statement2 = $db->prepare(check_sql($sql2));
- $prep_statement2->execute();
- $result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
- $result_count2 = count($result2);
- if ($result_count2 > 0) {
- $sql3 = "update v_contacts set contact_email = '' ";
- $sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
- $sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
- $prep_statement3 = $db->prepare(check_sql($sql3));
- $prep_statement3->execute();
- unset($sql3, $prep_statement3);
+ //verify and remove value from old field
+ $sql2 = "select email_address from v_contact_emails ";
+ $sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $sql2 .= "and email_address = '".$row['contact_email']."' ";
+ $prep_statement2 = $db->prepare(check_sql($sql2));
+ $prep_statement2->execute();
+ $result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
+ $result_count2 = count($result2);
+ if ($result_count2 > 0) {
+ $sql3 = "update v_contacts set contact_email = '' ";
+ $sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $prep_statement3 = $db->prepare(check_sql($sql3));
+ $prep_statement3->execute();
+ unset($sql3, $prep_statement3);
+ }
+ unset($sql2, $result2, $prep_statement2);
}
- unset($sql2, $result2, $prep_statement2);
}
}
- }
- unset($obj);
+ unset($obj);
//populate primary url from deprecated field in v_contact table
- $obj = new schema;
- $obj->db = $db;
- $obj->db_type = $db_type;
- $obj->schema();
- $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists
- if ($field_exists) {
- // get email records
- $sql = "select * from v_contacts where contact_url is not null and contact_url != ''";
+ $obj = new schema;
+ $obj->db = $db;
+ $obj->db_type = $db_type;
+ $obj->schema();
+ $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists
+ if ($field_exists) {
+ // get email records
+ $sql = "select * from v_contacts where contact_url is not null and contact_url != ''";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ $result_count = count($result);
+ unset ($prep_statement, $sql);
+ if ($result_count > 0) {
+ foreach($result as $row) {
+ $sql = "insert into v_contact_urls ";
+ $sql .= "(";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "contact_url_uuid, ";
+ $sql .= "url_primary, ";
+ $sql .= "url_address";
+ $sql .= ")";
+ $sql .= "values ";
+ $sql .= "(";
+ $sql .= "'".$row['domain_uuid']."', ";
+ $sql .= "'".$row['contact_uuid']."', ";
+ $sql .= "'".uuid()."', ";
+ $sql .= "1, ";
+ $sql .= "'".$row['contact_url']."' ";
+ $sql .= ")";
+ $db->exec(check_sql($sql));
+ unset($sql);
+
+ //verify and remove value from old field
+ $sql2 = "select url_address from v_contact_urls ";
+ $sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $sql2 .= "and url_address = '".$row['contact_url']."' ";
+ $prep_statement2 = $db->prepare(check_sql($sql2));
+ $prep_statement2->execute();
+ $result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
+ $result_count2 = count($result2);
+ if ($result_count2 > 0) {
+ $sql3 = "update v_contacts set contact_url = '' ";
+ $sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $prep_statement3 = $db->prepare(check_sql($sql3));
+ $prep_statement3->execute();
+ unset($sql3, $prep_statement3);
+ }
+ unset($sql2, $result2, $prep_statement2);
+ }
+ }
+ }
+ unset($obj);
+
+ //set [name]_primary fields to 0 where null
+ $name_tables = array('phones','addresses','emails','urls');
+ $name_fields = array('phone','address','email','url');
+ foreach ($name_tables as $name_index => $name_table) {
+ $sql = "update v_contact_".$name_table." set ".$name_fields[$name_index]."_primary = 0 ";
+ $sql .= "where ".$name_fields[$name_index]."_primary is null ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ unset($sql, $prep_statement);
+ }
+ unset($name_tables, $name_fields);
+
+ //move the users from the contact groups table into the contact users table
+ $sql = "select * from v_contact_groups ";
+ $sql .= "where group_uuid in (select user_uuid from v_users) ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- $result_count = count($result);
- unset ($prep_statement, $sql);
- if ($result_count > 0) {
- foreach($result as $row) {
- $sql = "insert into v_contact_urls ";
- $sql .= "(";
- $sql .= "domain_uuid, ";
- $sql .= "contact_uuid, ";
- $sql .= "contact_url_uuid, ";
- $sql .= "url_primary, ";
- $sql .= "url_address";
- $sql .= ")";
- $sql .= "values ";
- $sql .= "(";
- $sql .= "'".$row['domain_uuid']."', ";
- $sql .= "'".$row['contact_uuid']."', ";
- $sql .= "'".uuid()."', ";
- $sql .= "1, ";
- $sql .= "'".$row['contact_url']."' ";
- $sql .= ")";
- $db->exec(check_sql($sql));
- unset($sql);
+ foreach ($result as &$row) {
+ $sql = "insert into v_contact_users ";
+ $sql .= "( ";
+ $sql .= "contact_user_uuid, ";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "user_uuid ";
+ $sql .= ") ";
+ $sql .= "values ";
+ $sql .= "( ";
+ $sql .= "'".uuid()."', ";
+ $sql .= "'".$row["domain_uuid"]."', ";
+ $sql .= "'".$row["contact_uuid"]."', ";
+ $sql .= "'".$row["group_uuid"]."' ";
+ $sql .= ");";
+ //echo $sql."\n";
+ $db->exec($sql);
+ unset($sql);
- //verify and remove value from old field
- $sql2 = "select url_address from v_contact_urls ";
- $sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
- $sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
- $sql2 .= "and url_address = '".$row['contact_url']."' ";
- $prep_statement2 = $db->prepare(check_sql($sql2));
- $prep_statement2->execute();
- $result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
- $result_count2 = count($result2);
- if ($result_count2 > 0) {
- $sql3 = "update v_contacts set contact_url = '' ";
- $sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
- $sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
- $prep_statement3 = $db->prepare(check_sql($sql3));
- $prep_statement3->execute();
- unset($sql3, $prep_statement3);
- }
- unset($sql2, $result2, $prep_statement2);
- }
+ $sql = "delete from v_contact_groups ";
+ $sql .= "where contact_group_uuid = '".$row["contact_group_uuid"]."';";
+ //echo $sql."\n";
+ $db->exec($sql);
+ unset($sql);
}
- }
- unset($obj);
-
- //set [name]_primary fields to 0 where null
- $name_tables = array('phones','addresses','emails','urls');
- $name_fields = array('phone','address','email','url');
- foreach ($name_tables as $name_index => $name_table) {
- $sql = "update v_contact_".$name_table." set ".$name_fields[$name_index]."_primary = 0 ";
- $sql .= "where ".$name_fields[$name_index]."_primary is null ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- unset($sql, $prep_statement);
- }
- unset($name_tables, $name_fields);
+ unset ($prep_statement);
}
diff --git a/app/contacts/app_languages.php b/app/contacts/app_languages.php
index 2e2031957f..a17b05f209 100644
--- a/app/contacts/app_languages.php
+++ b/app/contacts/app_languages.php
@@ -1033,6 +1033,16 @@ $text['label-import_delimiter']['sv-se'] = "Avgränsare";
$text['label-import_delimiter']['de-at'] = "Trennzeichen";
$text['label-import_delimiter']['he'] = "";
+$text['label-users']['en-us'] = "Users";
+$text['label-users']['es-cl'] = "Usuarios";
+$text['label-users']['pt-pt'] = "Utilizadores";
+$text['label-users']['fr-fr'] = "Utilisateurs";
+$text['label-users']['pt-br'] = "Usuários";
+$text['label-users']['pl'] = "Użytkownicy";
+$text['label-users']['sv-se'] = "Användare";
+$text['label-users']['uk'] = "Користувачі";
+$text['label-users']['de-at'] = "Benutzer";
+
$text['label-groups']['en-us'] = "Groups";
$text['label-groups']['es-cl'] = "Grupos";
$text['label-groups']['pt-pt'] = "Grupos";
@@ -2108,11 +2118,21 @@ $text['description-import_delimiter']['sv-se'] = "Välj avgränsare (comma or pi
$text['description-import_delimiter']['de-at'] = "Wählen Sie das Trennzeichen (Beistrich oder Wagrechter Strich)";
$text['description-import_delimiter']['he'] = "";
-$text['description-groups']['en-us'] = "Contacts assigned to a group are only visible to users in the group. Contacts not assigned to a group will be visible to all users in the domain.";
+$text['description-users']['en-us'] = "Select the users that are allowed to view this contact.";
+$text['description-users']['es-cl'] = "Asignar usuarios adicionales como administradores de esta sala de conferencia.";
+$text['description-users']['pt-pt'] = "Atribuir utilizadores adicionais como administradores da sala de conferência.";
+$text['description-users']['fr-fr'] = "Ajouter des utilisateurs comme administrateurs des cette salle de conférence.";
+$text['description-users']['pt-br'] = "Selecione os usuários que podem ver este contato. ";
+$text['description-users']['pl'] = "'Dodaj dodatkowych użytkowników jako administratorów tego pokoju konferencyjnego.";
+$text['description-users']['sv-se'] = "Lägg till ytterligare användare som administratörer för detta konferensrum.";
+$text['description-users']['uk'] = "Зв'язати додаткових користувачів як адміністраторів цього конференц-залу.";
+$text['description-users']['de-at'] = "Weisen Sie diesem Konferenzraum weitere Administratoren zu. ";
+
+$text['description-groups']['en-us'] = "Select the groups that are allowed to view this contact.";
$text['description-groups']['es-cl'] = "Contactos asignados a un grupo sólo son visibles para los usuarios del grupo. Los contactos no asignados a un grupo serán visibles para todos los usuarios del dominio.";
$text['description-groups']['pt-pt'] = "Contatos atribuídos a um grupo só são visíveis para os usuários do grupo. Contatos não atribuídos a um grupo será visível para todos os usuários no domínio.";
$text['description-groups']['fr-fr'] = "Contacts affectés à un groupe ne sont accessibles qu'aux utilisateurs du groupe. Contacts ne sont pas affectés à un groupe seront visibles à tous les utilisateurs dans le domaine.";
-$text['description-groups']['pt-br'] = "Descrição";
+$text['description-groups']['pt-br'] = "Selecione os grupos que podem ver este contato";
$text['description-groups']['pl'] = "Kontaky przypisane do grupy, są widoczne tylko dla użytkowników w grupie. Kontakty nie przypisane do grupy będą widoczna dla wszystkich użytkowników w domenie.";
$text['description-groups']['uk'] = "Опис";
$text['description-groups']['sv-se'] = "Kontakter tilldelade till en grupp är endast synbara för användare i guppen. Kontakter som inte är tilldelade till någon grupp syns för alla användare i hela domänen.";
diff --git a/app/contacts/contact_delete.php b/app/contacts/contact_delete.php
index 8fc0b73f36..a3b1732152 100644
--- a/app/contacts/contact_delete.php
+++ b/app/contacts/contact_delete.php
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane
- Portions created by the Initial Developer are Copyright (C) 2008-2012
+ Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -106,7 +106,15 @@ if (strlen($contact_uuid) > 0) {
$prep_statement->execute();
unset($prep_statement, $sql);
- //delete groups
+ //delete contact users
+ $sql = "delete from v_contact_users ";
+ $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "and contact_uuid = '".$contact_uuid."' ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ unset($prep_statement, $sql);
+
+ //delete contact groups
$sql = "delete from v_contact_groups ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
diff --git a/app/contacts/contact_edit.php b/app/contacts/contact_edit.php
index db8e56fb92..883977907e 100644
--- a/app/contacts/contact_edit.php
+++ b/app/contacts/contact_edit.php
@@ -26,7 +26,7 @@
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
-if (permission_exists('contact_edit')) {
+if (permission_exists('contact_view')) {
//access granted
}
else {
@@ -38,21 +38,6 @@ else {
$language = new text;
$text = $language->get();
-//handle removal of contact group
- if ($_GET['a'] == 'delete') {
- $contact_uuid = $_GET["id"];
- $contact_group_uuid = $_GET["cgid"];
- $sql = "delete from v_contact_groups ";
- $sql .= "where contact_uuid = '".$contact_uuid."' ";
- $sql .= "and contact_group_uuid = '".$contact_group_uuid."' ";
- $db->exec(check_sql($sql));
- unset($sql);
-
- $_SESSION["message"] = $text['message-update'];
- header("Location: contact_edit.php?id=".$contact_uuid);
- exit;
- }
-
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
@@ -63,7 +48,8 @@ else {
}
//get http post variables and set them to php variables
- if (count($_POST)>0) {
+ if (count($_POST) > 0) {
+ $user_uuid = check_str($_POST["user_uuid"]);
$contact_type = check_str($_POST["contact_type"]);
$contact_organization = check_str($_POST["contact_organization"]);
$contact_name_prefix = check_str($_POST["contact_name_prefix"]);
@@ -117,141 +103,144 @@ else {
//add or update the database
if ($_POST["persistformvar"] != "true") {
- //update last modified
- $sql = "update v_contacts set ";
- $sql .= "last_mod_date = now(), ";
- $sql .= "last_mod_user = '".$_SESSION['username']."' ";
- $sql .= "where domain_uuid = '".$domain_uuid."' ";
- $sql .= "and contact_uuid = '".$contact_uuid."' ";
- $db->exec(check_sql($sql));
- unset($sql);
+ //add the contact
+ if ($action == "add" && permission_exists('contact_add')) {
+ $contact_uuid = uuid();
+ $sql = "insert into v_contacts ";
+ $sql .= "( ";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "contact_type, ";
+ $sql .= "contact_organization, ";
+ $sql .= "contact_name_prefix, ";
+ $sql .= "contact_name_given, ";
+ $sql .= "contact_name_middle, ";
+ $sql .= "contact_name_family, ";
+ $sql .= "contact_name_suffix, ";
+ $sql .= "contact_nickname, ";
+ $sql .= "contact_title, ";
+ $sql .= "contact_category, ";
+ $sql .= "contact_role, ";
+ $sql .= "contact_time_zone, ";
+ $sql .= "contact_note, ";
+ $sql .= "last_mod_date, ";
+ $sql .= "last_mod_user ";
+ $sql .= ") ";
+ $sql .= "values ";
+ $sql .= "( ";
+ $sql .= "'".$_SESSION['domain_uuid']."', ";
+ $sql .= "'".$contact_uuid."', ";
+ $sql .= "'".$contact_type."', ";
+ $sql .= "'".$contact_organization."', ";
+ $sql .= "'".$contact_name_prefix."', ";
+ $sql .= "'".$contact_name_given."', ";
+ $sql .= "'".$contact_name_middle."', ";
+ $sql .= "'".$contact_name_family."', ";
+ $sql .= "'".$contact_name_suffix."', ";
+ $sql .= "'".$contact_nickname."', ";
+ $sql .= "'".$contact_title."', ";
+ $sql .= "'".$contact_category."', ";
+ $sql .= "'".$contact_role."', ";
+ $sql .= "'".$contact_time_zone."', ";
+ $sql .= "'".$contact_note."', ";
+ $sql .= "now(), ";
+ $sql .= "'".$_SESSION['username']."' ";
+ $sql .= ")";
+ $db->exec(check_sql($sql));
+ unset($sql);
- if ($action == "add") {
- $contact_uuid = uuid();
- $sql = "insert into v_contacts ";
- $sql .= "( ";
- $sql .= "domain_uuid, ";
- $sql .= "contact_uuid, ";
- $sql .= "contact_type, ";
- $sql .= "contact_organization, ";
- $sql .= "contact_name_prefix, ";
- $sql .= "contact_name_given, ";
- $sql .= "contact_name_middle, ";
- $sql .= "contact_name_family, ";
- $sql .= "contact_name_suffix, ";
- $sql .= "contact_nickname, ";
- $sql .= "contact_title, ";
- $sql .= "contact_category, ";
- $sql .= "contact_role, ";
- $sql .= "contact_time_zone, ";
- $sql .= "contact_note, ";
- $sql .= "last_mod_date, ";
- $sql .= "last_mod_user ";
- $sql .= ") ";
- $sql .= "values ";
- $sql .= "( ";
- $sql .= "'".$_SESSION['domain_uuid']."', ";
- $sql .= "'".$contact_uuid."', ";
- $sql .= "'".$contact_type."', ";
- $sql .= "'".$contact_organization."', ";
- $sql .= "'".$contact_name_prefix."', ";
- $sql .= "'".$contact_name_given."', ";
- $sql .= "'".$contact_name_middle."', ";
- $sql .= "'".$contact_name_family."', ";
- $sql .= "'".$contact_name_suffix."', ";
- $sql .= "'".$contact_nickname."', ";
- $sql .= "'".$contact_title."', ";
- $sql .= "'".$contact_category."', ";
- $sql .= "'".$contact_role."', ";
- $sql .= "'".$contact_time_zone."', ";
- $sql .= "'".$contact_note."', ";
- $sql .= "now(), ";
- $sql .= "'".$_SESSION['username']."' ";
- $sql .= ")";
- $db->exec(check_sql($sql));
- unset($sql);
+ $_SESSION["message"] = $text['message-add'];
+ $location = "contact_edit.php?id=".$contact_uuid;
+ } //if ($action == "add")
- $_SESSION["message"] = $text['message-add'];
- $location = "contact_edit.php?id=".$contact_uuid;
- } //if ($action == "add")
+ //update the contact
+ if ($action == "update" && permission_exists('contact_edit')) {
+ $sql = "update v_contacts set ";
+ $sql .= "contact_type = '".$contact_type."', ";
+ $sql .= "contact_organization = '".$contact_organization."', ";
+ $sql .= "contact_name_prefix = '".$contact_name_prefix."', ";
+ $sql .= "contact_name_given = '".$contact_name_given."', ";
+ $sql .= "contact_name_middle = '".$contact_name_middle."', ";
+ $sql .= "contact_name_family = '".$contact_name_family."', ";
+ $sql .= "contact_name_suffix = '".$contact_name_suffix."', ";
+ $sql .= "contact_nickname = '".$contact_nickname."', ";
+ $sql .= "contact_title = '".$contact_title."', ";
+ $sql .= "contact_category = '".$contact_category."', ";
+ $sql .= "contact_role = '".$contact_role."', ";
+ $sql .= "contact_time_zone = '".$contact_time_zone."', ";
+ $sql .= "contact_note = '".$contact_note."', ";
+ $sql .= "last_mod_date = now(), ";
+ $sql .= "last_mod_user = '".$_SESSION['username']."' ";
+ $sql .= "where domain_uuid = '".$domain_uuid."' ";
+ $sql .= "and contact_uuid = '".$contact_uuid."' ";
+ $db->exec(check_sql($sql));
+ unset($sql);
- //if contact is shared, remove contact group record containing user's uuid
- if ($_POST['contact_shared'] == 'true') {
- $sql = "delete from v_contact_groups ";
- $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and contact_uuid = '".$contact_uuid."' ";
- $sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- unset($prep_statement, $sql);
- $group_uuid = $_POST['group_uuid'];
- }
- //if private contact, delete any groups currently assigned, set group uuid to user's uuid
- else {
- $sql = "delete from v_contact_groups ";
- $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and contact_uuid = '".$contact_uuid."' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- unset($prep_statement, $sql);
- $group_uuid = $_SESSION["user_uuid"];
- }
+ $_SESSION["message"] = $text['message-update'];
+ $location = "contact_edit.php?id=".$contact_uuid;
+ } //if ($action == "update")
- //handle insertion of contact group (or private contact, if not shared)
- if ($group_uuid != '') {
- $sql = "insert into v_contact_groups ";
- $sql .= "( ";
- $sql .= "contact_group_uuid, ";
- $sql .= "domain_uuid, ";
- $sql .= "contact_uuid, ";
- $sql .= "group_uuid ";
- $sql .= ") ";
- $sql .= "values ";
- $sql .= "( ";
- $sql .= "'".uuid()."', ";
- $sql .= "'".$domain_uuid."', ";
- $sql .= "'".$contact_uuid."', ";
- $sql .= "'".$group_uuid."' ";
- $sql .= ") ";
- $db->exec(check_sql($sql));
- unset($sql);
- }
+ //assign the contact to the user that added the contact
+ if ($action == "add" && !permission_exists('contact_user_add')) {
+ $user_uuid = $_SESSION["user_uuid"];
+ }
- if ($action == "update") {
- $sql = "update v_contacts set ";
- $sql .= "contact_type = '".$contact_type."', ";
- $sql .= "contact_organization = '".$contact_organization."', ";
- $sql .= "contact_name_prefix = '".$contact_name_prefix."', ";
- $sql .= "contact_name_given = '".$contact_name_given."', ";
- $sql .= "contact_name_middle = '".$contact_name_middle."', ";
- $sql .= "contact_name_family = '".$contact_name_family."', ";
- $sql .= "contact_name_suffix = '".$contact_name_suffix."', ";
- $sql .= "contact_nickname = '".$contact_nickname."', ";
- $sql .= "contact_title = '".$contact_title."', ";
- $sql .= "contact_category = '".$contact_category."', ";
- $sql .= "contact_role = '".$contact_role."', ";
- $sql .= "contact_time_zone = '".$contact_time_zone."', ";
- $sql .= "contact_note = '".$contact_note."', ";
- $sql .= "last_mod_date = now(), ";
- $sql .= "last_mod_user = '".$_SESSION['username']."' ";
- $sql .= "where domain_uuid = '".$domain_uuid."' ";
- $sql .= "and contact_uuid = '".$contact_uuid."' ";
- $db->exec(check_sql($sql));
- unset($sql);
+ //add user to contact users table
+ if ($user_uuid != '') {
+ $contact_user_uuid = uuid();
+ $sql = "insert into v_contact_users ";
+ $sql .= "(";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_user_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "user_uuid ";
+ $sql .= ") ";
+ $sql .= "values ";
+ $sql .= "(";
+ $sql .= "'$domain_uuid', ";
+ $sql .= "'$contact_user_uuid', ";
+ $sql .= "'$contact_uuid', ";
+ $sql .= "'$user_uuid' ";
+ $sql .= ")";
+ if (permission_exists('contact_user_add')) {
+ $db->exec(check_sql($sql));
+ }
+ elseif ($action == "add") {
+ //add the contact to the user that created it
+ $db->exec(check_sql($sql));
+ }
+ unset($sql);
+ }
- $_SESSION["message"] = $text['message-update'];
- $location = "contact_edit.php?id=".$contact_uuid;
- } //if ($action == "update")
+ //assign the contact to the group
+ if ($group_uuid != '' && permission_exists('contact_group_add')) {
+ $sql = "insert into v_contact_groups ";
+ $sql .= "( ";
+ $sql .= "contact_group_uuid, ";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "group_uuid ";
+ $sql .= ") ";
+ $sql .= "values ";
+ $sql .= "( ";
+ $sql .= "'".uuid()."', ";
+ $sql .= "'".$domain_uuid."', ";
+ $sql .= "'".$contact_uuid."', ";
+ $sql .= "'".$group_uuid."' ";
+ $sql .= ") ";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ }
//handle redirect
- if ($_POST['submit'] == $text['button-add']) {
- $group_uuid = $_POST['group_uuid'];
- //insert
- $location = "contact_edit.php?id=".$contact_uuid;
- }
+ if ($_POST['submit'] == $text['button-add']) {
+ $group_uuid = $_POST['group_uuid'];
+ $location = "contact_edit.php?id=".$contact_uuid;
+ }
- header("Location: ".$location);
- return;
+ //redirect the browser
+ header("Location: ".$location);
+ return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
@@ -280,9 +269,30 @@ else {
$contact_time_zone = $row["contact_time_zone"];
$contact_note = $row["contact_note"];
}
- unset ($prep_statement);
+ unset ($prep_statement, $sql);
}
+//get the users array
+ $sql = "SELECT * FROM v_users ";
+ $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "order by username asc ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement, $sql);
+
+//get the users assigned to this contact
+ $sql = "SELECT u.username, u.user_uuid, a.contact_user_uuid FROM v_contacts as c, v_users as u, v_contact_users as a ";
+ $sql .= "where c.contact_uuid = '".$contact_uuid."' ";
+ $sql .= "and c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "and u.user_uuid = a.user_uuid ";
+ $sql .= "and c.contact_uuid = a.contact_uuid ";
+ $sql .= "order by u.username asc ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $contact_users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement, $sql);
+
//show the header
require_once "resources/header.php";
if ($action == "update") {
@@ -292,7 +302,7 @@ else {
$document['title'] = $text['title-contact-add'];
}
-// qr code generation
+//qr code generation
$_GET['type'] = "text";
$qr_vcard = true;
include "contacts_vcard.php";
@@ -592,43 +602,46 @@ else {
echo "\n";
echo "\n";
- //determine if contact is shared or private
- if ($action == 'update') {
- $sql = "select count(*) as num_rows from v_contact_groups ";
- $sql .= "where domain_uuid = '".$domain_uuid."' ";
- $sql .= "and contact_uuid = '".$contact_uuid."' ";
- $sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' ";
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute();
- $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
- $contact_shared = ($row['num_rows'] > 0) ? 'false' : 'true';
- unset ($sql, $prep_statement, $row);
+ if (permission_exists('contact_user_edit')) {
+ echo " ";
+ echo " ".$text['label-users']." ";
+ echo " ";
+ if ($action == "update") {
+ echo " \n";
+ foreach($contact_users as $field) {
+ echo " \n";
+ echo " ".$field['username']." \n";
+ echo " \n";
+ if (permission_exists('contact_user_delete')) {
+ echo " $v_link_label_delete \n";
+ }
+ echo " \n";
+ echo " \n";
+ }
+ echo "
\n";
+ }
+ echo " \n";
+ if (permission_exists('contact_user_add')) {
+ echo " \n";
+ echo " \n";
+ foreach($users as $field) {
+ echo " ".$field['username']." \n";
+ }
+ echo " ";
+ if ($action == "update") {
+ echo " \n";
+ }
+ unset($users);
+ echo " \n";
+ echo " ".$text['description-users']."\n";
+ }
+ echo " ";
+ echo " ";
}
- else {
- //private by default on contact add, unless being done by a superadmin from a different domain
- $contact_shared = ($_SESSION['groups'][0]['domain_uuid'] != $_SESSION['domain_uuid']) ? 'true' : 'false';
- }
- //disable shared change if user (superadmin) is accessing a foreign domain
- $contact_shared_disabled = ($_SESSION['groups'][0]['domain_uuid'] != $_SESSION['domain_uuid']) ? "disabled='disabled'" : null;
- echo "\n";
- echo "\n";
- echo " ".$text['label-shared']."\n";
- echo " \n";
- echo "\n";
- echo " \n";
- echo " ".$text['option-false']." \n";
- echo " ".$text['option-true']." \n";
- echo " \n";
- if ($contact_shared_disabled != '') {
- echo " ";
- }
- echo " \n";
- echo $text['description-shared']."\n";
- echo " \n";
- echo " \n";
echo "";
if (permission_exists('contact_group_view')) {
+ $contact_shared = 'true';
echo "\n";
echo "
\n";
echo "";
@@ -658,7 +671,7 @@ else {
echo " ".$field['group_name']." \n";
echo " \n";
if (permission_exists('contact_group_delete') || if_group("superadmin")) {
- echo " $v_link_label_delete \n";
+ echo " $v_link_label_delete \n";
}
echo " \n";
echo " \n";
diff --git a/app/contacts/contact_group_delete.php b/app/contacts/contact_group_delete.php
new file mode 100644
index 0000000000..b1fe25208b
--- /dev/null
+++ b/app/contacts/contact_group_delete.php
@@ -0,0 +1,65 @@
+
+ Portions created by the Initial Developer are Copyright (C) 2008-2015
+ the Initial Developer. All Rights Reserved.
+
+ Contributor(s):
+ Mark J Crane
+*/
+require_once "root.php";
+require_once "resources/require.php";
+require_once "resources/check_auth.php";
+if (permission_exists('contact_group_delete')) {
+ //access granted
+}
+else {
+ echo "access denied";
+ exit;
+}
+
+// check if included in another file
+ if (!$included) {
+ //add multi-lingual support
+ $language = new text;
+ $text = $language->get();
+
+ if (count($_REQUEST) > 0) {
+ $contact_uuid = check_str($_REQUEST["contact_uuid"]);
+ $contact_group_uuid = $_REQUEST["id"];
+ }
+ }
+
+//delete the group
+ if (is_uuid($contact_uuid) && is_uuid($contact_group_uuid)) {
+ $sql = "delete from v_contact_groups ";
+ $sql .= "where contact_uuid = '".$contact_uuid."' ";
+ $sql .= "and contact_group_uuid = '".$contact_group_uuid."' ";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ }
+
+//redirect the browser
+ if (!$included) {
+ $_SESSION["message"] = $text['message-delete'];
+ header("Location: contact_edit.php?id=".$contact_uuid);
+ return;
+ }
+
+?>
\ No newline at end of file
diff --git a/app/contacts/contact_user_delete.php b/app/contacts/contact_user_delete.php
new file mode 100644
index 0000000000..d8112c3751
--- /dev/null
+++ b/app/contacts/contact_user_delete.php
@@ -0,0 +1,65 @@
+
+ Portions created by the Initial Developer are Copyright (C) 2008-2015
+ the Initial Developer. All Rights Reserved.
+
+ Contributor(s):
+ Mark J Crane
+*/
+require_once "root.php";
+require_once "resources/require.php";
+require_once "resources/check_auth.php";
+if (permission_exists('contact_group_delete')) {
+ //access granted
+}
+else {
+ echo "access denied";
+ exit;
+}
+
+// check if included in another file
+ if (!$included) {
+ //add multi-lingual support
+ $language = new text;
+ $text = $language->get();
+
+ if (count($_REQUEST) > 0) {
+ $contact_user_uuid = check_str($_REQUEST["id"]);
+ $contact_uuid = check_str($_REQUEST["contact_uuid"]);
+ }
+ }
+
+//delete the user
+ if (is_uuid($contact_uuid) && is_uuid($contact_user_uuid)) {
+ $sql = "delete from v_contact_users ";
+ $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "and contact_user_uuid = '$contact_user_uuid' ";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ }
+
+//redirect the browser
+ if (!$included) {
+ $_SESSION["message"] = $text['message-delete'];
+ header("Location: contact_edit.php?id=".$contact_uuid);
+ return;
+ }
+
+?>
\ No newline at end of file
diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php
index 82ebd227d9..f48d8f2ae3 100644
--- a/app/contacts/contacts.php
+++ b/app/contacts/contacts.php
@@ -72,7 +72,7 @@ else {
$sql .= "and contact_setting_name = 'array' ";
$sql .= "and contact_setting_value <> '' ";
$sql .= "and contact_setting_value is not null ";
- if (sizeof($user_group_uuids) > 0) {
+ if (!(if_group("superadmin") || if_group("admin"))) {
$sql .= "and ( \n"; //only contacts assigned to current user's group(s) and those not assigned to any group
$sql .= " contact_uuid in ( \n";
$sql .= " select contact_uuid from v_contact_groups ";
@@ -82,7 +82,8 @@ else {
$sql .= " or \n";
$sql .= " contact_uuid not in ( \n";
$sql .= " select contact_uuid from v_contact_groups ";
- $sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= " where user_uuid = '".$_SESSION['user_uuid']."' ";
+ $sql .= " and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " ) \n";
$sql .= ") \n";
}
@@ -100,17 +101,18 @@ else {
$sql = "select count(*) as num_rows ";
$sql .= "from v_contacts as c ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- if (sizeof($user_group_uuids) > 0) {
+ if (!(if_group("superadmin") || if_group("admin"))) {
$sql .= "and ( \n"; //only contacts assigned to current user's group(s) and those not assigned to any group
$sql .= " contact_uuid in ( \n";
$sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where group_uuid in ('".implode("','", $user_group_uuids)."') ";
$sql .= " and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " ) \n";
- $sql .= " or \n";
- $sql .= " contact_uuid not in ( \n";
- $sql .= " select contact_uuid from v_contact_groups ";
- $sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= " or contact_uuid in ( \n";
+ $sql .= " select contact_uuid from v_contact_users ";
+ $sql .= " where user_uuid = '".$_SESSION['user_uuid']."' ";
+ $sql .= " and domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "";
$sql .= " ) \n";
$sql .= ") \n";
}
diff --git a/app/contacts/root.php b/app/contacts/root.php
index 899238f027..4728665dd8 100644
--- a/app/contacts/root.php
+++ b/app/contacts/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php
index 3d48fb6059..ae85c7749a 100644
--- a/app/destinations/destination_edit.php
+++ b/app/destinations/destination_edit.php
@@ -35,7 +35,7 @@ else {
exit;
}
-if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")) {
+if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")) {
require_once "app/billing/resources/functions/currency.php";
require_once "app/billing/resources/functions/rating.php";
}
@@ -432,7 +432,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
// billing
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
$db2 = new database;
$db2->sql = "select currency, billing_uuid, balance from v_billings where type_value='$destination_accountcode'";
$db2->result = $db2->execute();
@@ -706,7 +706,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "\n";
echo "\n";
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/fax/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/fax/app_config.php")){
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "order by fax_name asc ";
@@ -750,7 +750,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "\n";
// billing
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
echo "\n";
echo "\n";
echo " ".$text['label-monthly_price']."\n";
@@ -797,7 +797,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " \n";
echo " \n";
echo $text['description-account_code']."\n";
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
echo " ".$text['billing-warning'];
}
echo " \n";
diff --git a/app/destinations/root.php b/app/destinations/root.php
index 899238f027..4728665dd8 100644
--- a/app/destinations/root.php
+++ b/app/destinations/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php
index de92aec84d..2be99a46d8 100644
--- a/app/devices/device_edit.php
+++ b/app/devices/device_edit.php
@@ -557,8 +557,8 @@ require_once "resources/require.php";
if (!isset($_SERVER['HTTP_PROTOCOL'])) {
$_SERVER['HTTP_PROTOCOL'] = 'http';
if (isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['HTTP_PROTOCOL'] = $_SERVER['REQUEST_SCHEME']; }
- if ($_SERVER['HTTPS'] = 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
- if ($_SERVER['SERVER_PORT'] = '443') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
+ if ($_SERVER['HTTPS'] == 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
+ if ($_SERVER['SERVER_PORT'] == '443') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
}
echo " window.location = '".$_SERVER['HTTP_PROTOCOL']."://".$domain_name."/app/provision?mac=".$device_mac_address."&file=' + d + '&content_type=application/octet-stream';\n";
echo " }\n";
@@ -1049,6 +1049,48 @@ require_once "resources/require.php";
"; }
}
+ if (strtolower($device_vendor) == "mitel" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
+ echo "";
+ ?>
+ >
+ >
+ >
+ >
+ >
+ >
+ >
+ >
+
+ "; }
+ }
if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
echo "";
?>
diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php
index bfe703b584..8ef1ede278 100644
--- a/app/devices/device_profile_edit.php
+++ b/app/devices/device_profile_edit.php
@@ -257,6 +257,7 @@ require_once "resources/require.php";
echo "\n";
echo "\n";
echo " \n";
+ echo " \n";
echo " \n";
echo " \n";
echo " \n";
diff --git a/app/devices/root.php b/app/devices/root.php
index 899238f027..4728665dd8 100644
--- a/app/devices/root.php
+++ b/app/devices/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/dialplan/dialplan_copy.php b/app/dialplan/dialplan_copy.php
index de81736106..81829cd4de 100644
--- a/app/dialplan/dialplan_copy.php
+++ b/app/dialplan/dialplan_copy.php
@@ -79,9 +79,9 @@ else {
//create a new app_uuid when copying a dialplan except for these exceptions
switch ($app_uuid) {
- case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes
- case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes
- case "4b821450-926b-175a-af93-a03c441818b1": //time conditions
+ case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": break; //inbound routes
+ case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": break; //outbound routes
+ case "4b821450-926b-175a-af93-a03c441818b1": break; //time conditions
default:
$app_uuid = uuid();
}
diff --git a/app/dialplan/dialplan_edit.php b/app/dialplan/dialplan_edit.php
index 68ec9b3b1b..8f5c99ec31 100644
--- a/app/dialplan/dialplan_edit.php
+++ b/app/dialplan/dialplan_edit.php
@@ -786,7 +786,7 @@ else {
echo " \n";
echo "";
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
echo "".$text['billing-warning']."
";
}
diff --git a/app/dialplan/root.php b/app/dialplan/root.php
index 899238f027..4728665dd8 100644
--- a/app/dialplan/root.php
+++ b/app/dialplan/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/dialplan_inbound/root.php b/app/dialplan_inbound/root.php
index 899238f027..4728665dd8 100644
--- a/app/dialplan_inbound/root.php
+++ b/app/dialplan_inbound/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/dialplan_outbound/root.php b/app/dialplan_outbound/root.php
index 899238f027..4728665dd8 100644
--- a/app/dialplan_outbound/root.php
+++ b/app/dialplan_outbound/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/edit/root.php b/app/edit/root.php
index 899238f027..4728665dd8 100644
--- a/app/edit/root.php
+++ b/app/edit/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/emails/root.php b/app/emails/root.php
index 899238f027..4728665dd8 100644
--- a/app/emails/root.php
+++ b/app/emails/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/exec/root.php b/app/exec/root.php
index 899238f027..4728665dd8 100644
--- a/app/exec/root.php
+++ b/app/exec/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php
index 5f7cd3c442..06edad79f4 100644
--- a/app/extensions/extension_edit.php
+++ b/app/extensions/extension_edit.php
@@ -35,7 +35,7 @@ else {
}
//detect billing app
- $billing_app_exists = file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php");
+ $billing_app_exists = file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php");
if ($billing_app_exists) {
require_once "app/billing/resources/functions/currency.php";
require_once "app/billing/resources/functions/rating.php";
diff --git a/app/extensions/root.php b/app/extensions/root.php
index 899238f027..4728665dd8 100644
--- a/app/extensions/root.php
+++ b/app/extensions/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php
index 83fabbae3d..f4fd232a3c 100644
--- a/app/fax/fax_edit.php
+++ b/app/fax/fax_edit.php
@@ -36,7 +36,7 @@ else {
}
//detect billing app
- $billing_app_exists = file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php");
+ $billing_app_exists = file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php");
if ($billing_app_exists) {
require_once "app/billing/resources/functions/currency.php";
diff --git a/app/fax/root.php b/app/fax/root.php
index 899238f027..4728665dd8 100644
--- a/app/fax/root.php
+++ b/app/fax/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/fifo/root.php b/app/fifo/root.php
index 899238f027..4728665dd8 100644
--- a/app/fifo/root.php
+++ b/app/fifo/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/fifo_list/root.php b/app/fifo_list/root.php
index 899238f027..4728665dd8 100644
--- a/app/fifo_list/root.php
+++ b/app/fifo_list/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/follow_me/root.php b/app/follow_me/root.php
index 899238f027..4728665dd8 100644
--- a/app/follow_me/root.php
+++ b/app/follow_me/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/gateways/root.php b/app/gateways/root.php
index 899238f027..4728665dd8 100644
--- a/app/gateways/root.php
+++ b/app/gateways/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/ivr_menus/root.php b/app/ivr_menus/root.php
index 899238f027..4728665dd8 100644
--- a/app/ivr_menus/root.php
+++ b/app/ivr_menus/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/log_viewer/root.php b/app/log_viewer/root.php
index 899238f027..4728665dd8 100644
--- a/app/log_viewer/root.php
+++ b/app/log_viewer/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/modules/root.php b/app/modules/root.php
index 899238f027..4728665dd8 100644
--- a/app/modules/root.php
+++ b/app/modules/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/music_on_hold/root.php b/app/music_on_hold/root.php
index 899238f027..4728665dd8 100644
--- a/app/music_on_hold/root.php
+++ b/app/music_on_hold/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/operator_panel/index.php b/app/operator_panel/index.php
index 481696d0ba..31827423b0 100644
--- a/app/operator_panel/index.php
+++ b/app/operator_panel/index.php
@@ -199,7 +199,7 @@ require_once "resources/header.php";
//refresh controls
function refresh_stop() {
clearInterval(interval_timer_id);
- document.getElementById('refresh_state').innerHTML = " \" title=\"\">";
+ if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = " \" title=\"\">"; }
}
function refresh_start() {
diff --git a/app/operator_panel/root.php b/app/operator_panel/root.php
index 899238f027..4728665dd8 100644
--- a/app/operator_panel/root.php
+++ b/app/operator_panel/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/phrases/root.php b/app/phrases/root.php
index 899238f027..4728665dd8 100644
--- a/app/phrases/root.php
+++ b/app/phrases/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php
index 6525c68a0d..95a3304d7f 100644
--- a/app/provision/resources/classes/provision.php
+++ b/app/provision/resources/classes/provision.php
@@ -498,6 +498,70 @@ include "root.php";
unset ($prep_statement);
}
+ //get the list of contact directly assigned to the user
+ if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_personal']['boolean'] == "true") {
+ foreach ($device_lines as &$line) {
+ //get the extension uuid from the line username [one result]
+ $sql = "select * from v_extensions ";
+ $sql .= "where (extension = '".$line["user_id"]."' or number_alias = '".$line["user_id"]."') ";
+ $sql .= "and domain_uuid = '$domain_uuid' ";
+ //echo $sql."\n";
+ $prep_statement = $this->db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement);
+ foreach ($extensions as &$extension) {
+ $extension_uuid = $extension["extension_uuid"];
+ }
+ //echo "extension uuid: ".$extension_uuid."\n";
+
+ //get the user_uuid assigned to the extension_uuid [multiple results]
+ $sql = "select user_uuid from v_extension_users ";
+ $sql .= "where extension_uuid = '$extension_uuid' ";
+ $sql .= "and domain_uuid = '$domain_uuid' ";
+ //echo $sql."\n";
+ $prep_statement = $this->db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $extension_users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement);
+ foreach ($extension_users as &$row) {
+ //get the list of contacts [multiple results]
+ $sql = "select contact_uuid from v_contact_users ";
+ $sql .= "where user_uuid = '".$row["user_uuid"]."' ";
+ $sql .= "and domain_uuid = '$domain_uuid' ";
+ //echo $sql."\n";
+ $prep_statement = $this->db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $extension_users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement);
+ foreach ($extension_users as &$row) {
+ $contacts[] = $row["contact_uuid"];
+ }
+ }
+ }
+
+ //get the contacts assigned to the user
+ //SQL 'in' with implode contacts array prevents returning duplicate contacts
+ if (sizeof($contacts) > 0) {
+ $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, ";
+ $sql .= "p.phone_number, p.phone_extension ";
+ $sql .= "from v_contacts as c, v_contact_phones as p ";
+ $sql .= "where c.contact_uuid in ('".implode("','",$contacts)."') ";
+ $sql .= "and c.contact_uuid = p.contact_uuid ";
+ $sql .= "and p.phone_type_voice = '1' ";
+ $sql .= "and c.domain_uuid = '$domain_uuid' ";
+ //echo $sql."\n";
+ $prep_statement = $this->db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $directory_personal = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset($prep_statement);
+ //print_r($contacts);
+ }
+
+ //assign the contacts array
+ $view->assign("directory_personal", $contacts);
+ }
+
//get the contact extensions array and add to the template engine
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") {
//get contacts from the database
diff --git a/app/provision/root.php b/app/provision/root.php
index 899238f027..4728665dd8 100644
--- a/app/provision/root.php
+++ b/app/provision/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/recordings/root.php b/app/recordings/root.php
index 899238f027..4728665dd8 100644
--- a/app/recordings/root.php
+++ b/app/recordings/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/registrations/root.php b/app/registrations/root.php
index 899238f027..4728665dd8 100644
--- a/app/registrations/root.php
+++ b/app/registrations/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/ring_groups/root.php b/app/ring_groups/root.php
index 899238f027..4728665dd8 100644
--- a/app/ring_groups/root.php
+++ b/app/ring_groups/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/services/root.php b/app/services/root.php
index 899238f027..4728665dd8 100644
--- a/app/services/root.php
+++ b/app/services/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/settings/root.php b/app/settings/root.php
index 899238f027..4728665dd8 100644
--- a/app/settings/root.php
+++ b/app/settings/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/sip_profiles/root.php b/app/sip_profiles/root.php
index 899238f027..4728665dd8 100644
--- a/app/sip_profiles/root.php
+++ b/app/sip_profiles/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/sip_status/root.php b/app/sip_status/root.php
index 899238f027..4728665dd8 100644
--- a/app/sip_status/root.php
+++ b/app/sip_status/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/sql_query/root.php b/app/sql_query/root.php
index 899238f027..4728665dd8 100644
--- a/app/sql_query/root.php
+++ b/app/sql_query/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/system/root.php b/app/system/root.php
index 899238f027..4728665dd8 100644
--- a/app/system/root.php
+++ b/app/system/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/time_conditions/root.php b/app/time_conditions/root.php
index 899238f027..4728665dd8 100644
--- a/app/time_conditions/root.php
+++ b/app/time_conditions/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/traffic_graph/root.php b/app/traffic_graph/root.php
index 899238f027..4728665dd8 100644
--- a/app/traffic_graph/root.php
+++ b/app/traffic_graph/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/vars/root.php b/app/vars/root.php
index 899238f027..4728665dd8 100644
--- a/app/vars/root.php
+++ b/app/vars/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/voicemail_greetings/root.php b/app/voicemail_greetings/root.php
index 899238f027..4728665dd8 100644
--- a/app/voicemail_greetings/root.php
+++ b/app/voicemail_greetings/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/voicemails/root.php b/app/voicemails/root.php
index 899238f027..4728665dd8 100644
--- a/app/voicemails/root.php
+++ b/app/voicemails/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/xml_cdr/root.php b/app/xml_cdr/root.php
index 899238f027..4728665dd8 100644
--- a/app/xml_cdr/root.php
+++ b/app/xml_cdr/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php
index 900b6086af..236940e143 100644
--- a/app/xml_cdr/v_xml_cdr_import.php
+++ b/app/xml_cdr/v_xml_cdr_import.php
@@ -70,7 +70,7 @@
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//add rating functions if the billing is installed
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
require_once "app/billing/resources/functions/rating.php";
}
@@ -246,7 +246,7 @@
}
//billing information
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
$db2 = new database;
$lcr_currency = (strlen($_SESSION['billing']['currency']['text'])?$_SESSION['billing']['currency']['text']:'USD');
$accountcode = (strlen(urldecode($xml->variables->accountcode)))?check_str(urldecode($xml->variables->accountcode)):$domain_name;
diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php
index 25fcb0e2e7..816ed04e6b 100644
--- a/app/xml_cdr/xml_cdr.php
+++ b/app/xml_cdr/xml_cdr.php
@@ -339,7 +339,7 @@ else {
echo th_order_by('start_stamp', $text['label-start'], $order_by, $order, null, "style='text-align: center;'", $param);
echo th_order_by('tta', $text['label-tta'], $order_by, $order, null, "style='text-align: right;'", $param);
echo th_order_by('duration', $text['label-duration'], $order_by, $order, null, "style='text-align: center;'", $param);
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
// billing collumns
echo "".$text['label-price']." \n";
$col_count++;
@@ -362,7 +362,7 @@ else {
$col_count++;
}
echo "\n";
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
require_once "app/billing/resources/functions/rating.php";
require_once "resources/classes/database.php";
$database = new database;
@@ -543,7 +543,7 @@ else {
echo " ".gmdate("G:i:s", $seconds)." \n";
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
$database->table = "v_xml_cdr";
$accountcode = (strlen($row["accountcode"])?$row["accountcode"]:$_SESSION[domain_name]);
diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php
index 34c8a23321..708e614362 100644
--- a/app/xml_cdr/xml_cdr_inc.php
+++ b/app/xml_cdr/xml_cdr_inc.php
@@ -299,7 +299,7 @@ else {
$sql .= "caller_id_number, ";
$sql .= "destination_number, ";
$sql .= "accountcode, ";
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
$sql .= "call_sell, ";
}
if (permission_exists("xml_cdr_pdd")) {
diff --git a/core/apps/root.php b/core/apps/root.php
index 899238f027..4728665dd8 100644
--- a/core/apps/root.php
+++ b/core/apps/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/databases/root.php b/core/databases/root.php
index 899238f027..4728665dd8 100644
--- a/core/databases/root.php
+++ b/core/databases/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/default_settings/root.php b/core/default_settings/root.php
index 899238f027..4728665dd8 100644
--- a/core/default_settings/root.php
+++ b/core/default_settings/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/domain_settings/domain_edit.php b/core/domain_settings/domain_edit.php
index 870a2c9ad9..0afc577cb1 100644
--- a/core/domain_settings/domain_edit.php
+++ b/core/domain_settings/domain_edit.php
@@ -133,7 +133,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($original_domain_name != $domain_name) {
// update dialplans
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/dialplan/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplan/app_config.php")){
$sql = "update v_dialplans set ";
$sql .= "dialplan_context = '".$domain_name."' ";
$sql .= "where dialplan_context = '".$original_domain_name."' ";
@@ -143,7 +143,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update extensions (accountcode, user_context, dial_domain)
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/extensions/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/extensions/app_config.php")){
$sql = "update v_extensions set ";
$sql .= "accountcode = '".$domain_name."' ";
$sql .= "where accountcode = '".$original_domain_name."' ";
@@ -167,7 +167,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update cdr records (domain_name, context)
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/xml_cdr/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/xml_cdr/app_config.php")){
$sql = "update v_xml_cdr set ";
$sql .= "domain_name = '".$domain_name."' ";
$sql .= "where domain_name = '".$original_domain_name."' ";
@@ -184,7 +184,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update billing, if installed
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
$sql = "update v_billings set ";
$sql .= "type_value = '".$domain_name."' ";
$sql .= "where type_value = '".$original_domain_name."' ";
@@ -242,7 +242,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update conference session recording paths
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/conference_centers/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")){
$sql = "select conference_session_uuid, recording from v_conference_sessions ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and recording like '%".$original_domain_name."%' ";
@@ -267,7 +267,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update conference center greetings
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/conference_centers/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")){
$sql = "select conference_center_uuid, conference_center_greeting from v_conference_centers ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and conference_center_greeting like '%".$original_domain_name."%' ";
@@ -292,7 +292,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update ivr menu greetings
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menu/app_config.php")){
$sql = "select ivr_menu_uuid, ivr_menu_greet_long, ivr_menu_greet_short from v_ivr_menus ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@@ -323,7 +323,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update ivr menu option parameters
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menu/app_config.php")){
$sql = "select ivr_menu_option_uuid, ivr_menu_option_param from v_ivr_menu_options ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ivr_menu_option_param like '%".$original_domain_name."%' ";
@@ -348,7 +348,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update call center queue record templates
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")){
$sql = "select call_center_queue_uuid, queue_record_template from v_call_center_queues ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and queue_record_template like '%".$original_domain_name."%' ";
@@ -373,7 +373,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update call center agent contacts
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")){
$sql = "select call_center_agent_uuid, agent_contact from v_call_center_agents ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and agent_contact like '%".$original_domain_name."%' ";
@@ -398,7 +398,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update call flows data, anti-data and contexts
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_flows/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_flows/app_config.php")){
$sql = "select call_flow_uuid, call_flow_data, call_flow_anti_data, call_flow_context from v_call_flows ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@@ -433,7 +433,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update ring group context, forward destination, timeout data
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ring_groups/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ring_groups/app_config.php")){
$sql = "select ring_group_uuid, ring_group_context, ring_group_forward_destination, ring_group_timeout_data from v_ring_groups ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@@ -468,7 +468,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update device lines server address, outbound proxy
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/devices/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/devices/app_config.php")){
$sql = "select device_line_uuid, server_address, outbound_proxy from v_device_lines ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@@ -510,7 +510,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($dialplan_public_xml);
// update dialplan details
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/dialplan/app_config.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplan/app_config.php")){
$sql = "select dialplan_detail_uuid, dialplan_detail_data from v_dialplan_details ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and dialplan_detail_data like '%".$original_domain_name."%' ";
diff --git a/core/domain_settings/root.php b/core/domain_settings/root.php
index 899238f027..4728665dd8 100644
--- a/core/domain_settings/root.php
+++ b/core/domain_settings/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/install/index.php b/core/install/index.php
index 36d012f0f7..34faefef83 100644
--- a/core/install/index.php
+++ b/core/install/index.php
@@ -31,7 +31,7 @@ require_once "resources/check_auth.php";
//detect install state
$first_time_install = true;
-if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
$first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux
diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php
index f6ed320bf1..7a60766b93 100644
--- a/core/install/install_first_time.php
+++ b/core/install/install_first_time.php
@@ -78,7 +78,7 @@ date_default_timezone_set($timezone);
//detect install state
$first_time_install = true;
-if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
$first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
$first_time_install = false;
diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php
index a889d908ff..c55e89fb9b 100644
--- a/core/install/resources/classes/install_fusionpbx.php
+++ b/core/install/resources/classes/install_fusionpbx.php
@@ -56,7 +56,7 @@ include "root.php";
} elseif (is_dir("/usr/local/etc/fusionpbx")){
$this->config_php = "/usr/local/etc/fusionpbx/config.php";
}
- elseif (is_dir($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources")) {
+ elseif (is_dir($_SERVER["PROJECT_ROOT"]."/resources")) {
$this->config_php = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php";
}
else {
diff --git a/core/install/root.php b/core/install/root.php
index 899238f027..4728665dd8 100644
--- a/core/install/root.php
+++ b/core/install/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/menu/root.php b/core/menu/root.php
index 899238f027..4728665dd8 100644
--- a/core/menu/root.php
+++ b/core/menu/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/notifications/root.php b/core/notifications/root.php
index 899238f027..4728665dd8 100644
--- a/core/notifications/root.php
+++ b/core/notifications/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/upgrade/root.php b/core/upgrade/root.php
index 899238f027..4728665dd8 100644
--- a/core/upgrade/root.php
+++ b/core/upgrade/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/user_settings/root.php b/core/user_settings/root.php
index 899238f027..4728665dd8 100644
--- a/core/user_settings/root.php
+++ b/core/user_settings/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/user_settings/user_dashboard.php b/core/user_settings/user_dashboard.php
index ed7f61a9d7..282fe09e5d 100644
--- a/core/user_settings/user_dashboard.php
+++ b/core/user_settings/user_dashboard.php
@@ -28,9 +28,9 @@
include "root.php";
//if config.php file does not exist then redirect to the install page
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
//do nothing
- } elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+ } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
//original directory
} elseif (file_exists("/etc/fusionpbx/config.php")){
//linux
diff --git a/core/users/root.php b/core/users/root.php
index 899238f027..4728665dd8 100644
--- a/core/users/root.php
+++ b/core/users/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/core/users/usersupdate.php b/core/users/usersupdate.php
index 10bab4cc32..16d641a313 100644
--- a/core/users/usersupdate.php
+++ b/core/users/usersupdate.php
@@ -341,7 +341,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
// if call center installed
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")) {
// update agent and tiers tables
$sql = "update v_call_center_agents set agent_name = '".$username."' where domain_uuid = '".$domain_uuid."' and agent_name = '".$username_old."' ";
diff --git a/index.php b/index.php
index 757aefec39..1ffe4ab5d6 100644
--- a/index.php
+++ b/index.php
@@ -30,13 +30,13 @@ include "root.php";
session_start();
//if config.php file does not exist then redirect to the install page
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
//do nothing
- } elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+ } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
//original directory
- } elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
+ } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/includes/config.php")) {
//move config.php from the includes to resources directory.
- rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
+ rename($_SERVER["PROJECT_ROOT"]."/includes/config.php", $_SERVER["PROJECT_ROOT"]."/resources/config.php");
} elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
@@ -59,8 +59,7 @@ include "root.php";
if (strlen($_SESSION["username"]) > 0) {
if (strlen($_SESSION['login']['destination']['url']) > 0) {
header("Location: ".$_SESSION['login']['destination']['url']);
- }elseif(file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/core/user_settings/user_dashboard.php"))
- {
+ } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/core/user_settings/user_dashboard.php")) {
header("Location: ".PROJECT_PATH."/core/user_settings/user_dashboard.php");
}
else {
@@ -70,10 +69,9 @@ include "root.php";
}
else {
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
- }
- else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
+ } else if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
}
else {
diff --git a/login.php b/login.php
index 0a9a01a7c6..75ff792782 100644
--- a/login.php
+++ b/login.php
@@ -40,12 +40,12 @@ include "root.php";
session_destroy();
//if config.php file does not exist then redirect to the install page
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
//original directory
}
- else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
+ else if (file_exists($_SERVER["PROJECT_ROOT"]."/includes/config.php")) {
//move config.php from the includes to resources directory.
- rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
+ rename($_SERVER["PROJECT_ROOT"]."/includes/config.php", $_SERVER["PROJECT_ROOT"]."/resources/config.php");
}
else if (file_exists("/etc/fusionpbx/config.php")){
//linux
@@ -68,7 +68,7 @@ include "root.php";
}
//use custom login, if present, otherwise use default login
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")){
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/login.php")){
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
}
else {
diff --git a/resources/captcha/root.php b/resources/captcha/root.php
index 899238f027..4728665dd8 100644
--- a/resources/captcha/root.php
+++ b/resources/captcha/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/resources/classes/config.php b/resources/classes/config.php
index a63ba0d03e..cc675d6933 100644
--- a/resources/classes/config.php
+++ b/resources/classes/config.php
@@ -70,8 +70,8 @@ class config {
//get the PROJECT PATH
include "root.php";
// find the file
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
- $this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
+ $this->config_path = $_SERVER["PROJECT_ROOT"]."/resources/config.php";
} elseif (file_exists("/etc/fusionpbx/config.php")) {
$this->config_path = "/etc/fusionpbx/config.php";
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
diff --git a/resources/classes/database.php b/resources/classes/database.php
index ef45601740..7cbcad0349 100644
--- a/resources/classes/database.php
+++ b/resources/classes/database.php
@@ -54,10 +54,10 @@ include "root.php";
if (strlen($this->type) == 0 && strlen($this->db_name) == 0) {
//include config.php
include "root.php";
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
- include $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
- } elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
- include $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
+ include $_SERVER["PROJECT_ROOT"]."/resources/config.php";
+ } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
+ include $_SERVER["PROJECT_ROOT"]."/resources/config.php";
} elseif (file_exists("/etc/fusionpbx/config.php")){
//linux
include "/etc/fusionpbx/config.php";
diff --git a/resources/classes/destinations.php b/resources/classes/destinations.php
index cff34ae040..f2657972b0 100644
--- a/resources/classes/destinations.php
+++ b/resources/classes/destinations.php
@@ -186,7 +186,7 @@ class destinations {
$destination = $row['field']['destination'];
//add multi-lingual support
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/".$name."/app_languages.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
$language2 = new text;
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
}
diff --git a/resources/classes/root.php b/resources/classes/root.php
index 899238f027..4728665dd8 100644
--- a/resources/classes/root.php
+++ b/resources/classes/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/resources/classes/vcard.php b/resources/classes/vcard.php
index 34285d47d0..30f51bd85c 100644
--- a/resources/classes/vcard.php
+++ b/resources/classes/vcard.php
@@ -13,10 +13,10 @@ class vcard {
var $revision_date;
var $card;
- /*
- The class constructor. You can set some defaults here if desired.
- */
- function vcard() {
+ /**
+ * Called when the object is created
+ */
+ public function __construct() {
$this->log = "New vcard() called ";
$this->data = array(
"display_name"=>null
@@ -59,7 +59,17 @@ class vcard {
,"sort_string"=>null
,"note"=>null
);
- return true;
+ return true;
+ }
+
+ /**
+ * 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);
+ }
}
/*
diff --git a/resources/header.php b/resources/header.php
index 6f792dfc5c..e8dc220901 100644
--- a/resources/header.php
+++ b/resources/header.php
@@ -87,7 +87,7 @@ require_once "resources/require.php";
unset($menu_prep_statement, $menu_result, $menu_row);
//get the content
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/content/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/content/app_config.php")) {
$sql = "select * from v_rss ";
$sql .= "where domain_uuid =:domain_uuid ";
$sql .= "and rss_category = 'content' ";
diff --git a/resources/install/scripts/app/voicemail/resources/functions/check_password.lua b/resources/install/scripts/app/voicemail/resources/functions/check_password.lua
index b95cf1feae..7763cfc2ba 100644
--- a/resources/install/scripts/app/voicemail/resources/functions/check_password.lua
+++ b/resources/install/scripts/app/voicemail/resources/functions/check_password.lua
@@ -61,6 +61,12 @@
end);
end
end
+
+ --end the session if this is an invalid voicemail box
+ if (not voicemail_uuid) or (#voicemail_uuid == 0) then
+ return session:hangup();
+ end
+
--please enter your password followed by pound
dtmf_digits = '';
password = macro(session, "voicemail_password", 20, 5000, '');
diff --git a/resources/root.php b/resources/root.php
index 899238f027..4728665dd8 100644
--- a/resources/root.php
+++ b/resources/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/resources/switch.php b/resources/switch.php
index c073d23a7c..b4546c72a6 100644
--- a/resources/switch.php
+++ b/resources/switch.php
@@ -29,7 +29,7 @@ require_once "root.php";
require_once "resources/require.php";
//get the event socket information
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/settings/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/settings/app_config.php")) {
if (strlen($_SESSION['event_socket_ip_address']) == 0) {
$sql = "select * from v_settings ";
$prep_statement = $db->prepare(check_sql($sql));
@@ -49,7 +49,7 @@ require_once "resources/require.php";
//get the extensions that are assigned to this user
function load_extensions() {
global $db;
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/extensions/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/extensions/app_config.php")) {
if (strlen($_SESSION["domain_uuid"]) > 0 && strlen($_SESSION["user_uuid"]) > 0 && count($_SESSION['user']['extension']) == 0) {
//get the user extension list
unset($_SESSION['user']['extension']);
@@ -128,7 +128,7 @@ function event_socket_request($fp, $cmd) {
function event_socket_request_cmd($cmd) {
global $db;
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/settings/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/settings/app_config.php")) {
$sql = "select * from v_settings ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
@@ -1442,25 +1442,25 @@ if (!function_exists('save_switch_xml')) {
}
}
if (is_readable($_SESSION['switch']['conf']['dir'])) {
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/settings/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/settings/app_config.php")) {
save_setting_xml();
}
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/modules/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/modules/app_config.php")) {
save_module_xml();
}
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/vars/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/vars/app_config.php")) {
save_var_xml();
}
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")) {
save_call_center_xml();
}
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/gateways/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/gateways/app_config.php")) {
save_gateway_xml();
}
- //if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")) {
+ //if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menu/app_config.php")) {
// save_ivr_menu_xml();
//}
- if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/sip_profiles/app_config.php")) {
+ if (file_exists($_SERVER["PROJECT_ROOT"]."/app/sip_profiles/app_config.php")) {
save_sip_profile_xml();
}
}
diff --git a/resources/templates/provision/cisco/7940/directory.xml b/resources/templates/provision/cisco/7940/directory.xml
index 6bb0637022..2b90e37102 100644
--- a/resources/templates/provision/cisco/7940/directory.xml
+++ b/resources/templates/provision/cisco/7940/directory.xml
@@ -3,20 +3,18 @@
Please choose...
Our Phones
- http://{$domain_name}/app/provision/file/directory-extensions.xml
+ http://{$domain_name}/app/provision/file/directory_extensions.xml?mac={$mac}
-
Enterprise
- http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}
+ http://{$domain_name}/app/provision/file/directory_enterprise.xml?mac={$mac}
Speed Dial
- http://{$domain_name}/app/provision/file/directory-speed_dial.xml?mac={$mac}
+ http://{$domain_name}/app/provision/file/directory_speed_dial.xml?mac={$mac}
\ No newline at end of file
diff --git a/resources/templates/provision/cisco/7940/directory-enterprise.xml b/resources/templates/provision/cisco/7940/directory_enterprise.xml
similarity index 100%
rename from resources/templates/provision/cisco/7940/directory-enterprise.xml
rename to resources/templates/provision/cisco/7940/directory_enterprise.xml
diff --git a/resources/templates/provision/cisco/7940/directory-extensions.xml b/resources/templates/provision/cisco/7940/directory_extensions.xml
similarity index 100%
rename from resources/templates/provision/cisco/7940/directory-extensions.xml
rename to resources/templates/provision/cisco/7940/directory_extensions.xml
diff --git a/resources/templates/provision/cisco/7940/directory-personal.xml b/resources/templates/provision/cisco/7940/directory_personal.xml
similarity index 83%
rename from resources/templates/provision/cisco/7940/directory-personal.xml
rename to resources/templates/provision/cisco/7940/directory_personal.xml
index 49998680f6..52f1f61688 100644
--- a/resources/templates/provision/cisco/7940/directory-personal.xml
+++ b/resources/templates/provision/cisco/7940/directory_personal.xml
@@ -2,7 +2,7 @@
Personal
Please choose...
{assign var=x value=1}
-{foreach $contacts as $row}{if $row.contact_category == "personal"}
+{foreach $directory_personal as $row}
{if $row.contact_name_given != ""}
{$row.contact_name_given} {$row.contact_name_family}
@@ -15,7 +15,6 @@
{$row.phone_extension}
{/if}
-{/if}
{assign var=x value=$x+1}
{/foreach}
diff --git a/resources/templates/provision/cisco/7940/directory-speed_dial.xml b/resources/templates/provision/cisco/7940/directory_speed_dial.xml
similarity index 100%
rename from resources/templates/provision/cisco/7940/directory-speed_dial.xml
rename to resources/templates/provision/cisco/7940/directory_speed_dial.xml
diff --git a/resources/templates/provision/cisco/7960/directory.xml b/resources/templates/provision/cisco/7960/directory.xml
index 6bb0637022..2b90e37102 100644
--- a/resources/templates/provision/cisco/7960/directory.xml
+++ b/resources/templates/provision/cisco/7960/directory.xml
@@ -3,20 +3,18 @@
Please choose...
Our Phones
- http://{$domain_name}/app/provision/file/directory-extensions.xml
+ http://{$domain_name}/app/provision/file/directory_extensions.xml?mac={$mac}
-
Enterprise
- http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}
+ http://{$domain_name}/app/provision/file/directory_enterprise.xml?mac={$mac}
Speed Dial
- http://{$domain_name}/app/provision/file/directory-speed_dial.xml?mac={$mac}
+ http://{$domain_name}/app/provision/file/directory_speed_dial.xml?mac={$mac}
\ No newline at end of file
diff --git a/resources/templates/provision/cisco/7960/directory-enterprise.xml b/resources/templates/provision/cisco/7960/directory_enterprise.xml
similarity index 100%
rename from resources/templates/provision/cisco/7960/directory-enterprise.xml
rename to resources/templates/provision/cisco/7960/directory_enterprise.xml
diff --git a/resources/templates/provision/cisco/7960/directory-extensions.xml b/resources/templates/provision/cisco/7960/directory_extensions.xml
similarity index 100%
rename from resources/templates/provision/cisco/7960/directory-extensions.xml
rename to resources/templates/provision/cisco/7960/directory_extensions.xml
diff --git a/resources/templates/provision/cisco/7960/directory-personal.xml b/resources/templates/provision/cisco/7960/directory_personal.xml
similarity index 83%
rename from resources/templates/provision/cisco/7960/directory-personal.xml
rename to resources/templates/provision/cisco/7960/directory_personal.xml
index 49998680f6..52f1f61688 100644
--- a/resources/templates/provision/cisco/7960/directory-personal.xml
+++ b/resources/templates/provision/cisco/7960/directory_personal.xml
@@ -2,7 +2,7 @@
Personal
Please choose...
{assign var=x value=1}
-{foreach $contacts as $row}{if $row.contact_category == "personal"}
+{foreach $directory_personal as $row}
{if $row.contact_name_given != ""}
{$row.contact_name_given} {$row.contact_name_family}
@@ -15,7 +15,6 @@
{$row.phone_extension}
{/if}
-{/if}
{assign var=x value=$x+1}
{/foreach}
diff --git a/resources/templates/provision/cisco/7960/directory-speed_dial.xml b/resources/templates/provision/cisco/7960/directory_speed_dial.xml
similarity index 100%
rename from resources/templates/provision/cisco/7960/directory-speed_dial.xml
rename to resources/templates/provision/cisco/7960/directory_speed_dial.xml
diff --git a/root.php b/root.php
index 899238f027..4728665dd8 100644
--- a/root.php
+++ b/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/secure/root.php b/secure/root.php
index 899238f027..4728665dd8 100644
--- a/secure/root.php
+++ b/secure/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/themes/accessible/root.php b/themes/accessible/root.php
index 899238f027..4728665dd8 100644
--- a/themes/accessible/root.php
+++ b/themes/accessible/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/themes/enhanced/root.php b/themes/enhanced/root.php
index 899238f027..4728665dd8 100644
--- a/themes/enhanced/root.php
+++ b/themes/enhanced/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
diff --git a/themes/minimized/root.php b/themes/minimized/root.php
index 899238f027..4728665dd8 100644
--- a/themes/minimized/root.php
+++ b/themes/minimized/root.php
@@ -74,6 +74,9 @@
}
$i++;
}
+ if(!file_exists($path. '/.project.ROOT')){
+ die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+ }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}