Merge pull request #13 from fusionpbx/master

11
This commit is contained in:
blackc2004
2016-01-23 06:24:07 -08:00
118 changed files with 1090 additions and 504 deletions
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+2 -2
View File
@@ -65,7 +65,7 @@ else {
if (if_group("superadmin")){ if (if_group("superadmin")){
$broadcast_accountcode = check_str($_POST["broadcast_accountcode"]); $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"]."'"; $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 = $db->prepare(check_sql($sql_accountcode));
$prep_statement_accountcode->execute(); $prep_statement_accountcode->execute();
@@ -277,7 +277,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo $text['description-accountcode']."\n"; echo $text['description-accountcode']."\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\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']."'"; $sql_accountcode = "SELECT type_value FROM v_billings WHERE domain_uuid = '".$_SESSION['domain_uuid']."'";
echo "<tr>\n"; echo "<tr>\n";
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+2 -1
View File
@@ -266,7 +266,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $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 == "add")
if ($action == "update") { if ($action == "update") {
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
-1
View File
@@ -79,7 +79,6 @@ else {
$sql .= "and extension = 'disabled' "; $sql .= "and extension = 'disabled' ";
} }
} }
$sql .= "and enabled = 'true' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+55 -51
View File
@@ -141,7 +141,7 @@ else {
} }
//delete the user //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) { if (strlen($_REQUEST["meeting_user_uuid"]) > 0) {
//set the variables //set the variables
$meeting_user_uuid = check_str($_REQUEST["meeting_user_uuid"]); $meeting_user_uuid = check_str($_REQUEST["meeting_user_uuid"]);
@@ -473,8 +473,28 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$enabled = $row["enabled"]; $enabled = $row["enabled"];
$description = $row["description"]; $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 //set default profile
if (strlen($profile) == 0) { $profile = 'default'; } if (strlen($profile) == 0) { $profile = 'default'; }
@@ -572,56 +592,40 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " </tr>"; echo " </tr>";
if (if_group("superadmin") || if_group("admin")) { if (if_group("superadmin") || if_group("admin")) {
echo " <tr>";
echo " <tr>"; echo " <td class='vncell' valign='top'>".$text['label-users']."</td>";
echo " <td class='vncell' valign='top'>".$text['label-users']."</td>"; echo " <td class='vtable' align='left'>";
echo " <td class='vtable' align='left'>"; if ($action == "update") {
if ($action == "update") { echo " <table border='0' style='width : 235px;'>\n";
echo " <table border='0' style='width : 235px;'>\n"; foreach($meeting_users as $field) {
$sql = "SELECT * FROM v_users as u, v_meeting_users as m "; echo " <tr>\n";
$sql .= "where u.user_uuid = m.user_uuid "; echo " <td class='vtable'>".$field['username']."</td>\n";
$sql .= "and m.domain_uuid = '".$_SESSION['domain_uuid']."' "; echo " <td style='width: 25px;' align='right'>\n";
$sql .= "and m.meeting_uuid = '$meeting_uuid' "; if (permission_exists('conference_room_delete')) {
$sql .= "order by u.username asc "; echo " <a href='conference_room_edit.php?meeting_user_uuid=".$field['meeting_user_uuid']."&conference_room_uuid=".$conference_room_uuid."&a=delete' alt='delete' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n";
$prep_statement = $db->prepare(check_sql($sql)); }
$prep_statement->execute(); echo " </td>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); echo " </tr>\n";
$result_count = count($result);
foreach($result as $field) {
echo " <tr>\n";
echo " <td class='vtable'>".$field['username']."</td>\n";
echo " <td style='width: 25px;' align='right'>\n";
if ($result_count > 1) {
echo " <a href='conference_room_edit.php?meeting_user_uuid=".$field['meeting_user_uuid']."&conference_room_uuid=".$conference_room_uuid."&a=delete' alt='delete' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n";
} }
echo " </td>\n"; echo " </table>\n";
echo " </tr>\n";
} }
echo " </table>\n"; echo " <br />\n";
} if (permission_exists('conference_room_add')) {
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n";
echo " <br />\n"; echo " <option value=\"\"></option>\n";
$sql = "SELECT * FROM v_users "; foreach($users as $field) {
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; echo " <option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
$sql .= "order by username asc "; }
$prep_statement = $db->prepare(check_sql($sql)); echo " </select>";
$prep_statement->execute(); if ($action == "update") {
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n"; echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
echo " <option value=\"\"></option>\n"; }
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset($users);
foreach($result as $field) { echo " <br>\n";
echo " <option value='".$field['user_uuid']."'>".$field['username']."</option>\n"; }
} echo " ".$text['description-users']."\n";
echo " </select>"; echo " </td>";
if ($action == "update") { echo " </tr>";
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
}
unset($sql, $result);
echo " <br>\n";
echo " ".$text['description-users']."\n";
echo " </td>";
echo " </tr>";
} }
if (permission_exists('conference_room_profile')) { if (permission_exists('conference_room_profile')) {
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+62 -9
View File
@@ -102,6 +102,22 @@
$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++; $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]['name'] = "contact_email_view";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "admin";
@@ -294,7 +310,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++; $z++;
$y = 1; //table array index $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_addresses"; $apps[$x]['db'][$y]['table'] = "v_contact_addresses";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_address_uuid"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_address_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "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."; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";
$z++; $z++;
$y = 2; //table array index $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_phones"; $apps[$x]['db'][$y]['table'] = "v_contact_phones";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_phone_uuid"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_phone_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "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."; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";
$z++; $z++;
$y = 3; //table array index $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_notes"; $apps[$x]['db'][$y]['table'] = "v_contact_notes";
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "id"; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "id";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "contacts_note_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'] = ""; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++; $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]['table'] = "v_contact_groups";
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "contact_group_uuid"; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "contact_group_uuid";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "contact_groups_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'] = ""; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++; $z++;
$y = 5; //table array index $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_settings"; $apps[$x]['db'][$y]['table'] = "v_contact_settings";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_setting_uuid"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_setting_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "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]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $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]['table'] = "v_contact_relations";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_relation_uuid"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_relation_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
@@ -622,7 +675,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++; $z++;
$y = 7; //table array index $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_emails"; $apps[$x]['db'][$y]['table'] = "v_contact_emails";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_email_uuid"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_email_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "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."; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the email description.";
$z++; $z++;
$y = 8; //table array index $y++; //table array index
$apps[$x]['db'][$y]['table'] = "v_contact_urls"; $apps[$x]['db'][$y]['table'] = "v_contact_urls";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_url_uuid"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_url_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "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."; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the URL description.";
$z++; $z++;
$y = 9; //table array index $y++; //table array index
$apps[$x]['db'][$y]['table'] = 'v_contact_times'; $apps[$x]['db'][$y]['table'] = 'v_contact_times';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid'; $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']['pgsql'] = 'uuid';
+192 -158
View File
@@ -2,183 +2,217 @@
if ($domains_processed == 1) { if ($domains_processed == 1) {
require_once "resources/classes/schema.php";
//populate new phone_label values, phone_type_* values //populate new phone_label values, phone_type_* values
$obj = new schema; $obj = new schema;
$obj->db = $db; $obj->db = $db;
$obj->db_type = $db_type; $obj->db_type = $db_type;
$obj->schema(); $obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists $field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists
if ($field_exists) { if ($field_exists) {
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
// populate phone_type_* values // populate phone_type_* values
$sql = "update v_contact_phones set phone_type_voice = '1' "; $sql = "update v_contact_phones set phone_type_voice = '1' ";
$sql .= "where phone_type = 'home' "; $sql .= "where phone_type = 'home' ";
$sql .= "or phone_type = 'work' "; $sql .= "or phone_type = 'work' ";
$sql .= "or phone_type = 'voice' "; $sql .= "or phone_type = 'voice' ";
$sql .= "or phone_type = 'voicemail' "; $sql .= "or phone_type = 'voicemail' ";
$sql .= "or phone_type = 'cell' "; $sql .= "or phone_type = 'cell' ";
$sql .= "or phone_type = 'pcs' "; $sql .= "or phone_type = 'pcs' ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($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);
// migrate phone_type values to phone_label, correct case and make multilingual where appropriate $sql = "update v_contact_phones set phone_type_fax = '1' where phone_type = 'fax'";
$default_phone_types = array('home','work','pref','voice','fax','msg','cell','pager','modem','car','isdn','video','pcs'); $db->exec(check_sql($sql));
$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'); unset($sql);
foreach ($default_phone_types as $index => $old) {
$new = $default_phone_labels[$index]; $sql = "update v_contact_phones set phone_type_video = '1' where phone_type = 'video'";
$sql = "update v_contact_phones set phone_label = '".$new."' where phone_type = '".$old."'"; $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)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
} }
unset($obj);
// 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);
//populate primary email from deprecated field in v_contact table //populate primary email from deprecated field in v_contact table
$obj = new schema; $obj = new schema;
$obj->db = $db; $obj->db = $db;
$obj->db_type = $db_type; $obj->db_type = $db_type;
$obj->schema(); $obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists
if ($field_exists) { if ($field_exists) {
// get email records // get email records
$sql = "select * from v_contacts where contact_email is not null and contact_email != ''"; $sql = "select * from v_contacts where contact_email is not null and contact_email != ''";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result); $result_count = count($result);
unset ($prep_statement, $sql); unset ($prep_statement, $sql);
if ($result_count > 0) { if ($result_count > 0) {
foreach($result as $row) { foreach($result as $row) {
$sql = "insert into v_contact_emails "; $sql = "insert into v_contact_emails ";
$sql .= "("; $sql .= "(";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "contact_uuid, "; $sql .= "contact_uuid, ";
$sql .= "contact_email_uuid, "; $sql .= "contact_email_uuid, ";
$sql .= "email_primary, "; $sql .= "email_primary, ";
$sql .= "email_address"; $sql .= "email_address";
$sql .= ")"; $sql .= ")";
$sql .= "values "; $sql .= "values ";
$sql .= "("; $sql .= "(";
$sql .= "'".$row['domain_uuid']."', "; $sql .= "'".$row['domain_uuid']."', ";
$sql .= "'".$row['contact_uuid']."', "; $sql .= "'".$row['contact_uuid']."', ";
$sql .= "'".uuid()."', "; $sql .= "'".uuid()."', ";
$sql .= "1, "; $sql .= "1, ";
$sql .= "'".$row['contact_email']."' "; $sql .= "'".$row['contact_email']."' ";
$sql .= ")"; $sql .= ")";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
//verify and remove value from old field //verify and remove value from old field
$sql2 = "select email_address from v_contact_emails "; $sql2 = "select email_address from v_contact_emails ";
$sql2 .= "where domain_uuid = '".$row['domain_uuid']."' "; $sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql2 .= "and contact_uuid = '".$row['contact_uuid']."' "; $sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$sql2 .= "and email_address = '".$row['contact_email']."' "; $sql2 .= "and email_address = '".$row['contact_email']."' ";
$prep_statement2 = $db->prepare(check_sql($sql2)); $prep_statement2 = $db->prepare(check_sql($sql2));
$prep_statement2->execute(); $prep_statement2->execute();
$result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED); $result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
$result_count2 = count($result2); $result_count2 = count($result2);
if ($result_count2 > 0) { if ($result_count2 > 0) {
$sql3 = "update v_contacts set contact_email = '' "; $sql3 = "update v_contacts set contact_email = '' ";
$sql3 .= "where domain_uuid = '".$row['domain_uuid']."' "; $sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql3 .= "and contact_uuid = '".$row['contact_uuid']."' "; $sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$prep_statement3 = $db->prepare(check_sql($sql3)); $prep_statement3 = $db->prepare(check_sql($sql3));
$prep_statement3->execute(); $prep_statement3->execute();
unset($sql3, $prep_statement3); 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 //populate primary url from deprecated field in v_contact table
$obj = new schema; $obj = new schema;
$obj->db = $db; $obj->db = $db;
$obj->db_type = $db_type; $obj->db_type = $db_type;
$obj->schema(); $obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists
if ($field_exists) { if ($field_exists) {
// get email records // get email records
$sql = "select * from v_contacts where contact_url is not null and contact_url != ''"; $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 = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result); foreach ($result as &$row) {
unset ($prep_statement, $sql); $sql = "insert into v_contact_users ";
if ($result_count > 0) { $sql .= "( ";
foreach($result as $row) { $sql .= "contact_user_uuid, ";
$sql = "insert into v_contact_urls "; $sql .= "domain_uuid, ";
$sql .= "("; $sql .= "contact_uuid, ";
$sql .= "domain_uuid, "; $sql .= "user_uuid ";
$sql .= "contact_uuid, "; $sql .= ") ";
$sql .= "contact_url_uuid, "; $sql .= "values ";
$sql .= "url_primary, "; $sql .= "( ";
$sql .= "url_address"; $sql .= "'".uuid()."', ";
$sql .= ")"; $sql .= "'".$row["domain_uuid"]."', ";
$sql .= "values "; $sql .= "'".$row["contact_uuid"]."', ";
$sql .= "("; $sql .= "'".$row["group_uuid"]."' ";
$sql .= "'".$row['domain_uuid']."', "; $sql .= ");";
$sql .= "'".$row['contact_uuid']."', "; //echo $sql."\n";
$sql .= "'".uuid()."', "; $db->exec($sql);
$sql .= "1, "; unset($sql);
$sql .= "'".$row['contact_url']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//verify and remove value from old field $sql = "delete from v_contact_groups ";
$sql2 = "select url_address from v_contact_urls "; $sql .= "where contact_group_uuid = '".$row["contact_group_uuid"]."';";
$sql2 .= "where domain_uuid = '".$row['domain_uuid']."' "; //echo $sql."\n";
$sql2 .= "and contact_uuid = '".$row['contact_uuid']."' "; $db->exec($sql);
$sql2 .= "and url_address = '".$row['contact_url']."' "; unset($sql);
$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 ($prep_statement);
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);
} }
+22 -2
View File
@@ -1033,6 +1033,16 @@ $text['label-import_delimiter']['sv-se'] = "Avgränsare";
$text['label-import_delimiter']['de-at'] = "Trennzeichen"; $text['label-import_delimiter']['de-at'] = "Trennzeichen";
$text['label-import_delimiter']['he'] = ""; $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']['en-us'] = "Groups";
$text['label-groups']['es-cl'] = "Grupos"; $text['label-groups']['es-cl'] = "Grupos";
$text['label-groups']['pt-pt'] = "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']['de-at'] = "Wählen Sie das Trennzeichen (Beistrich oder Wagrechter Strich)";
$text['description-import_delimiter']['he'] = ""; $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']['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']['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']['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']['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']['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."; $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.";
+10 -2
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
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. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -106,7 +106,15 @@ if (strlen($contact_uuid) > 0) {
$prep_statement->execute(); $prep_statement->execute();
unset($prep_statement, $sql); 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 = "delete from v_contact_groups ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
+192 -179
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "resources/require.php"; require_once "resources/require.php";
require_once "resources/check_auth.php"; require_once "resources/check_auth.php";
if (permission_exists('contact_edit')) { if (permission_exists('contact_view')) {
//access granted //access granted
} }
else { else {
@@ -38,21 +38,6 @@ else {
$language = new text; $language = new text;
$text = $language->get(); $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 //action add or update
if (isset($_REQUEST["id"])) { if (isset($_REQUEST["id"])) {
$action = "update"; $action = "update";
@@ -63,7 +48,8 @@ else {
} }
//get http post variables and set them to php variables //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_type = check_str($_POST["contact_type"]);
$contact_organization = check_str($_POST["contact_organization"]); $contact_organization = check_str($_POST["contact_organization"]);
$contact_name_prefix = check_str($_POST["contact_name_prefix"]); $contact_name_prefix = check_str($_POST["contact_name_prefix"]);
@@ -117,141 +103,144 @@ else {
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
//update last modified //add the contact
$sql = "update v_contacts set "; if ($action == "add" && permission_exists('contact_add')) {
$sql .= "last_mod_date = now(), "; $contact_uuid = uuid();
$sql .= "last_mod_user = '".$_SESSION['username']."' "; $sql = "insert into v_contacts ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "( ";
$sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "domain_uuid, ";
$db->exec(check_sql($sql)); $sql .= "contact_uuid, ";
unset($sql); $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") { $_SESSION["message"] = $text['message-add'];
$contact_uuid = uuid(); $location = "contact_edit.php?id=".$contact_uuid;
$sql = "insert into v_contacts "; } //if ($action == "add")
$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']; //update the contact
$location = "contact_edit.php?id=".$contact_uuid; if ($action == "update" && permission_exists('contact_edit')) {
} //if ($action == "add") $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 $_SESSION["message"] = $text['message-update'];
if ($_POST['contact_shared'] == 'true') { $location = "contact_edit.php?id=".$contact_uuid;
$sql = "delete from v_contact_groups "; } //if ($action == "update")
$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"];
}
//handle insertion of contact group (or private contact, if not shared) //assign the contact to the user that added the contact
if ($group_uuid != '') { if ($action == "add" && !permission_exists('contact_user_add')) {
$sql = "insert into v_contact_groups "; $user_uuid = $_SESSION["user_uuid"];
$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);
}
if ($action == "update") { //add user to contact users table
$sql = "update v_contacts set "; if ($user_uuid != '') {
$sql .= "contact_type = '".$contact_type."', "; $contact_user_uuid = uuid();
$sql .= "contact_organization = '".$contact_organization."', "; $sql = "insert into v_contact_users ";
$sql .= "contact_name_prefix = '".$contact_name_prefix."', "; $sql .= "(";
$sql .= "contact_name_given = '".$contact_name_given."', "; $sql .= "domain_uuid, ";
$sql .= "contact_name_middle = '".$contact_name_middle."', "; $sql .= "contact_user_uuid, ";
$sql .= "contact_name_family = '".$contact_name_family."', "; $sql .= "contact_uuid, ";
$sql .= "contact_name_suffix = '".$contact_name_suffix."', "; $sql .= "user_uuid ";
$sql .= "contact_nickname = '".$contact_nickname."', "; $sql .= ") ";
$sql .= "contact_title = '".$contact_title."', "; $sql .= "values ";
$sql .= "contact_category = '".$contact_category."', "; $sql .= "(";
$sql .= "contact_role = '".$contact_role."', "; $sql .= "'$domain_uuid', ";
$sql .= "contact_time_zone = '".$contact_time_zone."', "; $sql .= "'$contact_user_uuid', ";
$sql .= "contact_note = '".$contact_note."', "; $sql .= "'$contact_uuid', ";
$sql .= "last_mod_date = now(), "; $sql .= "'$user_uuid' ";
$sql .= "last_mod_user = '".$_SESSION['username']."' "; $sql .= ")";
$sql .= "where domain_uuid = '".$domain_uuid."' "; if (permission_exists('contact_user_add')) {
$sql .= "and contact_uuid = '".$contact_uuid."' "; $db->exec(check_sql($sql));
$db->exec(check_sql($sql)); }
unset($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']; //assign the contact to the group
$location = "contact_edit.php?id=".$contact_uuid; if ($group_uuid != '' && permission_exists('contact_group_add')) {
} //if ($action == "update") $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 //handle redirect
if ($_POST['submit'] == $text['button-add']) { if ($_POST['submit'] == $text['button-add']) {
$group_uuid = $_POST['group_uuid']; $group_uuid = $_POST['group_uuid'];
//insert $location = "contact_edit.php?id=".$contact_uuid;
$location = "contact_edit.php?id=".$contact_uuid; }
}
header("Location: ".$location); //redirect the browser
return; header("Location: ".$location);
return;
} //if ($_POST["persistformvar"] != "true") } //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
@@ -280,9 +269,30 @@ else {
$contact_time_zone = $row["contact_time_zone"]; $contact_time_zone = $row["contact_time_zone"];
$contact_note = $row["contact_note"]; $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 //show the header
require_once "resources/header.php"; require_once "resources/header.php";
if ($action == "update") { if ($action == "update") {
@@ -292,7 +302,7 @@ else {
$document['title'] = $text['title-contact-add']; $document['title'] = $text['title-contact-add'];
} }
// qr code generation //qr code generation
$_GET['type'] = "text"; $_GET['type'] = "text";
$qr_vcard = true; $qr_vcard = true;
include "contacts_vcard.php"; include "contacts_vcard.php";
@@ -592,43 +602,46 @@ else {
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
//determine if contact is shared or private if (permission_exists('contact_user_edit')) {
if ($action == 'update') { echo " <tr>";
$sql = "select count(*) as num_rows from v_contact_groups "; echo " <td class='vncell' valign='top'>".$text['label-users']."</td>";
$sql .= "where domain_uuid = '".$domain_uuid."' "; echo " <td class='vtable' align='left'>";
$sql .= "and contact_uuid = '".$contact_uuid."' "; if ($action == "update") {
$sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' "; echo " <table border='0' style='width : 235px;'>\n";
$prep_statement = $db->prepare(check_sql($sql)); foreach($contact_users as $field) {
$prep_statement->execute(); echo " <tr>\n";
$row = $prep_statement->fetch(PDO::FETCH_ASSOC); echo " <td class='vtable'>".$field['username']."</td>\n";
$contact_shared = ($row['num_rows'] > 0) ? 'false' : 'true'; echo " <td style='width: 25px;' align='right'>\n";
unset ($sql, $prep_statement, $row); if (permission_exists('contact_user_delete')) {
echo " <a href='contact_user_delete.php?id=".$field['contact_user_uuid']."&contact_uuid=".$contact_uuid."' alt='delete' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo " </tr>\n";
}
echo " </table>\n";
}
echo " <br />\n";
if (permission_exists('contact_user_add')) {
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n";
echo " <option value=\"\"></option>\n";
foreach($users as $field) {
echo " <option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
}
echo " </select>";
if ($action == "update") {
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
}
unset($users);
echo " <br>\n";
echo " ".$text['description-users']."\n";
}
echo " </td>";
echo " </tr>";
} }
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 "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-shared']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' ".(($contact_shared_disabled == '') ? "name='contact_shared'" : null)." id='contact_shared' ".((permission_exists('contact_group_view')) ? "onchange=\"$('#div_groups').slideToggle('400');\"" : null)." ".$contact_shared_disabled.">\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".(($contact_shared == 'true') ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($contact_shared_disabled != '') {
echo " <input type='hidden' name='contact_shared' value='".$contact_shared."'>";
}
echo "<br />\n";
echo $text['description-shared']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>"; echo "</table>";
if (permission_exists('contact_group_view')) { if (permission_exists('contact_group_view')) {
$contact_shared = 'true';
echo "<div id='div_groups' ".(($contact_shared != 'true') ? "style='display: none;'" : null).">\n"; echo "<div id='div_groups' ".(($contact_shared != 'true') ? "style='display: none;'" : null).">\n";
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n"; echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
echo "<tr>"; echo "<tr>";
@@ -658,7 +671,7 @@ else {
echo " <td class='vtable'>".$field['group_name']."</td>\n"; echo " <td class='vtable'>".$field['group_name']."</td>\n";
echo " <td>\n"; echo " <td>\n";
if (permission_exists('contact_group_delete') || if_group("superadmin")) { if (permission_exists('contact_group_delete') || if_group("superadmin")) {
echo " <a href='contact_edit.php?id=".$contact_uuid."&cgid=".$field['contact_group_uuid']."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n"; echo " <a href='contact_group_delete.php?id=".$contact_group_uuid."&contact_uuid=".$field['contact_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo "</tr>\n"; echo "</tr>\n";
+65
View File
@@ -0,0 +1,65 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('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;
}
?>
+65
View File
@@ -0,0 +1,65 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('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;
}
?>
+9 -7
View File
@@ -72,7 +72,7 @@ else {
$sql .= "and contact_setting_name = 'array' "; $sql .= "and contact_setting_name = 'array' ";
$sql .= "and contact_setting_value <> '' "; $sql .= "and contact_setting_value <> '' ";
$sql .= "and contact_setting_value is not null "; $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 .= "and ( \n"; //only contacts assigned to current user's group(s) and those not assigned to any group
$sql .= " contact_uuid in ( \n"; $sql .= " contact_uuid in ( \n";
$sql .= " select contact_uuid from v_contact_groups "; $sql .= " select contact_uuid from v_contact_groups ";
@@ -82,7 +82,8 @@ else {
$sql .= " or \n"; $sql .= " or \n";
$sql .= " contact_uuid not in ( \n"; $sql .= " contact_uuid not in ( \n";
$sql .= " select contact_uuid from v_contact_groups "; $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";
$sql .= ") \n"; $sql .= ") \n";
} }
@@ -100,17 +101,18 @@ else {
$sql = "select count(*) as num_rows "; $sql = "select count(*) as num_rows ";
$sql .= "from v_contacts as c "; $sql .= "from v_contacts as c ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $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 .= "and ( \n"; //only contacts assigned to current user's group(s) and those not assigned to any group
$sql .= " contact_uuid in ( \n"; $sql .= " contact_uuid in ( \n";
$sql .= " select contact_uuid from v_contact_groups "; $sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where group_uuid in ('".implode("','", $user_group_uuids)."') "; $sql .= " where group_uuid in ('".implode("','", $user_group_uuids)."') ";
$sql .= " and domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= " and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " ) \n"; $sql .= " ) \n";
$sql .= " or \n"; $sql .= " or contact_uuid in ( \n";
$sql .= " contact_uuid not in ( \n"; $sql .= " select contact_uuid from v_contact_users ";
$sql .= " select contact_uuid from v_contact_groups "; $sql .= " where user_uuid = '".$_SESSION['user_uuid']."' ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= " and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "";
$sql .= " ) \n"; $sql .= " ) \n";
$sql .= ") \n"; $sql .= ") \n";
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+5 -5
View File
@@ -35,7 +35,7 @@ else {
exit; 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/currency.php";
require_once "app/billing/resources/functions/rating.php"; require_once "app/billing/resources/functions/rating.php";
} }
@@ -432,7 +432,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "add") { if ($action == "add") {
$_SESSION["message"] = $text['message-add']; $_SESSION["message"] = $text['message-add'];
// billing // 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 = new database;
$db2->sql = "select currency, billing_uuid, balance from v_billings where type_value='$destination_accountcode'"; $db2->sql = "select currency, billing_uuid, balance from v_billings where type_value='$destination_accountcode'";
$db2->result = $db2->execute(); $db2->result = $db2->execute();
@@ -706,7 +706,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\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 = "select * from v_fax ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "order by fax_name asc "; $sql .= "order by fax_name asc ";
@@ -750,7 +750,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n"; echo "</tr>\n";
// billing // 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 "<tr id='tr_sell'>\n"; echo "<tr id='tr_sell'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-monthly_price']."\n"; echo " ".$text['label-monthly_price']."\n";
@@ -797,7 +797,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <input class='formfld' type='text' name='destination_accountcode' maxlength='255' value=\"$destination_accountcode\">\n"; echo " <input class='formfld' type='text' name='destination_accountcode' maxlength='255' value=\"$destination_accountcode\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-account_code']."\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 " ".$text['billing-warning'];
} }
echo "</td>\n"; echo "</td>\n";
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+44 -2
View File
@@ -557,8 +557,8 @@ require_once "resources/require.php";
if (!isset($_SERVER['HTTP_PROTOCOL'])) { if (!isset($_SERVER['HTTP_PROTOCOL'])) {
$_SERVER['HTTP_PROTOCOL'] = 'http'; $_SERVER['HTTP_PROTOCOL'] = 'http';
if (isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['HTTP_PROTOCOL'] = $_SERVER['REQUEST_SCHEME']; } if (isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['HTTP_PROTOCOL'] = $_SERVER['REQUEST_SCHEME']; }
if ($_SERVER['HTTPS'] = 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; } if ($_SERVER['HTTPS'] == 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
if ($_SERVER['SERVER_PORT'] = '443') { $_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 " window.location = '".$_SERVER['HTTP_PROTOCOL']."://".$domain_name."/app/provision?mac=".$device_mac_address."&file=' + d + '&content_type=application/octet-stream';\n";
echo " }\n"; echo " }\n";
@@ -1049,6 +1049,48 @@ require_once "resources/require.php";
<?php <?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; } if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
} }
if (strtolower($device_vendor) == "mitel" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
echo "<optgroup label='Mitel'>";
?>
<option value='0' <?php if ($row['device_key_type'] == "0") { echo $selected;$found=true; } ?>><?php echo $text['label-none'] ?></option>
<option value='6' <?php if ($row['device_key_type'] == "6") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='27' <?php if ($row['device_key_type'] == "27") { echo $selected;$found=true; } ?>><?php echo $text['label-blf'] ?></option>
<option value='1' <?php if ($row['device_key_type'] == "1") { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial'] ?></option>
<option value='5' <?php if ($row['device_key_type'] == "5") { echo $selected;$found=true; } ?>><?php echo $text['label-shared_line'] ?></option>
<option value='16' <?php if ($row['device_key_type'] == "16") { echo $selected;$found=true; } ?>><?php echo $text['label-forward'] ?></option>
<option value='17' <?php if ($row['device_key_type'] == "17") { echo $selected;$found=true; } ?>><?php echo $text['label-dnd'] ?></option>
<option value='19' <?php if ($row['device_key_type'] == "19") { echo $selected;$found=true; } ?>><?php echo $text['label-url'] ?></option>
<!--
0 - not programmed
1 - speed dial
2 - callLog
3 - advisoryMsg (on/off)
4 - headset(on/off)
5 - shared line
6 - Line 1
7 - Line 2
8 - Line 3
9 - Line 4
10 - Line 5
11 - Line 6
12 - Line 7
13 - Line 8
15 - phonebook
16 - call forwarding
17 - do not disturb
18 - PC Application
19 - RSS Feed URL / Branding /Notes
21 - Superkey (5304 set only)
22 - Redial key (5304 set only)
23 - Hold key (5304 set only)
24 - Trans/Conf key (5304 set only)
25 - Message key (5304 set only)
26 - Cancel key (5304 set only)
27 - Speed Dial & BLF
-->
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}
if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) { if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
echo "<optgroup label='Polycom'>"; echo "<optgroup label='Polycom'>";
?> ?>
+1
View File
@@ -257,6 +257,7 @@ require_once "resources/require.php";
echo "</td>\n"; echo "</td>\n";
echo "<td width='70%' align='right' valign='top'>\n"; echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_profiles.php'\" value='".$text['button-back']."'>\n"; echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_profiles.php'\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"window.location='device_profile_copy.php'\" value='".$text['button-copy']."'>\n";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n"; echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3 -3
View File
@@ -79,9 +79,9 @@ else {
//create a new app_uuid when copying a dialplan except for these exceptions //create a new app_uuid when copying a dialplan except for these exceptions
switch ($app_uuid) { switch ($app_uuid) {
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": break; //inbound routes
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": break; //outbound routes
case "4b821450-926b-175a-af93-a03c441818b1": //time conditions case "4b821450-926b-175a-af93-a03c441818b1": break; //time conditions
default: default:
$app_uuid = uuid(); $app_uuid = uuid();
} }
+1 -1
View File
@@ -786,7 +786,7 @@ else {
echo "<br><br>\n"; echo "<br><br>\n";
echo "</form>"; echo "</form>";
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 "<p>".$text['billing-warning']."</p>"; echo "<p>".$text['billing-warning']."</p>";
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+1 -1
View File
@@ -35,7 +35,7 @@ else {
} }
//detect billing app //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) { if ($billing_app_exists) {
require_once "app/billing/resources/functions/currency.php"; require_once "app/billing/resources/functions/currency.php";
require_once "app/billing/resources/functions/rating.php"; require_once "app/billing/resources/functions/rating.php";
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+1 -1
View File
@@ -36,7 +36,7 @@ else {
} }
//detect billing app //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) { if ($billing_app_exists) {
require_once "app/billing/resources/functions/currency.php"; require_once "app/billing/resources/functions/currency.php";
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+1 -1
View File
@@ -199,7 +199,7 @@ require_once "resources/header.php";
//refresh controls //refresh controls
function refresh_stop() { function refresh_stop() {
clearInterval(interval_timer_id); clearInterval(interval_timer_id);
document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">"; if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">"; }
} }
function refresh_start() { function refresh_start() {
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
@@ -498,6 +498,70 @@ include "root.php";
unset ($prep_statement); 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 //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") { if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") {
//get contacts from the database //get contacts from the database
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+2 -2
View File
@@ -70,7 +70,7 @@
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//add rating functions if the billing is installed //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"; require_once "app/billing/resources/functions/rating.php";
} }
@@ -246,7 +246,7 @@
} }
//billing information //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; $db2 = new database;
$lcr_currency = (strlen($_SESSION['billing']['currency']['text'])?$_SESSION['billing']['currency']['text']:'USD'); $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; $accountcode = (strlen(urldecode($xml->variables->accountcode)))?check_str(urldecode($xml->variables->accountcode)):$domain_name;
+3 -3
View File
@@ -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('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('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); 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 // billing collumns
echo "<th>".$text['label-price']."</th>\n"; echo "<th>".$text['label-price']."</th>\n";
$col_count++; $col_count++;
@@ -362,7 +362,7 @@ else {
$col_count++; $col_count++;
} }
echo "</tr>\n"; echo "</tr>\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 "app/billing/resources/functions/rating.php";
require_once "resources/classes/database.php"; require_once "resources/classes/database.php";
$database = new database; $database = new database;
@@ -543,7 +543,7 @@ else {
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".gmdate("G:i:s", $seconds)."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".gmdate("G:i:s", $seconds)."</td>\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"; $database->table = "v_xml_cdr";
$accountcode = (strlen($row["accountcode"])?$row["accountcode"]:$_SESSION[domain_name]); $accountcode = (strlen($row["accountcode"])?$row["accountcode"]:$_SESSION[domain_name]);
+1 -1
View File
@@ -299,7 +299,7 @@ else {
$sql .= "caller_id_number, "; $sql .= "caller_id_number, ";
$sql .= "destination_number, "; $sql .= "destination_number, ";
$sql .= "accountcode, "; $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, "; $sql .= "call_sell, ";
} }
if (permission_exists("xml_cdr_pdd")) { if (permission_exists("xml_cdr_pdd")) {
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+14 -14
View File
@@ -133,7 +133,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($original_domain_name != $domain_name) { if ($original_domain_name != $domain_name) {
// update dialplans // 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 = "update v_dialplans set ";
$sql .= "dialplan_context = '".$domain_name."' "; $sql .= "dialplan_context = '".$domain_name."' ";
$sql .= "where dialplan_context = '".$original_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) // 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 = "update v_extensions set ";
$sql .= "accountcode = '".$domain_name."' "; $sql .= "accountcode = '".$domain_name."' ";
$sql .= "where accountcode = '".$original_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) // 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 = "update v_xml_cdr set ";
$sql .= "domain_name = '".$domain_name."' "; $sql .= "domain_name = '".$domain_name."' ";
$sql .= "where domain_name = '".$original_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 // 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 = "update v_billings set ";
$sql .= "type_value = '".$domain_name."' "; $sql .= "type_value = '".$domain_name."' ";
$sql .= "where type_value = '".$original_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 // 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 = "select conference_session_uuid, recording from v_conference_sessions ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and recording like '%".$original_domain_name."%' "; $sql .= "and recording like '%".$original_domain_name."%' ";
@@ -267,7 +267,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
// update conference center greetings // 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 = "select conference_center_uuid, conference_center_greeting from v_conference_centers ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and conference_center_greeting like '%".$original_domain_name."%' "; $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 // 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 = "select ivr_menu_uuid, ivr_menu_greet_long, ivr_menu_greet_short from v_ivr_menus ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( "; $sql .= "and ( ";
@@ -323,7 +323,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
// update ivr menu option parameters // 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 = "select ivr_menu_option_uuid, ivr_menu_option_param from v_ivr_menu_options ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ivr_menu_option_param like '%".$original_domain_name."%' "; $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 // 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 = "select call_center_queue_uuid, queue_record_template from v_call_center_queues ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and queue_record_template like '%".$original_domain_name."%' "; $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 // 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 = "select call_center_agent_uuid, agent_contact from v_call_center_agents ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and agent_contact like '%".$original_domain_name."%' "; $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 // 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 = "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 .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( "; $sql .= "and ( ";
@@ -433,7 +433,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
// update ring group context, forward destination, timeout data // 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 = "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 .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( "; $sql .= "and ( ";
@@ -468,7 +468,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
// update device lines server address, outbound proxy // 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 = "select device_line_uuid, server_address, outbound_proxy from v_device_lines ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( "; $sql .= "and ( ";
@@ -510,7 +510,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($dialplan_public_xml); unset($dialplan_public_xml);
// update dialplan details // 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 = "select dialplan_detail_uuid, dialplan_detail_data from v_dialplan_details ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and dialplan_detail_data like '%".$original_domain_name."%' "; $sql .= "and dialplan_detail_data like '%".$original_domain_name."%' ";
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+1 -1
View File
@@ -31,7 +31,7 @@ require_once "resources/check_auth.php";
//detect install state //detect install state
$first_time_install = true; $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; $first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) { } elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux //linux
+1 -1
View File
@@ -78,7 +78,7 @@ date_default_timezone_set($timezone);
//detect install state //detect install state
$first_time_install = true; $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; $first_time_install = false;
} elseif (file_exists("/etc/fusionpbx/config.php")) { } elseif (file_exists("/etc/fusionpbx/config.php")) {
$first_time_install = false; $first_time_install = false;
@@ -56,7 +56,7 @@ include "root.php";
} elseif (is_dir("/usr/local/etc/fusionpbx")){ } elseif (is_dir("/usr/local/etc/fusionpbx")){
$this->config_php = "/usr/local/etc/fusionpbx/config.php"; $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"; $this->config_php = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php";
} }
else { else {
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+2 -2
View File
@@ -28,9 +28,9 @@
include "root.php"; include "root.php";
//if config.php file does not exist then redirect to the install page //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 //do nothing
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
//original directory //original directory
} elseif (file_exists("/etc/fusionpbx/config.php")){ } elseif (file_exists("/etc/fusionpbx/config.php")){
//linux //linux
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+1 -1
View File
@@ -341,7 +341,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
// if call center installed // 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 // 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."' "; $sql = "update v_call_center_agents set agent_name = '".$username."' where domain_uuid = '".$domain_uuid."' and agent_name = '".$username_old."' ";
+7 -9
View File
@@ -30,13 +30,13 @@ include "root.php";
session_start(); session_start();
//if config.php file does not exist then redirect to the install page //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 //do nothing
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
//original directory //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. //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")) { } elseif (file_exists("/etc/fusionpbx/config.php")) {
//linux //linux
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
@@ -59,8 +59,7 @@ include "root.php";
if (strlen($_SESSION["username"]) > 0) { if (strlen($_SESSION["username"]) > 0) {
if (strlen($_SESSION['login']['destination']['url']) > 0) { if (strlen($_SESSION['login']['destination']['url']) > 0) {
header("Location: ".$_SESSION['login']['destination']['url']); 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"); header("Location: ".PROJECT_PATH."/core/user_settings/user_dashboard.php");
} }
else { else {
@@ -70,10 +69,9 @@ include "root.php";
} }
else { else {
//use custom index, if present, otherwise use custom login, if present, otherwise use default login //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"; require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
} } else if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php"; require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
} }
else { else {
+4 -4
View File
@@ -40,12 +40,12 @@ include "root.php";
session_destroy(); session_destroy();
//if config.php file does not exist then redirect to the install page //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 //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. //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")){ else if (file_exists("/etc/fusionpbx/config.php")){
//linux //linux
@@ -68,7 +68,7 @@ include "root.php";
} }
//use custom login, if present, otherwise use default login //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"; require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
} }
else { else {
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+2 -2
View File
@@ -70,8 +70,8 @@ class config {
//get the PROJECT PATH //get the PROJECT PATH
include "root.php"; include "root.php";
// find the file // find the file
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
$this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"; $this->config_path = $_SERVER["PROJECT_ROOT"]."/resources/config.php";
} elseif (file_exists("/etc/fusionpbx/config.php")) { } elseif (file_exists("/etc/fusionpbx/config.php")) {
$this->config_path = "/etc/fusionpbx/config.php"; $this->config_path = "/etc/fusionpbx/config.php";
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
+4 -4
View File
@@ -54,10 +54,10 @@ include "root.php";
if (strlen($this->type) == 0 && strlen($this->db_name) == 0) { if (strlen($this->type) == 0 && strlen($this->db_name) == 0) {
//include config.php //include config.php
include "root.php"; include "root.php";
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
include $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"; include $_SERVER["PROJECT_ROOT"]."/resources/config.php";
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { } elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
include $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"; include $_SERVER["PROJECT_ROOT"]."/resources/config.php";
} elseif (file_exists("/etc/fusionpbx/config.php")){ } elseif (file_exists("/etc/fusionpbx/config.php")){
//linux //linux
include "/etc/fusionpbx/config.php"; include "/etc/fusionpbx/config.php";
+1 -1
View File
@@ -186,7 +186,7 @@ class destinations {
$destination = $row['field']['destination']; $destination = $row['field']['destination'];
//add multi-lingual support //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; $language2 = new text;
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name); $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
} }
+3
View File
@@ -74,6 +74,9 @@
} }
$i++; $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); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);
} }
+15 -5
View File
@@ -13,10 +13,10 @@ class vcard {
var $revision_date; var $revision_date;
var $card; var $card;
/* /**
The class constructor. You can set some defaults here if desired. * Called when the object is created
*/ */
function vcard() { public function __construct() {
$this->log = "New vcard() called<br />"; $this->log = "New vcard() called<br />";
$this->data = array( $this->data = array(
"display_name"=>null "display_name"=>null
@@ -59,7 +59,17 @@ class vcard {
,"sort_string"=>null ,"sort_string"=>null
,"note"=>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);
}
} }
/* /*
+1 -1
View File
@@ -87,7 +87,7 @@ require_once "resources/require.php";
unset($menu_prep_statement, $menu_result, $menu_row); unset($menu_prep_statement, $menu_result, $menu_row);
//get the content //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 = "select * from v_rss ";
$sql .= "where domain_uuid =:domain_uuid "; $sql .= "where domain_uuid =:domain_uuid ";
$sql .= "and rss_category = 'content' "; $sql .= "and rss_category = 'content' ";

Some files were not shown because too many files have changed in this diff Show More