浏览代码

Update from main repository contacts app.

Nate 4 年之前
父节点
当前提交
157ed1016c

+ 1 - 0
app_config.php

@@ -9,6 +9,7 @@
 		$apps[$x]['license'] = "Mozilla Public License 1.1";
 		$apps[$x]['contact_url'] = "http://www.fusionpbx.com";
 		$apps[$x]['description']['en-us'] = "Provides a place to store contact information for individuals and organizations.";
+		$apps[$x]['description']['en-gb'] = "Provides a place to store contact information for individuals and organizations.";
 		$apps[$x]['description']['ar-eg'] = "";
 		$apps[$x]['description']['de-at'] = "Bietet einen Ort um Kontaktinformationen von Personen und Firmen zu speichern.";
 		$apps[$x]['description']['de-ch'] = "";

文件差异内容过多而无法显示
+ 126 - 0
app_languages.php


+ 1 - 0
app_menu.php

@@ -2,6 +2,7 @@
 
 	$y=0;
 	$apps[$x]['menu'][$y]['title']['en-us'] = "Contacts";
+	$apps[$x]['menu'][$y]['title']['en-gb'] = "Contacts";
 	$apps[$x]['menu'][$y]['title']['ar-eg'] = "";
 	$apps[$x]['menu'][$y]['title']['de-at'] = "Kontakte";
 	$apps[$x]['menu'][$y]['title']['de-ch'] = "";

+ 3 - 3
contact_address_edit.php

@@ -237,7 +237,7 @@
 	echo "</script>";
 
 //show the content
-	echo "<form method='post' name='frm'>\n";
+	echo "<form method='post' name='frm' id='frm'>\n";
 
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'>";
@@ -249,8 +249,8 @@
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 57 - 62
contact_addresses.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2019
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -54,73 +54,68 @@
 	$contact_addresses = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-addresses']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_address_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_address_edit.php?contact_uuid='.urlencode($_GET['id'])]);
-	}
-	if (permission_exists('contact_address_delete') && $contact_addresses) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
-
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_address_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_addresses' name='checkbox_all' onclick=\"list_all_toggle('addresses');\" ".($contact_addresses ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th class='pct-15'>".$text['label-address_label']."</th>\n";
-	echo "<th>".$text['label-address_address']."</th>\n";
-	echo "<th>".$text['label-address_locality'].", ".$text['label-address_region']."</th>\n";
-	echo "<th class='center'>".$text['label-address_country']."</th>\n";
-	echo "<th class='shrink'>&nbsp;</th>\n";
-	echo "<th class='hide-md-dn'>".$text['label-address_description']."</th>\n";
-	if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
-
+//show if exists
 	if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
-		$x = 0;
-		foreach ($contact_addresses as $row) {
-			$map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code'];
-			if (permission_exists('contact_address_edit')) {
-				$list_row_url = "contact_address_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_address_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-addresses']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
+
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_address_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_addresses[$x][checked]' id='checkbox_".$x."' class='checkbox_addresses' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_addresses').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_addresses[$x][uuid]' value='".escape($row['contact_address_uuid'])."' />\n";
-				echo "	</td>\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_addresses' name='checkbox_all' onclick=\"edit_all_toggle('addresses');\" ".($contact_addresses ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			echo "	<td>".escape($row['address_label'])." ".($row['address_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
-			$address = escape($row['address_street']).($row['address_extended'] != '' ? " ".escape($row['address_extended']) : null);
-			echo "	<td class='pct-25 overflow no-wrap'><a href='".$list_row_url."'>".$address."</a>&nbsp;</td>\n";
-			echo "	<td class='no-wrap'>".escape($row['address_locality']).(($row['address_locality'] != '' && $row['address_region'] != '') ? ", " : null).escape($row['address_region'])."&nbsp;</td>\n";
-			echo "	<td class='center'>".escape($row['address_country'])."&nbsp;</td>\n";
-			echo "	<td class='button no-link'><a href=\"http://maps.google.com/maps?q=".urlencode($map_query)."&hl=en\" target=\"_blank\"><img src='resources/images/icon_gmaps.png' style='width: 21px; height: 21px; alt='".$text['label-google_map']."' title='".$text['label-google_map']."'></a></td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".escape($row['address_description'])."&nbsp;</td>\n";
+			echo "<th class='pct-15'>".$text['label-address_label']."</th>\n";
+			echo "<th>".$text['label-address_address']."</th>\n";
+			echo "<th>".$text['label-address_locality'].", ".$text['label-address_region']."</th>\n";
+			echo "<th class='center'>".$text['label-address_country']."</th>\n";
+			echo "<th class='shrink'>&nbsp;</th>\n";
+			echo "<th class='hide-md-dn'>".$text['label-address_description']."</th>\n";
 			if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-		unset($contact_addresses);
-	}
 
-	echo "</table>\n";
-	echo "<br />\n";
+			if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
+				$x = 0;
+				foreach ($contact_addresses as $row) {
+					$map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code'];
+					if (permission_exists('contact_address_edit')) {
+						$list_row_url = "contact_address_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_address_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_address_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_addresses[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_addresses' value='true' onclick=\"edit_delete_action('addresses');\">\n";
+						echo "		<input type='hidden' name='contact_addresses[$x][uuid]' value='".escape($row['contact_address_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td>".escape($row['address_label'])." ".($row['address_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
+					$address = escape($row['address_street']).($row['address_extended'] != '' ? " ".escape($row['address_extended']) : null);
+					echo "	<td class='pct-25 overflow no-wrap'><a href='".$list_row_url."'>".$address."</a>&nbsp;</td>\n";
+					echo "	<td class='no-wrap'>".escape($row['address_locality']).(($row['address_locality'] != '' && $row['address_region'] != '') ? ", " : null).escape($row['address_region'])."&nbsp;</td>\n";
+					echo "	<td class='center'>".escape($row['address_country'])."&nbsp;</td>\n";
+					echo "	<td class='button no-link'><a href=\"http://maps.google.com/maps?q=".urlencode($map_query)."&hl=en\" target=\"_blank\"><img src='resources/images/icon_gmaps.png' style='width: 21px; height: 21px; alt='".$text['label-google_map']."' title='".$text['label-google_map']."'></a></td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".escape($row['address_description'])."&nbsp;</td>\n";
+					if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+				unset($contact_addresses);
+			}
+
+			echo "</table>\n";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 3 - 3
contact_attachment_edit.php

@@ -152,7 +152,7 @@
 	require_once "resources/header.php";
 
 //show the content
-	echo "<form method='post' name='frm' enctype='multipart/form-data'>\n";
+	echo "<form method='post' name='frm' id='frm' enctype='multipart/form-data'>\n";
 
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'>";
@@ -164,8 +164,8 @@
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 86 - 91
contact_attachments.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -49,102 +49,97 @@
 	$contact_attachments = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//styles and attachment layer
-	echo "<style>\n";
-	echo "	#contact_attachment_layer {\n";
-	echo "		z-index: 999999;\n";
-	echo "		position: absolute;\n";
-	echo "		left: 0px;\n";
-	echo "		top: 0px;\n";
-	echo "		right: 0px;\n";
-	echo "		bottom: 0px;\n";
-	echo "		text-align: center;\n";
-	echo "		vertical-align: middle;\n";
-	echo "	}\n";
-	echo "</style>\n";
-	echo "<div id='contact_attachment_layer' style='display: none;'></div>\n";
-
-//script
-	echo "<script>\n";
-	echo "	function display_attachment(id) {\n";
-	echo "		$('#contact_attachment_layer').load('contact_attachment.php?id=' + id + '&action=display', function(){\n";
-	echo "			$('#contact_attachment_layer').fadeIn(200);\n";
-	echo "		});\n";
-	echo "	}\n";
-	echo "</script>\n";
-
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-attachments']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_attachment_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_attachment_edit.php?contact_uuid='.urlencode($_GET['id'])]);
-	}
-	if (permission_exists('contact_attachment_delete') && $contact_attachments) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
-
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_attachment_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_attachments' name='checkbox_all' onclick=\"list_all_toggle('attachments');\" ".($contact_attachments ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th class='pct-15'>".$text['label-type']."</th>\n";
-	echo "<th>".$text['label-attachment_filename']."</th>\n";
-	echo "<th>".$text['label-attachment_size']."</th>\n";
-	echo "<th>".$text['label-tools']."</th>\n";
-	echo "<th class='hide-md-dn'>".$text['label-attachment_description']."</th>\n";
-	if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
-
+//show if exists
 	if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
-		$x = 0;
-		foreach ($contact_attachments as $row) {
-			$attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION));
-			$attachment_type_label = $attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png' ? $text['label-image'] : $text['label-file'];
-			if (permission_exists('contact_attachment_edit')) {
-				$list_row_url = "contact_attachment_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_attachment_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+
+		//styles and attachment layer
+			echo "<style>\n";
+			echo "	#contact_attachment_layer {\n";
+			echo "		z-index: 999999;\n";
+			echo "		position: absolute;\n";
+			echo "		left: 0px;\n";
+			echo "		top: 0px;\n";
+			echo "		right: 0px;\n";
+			echo "		bottom: 0px;\n";
+			echo "		text-align: center;\n";
+			echo "		vertical-align: middle;\n";
+			echo "	}\n";
+			echo "</style>\n";
+			echo "<div id='contact_attachment_layer' style='display: none;'></div>\n";
+
+		//script
+			echo "<script>\n";
+			echo "	function display_attachment(id) {\n";
+			echo "		$('#contact_attachment_layer').load('contact_attachment.php?id=' + id + '&action=display', function(){\n";
+			echo "			$('#contact_attachment_layer').fadeIn(200);\n";
+			echo "		});\n";
+			echo "	}\n";
+			echo "</script>\n";
+
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-attachments']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
+
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_attachment_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_attachments[$x][checked]' id='checkbox_".$x."' class='checkbox_attachments' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_attachments').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_attachments[$x][uuid]' value='".escape($row['contact_attachment_uuid'])."' />\n";
-				echo "	</td>\n";
-			}
-			echo "	<td>".$attachment_type_label." ".($row['attachment_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
-			echo "	<td><a href='".$list_row_url."'>".escape($row['attachment_filename'])."</a></td>\n";
-			echo "	<td>".strtoupper(byte_convert($row['attachment_size']))."</td>\n";
-			echo "	<td class='no-link' style='cursor: pointer;'>";
-			if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') {
-				echo button::create(['type'=>'button','class'=>'link','label'=>$text['button-view'],'onclick'=>"display_attachment('".escape($row['contact_attachment_uuid'])."');"]);
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_attachments' name='checkbox_all' onclick=\"edit_all_toggle('attachments');\" ".($contact_attachments ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			else {
-				echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-download'],'onclick'=>"window.location='contact_attachment.php?id=".urlencode($row['contact_attachment_uuid'])."&action=download';"]);
-			}
-			echo "	</td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".escape($row['attachment_description'])."</td>\n";
+			echo "<th class='pct-15'>".$text['label-type']."</th>\n";
+			echo "<th>".$text['label-attachment_filename']."</th>\n";
+			echo "<th>".$text['label-attachment_size']."</th>\n";
+			echo "<th>".$text['label-tools']."</th>\n";
+			echo "<th class='hide-md-dn'>".$text['label-attachment_description']."</th>\n";
 			if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-	}
-	unset($contact_attachments);
 
-	echo "</table>";
-	echo "<br />\n";
+			if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
+				$x = 0;
+				foreach ($contact_attachments as $row) {
+					$attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION));
+					$attachment_type_label = $attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png' ? $text['label-image'] : $text['label-file'];
+					if (permission_exists('contact_attachment_edit')) {
+						$list_row_url = "contact_attachment_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_attachment_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_attachment_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_attachments[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_attachments' value='true' onclick=\"edit_delete_action('attachments');\">\n";
+						echo "		<input type='hidden' name='contact_attachments[$x][uuid]' value='".escape($row['contact_attachment_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td>".$attachment_type_label." ".($row['attachment_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
+					echo "	<td><a href='".$list_row_url."'>".escape($row['attachment_filename'])."</a></td>\n";
+					echo "	<td>".strtoupper(byte_convert($row['attachment_size']))."</td>\n";
+					echo "	<td class='no-link' style='cursor: pointer;'>";
+					if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') {
+						echo button::create(['type'=>'button','class'=>'link','label'=>$text['button-view'],'onclick'=>"display_attachment('".escape($row['contact_attachment_uuid'])."');"]);
+					}
+					else {
+						echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-download'],'onclick'=>"window.location='contact_attachment.php?id=".urlencode($row['contact_attachment_uuid'])."&action=download';"]);
+					}
+					echo "	</td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".escape($row['attachment_description'])."</td>\n";
+					if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+			}
+			unset($contact_attachments);
+
+			echo "</table>";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 0 - 100
contact_delete.php

@@ -1,100 +0,0 @@
-<?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 <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2015
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-*/
-require_once "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-if (permission_exists('contact_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();
-
-	$contact_uuid = $_GET["id"];
-}
-
-if (is_uuid($contact_uuid)) {
-
-	//specify tables
-		$tables[] = 'contact_addresses';
-		$tables[] = 'contact_attachments';
-		$tables[] = 'contact_emails';
-		$tables[] = 'contact_groups';
-		$tables[] = 'contact_notes';
-		$tables[] = 'contact_phones';
-		$tables[] = 'contact_relations';
-		$tables[] = 'contact_settings';
-		$tables[] = 'contact_times';
-		$tables[] = 'contact_urls';
-		$tables[] = 'contact_users';
-		$tables[] = 'contacts';
-
-	//create array from tables
-		foreach ($tables as $table) {
-			$array[$table][0]['contact_uuid'] = $contact_uuid;
-			$array[$table][0]['domain_uuid'] = $_SESSION['domain_uuid'];
-		}
-
-	//include reciprocal relationships
-		$array['contact_relations'][1]['relation_contact_uuid'] = $contact_uuid;
-		$array['contact_relations'][1]['domain_uuid'] = $_SESSION['domain_uuid'];
-
-	//grant temp permissions
-		$p = new permissions;
-		$database = new database;
-		foreach ($tables as $table) {
-			$p->add($database->singular($table).'_delete', 'temp');
-		}
-
-	//execute
-		$database = new database;
-		$database->app_name = 'contacts';
-		$database->app_uuid = '04481e0e-a478-c559-adad-52bd4174574c';
-		$database->delete($array);
-		unset($array);
-
-	//revoke temp permissions
-		foreach ($tables as $table) {
-			$p->delete($database->singular($table).'_delete', 'temp');
-		}
-
-	//set message
-		message::add($text['message-delete']);
-}
-
-if (!$included) {
-	header("Location: contacts.php");
-	exit;
-}
-
-?>

+ 3 - 3
contact_email_edit.php

@@ -209,7 +209,7 @@ if (is_uuid($_GET["contact_uuid"])) {
 	echo "</script>";
 
 //show the content
-	echo "<form method='post' name='frm'>\n";
+	echo "<form method='post' name='frm' id='frm'>\n";
 
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'>";
@@ -221,8 +221,8 @@ if (is_uuid($_GET["contact_uuid"])) {
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 48 - 53
contact_emails.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -49,65 +49,60 @@
 	$contact_emails = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-emails']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_email_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_email_edit.php?contact_uuid='.urlencode($_GET['id'])]);
-	}
-	if (permission_exists('contact_email_delete') && $contact_emails) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
+//show if exists
+	if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
 
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_email_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_emails' name='checkbox_all' onclick=\"list_all_toggle('emails');\" ".($contact_emails ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th class='pct-15'>".$text['label-email_label']."</th>\n";
-	echo "<th>".$text['label-email_address']."</th>\n";
-	echo "<th class='hide-md-dn'>".$text['label-email_description']."</th>\n";
-	if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-emails']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
 
-	if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
-		$x = 0;
-		foreach ($contact_emails as $row) {
-			if (permission_exists('contact_email_edit')) {
-				$list_row_url = "contact_email_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_email_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_email_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_emails[$x][checked]' id='checkbox_".$x."' class='checkbox_emails' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_emails').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_emails[$x][uuid]' value='".escape($row['contact_email_uuid'])."' />\n";
-				echo "	</td>\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_emails' name='checkbox_all' onclick=\"edit_all_toggle('emails');\" ".($contact_emails ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			echo "	<td>".escape($row['email_label'])." ".($row['email_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
-			echo "	<td class='no-link'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a>&nbsp;</td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".escape($row['email_description'])."&nbsp;</td>\n";
+			echo "<th class='pct-15'>".$text['label-email_label']."</th>\n";
+			echo "<th>".$text['label-email_address']."</th>\n";
+			echo "<th class='hide-md-dn'>".$text['label-email_description']."</th>\n";
 			if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-	}
-	unset($contact_emails);
 
-	echo "</table>";
-	echo "<br />\n";
+			if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
+				$x = 0;
+				foreach ($contact_emails as $row) {
+					if (permission_exists('contact_email_edit')) {
+						$list_row_url = "contact_email_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_email_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_email_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_emails[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_emails' value='true' onclick=\"edit_delete_action('emails');\">\n";
+						echo "		<input type='hidden' name='contact_emails[$x][uuid]' value='".escape($row['contact_email_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td>".escape($row['email_label'])." ".($row['email_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
+					echo "	<td class='no-link'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a>&nbsp;</td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".escape($row['email_description'])."&nbsp;</td>\n";
+					if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+			}
+			unset($contact_emails);
+
+			echo "</table>";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 46 - 48
contact_extensions.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -52,58 +52,56 @@
 	$contact_extensions = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-contact_extensions']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_url_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>PROJECT_PATH.'/app/extensions/extension_edit.php']);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
+//show if exists
+	if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
 
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	echo "<th>".$text['label-extension']."</th>\n";
-	echo "<th class='center'>".$text['label-enabled']."</th>\n";
-	echo "<th class='hide-md-dn'>".$text['label-description']."</th>\n";
-	if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-contact_extensions']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
 
-	if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
-		$x = 0;
-		foreach ($contact_extensions as $row) {
-			if (permission_exists('extension_edit')) {
-				$list_row_url = PROJECT_PATH.'/app/extensions/extension_edit.php?id='.urlencode($row['extension_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."' ".($row['url_primary'] ? "style='font-weight: bold;'" : null).">\n";
-			echo "	<td>";
-			if (permission_exists('extension_edit')) {
-				echo 	"<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".urlencode($row['extension_uuid'])."'>".escape($row['extension'])."</a>";
-			}
-			else {
-				echo $row['extension'];
-			}
-			echo "	</td>\n";
-			echo "	<td class='center'>".$text['label-'.escape($row['enabled'])]."&nbsp;</td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".$row['description']."&nbsp;</td>\n";
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
+			echo "<th>".$text['label-extension']."</th>\n";
+			echo "<th class='center'>".$text['label-enabled']."</th>\n";
+			echo "<th class='hide-md-dn'>".$text['label-description']."</th>\n";
 			if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-	}
-	unset($contact_extensions);
 
-	echo "</table>";
-	echo "<br />\n";
+			if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
+				$x = 0;
+				foreach ($contact_extensions as $row) {
+					if (permission_exists('extension_edit')) {
+						$list_row_url = PROJECT_PATH.'/app/extensions/extension_edit.php?id='.urlencode($row['extension_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."' ".($row['url_primary'] ? "style='font-weight: bold;'" : null).">\n";
+					echo "	<td>";
+					if (permission_exists('extension_edit')) {
+						echo 	"<a href='".PROJECT_PATH."/app/extensions/extension_edit.php?id=".urlencode($row['extension_uuid'])."'>".escape($row['extension'])."</a>";
+					}
+					else {
+						echo $row['extension'];
+					}
+					echo "	</td>\n";
+					echo "	<td class='center'>".$text['label-'.escape($row['enabled'])]."&nbsp;</td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".$row['description']."&nbsp;</td>\n";
+					if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+			}
+			unset($contact_extensions);
+
+			echo "</table>";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 0 - 67
contact_group_delete.php

@@ -1,67 +0,0 @@
-<?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 <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2015
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-*/
-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();
-
-		$contact_uuid = $_REQUEST["contact_uuid"];
-		$contact_group_uuid = $_REQUEST["id"];
-	}
-
-//delete the group
-	if (is_uuid($contact_uuid) && is_uuid($contact_group_uuid)) {
-		$array['contact_groups'][0]['contact_uuid'] = $contact_uuid;
-		$array['contact_groups'][0]['contact_group_uuid'] = $contact_group_uuid;
-
-		$database = new database;
-		$database->app_name = 'contacts';
-		$database->app_uuid = '04481e0e-a478-c559-adad-52bd4174574c';
-		$database->delete($array);
-		unset($array);
-
-		message::add($text['message-delete']);
-	}
-
-//redirect
-	if (!$included) {
-		header("Location: contact_edit.php?id=".$contact_uuid);
-		exit;
-	}
-
-?>

+ 6 - 6
contact_import.php

@@ -161,8 +161,8 @@
 			echo "<div class='action_bar' id='action_bar'>\n";
 			echo "	<div class='heading'><b>".$text['header-contacts_import']."</b></div>\n";
 			echo "	<div class='actions'>\n";
-			echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_import.php']);
-			echo button::create(['type'=>'submit','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import']]);
+			echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_import.php']);
+			echo button::create(['type'=>'submit','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'id'=>'btn_save']);
 			echo "	</div>\n";
 			echo "	<div style='clear: both;'></div>\n";
 			echo "</div>\n";
@@ -390,8 +390,8 @@
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'><b>".$text['header-contacts_import']."</b></div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contacts.php']);
-	echo button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>$_SESSION['theme']['button_icon_upload']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contacts.php']);
+	echo button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>$_SESSION['theme']['button_icon_upload'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";
@@ -418,7 +418,7 @@
 	echo "</td>\n";
 	echo "<td class='vtable' align='left'>\n";
 	echo "		<select class='formfld' name='from_row'>\n";
-	$i=1;
+	$i=2;
 	while($i<=99) {
 		$selected = ($i == $from_row) ? "selected" : null;
 		echo "			<option value='$i' ".$selected.">$i</option>\n";
@@ -485,4 +485,4 @@
 //include the footer
 	require_once "resources/footer.php";
 
-?>
+?>

+ 37 - 20
contact_import_google.php

@@ -17,25 +17,28 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2013
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
 	Mark J Crane <[email protected]>
 */
-require_once "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-require_once "resources/functions/google_get_groups.php";
-require_once "resources/functions/google_get_contacts.php";
-
-if (permission_exists('contact_add')) {
-	//access granted
-}
-else {
-	echo "access denied";
-	exit;
-}
+
+//includes
+	require_once "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/functions/google_get_groups.php";
+	require_once "resources/functions/google_get_contacts.php";
+
+//check permissions
+	if (permission_exists('contact_add')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
 
 //add multi-lingual support
 	$language = new text;
@@ -99,11 +102,25 @@ if ($_POST['a'] == 'import') {
 			}
 			//replace contact (delete before inserts below)
 			else if ($duplicate_exists && $_POST['import_duplicates'] == 'replace') {
-				$contact_uuid = $duplicate_contact_uuid;
-				$included = true;
-				require_once "contact_delete.php";
-				unset($contact_uuid, $duplicate_contact_uuid);
-				$contacts_replaced++;
+				//build array
+					$array[0]['checked'] = 'true';
+					$array[0]['uuid'] = $duplicate_contact_uuid;
+					unset($duplicate_contact_uuid);
+
+				//grant temporary permissions
+					$p = new permissions;
+					$p->add('contact_delete', 'temp');
+
+				//delete duplicate contact
+					$obj = new contacts;
+					$obj->delete($array);
+					unset($array);
+
+				//revoke temporary permissions
+					$p->delete('contact_delete', 'temp');
+
+				//increase counter
+					$contacts_replaced++;
 			}
 
 			//extract contact record from array using contact id
@@ -587,4 +604,4 @@ function curl_file_get_contents($url) {
 	curl_close($curl);
 	return $contents;
 }
-?>
+?>

+ 2 - 2
contact_note_edit.php

@@ -195,8 +195,8 @@
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 47 - 57
contact_notes.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -54,70 +54,60 @@
 	$contact_notes = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-contact_notes']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_note_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_note_edit.php?contact_uuid='.urlencode($contact_uuid)]);
-	}
-	if (permission_exists('contact_note_delete') && $contact_notes) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
-
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_note_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_notes' name='checkbox_all' onclick=\"list_all_toggle('notes');\" ".($contact_notes ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th>".$text['label-note_content']."</th>\n";
-	echo "<th class='shrink'>".$text['label-note_user']."</th>\n";
-	if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
+//show if exists
+	if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
 
-// 	echo "<div id='contact_notes' style='width: 100%; overflow: auto; direction: rtl; text-align: right; margin-bottom: 23px;'>";
-// 	echo "<table class='tr_hover' style='width: 100%; direction: ltr; padding-left: 1px' border='0' cellpadding='0' cellspacing='0'>\n";
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-contact_notes']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
 
-	if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
-		foreach ($contact_notes as $row) {
-			$contact_note = $row['contact_note'];
-			$contact_note = escape($contact_note);
-			$contact_note = str_replace("\n","<br />",$contact_note);
-			if (permission_exists('contact_note_add')) {
-				$list_row_url = "contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_note_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_notes[$x][checked]' id='checkbox_".$x."' class='checkbox_notes' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_notes').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_notes[$x][uuid]' value='".escape($row['contact_note_uuid'])."' />\n";
-				echo "	</td>\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_notes' name='checkbox_all' onclick=\"edit_all_toggle('notes');\" ".($contact_notes ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			echo "	<td class='overflow'>".$contact_note."</td>\n";
-			echo "	<td class='description no-wrap'><strong>".escape($row['last_mod_user'])."</strong>: ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."</td>\n";
+			echo "<th>".$text['label-note_content']."</th>\n";
+			echo "<th class='shrink'>".$text['label-note_user']."</th>\n";
 			if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-	}
-	unset($contact_notes);
 
-	echo "</table>";
-	echo "<br />\n";
+			if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
+				foreach ($contact_notes as $row) {
+					$contact_note = $row['contact_note'];
+					$contact_note = escape($contact_note);
+					$contact_note = str_replace("\n","<br />",$contact_note);
+					if (permission_exists('contact_note_add')) {
+						$list_row_url = "contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_note_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_notes[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_notes' value='true' onclick=\"edit_delete_action('notes');\">\n";
+						echo "		<input type='hidden' name='contact_notes[$x][uuid]' value='".escape($row['contact_note_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td class='overflow'>".$contact_note."</td>\n";
+					echo "	<td class='description no-wrap'><strong>".escape($row['last_mod_user'])."</strong>: ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."</td>\n";
+					if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+			}
+			unset($contact_notes);
 
-// 	echo "<script>if (document.getElementById('contact_notes').offsetHeight > 200) { document.getElementById('contact_notes').style.height = 200; }</script>\n";
+			echo "</table>";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 3 - 3
contact_phone_edit.php

@@ -235,7 +235,7 @@
 	echo "</script>";
 
 //show the content
-	echo "<form method='post' name='frm'>\n";
+	echo "<form method='post' name='frm' id='frm'>\n";
 
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'>";
@@ -247,8 +247,8 @@
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 86 - 91
contact_phones.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2019
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -49,102 +49,97 @@
 	$contact_phones = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//javascript function: send_cmd
-	echo "<script type=\"text/javascript\">\n";
-	echo "function send_cmd(url) {\n";
-	echo "	if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari\n";
-	echo "		xmlhttp=new XMLHttpRequest();\n";
-	echo "	}\n";
-	echo "	else {// code for IE6, IE5\n";
-	echo "		xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
-	echo "	}\n";
-	echo "	xmlhttp.open(\"GET\",url,true);\n";
-	echo "	xmlhttp.send(null);\n";
-	echo "	document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;\n";
-	echo "}\n";
-	echo "</script>\n";
-
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-phone_numbers']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_phone_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_phone_edit.php?contact_uuid='.urlencode($_GET['id'])]);
-	}
-	if (permission_exists('contact_phone_delete') && $contact_phones) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
-
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_phone_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_phones' name='checkbox_all' onclick=\"list_all_toggle('phones');\" ".($contact_phones ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th class='pct-15'>".$text['label-phone_label']."</th>\n";
-	echo "<th>".$text['label-phone_number']."</th>\n";
-	echo "<th>".$text['label-phone_type']."</th>\n";
-	echo "<th>".$text['label-phone_tools']."</th>\n";
-	echo "<th class='hide-md-dn'>".$text['label-phone_description']."</th>\n";
-	if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
-
+//show if exists
 	if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
-		$x = 0;
-		foreach ($contact_phones as $row) {
-			if (permission_exists('contact_phone_edit')) {
-				$list_row_url = "contact_phone_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_phone_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+
+		//javascript function: send_cmd
+			echo "<script type=\"text/javascript\">\n";
+			echo "function send_cmd(url) {\n";
+			echo "	if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari\n";
+			echo "		xmlhttp=new XMLHttpRequest();\n";
+			echo "	}\n";
+			echo "	else {// code for IE6, IE5\n";
+			echo "		xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
+			echo "	}\n";
+			echo "	xmlhttp.open(\"GET\",url,true);\n";
+			echo "	xmlhttp.send(null);\n";
+			echo "	document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;\n";
+			echo "}\n";
+			echo "</script>\n";
+
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-phone_numbers']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
+
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_phone_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_phones[$x][checked]' id='checkbox_".$x."' class='checkbox_phones' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_phones').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_phones[$x][uuid]' value='".escape($row['contact_phone_uuid'])."' />\n";
-				echo "	</td>\n";
-			}
-			echo "	<td>".($row['phone_label'] == strtolower($row['phone_label']) ? ucwords($row['phone_label']) : $row['phone_label'])." ".($row['phone_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
-			echo "	<td class='no-link'>\n";
-			echo button::create(['type'=>'button','class'=>'link','label'=>escape(format_phone($row['phone_number'])),'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
-			echo "	</td>\n";
-			echo "	<td class='no-wrap'>\n";
-			if ($row['phone_type_voice']) { $phone_types[] = "<i class='fas fa-phone fa-fw' style='margin-right: 3px;' title=\"".$text['label-voice']."\"></i>"; }
-			if ($row['phone_type_fax']) { $phone_types[] = "<i class='fas fa-fax fa-fw' style='margin-right: 3px;' title=\"".$text['label-fax']."\"></i>"; }
-			if ($row['phone_type_video']) { $phone_types[] = "<i class='fas fa-video fa-fw' style='margin-right: 3px;' title=\"".$text['label-video']."\"></i>"; }
-			if ($row['phone_type_text']) { $phone_types[] = "<i class='fas fa-sms fa-fw' style='margin-right: 3px;' title=\"".$text['label-text']."\"></i>"; }
-			if (is_array($phone_types)) {
-				echo "	".implode(" ", $phone_types)."\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_phones' name='checkbox_all' onclick=\"edit_all_toggle('phones');\" ".($contact_phones ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			unset($phone_types);
-			echo "	</td>\n";
-			echo "	<td class='no-link no-wrap'>\n";
-			echo "		<a href='../xml_cdr/xml_cdr.php?caller_id_number=".urlencode($row['phone_number'])."'>".$text['button-cdr']."</a>";
-			if ($row['phone_type_voice']) {
-				echo "&nbsp;<span class='hide-sm-dn'>\n";
-				echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-phone_call'],'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
-				echo "</span>";
-			}
-			echo "	</td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".escape($row['phone_description'])."&nbsp;</td>\n";
+			echo "<th class='pct-15'>".$text['label-phone_label']."</th>\n";
+			echo "<th>".$text['label-phone_number']."</th>\n";
+			echo "<th>".$text['label-phone_type']."</th>\n";
+			echo "<th>".$text['label-phone_tools']."</th>\n";
+			echo "<th class='hide-md-dn'>".$text['label-phone_description']."</th>\n";
 			if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-		unset($contact_phones);
-	}
 
-	echo "</table>\n";
-	echo "<br />\n";
+			if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
+				$x = 0;
+				foreach ($contact_phones as $row) {
+					if (permission_exists('contact_phone_edit')) {
+						$list_row_url = "contact_phone_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_phone_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_phone_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_phones[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_phones' value='true' onclick=\"edit_delete_action('phones');\">\n";
+						echo "		<input type='hidden' name='contact_phones[$x][uuid]' value='".escape($row['contact_phone_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td>".($row['phone_label'] == strtolower($row['phone_label']) ? ucwords($row['phone_label']) : $row['phone_label'])." ".($row['phone_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
+					echo "	<td class='no-link'>\n";
+					echo button::create(['type'=>'button','class'=>'link','label'=>escape(format_phone($row['phone_number'])),'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
+					echo "	</td>\n";
+					echo "	<td class='no-wrap'>\n";
+					if ($row['phone_type_voice']) { $phone_types[] = "<i class='fas fa-phone fa-fw' style='margin-right: 3px;' title=\"".$text['label-voice']."\"></i>"; }
+					if ($row['phone_type_fax']) { $phone_types[] = "<i class='fas fa-fax fa-fw' style='margin-right: 3px;' title=\"".$text['label-fax']."\"></i>"; }
+					if ($row['phone_type_video']) { $phone_types[] = "<i class='fas fa-video fa-fw' style='margin-right: 3px;' title=\"".$text['label-video']."\"></i>"; }
+					if ($row['phone_type_text']) { $phone_types[] = "<i class='fas fa-sms fa-fw' style='margin-right: 3px;' title=\"".$text['label-text']."\"></i>"; }
+					if (is_array($phone_types)) {
+						echo "	".implode(" ", $phone_types)."\n";
+					}
+					unset($phone_types);
+					echo "	</td>\n";
+					echo "	<td class='no-link no-wrap'>\n";
+					echo "		<a href='../xml_cdr/xml_cdr.php?caller_id_number=".urlencode($row['phone_number'])."'>".$text['button-cdr']."</a>";
+					if ($row['phone_type_voice']) {
+						echo "&nbsp;<span class='hide-sm-dn'>\n";
+						echo button::create(['type'=>'button','class'=>'link','label'=>$text['label-phone_call'],'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
+						echo "</span>";
+					}
+					echo "	</td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".escape($row['phone_description'])."&nbsp;</td>\n";
+					if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+				unset($contact_phones);
+			}
+
+			echo "</table>\n";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 2 - 2
contact_relation_edit.php

@@ -209,8 +209,8 @@
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'><b>".$text['header-contact_relation']."</b></div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 47 - 52
contact_relations.php

@@ -63,65 +63,60 @@
 	$contact_relations = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['header-contact_relations']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_relation_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_relation_edit.php?contact_uuid='.urlencode($contact_uuid)]);
-	}
-	if (permission_exists('contact_relation_delete') && $contact_relations) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
+//show if exists
+	if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
 
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_relation_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_relations' name='checkbox_all' onclick=\"list_all_toggle('relations');\" ".($contact_relations ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th>".$text['label-contact_relation_label']."</th>\n";
-	echo "<th>".$text['label-contact_relation_organization']."</th>\n";
-	echo "<th>".$text['label-contact_relation_name']."</th>\n";
-	if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['header-contact_relations']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
 
-	if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
-		$x = 0;
-		foreach ($contact_relations as $row) {
-			if (permission_exists('contact_relation_edit')) {
-				$list_row_url = "contact_relation_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_relation_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_relation_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_relations[$x][checked]' id='checkbox_".$x."' class='checkbox_relations' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_relations').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_relations[$x][uuid]' value='".escape($row['contact_relation_uuid'])."' />\n";
-				echo "	</td>\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_relations' name='checkbox_all' onclick=\"edit_all_toggle('relations');\" ".($contact_relations ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			echo "	<td>".escape($row['relation_label'])."&nbsp;</td>\n";
-			echo "	<td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_organization'])."</a>&nbsp;</td>\n";
-			echo "	<td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_name_given']).(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).escape($row['contact_name_family'])."</a>&nbsp;</td>\n";
+			echo "<th>".$text['label-contact_relation_label']."</th>\n";
+			echo "<th>".$text['label-contact_relation_organization']."</th>\n";
+			echo "<th>".$text['label-contact_relation_name']."</th>\n";
 			if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-		unset($contact_relations);
-	}
 
-	echo "</table>";
-	echo "<br />\n";
+			if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
+				$x = 0;
+				foreach ($contact_relations as $row) {
+					if (permission_exists('contact_relation_edit')) {
+						$list_row_url = "contact_relation_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_relation_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_relation_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_relations[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_relations' value='true' onclick=\"edit_delete_action('relations');\">\n";
+						echo "		<input type='hidden' name='contact_relations[$x][uuid]' value='".escape($row['contact_relation_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td>".escape($row['relation_label'])."&nbsp;</td>\n";
+					echo "	<td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_organization'])."</a>&nbsp;</td>\n";
+					echo "	<td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_name_given']).(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).escape($row['contact_name_family'])."</a>&nbsp;</td>\n";
+					if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+				unset($contact_relations);
+			}
+
+			echo "</table>";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 2 - 2
contact_setting_edit.php

@@ -220,8 +220,8 @@
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 67 - 72
contact_settings.php

@@ -17,7 +17,7 @@
 
  The Initial Developer of the Original Code is
  Mark J Crane <[email protected]>
- Portions created by the Initial Developer are Copyright (C) 2008-2018
+ Portions created by the Initial Developer are Copyright (C) 2008-2020
  the Initial Developer. All Rights Reserved.
 
  Contributor(s):
@@ -53,84 +53,79 @@
 	$contact_settings = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-contact_settings']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_setting_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_setting_edit.php?contact_uuid='.urlencode($contact_uuid)]);
-	}
-	if (permission_exists('contact_setting_delete') && $contact_settings) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
+//show if exists
+	if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
 
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_setting_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_settings' name='checkbox_all' onclick=\"list_all_toggle('settings');\" ".($contact_settings ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th class='pct-15'>".$text['label-contact_setting_category']."</th>";
-	echo "<th>".$text['label-contact_setting_subcategory']."</th>";
-	echo "<th>".$text['label-contact_setting_type']."</th>";
-	echo "<th>".$text['label-contact_setting_value']."</th>";
-	echo "<th class='center'>".$text['label-enabled']."</th>";
-	echo "<th class='hide-md-dn'>".$text['label-description']."</th>";
-	if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-contact_settings']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
 
-	if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
-		$x = 0;
-		foreach ($contact_settings as $row) {
-			if (permission_exists('contact_setting_edit')) {
-				$list_row_url = "contact_setting_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_setting_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_setting_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_settings[$x][checked]' id='checkbox_".$x."' class='checkbox_settings' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_settings').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_settings[$x][uuid]' value='".escape($row['contact_setting_uuid'])."' />\n";
-				echo "	</td>\n";
-			}
-			echo "	<td>".escape($row['contact_setting_category'])."&nbsp;</td>\n";
-			echo "	<td><a href='".$list_row_url."'>".escape($row['contact_setting_subcategory'])."</a></td>\n";
-			echo "	<td>".escape($row['contact_setting_name'])."&nbsp;</td>\n";
-			echo "	<td>\n";
-			$category = escape($row['contact_setting_category']);
-			$subcategory = escape($row['contact_setting_subcategory']);
-			$name = escape($row['contact_setting_name']);
-			if ($category == "callingcard" && $subcategory == "username" && $name == "var" ) {
-				echo "		********\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_settings' name='checkbox_all' onclick=\"edit_all_toggle('settings');\" ".($contact_settings ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			else if ($category == "callingcard" && $subcategory == "password" && $name == "var" ) {
-				echo "		********\n";
-			}
-			else {
-				echo escape($row['contact_setting_value']);
-			}
-			echo "	</td>\n";
-			echo "	<td class='center'>".$text['label-'.escape($row['contact_setting_enabled'])]."&nbsp;</td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".$row['contact_setting_description']."&nbsp;</td>\n";
+			echo "<th class='pct-15'>".$text['label-contact_setting_category']."</th>";
+			echo "<th>".$text['label-contact_setting_subcategory']."</th>";
+			echo "<th>".$text['label-contact_setting_type']."</th>";
+			echo "<th>".$text['label-contact_setting_value']."</th>";
+			echo "<th class='center'>".$text['label-enabled']."</th>";
+			echo "<th class='hide-md-dn'>".$text['label-description']."</th>";
 			if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-		unset($contact_settings);
-	}
 
-	echo "</table>";
-	echo "<br />\n";
+			if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
+				$x = 0;
+				foreach ($contact_settings as $row) {
+					if (permission_exists('contact_setting_edit')) {
+						$list_row_url = "contact_setting_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_setting_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_setting_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_settings[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_settings' value='true' onclick=\"edit_delete_action('settings');\">\n";
+						echo "		<input type='hidden' name='contact_settings[$x][uuid]' value='".escape($row['contact_setting_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td>".escape($row['contact_setting_category'])."&nbsp;</td>\n";
+					echo "	<td><a href='".$list_row_url."'>".escape($row['contact_setting_subcategory'])."</a></td>\n";
+					echo "	<td>".escape($row['contact_setting_name'])."&nbsp;</td>\n";
+					echo "	<td>\n";
+					$category = escape($row['contact_setting_category']);
+					$subcategory = escape($row['contact_setting_subcategory']);
+					$name = escape($row['contact_setting_name']);
+					if ($category == "callingcard" && $subcategory == "username" && $name == "var" ) {
+						echo "		********\n";
+					}
+					else if ($category == "callingcard" && $subcategory == "password" && $name == "var" ) {
+						echo "		********\n";
+					}
+					else {
+						echo escape($row['contact_setting_value']);
+					}
+					echo "	</td>\n";
+					echo "	<td class='center'>".$text['label-'.escape($row['contact_setting_enabled'])]."&nbsp;</td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".$row['contact_setting_description']."&nbsp;</td>\n";
+					if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+				unset($contact_settings);
+			}
+
+			echo "</table>";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 2 - 2
contact_time_edit.php

@@ -196,8 +196,8 @@
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 1 - 1
contact_timer.php

@@ -334,7 +334,7 @@ if (!permission_exists('contact_time_add')) { echo "access denied"; exit; }
 	<br><br>
 	<div id='ajax_reponse' class='timer_<?php echo escape($timer_state);?>'>00:00:00</div>
 	<br>
-	<form name='frm' id='frm' method='post' action=''>
+	<form name='frm' id='frm' method='post'>
 	<input type='hidden' name='domain_uuid' value="<?php echo escape($domain_uuid); ?>">
 	<input type='hidden' name='contact_time_uuid' value="<?php echo escape($contact_time_uuid); ?>">
 	<input type='hidden' name='contact_uuid' value="<?php echo escape($contact_uuid); ?>">

+ 61 - 66
contact_times.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -56,77 +56,72 @@
 	$contact_times = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['header_contact_times']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_time_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_time_edit.php?contact_uuid='.urlencode($contact_uuid)]);
-	}
-	if (permission_exists('contact_time_delete') && $contact_times) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
-
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_time_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_times' name='checkbox_all' onclick=\"list_all_toggle('times');\" ".($contact_times ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th class='pct-20'>".$text['label-time_user']."</th>\n";
-	echo "<th class='pct-20'>".$text['label-time_start']."</th>\n";
-	echo "<th class='pct-20'>".$text['label-time_duration']."</th>\n";
-	echo "<th class='pct-40 hide-md-dn'>".$text['label-time_description']."</th>\n";
-	if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
-
+//show if exists
 	if (is_array($contact_times) && @sizeof($contact_times) != 0) {
-		$x = 0;
-		foreach ($contact_times as $row) {
-			if ($row["time_start"] != '' && $row['time_stop'] != '') {
-				$time_start = strtotime($row["time_start"]);
-				$time_stop = strtotime($row['time_stop']);
-				$time = gmdate("H:i:s", ($time_stop - $time_start));
-			}
-			else {
-				unset($time);
-			}
-			$tmp = explode(' ', $row['time_start']);
-			$time_start = $tmp[0];
-			if (permission_exists('contact_time_edit')) {
-				$list_row_url = "contact_time_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_time_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['header_contact_times']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
+
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_time_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_times[$x][checked]' id='checkbox_".$x."' class='checkbox_times' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_times').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_times[$x][uuid]' value='".escape($row['contact_time_uuid'])."' />\n";
-				echo "	</td>\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_times' name='checkbox_all' onclick=\"edit_all_toggle('times');\" ".($contact_times ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			echo "	<td><span ".($row['user_domain_uuid'] != $domain_uuid ? "title='".$_SESSION['domains'][escape($row['user_domain_uuid'])]['domain_name']."' style='cursor: help;'" : null).">".escape($row["username"])."</span>&nbsp;</td>\n";
-			echo "	<td>".$time_start."&nbsp;</td>\n";
-			echo "	<td>".$time."&nbsp;</td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".escape($row['time_description'])."&nbsp;</td>\n";
+			echo "<th class='pct-20'>".$text['label-time_user']."</th>\n";
+			echo "<th class='pct-20'>".$text['label-time_start']."</th>\n";
+			echo "<th class='pct-20'>".$text['label-time_duration']."</th>\n";
+			echo "<th class='pct-40 hide-md-dn'>".$text['label-time_description']."</th>\n";
 			if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-		unset($contact_times);
-	}
 
-	echo "</table>\n";
-	echo "<br />\n";
+			if (is_array($contact_times) && @sizeof($contact_times) != 0) {
+				$x = 0;
+				foreach ($contact_times as $row) {
+					if ($row["time_start"] != '' && $row['time_stop'] != '') {
+						$time_start = strtotime($row["time_start"]);
+						$time_stop = strtotime($row['time_stop']);
+						$time = gmdate("H:i:s", ($time_stop - $time_start));
+					}
+					else {
+						unset($time);
+					}
+					$tmp = explode(' ', $row['time_start']);
+					$time_start = $tmp[0];
+					if (permission_exists('contact_time_edit')) {
+						$list_row_url = "contact_time_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_time_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_time_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_times[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_times' value='true' onclick=\"edit_delete_action('times');\">\n";
+						echo "		<input type='hidden' name='contact_times[$x][uuid]' value='".escape($row['contact_time_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td><span ".($row['user_domain_uuid'] != $domain_uuid ? "title='".$_SESSION['domains'][escape($row['user_domain_uuid'])]['domain_name']."' style='cursor: help;'" : null).">".escape($row["username"])."</span>&nbsp;</td>\n";
+					echo "	<td>".$time_start."&nbsp;</td>\n";
+					echo "	<td>".$time."&nbsp;</td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".escape($row['time_description'])."&nbsp;</td>\n";
+					if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+				unset($contact_times);
+			}
+
+			echo "</table>\n";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 3 - 3
contact_url_edit.php

@@ -210,7 +210,7 @@
 	echo "</script>";
 
 //show the content
-	echo "<form method='post' name='frm'>\n";
+	echo "<form method='post' name='frm' id='frm'>\n";
 
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'>";
@@ -222,8 +222,8 @@
 	}
 	echo "	</div>\n";
 	echo "	<div class='actions'>\n";
-	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
-	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
 	echo "	</div>\n";
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";

+ 49 - 54
contact_urls.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2018
+	Portions created by the Initial Developer are Copyright (C) 2008-2020
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -54,65 +54,60 @@
 	$contact_urls = $database->select($sql, $parameters, 'all');
 	unset($sql, $parameters);
 
-//show the content
-	echo "<div class='action_bar sub shrink'>\n";
-	echo "	<div class='heading'><b>".$text['label-urls']."</b></div>\n";
-	echo "	<div class='actions'>\n";
-	/*
-	if (permission_exists('contact_url_add')) {
-		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-sm-dn','link'=>'contact_url_edit.php?contact_uuid='.urlencode($_GET['id'])]);
-	}
-	if (permission_exists('contact_url_delete') && $contact_urls) {
-		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-sm-dn','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
-	}
-	*/
-	echo "	</div>\n";
-	echo "	<div style='clear: both;'></div>\n";
-	echo "</div>\n";
-
-	echo "<table class='list'>\n";
-	echo "<tr class='list-header'>\n";
-	if (permission_exists('contact_url_delete')) {
-		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all_urls' name='checkbox_all' onclick=\"list_all_toggle('urls');\" ".($contact_urls ?: "style='visibility: hidden;'").">\n";
-		echo "	</th>\n";
-	}
-	echo "<th class='pct-15'>".$text['label-url_label']."</th>\n";
-	echo "<th>".$text['label-url_address']."</th>\n";
-	echo "<th class='hide-md-dn'>".$text['label-url_description']."</th>\n";
-	if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-		echo "	<td class='action-button'>&nbsp;</td>\n";
-	}
-	echo "</tr>\n";
-
+//show if exists
 	if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
-		$x = 0;
-		foreach ($contact_urls as $row) {
-			if (permission_exists('contact_url_edit')) {
-				$list_row_url = "contact_url_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_url_uuid']);
-			}
-			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+
+		//show the content
+			echo "<div class='action_bar sub shrink'>\n";
+			echo "	<div class='heading'><b>".$text['label-urls']."</b></div>\n";
+			echo "	<div style='clear: both;'></div>\n";
+			echo "</div>\n";
+
+			echo "<table class='list'>\n";
+			echo "<tr class='list-header'>\n";
 			if (permission_exists('contact_url_delete')) {
-				echo "	<td class='checkbox'>\n";
-				echo "		<input type='checkbox' name='contact_urls[$x][checked]' id='checkbox_".$x."' class='checkbox_urls' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all_urls').checked = false; }\">\n";
-				echo "		<input type='hidden' name='contact_urls[$x][uuid]' value='".escape($row['contact_url_uuid'])."' />\n";
-				echo "	</td>\n";
+				echo "	<th class='checkbox'>\n";
+				echo "		<input type='checkbox' id='checkbox_all_urls' name='checkbox_all' onclick=\"edit_all_toggle('urls');\" ".($contact_urls ?: "style='visibility: hidden;'").">\n";
+				echo "	</th>\n";
 			}
-			echo "	<td>".escape($row['url_label'])." ".($row['url_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
-			echo "	<td class='no-link overflow no-wrap'><a href='".escape($row['url_address'])."' target='_blank'>".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."</a></td>\n";
-			echo "	<td class='description overflow hide-md-dn'>".escape($row['url_description'])."&nbsp;</td>\n";
+			echo "<th class='pct-15'>".$text['label-url_label']."</th>\n";
+			echo "<th>".$text['label-url_address']."</th>\n";
+			echo "<th class='hide-md-dn'>".$text['label-url_description']."</th>\n";
 			if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
-				echo "	<td class='action-button'>\n";
-				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
-				echo "	</td>\n";
+				echo "	<td class='action-button'>&nbsp;</td>\n";
 			}
 			echo "</tr>\n";
-			$x++;
-		}
-	}
-	unset($contact_urls);
 
-	echo "</table>\n";
-	echo "<br />\n";
+			if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
+				$x = 0;
+				foreach ($contact_urls as $row) {
+					if (permission_exists('contact_url_edit')) {
+						$list_row_url = "contact_url_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_url_uuid']);
+					}
+					echo "<tr class='list-row' href='".$list_row_url."'>\n";
+					if (permission_exists('contact_url_delete')) {
+						echo "	<td class='checkbox'>\n";
+						echo "		<input type='checkbox' name='contact_urls[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_urls' value='true' onclick=\"edit_delete_action('urls');\">\n";
+						echo "		<input type='hidden' name='contact_urls[$x][uuid]' value='".escape($row['contact_url_uuid'])."' />\n";
+						echo "	</td>\n";
+					}
+					echo "	<td>".escape($row['url_label'])." ".($row['url_primary'] ? "&nbsp;<i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
+					echo "	<td class='no-link overflow no-wrap'><a href='".escape($row['url_address'])."' target='_blank'>".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."</a></td>\n";
+					echo "	<td class='description overflow hide-md-dn'>".escape($row['url_description'])."&nbsp;</td>\n";
+					if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+						echo "	<td class='action-button'>\n";
+						echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+						echo "	</td>\n";
+					}
+					echo "</tr>\n";
+					$x++;
+				}
+			}
+			unset($contact_urls);
+
+			echo "</table>\n";
+			echo "<br />\n";
+
+	}
 
 ?>

+ 0 - 69
contact_user_delete.php

@@ -1,69 +0,0 @@
-<?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 <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2015
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-*/
-require_once "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-if (permission_exists('contact_user_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 (is_array($_REQUEST) && @sizeof($_REQUEST) != 0) {
-			$contact_user_uuid = $_REQUEST["id"];
-			$contact_uuid = $_REQUEST["contact_uuid"];
-		}
-	}
-
-//delete the user
-	if (is_uuid($contact_uuid) && is_uuid($contact_user_uuid)) {
-		$array['contact_users'][0]['contact_user_uuid'] = $contact_user_uuid;
-		$array['contact_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
-
-		$database = new database;
-		$database->app_name = 'contacts';
-		$database->app_uuid = '04481e0e-a478-c559-adad-52bd4174574c';
-		$database->delete($array);
-		$response = $database->message;
-		unset($array);
-	}
-
-//redirect the browser
-	if (!$included) {
-		message::add($text['message-delete']);
-		header("Location: contact_edit.php?id=".$contact_uuid);
-		return;
-	}
-
-?>

+ 1 - 1
contacts_vcard.php

@@ -82,7 +82,7 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
 		$database = new database;
 		$result = $database->select($sql, $parameters, 'all');
 		if (is_array($result) && @sizeof($result) != 0) {
-			$e = 0;
+			$e = 1;
 			foreach ($result as &$row) {
 				$vcard->data['email'.$e] = $row["email_address"];
 				if ($e++ == 2) { break; } //limit to 2 rows

+ 94 - 4
resources/classes/contacts.php

@@ -179,19 +179,109 @@ if (!class_exists('contacts')) {
 
 					//delete the checked rows
 						if (is_array($array) && @sizeof($array) != 0) {
-
 							//execute delete
 								$database = new database;
 								$database->app_name = $this->app_name;
 								$database->app_uuid = $this->app_uuid;
 								$database->delete($array);
 								unset($array);
-
-							//set message
-								message::add($text['message-delete']);
 						}
 						unset($records);
 				}
+		}
+
+		public function delete_users($records) {
+			//assign private variables
+				$this->permission_prefix = 'contact_user_';
+				$this->table = 'contact_users';
+				$this->uuid_prefix = 'contact_user_';
+
+			if (permission_exists($this->permission_prefix.'delete')) {
+
+				//add multi-lingual support
+					$language = new text;
+					$text = $language->get();
+
+				//validate the token
+					$token = new token;
+					if (!$token->validate($_SERVER['PHP_SELF'])) {
+						message::add($text['message-invalid_token'],'negative');
+						header('Location: '.$this->list_page);
+						exit;
+					}
+
+				//delete multiple records
+					if (is_array($records) && @sizeof($records) != 0) {
+
+						//filter out unchecked ivr menu options, build delete array
+							$x = 0;
+							foreach ($records as $record) {
+								if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
+									$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
+									$array[$this->table][$x]['contact_uuid'] = $this->contact_uuid;
+									$x++;
+								}
+							}
+
+						//delete the checked rows
+							if (is_array($array) && @sizeof($array) != 0) {
+								//execute delete
+									$database = new database;
+									$database->app_name = $this->app_name;
+									$database->app_uuid = $this->app_uuid;
+									$database->delete($array);
+									unset($array);
+							}
+							unset($records);
+					}
+			}
+		}
+
+		public function delete_groups($records) {
+			//assign private variables
+				$this->permission_prefix = 'contact_group_';
+				$this->table = 'contact_groups';
+				$this->uuid_prefix = 'contact_group_';
+
+			if (permission_exists($this->permission_prefix.'delete')) {
+
+				//add multi-lingual support
+					$language = new text;
+					$text = $language->get();
+
+				//validate the token
+					$token = new token;
+					if (!$token->validate($_SERVER['PHP_SELF'])) {
+						message::add($text['message-invalid_token'],'negative');
+						header('Location: '.$this->list_page);
+						exit;
+					}
+
+				//delete multiple records
+					if (is_array($records) && @sizeof($records) != 0) {
+
+						//filter out unchecked ivr menu options, build delete array
+							$x = 0;
+							foreach ($records as $record) {
+								if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
+									$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
+									$array[$this->table][$x]['contact_uuid'] = $this->contact_uuid;
+									$x++;
+								}
+							}
+
+						//delete the checked rows
+							if (is_array($array) && @sizeof($array) != 0) {
+								//execute delete
+									$database = new database;
+									$database->app_name = $this->app_name;
+									$database->app_uuid = $this->app_uuid;
+									$database->delete($array);
+									unset($array);
+							}
+							unset($records);
+					}
+			}
 		} //method
 
 	} //class

部分文件因为文件数量过多而无法显示