2
0
Эх сурвалжийг харах

Move call_block so that it is available to people in a default install. Thanks gerritv for providing this feature.

Mark Crane 12 жил өмнө
parent
commit
58379a9f16

+ 0 - 102
call_block/app_config.php

@@ -1,102 +0,0 @@
-<?php
-	//application details
-		$apps[$x]['name'] = 'Call Block';
-		$apps[$x]['uuid'] = '9ed63276-e085-4897-839c-4f2e36d92d6c';
-		$apps[$x]['category'] = 'Switch';
-		$apps[$x]['subcategory'] = '';
-		$apps[$x]['version'] = '';
-		$apps[$x]['license'] = 'Mozilla Public License 1.1';
-		$apps[$x]['url'] = 'http://www.fusionpbx.com';
-		$apps[$x]['description']['en-us'] = 'A tool to block incoming numbers.';
-		$apps[$x]['description']['es-mx'] = '';
-		$apps[$x]['description']['de'] = '';
-		$apps[$x]['description']['de-ch'] = '';
-		$apps[$x]['description']['de-at'] = '';
-		$apps[$x]['description']['fr'] = '';
-		$apps[$x]['description']['fr-ca'] = '';
-		$apps[$x]['description']['fr-ch'] = '';
-		$apps[$x]['description']['pt-pt'] = '';
-		$apps[$x]['description']['pt-br'] = '';
-
-	//menu details
-		$apps[$x]['menu'][0]['title']['en-us'] = 'Call Block';
-		$apps[$x]['menu'][0]['title']['es-mx'] = '';
-		$apps[$x]['menu'][0]['title']['de'] = '';
-		$apps[$x]['menu'][0]['title']['de-ch'] = '';
-		$apps[$x]['menu'][0]['title']['de-at'] = '';
-		$apps[$x]['menu'][0]['title']['fr'] = '';
-		$apps[$x]['menu'][0]['title']['fr-ca'] = '';
-		$apps[$x]['menu'][0]['title']['fr-ch'] = '';
-		$apps[$x]['menu'][0]['title']['pt-pt'] = '';
-		$apps[$x]['menu'][0]['title']['pt-br'] = '';
-		$apps[$x]['menu'][0]['uuid'] = '29295c90-b1b9-440b-9c7E-c8363c6e8975';
-		$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
-		$apps[$x]['menu'][0]['category'] = 'internal';
-		$apps[$x]['menu'][0]['path'] = '/app/call_block/call_block.php';
-		$apps[$x]['menu'][0]['groups'][] = 'user';
-		$apps[$x]['menu'][0]['groups'][] = 'admin';
-		$apps[$x]['menu'][0]['groups'][] = 'superadmin';
-
-	//permission details
-		$y = 0;
-		$apps[$x]['permissions'][$y]['name'] = 'call_block_view';
-		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'admin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'user';
-		$y++;
-		$apps[$x]['permissions'][$y]['name'] = 'call_block_add';
-		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'admin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'user';
-		$y++;
-		$apps[$x]['permissions'][$y]['name'] = 'call_block_edit';
-		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'admin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'user';
-		$y++;
-		$apps[$x]['permissions'][$y]['name'] = 'call_block_delete';
-		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'admin';
-		$apps[$x]['permissions'][$y]['groups'][] = 'user';
-		$y++;
-	//schema details
-		$y = 0; //table array index
-		$z = 0; //field array index
-		$apps[$x]['db'][$y]['table'] = 'v_call_block';
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
-		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
-		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
-		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
-		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
-		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'blocked_caller_uuid';
-		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
-		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
-		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
-		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'blocked_caller_name';
-		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
-		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'blocked_caller_number';
-		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the full phone number.';
-		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
-		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'blocked_call_count';
-		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Number of calls.';
-		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'blocked_call_action';
-		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Action for call.';
-		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'date_added';
-		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Date/Time number was added.';
-		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'block_call_enabled';
-		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enable/disable blocking the call.';
-		$z++;
-?>

+ 0 - 105
call_block/app_languages.php

@@ -1,105 +0,0 @@
-<?php
-// call_block.php
-	$text['title-call-block']['en-us'] = 'Call Block';
-	$text['title-call-block']['pt-pt'] = '';
-
-	$text['description-call-block']['en-us'] = 'A list of numbers from which to block calls.';
-	$text['description-call-block']['pt-pt'] = '';
-
-	$text['label-number']['en-us'] = 'Number';
-	$text['label-number']['pt-pt'] = '';
-
-	$text['label-name']['en-us'] = 'Name';
-	$text['label-name']['pt-pt'] = '';
-
-	$text['label-Count']['en-us'] = 'Count';
-	$text['label-Count']['pt-pt'] = '';
-
-	$text['label-date-added']['en-us'] = 'Date Added';
-	$text['label-date-added']['pt-pt'] = '';
-
-	$text['label-action']['en-us'] = 'Action';
-	$text['label-action']['pt-pt'] = '';
-
-	$text['label-enabled']['en-us'] = 'Enabled';
-	$text['label-enabled']['pt-pt'] = '';
-
-	$text['button-edit']['en-us'] = 'Edit';
-	$text['button-edit']['pt-pt'] = '';
-
-	$text['button-delete']['en-us'] = 'Delete';
-	$text['button-delete']['pt-pt'] = '';
-
-	$text['button-add']['en-us'] = 'Add';
-	$text['button-add']['pt-pt'] = '';
-
-	$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
-	$text['confirm-delete']['pt-pt'] = '';
-
-	// call_block_cdr_add.php
-	$text['label-add-complete']['en-us'] = 'Add Complete';
-	$text['label-add-complete']['pt-pt'] = '';
-
-	// call_block_delete.php
-	$text['label-message']['en-us'] = 'Message';
-	$text['label-message']['pt-pt'] = '';
-
-	$text['label-delete-complete']['en-us'] = 'Delete Complete';
-	$text['label-delete-complete']['pt-pt'] = '';
-
-	// call_block_edit.php
-	$text['label-provide-name']['en-us'] = 'Please provide: Name';
-	$text['label-provide-name']['pt-pt'] = '';
-
-	$text['label-provide-number']['en-us'] = 'Please provide: Number';
-	$text['label-provide-number']['pt-pt'] = '';
-
-	$text['label-provide-enabled']['en-us'] = 'Please provide: Enabled';
-	$text['label-provide-enabled']['pt-pt'] = '';
-
-	$text['label-update-complete']['en-us'] = 'Update Complete';
-	$text['label-update-complete']['pt-pt'] = '';
-
-	$text['label-called-on']['en-us'] = 'Called on';
-	$text['label-called-on']['pt-pt'] = '';
-
-	$text['label-edit-add']['en-us'] = 'Call Block Add';
-	$text['label-edit-add']['pt-pt'] = '';
-
-	$text['label-edit-edit']['en-us'] = 'Call Block Edit';
-	$text['label-edit-edit']['pt-pt'] = '';
-
-	$text['label-add-note']['en-us'] = 'Block calls from a number. Either select a number from the list above or enter the number, name and enable below.';
-	$text['label-add-note']['pt-pt'] = '';
-
-	$text['label-edit-note']['en-us'] = 'Block calls from a number. Edit the name and enable/disable below.';
-	$text['label-edit-note']['pt-pt'] = '';
-
-	$text['label-exact-number']['en-us'] = 'Enter the exact number.';
-	$text['label-exact-number']['pt-pt'] = '';
-
-	$text['label-reject']['en-us'] = 'Reject';
-	$text['label-reject']['pt-pt'] = '';
-
-	$text['label-busy']['en-us'] = 'Busy';
-	$text['label-busy']['pt-pt'] = '';
-
-	$text['label-action-message']['en-us'] = 'Set an action for calls from this number.';
-	$text['label-action-message']['pt-pt'] = '';
-
-	$text['label-true']['en-us'] = 'true';
-	$text['label-true']['pt-pt'] = '';
-
-	$text['label-false']['en-us'] = 'false';
-	$text['label-false']['pt-pt'] = '';
-
-	$text['label-enable-message']['en-us'] = 'Set to true to enable call blocking for this number.';
-	$text['label-enable-message']['pt-pt'] = '';
-
-	$text['button-save']['en-us'] = 'Save';
-	$text['button-save']['pt-pt'] = '';
-
-	$text['button-back']['en-us'] = 'Back';
-	$text['button-back']['pt-pt'] = ''
-
-?>

+ 0 - 182
call_block/call_block.php

@@ -1,182 +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-2012
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-
-	Call Block is written by Gerrit Visser <[email protected]>
-*/
-require_once "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-
-if (permission_exists('call_block_view')) {
-	//access granted
-}
-else {
-	echo "access denied";
-	exit;
-}
-
-//add multi-lingual support
-	require_once "app_languages.php";
-	foreach($text as $key => $value) {
-		$text[$key] = $value[$_SESSION['domain']['language']['code']];
-	}
-
-//additional includes
-	require_once "resources/header.php";
-	require_once "resources/paging.php";
-
-//get variables used to control the order
-	$order_by = $_GET["order_by"];
-	$order = $_GET["order"];
-
-//show the content
-	echo "<div align='center'>";
-	echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
-	echo "<tr class='border'>\n";
-	echo "	<td align=\"center\">\n";
-	echo "		<br />";
-	echo "<table width='100%' border='0'>\n";
-	echo "	<tr>\n";
-	echo "		<td width='50%' align='left' nowrap='nowrap'><b>".$text['title-call-block']."</b></td>\n";
-	echo "		<td width='50%' align='right'>&nbsp;</td>\n";
-	echo "	</tr>\n";
-	echo "	<tr>\n";
-	echo "		<td align='left' colspan='2'>\n";
-	echo "			".$text['description-call-block']."<br /><br />\n";
-	echo "		</td>\n";
-	echo "	</tr>\n";
-	echo "</table>\n";
-
-	//prepare to page the results
-		$sql = "select count(*) as num_rows from v_call_block ";
-		$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' and direction <> 'outbound' ";
-		if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
-		$prep_statement = $db->prepare($sql);
-		if ($prep_statement) {
-		$prep_statement->execute();
-			$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
-			if ($row['num_rows'] > 0) {
-				$num_rows = $row['num_rows'];
-			}
-			else {
-				$num_rows = '0';
-			}
-		}
-
-	//prepare to page the results
-		$rows_per_page = 10;
-		$param = "";
-		$page = $_GET['page'];
-		if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } 
-		list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); 
-		$offset = $rows_per_page * $page; 
-
-	//get the  list
-		$sql = " select * from v_call_block ";
-		$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
-		if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
-		$sql .= " limit $rows_per_page offset $offset ";
-		$prep_statement = $db->prepare(check_sql($sql));
-		$prep_statement->execute();
-		$result = $prep_statement->fetchAll();
-		$result_count = count($result);
-		unset ($prep_statement, $sql);
-
-	$c = 0;
-	$row_style["0"] = "row_style0";
-	$row_style["1"] = "row_style1";
-	echo "<div align='center'>\n";
-	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
-	echo "<tr>\n";
-	echo th_order_by('blocked_caller_number', $text['label-number'], $order_by, $order);
-	echo th_order_by('blocked_caller_name', $text['label-name'], $order_by, $order);
-	echo th_order_by('blocked_call_count', $text['label-count'], $order_by, $order);
-	echo th_order_by('date_added', $text['label-date-added'], $order_by, $order);
-	echo th_order_by('blocked_call_action', $text['label-action'], $order_by, $order);
-	echo th_order_by('block_call_enabled', $text['label-enabled'], $order_by, $order);
-	echo "<td align='right' width='42'>\n";
-	if (permission_exists('call_block_add')) {
-		echo "	<a href='call_block_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
-	}
-	echo "</td>\n";
-	echo "<tr>\n";
-
-	if ($result_count > 0) {
-		foreach($result as $row) {
-			echo "<tr >\n";
-			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['blocked_caller_number']."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['blocked_caller_name']."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['blocked_call_count']."&nbsp;</td>\n";
-			if (defined('TIME_24HR') && TIME_24HR == 1) {
-				$tmp_date_added = date("j M Y H:i:s", $row['date_added']);
-			} else {
-				$tmp_date_added = date("j M Y h:i:sa", $row['date_added']);
-			}
-			echo "	<td valign='top' class='".$row_style[$c]."'>".$tmp_date_added."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['blocked_call_action']."&nbsp;</td>\n";
-			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['block_call_enabled']."&nbsp;</td>\n";
-			echo "	<td valign='top' align='right'>\n";
-			if (permission_exists('call_block_edit')) {
-				echo "		<a href='call_block_edit.php?id=".$row['blocked_caller_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
-			}
-			if (permission_exists('call_block_delete')) {
-				echo "		<a href='call_block_delete.php?id=".$row['blocked_caller_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n";
-			};
-			echo "</tr>\n";
-			if ($c==0) { $c=1; } else { $c=0; }
-		} //end foreach
-		unset($sql, $result, $row_count);
-	} //end if results
-
-	echo "<tr>\n";
-	echo "<td colspan='11' align='left'>\n";
-	echo "	<table width='100%' cellpadding='0' cellspacing='0'>\n";
-	echo "	<tr>\n";
-	echo "		<td width='33.3%' nowrap>&nbsp;</td>\n";
-	echo "		<td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
-		echo "		<td width='33.3%' align='right'>\n";
-		if (permission_exists('call_block_add')) {
-			echo "			<a href='call_block_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
-		}
-		echo "		</td>\n";
-	echo "	</tr>\n";
- 	echo "	</table>\n";
-	echo "</td>\n";
-	echo "</tr>\n";
-
-	echo "</table>";
-	echo "</div>";
-	echo "<br /><br />";
-	echo "<br /><br />";
-
-	echo "</td>";
-	echo "</tr>";
-	echo "</table>";
-	echo "</div>";
-	echo "<br /><br />";
-
-//include the footer
-	require_once "resources/footer.php";
-?>

+ 0 - 98
call_block/call_block_cdr_add.php

@@ -1,98 +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-2012
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-
-	Call Block is written by Gerrit Visser <[email protected]>
-*/
-require_once "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-
-if (permission_exists('call_block_edit') || permission_exists('call_block_add')) {
-	//access granted
-}
-else {
-	echo "access denied";
-	exit;
-}
-
-//add multi-lingual support
-	require_once "app_languages.php";
-	foreach($text as $key => $value) {
-		$text[$key] = $value[$_SESSION['domain']['language']['code']];
-	}
-
-//action add from cdr
-	if (isset($_REQUEST["cdr_id"])) {
-		$action = "cdr_add";
-		$cdr_uuid = check_str($_REQUEST["cdr_id"]);
-	}
-
-	// get the caller id info from cdr that user chose
-	$sql = "select caller_id_name, caller_id_number from v_xml_cdr ";
-	$sql .= "where uuid = '$cdr_uuid' ";
-	$prep_statement = $db->prepare(check_sql($sql));
-	$prep_statement->execute();
-	$result = $prep_statement->fetch();
-	unset ($prep_statement);
-
-	$blocked_caller_name = $result["caller_id_name"];
-	$blocked_caller_number = $result["caller_id_number"];
-	$block_call_enabled = "true";
-	$block_call_action = "Reject";
-
-	$sql = "insert into v_call_block ";
-	$sql .= "(";
-	$sql .= "domain_uuid, ";
-	$sql .= "blocked_caller_uuid, ";
-	$sql .= "blocked_caller_name, ";
-	$sql .= "blocked_caller_number, ";
-	$sql .= "blocked_call_count, ";
-	$sql .= "blocked_call_action, ";
-	$sql .= "block_call_enabled, ";
-	$sql .= "date_added ";
-	$sql .= ") ";
-	$sql .= "values ";
-	$sql .= "(";
-	$sql .= "'".$_SESSION['domain_uuid']."', ";
-	$sql .= "'".uuid()."', ";
-	$sql .= "'$blocked_caller_name', ";
-	$sql .= "'$blocked_caller_number', ";
-	$sql .= "0, ";
-	$sql .= "'$block_call_action', ";
-	$sql .= "'$block_call_enabled', ";
-	$sql .= "'".time()."' ";
-	$sql .= ")";
-	$db->exec(check_sql($sql));
-	unset($sql);
-
-	require_once "resources/header.php";
-	echo "<meta http-equiv=\"refresh\" content=\"2;url=call_block.php\">\n";
-	echo "<div align='center'>\n";
-	echo $text['label-add-complete']."\n";
-	echo "</div>\n";
-	require_once "resources/footer.php";
-	return;
-
-?>

+ 0 - 78
call_block/call_block_delete.php

@@ -1,78 +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-2012
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-
-	Call Block is written by Gerrit Visser <[email protected]>
-*/
-include "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-if (permission_exists('call_block_delete')) {
-	//access granted
-}
-else {
-	echo "access denied";
-	exit;
-}
-
-//add multi-lingual support
-	require_once "app_languages.php";
-	foreach($text as $key => $value) {
-		$text[$key] = $value[$_SESSION['domain']['language']['code']];
-	}
-
-//set the variable
-	if (count($_GET)>0) {
-		$id = $_GET["id"];
-	}
-
-//delete the extension
-	if (strlen($id)>0) {
-		$sql = "delete from v_call_block ";
-		$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
-		$sql .= "and blocked_caller_uuid = '$id' ";
-		$prep_statement = $db->prepare(check_sql($sql));
-		$prep_statement->execute();
-		unset($prep_statement, $sql);
-	}
-
-//redirect the user
-	require_once "resources/header.php";
-	echo "<meta http-equiv=\"refresh\" content=\"2;url=call_block.php\">\n";
-	echo "<br />\n";
-	echo "<div align='center'>\n";
-	echo "	<table width='40%'>\n";
-	echo "		<tr>\n";
-	echo "			<th align='left'>".$text['label-message']."</th>\n";
-	echo "		</tr>\n";
-	echo "		<tr>\n";
-	echo "			<td class='row_style1'><strong>".$text['label-delete-complete']."</strong></td>\n";
-	echo "		</tr>\n";
-	echo "	</table>\n";
-	echo "	<br />\n";
-	echo "</div>\n";
-	require_once "resources/footer.php";
-	return;
-
-?>

+ 0 - 385
call_block/call_block_edit.php

@@ -1,385 +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-2012
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-
-	Call Block is written by Gerrit Visser <[email protected]>
-*/
-require_once "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-
-if (permission_exists('call_block_edit') || permission_exists('call_block_add')) {
-	//access granted
-}
-else {
-	echo "access denied";
-	exit;
-}
-
-//add multi-lingual support
-	require_once "app_languages.php";
-	foreach($text as $key => $value) {
-		$text[$key] = $value[$_SESSION['domain']['language']['code']];
-	}
-
-//define the call_block_get_extensions function
-	function call_block_get_extensions($select_extension) {
-		global $db;
-
-		//list voicemail
-		$sql = "select extension, user_context, description from v_extensions ";
-		$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
-		$sql .= "and enabled = 'true' ";
-		$sql .= "order by extension asc ";
-		$prep_statement = $db->prepare(check_sql($sql));
-		$prep_statement->execute();
-		$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
-
-		echo "<optgroup label='Voicemail'>\n";
-		foreach ($result as &$row) {
-			$extension = $row["extension"];
-			$context = $row["user_context"];
-			$description = $row["description"];
-			if ($extension == $select_extension) $selected = "SELECTED";
-			echo "		<option value='Voicemail $context $extension' $selected>".$extension." ".$description."</option>\n";
-			$selected = "";
-		}
-		echo "</optgroup>\n";
-	}
-
-//action add or update
-	if (isset($_REQUEST["id"])) {
-		$action = "update";
-		$blocked_caller_uuid = check_str($_REQUEST["id"]);
-	}
-	else {
-		$action = "add";
-	}
-
-//get http post variables and set them to php variables
-	if (count($_POST)>0) {
-		$blocked_caller_name = check_str($_POST["blocked_caller_name"]);
-		$blocked_caller_number = check_str($_POST["blocked_caller_number"]);
-		$blocked_call_action = check_str($_POST["blocked_call_action"]);
-		$block_call_enabled = check_str($_POST["block_call_enabled"]);
-	}
-
-if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
-
-	$msg = '';
-	if ($action == "update") {
-		//$blocked_caller_uuid = check_str($_POST["blocked_caller_uuid"]);
-	}
-	
-	//check for all required data
-		if (strlen($blocked_caller_name) == 0) { $msg .= $text['label-provide-name']."<br>\n"; }
-		if ($action == "add") { 
-			if (strlen($blocked_caller_number) == 0) { $msg .= $text['label-provide-number']."<br>\n"; }
-		}
-		if (strlen($block_call_enabled) == 0) { $msg .= $text['label-provide-enabled']."<br>\n"; }
-		if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
-			require_once "resources/header.php";
-			require_once "resources/persist_form_var.php";
-			echo "<div align='center'>\n";
-			echo "<table><tr><td>\n";
-			echo $msg."<br />";
-			echo "</td></tr></table>\n";
-			persistformvar($_POST);
-			echo "</div>\n";
-			require_once "resources/footer.php";
-			return;
-		}
-
-	//add or update the database
-		if (($_POST["persistformvar"] != "true")>0) {
-			if ($action == "add") {
-				$sql = "insert into v_call_block ";
-				$sql .= "(";
-				$sql .= "domain_uuid, ";
-				$sql .= "blocked_caller_uuid, ";
-				$sql .= "blocked_caller_name, ";
-				$sql .= "blocked_caller_number, ";
-				$sql .= "blocked_call_count, ";
-				$sql .= "blocked_call_action, ";
-				$sql .= "block_call_enabled, ";
-				$sql .= "date_added ";
-				$sql .= ") ";
-				$sql .= "values ";
-				$sql .= "(";
-				$sql .= "'".$_SESSION['domain_uuid']."', ";
-				$sql .= "'".uuid()."', ";
-				$sql .= "'$blocked_caller_name', ";
-				$sql .= "'$blocked_caller_number', ";
-				$sql .= "0, ";
-				$sql .= "'$blocked_call_action', ";
-				$sql .= "'$block_call_enabled', ";
-				$sql .= "'".time()."' ";
-				$sql .= ")";
-				$db->exec(check_sql($sql));
-				unset($sql);
-
-				require_once "resources/header.php";
-				echo "<meta http-equiv=\"refresh\" content=\"2;url=call_block.php\">\n";
-				echo "<div align='center'>\n";
-				echo $text['label-add-complete']."\n";
-				echo "</div>\n";
-				require_once "resources/footer.php";
-				return;
-			} //if ($action == "add")
-
-			if ($action == "update") {
-				$sql = "update v_call_block set ";
-				$sql .= "blocked_caller_name = '$blocked_caller_name', ";
-				//$sql .= "blocked_caller_number = '$blocked_caller_number', ";
-				$sql .= "blocked_call_action = '$blocked_call_action', ";
-				$sql .= "block_call_enabled = '$block_call_enabled' ";
-				$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
-				$sql .= "and blocked_caller_uuid = '$blocked_caller_uuid'";
-				$db->exec(check_sql($sql));
-				unset($sql);
-
-				require_once "resources/header.php";
-				echo "<meta http-equiv=\"refresh\" content=\"2;url=call_block.php\">\n";
-				echo "<div align='center'>\n";
-				echo $text['label-update-complete']."\n";
-				echo "</div>\n";
-				require_once "resources/footer.php";
-				return;
-			} //if ($action == "update")
-		} //if ($_POST["persistformvar"] != "true") 
-} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
-
-//pre-populate the form
-	if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
-		$blocked_caller_uuid = $_GET["id"];
-		$sql = "select * from v_call_block ";
-		$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
-		$sql .= "and blocked_caller_uuid = '$blocked_caller_uuid' ";
-		$prep_statement = $db->prepare(check_sql($sql));
-		$prep_statement->execute();
-		$result = $prep_statement->fetchAll();
-		foreach ($result as &$row) {
-			$blocked_caller_name = $row["blocked_caller_name"];
-			$blocked_caller_number = $row["blocked_caller_number"];
-			$blocked_call_action = $row["blocked_call_action"];
-			$blocked_call_destination = $row["blocked_call_destination"];
-			$block_call_enabled = $row["block_call_enabled"];
-			break; //limit to 1 row
-		}
-		unset ($prep_statement, $sql);
-	}
-
-//show the header
-	require_once "resources/header.php";
-
-//show the content
-	echo "<div align='center'>";
-	// Show last 5-10 calls first, with add button
-
-//get the results from the db
-	$sql = "select caller_id_number, caller_id_name, start_epoch, uuid from v_xml_cdr ";
-	$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
-	$sql .= "and direction != 'outbound' ";
-	$sql .= "order by start_stamp DESC ";
-	$sql .= "limit 20 ";
-	$prep_statement = $db->prepare(check_sql($sql));
-	$prep_statement->execute();
-	$result = $prep_statement->fetchAll();
-	$result_count = count($result);
-	unset ($prep_statement);
-
-	echo "<table width='100%' cellpadding='0' cellspacing='0'>\n";
-	echo "<tr>\n";
-	echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order);
-	echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order);
-	echo th_order_by('start_stamp', $text['label-called-on'], $order_by, $order);
-
-	$c = 0;
-	$row_style["0"] = "row_style0";
-	$row_style["1"] = "row_style1";
-
-	if ($result_count > 0) {
-		foreach($result as $row) {
-			if (strlen($row['caller_id_number']) >= 7) {
-				if (defined('TIME_24HR') && TIME_24HR == 1) {
-					$tmp_start_epoch = date("j M Y H:i:s", $row['start_epoch']);
-				} else {
-					$tmp_start_epoch = date("j M Y h:i:sa", $row['start_epoch']);
-				}
-				echo "<tr >\n";
-				echo "	<td valign='top' class='".$row_style[$c]."'>";
-				echo 	$row['caller_id_name'].' ';
-				echo "	</td>\n";
-				echo "	<td valign='top' class='".$row_style[$c]."'>";
-				if (is_numeric($row['caller_id_number'])) {
-					echo 	format_phone($row['caller_id_number']).' ';
-				}
-				else {
-					echo 	$row['caller_id_number'].' ';
-				}
-				echo "	</td>\n";
-				echo "	<td valign='top' class='".$row_style[$c]."'>".$tmp_start_epoch."</td>\n";
-				echo "	<td valign='top' align='right'>\n";
-				echo "		<a href='call_block_cdr_add.php?cdr_id=".$row['uuid']."' alt='add'>$v_link_label_add</a>\n";
-				echo "</tr>\n";
-				if ($c==0) { $c=1; } else { $c=0; }
-			}
-		} //end foreach
-		unset($sql, $result, $row_count);
-	} //end if results
-
-	echo "<tr>\n";
-	echo "</tr>\n";
-	echo "</table>";
-	// end of Display Last 5-10 Calls
-
-	echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
-	echo "<tr class='border'>\n";
-	echo "	<td align=\"left\">\n";
-	echo "	  <br>";
-
-	echo "<form method='post' name='frm' action=''>\n";
-	echo "<div align='center'>\n";
-	echo "<table width='100%'  border='0' cellpadding='6' cellspacing='0'>\n";
-	echo "<tr>\n";
-	if ($action == "add") {
-		echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['label-edit-add']."</b></td>\n";
-	}
-	if ($action == "update") {
-		echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['label-edit-edit']."</b></td>\n";
-	}
-	echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='call_block.php'\" value='".$text['button-back']."'></td>\n";
-	echo "</tr>\n";
-	echo "<tr>\n";
-	echo "<td align='left' colspan='2'>\n";
-	if ($action == "add") {
-	echo $text['label-add-note']."<br /><br />\n";
-	}
-	if ($action == "update") {
-	echo $text['label-edit-note']."<br /><br />\n";
-	}
-	echo "</td>\n";
-	echo "</tr>\n";
-
-	echo "<tr>\n";
-	echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
-	echo "	Number:\n";
-	echo "</td>\n";
-	echo "<td class='vtable' align='left'>\n";
-	if ($action == "add") {
-		echo "	<input class='formfld' type='text' name='blocked_caller_number' maxlength='255' value=\"$blocked_caller_number\">\n";
-		echo "<br />\n";
-		echo $text['label-exact-number']."\n";
-	}
-	else {
-		echo $blocked_caller_number;
-	}
-	echo "<br />\n";
-	echo "</td>\n";
-	echo "</tr>\n";
-
-	echo "<tr>\n";
-	echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
-	echo "	Name:\n";
-	echo "</td>\n";
-	echo "<td class='vtable' align='left'>\n";
-	echo "	<input class='formfld' type='text' name='blocked_caller_name' maxlength='255' value=\"$blocked_caller_name\">\n";
-	echo "<br />\n";
-	echo "Enter the name.\n";
-	echo "</td>\n";
-	echo "</tr>\n";
-
-	echo "<tr>\n";
-	echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
-	echo "	Action:\n";
-	echo "</td>\n";
-	echo "<td class='vtable' align='left'>\n";
-	echo "	<select class='formfld' name='blocked_call_action'>\n";
-	echo "	<option value=''></option>\n";
-	$pieces = explode(" ", $blocked_call_action);
-	$action = $pieces[0];
-	$extension = $pieces[2];
-	if ($action == "Reject") {
-		echo "	<option value='Reject' SELECTED >Reject</option>\n";
-	} else {
-		echo "   <option value='Reject' >Reject</option>\n";
-	}
-	if ($action == "Busy") {
-		echo "	<option value='Busy' SELECTED >".$text['label-reject']."</option>\n";
-	} else {
-		echo "   <option value='Busy' >".$text['label-busy']."</option>\n";
-	}
-	call_block_get_extensions($extension);
-	echo "	</select>\n";
-	echo "<br />\n";
-	echo $text['label-action-message']."\n";
-	echo "\n";
-	echo "</td>\n";
-	echo "</tr>\n";
-
-	echo "<tr>\n";
-	echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
-	echo "	Enabled:\n";
-	echo "</td>\n";
-	echo "<td class='vtable' align='left'>\n";
-	echo "	<select class='formfld' name='block_call_enabled'>\n";
-	echo "	<option value=''></option>\n";
-	if ($block_call_enabled == "true") { 
-		echo "	<option value='true' SELECTED >true</option>\n";
-	}
-	else {
-		echo "	<option value='true'>true</option>\n";
-	}
-	if ($block_call_enabled == "false") { 
-		echo "	<option value='false' SELECTED >".$text['label-true']."</option>\n";
-	}
-	else {
-		echo "	<option value='false'>".$text['label-false']."</option>\n";
-	}
-	echo "	</select>\n";
-	echo "<br />\n";
-	echo $text['label-enable-message']."\n";
-	echo "\n";
-	echo "</td>\n";
-	echo "</tr>\n";
-
-	echo "	<tr>\n";
-	echo "		<td colspan='2' align='right'>\n";
-	if ($action == "update") {
-		echo "				<input type='hidden' name='blocked_caller_uuid' value='$blocked_caller_uuid'>\n";
-	}
-	echo "				<input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
-	echo "		</td>\n";
-	echo "	</tr>";
-	echo "</table>";
-	echo "</form>";
-
-	echo "	</td>";
-	echo "	</tr>";
-	echo "</table>";
-	echo "</div>";
-
-//include the footer
-	require_once "resources/footer.php";
-?>

+ 0 - 52
call_block/root.php

@@ -1,52 +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-2012
-	the Initial Developer. All Rights Reserved.
-
-	Contributor(s):
-	Mark J Crane <[email protected]>
-	
-	Callblock is written by Gerrit Visser <[email protected]>
-*/
-
-// make sure the PATH_SEPARATOR is defined
-	if (!defined("PATH_SEPARATOR")) {
-		if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
-	}
-
-// make sure the document_root is set
-	$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
-	$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
-	$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
-	//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
-	//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
-	//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
-
-// if the project directory exists then add it to the include path otherwise add the document root to the include path
-	if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
-		if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
-		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
-	}
-	else {
-		if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
-		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
-	}
-
-?>

+ 0 - 125
call_block/scripts/call_block.lua

@@ -1,125 +0,0 @@
---
---      call_block-FS
---      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 call_block-FS
---
---      The Initial Developer of the Original Code is
---      Gerrit Visser <[email protected]>
---      Copyright (C) 2011
---      the Initial Developer. All Rights Reserved.
---
---      Contributor(s):
---      Gerrit Visser <[email protected]>
---      Mark J Crane <[email protected]>
---[[
-This module provides for Blacklisting of phone numbers. Essentially these are numbers that you do not want to hear from again!
-
-To call this script and pass it arguments:
-1. On the command line, e.g. in a FS incoming dialplan: <action application="lua" data="call_block.lua C"/>
-This method causes the script to get its manadatory arguments directly from the Session
-]]
---[[ Change Log:
-	15 Jun, 2011: initial release > FusionPBX
-	15 Jun, 2011: Added loglevel parameter and logger function to simplify control of debug output
-	4 May, 2012: tested with FusionPBX V3
-	4 May, 2012: added per_tenant capability (domain based)
-	12 Jun, 2013: update the database connection, change table name from v_callblock to v_call_block
-	14 Jun, 2013: Change Voicemail option to use Transfer, avoids mod_voicemail dependency
-]]
-
--- Command line parameters
-	local	params = {	cmd="",
-						cid_num = string.gsub(tostring(session:getVariable("caller_id_number")), "+", ""),
-						cid_name = session:getVariable("caller_id_name"),
-						domain = session:getVariable("domain"),
-						userid= "", -- session:getVariable("id")
-						loglevel = "W" -- Warning, Debug, Info
-						}
-
--- local storage
-	local sql = nil
-
---define the logger function
-	local function logger(level, log, data)
-		-- output data to console 'log' if debug level is on
-		if string.find(params["loglevel"], level) then
-			freeswitch.consoleLog(log, "[Call Block]: " .. data .. "\n")
-		end
-	end
-
---include config.lua
-	scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
-	dofile(scripts_dir.."/resources/functions/config.lua");
-	dofile(config());
-
---connect to the database
-	dofile(scripts_dir.."/resources/functions/database_handle.lua");
-	dbh = database_handle('system');
-
---log if not connect 
-	if dbh:connected() == false then
-		logger("W", "NOTICE", "db was not connected")
-	end
-
--- We have a single command letter
--- Use session variables
-	logger("D", "NOTICE", "params default from session, count " .. string.format("%d", #argv[1]) .. " \n")
-	params["cmd"] = argv[1]
-
--- ensure that we have a fresh status on exit
-	session:setVariable("call_block", "")
-
---send to the log
-	logger("D", "NOTICE", "params are: " .. string.format("'%s', '%s', '%s', '%s'", params["cid_num"], 
-			params["cid_name"], params["userid"], params["domain"]));
-
---Check if number is in call_block list
-	--	If it is, then increment the counter and block the call
-	if (params["cmd"] == "C") then
-		sql = "SELECT * FROM v_call_block as c "
-		sql = sql .. "JOIN v_domains as d ON c.domain_uuid=d.domain_uuid "
-		sql = sql .. "WHERE c.blocked_caller_number = '" .. params["cid_num"] .. "' AND d.domain_name = '" .. params["domain"] .."'"
-		status = dbh:query(sql, function(rows)
-			found_cid_num = rows["blocked_caller_number"]
-			found_uuid = rows["blocked_caller_uuid"]
-			found_enabled = rows["block_call_enabled"]
-			found_action = rows["blocked_call_action"]
-			found_count = rows["blocked_call_count"]
-			end)
-		-- dbh:affected_rows() doesn't do anything if using core:db so this is the workaround:
-		if found_cid_num then	-- caller id exists
-			if (found_enabled == "true") then
-				details = {}
-				k = 0
-				for v in string.gmatch(found_action, "[%w%.]+") do
-					details[k] = v
-					--logger("W", "INFO", "Details: " .. details[k])
-					k = k + 1
-				end
-				dbh:query("UPDATE v_call_block SET blocked_call_count = " .. found_count + 1 .. " WHERE blocked_caller_uuid = '" .. found_uuid .. "'")
-				session:setVariable("call_block", "block")
-				logger("W", "NOTICE", "number " .. params["cid_num"] .. " blocked with " .. found_count .. " previous hits, domain: " .. params["domain"])
-				if (found_action == "Reject") then
-					session:hangup("CALL_REJECTED")
-				end
-				if (found_action == "Busy") then
-					session:hangup("USER_BUSY")
-				end
-				if (details[0] =="Voicemail") then
-					session:setAutoHangup(false)
-					session:execute("transfer", "*99" .. details[2] .. " XML  " .. details[1])
-				end
-			end
-		end
-	end