Add a missing file sip_profile_copy.php to the dev branch.

This commit is contained in:
Mark Crane
2012-06-04 14:58:40 +00:00
commit af103e9c41
1240 changed files with 164946 additions and 0 deletions

5
.htaccess Normal file
View File

@@ -0,0 +1,5 @@
RewriteEngine On
RewriteRule ^([A-Fa-f0-9]{12})(\.(xml|cfg))?$ mod/provision/index.php?mac=$1 [QSA]
RewriteRule ^([A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-][A-Fa-f0-9]{2}[:-])(\.(xml|cfg))?$ mod/provision/index.php?mac=$1 [QSA]

1452
app/adminer/adminer.php Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
<?php
//application details
$apps[$x]['name'] = "Adminer";
$apps[$x]['uuid'] = '214b9f02-547b-d49d-f4e9-02987d9581c5';
$apps[$x]['category'] = 'System';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '3.2.2';
$apps[$x]['license'] = 'http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0';
$apps[$x]['url'] = 'http://www.adminer.org/';
$apps[$x]['description']['en'] = 'Adminer (formerly phpMinAdmin) is a full-featured database management tool written in PHP. Adminer is available for MySQL, PostgreSQL, SQLite, MS SQL and Oracle.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Adminer';
$apps[$x]['menu'][0]['uuid'] = '1f59d07b-b4f7-4f9e-bde9-312cf491d66e';
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
$apps[$x]['menu'][0]['category'] = 'external';
$apps[$x]['menu'][0]['path'] = '<!--{project_path}-->/app/adminer/index.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'adminer';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
?>

66
app/adminer/index.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
//includes
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
//check permission
if (permission_exists('adminer')) {
//access granted
}
else {
echo "access denied";
exit;
}
//only allow users in the superadmin group to use this feature
if (if_group("superadmin")) {
//echo "access granted";
}
else {
echo "access denied";
exit;
}
function adminer_object() {
class AdminerSoftware extends Adminer {
function name() {
// custom name in title and heading
return 'Adminer';
}
/*
function permanentLogin() {
// key used for permanent login
return "7bebc76d8680196752c6b961ef13c360";
}
function credentials() {
global $db_host, $db_username, $db_password;
// server, username and password for connecting to database
return array($db_host.':'.$db_port, $db_username, $db_password);
}
function database() {
global $db_name;
// database name, will be escaped by Adminer
return $db_name;
}
function login($login, $password) {
// validate user submitted credentials
return ($login == 'admin' && $password == '');
}
*/
}
return new AdminerSoftware;
}
// include original Adminer or Adminer Editor
include "adminer.php";
?>

50
app/adminer/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,120 @@
<?php
//application details
$apps[$x]['name'] = "Call Broadcast";
$apps[$x]['uuid'] = 'efc11f6b-ed73-9955-4d4d-3a1bed75a056';
$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'] = 'Schedule to immediately make multiple calls to the extension an IVR Menu, Conference Room, or any other number.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Call Broadcast';
$apps[$x]['menu'][0]['uuid'] = '50153bbf-78c5-b49e-7bd9-4b3e4b1134e6';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
$apps[$x]['menu'][0]['path'] = '/app/call_broadcast/v_call_broadcast.php';
//permission details
$apps[$x]['permissions'][0]['name'] = 'call_broadcast_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'call_broadcast_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'call_broadcast_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'call_broadcast_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'call_broadcast_send';
$apps[$x]['permissions'][4]['groups'][] = 'admin';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_call_broadcasts';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'call_broadcast_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'call_call_broadcast_uuid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'broadcast_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'broadcast_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'broadcast_desc';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_timeout';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_concurrent_limit';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'recording_uuid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'recordingid';
$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]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_caller_id_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_caller_id_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_destination_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_phone_numbers';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_destination_data';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>

View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,151 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get the http get variables and set them to php variables
$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'><tr>\n";
echo "<td width='50%' nowrap='nowrap' align='left'><b>Call Broadcast List</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr></table>\n";
$sql = "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 10;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$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(PDO::FETCH_NAMED);
$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('broadcast_name', 'Name', $order_by, $order);
echo th_order_by('broadcast_concurrent_limit', 'Concurrent Limit', $order_by, $order);
echo th_order_by('broadcast_description', 'Description', $order_by, $order);
//echo th_order_by('recordingid', 'Recording', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('call_broadcast_add')) {
echo " <a href='v_call_broadcast_edit.php' alt='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['broadcast_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['broadcast_concurrent_limit']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['recordingid']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['broadcast_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('call_broadcast_edit')) {
echo " <a href='v_call_broadcast_edit.php?id=".$row['call_broadcast_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('call_broadcast_delete')) {
echo " <a href='v_call_broadcast_delete.php?id=".$row['call_broadcast_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\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='5' 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_broadcast_add')) {
echo " <a href='v_call_broadcast_edit.php' alt='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>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,61 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the id
if (count($_GET)>0) {
$id = $_GET["id"];
}
//delete the call broadcast entry
if (strlen($id)>0) {
$sql = "delete from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_broadcast.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,560 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the action with add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$call_broadcast_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get the http post variables and set them to php variables
if (count($_POST)>0) {
$broadcast_name = check_str($_POST["broadcast_name"]);
$broadcast_description = check_str($_POST["broadcast_description"]);
$broadcast_timeout = check_str($_POST["broadcast_timeout"]);
$broadcast_concurrent_limit = check_str($_POST["broadcast_concurrent_limit"]);
//$recording_uuid = check_str($_POST["recording_uuid"]);
$broadcast_caller_id_name = check_str($_POST["broadcast_caller_id_name"]);
$broadcast_caller_id_number = check_str($_POST["broadcast_caller_id_number"]);
$broadcast_destination_type = check_str($_POST["broadcast_destination_type"]);
$broadcast_phone_numbers = check_str($_POST["broadcast_phone_numbers"]);
$broadcast_destination_data = check_str($_POST["broadcast_destination_data"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$call_broadcast_uuid = check_str($_POST["call_broadcast_uuid"]);
}
//check for all required data
if (strlen($broadcast_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
//if (strlen($broadcast_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
//if (strlen($broadcast_timeout) == 0) { $msg .= "Please provide: Timeout<br>\n"; }
//if (strlen($broadcast_concurrent_limit) == 0) { $msg .= "Please provide: Concurrent Limit<br>\n"; }
//if (strlen($recording_uuid) == 0) { $msg .= "Please provide: Recording<br>\n"; }
//if (strlen($broadcast_caller_id_name) == 0) { $msg .= "Please provide: Caller ID Name<br>\n"; }
//if (strlen($broadcast_caller_id_number) == 0) { $msg .= "Please provide: Caller ID Number<br>\n"; }
//if (strlen($broadcast_destination_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
//if (strlen($broadcast_phone_numbers) == 0) { $msg .= "Please provide: Phone Number List<br>\n"; }
//if (strlen($broadcast_destination_data) == 0) { $msg .= "Please provide: Destination<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('call_broadcast_add')) {
$call_broadcast_uuid = uuid();
$sql = "insert into v_call_broadcasts ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "call_broadcast_uuid, ";
$sql .= "broadcast_name, ";
$sql .= "broadcast_description, ";
$sql .= "broadcast_timeout, ";
$sql .= "broadcast_concurrent_limit, ";
//$sql .= "recording_uuid, ";
$sql .= "broadcast_caller_id_name, ";
$sql .= "broadcast_caller_id_number, ";
$sql .= "broadcast_destination_type, ";
$sql .= "broadcast_phone_numbers, ";
$sql .= "broadcast_destination_data ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$call_broadcast_uuid', ";
$sql .= "'$broadcast_name', ";
$sql .= "'$broadcast_description', ";
if (strlen($broadcast_timeout) == 0) {
$sql .= "null, ";
}
else {
$sql .= "'$broadcast_timeout', ";
}
if (strlen($broadcast_concurrent_limit) == 0) {
$sql .= "null, ";
}
else {
$sql .= "'$broadcast_concurrent_limit', ";
}
//$sql .= "'$recording_uuid', ";
$sql .= "'$broadcast_caller_id_name', ";
$sql .= "'$broadcast_caller_id_number', ";
$sql .= "'$broadcast_destination_type', ";
$sql .= "'$broadcast_phone_numbers', ";
$sql .= "'$broadcast_destination_data' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_broadcast.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('call_broadcast_edit')) {
$sql = "update v_call_broadcasts set ";
$sql .= "broadcast_name = '$broadcast_name', ";
$sql .= "broadcast_description = '$broadcast_description', ";
if (strlen($broadcast_timeout) == 0) {
$sql .= "broadcast_timeout = null, ";
}
else {
$sql .= "broadcast_timeout = '$broadcast_timeout', ";
}
if (strlen($broadcast_concurrent_limit) == 0) {
$sql .= "broadcast_concurrent_limit = null, ";
}
else {
$sql .= "broadcast_concurrent_limit = '$broadcast_concurrent_limit', ";
}
//$sql .= "recording_uuid = '$recording_uuid', ";
$sql .= "broadcast_caller_id_name = '$broadcast_caller_id_name', ";
$sql .= "broadcast_caller_id_number = '$broadcast_caller_id_number', ";
$sql .= "broadcast_destination_type = '$broadcast_destination_type', ";
$sql .= "broadcast_phone_numbers = '$broadcast_phone_numbers', ";
$sql .= "broadcast_destination_data = '$broadcast_destination_data' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$call_broadcast_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_broadcast.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$call_broadcast_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$call_broadcast_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
$broadcast_name = $row["broadcast_name"];
$broadcast_description = $row["broadcast_description"];
$broadcast_timeout = $row["broadcast_timeout"];
$broadcast_concurrent_limit = $row["broadcast_concurrent_limit"];
//$recording_uuid = $row["recording_uuid"];
$broadcast_caller_id_name = $row["broadcast_caller_id_name"];
$broadcast_caller_id_number = $row["broadcast_caller_id_number"];
$broadcast_destination_type = $row["broadcast_destination_type"];
$broadcast_phone_numbers = $row["broadcast_phone_numbers"];
$broadcast_destination_data = $row["broadcast_destination_data"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//begin header
require_once "includes/header.php";
//begin content
echo "<div align='center'>";
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 width='30%' align='left' nowrap='nowrap'><b>Call Broadcast</b></td>\n";
}
if ($action == "update") {
echo "<td width='30%' align='left' nowrap='nowrap'><b>Call Broadcast Edit</b></td>\n";
}
echo "<td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='back' alt='back' onclick=\"window.location='v_call_broadcast.php'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_name' maxlength='255' value=\"$broadcast_name\">\n";
echo "<br />\n";
echo "Enter a name here.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Timeout:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_timeout' maxlength='255' value=\"$broadcast_timeout\">\n";
echo "<br />\n";
echo "Limit the length of the call. Leave this empty for no limit.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Concurrent Limit:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_concurrent_limit' maxlength='255' value=\"$broadcast_concurrent_limit\">\n";
echo "<br />\n";
echo "Limit the approximate number of concurrent calls. Leave this empty for no limit.\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
//echo " Recording:\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <select name='recording_uuid' class='formfld'>\n";
//echo " <option></option>\n";
//$sql = "";
//$sql .= "select * from v_recordings ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
//$prep_statement = $db->prepare(check_sql($sql));
//$prep_statement->execute();
//while($row = $prep_statement->fetch()) {
// if ($recording_uuid == $row['recording_uuid']) {
// echo " <option value='".$row['recording_uuid']."' selected='yes'>".$row['recordingname']."</option>\n";
// }
// else {
// echo " <option value='".$row['recording_uuid']."'>".$row['recordingname']."</option>\n";
// }
//}
//unset ($prep_statement);
//echo " </select>\n";
//echo "<br />\n";
//echo "Recording to play when the call is answered.<br />\n";
//echo "\n";
//echo "</td>\n";
//echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Caller ID Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_caller_id_name' maxlength='255' value=\"$broadcast_caller_id_name\">\n";
echo "<br />\n";
echo "Applicable if the provider allow the Caller ID Name to be set. default: anonymous\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Caller ID Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_caller_id_number' maxlength='255' value=\"$broadcast_caller_id_number\">\n";
echo "<br />\n";
echo "Applicable if the provider that allow the Caller ID number to be sent. default: 0000000000\n";
echo "</td>\n";
echo "</tr>\n";
/*
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_destination_type' maxlength='255' value=\"$broadcast_destination_type\">\n";
echo "<br />\n";
echo "Optional, Destination Type: bridge, transfer, voicemail, conference, fifo, etc.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Destination:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_destination_data' maxlength='255' value=\"$broadcast_destination_data\">\n";
echo "<br />\n";
echo "Optional, send the call to an auto attendant, conference room, or any other destination. <br /><br />\n";
echo "conference (8khz): 01-\${domain}@default <br />\n";
echo "bridge (external number): sofia/gateway/gatewayname/12081231234 <br />\n";
echo "bridge (auto attendant): sofia/internal/5002@\${domain} <br />\n";
echo "transfer (external number): 12081231234 XML default <br />\n";
echo "</td>\n";
echo "</tr>\n";
*/
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Destination Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_destination_data' maxlength='255' value=\"$broadcast_destination_data\">\n";
echo "<br />\n";
echo "Send the call to the extension an IVR Menu, Conference Room, or any other number. <br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Phone Number List:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <textarea class='formfld' type='text' name='broadcast_phone_numbers' rows='10'>$broadcast_phone_numbers</textarea>\n";
echo "<br />\n";
echo "Optional, set a list of phone numbers one per row in the following format: 123-123-1234|Last Name, First Name <br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Description:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_description' maxlength='255' value=\"$broadcast_description\">\n";
echo "<br />\n";
echo "Enter a description here.\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='call_broadcast_uuid' value='$call_broadcast_uuid'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_call_broadcast_send.php?call_broadcast_uuid=$call_broadcast_uuid'\" value='Send Broadcast'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
/*
if ($action == "update") {
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' nowrap><b>Call Broadcast</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<form method='get' name='frm' action='v_call_broadcast_send.php'>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo " Category:\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select name='user_category' class='formfld'>\n";
echo " <option></option>\n";
$sql = "";
$sql .= "select distinct(user_category) as user_category from v_users ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
if ($user_category == $row['user_category']) {
echo " <option value='".$row['user_category']."' selected='yes'>".$row['user_category']."</option>\n";
}
else {
echo " <option value='".$row['user_category']."'>".$row['user_category']."</option>\n";
}
}
unset ($prep_statement);
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo " Group:\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select name='group_name' class='formfld'>\n";
echo " <option></option>\n";
$sql = "";
$sql .= "select * from v_groups ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
if ($recording_uuid == $row['group_name']) {
echo " <option value='".$row['group_name']."' selected='yes'>".$row['group_name']."</option>\n";
}
else {
echo " <option value='".$row['group_name']."'>".$row['group_name']."</option>\n";
}
}
unset ($prep_statement);
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo " Gateway:\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select name='gateway' class='formfld'>\n";
echo " <option></option>\n";
$sql = "";
$sql .= "select * from v_gateways ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
if ($gateway == $row['gateway']) {
echo " <option value='".$row['gateway']."' selected='yes'>".$row['gateway']."</option>\n";
}
else {
echo " <option value='".$row['gateway']."'>".$row['gateway']."</option>\n";
}
}
unset ($prep_statement);
echo " <option value='loopback'>loopback</option>\n";
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Phone Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='phonetype1' class='formfld'>\n";
echo " <option></option>\n";
echo " <option value='phone1'>phone1</option>\n";
echo " <option value='phone2'>phone2</option>\n";
echo " <option value='cell'>cell</option>\n";
//echo " <option value='zzz'>cell</option>\n";
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Phone Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='phonetype2' class='formfld'>\n";
echo " <option></option>\n";
echo " <option value='phone1'>phone1</option>\n";
echo " <option value='phone2'>phone2</option>\n";
echo " <option value='cell'>cell</option>\n";
//echo " <option value='zzz'>cell</option>\n";
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='call_broadcast_uuid' value='$call_broadcast_uuid'>\n";
echo " <input type='submit' name='submit' class='btn' value='Send Broadcast'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
}
*/
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,374 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_send')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the max execution time to 1 hour
ini_set(max_execution_time,3600);
function cmd_async($cmd) {
//windows
if (stristr(PHP_OS, 'WIN')) {
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w") // stderr
);
$process = proc_open("start ".$cmd, $descriptorspec, $pipes);
//sleep(1);
proc_close($process);
}
else { //posix
exec ($cmd ." /dev/null 2>&1 &");
}
}
//get the http get values and set as php variables
$group_name = $_GET["group_name"];
$call_broadcast_uuid = $_GET["call_broadcast_uuid"];
$user_category = $_GET["user_category"];
$gateway = $_GET["gateway"];
$phonetype1 = $_GET["phonetype1"];
$phonetype2 = $_GET["phonetype2"];
//get the call broadcast details from the database
$sql = "";
$sql .= "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$call_broadcast_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
$broadcast_name = $row["broadcast_name"];
$broadcast_description = $row["broadcast_description"];
$broadcast_timeout = $row["broadcast_timeout"];
$broadcast_concurrent_limit = $row["broadcast_concurrent_limit"];
$recordingid = $row["recordingid"];
$broadcast_caller_id_name = $row["broadcast_caller_id_name"];
$broadcast_caller_id_number = $row["broadcast_caller_id_number"];
$broadcast_destination_type = $row["broadcast_destination_type"];
$broadcast_phone_numbers = $row["broadcast_phone_numbers"];
$broadcast_destination_data = $row["broadcast_destination_data"];
//if (strlen($row["broadcast_destination_data"]) == 0) {
// $broadcast_destination_application = '';
// $broadcast_destination_data = '';
//}
//else {
// $broadcast_destination_array = explode(":", $row["broadcast_destination_data"]);
// $broadcast_destination_application = $broadcast_destination_array[0];
// $broadcast_destination_data = $broadcast_destination_array[1];
//}
break; //limit to 1 row
}
unset ($prep_statement);
if (strlen($broadcast_caller_id_name) == 0) {
$broadcast_caller_id_name = "anonymous";
}
if (strlen($broadcast_caller_id_number) == 0) {
$broadcast_caller_id_number = "0000000000";
}
//get the recording name
//$recording_filename = get_recording_filename($recordingid);
//remove unsafe characters from the name
$broadcast_name = str_replace(" ", "", $broadcast_name);
$broadcast_name = str_replace("'", "", $broadcast_name);
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get information over event socket
if (!$fp) {
require_once "includes/header.php";
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
require_once "includes/footer.php";
}
else {
//show the header
require_once "includes/header.php";
//send the call broadcast
if (strlen($broadcast_phone_numbers) > 0) {
$broadcast_phone_number_array = explode ("\n", $broadcast_phone_numbers);
$count = 1;
$sched_seconds = '3';
foreach ($broadcast_phone_number_array as $tmp_value) {
$tmp_value = str_replace(";", "|", $tmp_value);
$tmp_value_array = explode ("|", $tmp_value);
//make sure the phone numbers are correct
$phone1 = trim($tmp_value_array[0]);
$phone1 = str_replace("-", "", $phone1);
$phone1 = str_replace("(", "", $phone1);
$phone1 = str_replace(")", "", $phone1);
$phone1 = str_replace(" ", "", $phone1);
$phone1 = str_replace(".", "", $phone1);
//get the correct gateway
$bridge_array = outbound_route_to_bridge ($phone1);
//prepare the string
$channel_variables = "ignore_early_media=true,origination_number=$phone1,origination_caller_id_name='$broadcast_caller_id_name',origination_caller_id_number=$broadcast_caller_id_number";
$origination_url = "{".$channel_variables."}".$bridge_array[0]."";
//get the context
if (count($_SESSION["domains"]) > 1) {
$context = $_SESSION['domain_name'];
}
else {
$context = "default";
}
//set the command
$cmd = "bgapi sched_api +".$sched_seconds." none bgapi originate ".$origination_url." ".$broadcast_destination_data." XML $context";
//if the event socket connection is lost then re-connect
if (!$fp) {
$fp = eventsocket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
}
//method 1
$response = trim(event_socket_request($fp, 'api '.$cmd));
//method 2
//cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";");
//spread the calls out so that they are scheduled with different times
if (strlen($broadcast_concurrent_limit) > 0 && strlen($broadcast_timeout) > 0) {
if ($broadcast_concurrent_limit == $count) {
$sched_seconds = $sched_seconds + $broadcast_timeout;
$count=0;
}
}
$count++;
}
fclose($fp);
//echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/calls_active/v_calls_active.php\">\n";
echo "<div align='center'>\n";
echo "<table width='50%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1' align='center'>\n";
echo " <strong>Call Broadcast $broadcast_name has been started.</strong>\n";
echo " <br /><br />\n";
echo " <table width='100%'>\n";
echo " <tr>\n";
echo " <td align='center'>\n";
echo " <a href='".PROJECT_PATH."/app/calls_active/v_calls_active.php'>View Calls</a>\n";
echo " </td>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
//show the footer
require_once "includes/footer.php";
}
/*
//reserved for future use
require_once "includes/header.php";
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'><tr>\n";
echo "<td width='50%' nowrap><b>Contact List</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr></table>\n";
$broadcast_phone_number_array = explode ("\n", $broadcast_phone_numbers);
foreach ($broadcast_phone_number_array as $tmp_value) {
$tmp_value = str_replace(";", "|", $tmp_value);
$tmp_value_array = explode ("|", $tmp_value);
//make sure the phone numbers are correct
$phone1 = trim($tmp_value_array[0]);
$phone1 = str_replace("-", "", $phone1);
$phone1 = str_replace("(", "", $phone1);
$phone1 = str_replace(")", "", $phone1);
$phone1 = str_replace(" ", "", $phone1);
$phone1 = str_replace(".", "", $phone1);
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
echo $cmd."<br />\n";
cmd_async($cmd);
//sleep(60);
}
if (strlen($group_name) > 0) {
$sql = " select * from v_users as u, v_group_users as m ";
$sql .= " where u.user_uuid = m.user_uuid ";
$sql .= " and m.group_name = '".$group_name."' ";
$sql .= " and u.user_category = '".$user_category."' ";
//echo $sql."<br />";
}
else {
$sql = " select * from v_users as u ";
$sql .= " where u.user_category = '".$user_category."' ";
//echo $sql."<br />";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$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('username', 'Username', $order_by, $order);
echo th_order_by('user_type', 'Type', $order_by, $order);
//echo th_order_by('user_category', 'Category', $order_by, $order);
echo th_order_by('user_first_name', 'First Name', $order_by, $order);
echo th_order_by('user_last_name', 'Last Name', $order_by, $order);
echo th_order_by('user_company_name', 'Organization', $order_by, $order);
echo th_order_by('user_phone_1', 'Phone1', $order_by, $order);
echo th_order_by('user_phone_2', 'Phone2', $order_by, $order);
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[username]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_type]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_category]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_first_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_last_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_company_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_phone_1]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_phone_2]."&nbsp;</td>\n";
echo "</tr>\n";
//if (strlen($gateway) > 0) {
if ($phonetype1 == "phone1" && strlen($row[user_phone_1]) > 0) { $phone1 = $row[user_phone_1]; }
if ($phonetype1 == "phone2" && strlen($row[user_phone_2]) > 0) { $phone1 = $row[user_phone_2]; }
if ($phonetype1 == "cell" && strlen($row[user_phone_mobile]) > 0) { $phone1 = $row[user_phone_mobile]; }
if ($phonetype2 == "phone1" && strlen($row[user_phone_2]) > 0) { $phone2 = $row[user_phone_2]; }
if ($phonetype2 == "phone2" && strlen($row[user_phone_2]) > 0) { $phone2 = $row[user_phone_2]; }
if ($phonetype2 == "cell" && strlen($row[user_phone_mobile]) > 0) { $phone2 = $row[user_phone_mobile]; }
//make sure the phone numbers are correct
$phone1 = str_replace("-", "", $phone1);
$phone1 = str_replace("(", "", $phone1);
$phone1 = str_replace(")", "", $phone1);
$phone1 = str_replace(" ", "", $phone1);
$phone1 = str_replace(".", "", $phone1);
$phone2 = str_replace("-", "", $phone2);
$phone2 = str_replace("(", "", $phone2);
$phone2 = str_replace(")", "", $phone2);
$phone2 = str_replace(" ", "", $phone2);
$phone2 = str_replace(".", "", $phone2);
//make the call
if (strlen($phone1)> 0) {
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
//echo $cmd."<br />\n";
cmd_async($cmd);
}
if (strlen($phone2)> 0) {
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone2." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
//echo $cmd."<br />\n";
cmd_async($cmd);
}
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "</table>";
echo "</div>";
echo "<br><br>";
echo "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
*/
?>

View File

@@ -0,0 +1,457 @@
<?php
//application details
$apps[$x]['name'] = "Call Center";
$apps[$x]['uuid'] = '95788e50-9500-079e-2807-fd530b0ea370';
$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'] = 'Queues for managing inbound calls and routing those calls to available agents.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Call Center';
$apps[$x]['menu'][0]['uuid'] = '6c072b29-5b6c-49fc-008e-95e24c77de99';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/call_center/v_call_center_queue.php';
$apps[$x]['menu'][0]['groups'][] = 'agent';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
$apps[$x]['menu'][1]['title']['en'] = 'Agent Status';
$apps[$x]['menu'][1]['uuid'] = '597c483a-51a9-f95a-8d54-ea7d87ada2b8';
$apps[$x]['menu'][1]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][1]['category'] = 'internal';
$apps[$x]['menu'][1]['path'] = '/app/call_center/v_call_center_agent_status.php';
$apps[$x]['menu'][1]['groups'][] = 'agent_admin';
$apps[$x]['menu'][1]['groups'][] = 'admin';
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'call_center_queues_view';
$apps[$x]['permissions'][0]['groups'][] = 'agent';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'call_center_queues_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'call_center_queues_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'call_center_queues_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'call_center_agents_view';
$apps[$x]['permissions'][0]['groups'][] = 'agent';
$apps[$x]['permissions'][4]['groups'][] = 'admin';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
$apps[$x]['permissions'][5]['name'] = 'call_center_agents_add';
$apps[$x]['permissions'][5]['groups'][] = 'admin';
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
$apps[$x]['permissions'][6]['name'] = 'call_center_agents_edit';
$apps[$x]['permissions'][6]['groups'][] = 'admin';
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
$apps[$x]['permissions'][7]['name'] = 'call_center_agents_delete';
$apps[$x]['permissions'][7]['groups'][] = 'admin';
$apps[$x]['permissions'][7]['groups'][] = 'superadmin';
$apps[$x]['permissions'][8]['name'] = 'call_center_tiers_view';
$apps[$x]['permissions'][0]['groups'][] = 'agent';
$apps[$x]['permissions'][8]['groups'][] = 'admin';
$apps[$x]['permissions'][8]['groups'][] = 'superadmin';
$apps[$x]['permissions'][9]['name'] = 'call_center_tiers_add';
$apps[$x]['permissions'][9]['groups'][] = 'admin';
$apps[$x]['permissions'][9]['groups'][] = 'superadmin';
$apps[$x]['permissions'][10]['name'] = 'call_center_tiers_edit';
$apps[$x]['permissions'][10]['groups'][] = 'admin';
$apps[$x]['permissions'][10]['groups'][] = 'superadmin';
$apps[$x]['permissions'][11]['name'] = 'call_center_tiers_delete';
$apps[$x]['permissions'][11]['groups'][] = 'admin';
$apps[$x]['permissions'][11]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_call_center_agents';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'call_center_agent_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'call_center_agent_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_call_timeout';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_contact';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_status';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_logout';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_max_no_answer';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_wrap_up_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_reject_delay_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_busy_delay_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_no_answer_delay_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_call_center_logs';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'cc_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_queue';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_action';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_count';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent_system';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent_status';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent_state';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent_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]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_selection';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_cause';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_wait_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_talk_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_total_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_epoch';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_date';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamp';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'timestamp';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_member_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_member_session_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_member_cid_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_member_cid_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent_called_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_agent_answered_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_member_joined_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_member_leaving_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_bridge_terminated_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cc_hangup_cause';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 2; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_call_center_queues';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'call_center_queue_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'call_center_queue_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_dialplans';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'dialplan_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_extension';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_strategy';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_moh_sound';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_record_template';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_time_base_score';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_max_wait_time';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_max_wait_time_with_no_agent';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_tier_rules_apply';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_tier_rule_wait_second';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_tier_rule_no_agent_no_wait';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_timeout_action';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_discard_abandoned_after';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_abandoned_resume_allowed';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_tier_rule_wait_multiply_level';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_cid_prefix';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 3; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_call_center_tiers';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'call_center_tier_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'call_center_tier_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'agent_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'queue_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'tier_level';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'tier_position';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>

50
app/call_center/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,190 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_agents_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get http values and set them to php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show 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>Call Center Agent List</b></td>\n";
echo "<td width='50%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_call_center_agent_status.php'\" value='Status'>\n";
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_call_center_queue.php'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "List of call center agents.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$sql = "";
$sql .= "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'agent_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "";
$sql .= " select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'agent_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$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('domain_uuid', 'domain_uuid', $order_by, $order);
echo th_order_by('agent_name', 'Agent Name', $order_by, $order);
echo th_order_by('agent_type', 'Type', $order_by, $order);
echo th_order_by('agent_call_timeout', 'Call Timeout', $order_by, $order);
echo th_order_by('agent_contact', 'Contact', $order_by, $order);
echo th_order_by('agent_max_no_answer', 'Max No Answer', $order_by, $order);
echo th_order_by('agent_status', 'Status', $order_by, $order);
//echo th_order_by('agent_wrap_up_time', 'Wrap Up Time', $order_by, $order);
//echo th_order_by('agent_reject_delay_time', 'Reject Delay Time', $order_by, $order);
//echo th_order_by('agent_busy_delay_time', 'Busy Delay Time', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('call_center_agents_add')) {
echo " <a href='v_call_center_agent_edit.php' alt='add'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count == 0) { //no results
}
else { //received results
foreach($result as $row) {
echo "<tr >\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[domain_uuid]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_type]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_call_timeout]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_contact]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_max_no_answer]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_status]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_wrap_up_time]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_reject_delay_time]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_busy_delay_time]."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('call_center_agents_edit')) {
echo " <a href='v_call_center_agent_edit.php?id=".$row[call_center_agent_uuid]."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('call_center_agents_delete')) {
echo " <a href='v_call_center_agent_delete.php?id=".$row[call_center_agent_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
//echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='v_call_center_agent_edit.php?id=".$row[call_center_agent_uuid]."'\" value='e'>\n";
//echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='v_call_center_agent_delete.php?id=".$row[call_center_agent_uuid]."' }\" value='x'>\n";
echo " </td>\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_center_agents_add')) {
echo " <a href='v_call_center_agent_edit.php' alt='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>";
//show the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,85 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_agents_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//get the agent details
$sql = "";
$sql .= "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_agent_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$agent_name = $row["agent_name"];
break; //limit to 1 row
}
unset ($prep_statement);
//delete the agent from the freeswitch
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//delete the agent over event socket
if ($fp) {
$cmd = "api callcenter_config agent del ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
$response = event_socket_request($fp, $cmd);
}
//delete the agent from the db
if (strlen($id)>0) {
$sql = "";
$sql .= "delete from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_agent_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_agent.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,513 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_agents_add') || permission_exists('call_center_agents_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$call_center_agent_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$agent_name = check_str($_POST["agent_name"]);
$agent_type = check_str($_POST["agent_type"]);
$agent_call_timeout = check_str($_POST["agent_call_timeout"]);
$agent_contact = check_str($_POST["agent_contact"]);
$agent_status = check_str($_POST["agent_status"]);
$agent_logout = check_str($_POST["agent_logout"]);
$agent_no_answer_delay_time = check_str($_POST["agent_no_answer_delay_time"]);
$agent_max_no_answer = check_str($_POST["agent_max_no_answer"]);
$agent_wrap_up_time = check_str($_POST["agent_wrap_up_time"]);
$agent_reject_delay_time = check_str($_POST["agent_reject_delay_time"]);
$agent_busy_delay_time = check_str($_POST["agent_busy_delay_time"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$call_center_agent_uuid = check_str($_POST["call_center_agent_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($agent_name) == 0) { $msg .= "Please provide: Agent Name<br>\n"; }
//if (strlen($agent_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
//if (strlen($agent_call_timeout) == 0) { $msg .= "Please provide: Call Timeout<br>\n"; }
//if (strlen($agent_contact) == 0) { $msg .= "Please provide: Contact<br>\n"; }
//if (strlen($agent_status) == 0) { $msg .= "Please provide: Status<br>\n"; }
//if (strlen($agent_logout) == 0) { $msg .= "Please provide: Logout<br>\n"; }
//if (strlen($agent_no_answer_delay_time) == 0) { $msg .= "Please provide: No Answer Delay Time<br>\n"; }
//if (strlen($agent_max_no_answer) == 0) { $msg .= "Please provide: Max No Answer<br>\n"; }
//if (strlen($agent_wrap_up_time) == 0) { $msg .= "Please provide: Wrap Up Time<br>\n"; }
//if (strlen($agent_reject_delay_time) == 0) { $msg .= "Please provide: Reject Delay Time<br>\n"; }
//if (strlen($agent_busy_delay_time) == 0) { $msg .= "Please provide: Busy Delay Time<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//get and then set the complete agent_contact with the call_timeout and when necessary confirm
$tmp_confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1";
if(strstr($agent_contact, '}') === FALSE) {
//not found
if(stristr($agent_contact, 'sofia/gateway') === FALSE) {
//add the call_timeout
$tmp_agent_contact = "{call_timeout=".$agent_call_timeout."}".$agent_contact;
}
else {
//add the call_timeout and confirm
$tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last;
$tmp_agent_contact = "{".$tmp_confirm.",call_timeout=".$agent_call_timeout."}".$agent_contact;
}
}
else {
//found
if(stristr($agent_contact, 'sofia/gateway') === FALSE) {
//not found
if(stristr($agent_contact, 'call_timeout') === FALSE) {
//add the call_timeout
$tmp_pos = strrpos($agent_contact, "}");
$tmp_first = substr($agent_contact, 0, $tmp_pos);
$tmp_last = substr($agent_contact, $tmp_pos);
$tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last;
}
else {
//the string has the call timeout
$tmp_agent_contact = $agent_contact;
}
}
else {
//found
$tmp_pos = strrpos($agent_contact, "}");
$tmp_first = substr($agent_contact, 0, $tmp_pos);
$tmp_last = substr($agent_contact, $tmp_pos);
if(stristr($agent_contact, 'call_timeout') === FALSE) {
//add the call_timeout and confirm
$tmp_agent_contact = $tmp_first.','.$tmp_confirm.',call_timeout='.$agent_call_timeout.$tmp_last;
}
else {
//add confirm
$tmp_agent_contact = $tmp_first.','.$tmp_confirm.$tmp_last;
}
}
}
//set the user_status
$sql = "update v_users set ";
$sql .= "user_status = '".$agent_status."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$agent_name."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
//add the agent
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//add the agent using event socket
if ($fp) {
//add the agent
$cmd = "api callcenter_config agent add ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_type;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set contact
$cmd = "api callcenter_config agent set contact ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$tmp_agent_contact;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set status
$cmd = "api callcenter_config agent set status ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." '".$agent_status."'";
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set reject_delay_time
$cmd = "api callcenter_config agent set reject_delay_time ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_reject_delay_time;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set busy_delay_time
$cmd = "api callcenter_config agent set busy_delay_time ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_busy_delay_time;
$response = event_socket_request($fp, $cmd);
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
//add the agent to the database
$call_center_agent_uuid = uuid();
$sql = "insert into v_call_center_agents ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "call_center_agent_uuid, ";
$sql .= "agent_name, ";
$sql .= "agent_type, ";
$sql .= "agent_call_timeout, ";
$sql .= "agent_contact, ";
$sql .= "agent_status, ";
$sql .= "agent_logout, ";
$sql .= "agent_no_answer_delay_time, ";
$sql .= "agent_max_no_answer, ";
$sql .= "agent_wrap_up_time, ";
$sql .= "agent_reject_delay_time, ";
$sql .= "agent_busy_delay_time ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$call_center_agent_uuid', ";
$sql .= "'$agent_name', ";
$sql .= "'$agent_type', ";
$sql .= "'$agent_call_timeout', ";
$sql .= "'$agent_contact', ";
$sql .= "'$agent_status', ";
$sql .= "'$agent_logout', ";
$sql .= "'$agent_no_answer_delay_time', ";
$sql .= "'$agent_max_no_answer', ";
$sql .= "'$agent_wrap_up_time', ";
$sql .= "'$agent_reject_delay_time', ";
$sql .= "'$agent_busy_delay_time' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_call_center_xml();
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_agent.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_call_center_agents set ";
$sql .= "agent_name = '$agent_name', ";
$sql .= "agent_type = '$agent_type', ";
$sql .= "agent_call_timeout = '$agent_call_timeout', ";
$sql .= "agent_contact = '$agent_contact', ";
$sql .= "agent_status = '$agent_status', ";
$sql .= "agent_logout = '$agent_logout', ";
$sql .= "agent_no_answer_delay_time = '$agent_no_answer_delay_time', ";
$sql .= "agent_max_no_answer = '$agent_max_no_answer', ";
$sql .= "agent_wrap_up_time = '$agent_wrap_up_time', ";
$sql .= "agent_reject_delay_time = '$agent_reject_delay_time', ";
$sql .= "agent_busy_delay_time = '$agent_busy_delay_time' ";
$sql .= "where domain_uuid = '$domain_uuid'";
$sql .= "and call_center_agent_uuid = '$call_center_agent_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_call_center_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_agent.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$call_center_agent_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_agent_uuid = '$call_center_agent_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$agent_name = $row["agent_name"];
$agent_type = $row["agent_type"];
$agent_call_timeout = $row["agent_call_timeout"];
$agent_contact = $row["agent_contact"];
$agent_status = $row["agent_status"];
$agent_logout = $row["agent_logout"];
$agent_no_answer_delay_time = $row["agent_no_answer_delay_time"];
$agent_max_no_answer = $row["agent_max_no_answer"];
$agent_wrap_up_time = $row["agent_wrap_up_time"];
$agent_reject_delay_time = $row["agent_reject_delay_time"];
$agent_busy_delay_time = $row["agent_busy_delay_time"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//set default values
if (strlen($agent_type) == 0) { $agent_type = "callback"; }
if (strlen($agent_call_timeout) == 0) { $agent_call_timeout = 10; }
if (strlen($agent_max_no_answer) == 0) { $agent_max_no_answer = "3"; }
if (strlen($agent_wrap_up_time) == 0) { $agent_wrap_up_time = "10"; }
if (strlen($agent_no_answer_delay_time) == 0) { $agent_no_answer_delay_time = "10"; }
if (strlen($agent_reject_delay_time) == 0) { $agent_reject_delay_time = "10"; }
if (strlen($agent_busy_delay_time) == 0) { $agent_busy_delay_time = "60"; }
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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>Call Center Agent Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Call Center Agent Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_call_center_agent.php'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
//echo "Call Center agents settings.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Agent Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "order by username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select id=\"agent_name\" name=\"agent_name\" class='formfld'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$catcount = count($result);
foreach($result as $field) {
if ($field[username] == $agent_name) {
echo "<option value='".$field[username]."' selected='selected'>".$field[username]."</option>\n";
}
else {
echo "<option value='".$field[username]."'>".$field[username]."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo "<br />\n";
echo "Select the agents name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_type' maxlength='255' value=\"$agent_type\">\n";
echo "<br />\n";
echo "Enter the agent type.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Call Timeout:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_call_timeout' maxlength='255' value='$agent_call_timeout'>\n";
echo "<br />\n";
echo "Enter the call timeout.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Contact:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//switch_select_destination(select_type, select_label, select_name, select_value, select_style, action);
switch_select_destination("call_center_contact", "", "agent_contact", $agent_contact, "", "");
echo "<br />\n";
echo "Select the contact number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Status:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='agent_status'>\n";
echo " <option value=''></option>\n";
if ($agent_status == "Logged Out") {
echo " <option value='Logged Out' SELECTED >Logged Out</option>\n";
}
else {
echo " <option value='Logged Out'>Logged Out</option>\n";
}
if ($agent_status == "Available") {
echo " <option value='Available' SELECTED >Available</option>\n";
}
else {
echo " <option value='Available'>Available</option>\n";
}
if ($agent_status == "Available (On Demand)") {
echo " <option value='Available (On Demand)' SELECTED >Available (On Demand)</option>\n";
}
else {
echo " <option value='Available (On Demand)'>Available (On Demand)</option>\n";
}
if ($agent_status == "On Break") {
echo " <option value='On Break' SELECTED >On Break</option>\n";
}
else {
echo " <option value='On Break'>On Break</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select the agent status.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " No Answer Delay Time:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_no_answer_delay_time' maxlength='255' value='$agent_no_answer_delay_time'>\n";
echo "<br />\n";
echo "Enter the agent no answer delay time in seconds.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Max No Answer:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_max_no_answer' maxlength='255' value='$agent_max_no_answer'>\n";
echo "<br />\n";
echo "Enter max no answer.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Wrap Up Time:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_wrap_up_time' maxlength='255' value='$agent_wrap_up_time'>\n";
echo "<br />\n";
echo "Enter the wrap up time.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Reject Delay Time:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_reject_delay_time' maxlength='255' value='$agent_reject_delay_time'>\n";
echo "<br />\n";
echo "Enter the reject delay time.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Busy Delay Time:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_busy_delay_time' maxlength='255' value='$agent_busy_delay_time'>\n";
echo "<br />\n";
echo "Enter the agent busy delay time.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Agent Logout:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='agent_logout' maxlength='255' value='$agent_logout'>\n";
echo "<br />\n";
echo "Enter the auto agent logout time in 00:00 format. Requires a service to enforce the logout time.\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='call_center_agent_uuid' value='$call_center_agent_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,235 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_agents_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get the http post values and set them as php variables
if (count($_POST)>0) {
//include the dnd php class
include "includes/classes/do_not_disturb.php";
foreach($_POST['agents'] as $row) {
if (strlen($row['status']) > 0) {
//agent set status
if ($fp) {
//set the user_status
$sql = "update v_users set ";
$sql .= "user_status = '".$row['status']."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$row['name']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
//set the call center status
if ($row['status'] == "Do Not Disturb") {
//set the default dnd action
$dnd_action = "add";
//set the call center status to Logged Out
$cmd = "api callcenter_config agent set status ".$row['name']."@".$_SESSION['domains'][$domain_uuid]['domain_name']." 'Logged Out'";
}
else {
$cmd = "api callcenter_config agent set status ".$row['name']."@".$_SESSION['domains'][$domain_uuid]['domain_name']." '".$row['status']."'";
}
//echo $cmd."<br />\n";
$response = event_socket_request($fp, $cmd);
usleep(200);
}
//loop through the list of assigned extensions
foreach ($_SESSION['user']['extension'] as &$sub_row) {
$extension = $sub_row["user"];
//hunt_group information used to determine if this is an add or an update
$sql = "select * from v_hunt_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hunt_group_extension = '$extension' ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
foreach ($result2 as &$row2) {
if ($row2["hunt_group_type"] == 'dnd') {
$dnd_action = "update";
$dnd_uuid = $row2["hunt_group_uuid"];
}
}
unset ($prep_statement_2, $result2, $row2);
//add or update dnd
$dnd = new do_not_disturb;
//$dnd->debug = false;
$dnd->domain_uuid = $domain_uuid;
$dnd->dnd_uuid = $dnd_uuid;
$dnd->domain_name = $_SESSION['domain_name'];
$dnd->extension = $extension;
if ($row['status'] == "Do Not Disturb") {
$dnd->dnd_enabled = "true";
if ($dnd_action == "add") {
$dnd->dnd_add();
}
if ($dnd_action == "update") {
$dnd->dnd_update();
}
}
else {
//for other status disable dnd
if ($dnd_action == "update") {
$dnd->dnd_enabled = "false";
$dnd->dnd_update();
}
}
unset($dnd);
}
unset ($prep_statement);
}
}
}
//get the agent list from event socket
$switch_cmd = 'callcenter_config agent list';
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$agent_array = csv_to_named_array($event_socket_str, '|');
//set the status on the user_array by using the extension as the key
foreach ($agent_array as $row) {
if (count($_SESSION['domains']) == 1) {
//get the extension status from the call center agent list
preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
$extension = $matches[1];
$user_array[$extension]['username'] = $tmp[0];
if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
$user_array[$extension]['user_status'] = $row['status'];
}
} else {
$tmp = explode('@',$row["name"]);
if ($tmp[1] == $_SESSION['domain_name']) {
//get the extension status from the call center agent list
preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
$extension = $matches[1];
$user_array[$extension]['username'] = $tmp[0];
if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
$user_array[$extension]['user_status'] = $row['status'];
}
}
}
}
//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>Call Center Agent Status</b></td>\n";
echo "<td width='50%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_call_center_agent_status.php'\" value='Refresh'>\n";
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_call_center_queue.php'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "List all the call center agents with the option to change the status of one or more agents.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<form method='post' name='frm' action=''>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Agent</th>\n";
echo "<th>Status</th>\n";
echo "<th>Options</th>\n";
echo "<tr>\n";
$x = 0;
foreach($agent_array as $row) {
$tmp = explode('@',$row["name"]);
$agent_name = $tmp[0];
if ($tmp[1] == $_SESSION['domain_name']) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['status']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo " <input type='hidden' name='agents[".$x."][name]' id='agent_".$x."_name' value='".$agent_name."'>\n";
echo " <input type='radio' name='agents[".$x."][status]' id='agent_".$x."_status_no_change' value='' checked='checked'><label for='agent_".$x."_status_no_change'>No Change</label>\n";
echo " <input type='radio' name='agents[".$x."][status]' id='agent_".$x."_status_available' value='Available'><label for='agent_".$x."_status_available'>Available</label>\n";
echo " <input type='radio' name='agents[".$x."][status]' id='agent_".$x."_status_logged_out' value='Logged Out'><label for='agent_".$x."_status_logged_out'>Logged Out</label>\n";
echo " <input type='radio' name='agents[".$x."][status]' id='agent_".$x."_status_on_break' value='On Break'><label for='agent_".$x."_status_on_break'>On Break</label>\n";
echo " <input type='radio' name='agents[".$x."][status]' id='agent_".$x."_status_dnd' value='Do Not Disturb'><label for='agent_".$x."_status_dnd'>DND</label>\n";
echo " </td>\n";
echo "</tr>\n";
}
if ($c==0) { $c=1; } else { $c=0; }
$x++;
} //end foreach
unset($sql, $result, $row_count);
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";
echo " <br />\n";
echo " <input type='submit' name='submit' class='btn' value='Update Status'>\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 "</form>\n";
echo "<br><br>";
//show the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,194 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_queues_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get http variables and set as php variables
$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>Call Center Queue</b></td>\n";
echo "<td width='50%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_call_center_agent.php'\" value='Agents'>\n";
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_call_center_tier.php'\" value='Tiers'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "List of queues for the call center.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$sql = "";
$sql .= "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "";
$sql .= "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$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('queue_name', 'Queue Name', $order_by, $order);
echo th_order_by('queue_extension', 'Extension', $order_by, $order);
echo th_order_by('queue_strategy', 'Strategy', $order_by, $order);
//echo th_order_by('queue_moh_sound', 'Music On Hold', $order_by, $order);
//echo th_order_by('queue_record_template', 'Record Template', $order_by, $order);
//echo th_order_by('queue_time_base_score', 'Time Base Score', $order_by, $order);
//echo th_order_by('queue_max_wait_time', 'Max Wait Time', $order_by, $order);
//echo th_order_by('queue_max_wait_time_with_no_agent', 'Max Wait Time With No Agent', $order_by, $order);
echo th_order_by('queue_tier_rules_apply', 'Tier Rules Apply', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_second', 'Tier Rule Wait Second', $order_by, $order);
//echo th_order_by('queue_tier_rule_no_agent_no_wait', 'Tier Rule No Agent No Wait', $order_by, $order);
//echo th_order_by('queue_discard_abandoned_after', 'Discard Abandoned After', $order_by, $order);
//echo th_order_by('queue_abandoned_resume_allowed', 'Abandoned Resume Allowed', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_multiply_level', 'Tier Rule Wait Multiply Level', $order_by, $order);
echo th_order_by('queue_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('call_center_queues_add')) {
echo " <a href='v_call_center_queue_edit.php' alt='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[queue_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_extension]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_strategy]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_moh_sound]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_record_template]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_time_base_score]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time_with_no_agent]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rules_apply]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_second]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_no_agent_no_wait]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_discard_abandoned_after]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_abandoned_resume_allowed]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_multiply_level]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_description]."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('call_center_queues_edit')) {
echo " <a href='v_call_center_queue_edit.php?id=".$row[call_center_queue_uuid]."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('call_center_queues_delete')) {
echo " <a href='v_call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\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='17' 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_center_queues_add')) {
echo " <a href='v_call_center_queue_edit.php' alt='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>";
//show the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,93 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_queues_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET) > 0) {
$id = check_str($_GET["id"]);
}
if (strlen($id) > 0) {
//get the dialplan uuid
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_queue_uuid = '$id' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
$dialplan_uuid = $row['dialplan_uuid'];
}
//delete the call center queue
$sql = "delete from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//delete the dialplan entry
$sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
//echo $sql."<br>\n";
$db->query($sql);
unset($sql);
//delete the dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
//echo $sql."<br>\n";
$db->query($sql);
unset($sql);
//syncrhonize configuration
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_queue.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,633 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_queues_add') || permission_exists('call_center_queues_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$call_center_queue_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
//$domain_uuid = check_str($_POST["domain_uuid"]);
$queue_name = check_str($_POST["queue_name"]);
$queue_extension = check_str($_POST["queue_extension"]);
$queue_strategy = check_str($_POST["queue_strategy"]);
$queue_moh_sound = check_str($_POST["queue_moh_sound"]);
$queue_record_template = check_str($_POST["queue_record_template"]);
$queue_time_base_score = check_str($_POST["queue_time_base_score"]);
$queue_max_wait_time = check_str($_POST["queue_max_wait_time"]);
$queue_max_wait_time_with_no_agent = check_str($_POST["queue_max_wait_time_with_no_agent"]);
$queue_tier_rules_apply = check_str($_POST["queue_tier_rules_apply"]);
$queue_tier_rule_wait_second = check_str($_POST["queue_tier_rule_wait_second"]);
$queue_tier_rule_wait_multiply_level = check_str($_POST["queue_tier_rule_wait_multiply_level"]);
$queue_tier_rule_no_agent_no_wait = check_str($_POST["queue_tier_rule_no_agent_no_wait"]);
$queue_timeout_action = check_str($_POST["queue_timeout_action"]);
$queue_discard_abandoned_after = check_str($_POST["queue_discard_abandoned_after"]);
$queue_abandoned_resume_allowed = check_str($_POST["queue_abandoned_resume_allowed"]);
$queue_cid_prefix = check_str($_POST["queue_cid_prefix"]);
$queue_description = check_str($_POST["queue_description"]);
//remove invalid characters
$queue_cid_prefix = str_replace(":", "-", $queue_cid_prefix);
$queue_cid_prefix = str_replace("\"", "", $queue_cid_prefix);
$queue_cid_prefix = str_replace("@", "", $queue_cid_prefix);
$queue_cid_prefix = str_replace("\\", "", $queue_cid_prefix);
$queue_cid_prefix = str_replace("/", "", $queue_cid_prefix);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$call_center_queue_uuid = check_str($_POST["call_center_queue_uuid"]);
}
//check for all required data
if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
if (strlen($queue_name) == 0) { $msg .= "Please provide: Queue Name<br>\n"; }
if (strlen($queue_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
if (strlen($queue_strategy) == 0) { $msg .= "Please provide: Strategy<br>\n"; }
if (strlen($queue_moh_sound) == 0) { $msg .= "Please provide: Music on Hold<br>\n"; }
//if (strlen($queue_record_template) == 0) { $msg .= "Please provide: Record Template<br>\n"; }
//if (strlen($queue_time_base_score) == 0) { $msg .= "Please provide: Time Base Score<br>\n"; }
//if (strlen($queue_max_wait_time) == 0) { $msg .= "Please provide: Max Wait Time<br>\n"; }
//if (strlen($queue_max_wait_time_with_no_agent) == 0) { $msg .= "Please provide: Max Wait Time with no Agent<br>\n"; }
//if (strlen($queue_tier_rules_apply) == 0) { $msg .= "Please provide: Tier Rules Apply<br>\n"; }
//if (strlen($queue_tier_rule_wait_second) == 0) { $msg .= "Please provide: Tier Rule Wait Second<br>\n"; }
//if (strlen($queue_tier_rule_wait_multiply_level) == 0) { $msg .= "Please provide: Tier Rule Wait Multiply Level<br>\n"; }
//if (strlen($queue_tier_rule_no_agent_no_wait) == 0) { $msg .= "Please provide: Tier Rule No Agent No Wait<br>\n"; }
//if (strlen($queue_timeout_action) == 0) { $msg .= "Please provide: Timeout Action<br>\n"; }
//if (strlen($queue_discard_abandoned_after) == 0) { $msg .= "Please provide: Discard Abandoned After<br>\n"; }
//if (strlen($queue_abandoned_resume_allowed) == 0) { $msg .= "Please provide: Abandoned Resume Allowed<br>\n"; }
//if (strlen($queue_cid_prefix) == 0) { $msg .= "Please provide: Caller ID Prefix<br>\n"; }
//if (strlen($queue_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
//add the call center queue
$call_center_queue_uuid = uuid();
$sql = "insert into v_call_center_queues ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "call_center_queue_uuid, ";
$sql .= "queue_name, ";
$sql .= "queue_extension, ";
$sql .= "queue_strategy, ";
$sql .= "queue_moh_sound, ";
$sql .= "queue_record_template, ";
$sql .= "queue_time_base_score, ";
$sql .= "queue_max_wait_time, ";
$sql .= "queue_max_wait_time_with_no_agent, ";
$sql .= "queue_tier_rules_apply, ";
$sql .= "queue_tier_rule_wait_second, ";
$sql .= "queue_tier_rule_wait_multiply_level, ";
$sql .= "queue_tier_rule_no_agent_no_wait, ";
$sql .= "queue_timeout_action, ";
$sql .= "queue_discard_abandoned_after, ";
$sql .= "queue_abandoned_resume_allowed, ";
$sql .= "queue_cid_prefix, ";
$sql .= "queue_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$call_center_queue_uuid', ";
$sql .= "'$queue_name', ";
$sql .= "'$queue_extension', ";
$sql .= "'$queue_strategy', ";
$sql .= "'$queue_moh_sound', ";
$sql .= "'$queue_record_template', ";
$sql .= "'$queue_time_base_score', ";
$sql .= "'$queue_max_wait_time', ";
$sql .= "'$queue_max_wait_time_with_no_agent', ";
$sql .= "'$queue_tier_rules_apply', ";
$sql .= "'$queue_tier_rule_wait_second', ";
$sql .= "'$queue_tier_rule_wait_multiply_level', ";
$sql .= "'$queue_tier_rule_no_agent_no_wait', ";
$sql .= "'$queue_timeout_action', ";
$sql .= "'$queue_discard_abandoned_after', ";
$sql .= "'$queue_abandoned_resume_allowed', ";
$sql .= "'$queue_cid_prefix', ";
$sql .= "'$queue_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize the configuration
save_call_center_xml();
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_queue.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
//update the call center queue
$sql = "update v_call_center_queues set ";
$sql .= "queue_name = '$queue_name', ";
$sql .= "queue_extension = '$queue_extension', ";
$sql .= "queue_strategy = '$queue_strategy', ";
$sql .= "queue_moh_sound = '$queue_moh_sound', ";
$sql .= "queue_record_template = '$queue_record_template', ";
$sql .= "queue_time_base_score = '$queue_time_base_score', ";
$sql .= "queue_max_wait_time = '$queue_max_wait_time', ";
$sql .= "queue_max_wait_time_with_no_agent = '$queue_max_wait_time_with_no_agent', ";
$sql .= "queue_tier_rules_apply = '$queue_tier_rules_apply', ";
$sql .= "queue_tier_rule_wait_second = '$queue_tier_rule_wait_second', ";
$sql .= "queue_tier_rule_wait_multiply_level = '$queue_tier_rule_wait_multiply_level', ";
$sql .= "queue_tier_rule_no_agent_no_wait = '$queue_tier_rule_no_agent_no_wait', ";
$sql .= "queue_timeout_action = '$queue_timeout_action', ";
$sql .= "queue_discard_abandoned_after = '$queue_discard_abandoned_after', ";
$sql .= "queue_abandoned_resume_allowed = '$queue_abandoned_resume_allowed', ";
$sql .= "queue_cid_prefix = '$queue_cid_prefix', ";
$sql .= "queue_description = '$queue_description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_queue_uuid = '$call_center_queue_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize the configuration
save_call_center_xml();
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_queue.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$call_center_queue_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_queue_uuid = '$call_center_queue_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$queue_name = $row["queue_name"];
$queue_extension = $row["queue_extension"];
$queue_strategy = $row["queue_strategy"];
$queue_moh_sound = $row["queue_moh_sound"];
$queue_record_template = $row["queue_record_template"];
$queue_time_base_score = $row["queue_time_base_score"];
$queue_max_wait_time = $row["queue_max_wait_time"];
$queue_max_wait_time_with_no_agent = $row["queue_max_wait_time_with_no_agent"];
$queue_timeout_action = $row["queue_timeout_action"];
$queue_tier_rules_apply = $row["queue_tier_rules_apply"];
$queue_tier_rule_wait_second = $row["queue_tier_rule_wait_second"];
$queue_tier_rule_wait_multiply_level = $row["queue_tier_rule_wait_multiply_level"];
$queue_tier_rule_no_agent_no_wait = $row["queue_tier_rule_no_agent_no_wait"];
$queue_discard_abandoned_after = $row["queue_discard_abandoned_after"];
$queue_abandoned_resume_allowed = $row["queue_abandoned_resume_allowed"];
$queue_cid_prefix = $row["queue_cid_prefix"];
$queue_description = $row["queue_description"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//set default values
if (strlen($queue_strategy) == 0) { $queue_strategy = "longest-idle-agent"; }
if (strlen($queue_moh_sound) == 0) { $queue_moh_sound = "\$\${hold_music}"; }
if (strlen($queue_time_base_score) == 0) { $queue_time_base_score = "system"; }
if (strlen($queue_max_wait_time) == 0) { $queue_max_wait_time = "0"; }
if (strlen($queue_max_wait_time_with_no_agent) == 0) { $queue_max_wait_time_with_no_agent = "0"; }
if (strlen($queue_tier_rules_apply) == 0) { $queue_tier_rules_apply = "false"; }
if (strlen($queue_tier_rule_wait_second) == 0) { $queue_tier_rule_wait_second = "300"; }
if (strlen($queue_tier_rule_wait_multiply_level) == 0) { $queue_tier_rule_wait_multiply_level = "true"; }
if (strlen($queue_tier_rule_no_agent_no_wait) == 0) { $queue_tier_rule_no_agent_no_wait = "false"; }
if (strlen($queue_discard_abandoned_after) == 0) { $queue_discard_abandoned_after = "60"; }
if (strlen($queue_abandoned_resume_allowed) == 0) { $queue_abandoned_resume_allowed = "false"; }
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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>Call Center Queue Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Call Center Queue Edit</b></td>\n";
}
echo "<td width='70%' align='right'>\n";
if ($action == "update") {
echo " <input type='button' class='btn' value='View' onclick=\"document.location.href='".PROJECT_PATH."/app/call_center_active/v_call_center_active.php?queue_name=$queue_name';\" />\n";
echo " <input type='button' class='btn' value='Load' onclick=\"document.location.href='cmd.php?cmd=api+callcenter_config+queue+load+$queue_name@".$_SESSION['domain_name']."';\" />\n";
echo " <input type='button' class='btn' value='Unload' onclick=\"document.location.href='cmd.php?cmd=api+callcenter_config+queue+unload+$queue_name@".$_SESSION['domain_name']."';\" />\n";
echo " <input type='button' class='btn' value='Reload' onclick=\"document.location.href='cmd.php?cmd=api+callcenter_config+queue+reload+$queue_name@".$_SESSION['domain_name']."';\" />\n";
}
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_call_center_queue.php'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
//echo "Call Center queue settings.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Queue Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_name' maxlength='255' value=\"$queue_name\">\n";
echo "<br />\n";
echo "Enter the queue name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Extension:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_extension' maxlength='255' value=\"$queue_extension\">\n";
echo "<br />\n";
echo "Enter the extension number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Strategy:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='queue_strategy'>\n";
echo " <option value=''></option>\n";
if ($queue_strategy == "ring-all") {
echo " <option value='ring-all' selected='selected' >ring-all</option>\n";
}
else {
echo " <option value='ring-all'>ring-all</option>\n";
}
if ($queue_strategy == "longest-idle-agent") {
echo " <option value='longest-idle-agent' selected='selected' >longest-idle-agent</option>\n";
}
else {
echo " <option value='longest-idle-agent'>longest-idle-agent</option>\n";
}
if ($queue_strategy == "round-robin") {
echo " <option value='round-robin' selected='selected'>round-robin</option>\n";
}
else {
echo " <option value='round-robin'>round-robin</option>\n";
}
if ($queue_strategy == "top-down") {
echo " <option value='top-down' selected='selected'>top-down</option>\n";
}
else {
echo " <option value='top-down'>top-down</option>\n";
}
if ($queue_strategy == "agent-with-least-talk-time") {
echo " <option value='agent-with-least-talk-time' selected='selected'>agent-with-least-talk-time</option>\n";
}
else {
echo " <option value='agent-with-least-talk-time'>agent-with-least-talk-time</option>\n";
}
if ($queue_strategy == "agent-with-fewest-calls") {
echo " <option value='agent-with-fewest-calls' selected='selected'>agent-with-fewest-calls</option>\n";
}
else {
echo " <option value='agent-with-fewest-calls'>agent-with-fewest-calls</option>\n";
}
if ($queue_strategy == "sequentially-by-agent-order") {
echo " <option value='sequentially-by-agent-order' selected='selected'>sequentially-by-agent-order</option>\n";
}
else {
echo " <option value='sequentially-by-agent-order'>sequentially-by-agent-order</option>\n";
}
if ($queue_strategy == "sequentially-by-next-agent-order") {
echo " <option value='sequentially-by-next-agent-order' selected='selected'>sequentially-by-next-agent-order</option>\n";
}
else {
echo " <option value='sequentially-by-next-agent-order'>sequentially-by-next-agent-order</option>\n";
}
if ($queue_strategy == "random") {
echo " <option value='random' selected='selected'>random</option>\n";
}
else {
echo " <option value='random'>random</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Enter the queue strategy.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Music on Hold:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_moh_sound' maxlength='255' value=\"$queue_moh_sound\">\n";
echo "<br />\n";
echo "Enter the music on hold information.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Record Template:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_record_template' maxlength='255' value=\"$queue_record_template\">\n";
echo "<br />\n";
echo "Enter a record template. \$\${base_dir}/recordings/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.wav\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Time Base Score:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='queue_time_base_score'>\n";
echo " <option value=''></option>\n";
if ($queue_time_base_score == "system") {
echo " <option value='system' selected='selected' >system</option>\n";
}
else {
echo " <option value='system'>system</option>\n";
}
if ($queue_time_base_score == "queue") {
echo " <option value='queue' selected='selected' >queue</option>\n";
}
else {
echo " <option value='queue'>queue</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Enter the time base score.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Max Wait Time:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_max_wait_time' maxlength='255' value='$queue_max_wait_time'>\n";
echo "<br />\n";
echo "Enter the max wait time.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Max Wait Time with no Agent:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_max_wait_time_with_no_agent' maxlength='255' value='$queue_max_wait_time_with_no_agent'>\n";
echo "<br />\n";
echo "Enter the max wait time with no agent.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Timeout Action:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//switch_select_destination(select_type, select_label, select_name, select_value, select_style, action);
switch_select_destination("dialplan", "", "queue_timeout_action", $queue_timeout_action, "", "");
echo "<br />\n";
echo "Set the action to perform when the max wait time is reached.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Tier Rules Apply:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='queue_tier_rules_apply'>\n";
echo " <option value=''></option>\n";
if ($queue_tier_rules_apply == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($queue_tier_rules_apply == "false") {
echo " <option value='false' selected='selected' >false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Set the tier rule rules apply to true or false.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Tier Rule Wait Second:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_tier_rule_wait_second' maxlength='255' value='$queue_tier_rule_wait_second'>\n";
echo "<br />\n";
echo "Enter the tier rule wait seconds.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Tier Rule Wait Multiply Level:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='queue_tier_rule_wait_multiply_level'>\n";
echo " <option value=''></option>\n";
if ($queue_tier_rule_wait_multiply_level == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($queue_tier_rule_wait_multiply_level == "false") {
echo " <option value='false' selected='selected' >false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Set the tier rule wait multiply level to true or false.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Tier Rule No Agent No Wait:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='queue_tier_rule_no_agent_no_wait'>\n";
echo " <option value=''></option>\n";
if ($queue_tier_rule_no_agent_no_wait == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($queue_tier_rule_no_agent_no_wait == "false") {
echo " <option value='false' selected='selected' >false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Enter the tier rule no agent no wait.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Discard Abandoned After:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_discard_abandoned_after' maxlength='255' value='$queue_discard_abandoned_after'>\n";
echo "<br />\n";
echo "Set the discard abandoned after seconds.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Abandoned Resume Allowed:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='queue_abandoned_resume_allowed'>\n";
echo " <option value=''></option>\n";
if ($queue_abandoned_resume_allowed == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($queue_abandoned_resume_allowed == "false") {
echo " <option value='false' selected='selected' >false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Set the abandoned resume allowed to true or false.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " CID Prefix:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_cid_prefix' maxlength='255' value='$queue_cid_prefix'>\n";
echo "<br />\n";
echo "Set a prefix on the caller ID name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Description:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='queue_description' maxlength='255' value=\"$queue_description\">\n";
echo "<br />\n";
echo "Enter the description.\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='call_center_queue_uuid' value='$call_center_queue_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,177 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_tiers_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get http variables and set as php variables
$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>Call Center Tier List</b></td>\n";
echo "<td width='50%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='v_call_center_queue.php'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "List all tiers. Tiers assign agents to queues.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$sql = "";
$sql .= "select * from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "";
$sql .= "select * from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by) == 0) {
$order_by = 'queue_name';
$order = 'asc';
}
else {
$sql .= "order by $order_by $order ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$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('agent_name', 'Agent Name', $order_by, $order);
echo th_order_by('queue_name', 'Queue Name', $order_by, $order);
echo th_order_by('tier_level', 'Tier Level', $order_by, $order);
echo th_order_by('tier_position', 'Tier Position', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('call_center_tiers_add')) {
echo " <a href='v_call_center_tier_edit.php' alt='add'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count == 0) { //no results
}
else { //received results
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[agent_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[tier_level]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[tier_position]."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('call_center_tiers_edit')) {
echo " <a href='v_call_center_tier_edit.php?id=".$row[call_center_tier_uuid]."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('call_center_tiers_delete')) {
echo " <a href='v_call_center_tier_delete.php?id=".$row[call_center_tier_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\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='6' 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_center_tiers_add')) {
echo " <a href='v_call_center_tier_edit.php' alt='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>";
//show the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,89 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_tiers_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//get the agent details
$sql = "";
$sql .= "select * from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_tier_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$agent_name = $row["agent_name"];
$queue_name = $row["queue_name"];
break; //limit to 1 row
}
unset ($prep_statement);
//delete the agent from the freeswitch
//get the domain using the $domain_uuid
$tmp_domain = $_SESSION['domains'][$domain_uuid]['domain_name'];
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//delete the agent over event socket
if ($fp) {
//callcenter_config tier del [queue_name] [agent_name]
$cmd = "api callcenter_config tier del ".$queue_name."@".$tmp_domain." ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
$response = event_socket_request($fp, $cmd);
}
//delete the tier from the database
if (strlen($id)>0) {
$sql = "";
$sql .= "delete from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_tier_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_tier.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,437 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_tiers_add') || permission_exists('call_center_tiers_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$call_center_tier_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$agent_name = check_str($_POST["agent_name"]);
$queue_name = check_str($_POST["queue_name"]);
$tier_level = check_str($_POST["tier_level"]);
$tier_position = check_str($_POST["tier_position"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$call_center_tier_uuid = check_str($_POST["call_center_tier_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($agent_name) == 0) { $msg .= "Please provide: Agent Name<br>\n"; }
//if (strlen($queue_name) == 0) { $msg .= "Please provide: Queue Name<br>\n"; }
//if (strlen($tier_level) == 0) { $msg .= "Please provide: Tier Level<br>\n"; }
//if (strlen($tier_position) == 0) { $msg .= "Please provide: Tier Position<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add the agent
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//add the agent using event socket
if ($fp) {
//get the domain using the $domain_uuid
$tmp_domain = $_SESSION['domains'][$domain_uuid]['domain_name'];
//syntax
//callcenter_config tier add [queue_name] [agent_name] [level] [position]
//callcenter_config tier set state [queue_name] [agent_name] [state]
//callcenter_config tier set level [queue_name] [agent_name] [level]
//callcenter_config tier set position [queue_name] [agent_name] [position]
//add the agent
$cmd = "api callcenter_config tier add ".$queue_name."@".$tmp_domain." ".$agent_name."@".$tmp_domain." ".$tier_level." ".$tier_position;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set level
$cmd = "api callcenter_config tier set level ".$queue_name."@".$tmp_domain." ".$agent_name."@".$tmp_domain." ".$tier_level;
$response = event_socket_request($fp, $cmd);
usleep(200);
//agent set position
$cmd = "api callcenter_config tier set position ".$queue_name."@".$tmp_domain." ".$agent_name."@".$tmp_domain." ".$tier_position;
$response = event_socket_request($fp, $cmd);
usleep(200);
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$call_center_tier_uuid = uuid();
$sql = "insert into v_call_center_tiers ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "call_center_tier_uuid, ";
$sql .= "agent_name, ";
$sql .= "queue_name, ";
$sql .= "tier_level, ";
$sql .= "tier_position ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$call_center_tier_uuid', ";
$sql .= "'$agent_name', ";
$sql .= "'$queue_name', ";
$sql .= "'$tier_level', ";
$sql .= "'$tier_position' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_call_center_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_tier.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_call_center_tiers set ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "agent_name = '$agent_name', ";
$sql .= "queue_name = '$queue_name', ";
$sql .= "tier_level = '$tier_level', ";
$sql .= "tier_position = '$tier_position' ";
$sql .= "where call_center_tier_uuid = '$call_center_tier_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_call_center_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_center_tier.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$call_center_tier_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_tier_uuid = '$call_center_tier_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$agent_name = $row["agent_name"];
$queue_name = $row["queue_name"];
$tier_level = $row["tier_level"];
$tier_position = $row["tier_position"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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>Call Center Tier Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Call Center Tier Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_call_center_tier.php'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "List all tiers. Tiers assign agents to queues.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Agent Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "order by username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select id=\"agent_name\" name=\"agent_name\" class='formfld'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$catcount = count($result);
foreach($result as $field) {
if ($field[username] == $agent_name) {
echo "<option value='".$field['username']."' selected='selected'>".$field['username']."</option>\n";
}
else {
echo "<option value='".$field['username']."'>".$field['username']."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo "<br />\n";
echo "Select the agent name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Queue Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "order by queue_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select id=\"queue_name\" name=\"queue_name\" class='formfld'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$catcount = count($result);
foreach($result as $field) {
if ($field[queue_name] == $queue_name) {
echo "<option value='".$field['queue_name']."' selected='selected'>".$field['queue_name']."</option>\n";
}
else {
echo "<option value='".$field['queue_name']."'>".$field['queue_name']."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo "<br />\n";
echo "Select the queue name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Tier Level:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='tier_level'>\n";
//echo " <option value=''></option>\n";
if ($tier_level == "1") {
echo " <option value='1' selected='selected' >1</option>\n";
}
else {
echo " <option value='1'>1</option>\n";
}
if ($tier_level == "2") {
echo " <option value='2' selected='selected' >2</option>\n";
}
else {
echo " <option value='2'>2</option>\n";
}
if ($tier_level == "3") {
echo " <option value='3' selected='selected' >3</option>\n";
}
else {
echo " <option value='3'>3</option>\n";
}
if ($tier_level == "4") {
echo " <option value='4' selected='selected' >4</option>\n";
}
else {
echo " <option value='4'>4</option>\n";
}
if ($tier_level == "5") {
echo " <option value='5' selected='selected' >5</option>\n";
}
else {
echo " <option value='5'>5</option>\n";
}
if ($tier_level == "6") {
echo " <option value='6' selected='selected' >6</option>\n";
}
else {
echo " <option value='6'>6</option>\n";
}
if ($tier_level == "7") {
echo " <option value='7' selected='selected' >7</option>\n";
}
else {
echo " <option value='7'>7</option>\n";
}
if ($tier_level == "8") {
echo " <option value='8' selected='selected' >8</option>\n";
}
else {
echo " <option value='8'>8</option>\n";
}
if ($tier_level == "9") {
echo " <option value='9' selected='selected' >9</option>\n";
}
else {
echo " <option value='9'>9</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select the tier level.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Tier Position:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='tier_position'>\n";
//echo " <option value=''></option>\n";
if ($tier_position == "1") {
echo " <option value='1' selected='selected' >1</option>\n";
}
else {
echo " <option value='1'>1</option>\n";
}
if ($tier_position == "2") {
echo " <option value='2' selected='selected' >2</option>\n";
}
else {
echo " <option value='2'>2</option>\n";
}
if ($tier_position == "3") {
echo " <option value='3' selected='selected' >3</option>\n";
}
else {
echo " <option value='3'>3</option>\n";
}
if ($tier_position == "4") {
echo " <option value='4' selected='selected' >4</option>\n";
}
else {
echo " <option value='4'>4</option>\n";
}
if ($tier_position == "5") {
echo " <option value='5' selected='selected' >5</option>\n";
}
else {
echo " <option value='5'>5</option>\n";
}
if ($tier_position == "6") {
echo " <option value='6' selected='selected' >6</option>\n";
}
else {
echo " <option value='6'>6</option>\n";
}
if ($tier_position == "7") {
echo " <option value='7' selected='selected' >7</option>\n";
}
else {
echo " <option value='7'>7</option>\n";
}
if ($tier_position == "8") {
echo " <option value='8' selected='selected' >8</option>\n";
}
else {
echo " <option value='8'>8</option>\n";
}
if ($tier_position == "9") {
echo " <option value='9' selected='selected' >9</option>\n";
}
else {
echo " <option value='9'>9</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select the tier position.\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='call_center_tier_uuid' value='$call_center_tier_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

57
app/call_center/v_cmd.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_queues_add') || permission_exists('call_center_queues_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
$cmd = $_GET['cmd'];
$rdr = $_GET['rdr'];
//connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$response = event_socket_request($fp, 'api reloadxml');
$response = event_socket_request($fp, $cmd);
fclose($fp);
}
else {
$response = '';
}
if ($rdr == "false") {
//redirect false
echo $response;
}
else {
header("Location: v_call_center_queue.php?savemsg=".urlencode($response));
}
?>

View File

@@ -0,0 +1,26 @@
<?php
//application details
$apps[$x]['name'] = "Call Center Active";
$apps[$x]['uuid'] = '3f159f62-ca2d-41b8-b3f0-c5519cebbc5a';
$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'] = 'Shows active calls, and agents in the call center queue.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Active Call Center';
$apps[$x]['menu'][0]['uuid'] = '7fb0dd87-e984-9980-c512-2c76b887aeb2';
$apps[$x]['menu'][0]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/call_center_active/v_call_center_queue.php';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'call_center_active_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
?>

View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,122 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name];
//get the header
require_once "includes/header.php";
?><script type="text/javascript">
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_response').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = 'v_call_center_active_inc.php?queue_name=<?php echo $queue_name; ?>';
new loadXmlHttp(url, 'ajax_response');
<?php
if (strlen($_SESSION["ajax_refresh_rate"]) == 0) { $_SESSION["ajax_refresh_rate"] = "1777"; }
echo "setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, ".$_SESSION["ajax_refresh_rate"].");";
?>
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
function send_cmd(url) {
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
//document.getElementById('cmd_response').innerHTML=xmlhttp.responseText;
}
</script>
<?php
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <div id=\"ajax_response\">\n";
echo " </div>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,302 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name].'@'. $_SESSION['domains'][$domain_uuid]['domain_name'];
//convert the string to a named array
function str_to_named_array($tmp_str, $tmp_delimiter) {
$tmp_array = explode ("\n", $tmp_str);
$result = '';
if (trim(strtoupper($tmp_array[0])) != "+OK") {
$tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]);
$x = 0;
foreach ($tmp_array as $row) {
if ($x > 0) {
$tmp_field_value_array = explode ($tmp_delimiter, $tmp_array[$x]);
$y = 0;
foreach ($tmp_field_value_array as $tmp_value) {
$tmp_name = $tmp_field_name_array[$y];
if (trim(strtoupper($tmp_value)) != "+OK") {
$result[$x][$tmp_name] = $tmp_value;
}
$y++;
}
}
$x++;
}
unset($row);
}
return $result;
}
//alternate the color of the row
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//create an event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get the call center queue, agent and tiers list
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//get the queue list
//send the event socket command and get the response
//callcenter_config queue list members [queue_name]
$switch_cmd = 'callcenter_config queue list members '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//show the title
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>".ucfirst($_GET[queue_name])." Queue</b><br />\n";
echo " Shows a list of callers in the queue.<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Time</th>\n";
//echo "<th>System</th>\n";
echo "<th>Name</th>\n";
echo "<th>Number</th>\n";
echo "<th>Status</th>\n";
if (if_group("admin") || if_group("superadmin")) {
echo "<th>Options</th>\n";
}
echo "</tr>\n";
foreach ($result as $row) {
$switch_cmd = 'uuid_exists '.$row['session_uuid'];
if (trim(event_socket_request($fp, 'api '.$switch_cmd)) == "true") {
$queue = $row['queue'];
$system = $row['system'];
$uuid = $row['uuid'];
$session_uuid = $row['session_uuid'];
$caller_number = $row['caller_number'];
$caller_name = $row['caller_name'];
$system_epoch = $row['system_epoch'];
$joined_epoch = $row['joined_epoch'];
$rejoined_epoch = $row['rejoined_epoch'];
$bridge_epoch = $row['bridge_epoch'];
$abandoned_epoch = $row['abandoned_epoch'];
$base_score = $row['base_score'];
$skill_score = $row['skill_score'];
$serving_agent = $row['serving_agent'];
$serving_system = $row['serving_system'];
$state = $row['state'];
$joined_seconds = time() - $joined_epoch;
$joined_length_hour = floor($joined_seconds/3600);
$joined_length_min = floor($joined_seconds/60 - ($joined_length_hour * 60));
$joined_length_sec = $joined_seconds - (($joined_length_hour * 3600) + ($joined_length_min * 60));
$joined_length_min = sprintf("%02d", $joined_length_min);
$joined_length_sec = sprintf("%02d", $joined_length_sec);
$joined_length = $joined_length_hour.':'.$joined_length_min.':'.$joined_length_sec;
//$system_seconds = time() - $system_epoch;
//$system_length_hour = floor($system_seconds/3600);
//$system_length_min = floor($system_seconds/60 - ($system_length_hour * 60));
//$system_length_sec = $system_seconds - (($system_length_hour * 3600) + ($system_length_min * 60));
//$system_length_min = sprintf("%02d", $system_length_min);
//$system_length_sec = sprintf("%02d", $system_length_sec);
//$system_length = $system_length_hour.':'.$system_length_min.':'.$system_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$joined_length."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$system_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_name."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_number."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
if (if_group("admin") || if_group("superadmin")) {
echo "<td valign='top' class='".$row_style[$c]."'>";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('v_call_center_exec.php?cmd=originate+user/".$_SESSION['user']['extension']['user'][0]."+%26eavesdrop(".$uuid.")');}\">eavesdrop</a>&nbsp;\n";
echo "</td>";
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end if uuid_exists
}
echo "</table>\n";
//add vertical spacing
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
//get the agent list
//show the title
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Agents</b><br />\n";
echo " List all the agents.<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
//send the event socket command and get the response
//callcenter_config queue list tiers [queue_name] |
$switch_cmd = 'callcenter_config queue list tiers '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//prepare the result for array_multisort
$x = 0;
foreach ($result as $row) {
$tier_result[$x]['level'] = $row['level'];
$tier_result[$x]['position'] = $row['position'];
$tier_result[$x]['agent'] = $row['agent'];
$tier_result[$x]['state'] = trim($row['state']);
$tier_result[$x]['queue'] = $row['queue'];
$x++;
}
//sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
array_multisort($tier_result, SORT_ASC);
//send the event socket command and get the response
//callcenter_config queue list agents [queue_name] [status] |
$switch_cmd = 'callcenter_config queue list agents '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$agent_result = str_to_named_array($event_socket_str, '|');
//list the agents
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Name</th>\n";
echo "<th>Contact</th>\n";
echo "<th>Status</th>\n";
echo "<th>State</th>\n";
//echo "<th>Offered Call</th>\n";
echo "<th>Status Change</th>\n";
echo "<th>Missed</th>\n";
echo "<th>Answered</th>\n";
echo "<th>Tier State</th>\n";
echo "<th>Tier Level</th>\n";
echo "<th>Tier Position</th>\n";
echo "</tr>\n";
foreach ($tier_result as $tier_row) {
//$queue = $tier_row['queue'];
//$queue = str_replace('@'.$_SESSION['domain_name'], '', $queue);
$agent = $tier_row['agent'];
//$agent = str_replace('@'.$_SESSION['domain_name'], '', $agent);
$tier_state = $tier_row['state'];
$tier_level = $tier_row['level'];
$tier_position = $tier_row['position'];
foreach ($agent_result as $agent_row) {
if ($tier_row['agent'] == $agent_row['name']) {
$name = $agent_row['name'];
$name = str_replace('@'.$_SESSION['domain_name'], '', $name);
//$system = $agent_row['system'];
//$uuid = $agent_row['uuid'];
//$type = $agent_row['type'];
$contact = $agent_row['contact'];
$status = $agent_row['status'];
$state = $agent_row['state'];
$max_no_answer = $agent_row['max_no_answer'];
$wrap_up_time = $agent_row['wrap_up_time'];
$reject_delay_time = $agent_row['reject_delay_time'];
$busy_delay_time = $agent_row['busy_delay_time'];
$last_bridge_start = $agent_row['last_bridge_start'];
$last_bridge_end = $agent_row['last_bridge_end'];
//$last_offered_call = $agent_row['last_offered_call'];
$last_status_change = $agent_row['last_status_change'];
$no_answer_count = $agent_row['no_answer_count'];
$calls_answered = $agent_row['calls_answered'];
$talk_time = $agent_row['talk_time'];
$ready_time = $agent_row['ready_time'];
$last_offered_call_seconds = time() - $last_offered_call;
$last_offered_call_length_hour = floor($last_offered_call_seconds/3600);
$last_offered_call_length_min = floor($last_offered_call_seconds/60 - ($last_offered_call_length_hour * 60));
$last_offered_call_length_sec = $last_offered_call_seconds - (($last_offered_call_length_hour * 3600) + ($last_offered_call_length_min * 60));
$last_offered_call_length_min = sprintf("%02d", $last_offered_call_length_min);
$last_offered_call_length_sec = sprintf("%02d", $last_offered_call_length_sec);
$last_offered_call_length = $last_offered_call_length_hour.':'.$last_offered_call_length_min.':'.$last_offered_call_length_sec;
$last_status_change_seconds = time() - $last_status_change;
$last_status_change_length_hour = floor($last_status_change_seconds/3600);
$last_status_change_length_min = floor($last_status_change_seconds/60 - ($last_status_change_length_hour * 60));
$last_status_change_length_sec = $last_status_change_seconds - (($last_status_change_length_hour * 3600) + ($last_status_change_length_min * 60));
$last_status_change_length_min = sprintf("%02d", $last_status_change_length_min);
$last_status_change_length_sec = sprintf("%02d", $last_status_change_length_sec);
$last_status_change_length = $last_status_change_length_hour.':'.$last_status_change_length_min.':'.$last_status_change_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$name."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$contact."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$status."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$last_offered_call_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$last_status_change_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$no_answer_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$calls_answered."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_state."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_level."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_position."</td>\n";
}
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
//add vertical spacing
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
}
?>

View File

@@ -0,0 +1,96 @@
<?php
/* $Id$ */
/*
v_exec.php
Copyright (C) 2008 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//http get variables set to php variables
if (count($_GET)>0) {
$switch_cmd = trim($_GET["cmd"]);
$action = trim(check_str($_GET["action"]));
$data = trim(check_str($_GET["data"]));
$username = trim(check_str($_GET["username"]));
}
//authorized commands
if (stristr($switch_cmd, 'user_status') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'callcenter_config') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'eavesdrop') == true) {
//authorized;
} else {
//not found. this command is not authorized
echo "access denied";
exit;
}
//set the username
if (if_group("admin") || if_group("superadmin")) {
//use the username that was provided
}
else {
$username = $_SESSION['username'];
}
//get to php variables
if (count($_GET)>0) {
if ($action == "user_status") {
$user_status = $data;
$sql = "update v_users set ";
$sql .= "user_status = '".trim($user_status, "'")."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$username."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
}
//fs cmd
if (strlen($switch_cmd) > 0) {
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//ensure the connection exists
if ($fp) {
//send the command
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//set the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
}
}
}
?>

View File

@@ -0,0 +1,177 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
$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>Call Center Queue List</b></td>\n";
echo "<td width='50%' align=\"right\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=\"left\" colspan='2'>\n";
echo "List of queues for the call center.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
$sql = "";
$sql .= " select * from v_call_center_queues ";
$sql .= " where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 100;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "";
$sql .= " select * from v_call_center_queues ";
$sql .= " where domain_uuid = '$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(PDO::FETCH_NAMED);
$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('queue_name', 'Queue Name', $order_by, $order);
echo th_order_by('queue_extension', 'Extension', $order_by, $order);
echo th_order_by('queue_strategy', 'Strategy', $order_by, $order);
//echo th_order_by('queue_moh_sound', 'Music On Hold', $order_by, $order);
//echo th_order_by('queue_record_template', 'Record Template', $order_by, $order);
//echo th_order_by('queue_time_base_score', 'Time Base Score', $order_by, $order);
//echo th_order_by('queue_max_wait_time', 'Max Wait Time', $order_by, $order);
//echo th_order_by('queue_max_wait_time_with_no_agent', 'Max Wait Time With No Agent', $order_by, $order);
//echo th_order_by('queue_tier_rules_apply', 'Tier Rules Apply', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_second', 'Tier Rule Wait Second', $order_by, $order);
//echo th_order_by('queue_tier_rule_no_agent_no_wait', 'Tier Rule No Agent No Wait', $order_by, $order);
//echo th_order_by('queue_discard_abandoned_after', 'Discard Abandoned After', $order_by, $order);
//echo th_order_by('queue_abandoned_resume_allowed', 'Abandoned Resume Allowed', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_multiply_level', 'Tier Rule Wait Multiply Level', $order_by, $order);
echo th_order_by('queue_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n";
//echo " <a href='v_call_center_queue_edit.php' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "<tr>\n";
if ($result_count == 0) { //no results
}
else { //received results
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_name]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_extension]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_strategy]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_moh_sound]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_record_template]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_time_base_score]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_max_wait_time_with_no_agent]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rules_apply]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_second]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_no_agent_no_wait]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_discard_abandoned_after]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_abandoned_resume_allowed]."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_multiply_level]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_description]."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='".PROJECT_PATH."/app/call_center_active/v_call_center_active.php?queue_name=".$row[queue_name]."' alt='edit'>$v_link_label_edit</a>\n";
//echo " <a href='v_call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
//echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='v_call_center_queue_edit.php?id=".$row[call_center_queue_uuid]."'\" value='e'>\n";
//echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='v_call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' }\" value='x'>\n";
echo " </td>\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='17' 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";
//echo " <a href='v_call_center_queue_edit.php' alt='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>";
//show the footer
require_once "includes/footer.php";
?>

37
app/calls/app_config.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
//application details
$apps[$x]['name'] = "Calls";
$apps[$x]['uuid'] = '19806921-e8ed-dcff-b325-dd3e5da4959d';
$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'] = 'Call Forward, Follow Me and Do Not Disturb.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Calls';
$apps[$x]['menu'][0]['uuid'] = '';
$apps[$x]['menu'][0]['parent_uuid'] = '';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/calls/v_calls.php';
$apps[$x]['menu'][0]['groups'][] = 'user';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][1]['name'] = 'follow_me';
$apps[$x]['permissions'][1]['groups'][] = 'user';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'call_forward';
$apps[$x]['permissions'][2]['groups'][] = 'user';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'do_not_disturb';
$apps[$x]['permissions'][3]['groups'][] = 'user';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
?>

50
app/calls/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

751
app/calls/v_call_edit.php Normal file
View File

@@ -0,0 +1,751 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
//access granted
}
else {
echo "access denied";
exit;
}
function destination_select($select_name, $select_value, $select_default) {
if (strlen($select_value) == 0) { $select_value = $select_default; }
echo " <select class='formfld' style='width: 45px;' name='$select_name'>\n";
echo " <option value=''></option>\n";
$i=5;
while($i<=100) {
if ($select_value == $i) {
echo " <option value='$i' selected='selected'>$i</option>\n";
}
else {
echo " <option value='$i'>$i</option>\n";
}
$i=$i+5;
}
echo "</select>\n";
}
//get the extension_uuid
$extension_uuid = $_REQUEST["id"];
//get the extension number
$sql = "";
$sql .= "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid' ";
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
$sql .= "and enabled = 'true' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result)== 0) {
echo "access denied";
exit;
}
else {
foreach ($result as &$row) {
$extension = $row["extension"];
$effective_caller_id_name = $row["effective_caller_id_name"];
$effective_caller_id_number = $row["effective_caller_id_number"];
$outbound_caller_id_name = $row["outbound_caller_id_name"];
$outbound_caller_id_number = $row["outbound_caller_id_number"];
$description = $row["description"];
break; //limit to 1 row
}
}
unset ($prep_statement);
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//get http post variables and set them to php variables
if (count($_POST)>0) {
$call_forward_enabled = check_str($_POST["call_forward_enabled"]);
$call_forward_number = check_str($_POST["call_forward_number"]);
$follow_me_enabled = check_str($_POST["follow_me_enabled"]);
$follow_me_type = check_str($_POST["follow_me_type"]);
$destination_data_1 = check_str($_POST["destination_data_1"]);
$destination_timeout_1 = check_str($_POST["destination_timeout_1"]);
$destination_data_2 = check_str($_POST["destination_data_2"]);
$destination_timeout_2 = check_str($_POST["destination_timeout_2"]);
$destination_data_3 = check_str($_POST["destination_data_3"]);
$destination_timeout_3 = check_str($_POST["destination_timeout_3"]);
$destination_data_4 = check_str($_POST["destination_data_4"]);
$destination_timeout_4 = check_str($_POST["destination_timeout_4"]);
$destination_data_5 = check_str($_POST["destination_data_5"]);
$destination_timeout_5 = check_str($_POST["destination_timeout_5"]);
$dnd_enabled = check_str($_POST["dnd_enabled"]);
$hunt_group_call_prompt = check_str($_POST["hunt_group_call_prompt"]);
if (strlen($follow_me_type) == 0) { $follow_me_type = "follow_me_sequence"; }
if (strlen($call_forward_number) > 0) {
$call_forward_number = preg_replace("~[^0-9]~", "",$call_forward_number);
}
if (strlen($destination_data_1) > 0) {
$destination_data_1 = preg_replace("~[^0-9]~", "",$destination_data_1);
}
if (strlen($destination_data_2) > 0) {
$destination_data_2 = preg_replace("~[^0-9]~", "",$destination_data_2);
}
if (strlen($destination_data_3) > 0) {
$destination_data_3 = preg_replace("~[^0-9]~", "",$destination_data_3);
}
if (strlen($destination_data_4) > 0) {
$destination_data_4 = preg_replace("~[^0-9]~", "",$destination_data_4);
}
if (strlen($destination_data_5) > 0) {
$destination_data_5 = preg_replace("~[^0-9]~", "",$destination_data_5);
}
//set the default
if (strlen($hunt_group_call_prompt) == 0) {
$hunt_group_call_prompt = 'false';
}
//destination_1
if (strlen($destination_data_1) > 0) {
if (extension_exists($destination_data_1)) {
$destination_type_1 = 'extension';
}
else {
$destination_type_1 = 'sip uri';
}
}
//destination_2
if (extension_exists($destination_data_2)) {
$destination_type_2 = 'extension';
}
else {
$destination_type_2 = 'sip uri';
}
//destination_3
if (extension_exists($destination_data_3)) {
$destination_type_3 = 'extension';
}
else {
$destination_type_3 = 'sip uri';
}
//destination_4
if (extension_exists($destination_data_4)) {
$destination_type_4 = 'extension';
}
else {
$destination_type_4 = 'sip uri';
}
//destination_5
if (extension_exists($destination_data_5)) {
$destination_type_5 = 'extension';
}
else {
$destination_type_5 = 'sip uri';
}
}
//check for all required data
//if (strlen($call_forward_enabled) == 0) { $msg .= "Please provide: Call Forward<br>\n"; }
//if (strlen($call_forward_number) == 0) { $msg .= "Please provide: Number<br>\n"; }
//if (strlen($follow_me_enabled) == 0) { $msg .= "Please provide: Follow Me<br>\n"; }
//if (strlen($destination_data_1) == 0) { $msg .= "Please provide: 1st Number<br>\n"; }
//if (strlen($destination_timeout_1) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_2) == 0) { $msg .= "Please provide: 2nd Number<br>\n"; }
//if (strlen($destination_timeout_2) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_3) == 0) { $msg .= "Please provide: 3rd Number<br>\n"; }
//if (strlen($destination_timeout_3) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_4) == 0) { $msg .= "Please provide: 4th Number<br>\n"; }
//if (strlen($destination_timeout_4) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_5) == 0) { $msg .= "Please provide: 5th Number<br>\n"; }
//if (strlen($destination_timeout_5) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_6) == 0) { $msg .= "Please provide: 6th Number<br>\n"; }
//if (strlen($destination_timeout_6) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_7) == 0) { $msg .= "Please provide: 7th Number<br>\n"; }
//if (strlen($destination_timeout_7) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($hunt_group_call_prompt) == 0) { $msg .= "Please provide: call prompt<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//set the default action to add
$call_forward_action = "add";
$dnd_action = "add";
$follow_me_action = "add";
//get the hunt group timeout
//add the destination timeouts together to create the hunt group timeout
if ($follow_me_type == "follow_me_sequence") {
if (strlen($destination_data_1) > 0) {
$hunt_group_timeout = $destination_timeout_1;
}
if (strlen($destination_data_2) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_2;
}
if (strlen($destination_data_3) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_3;
}
if (strlen($destination_data_4) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_4;
}
if (strlen($destination_data_5) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_5;
}
}
//find the highest timeout and set that as the hunt_group_timeout
if ($follow_me_type == "follow_me_simultaneous") {
if (strlen($destination_data_1) > 0) {
$hunt_group_timeout = $destination_timeout_1;
}
if (strlen($destination_data_2) > 0 && $hunt_group_timeout < $destination_timeout_2) {
$hunt_group_timeout = $destination_timeout_2;
}
if (strlen($destination_data_3) > 0 && $hunt_group_timeout < $destination_timeout_3) {
$hunt_group_timeout = $destination_timeout_3;
}
if (strlen($destination_data_4) > 0 && $hunt_group_timeout < $destination_timeout_4) {
$hunt_group_timeout = $destination_timeout_4;
}
if (strlen($destination_data_5) > 0 && $hunt_group_timeout < $destination_timeout_5) {
$hunt_group_timeout = $destination_timeout_5;
}
}
//hunt_group information used to determine if this is an add or an update
$sql = "select * from v_hunt_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hunt_group_extension = '$extension' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
if ($row["hunt_group_type"] == 'call_forward') {
$call_forward_action = "update";
$call_forward_uuid = $row["hunt_group_uuid"];
}
if ($row["hunt_group_type"] == 'follow_me_sequence') {
$follow_me_action = "update";
$follow_me_uuid = $row["hunt_group_uuid"];
}
if ($row["hunt_group_type"] == 'follow_me_simultaneous') {
$follow_me_action = "update";
$follow_me_uuid = $row["hunt_group_uuid"];
}
if ($row["hunt_group_type"] == 'dnd') {
$dnd_action = "update";
$dnd_uuid = $row["hunt_group_uuid"];
}
}
unset ($prep_statement);
//include the classes
include "includes/classes/call_forward.php";
include "includes/classes/follow_me.php";
include "includes/classes/do_not_disturb.php";
//call forward config
if (permission_exists('call_forward')) {
$call_forward = new call_forward;
$call_forward->domain_uuid = $_SESSION['domain_uuid'];
$call_forward->db_type = $db_type;
$call_forward->extension = $extension;
$call_forward->call_forward_number = $call_forward_number;
$call_forward->call_forward_enabled = $call_forward_enabled;
if ($call_forward_enabled == "true") {
if ($call_forward_action == "add") {
$call_forward->call_forward_uuid = uuid();
$call_forward->call_forward_add();
}
}
if ($call_forward_action == "update") {
$call_forward->call_forward_uuid = $call_forward_uuid;
$call_forward->call_forward_update();
}
unset($call_forward);
}
//follow me config
if (permission_exists('follow_me')) {
$follow_me = new follow_me;
$follow_me->domain_uuid = $_SESSION['domain_uuid'];
$follow_me->db_type = $db_type;
$follow_me->extension = $extension;
$follow_me->follow_me_enabled = $follow_me_enabled;
$follow_me->follow_me_type = $follow_me_type;
$follow_me->hunt_group_call_prompt = $hunt_group_call_prompt;
$follow_me->hunt_group_timeout = $hunt_group_timeout;
$follow_me->destination_data_1 = $destination_data_1;
$follow_me->destination_type_1 = $destination_type_1;
$follow_me->destination_timeout_1 = $destination_timeout_1;
$follow_me->destination_data_2 = $destination_data_2;
$follow_me->destination_type_2 = $destination_type_2;
$follow_me->destination_timeout_2 = $destination_timeout_2;
$follow_me->destination_data_3 = $destination_data_3;
$follow_me->destination_type_3 = $destination_type_3;
$follow_me->destination_timeout_3 = $destination_timeout_3;
$follow_me->destination_data_4 = $destination_data_4;
$follow_me->destination_type_4 = $destination_type_4;
$follow_me->destination_timeout_4 = $destination_timeout_4;
$follow_me->destination_data_5 = $destination_data_5;
$follow_me->destination_type_5 = $destination_type_5;
$follow_me->destination_timeout_5 = $destination_timeout_5;
if ($follow_me_enabled == "true") {
if ($follow_me_action == "add") {
$follow_me->follow_me_uuid = uuid();
$follow_me->follow_me_add();
}
}
if ($follow_me_action == "update") {
$follow_me->follow_me_uuid = $follow_me_uuid;
$follow_me->follow_me_update();
}
unset($follow_me);
}
//do not disturb (dnd) config
if (permission_exists('do_not_disturb')) {
$dnd = new do_not_disturb;
$dnd->domain_uuid = $_SESSION['domain_uuid'];
$dnd->domain_name = $_SESSION['domain_name'];
$dnd->extension = $extension;
$dnd->dnd_enabled = $dnd_enabled;
if ($dnd_enabled == "true") {
if ($dnd_action == "add") {
$dnd->dnd_uuid = uuid();
$dnd->dnd_add();
}
}
if ($dnd_action == "update") {
$dnd->dnd_uuid = $dnd_uuid;
$dnd->dnd_update();
}
$dnd->dnd_status();
unset($dnd);
}
//synchronize the xml config
save_hunt_group_xml();
//synchronize the xml config
save_dialplan_xml();
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"3;url=".PROJECT_PATH."/app/calls/v_calls.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete<br />\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//show the header
require_once "includes/header.php";
//pre-populate the form
$sql = "select * from v_hunt_groups ";
$sql .= "where hunt_group_extension = '$extension' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$hunt_group_uuid = $row["hunt_group_uuid"];
$hunt_group_extension = $row["hunt_group_extension"];
$huntgroup_name = $row["hunt_group_name"];
$hunt_group_type = $row["hunt_group_type"];
$hunt_group_context = $row["hunt_group_context"];
$hunt_group_timeout = $row["hunt_group_timeout"];
$hunt_group_timeout_destination = $row["hunt_group_timeout_destination"];
$hunt_group_timeout_type = $row["hunt_group_timeout_type"];
$hunt_group_ring_back = $row["hunt_group_ringback"];
$hunt_group_cid_name_prefix = $row["hunt_group_cid_name_prefix"];
$hunt_group_pin = $row["hunt_group_pin"];
$hunt_group_call_prompt = $row["hunt_group_call_prompt"];
$huntgroup_caller_announce = $row["hunt_group_caller_announce"];
$hunt_group_user_list = $row["hunt_group_user_list"];
$hunt_group_enabled = $row["hunt_group_enabled"];
$hunt_group_description = $row["hunt_group_description"];
if ($row["hunt_group_type"] == 'call_forward') {
$call_forward_enabled = $hunt_group_enabled;
}
if ($row["hunt_group_type"] == 'follow_me_simultaneous') {
$follow_me_enabled = $hunt_group_enabled;
$follow_me_type = 'follow_me_simultaneous';
}
if ($row["hunt_group_type"] == 'follow_me_sequence') {
$follow_me_enabled = $hunt_group_enabled;
$follow_me_type = 'follow_me_sequence';
}
if ($row["hunt_group_type"] == 'dnd') {
$dnd_enabled = $hunt_group_enabled;
}
if ($row["hunt_group_type"] == 'call_forward' || $row["hunt_group_type"] == 'follow_me_sequence' || $row["hunt_group_type"] == 'follow_me_simultaneous') {
$sql = "select * from v_hunt_group_destinations ";
$sql .= "where hunt_group_uuid = '$hunt_group_uuid' ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
$x=1;
foreach ($result2 as &$row2) {
if ($row["hunt_group_type"] == 'call_forward') {
if (strlen($row2["destination_data"]) > 0) {
$call_forward_number = $row2["destination_data"];
}
}
if ($row["hunt_group_type"] == 'follow_me_sequence' || $row["hunt_group_type"] == 'follow_me_simultaneous') {
if ($x == 1) {
$destination_data_1 = $row2["destination_data"];
$destination_timeout_1 = $row2["destination_timeout"];
}
if ($x == 2) {
$destination_data_2 = $row2["destination_data"];
$destination_timeout_2 = $row2["destination_timeout"];
}
if ($x == 3) {
$destination_data_3 = $row2["destination_data"];
$destination_timeout_3 = $row2["destination_timeout"];
}
if ($x == 4) {
$destination_data_4 = $row2["destination_data"];
$destination_timeout_4 = $row2["destination_timeout"];
}
if ($x == 5) {
$destination_data_5 = $row2["destination_data"];
$destination_timeout_5 = $row2["destination_timeout"];
}
$x++;
}
}
unset ($prep_statement_2);
}
}
unset ($prep_statement);
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br>";
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap>\n";
echo " <b>Calls</b>\n";
echo "</td>\n";
echo "<td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_calls.php'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo " Directs incoming calls for extension $extension.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " <strong>Call Forward:</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$on_click = "document.getElementById('follow_me_enabled').checked=true;";
$on_click .= "document.getElementById('follow_me_disabled').checked=true;";
$on_click .= "document.getElementById('dnd_enabled').checked=false;";
$on_click .= "document.getElementById('dnd_disabled').checked=true;";
if ($call_forward_enabled == "true") {
echo " <input type='radio' name='call_forward_enabled' id='call_forward_enabled' onclick=\"$on_click\" value='true' checked='checked'/> Enabled \n";
}
else {
echo " <input type='radio' name='call_forward_enabled' id='call_forward_enabled' onclick=\"$on_click\" value='true' /> Enable \n";
}
if ($call_forward_enabled == "false" || $call_forward_enabled == "") {
echo " <input type='radio' name='call_forward_enabled' id='call_forward_disabled' onclick=\"\" value='false' checked='checked' /> Disabled \n";
}
else {
echo " <input type='radio' name='call_forward_enabled' id='call_forward_disabled' onclick=\"\" value='false' /> Disable \n";
}
unset($on_click);
echo "<br />\n";
echo "<br />\n";
//echo "Enable or disable call forward.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_forward_number' maxlength='255' value=\"$call_forward_number\">\n";
echo "<br />\n";
//echo "Enter the call forward number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
echo " <br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " <strong>Follow Me:</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$on_click = "document.getElementById('call_forward_enabled').checked=true;";
$on_click .= "document.getElementById('call_forward_disabled').checked=true;";
$on_click .= "document.getElementById('dnd_enabled').checked=false;";
$on_click .= "document.getElementById('dnd_disabled').checked=true;";
if ($follow_me_enabled == "true") {
echo " <input type='radio' name='follow_me_enabled' id='follow_me_enabled' value='true' onclick=\"$on_click\" checked='checked'/> Enabled \n";
}
else {
echo " <input type='radio' name='follow_me_enabled' id='follow_me_enabled' value='true' onclick=\"$on_click\" /> Enable \n";
}
if ($follow_me_enabled == "false" || $follow_me_enabled == "") {
echo " <input type='radio' name='follow_me_enabled' id='follow_me_disabled' value='false' onclick=\"\" checked='checked' /> Disabled \n";
}
else {
echo " <input type='radio' name='follow_me_enabled' id='follow_me_disabled' value='false' onclick=\"\" /> Disable \n";
}
unset($on_click);
echo "<br />\n";
echo "<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Ring 1st Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_1' maxlength='255' value=\"$destination_data_1\">\n";
echo " Sec \n";
destination_select('destination_timeout_1', $destination_timeout_1, '10');
//echo "<br />\n";
//echo "This number rings first.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Ring 2nd Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_2' maxlength='255' value=\"$destination_data_2\">\n";
echo " Sec \n";
destination_select('destination_timeout_2', $destination_timeout_2, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Ring 3rd Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_3' maxlength='255' value=\"$destination_data_3\">\n";
echo " Sec \n";
destination_select('destination_timeout_3', $destination_timeout_3, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Ring 4th Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_4' maxlength='255' value=\"$destination_data_4\">\n";
echo " Sec \n";
destination_select('destination_timeout_4', $destination_timeout_4, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Ring 5th Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_5' maxlength='255' value=\"$destination_data_5\">\n";
echo " Sec \n";
destination_select('destination_timeout_5', $destination_timeout_5, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Ring Order:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<select class='formfld' name='follow_me_type'>\n";
echo "<option value=''></option>\n";
if ($follow_me_type == "follow_me_sequence") {
echo "<option value='follow_me_sequence' selected='selected'>sequence</option>\n";
}
else {
echo "<option value='follow_me_sequence'>sequence</option>\n";
}
if ($follow_me_type == "follow_me_simultaneous") {
echo "<option value='follow_me_simultaneous' selected='selected'>simultaneous</option>\n";
}
else {
echo "<option value='follow_me_simultaneous'>simultaneous</option>\n";
}
echo "</select>\n";
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Prompt to accept the call:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<select class='formfld' name='hunt_group_call_prompt'>\n";
echo "<option value=''></option>\n";
if ($hunt_group_call_prompt == "true") {
echo "<option value='true' selected='selected'>true</option>\n";
}
else {
echo "<option value='true'>true</option>\n";
}
if ($hunt_group_call_prompt == "false") {
echo "<option value='false' selected='selected'>false</option>\n";
}
else {
echo "<option value='false'>false</option>\n";
}
echo "</select>\n";
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
echo " <br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " <strong>Do Not Disturb:</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$on_click = "document.getElementById('call_forward_enabled').checked=true;";
$on_click .= "document.getElementById('call_forward_disabled').checked=true;";
$on_click .= "document.getElementById('follow_me_enabled').checked=true;";
$on_click .= "document.getElementById('follow_me_disabled').checked=true;";
if ($dnd_enabled == "true") {
echo " <input type='radio' name='dnd_enabled' id='dnd_enabled' value='true' onclick=\"$on_click\" checked='checked'/> Enabled \n";
}
else {
echo " <input type='radio' name='dnd_enabled' id='dnd_enabled' value='true' onclick=\"$on_click\"/> Enable \n";
}
if ($dnd_enabled == "false" || $dnd_enabled == "") {
echo " <input type='radio' name='dnd_enabled' id='dnd_disabled' value='false' onclick=\"\" checked='checked' /> Disabled \n";
}
else {
echo " <input type='radio' name='dnd_enabled' id='dnd_disabled' value='false' onclick=\"\" /> Disable \n";
}
echo " <br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
echo " <br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
echo " <br />\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='id' value='$extension_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

196
app/calls/v_calls.php Normal file
View File

@@ -0,0 +1,196 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
$order_by = $_GET["order_by"];
$order = $_GET["order"];
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>";
if ($is_included != "true") {
echo " <table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Calls</b><br>\n";
echo " Use the links to configure call forward follow me, or do no disturb.\n";
echo " The following list the extensions that have been assigned to this user account. \n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <br />";
}
$sql = "";
$sql .= " select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and enabled = 'true' ";
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//used to hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
if (strlen($order_by)> 0) {
$sql .= "order by $order_by $order ";
}
else {
$sql .= "order by extension asc ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 150;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "";
$sql .= " select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and enabled = 'true' ";
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
if (strlen($order_by)> 0) {
$sql .= "order by $order_by $order ";
}
else {
$sql .= "order by extension asc ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Extension</th>\n";
echo "<th>Tools</th>\n";
echo "<th>Description</th>\n";
echo "</tr>\n";
if ($result_count == 0) {
//no results
}
else { //received results
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[extension]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>\n";
if (permission_exists('call_forward')) {
echo " <a href='".PROJECT_PATH."/app/calls/v_call_edit.php?id=".$row[extension_uuid]."&a=call_forward' alt='Call Forward'>Call Forward</a> \n";
echo " &nbsp;&nbsp;\n";
}
if (permission_exists('follow_me')) {
echo " <a href='".PROJECT_PATH."/app/calls/v_call_edit.php?id=".$row[extension_uuid]."&a=follow_me' alt='Follow Me'>Follow Me</a> \n";
echo " &nbsp;&nbsp;\n";
}
if (permission_exists('do_not_disturb')) {
echo " <a href='".PROJECT_PATH."/app/calls/v_call_edit.php?id=".$row[extension_uuid]."&a=do_not_disturb' alt='Do Not Disturb'>Do Not Disturb</a> \n";
}
echo " </td>\n";
echo " <td valign='top' class='row_stylebg' width='40%'>".$row[description]."&nbsp;</td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
if (strlen($paging_controls) > 0) {
echo "<tr>\n";
echo "<td colspan='5' align='left'>\n";
echo " <table border='0' 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 " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>";
echo "</table>";
echo "</div>";
echo "<br>";
echo "<br>";
echo "<br>";
if ($is_included != "true") {
require_once "includes/footer.php";
}
?>

View File

@@ -0,0 +1,75 @@
<?php
//application details
$apps[$x]['name'] = "Active Calls";
$apps[$x]['uuid'] = 'ec8530a9-903a-469d-3717-281f798b9ef6';
$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'] = 'Active channels on the system.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Active Calls';
$apps[$x]['menu'][0]['uuid'] = 'eba3d07f-dd5c-6b7b-6880-493b44113ade';
$apps[$x]['menu'][0]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/calls_active/v_calls_active.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
$apps[$x]['menu'][1]['title']['en'] = 'Active Extensions';
$apps[$x]['menu'][1]['uuid'] = '6dd85c19-cb6b-5cca-bf32-499bbe936f79';
$apps[$x]['menu'][1]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][1]['category'] = 'internal';
$apps[$x]['menu'][1]['path'] = '/app/calls_active/v_calls_active_extensions.php';
//$apps[$x]['menu'][1]['groups'][] = 'user';
$apps[$x]['menu'][1]['groups'][] = 'admin';
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'calls_active_view';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'calls_active_transfer';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'calls_active_hangup';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'calls_active_park';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'calls_active_rec';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
$apps[$x]['permissions'][5]['name'] = 'extensions_active_view';
$apps[$x]['permissions'][5]['groups'][] = 'user';
$apps[$x]['permissions'][5]['groups'][] = 'admin';
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
$apps[$x]['permissions'][6]['name'] = 'extensions_active_transfer';
$apps[$x]['permissions'][6]['groups'][] = 'admin';
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
$apps[$x]['permissions'][7]['name'] = 'extensions_active_hangup';
$apps[$x]['permissions'][7]['groups'][] = 'admin';
$apps[$x]['permissions'][7]['groups'][] = 'superadmin';
$apps[$x]['permissions'][8]['name'] = 'extensions_active_park';
$apps[$x]['permissions'][8]['groups'][] = 'admin';
$apps[$x]['permissions'][8]['groups'][] = 'superadmin';
$apps[$x]['permissions'][9]['name'] = 'extensions_active_rec';
$apps[$x]['permissions'][9]['groups'][] = 'admin';
$apps[$x]['permissions'][9]['groups'][] = 'superadmin';
$apps[$x]['permissions'][10]['name'] = 'extensions_active_list_view';
//$apps[$x]['permissions'][10]['groups'][] = 'user';
$apps[$x]['permissions'][10]['groups'][] = 'admin';
$apps[$x]['permissions'][10]['groups'][] = 'superadmin';
$apps[$x]['permissions'][11]['name'] = 'extensions_active_assigned_view';
//$apps[$x]['permissions'][11]['groups'][] = 'user';
$apps[$x]['permissions'][11]['groups'][] = 'admin';
$apps[$x]['permissions'][11]['groups'][] = 'superadmin';
?>

50
app/calls_active/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,165 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('calls_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
$conference_name = trim($_REQUEST["c"]);
$tmp_conference_name = str_replace("_", " ", $conference_name);
require_once "includes/header.php";
?><script type="text/javascript">
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = 'v_calls_active_inc.php?c=<?php echo trim($_REQUEST["c"]); ?>';
new loadXmlHttp(url, 'ajax_reponse');
setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, 1500);
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
function send_cmd(url) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;
}
var record_count = 0;
var cmd;
var destination;
</script>
<?php
echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Active Calls</b><br>\n";
echo " Use this to monitor and interact with the active calls.\n";
echo " </td>\n";
echo " <td align='right'>\n";
echo " <table>\n";
echo " <td align='left' valign='middle'>\n";
echo " <div id=\"form_label\">\n";
echo " <div id=\"url\"></div>\n";
echo " </td>\n";
echo " <td align='left' valign='middle'>\n";
echo " <div id=\"form_label\"></div><input type=\"text\" id=\"form_value\" name=\"form_value\" />\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo " <tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <div id=\"ajax_reponse\"></div>\n";
echo " <div id=\"time_stamp\" style=\"visibility:hidden\">".date('Y-m-d-s')."</div>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>\n";
echo "<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "function get_transfer_cmd(uuid) {\n";
echo " destination = document.getElementById('form_value').value;\n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg \"+destination+\" xml ".$_SESSION['user_context']."\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_park_cmd(uuid) {\n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg *6000 xml ".$_SESSION['user_context']."\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_record_cmd(uuid, prefix, name) {\n";
echo " cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "-->\n";
echo "</script>\n";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,231 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('extensions_active_assigned_view')) {
//http get and set variables
if (strlen($_GET['url']) > 0) {
$url = $_GET['url'];
}
echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td valign='top'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th width='50px;'>Ext</th>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<th>Status</th>\n";
}
echo "<th>Time</th>\n";
//echo "<th>Direction</th>\n";
//echo "<th>Profile</th>\n";
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
echo "<th>Dest</th>\n";
echo "<th>Application</th>\n";
echo "<th>Secure</th>\n";
echo "<th>Name</th>\n";
echo "<th>Options</th>\n";
echo "</tr>\n";
foreach ($_SESSION['extension_array'] as $row) {
$domain_uuid = $row['domain_uuid'];
$extension = $row['extension'];
$enabled = $row['enabled'];
$effective_caller_id_name = $row['effective_caller_id_name'];
foreach ($_SESSION['user']['extension'] as &$user_row) {
if ($extension == $user_row['user']) {
$found_extension = false;
$x = 1;
foreach ($channels_array as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//find the matching extensions
if ($number == $extension) {
//set the found extension to true
$found_extension = true;
break;
}
} //end foreach
if ($number == $extension) {
if ($application == "conference") {
$alt_color = "background-image: url('".PROJECT_PATH."/images/background_cell_active.gif";
}
switch ($application) {
case "conference":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_conference.gif');\"";
break;
case "fifo":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
case "valet_park":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
default:
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_active.gif');\"";
}
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate width='20px;'>".$call_length."</td>\n";
if (strlen($url) == 0) {
$url = PROJECT_PATH."/app/contacts/contacts.php?search_all={cid_num}";
}
$url = str_replace ("{cid_num}", $cid_num, $url);
$url = str_replace ("{cid_name}", $cid_name, $url);
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_name."</a></td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_num."</a></td>\n";
//get the active uuid list
if (strlen($uuid) > 1) {
if (strlen($uuid_1) == 0) {
$uuid_1 = $uuid;
//$direction_1 = $direction;
$cid_name_1 = $cid_name;
$cid_num_1 = $cid_num;
}
if (strlen($uuid_1) > 0 && $uuid != $uuid_1) {
$uuid_2 = $uuid;
//$direction_2 = $direction;
$cid_name_2 = $cid_name;
$cid_num_2 = $cid_num;
}
}
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
if ($application == "valet_park") {
echo $valet_array[trim($uuid)]['extension']."\n";
}
else {
echo $dest."&nbsp;\n";
}
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
if ($application == "fifo") {
echo "queue &nbsp;\n";
}
else {
echo $application."&nbsp;\n";
}
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$secure."&nbsp;\n";
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$effective_caller_id_name."&nbsp;\n";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
//transfer
echo " <a href='javascript:void(0);' style='color: #444444;' onMouseover=\"document.getElementById('form_label').innerHTML='<strong>Transfer To</strong>';\" onclick=\"send_cmd('v_calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">transfer</a>&nbsp;\n";
//park
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">park</a>&nbsp;\n";
//hangup
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to hangup this call?');if (confirm_response){send_cmd('v_calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">hangup</a>&nbsp;\n";
//record start/stop
$tmp_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
if (file_exists($tmp_file)) {
//stop
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=stop&prefix=active_extensions_&name='+escape('$cid_num'));\">stop record</a>&nbsp;\n";
}
else {
//start
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=start&prefix=active_extensions_');\">start record</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";
echo "</tr>\n";
}
else {
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_light.gif');\"";
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
echo "</tr>\n";
}
if ($c==0) { $c=1; } else { $c=0; }
} //end if
} //end foreach
}
echo "</table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<span id='uuid_1' style='visibility:hidden;'>$uuid_1</span>\n";
//echo "<span id='direction_1' style='visibility:hidden;'>$direction_1</span>\n";
echo "<span id='cid_name_1' style='visibility:hidden;'>$cid_name_1</span>\n";
echo "<span id='cid_num_1' style='visibility:hidden;'>$cid_num_1</span>\n";
echo "<span id='uuid_2' style='visibility:hidden;'>$uuid_2</span>\n";
//echo "<span id='direction_2' style='visibility:hidden;'>$direction_2</span>\n";
echo "<span id='cid_name_2' style='visibility:hidden;'>$cid_name_2</span>\n";
echo "<span id='cid_num_2' style='visibility:hidden;'>$cid_num_2</span>\n";
echo "<br />\n";
}
?>

View File

@@ -0,0 +1,337 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('extensions_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//http get and set variables
$event_type = $_GET['event_type']; //open_window //iframe
if ($event_type=="iframe") {
$iframe_width = $_GET['iframe_width'];
$iframe_height = $_GET['iframe_height'];
$iframe_postition = $_GET['iframe_postition'];
if (strlen($iframe_postition) > 0) { $iframe_postition = 'right'; }
if (strlen($iframe_width) > 0) { $iframe_width = '25%'; }
if (strlen($iframe_height) > 0) { $iframe_height = '100%'; }
}
if (strlen($_GET['url']) > 0) {
$url = $_GET['url'];
}
if (strlen($_GET['rows']) > 0) {
$rows = $_GET['rows'];
}
else {
$rows = 0;
}
$conference_name = trim($_REQUEST["c"]);
$tmp_conference_name = str_replace("_", " ", $conference_name);
require_once "includes/header.php";
?><script type="text/javascript">
<!--
//declare variables
var previous_uuid_1 = '';
var previous_uuid_2 = '';
var url = '<?php echo $url; ?>';
//define the ajax function
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
if (document.getElementById('uuid_1')) {
uuid_1 = document.getElementById('uuid_1').innerHTML;
}
else {
uuid_1 = "";
}
if (document.getElementById('direction_1')) {
direction_1 = document.getElementById('direction_1').innerHTML;
}
else {
direction_1 = "";
}
if (document.getElementById('cid_name_1')) {
cid_name_1 = document.getElementById('cid_name_1').innerHTML;
}
else {
cid_name_1 = "";
}
if (document.getElementById('cid_num_1')) {
cid_num_1 = document.getElementById('cid_num_1').innerHTML;
}
else {
cid_num_1 = "";
}
//get the user_status from the database
if (document.getElementById('db_user_status')) {
db_user_status = document.getElementById('db_user_status').innerHTML;
}
if (previous_uuid_1 != uuid_1) {
if (cid_num_1.length > 6) {
var new_url = url;
new_url = new_url.replace("{cid_name}", cid_name_1);
new_url = new_url.replace("{cid_num}", cid_num_1);
new_url = new_url.replace("{uuid}", uuid_1);
previous_uuid_1 = uuid_1;
<?php
if ($event_type=="open_window") {
echo "open_window = window.open(new_url,'width='+window.innerWidth+',height='+window.innerHeight+',left=0px;toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');";
echo "if (window.focus) {open_window.focus()}\n";
}
if ($event_type=="iframe") {
echo "document.getElementById('iframe1').src = new_url;\n";
//iframe_postition
//iframe_width
//iframe_height
}
?>
}
else {
//hangup or initial page load detected
}
previous_uuid_1 = uuid_1;
}
}
var requestTime = function() {
<?php
echo "var url = 'v_calls_active_extensions_inc.php?". $_SERVER["QUERY_STRING"]."';\n";
echo "new loadXmlHttp(url, 'ajax_reponse');\n";
if (strlen($_SESSION["ajax_refresh_rate"]) == 0) { $_SESSION["ajax_refresh_rate"] = "900"; }
echo "setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, ".$_SESSION["ajax_refresh_rate"].");";
?>
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
function send_cmd(url) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;
}
var record_count = 0;
var cmd;
var destination;
// -->
</script>
<?php
echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left' colspan='2' nowrap='nowrap'>\n";
echo " <b>Active Extensions</b><br>\n";
echo " </td>\n";
//get the user status when the page loads
$sql = "";
$sql .= "select * from v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$_SESSION['username']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$user_status = $row["user_status"];
break; //limit to 1 row
}
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo " <td class='' width='40%'>\n";
echo " &nbsp;";
echo " </td>\n";
echo " <td class='' valign='bottom' align='right' style='width:200px' nowrap='nowrap'>\n";
//status list
echo " &nbsp;";
echo " <strong>Status</strong>&nbsp;\n";
$cmd = "'v_calls_exec.php?action=user_status&data='+this.value+'";
$cmd .= "&cmd=callcenter_config+agent+set+status+".$_SESSION['username']."@".$_SESSION['domain_name']."+'+this.value";
echo " <select id='agent_status' name='agent_status' class='formfld' style='width:125px' nowrap='nowrap' onchange=\"send_cmd($cmd);\">\n";
echo " <option value=' '></option>\n";
if ($user_status == "Available") {
echo " <option value='Available' selected='selected'>Available</option>\n";
}
else {
echo " <option value='Available'>Available</option>\n";
}
if ($user_status == "Available (On Demand)") {
echo " <option value='Available_On_Demand' selected='selected'>Available (On Demand)</option>\n";
}
else {
echo " <option value='Available_On_Demand'>Available (On Demand)</option>\n";
}
if ($user_status == "Logged Out") {
echo " <option value='Logged_Out' selected='selected'>Logged Out</option>\n";
}
else {
echo " <option value='Logged_Out'>Logged Out</option>\n";
}
if ($user_status == "On Break") {
echo " <option value='On_Break' selected='selected'>On Break</option>\n";
}
else {
echo " <option value='On_Break'>On Break</option>\n";
}
if ($user_status == "Do Not Disturb") {
echo " <option value='Do_Not_Disturb' selected='selected'>Do Not Disturb</option>\n";
}
else {
echo " <option value='Do_Not_Disturb'>Do Not Disturb</option>\n";
}
echo " </select>\n";
echo " </td>\n";
}
echo " <td align='right' nowrap='nowrap'>\n";
echo " &nbsp;";
echo " <strong>Transfer To</strong>\n";
echo " <input type=\"text\" id=\"form_value\" name=\"form_value\" class='formfld' style='width:125px'/>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='99'>\n";
echo " Use this to view all extensions and monitor and interact with active calls.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<div id=\"url\"></div>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo " <tr class='border'>\n";
if ($event_type=="iframe") {
echo " <td align=\"left\" width='".$iframe_width."'>\n";
}
else {
echo " <td align=\"left\" width='100%'>\n";
}
echo " <div id=\"ajax_reponse\"></div>\n";
echo " <div id=\"time_stamp\" style=\"visibility:hidden\">".date('Y-m-d-s')."</div>\n";
echo " </td>\n";
if ($event_type=="iframe") {
echo "</td>\n";
echo "<td width='".$iframe_width."' height='".$iframe_height."'>\n";
echo " <iframe src ='$url' width='100%' id='iframe1' height='100%' frameborder=0>\n";
echo " <p>Your browser does not support iframes.</p>\n";
echo " </iframe>\n";
echo "</td>\n";
}
echo " </tr>";
echo "</table>";
echo "</div>\n";
echo "<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "function get_transfer_cmd(uuid) {\n";
echo " destination = document.getElementById('form_value').value;\n";
echo " if (destination.length > 1) { \n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg \"+destination+\" xml ".$_SESSION['user_context']."\";\n";
echo " }\n";
echo " else {\n";
echo " cmd = '';\n";
echo " alert(\"Please provide a number to transfer the call to.\");\n";
echo " }\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_park_cmd(uuid) {\n";
echo " cmd = \"uuid_transfer \"+uuid+\" -bleg *6000 xml ".$_SESSION['user_context']."\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "\n";
echo "function get_record_cmd(uuid, prefix, name) {\n";
echo " cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";\n";
echo " return escape(cmd);\n";
echo "}\n";
echo "-->\n";
echo "</script>\n";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,561 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('extensions_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set debug to true or false
$debug = false;
//http get and set variables
if (strlen($_GET['url']) > 0) {
$url = $_GET['url'];
}
if (strlen($_GET['rows']) == 0) {
$_GET['rows'] = 0;
}
//define variables
$c = 0;
$row_style["0"] = "row_style1";
$row_style["1"] = "row_style1";
//get the user status
$sql = "";
$sql .= "select e.extension, u.username, u.user_status ";
$sql .= "from v_users as u, v_extensions as e ";
$sql .= "where e.domain_uuid = '$domain_uuid' ";
$sql .= "and u.domain_uuid = '$domain_uuid' ";
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "e.extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$x = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
if (strlen($row["user_status"]) > 0) {
$user_array[$row["extension"]]['username'] = $row["username"];
$user_array[$row["extension"]]['user_status'] = $row["user_status"];
$username_array[$row["username"]]['user_status'] = $row["user_status"];
if ($row["username"] == $_SESSION["username"]) {
$user_status = $row["user_status"];
}
}
$x++;
}
unset ($prep_statement, $x);
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get information over event socket
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//get the agent list from event socket
$switch_cmd = 'callcenter_config agent list';
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$agent_array = csv_to_named_array($event_socket_str, '|');
//set the status on the user_array by using the extension as the key
foreach ($agent_array as $row) {
if (count($_SESSION['domains']) == 1) {
//get the extension status from the call center agent list
preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
$extension = $matches[1];
$user_array[$extension]['username'] = $tmp[0];
if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
$user_array[$extension]['user_status'] = $row['status'];
}
} else {
$tmp = explode('@',$row["name"]);
if ($tmp[1] == $_SESSION['domain_name']) {
//get the extension status from the call center agent list
preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
$extension = $matches[1];
$user_array[$extension]['username'] = $tmp[0];
if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
$user_array[$extension]['user_status'] = $row['status'];
}
}
}
}
//send the api command over event socket
$switch_cmd = 'valet_info';
$valet_xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
//parse the xml
try {
$valet_xml = new SimpleXMLElement($valet_xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
$valet_xml = new SimpleXMLElement($valet_xml_str);
foreach ($valet_xml as $row) {
$valet_name = (string) $row->attributes()->name;
foreach ($row->extension as $row2) {
$extension = (string) $row2;
$uuid = (string) $row2->attributes()->uuid;
$uuid = trim($uuid);
$valet_array[$uuid]['name'] = $valet_name;
$valet_array[$uuid]['extension'] = $extension;
}
}
//send the event socket command
$switch_cmd = 'show channels as xml';
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
//parse the xml
try {
$xml = new SimpleXMLElement($xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
//active channels array
$channels_array = '';
$x = 1;
foreach ($xml as $row) {
//set the original array id
$channels_array[$x]['x'] = $x;
//get the values from xml and set them to the channel array
$channels_array[$x]['uuid'] = $row->uuid;
$channels_array[$x]['direction'] = $row->direction;
$channels_array[$x]['created'] = $row->created;
$channels_array[$x]['created_epoch'] = $row->created_epoch;
$channels_array[$x]['name'] = $row->name;
$channels_array[$x]['state'] = $row->state;
$channels_array[$x]['cid_name'] = $row->cid_name;
$channels_array[$x]['cid_num'] = $row->cid_num;
$channels_array[$x]['ip_addr'] = $row->ip_addr;
$channels_array[$x]['dest'] = $row->dest;
$channels_array[$x]['application'] = $row->application;
$channels_array[$x]['application_data'] = $row->application_data;
$channels_array[$x]['dialplan'] = $row->dialplan;
$channels_array[$x]['context'] = $row->context;
$channels_array[$x]['read_codec'] = $row->read_codec;
$channels_array[$x]['read_rate'] = $row->read_rate;
$channels_array[$x]['read_bit_rate'] = $row->read_bit_rate;
$channels_array[$x]['write_codec'] = $row->write_codec;
$channels_array[$x]['write_rate'] = $row->write_rate;
$channels_array[$x]['write_bit_rate'] = $row->write_bit_rate;
$channels_array[$x]['secure'] = $row->secure;
$channels_array[$x]['hostname'] = $row->hostname;
$channels_array[$x]['presence_id'] = $row->presence_id;
$channels_array[$x]['presence_data'] = $row->presence_data;
$channels_array[$x]['callstate'] = $row->callstate;
$channels_array[$x]['callee_name'] = $row->callee_name;
$channels_array[$x]['callee_num'] = $row->callee_num;
$channels_array[$x]['callee_direction'] = $row->callee_direction;
$channels_array[$x]['call_uuid'] = $row->call_uuid;
//remove other domains
if (count($_SESSION["domains"]) > 1) {
//unset domains that are not related to this tenant
$temp_array = explode("@", $channels_array[$x]['presence_id']);
if ($temp_array[1] != $_SESSION['domain_name']) {
unset($channels_array[$x]);
}
}
//parse some of the php variables\
$temp_array = explode("@", $channels_array[$x]['presence_id']);
$channels_array[$x]['number'] = $temp_array[0];
//remove the '+' because it breaks the call recording
$channels_array[$x]['cid_num'] = $temp_array[0] = str_replace("+", "", $channels_array[$x]['cid_num']);
//calculate and set the call length
$call_length_seconds = time() - $channels_array[$x]['created_epoch'];
$call_length_hour = floor($call_length_seconds/3600);
$call_length_min = floor($call_length_seconds/60 - ($call_length_hour * 60));
$call_length_sec = $call_length_seconds - (($call_length_hour * 3600) + ($call_length_min * 60));
$call_length_min = sprintf("%02d", $call_length_min);
$call_length_sec = sprintf("%02d", $call_length_sec);
$call_length = $call_length_hour.':'.$call_length_min.':'.$call_length_sec;
$channels_array[$x]['call_length'] = $call_length;
//valet park
if (is_array($valet_array[$uuid])) {
$valet_array[$uuid]['context'] = $channels_array[$x]['context'];
$valet_array[$uuid]['cid_name'] = $channels_array[$x]['cid_name'];
$valet_array[$uuid]['cid_num'] = $channels_array[$x]['cid_num'];
$valet_array[$uuid]['call_length'] = $call_length;
}
//increment the array index
$x++;
}
//active extensions
//get the extension information
if ($debug) {
unset($_SESSION['extension_array']);
}
if (count($_SESSION['extension_array']) == 0) {
$sql = "";
$sql .= "select * from v_extensions ";
$x = 0;
$range_array = $_GET['range'];
foreach($range_array as $tmp_range) {
$tmp_range = str_replace(":", "-", $tmp_range);
$tmp_array = explode("-", $tmp_range);
$tmp_min = $tmp_array[0];
$tmp_max = $tmp_array[1];
if ($x == 0) {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension >= $tmp_min ";
$sql .= "and extension <= $tmp_max ";
$sql .= "and enabled = 'true' ";
}
else {
$sql .= "or domain_uuid = '$domain_uuid' ";
$sql .= "and extension >= $tmp_min ";
$sql .= "and extension <= $tmp_max ";
$sql .= "and enabled = 'true' ";
}
$x++;
}
if (count($range_array) == 0) {
$sql .= "where domain_uuid = '$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_NAMED);
foreach ($result as &$row) {
if ($row["enabled"] == "true") {
$extension = $row["extension"];
$extension_array[$extension]['domain_uuid'] = $row["domain_uuid"];
$extension_array[$extension]['extension'] = $row["extension"];
//$extension_array[$extension]['password'] = $row["password"];
$extension_array[$extension]['mailbox'] = $row["mailbox"];
//$vm_password = $row["vm_password"];
//$vm_password = str_replace("#", "", $vm_password); //preserves leading zeros
//$_SESSION['extension_array'][$extension]['vm_password'] = $vm_password;
$extension_array[$extension]['accountcode'] = $row["accountcode"];
$extension_array[$extension]['effective_caller_id_name'] = $row["effective_caller_id_name"];
$extension_array[$extension]['effective_caller_id_number'] = $row["effective_caller_id_number"];
$extension_array[$extension]['outbound_caller_id_name'] = $row["outbound_caller_id_name"];
$extension_array[$extension]['outbound_caller_id_number'] = $row["outbound_caller_id_number"];
$extension_array[$extension]['vm_enabled'] = $row["vm_enabled"];
$extension_array[$extension]['vm_mailto'] = $row["vm_mailto"];
$extension_array[$extension]['vm_attach_file'] = $row["vm_attach_file"];
$extension_array[$extension]['vm_keep_local_after_email'] = $row["vm_keep_local_after_email"];
$extension_array[$extension]['user_context'] = $row["user_context"];
$extension_array[$extension]['call_group'] = $row["call_group"];
$extension_array[$extension]['auth_acl'] = $row["auth_acl"];
$extension_array[$extension]['cidr'] = $row["cidr"];
$extension_array[$extension]['sip_force_contact'] = $row["sip_force_contact"];
//$extension_array[$extension]['enabled'] = $row["enabled"];
$extension_array[$extension]['effective_caller_id_name'] = $row["effective_caller_id_name"];
}
}
$_SESSION['extension_array'] = $extension_array;
}
//get a list of assigned extensions for this user
include "v_calls_active_assigned_extensions_inc.php";
//list all extensions
if (permission_exists('extensions_active_list_view')) {
echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td valign='top'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th width='50px;'>Ext</th>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<th>Status</th>\n";
}
echo "<th>Time</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
echo "<th>Dest</th>\n";
echo "<th>App</th>\n";
echo "<th>Secure</th>\n";
}
}
echo "<th>Name</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<th>Options</th>\n";
}
}
echo "</tr>\n";
$x = 1;
foreach ($_SESSION['extension_array'] as $row) {
$domain_uuid = $row['domain_uuid'];
$extension = $row['extension'];
$enabled = $row['enabled'];
$effective_caller_id_name = $row['effective_caller_id_name'];
$found_extension = false;
foreach ($channels_array as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//check to see if the extension is found in the channel array
if ($number == $extension) {
$found_extension = true;
break;
}
}
if ($found_extension) {
if ($application == "conference") {
$alt_color = "background-image: url('".PROJECT_PATH."/images/background_cell_active.gif";
}
switch ($application) {
case "conference":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_conference.gif');\"";
break;
case "fifo":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
case "valet_park":
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_fifo.gif');\"";
break;
default:
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_active.gif');\"";
}
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate width='20px;'>".$call_length."</td>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
if (strlen($url) == 0) {
$url = PROJECT_PATH."/app/contacts/contacts.php?search_all={cid_num}";
}
$url = str_replace ("{cid_num}", $cid_num, $url);
$url = str_replace ("{cid_name}", $cid_name, $url);
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_name."</a></td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".$cid_num."</a></td>\n";
}
}
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$dest."<br />\n";
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
if ($application == "fifo") {
echo "queue &nbsp;\n";
}
else {
echo $application." &nbsp;\n";
}
echo "</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>\n";
echo "".$secure."<br />\n";
echo "</td>\n";
}
}
}
else {
$style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/images/background_cell_light.gif');\"";
echo "<tr>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<td class='".$row_style[$c]."' $style_alternate>".$user_array[$extension]['user_status']."&nbsp;</td>\n";
}
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
}
}
}
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " ".$effective_caller_id_name."&nbsp;\n";
echo "</td>\n";
if (if_group("admin") || if_group("superadmin")) {
if (strlen(($_GET['rows'])) == 0) {
if ($found_extension) {
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
//transfer
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">transfer</a>&nbsp;\n";
//park
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">park</a>&nbsp;\n";
//hangup
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to hangup this call?');if (confirm_response){send_cmd('v_calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">hangup</a>&nbsp;\n";
//record start/stop
$tmp_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
if (file_exists($tmp_file)) {
//stop
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=stop&prefix=active_extensions_&name='+escape('$cid_num'));\">stop record</a>&nbsp;\n";
}
else {
//start
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=start&prefix=active_extensions_');\">start record</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
echo " &nbsp;";
echo "</td>\n";
}
}
}
echo "</tr>\n";
if ($y == $_GET['rows'] && $_GET['rows'] > 0) {
$y = 0;
echo "</table>\n";
echo "</td>\n";
echo "<td valign='top'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Ext</th>\n";
if ($_SESSION['user_status_display'] == "false") {
//hide the user_status when it is set to false
}
else {
echo "<th>Status</th>\n";
}
echo "<th>Time</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if ($_GET['rows'] == 0) {
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
echo "<th>Dest</th>\n";
echo "<th>App</th>\n";
echo "<th>Secure</th>\n";
}
}
echo "<th>Name</th>\n";
if (if_group("admin") || if_group("superadmin")) {
if ($_GET['rows'] == 0) {
echo "<th>Options</th>\n";
}
}
echo "</tr>\n";
}
$y++;
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
echo "<br /><br />\n";
//valet park
echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th valign='top'>Park Extension</th>\n";
echo "<th valign='top'>Time</th>\n";
echo "<th valign='top'>CID Name</th>\n";
echo "<th valign='top'>CID Number</th>\n";
echo "</tr>\n";
foreach ($valet_array as $row) {
if (strlen($row['extension']) > 0) {
if ($row['context'] == $_SESSION['domain_name'] || $row['context'] == "default") {
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."' >*".$row['extension']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' >".$row['call_length']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' >".$row['cid_name']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' >".$row['cid_num']."</td>\n";
echo "</tr>\n";
}
}
}
echo "<table>\n";
}
echo "<br /><br />\n";
if ($user_status == "Available (On Demand)") {
$user_status = "Available_On_Demand";
}
$user_status = str_replace(" ", "_", $user_status);
echo "<span id='db_user_status' style='visibility:hidden;'>$user_status</span>\n";
echo "<div id='cmd_reponse'>\n";
echo "</div>\n";
}
?>

View File

@@ -0,0 +1,172 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('calls_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the command
$switch_cmd = 'show channels';
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//if the connnection is available then run it and return the results
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//send the event socket command
$csv = trim(event_socket_request($fp, 'api '.$switch_cmd));
//prepare the string
$result_array = explode("\n\n",$csv);
//get the named array
$result_array = csv_to_named_array($result_array[0], ",");
//set the alternating color for each row
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the results
echo "<div id='cmd_reponse'>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='3' cellspacing='0'>\n";
echo "<tr>\n";
//echo "<th>ID</th>\n";
//echo "<th>UUID</th>\n";
//echo "<th>Dir</th>\n";
echo "<th>Profile</th>\n";
echo "<th>Created</th>\n";
//echo "<th>Created Epoch</th>\n";
//echo "<th>Name</th>\n";
echo "<th>Number</th>\n";
//echo "<th>State</th>\n";
echo "<th>CID Name</th>\n";
echo "<th>CID Number</th>\n";
//echo "<th>IP Addr</th>\n";
echo "<th>Dest</th>\n";
echo "<th>Application</th>\n";
//echo "<th>Dialplan</th>\n";
//echo "<th>Context</th>\n";
echo "<th>Read / Write Codec</th>\n";
//echo "<th>Read Rate</th>\n";
//echo "<th>Write Codec</th>\n";
//echo "<th>Write Rate</th>\n";
echo "<th>Secure</th>\n";
echo "<th>Options</th>\n";
echo "</tr>\n";
foreach ($result_array as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//get the sip profile
$name_array = explode("/", $name);
$sip_profile = $name_array[1];
$sip_uri = $name_array[2];
//get the number
$temp_array = explode("@", $sip_uri);
$tmp_number = $temp_array[0];
$tmp_number = str_replace("sip:", "", $tmp_number);
//remove the '+' because it breaks the call recording
$cid_num = str_replace("+", "", $cid_num);
echo "<tr>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$id &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$uuid &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$direction &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$sip_profile &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$created &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$created_epoch &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$name &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tmp_number."&nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$state &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$cid_name &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$cid_num &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$ip_addr &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$dest &nbsp;</td>\n";
if (strlen($application) > 0) {
echo "<td valign='top' class='".$row_style[$c]."'>".$application.":".$application_data." &nbsp;</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp;</td>\n";
}
//echo "<td valign='top' class='".$row_style[$c]."'>$dialplan &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$context &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$read_codec:$read_rate / $write_codec:$write_rate &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$read_rate &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$write_codec &nbsp;</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$write_rate &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$secure &nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."' style='text-align:center;'>\n";
//transfer
echo " <a href='javascript:void(0);' onMouseover=\"document.getElementById('form_label').innerHTML='<strong>Transfer To</strong>';\" onclick=\"send_cmd('v_calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">xfer</a>&nbsp;\n";
//park
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">park</a>&nbsp;\n";
//hangup
echo " <a href='javascript:void(0);' onclick=\"confirm_response = confirm('Do you really want to hangup this call?');if (confirm_response){send_cmd('v_calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">hangup</a>&nbsp;\n";
//record start/stop
$tmp_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d");
mkdir($tmp_dir, 0777, true);
$tmp_file = $tmp_dir."/".$uuid.".wav";
if (file_exists($tmp_file)) {
//stop
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_calls_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=stop&prefix=active_calls_&name='+escape('$cid_num'));\">stop rec</a>&nbsp;\n";
}
else {
//start
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('v_calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_calls_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=start&prefix=active_calls_');\">rec</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
}
?>

View File

@@ -0,0 +1,259 @@
<?php
/* $Id$ */
/*
v_exec.php
Copyright (C) 2008 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('calls_active_view') || permission_exists('extensions_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//authorized referrer
if(stristr($_SERVER["HTTP_REFERER"], '/v_calls_active_extensions.php') === false) {
if(stristr($_SERVER["HTTP_REFERER"], '/v_calls_active.php') === false) {
echo " access denied";
exit;
}
}
//http get variables set to php variables
if (count($_GET)>0) {
$switch_cmd = trim($_GET["cmd"]);
$action = trim($_GET["action"]);
$data = trim($_GET["data"]);
$direction = trim($_GET["direction"]);
$username = $_SESSION['username'];
}
//authorized commands
if (stristr($switch_cmd, '&uuid=') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_kill') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_transfer') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_record') == true) {
//authorized;
} elseif (stristr($action, 'user_status') == true) {
//authorized;
} elseif (stristr($action, 'callcenter_config') == true) {
//authorized;
} else {
//not found. this command is not authorized
echo "access denied";
exit;
}
if (count($_GET)>0) {
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (stristr($action, 'user_status') == true) {
$user_status = $data;
switch ($user_status) {
case "Available":
$user_status = "Available";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "Available_On_Demand":
$user_status = "Available (On Demand)";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "Logged_Out":
$user_status = "Logged Out";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "On_Break":
$user_status = "On Break";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
case "Do_Not_Disturb":
$user_status = "Do Not Disturb";
//update the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
break;
default:
$user_status = "";
}
//update the v_users table with the status
$sql = "update v_users set ";
$sql .= "user_status = '$user_status' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$username."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
if (strlen($user_status) > 0) {
//include the dnd class
include "includes/classes/do_not_disturb.php";
//loop through the list of assigned extensions
foreach ($_SESSION['user']['extension'] as &$row) {
$extension = $row["user"];
//set the default action
if ($user_status == "Do Not Disturb") {
$dnd_action = "add";
}
//hunt_group information used to determine if this is an add or an update
$sql = "select * from v_hunt_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hunt_group_extension = '$extension' ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
foreach ($result2 as &$row2) {
if ($row2["hunt_group_type"] == 'dnd') {
$dnd_action = "update";
$dnd_uuid = $row2["hunt_group_uuid"];
}
}
unset ($prep_statement_2, $result, $row2);
//add or update dnd
$dnd = new do_not_disturb;
$dnd->domain_uuid = $domain_uuid;
$dnd->dnd_uuid = $dnd_uuid;
$dnd->domain_name = $_SESSION['domain_name'];
$dnd->extension = $extension;
if ($user_status == "Do Not Disturb") {
$dnd->dnd_enabled = "true";
if ($dnd_action == "add") {
$dnd->dnd_add();
}
if ($dnd_action == "update") {
$dnd->dnd_update();
}
}
else {
//for other status disable dnd
if ($dnd_action == "update") {
$dnd->dnd_enabled = "false";
$dnd->dnd_update();
}
}
$dnd->debug = false;
$dnd->dnd_status();
unset($dnd);
}
unset ($prep_statement);
}
//synchronize the xml config
save_hunt_group_xml();
//synchronize the xml config
save_dialplan_xml();
//reloadxml
$cmd = 'api reloadxml';
$response = event_socket_request($fp, $cmd);
//apply settings reminder
$_SESSION["reload_xml"] = false;
}
//fs cmd
if (strlen($switch_cmd) > 0) {
//set the status so they are compatible with mod_callcenter
$switch_cmd = str_replace("Available_On_Demand", "'Available (On Demand)'", $switch_cmd);
$switch_cmd = str_replace("Logged_Out", "'Logged Out'", $switch_cmd);
$switch_cmd = str_replace("On_Break", "'On Break'", $switch_cmd);
$switch_cmd = str_replace("Do_Not_Disturb", "'Logged Out'", $switch_cmd);
/*
//if ($action == "energy") {
//conference 3001-example.org energy 103
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
//if ($direction == "up") { $tmp_value = $tmp_value + 100; }
//if ($direction == "down") { $tmp_value = $tmp_value - 100; }
//echo "energy $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
//}
if ($action == "volume_in") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
if ($action == "volume_out") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
*/
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
if ($action == "record") {
if (trim($_GET["action2"]) == "stop") {
$x=0;
while (true) {
if ($x > 0) {
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"]."_".$x.".wav";
}
else {
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav";
}
if (!file_exists($dest_file)) {
rename($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav", $dest_file);
break;
}
$x++;
}
}
}
}
}
?>

View File

@@ -0,0 +1,30 @@
<?php
//application details
$apps[$x]['name'] = "Click to Call";
$apps[$x]['uuid'] = 'eb221c9b-cb13-5542-9140-dff924816dc4';
$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'] = 'Originate calls with a URL.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Click to Call';
$apps[$x]['menu'][0]['uuid'] = 'f862556f-9ddd-2697-fdf4-bed08ec63aa5';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/click_to_call/click_to_call.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'click_to_call_view';
$apps[$x]['permissions'][0]['groups'][] = 'user';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'click_to_call_call';
$apps[$x]['permissions'][1]['groups'][] = 'user';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
?>

View File

@@ -0,0 +1,331 @@
<?php
/* $Id$ */
/*
call.php
Copyright (C) 2008, 2009 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('click_to_call_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest'])) {
//get the http variables and set them as variables
$src = $_REQUEST['src'];
$dest = $_REQUEST['dest'];
$ringback = $_REQUEST['ringback'];
$src = str_replace(array('.', '(', ')', '-', ' '), '', $src);
$dest = str_replace(array('.', '(', ')', '-', ' '), '', $dest);
$src_cid_name = $_REQUEST['src_cid_name'];
$src_cid_number = $_REQUEST['src_cid_number'];
$dest_cid_name = $_REQUEST['dest_cid_name'];
$dest_cid_number = $_REQUEST['dest_cid_number'];
$rec = $_REQUEST['rec']; //true,false
if (strlen($cid_number) == 0) { $cid_number = $src;}
if (strlen($_SESSION['context']) > 0) {
$context = $_SESSION['context'];
}
else {
$context = 'default';
}
//translate ringback
switch ($ringback) {
case "us-ring":
$ringback_value = "\'%(2000,4000,440.0,480.0)\'";
break;
case "uk-ring":
$ringback_value = "\'%(400,200,400,450);%(400,2200,400,450)\'";
break;
case "fr-ring":
$ringback_value = "\'%(1500,3500,440.0,0.0)\'";
break;
case "rs-ring":
$ringback_value = "\'%(1000,4000,425.0,0.0)\'";
break;
case "music":
$ringback_value = "\'local_stream://moh\'";
break;
default:
$ringback = 'us-ring';
$ringback_value = "\'%(2000,4000,440.0,480.0)\'";
}
//source should see the destination caller id
if (strlen($src) < 7) {
$source = "{origination_caller_id_name='$src_cid_name',origination_caller_id_number=$src_cid_number,instant_ringback=true,ringback=$ringback_value,presence_id=$src@".$_SESSION['domains'][$domain_uuid]['domain_name'].",call_direction=outbound}sofia/internal/$src%".$_SESSION['domains'][$domain_uuid]['domain_name'];
}
else {
$bridge_array = outbound_route_to_bridge ($src);
$source = "{origination_caller_id_name='$src_cid_name',origination_caller_id_number=$src_cid_number,instant_ringback=true,ringback=$ringback_value,presence_id=$src@".$_SESSION['domains'][$domain_uuid]['domain_name'].",call_direction=outbound}".$bridge_array[0];
}
//destination needs to see the source caller id
if (strlen($dest) < 7) {
$switch_cmd = "api originate $source &transfer('".$dest." XML ".$context."')";
}
else {
if (strlen($src) < 7) {
if (strlen($dest_cid_number) == 0) {
//get the caller id from the extension caller id comes from the extension (the source number)
$sql = "";
$sql .= "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension = '$src' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$dest_cid_name = $row["outbound_caller_id_name"];
$dest_cid_number = $row["outbound_caller_id_number"];
break; //limit to 1 row
}
unset ($prep_statement);
}
}
$bridge_array = outbound_route_to_bridge ($dest);
$destination = "{origination_caller_id_name='$dest_cid_name',origination_caller_id_number=$dest_cid_number}".$bridge_array[0];
if (permission_exists('click_to_call_call')) {
$switch_cmd = "api originate $source &bridge($destination)";
}
}
//display the last command
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$switch_cmd $src has called $dest</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
//create the even socket connection and send the event socket command
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
//show the error message
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo " <th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//show the command result
$result = trim(event_socket_request($fp, $switch_cmd));
if (substr($result, 0,3) == "+OK") {
$uuid = substr($result, 4);
if ($rec == "true") {
//use the server's time zone to ensure it matches the time zone used by freeswitch
date_default_timezone_set($_SESSION['time_zone']['system']);
//create the api record command and send it over event socket
$switch_cmd = "api uuid_record ".$uuid." start ".$_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
$result2 = trim(event_socket_request($fp, $switch_cmd));
}
}
echo "<div align='center'>\n";
echo "<br />\n";
echo $result;
echo "<br />\n";
echo "<br />\n";
echo "</div>\n";
}
}
//show html form
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " <span class=\"vexpl\" class=\"red\">\n";
echo " <strong>Click to Call</strong>\n";
echo " </span>\n";
echo " </td>\n";
echo " <td align='right'>\n";
echo " &nbsp;\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " <span class=\"vexpl\">\n";
echo " Provide the following information to make a call from the source number to the destination number.\n";
echo " </span>\n";
echo " </td>\n";
echo "\n";
echo " </tr>\n";
echo " </table>";
echo " <br />";
echo "<form>\n";
echo "<table border='0' width='100%' cellpadding='6' cellspacing='0'\n";
echo "<tr>\n";
echo " <td class='vncellreq' width='40%'>Source Caller ID Name:</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src_cid_name\" value='$src_cid_name' class='formfld'>\n";
echo " <br />\n";
echo " Enter the name to show to the source caller.\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>Source Caller ID Number:</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src_cid_number\" value='$src_cid_number' class='formfld'>\n";
echo " <br />\n";
echo " Enter the number to show to the source caller.\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncell' width='40%'>Destination Caller ID Name:</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest_cid_name\" value='$dest_cid_name' class='formfld'>\n";
echo " <br />\n";
echo " Enter the name to send to the destination callee.\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncell'>Destination Caller ID Number:</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest_cid_number\" value='$dest_cid_number' class='formfld'>\n";
echo " <br />\n";
echo " Enter the number to show to the destination callee.\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>Source Number:</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src\" value='$src' class='formfld'>\n";
echo " <br />\n";
echo " Enter the number to call from.\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>Destination Number:</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest\" value='$dest' class='formfld'>\n";
echo " <br />\n";
echo " Enter the number to call.\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Record:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='rec'>\n";
echo " <option value=''></option>\n";
if ($rec == "true") {
echo " <option value='true' selected='selected'>true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($rec == "false") {
echo " <option value='false' selected='selected'>false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select whether to record the call.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Ring Back:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='ringback'>\n";
echo " <option value=''></option>\n";
if ($ringback == "us-ring") {
echo " <option value='us-ring' selected='selected'>us-ring</option>\n";
}
else {
echo " <option value='us-ring'>us-ring</option>\n";
}
if ($ringback == "fr-ring") {
echo " <option value='fr-ring' selected='selected'>fr-ring</option>\n";
}
else {
echo " <option value='fr-ring'>fr-ring</option>\n";
}
if ($ringback == "uk-ring") {
echo " <option value='uk-ring' selected='selected'>uk-ring</option>\n";
}
else {
echo " <option value='uk-ring'>uk-ring</option>\n";
}
if ($ringback == "rs-ring") {
echo " <option value='rs-ring' selected='selected'>rs-ring</option>\n";
}
else {
echo " <option value='rs-ring'>rs-ring</option>\n";
}
if ($ringback == "music") {
echo " <option value='music' selected='selected'>music</option>\n";
}
else {
echo " <option value='music'>music</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Defines what the caller will hear while destination is being called. The choices are music (music on hold) ring (ring tone.)\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type=\"submit\" class='btn' value=\"Call\">\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>";
//show the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,140 @@
<?php
//application details
$apps[$x]['name'] = 'Conferences';
$apps[$x]['uuid'] = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9';
$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'] = 'Conferences is used to setup conference rooms with a name, description, and optional pin number.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Conferences';
$apps[$x]['menu'][0]['title']['pt-pt'] = 'Conferencias';
$apps[$x]['menu'][0]['uuid'] = '9f2a8c08-3e65-c41c-a716-3b53d42bc4d4';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/conferences/conferences.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'] = 'conference_view';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'user';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'conference_add';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'conference_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'] = 'conference_delete';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_conferences';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_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]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the conference name.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_extension';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the conference extension number.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_pin_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Optional pin number to secure access to the conference.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_profile';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Conference Profile is a collection of settings for the conference.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_flags';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Optional conference flags. examples: mute|deaf|waste|moderator';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_order';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the order number.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the description.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Select whether to enable or disable the conference.';
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_conference_users';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_conferences';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'conference_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_users';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>

View File

@@ -0,0 +1,202 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conference_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/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 align='left' width='50%' nowrap><b>Conferences</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 " Conferences is used to setup conference rooms with a name, description, and optional pin number. \n";
if (permission_exists('conferences_active_advanced_view')) {
echo " Show <a href='".PROJECT_PATH."/app/conferences_active/v_conferences_active.php'>Active Conferences</a> and then select a conference to monitor and interact with it.<br /><br />\n";
}
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
//prepare to page the results
if (if_group("superadmin") || if_group("admin")) {
//show all extensions
$sql = "select count(*) as num_rows from v_conferences ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
}
else {
//show only assigned extensions
$sql = "select count(*) as num_rows from v_conferences as c, v_conference_users as u ";
$sql .= "where c.conference_uuid = u.conference_uuid ";
$sql .= "and c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
}
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
if (if_group("superadmin") || if_group("admin")) {
//show all extensions
$sql = "select * from v_conferences ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
}
else {
//show only assigned extensions
$sql = "select * from v_conferences as c, v_conference_users as u ";
$sql .= "where c.conference_uuid = u.conference_uuid ";
$sql .= "and c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_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('conference_name', 'Name', $order_by, $order);
echo th_order_by('conference_extension', 'Extension', $order_by, $order);
echo th_order_by('conference_profile', 'Profile', $order_by, $order);
//echo th_order_by('conference_flags', 'Flags', $order_by, $order);
echo th_order_by('conference_order', 'Order', $order_by, $order);
echo th_order_by('conference_enabled', 'Enabled', $order_by, $order);
echo th_order_by('conference_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('conference_add')) {
echo " <a href='conferences_edit.php' alt='add'>$v_link_label_add</a>\n";
}
else {
echo " &nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$conference_name = $row['conference_name'];
$conference_name = str_replace("-", " ", $conference_name);
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$conference_name."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['conference_extension']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['conference_profile']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['conference_flags']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['conference_order']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['conference_enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg' width='35%'>".$row['conference_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('conference_edit')) {
echo " <a href='conferences_edit.php?id=".$row['conference_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('conference_delete')) {
echo " <a href='conferences_delete.php?id=".$row['conference_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\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='10' 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('conference_add')) {
echo " <a href='conferences_edit.php' alt='add'>$v_link_label_add</a>\n";
}
else {
echo " &nbsp;\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 "includes/footer.php";
?>

View File

@@ -0,0 +1,91 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conference_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
if (strlen($id)>0) {
//get the dialplan uuid
$sql = "select * from v_conferences ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and conference_uuid = '$id' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
$dialplan_uuid = $row['dialplan_uuid'];
}
//delete conference
$sql = "delete from v_conferences ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and conference_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//delete the dialplan entry
$sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//delete the dialplan details
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//syncrhonize configuration
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,541 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conference_add') || permission_exists('conference_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$conference_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
$conference_name = check_str($_POST["conference_name"]);
$conference_extension = check_str($_POST["conference_extension"]);
$conference_pin_number = check_str($_POST["conference_pin_number"]);
$conference_profile = check_str($_POST["conference_profile"]);
$conference_flags = check_str($_POST["conference_flags"]);
$conference_order = check_str($_POST["conference_order"]);
$conference_description = check_str($_POST["conference_description"]);
$conference_enabled = check_str($_POST["conference_enabled"]);
//sanitize the conference name
$conference_name = preg_replace("/[^A-Za-z0-9\- ]/", "", $conference_name);
$conference_name = str_replace(" ", "-", $conference_name);
}
//delete the user from the v_conference_users
if ($_GET["a"] == "delete" && permission_exists("conference_delete")) {
//set the variables
$user_uuid = check_str($_REQUEST["user_uuid"]);
$conference_uuid = check_str($_REQUEST["id"]);
//delete the group from the users
$sql = "delete from v_conference_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and conference_uuid = '".$conference_uuid."' ";
$sql .= "and user_uuid = '".$user_uuid."' ";
$db->exec(check_sql($sql));
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences_edit.php?id=$conference_uuid\">\n";
echo "<div align='center'>Delete Complete</div>";
require_once "includes/footer.php";
return;
}
//add the user to the v_conference_users
if (strlen($_REQUEST["user_uuid"]) > 0 && strlen($_REQUEST["id"]) > 0 && $_GET["a"] != "delete") {
//set the variables
$user_uuid = check_str($_REQUEST["user_uuid"]);
$conference_uuid = check_str($_REQUEST["id"]);
//assign the user to the extension
$sql_insert = "insert into v_conference_users ";
$sql_insert .= "(";
$sql_insert .= "conference_user_uuid, ";
$sql_insert .= "domain_uuid, ";
$sql_insert .= "conference_uuid, ";
$sql_insert .= "user_uuid ";
$sql_insert .= ")";
$sql_insert .= "values ";
$sql_insert .= "(";
$sql_insert .= "'".uuid()."', ";
$sql_insert .= "'".$_SESSION['domain_uuid']."', ";
$sql_insert .= "'".$conference_uuid."', ";
$sql_insert .= "'".$user_uuid."' ";
$sql_insert .= ")";
$db->exec($sql_insert);
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences_edit.php?id=$conference_uuid\">\n";
echo "<div align='center'>Add Complete</div>";
require_once "includes/footer.php";
return;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$conference_uuid = check_str($_POST["conference_uuid"]);
}
//check for all required data
//if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID<br>\n"; }
if (strlen($conference_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
if (strlen($conference_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
//if (strlen($conference_pin_number) == 0) { $msg .= "Please provide: Pin Number<br>\n"; }
if (strlen($conference_profile) == 0) { $msg .= "Please provide: Profile<br>\n"; }
//if (strlen($conference_flags) == 0) { $msg .= "Please provide: Flags<br>\n"; }
//if (strlen($conference_order) == 0) { $msg .= "Please provide: Order<br>\n"; }
//if (strlen($conference_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($conference_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
//prepare the uuids
$conference_uuid = uuid();
$dialplan_uuid = uuid();
//add the conference
$sql = "insert into v_conferences ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "conference_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "conference_name, ";
$sql .= "conference_extension, ";
$sql .= "conference_pin_number, ";
$sql .= "conference_profile, ";
$sql .= "conference_flags, ";
$sql .= "conference_order, ";
$sql .= "conference_description, ";
$sql .= "conference_enabled ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$conference_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'$conference_name', ";
$sql .= "'$conference_extension', ";
$sql .= "'$conference_pin_number', ";
$sql .= "'$conference_profile', ";
$sql .= "'$conference_flags', ";
$sql .= "'$conference_order', ";
$sql .= "'$conference_description', ";
$sql .= "'$conference_enabled' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//create the dialplan entry
$dialplan_name = $conference_name;
$dialplan_order ='333';
$dialplan_context = $_SESSION['context'];
$dialplan_enabled = 'true';
$dialplan_description = $conference_description;
$app_uuid = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9';
dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid);
//<condition destination_number="500" />
$dialplan_detail_tag = 'condition'; //condition, action, antiaction
$dialplan_detail_type = 'destination_number';
$dialplan_detail_data = '^'.$conference_extension.'$';
$dialplan_detail_order = '000';
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//<action application="answer" />
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'answer';
$dialplan_detail_data = '';
$dialplan_detail_order = '010';
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//<action application="answer" />
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'conference';
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
$dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
$dialplan_detail_order = '020';
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
//update the conference extension
$sql = "update v_conferences set ";
$sql .= "conference_name = '$conference_name', ";
$sql .= "conference_extension = '$conference_extension', ";
$sql .= "conference_pin_number = '$conference_pin_number', ";
$sql .= "conference_profile = '$conference_profile', ";
$sql .= "conference_flags = '$conference_flags', ";
$sql .= "conference_order = '$conference_order', ";
$sql .= "conference_description = '$conference_description', ";
$sql .= "conference_enabled = '$conference_enabled' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and conference_uuid = '$conference_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//udpate the conference dialplan
$sql = "update v_dialplans set ";
$sql .= "dialplan_name = '$conference_name', ";
if (strlen($dialplan_order) > 0) {
$sql .= "dialplan_order = '333', ";
}
$sql .= "dialplan_context = '".$_SESSION['context']."', ";
$sql .= "dialplan_enabled = 'true', ";
$sql .= "dialplan_description = '$conference_description' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//update dialplan detail condition
$sql = "";
$sql = "update v_dialplan_details set ";
$sql .= "dialplan_detail_data = '^".$conference_extension."$' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_detail_tag = 'condition' ";
$sql .= "and dialplan_detail_type = 'destination_number' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//update dialplan detail action
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
$dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
$sql = "update v_dialplan_details set ";
$sql .= "dialplan_detail_data = '".$dialplan_detail_data."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_detail_tag = 'action' ";
$sql .= "and dialplan_detail_type = 'conference' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$conference_uuid = $_GET["id"];
$sql = "select * from v_conferences ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and conference_uuid = '$conference_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
foreach ($result as &$row) {
$dialplan_uuid = $row["dialplan_uuid"];
$conference_name = $row["conference_name"];
$conference_extension = $row["conference_extension"];
$conference_pin_number = $row["conference_pin_number"];
$conference_profile = $row["conference_profile"];
$conference_flags = $row["conference_flags"];
$conference_order = $row["conference_order"];
$conference_description = $row["conference_description"];
$conference_enabled = $row["conference_enabled"];
$conference_name = str_replace("-", " ", $conference_name);
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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>Conference Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Conference Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='conferences.php'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "Conferences is used to setup conference rooms with a name, description, and optional pin number. \n";
echo "Click on <a href='".PROJECT_PATH."/app/conferences_active/v_conference_interactive.php?c=".str_replace(" ", "-", $conference_name)."'>Active Conference</a> \n";
echo "to monitor and interact with the conference room.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' 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='conference_name' maxlength='255' value=\"$conference_name\">\n";
echo "<br />\n";
echo "Enter the conference name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Extension:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='conference_extension' maxlength='255' value=\"$conference_extension\">\n";
echo "<br />\n";
echo "Enter the conference extension number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Pin Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='conference_pin_number' maxlength='255' value=\"$conference_pin_number\">\n";
echo "<br />\n";
echo "Optional pin number to secure access to the conference.\n";
echo "</td>\n";
echo "</tr>\n";
if (if_group("admin") || if_group("superadmin")) {
if ($action == "update") {
echo " <tr>";
echo " <td class='vncell' valign='top'>User List:</td>";
echo " <td class='vtable'>";
echo " <table width='52%'>\n";
$sql = "SELECT * FROM v_conference_users as e, v_users as u ";
$sql .= "where e.user_uuid = u.user_uuid ";
$sql .= "and e.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and e.conference_uuid = '".$conference_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
$result_count = count($result);
foreach($result as $field) {
echo " <tr>\n";
echo " <td class='vtable'>".$field['username']."</td>\n";
echo " <td>\n";
echo " <a href='conferences_edit.php?id=".$conference_uuid."&domain_uuid=".$_SESSION['domain_uuid']."&user_uuid=".$field['user_uuid']."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo " </tr>\n";
}
echo " </table>\n";
echo " <br />\n";
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo " <select name=\"user_uuid\" class='frm'>\n";
echo " <option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $field) {
echo " <option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
}
echo " </select>";
echo " <input type=\"submit\" class='btn' value=\"Add\">\n";
unset($sql, $result);
echo " <br>\n";
echo " Assign the users that are can manage this conference extension.\n";
echo " <br />\n";
echo " </td>";
echo " </tr>";
}
}
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Profile:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='conference_profile'>\n";
//if the profile has no value set it to default
if ($conference_profile == "") { $conference_profile = "default"; }
if ($conference_profile == "default") { echo "<option value='default' selected='selected'>default</option>\n"; } else { echo "<option value='default'>default</option>\n"; }
if ($conference_profile == "wideband") { echo "<option value='wideband' selected='selected'>wideband</option>\n"; } else { echo "<option value='wideband'>wideband</option>\n"; }
if ($conference_profile == "ultrawideband") { echo "<option value='ultrawideband' selected='selected'>ultrawideband</option>\n"; } else { echo "<option value='ultrawideband'>ultrawideband</option>\n"; }
if ($conference_profile == "cdquality") { echo "<option value='cdquality' selected='selected'>cdquality</option>\n"; } else { echo "<option value='cdquality'>cdquality</option>\n"; }
echo " </select>\n";
echo "<br />\n";
echo "Conference Profile is a collection of settings for the conference.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Flags:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='conference_flags' maxlength='255' value=\"$conference_flags\">\n";
echo "<br />\n";
echo "Optional conference flags. examples: mute|deaf|waste|moderator\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Order:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='conference_order' class='formfld'>\n";
if (strlen(htmlspecialchars($dialplan_order))> 0) {
echo " <option selected='selected' value='".htmlspecialchars($dialplan_order)."'>".htmlspecialchars($dialplan_order)."</option>\n";
}
$i=0;
while($i<=999) {
if (strlen($i) == 1) { echo " <option value='00$i'>00$i</option>\n"; }
if (strlen($i) == 2) { echo " <option value='0$i'>0$i</option>\n"; }
if (strlen($i) == 3) { echo " <option value='$i'>$i</option>\n"; }
$i++;
}
echo " </select>\n";
echo "<br />\n";
echo "Enter the order number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' 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='conference_enabled'>\n";
echo " <option value=''></option>\n";
if ($conference_enabled == "true") {
echo " <option value='true' selected='selected'>true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($conference_enabled == "false") {
echo " <option value='false' selected='selected'>false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select whether to enable or disable the conference.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Description:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='conference_description' maxlength='255' value=\"$conference_description\">\n";
echo "<br />\n";
echo "Enter the description.\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='dialplan_uuid' value=\"$dialplan_uuid\">\n";
echo " <input type='hidden' name='conference_uuid' value='$conference_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

50
app/conferences/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,70 @@
<?php
//application details
$apps[$x]['name'] = "Conferences Active";
$apps[$x]['uuid'] = 'c168c943-833a-c29c-7ef9-d1ee78810b71';
$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'] = 'AJAX tool to view and manage all active callers in a conference room.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Active Conferences';
$apps[$x]['menu'][0]['uuid'] = '2d857bbb-43b9-b8f7-a138-642868e0453a';
$apps[$x]['menu'][0]['parent_uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/conferences_active/v_conferences_active.php';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'conferences_active_view';
$apps[$x]['permissions'][0]['groups'][] = 'user';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'conferences_active_record';
$apps[$x]['permissions'][1]['groups'][] = 'user';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'conferences_active_lock';
$apps[$x]['permissions'][2]['groups'][] = 'user';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'conferences_active_kick';
$apps[$x]['permissions'][3]['groups'][] = 'user';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'conferences_active_energy';
$apps[$x]['permissions'][4]['groups'][] = 'user';
$apps[$x]['permissions'][4]['groups'][] = 'admin';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
$apps[$x]['permissions'][5]['name'] = 'conferences_active_volume';
$apps[$x]['permissions'][5]['groups'][] = 'user';
$apps[$x]['permissions'][5]['groups'][] = 'admin';
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
$apps[$x]['permissions'][6]['name'] = 'conferences_active_gain';
$apps[$x]['permissions'][6]['groups'][] = 'user';
$apps[$x]['permissions'][6]['groups'][] = 'admin';
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
$apps[$x]['permissions'][7]['name'] = 'conferences_active_mute';
$apps[$x]['permissions'][7]['groups'][] = 'user';
$apps[$x]['permissions'][7]['groups'][] = 'admin';
$apps[$x]['permissions'][7]['groups'][] = 'superadmin';
$apps[$x]['permissions'][8]['name'] = 'conferences_active_deaf';
$apps[$x]['permissions'][8]['groups'][] = 'user';
$apps[$x]['permissions'][8]['groups'][] = 'admin';
$apps[$x]['permissions'][8]['groups'][] = 'superadmin';
$apps[$x]['permissions'][9]['name'] = 'conferences_active_advanced_view';
$apps[$x]['permissions'][9]['groups'][] = 'admin';
$apps[$x]['permissions'][9]['groups'][] = 'superadmin';
?>

View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

View File

@@ -0,0 +1,126 @@
<?php
/* $Id$ */
/*
v_exec.php
Copyright (C) 2008 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conferences_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the http values and set them as php variables
if (count($_GET)>0) {
$cmd = trim($_GET["cmd"]);
$name = trim($_GET["name"]);
$data = trim($_GET["data"]);
$id = trim($_GET["id"]);
$direction = trim($_GET["direction"]);
}
//authorized commands
if ($cmd == "conference") {
//authorized;
} else {
//not found. this command is not authorized
echo "access denied";
exit;
}
//check if the domain is in the switch_cmd
if(stristr($name, $_SESSION['domain_name']) === FALSE) {
echo "access denied";
exit;
}
if (count($_GET)>0) {
if (strlen($cmd) > 0) {
//prepare the switch cmd
$switch_cmd = $cmd . " ";
$switch_cmd .= $name . " ";
$switch_cmd .= $data . " ";
if (strlen($id) > 0) {
$switch_cmd .= " ".$id;
}
//connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
if ($data == "energy") {
//conference 3001-example-domain.org energy 103
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 100; }
if ($direction == "down") { $tmp_value = $tmp_value - 100; }
//echo "energy $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
elseif ($data == "volume_in") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
elseif ($data == "volume_out") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result);
$tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
}
elseif ($data == "record") {
$switch_cmd .= $_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav";
if (!file_exists($_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav")) {
$switch_result = event_socket_request($fp, "api ".$switch_cmd);
}
}
elseif ($data == "norecord") {
//stop recording and rename the file
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav")) {
rename($_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav", $_SESSION['switch']['recordings']['dir']."/".$name."-".date("Y").".".date("M").".".date("d")."-".uuid().".wav");
}
$switch_cmd .= $_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
else {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
}
}
?>

View File

@@ -0,0 +1,129 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conferences_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get and prepare the conference name
$conference_name = check_str(trim($_REQUEST["c"]));
$conference_display_name = str_replace("-", " ", $conference_name);
$conference_display_name = str_replace("_", " ", $conference_display_name);
//show the header
require_once "includes/header.php";
?><script type="text/javascript">
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = 'v_conference_interactive_inc.php?c=<?php echo trim($_REQUEST["c"]); ?>';
new loadXmlHttp(url, 'ajax_reponse');
setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, 1222);
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
function send_cmd(url) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;
}
var record_count = 0;
</script>
<?php
echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Interactive Conference</b><br>\n";
echo " Use this to monitor and interact with the members of the <strong>$conference_display_name</strong> conference.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo " <tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <div id=\"ajax_reponse\"></div>\n";
echo " <div id=\"time_stamp\" style=\"visibility:hidden\">".date('Y-m-d-s')."</div>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//show the header
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,263 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conferences_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the http get or post and set it as php variables
$conference_name = check_str($_REQUEST["c"]);
//determine if the user should have access to the conference room
if (if_group("superadmin") || if_group("admin")) {
//access granted
}
else {
//get the conference_uuid from the coference_name
$sql = "select conference_uuid from v_conferences ";
$sql .= "where conference_name = '".$conference_name."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$conference_uuid = $row['conference_uuid'];
}
//show only assigned extensions
$sql = "select count(*) as num_rows from v_conferences as c, v_conference_users as u ";
$sql .= "where c.conference_uuid = u.conference_uuid ";
$sql .= "and c.conference_uuid = '".$conference_uuid."' ";
$sql .= "and c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
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) {
echo "access denied";
exit;
}
}
}
//replace the space with underscore
$conference_name = $conference_name.'-'.$_SESSION['domain_name'];
//create the conference list command
$switch_cmd = "conference '".$conference_name."' xml_list";
//connect to event socket, send the command and process the results
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//show the content
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
try {
$xml = new SimpleXMLElement($xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
//$name = $xml->conference['name'];
$member_count = $xml->conference['member-count'];
$locked = $xml->conference['locked'];
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div id='cmd_reponse'>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td >\n";
echo " <strong>Count: $member_count</strong>\n";
echo "</td>\n";
echo "<td colspan='9'>\n";
echo " &nbsp;\n";
echo "</td>\n";
echo "<td colspan='1' align='right'>\n";
if (permission_exists('conferences_active_record') || permission_exists('conferences_active_lock')) {
echo " <strong>Conference Tools:</strong> \n";
}
if (permission_exists('conferences_active_record')) {
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$conference_name."-tmp.wav")) {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=norecord');\">Stop Record</a>&nbsp;\n";
}
else {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=record');\">Start Record</a>&nbsp;\n";
}
}
if (permission_exists('conferences_active_lock')) {
if ($locked == "true") {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=unlock');\">Unlock</a>&nbsp;\n";
}
else {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=lock');\">Lock</a>&nbsp;\n";
}
}
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th>ID</th>\n";
//echo "<th>UUID</th>\n";
echo "<th>Caller ID Name</th>\n";
echo "<th>Caller ID Number</th>\n";
echo "<th>Joined</th>\n";
echo "<th>Hear</th>\n";
echo "<th>Speak</th>\n";
echo "<th>Talking</th>\n";
echo "<th>Last Talked</th>\n";
echo "<th>Video</th>\n";
echo "<th>Has Floor</th>\n";
echo "<th>Tools</th>\n";
echo "</tr>\n";
foreach ($xml->conference->members->member as $row) {
$id = $row->id;
$record_path = $row->record_path;
$flag_can_hear = $row->flags->can_hear;
$flag_can_speak = $row->flags->can_speak;
$flag_talking = $row->flags->talking;
$last_talking = $row->last_talking;
$join_time = $row->join_time;
$flag_has_video = $row->flags->has_video;
$flag_has_floor = $row->flags->has_floor;
$uuid = $row->uuid;
$caller_id_name = $row->caller_id_name;
$caller_id_name = str_replace("%20", " ", $caller_id_name);
$caller_id_number = $row->caller_id_number;
//format the seconds
$join_time_formatted = floor($join_time/60)."' ".($join_time - (floor($join_time/60))*60)."\"";
$last_talking_formatted = floor($last_talking/60)."' ".($last_talking - (floor($last_talking/60))*60)."\"";
if (strlen($record_path) == 0) {
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$id</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>$uuid</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$caller_id_name</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>$caller_id_number</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$join_time_formatted."</td>\n";
if ($flag_can_hear == "true") {
echo "<td valign='top' class='".$row_style[$c]."'>yes</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>no</td>\n";
}
if ($flag_can_speak == "true") {
echo "<td valign='top' class='".$row_style[$c]."'>yes</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>no</td>\n";
}
if ($flag_talking == "true") {
echo "<td valign='top' class='".$row_style[$c]."'>yes</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>no</td>\n";
}
echo "<td valign='top' class='".$row_style[$c]."'>$last_talking_formatted</td>\n";
if ($flag_has_video == "true") {
echo "<td valign='top' class='".$row_style[$c]."'>yes</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>no</td>\n";
}
if ($flag_has_floor == "true") {
echo "<td valign='top' class='".$row_style[$c]."'>yes</td>\n";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>no</td>\n";
}
echo "<td valign='top' class='".$row_style[$c]."' style='text-align:right;'>\n";
//energy
if (permission_exists('conferences_active_energy')) {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?direction=up&cmd=conference&name=".$conference_name."&data=energy&id=".$id."');\">+energy</a>&nbsp;\n";
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?direction=down&cmd=conference&name=".$conference_name."&data=energy&id=".$id."');\">-energy</a>&nbsp;\n";
}
//volume
if (permission_exists('conferences_active_volume')) {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?direction=up&cmd=conference&name=".$conference_name."%&data=volume_in&id=".$id."');\">+vol</a>&nbsp;\n";
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?direction=down&cmd=conference&name=".$conference_name."&data=volume_in&id=".$id."');\">-vol</a>&nbsp;\n";
}
if (permission_exists('conferences_active_gain')) {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?direction=up&cmd=conference&name=".$conference_name."&data=volume_out&id=".$id."');\">+gain</a>&nbsp;\n";
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?direction=down&cmd=conference&name=".$conference_name."&data=volume_out&id=".$id."');\">-gain</a>&nbsp;\n";
}
//mute and unmute
if (permission_exists('conferences_active_mute')) {
if ($flag_can_speak == "true"){
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=mute&id=".$id."');\">mute</a>&nbsp;\n";
}
else {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=unmute&id=".$id."');\">unmute</a>&nbsp;\n";
}
}
//deaf and undeaf
if (permission_exists('conferences_active_deaf')) {
if ($flag_can_hear == "true"){
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=deaf&id=".$id."');\">deaf</a>&nbsp;\n";
}
else {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=undeaf&id=".$id."');\">undeaf</a>&nbsp;\n";
}
}
//kick someone from the conference
if (permission_exists('conferences_active_kick')) {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('v_conference_exec.php?cmd=conference&name=".$conference_name."&data=kick&id=".$id."');\">kick</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";
echo "</tr>\n";
}
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
}
?>

View File

@@ -0,0 +1,112 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conferences_active_advanced_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
?><script type="text/javascript">
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = 'v_conferences_active_inc.php';
new loadXmlHttp(url, 'ajax_reponse');
setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, 1777);
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
</script>
<?php
echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Active Conferences</b><br>\n";
echo " List all the conferences that are currently active with one or more members.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <div id=\"ajax_reponse\">\n";
echo " </div>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,107 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('conferences_active_advanced_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
$tmp_conference_name = str_replace("_", " ", $conference_name);
$switch_cmd = 'conference xml_list';
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
try {
$xml = new SimpleXMLElement($xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Name</th>\n";
echo "<th>Member Count</th>\n";
echo "<th>&nbsp;</th>\n";
echo "</tr>\n";
foreach ($xml->conference as $row) {
//set the variables
$name = $row['name'];
$member_count = $row['member-count'];
//show the conferences that have a matching domain
$tmp_domain = substr($name, -strlen($_SESSION['domain_name']));
if ($tmp_domain == $_SESSION['domain_name']) {
$conference_name = substr($name, 0, strlen($name) - strlen('-'.$_SESSION['domain_name']));
$conference_display_name = str_replace("-", " ", $conference_name);
$conference_display_name = str_replace("_", " ", $conference_display_name);
//$id = $row->members->member->id;
//$flag_can_hear = $row->members->member->flags->can_hear;
//$flag_can_speak = $row->members->member->flags->can_speak;
//$flag_talking = $row->members->member->flags->talking;
//$flag_has_video = $row->members->member->flags->has_video;
//$flag_has_floor = $row->members->member->flags->has_floor;
//$uuid = $row->members->member->uuid;
//$caller_id_name = $row->members->member->caller_id_name;
//$caller_id_name = str_replace("%20", " ", $caller_id_name);
//$caller_id_number = $row->members->member->caller_id_number;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$conference_display_name."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$member_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'><a href='v_conference_interactive.php?c=".$conference_name."'>view</a></td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
}
echo "</table>\n";
}
?>

275
app/contacts/app_config.php Normal file
View File

@@ -0,0 +1,275 @@
<?php
//application details
$apps[$x]['name'] = 'Contacts';
$apps[$x]['uuid'] = '04481e0e-a478-c559-adad-52bd4174574c';
$apps[$x]['category'] = 'CRM';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['contact_url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en'] = 'Provides a place to store contact information for individuals and organizations.';
//menu details
$apps[$x]['menu'][$y]['title']['en'] = 'Contacts';
$apps[$x]['menu'][$y]['uuid'] = 'f14e6ab6-6565-d4e6-cbad-a51d2e3e8ec6';
$apps[$x]['menu'][$y]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][$y]['category'] = 'internal';
$apps[$x]['menu'][$y]['path'] = '/app/contacts/contacts.php';
//$apps[$x]['menu'][$y]['groups'][] = 'user';
$apps[$x]['menu'][$y]['groups'][] = 'admin';
$apps[$x]['menu'][$y]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'contacts_view';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][0]['groups'][] = 'user';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['name'] = 'contacts_add';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['name'] = 'contacts_edit';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
//$apps[$x]['permissions'][2]['groups'][] = 'user';
$apps[$x]['permissions'][3]['name'] = 'contacts_delete';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_contacts';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'contact_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the type.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_organization';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the organization.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_name_given';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the given name.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_name_family';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the family name.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_nickname';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the nickname.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_title';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the title.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_role';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the role.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_email';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the email address.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_url';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the website address.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_time_zone';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the time zone.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_note';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the notes.';
$z++;
$y = 1; //table array index
$apps[$x]['db'][$y]['table'] = 'v_contact_addresses';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_address_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the address type.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_street';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the street address.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_extended';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter teh extended address.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_locality';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the city.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_region';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the state or province.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_postal_code';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the postal code.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_country';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the country.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_latitude';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the latitude';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'address_longitude';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the longitude';
$z++;
$y = 2; //table array index
$apps[$x]['db'][$y]['table'] = 'v_contact_phones';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_phone_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the telephone type.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the telephone number.';
$z++;
$y = 3; //table array index
$apps[$x]['db'][$y]['table'] = 'v_contact_notes';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'contacts_note_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_note_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Contact ID';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'contact_note';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'notes';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'last_mod_date';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'last_mod_user';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
?>

View File

@@ -0,0 +1,173 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/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>Addresses</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 "List of addresses for the contact.<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_contact_addresses ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " and contact_uuid = '$contact_uuid' ";
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, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the contact list
$sql = " select * from v_contact_addresses ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " and contact_uuid = '$contact_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(PDO::FETCH_NAMED);
$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('address_type', 'Type', $order_by, $order);
//echo th_order_by('address_street', 'Street Address', $order_by, $order);
//echo th_order_by('address_extended', 'Extended Address', $order_by, $order);
echo th_order_by('address_locality', 'City', $order_by, $order);
echo th_order_by('address_region', 'Region', $order_by, $order);
//echo th_order_by('address_postal_code', 'Postal Code', $order_by, $order);
echo th_order_by('address_country', 'Country', $order_by, $order);
//echo th_order_by('address_latitude', 'Latitude', $order_by, $order);
//echo th_order_by('address_longitude', 'Longitude', $order_by, $order);
echo "<th>Tools</th>\n";
echo "<td align='right' width='42'>\n";
echo " <a href='contact_addresses_edit.php?contact_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code'];
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_type']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_street']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_extended']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_locality']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_region']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_postal_code']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_country']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_latitude']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['address_longitude']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>\n";
echo " <a href=\"http://maps.google.com/maps?q=".urlencode($map_query)."&hl=en\" target=\"_blank\">Map</a>&nbsp;\n";
echo " </td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='contact_addresses_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_address_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='contact_addresses_delete.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_address_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " </td>\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";
echo " <a href='contact_addresses_edit.php?contact_uuid=".$_GET['id']."' alt='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 "</td>";
//echo "</tr>";
//echo "</table>";
//echo "</div>";
//echo "<br><br>";
//include the footer
//require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,61 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$contact_uuid = check_str($_GET["contact_uuid"]);
}
if (strlen($id)>0) {
$sql = "";
$sql .= "delete from v_contact_addresses ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_address_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,352 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$contact_address_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$address_type = check_str($_POST["address_type"]);
$address_street = check_str($_POST["address_street"]);
$address_extended = check_str($_POST["address_extended"]);
$address_locality = check_str($_POST["address_locality"]);
$address_region = check_str($_POST["address_region"]);
$address_postal_code = check_str($_POST["address_postal_code"]);
$address_country = check_str($_POST["address_country"]);
$address_latitude = check_str($_POST["address_latitude"]);
$address_longitude = check_str($_POST["address_longitude"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$contact_address_uuid = check_str($_POST["contact_address_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($address_type) == 0) { $msg .= "Please provide: Address Type<br>\n"; }
//if (strlen($address_street) == 0) { $msg .= "Please provide: Street Address<br>\n"; }
//if (strlen($address_extended) == 0) { $msg .= "Please provide: Extended Address<br>\n"; }
//if (strlen($address_locality) == 0) { $msg .= "Please provide: City<br>\n"; }
//if (strlen($address_region) == 0) { $msg .= "Please provide: State / Province<br>\n"; }
//if (strlen($address_postal_code) == 0) { $msg .= "Please provide: Postal Code<br>\n"; }
//if (strlen($address_country) == 0) { $msg .= "Please provide: Country<br>\n"; }
//if (strlen($address_latitude) == 0) { $msg .= "Please provide: Latitude<br>\n"; }
//if (strlen($address_longitude) == 0) { $msg .= "Please provide: Longitude<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$contact_address_uuid = uuid();
$sql = "insert into v_contact_addresses ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_address_uuid, ";
$sql .= "address_type, ";
$sql .= "address_street, ";
$sql .= "address_extended, ";
$sql .= "address_locality, ";
$sql .= "address_region, ";
$sql .= "address_postal_code, ";
$sql .= "address_country, ";
$sql .= "address_latitude, ";
$sql .= "address_longitude ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$contact_address_uuid', ";
$sql .= "'$address_type', ";
$sql .= "'$address_street', ";
$sql .= "'$address_extended', ";
$sql .= "'$address_locality', ";
$sql .= "'$address_region', ";
$sql .= "'$address_postal_code', ";
$sql .= "'$address_country', ";
$sql .= "'$address_latitude', ";
$sql .= "'$address_longitude' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contact_addresses set ";
$sql .= "contact_uuid = '$contact_uuid', ";
$sql .= "address_type = '$address_type', ";
$sql .= "address_street = '$address_street', ";
$sql .= "address_extended = '$address_extended', ";
$sql .= "address_locality = '$address_locality', ";
$sql .= "address_region = '$address_region', ";
$sql .= "address_postal_code = '$address_postal_code', ";
$sql .= "address_country = '$address_country', ";
$sql .= "address_latitude = '$address_latitude', ";
$sql .= "address_longitude = '$address_longitude' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."'";
$sql .= "and contact_address_uuid = '$contact_address_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$contact_address_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_contact_addresses ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_address_uuid = '$contact_address_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$address_type = $row["address_type"];
$address_street = $row["address_street"];
$address_extended = $row["address_extended"];
$address_locality = $row["address_locality"];
$address_region = $row["address_region"];
$address_postal_code = $row["address_postal_code"];
$address_country = $row["address_country"];
$address_latitude = $row["address_latitude"];
$address_longitude = $row["address_longitude"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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>Contacts Address Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Contacts Address Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='contacts_edit.php?id=$contact_uuid'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "Contact address information.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Address Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='address_type'>\n";
echo " <option value=''></option>\n";
if ($address_type == "Home") {
echo " <option value='Home' SELECTED >home</option>\n";
}
else {
echo " <option value='Home'>home</option>\n";
}
if ($address_type == "Work") {
echo " <option value='Work' SELECTED >work</option>\n";
}
else {
echo " <option value='Work'>work</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Enter the address type.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Street Address:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_street' maxlength='255' value=\"$address_street\">\n";
echo "<br />\n";
echo "Enter the street address.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Extended Address:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_extended' maxlength='255' value=\"$address_extended\">\n";
echo "<br />\n";
echo "Enter the extended address.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " City:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_locality' maxlength='255' value=\"$address_locality\">\n";
echo "<br />\n";
echo "Enter the city.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Region:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_region' maxlength='255' value=\"$address_region\">\n";
echo "<br />\n";
echo "Enter the state or province.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Postal Code:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_postal_code' maxlength='255' value=\"$address_postal_code\">\n";
echo "<br />\n";
echo "Enter the postal code.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Country:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_country' maxlength='255' value=\"$address_country\">\n";
echo "<br />\n";
echo "Enter the country.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Latitude:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_latitude' maxlength='255' value=\"$address_latitude\">\n";
echo "<br />\n";
echo "Enter the latitude\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Longitude:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='address_longitude' maxlength='255' value=\"$address_longitude\">\n";
echo "<br />\n";
echo "Enter the longitude\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='contact_uuid' value='$contact_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_address_uuid' value='$contact_address_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,179 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/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>Notes</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 " List of notes for the contact.<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_contact_notes ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " and contact_uuid = '$contact_uuid' ";
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, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the contact list
$sql = "select * from v_contact_notes ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '$contact_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));
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$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";
if ($result_count == 0) {
echo "<tr>\n";
echo "<th>\n";
echo " &nbsp; \n";
echo "</th>\n";
echo "<td align='right' width='42'>\n";
echo " <a href='contact_notes_edit.php?contact_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "<tr>\n";
}
else {
foreach($result as $row) {
$contact_note = $row['contact_note'];
//$contact_note = str_replace("\n","<br />",$contact_note);
echo "<tr>\n";
echo "<th>\n";
echo " ".$row['last_mod_date']."&nbsp; &nbsp; \n";
echo " ".$row['last_mod_user']." &nbsp; &nbsp; \n";
echo "</th>\n";
//echo "<th>Modified Date ".$row['last_mod_date']."</th>\n";
//echo "<th>Modified By ".$row['last_mod_user']."</th>\n";
echo "<td align='right' width='42'>\n";
echo " <a href='contact_notes_edit.php?contact_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "<tr>\n";
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'><br />".$contact_note."&nbsp;<br /><br /></td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['last_mod_date']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['last_mod_user']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='contact_notes_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_note_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='contact_notes_delete.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_note_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>&nbsp;</td>\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='4' 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";
echo " <a href='contact_notes_edit.php?contact_uuid=".$_GET['id']."' alt='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 "</td>";
//echo "</tr>";
//echo "</table>";
//echo "</div>";
//echo "<br><br>";
//include the footer
//require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,60 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$contact_uuid = check_str($_GET["contact_uuid"]);
}
if (strlen($id)>0) {
$sql = "";
$sql .= "delete from v_contact_notes ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_note_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,210 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$contact_note_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$contact_note = check_str($_POST["contact_note"]);
$last_mod_date = check_str($_POST["last_mod_date"]);
$last_mod_user = check_str($_POST["last_mod_user"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$contact_note_uuid = check_str($_POST["contact_note_uuid"]);
}
//check for all required data
//if (strlen($contact_note) == 0) { $msg .= "Please provide: Notes<br>\n"; }
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($last_mod_date) == 0) { $msg .= "Please provide: Last Modified Date<br>\n"; }
//if (strlen($last_mod_user) == 0) { $msg .= "Please provide: Last Modified By<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$contact_note_uuid = uuid();
$sql = "insert into v_contact_notes ";
$sql .= "(";
$sql .= "contact_note_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_note, ";
$sql .= "domain_uuid, ";
$sql .= "last_mod_date, ";
$sql .= "last_mod_user ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$contact_note_uuid', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$contact_note', ";
$sql .= "'$domain_uuid', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION['username']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contact_notes set ";
$sql .= "contact_uuid = '$contact_uuid', ";
$sql .= "contact_note = '$contact_note', ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_note_uuid = '$contact_note_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$contact_note_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_contact_notes ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_note_uuid = '$contact_note_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$contact_note = $row["contact_note"];
$last_mod_date = $row["last_mod_date"];
$last_mod_user = $row["last_mod_user"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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='15%' nowrap='nowrap'><b>Add Notes</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='15%' nowrap='nowrap'><b>Edit Notes</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='contacts_edit.php?id=$contact_uuid'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Notes:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <textarea class='formfld' type='text' rows=\"20\" style=\"width: 100%\" name='contact_note'>$contact_note</textarea>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='contact_uuid' value='$contact_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_note_uuid' value='$contact_note_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,154 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/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>Phone Numbers</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td colspan='2'>\n";
//echo " List of phone numbers for the contact.<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_contact_phones ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= " and contact_uuid = '$contact_uuid' ";
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, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the contact list
$sql = " select * from v_contact_phones ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= " and contact_uuid = '$contact_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(PDO::FETCH_NAMED);
$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('phone_type', 'Type', $order_by, $order);
echo th_order_by('phone_number', 'Numbers', $order_by, $order);
echo "<th>Tools</th>\n";
echo "<td align='right' width='42'>\n";
echo " <a href='contact_phones_edit.php?contact_uuid=".$_GET['id']."' alt='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['phone_type']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".format_phone($row['phone_number'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href=\"".PROJECT_PATH."/app/xml_cdr/xml_cdr.php?caller_id_number=".$row['phone_number']."&destination_number=".$row['phone_number']."\">CDR</a>&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='contact_phones_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_phone_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='contact_phones_delete.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_phone_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " </td>\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='4' 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";
echo " <a href='contact_phones_edit.php?contact_uuid=".$_GET['id']."' alt='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 "</td>";
//echo "</tr>";
//echo "</table>";
//echo "</div>";
//echo "<br><br>";
//include the footer
//require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,61 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$contact_uuid = check_str($_GET["contact_uuid"]);
}
if (strlen($id)>0) {
$sql = "";
$sql .= "delete from v_contact_phones ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_phone_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,320 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$contact_phone_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$phone_type = check_str($_POST["phone_type"]);
$phone_number = check_str($_POST["phone_number"]);
//remove any phone number formatting
$phone_number = preg_replace('{\D}', '', $phone_number);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$contact_phone_uuid = check_str($_POST["contact_phone_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($phone_type) == 0) { $msg .= "Please provide: Telephone Type.<br>\n"; }
//if (strlen($phone_number) == 0) { $msg .= "Please provide: Telephone Number<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$contact_phone_uuid = uuid();
$sql = "insert into v_contact_phones ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_phone_uuid, ";
$sql .= "phone_type, ";
$sql .= "phone_number ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$contact_phone_uuid', ";
$sql .= "'$phone_type', ";
$sql .= "'$phone_number' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contact_phones set ";
$sql .= "contact_uuid = '$contact_uuid', ";
$sql .= "phone_type = '$phone_type', ";
$sql .= "phone_number = '$phone_number' ";
$sql .= "where domain_uuid = '$domain_uuid'";
$sql .= "and contact_phone_uuid = '$contact_phone_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts_edit.php?id=$contact_uuid\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$contact_phone_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_contact_phones ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_phone_uuid = '$contact_phone_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$phone_type = $row["phone_type"];
$phone_number = $row["phone_number"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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%' align='left' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Contacts Phone Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Contacts Phone Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='contacts_edit.php?id=$contact_uuid'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "Telephone Numbers<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Telephone Type.:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='phone_type'>\n";
echo " <option value=''></option>\n";
if ($phone_type == "home") {
echo " <option value='home' SELECTED >Home</option>\n";
}
else {
echo " <option value='home'>Home</option>\n";
}
if ($phone_type == "work") {
echo " <option value='work' SELECTED >Work</option>\n";
}
else {
echo " <option value='work'>Work</option>\n";
}
if ($phone_type == "pref") {
echo " <option value='pref' SELECTED >Pref</option>\n";
}
else {
echo " <option value='pref'>Pref</option>\n";
}
if ($phone_type == "voice") {
echo " <option value='voice' SELECTED >Voice</option>\n";
}
else {
echo " <option value='voice'>Voice</option>\n";
}
if ($phone_type == "fax") {
echo " <option value='fax' SELECTED >Fax</option>\n";
}
else {
echo " <option value='fax'>Fax</option>\n";
}
if ($phone_type == "msg") {
echo " <option value='msg' SELECTED >MSG</option>\n";
}
else {
echo " <option value='msg'>MSG</option>\n";
}
if ($phone_type == "cell") {
echo " <option value='cell' SELECTED >Cell</option>\n";
}
else {
echo " <option value='cell'>Cell</option>\n";
}
if ($phone_type == "pager") {
echo " <option value='pager' SELECTED >Pager</option>\n";
}
else {
echo " <option value='pager'>Pager</option>\n";
}
if ($phone_type == "bbs") {
echo " <option value='bbs' SELECTED >BBS</option>\n";
}
else {
echo " <option value='bbs'>BBS</option>\n";
}
if ($phone_type == "modem") {
echo " <option value='modem' SELECTED >Modem</option>\n";
}
else {
echo " <option value='modem'>Modem</option>\n";
}
if ($phone_type == "car") {
echo " <option value='car' SELECTED >Car</option>\n";
}
else {
echo " <option value='car'>Car</option>\n";
}
if ($phone_type == "isdn") {
echo " <option value='isdn' SELECTED >ISDN</option>\n";
}
else {
echo " <option value='isdn'>ISDN</option>\n";
}
if ($phone_type == "video") {
echo " <option value='video' SELECTED >Video</option>\n";
}
else {
echo " <option value='video'>Video</option>\n";
}
if ($phone_type == "pcs") {
echo " <option value='pcs' SELECTED >PCS</option>\n";
}
else {
echo " <option value='pcs'>PCS</option>\n";
}
if ($phone_type == "iana-token") {
echo " <option value='iana-token' SELECTED >iana-token</option>\n";
}
else {
echo " <option value='iana-token'>iana-token</option>\n";
}
if ($phone_type == "x-name") {
echo " <option value='x-name' SELECTED >x-name</option>\n";
}
else {
echo " <option value='x-name'>x-name</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Enter the telephone type.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Telephone Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='phone_number' maxlength='255' value=\"$phone_number\">\n";
echo "<br />\n";
echo "Enter the telephone number.\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='contact_uuid' value='$contact_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_phone_uuid' value='$contact_phone_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

224
app/contacts/contacts.php Normal file
View File

@@ -0,0 +1,224 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get the search criteria
$search_all = $_GET["search_all"];
//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\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align=\"left\" valign=\"top\"><strong>Contacts</strong><br>\n";
echo " The contact is a list of individuals and organizations.\n";
echo " </td>\n";
echo " <td align=\"right\" valign=\"top\">\n";
echo " <form method=\"GET\" name=\"frm_search\" action=\"\">\n";
echo " <input class=\"formfld\" type=\"text\" name=\"search_all\" value=\"$search_all\">\n";
echo " <input class=\"btn\" type=\"submit\" name=\"submit\" value=\"Search All\">\n";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
//prepare to page the results
$sql = "";
$sql .= " select count(*) as num_rows from v_contacts ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
if (strlen($search_all) > 0) {
if (is_numeric($search_all)) {
$sql .= "and contact_uuid in (select contact_uuid from v_contact_phones where phone_number like '%".$search_all."%') \n";
}
else {
$sql .= "and contact_uuid in (\n";
$sql .= " select contact_uuid from v_contacts ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' \n";
$sql .= " and (\n";
$sql .= " contact_organization like '%".$search_all."%' or \n";
$sql .= " contact_name_given like '%".$search_all."%' or \n";
$sql .= " contact_name_family like '%".$search_all."%' or \n";
$sql .= " contact_nickname like '%".$search_all."%' or \n";
$sql .= " contact_title like '%".$search_all."%' or \n";
$sql .= " contact_role like '%".$search_all."%' or \n";
$sql .= " contact_email like '%".$search_all."%' or \n";
$sql .= " contact_url like '%".$search_all."%' or \n";
$sql .= " contact_time_zone like '%".$search_all."%' or \n";
$sql .= " contact_note like '%".$search_all."%' or \n";
$sql .= " contact_type like '%".$search_all."%'\n";
$sql .= " )\n";
$sql .= ")\n";
}
}
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 = 30;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = " select * from v_contacts ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
if (strlen($search_all) > 0) {
if (is_numeric($search_all)) {
$sql .= "and contact_uuid in (select contact_uuid from v_contact_phones where phone_number like '%".$search_all."%') \n";
}
else {
$sql .= "and contact_uuid in (\n";
$sql .= " select contact_uuid from v_contacts where domain_uuid = '".$_SESSION['domain_uuid']."' \n";
$sql .= " and (\n";
$sql .= " contact_organization like '%".$search_all."%' or \n";
$sql .= " contact_name_given like '%".$search_all."%' or \n";
$sql .= " contact_name_family like '%".$search_all."%' or \n";
$sql .= " contact_nickname like '%".$search_all."%' or \n";
$sql .= " contact_title like '%".$search_all."%' or \n";
$sql .= " contact_role like '%".$search_all."%' or \n";
$sql .= " contact_email like '%".$search_all."%' or \n";
$sql .= " contact_url like '%".$search_all."%' or \n";
$sql .= " contact_time_zone like '%".$search_all."%' or \n";
$sql .= " contact_note like '%".$search_all."%' or \n";
$sql .= " contact_type like '%".$search_all."%'\n";
$sql .= " )\n";
$sql .= ")\n";
}
}
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(PDO::FETCH_NAMED);
$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('contact_type', 'Type', $order_by, $order);
echo th_order_by('contact_organization', 'Organization', $order_by, $order);
echo th_order_by('contact_name_given', 'First Name', $order_by, $order);
echo th_order_by('contact_name_family', 'Last Name', $order_by, $order);
echo th_order_by('contact_nickname', 'Nickname', $order_by, $order);
echo th_order_by('contact_title', 'Title', $order_by, $order);
echo th_order_by('contact_role', 'Role', $order_by, $order);
//echo th_order_by('contact_email', 'Email', $order_by, $order);
//echo th_order_by('contact_url', 'URL', $order_by, $order);
//echo th_order_by('contact_time_zone', 'Time Zone', $order_by, $order);
//echo th_order_by('contact_note', 'Notes', $order_by, $order);
echo "<td align='right' width='42'>\n";
echo " <a href='contacts_edit.php' alt='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]."'>".ucwords($row['contact_type'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_organization']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_name_given']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_name_family']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_nickname']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_title']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_role']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_email']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_url']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_time_zone']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_note']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='contacts_edit.php?id=".$row['contact_uuid']."&query_string=".urlencode($_SERVER["QUERY_STRING"])."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='contacts_delete.php?id=".$row['contact_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " </td>\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='15' 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";
echo " <a href='contacts_edit.php' alt='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 "includes/footer.php";
?>

View File

@@ -0,0 +1,86 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
if (strlen($id)>0) {
//delete a contact
$sql = "delete from v_contacts ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement, $sql);
//delete addresses
$sql = "delete from v_contact_addresses ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement, $sql);
//delete phones
$sql = "";
$sql .= "delete from v_contact_phones ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement, $sql);
//delete notes
$sql = "";
$sql .= "delete from v_contact_notes ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement, $sql);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,481 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$contact_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$contact_type = check_str($_POST["contact_type"]);
$contact_organization = check_str($_POST["contact_organization"]);
$contact_name_given = check_str($_POST["contact_name_given"]);
$contact_name_family = check_str($_POST["contact_name_family"]);
$contact_nickname = check_str($_POST["contact_nickname"]);
$contact_title = check_str($_POST["contact_title"]);
$contact_role = check_str($_POST["contact_role"]);
$contact_email = check_str($_POST["contact_email"]);
$contact_url = check_str($_POST["contact_url"]);
$contact_time_zone = check_str($_POST["contact_time_zone"]);
$contact_note = check_str($_POST["contact_note"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$contact_uuid = check_str($_POST["contact_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($contact_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
//if (strlen($contact_organization) == 0) { $msg .= "Please provide: Organization<br>\n"; }
//if (strlen($contact_name_given) == 0) { $msg .= "Please provide: First Name<br>\n"; }
//if (strlen($contact_name_family) == 0) { $msg .= "Please provide: Last Name<br>\n"; }
//if (strlen($contact_nickname) == 0) { $msg .= "Please provide: Nickname<br>\n"; }
//if (strlen($contact_title) == 0) { $msg .= "Please provide: Title<br>\n"; }
//if (strlen($contact_role) == 0) { $msg .= "Please provide: Role<br>\n"; }
//if (strlen($) == 0) { $msg .= "Please provide: Contact Information<br>\n"; }
//if (strlen($contact_email) == 0) { $msg .= "Please provide: Email<br>\n"; }
//if (strlen($contact_url) == 0) { $msg .= "Please provide: URL<br>\n"; }
//if (strlen($) == 0) { $msg .= "Please provide: Additional Information<br>\n"; }
//if (strlen($contact_time_zone) == 0) { $msg .= "Please provide: Time Zone<br>\n"; }
//if (strlen($contact_note) == 0) { $msg .= "Please provide: Notes<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$contact_uuid = uuid();
$sql = "insert into v_contacts ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_type, ";
$sql .= "contact_organization, ";
$sql .= "contact_name_given, ";
$sql .= "contact_name_family, ";
$sql .= "contact_nickname, ";
$sql .= "contact_title, ";
$sql .= "contact_role, ";
$sql .= "contact_email, ";
$sql .= "contact_url, ";
$sql .= "contact_time_zone, ";
$sql .= "contact_note ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$contact_type', ";
$sql .= "'$contact_organization', ";
$sql .= "'$contact_name_given', ";
$sql .= "'$contact_name_family', ";
$sql .= "'$contact_nickname', ";
$sql .= "'$contact_title', ";
$sql .= "'$contact_role', ";
$sql .= "'$contact_email', ";
$sql .= "'$contact_url', ";
$sql .= "'$contact_time_zone', ";
$sql .= "'$contact_note' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contacts set ";
$sql .= "contact_type = '$contact_type', ";
$sql .= "contact_organization = '$contact_organization', ";
$sql .= "contact_name_given = '$contact_name_given', ";
$sql .= "contact_name_family = '$contact_name_family', ";
$sql .= "contact_nickname = '$contact_nickname', ";
$sql .= "contact_title = '$contact_title', ";
$sql .= "contact_role = '$contact_role', ";
$sql .= "contact_email = '$contact_email', ";
$sql .= "contact_url = '$contact_url', ";
$sql .= "contact_time_zone = '$contact_time_zone', ";
$sql .= "contact_note = '$contact_note' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '$contact_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=contacts.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$contact_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_contacts ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '$contact_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$contact_type = $row["contact_type"];
$contact_organization = $row["contact_organization"];
$contact_name_given = $row["contact_name_given"];
$contact_name_family = $row["contact_name_family"];
$contact_nickname = $row["contact_nickname"];
$contact_title = $row["contact_title"];
$contact_role = $row["contact_role"];
$contact_email = $row["contact_email"];
$contact_url = $row["contact_url"];
$contact_time_zone = $row["contact_time_zone"];
$contact_note = $row["contact_note"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
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>Contact Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Contact Edit</b></td>\n";
}
echo "<td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='qr code' onclick=\"window.location='contacts_vcard.php?id=$contact_uuid&type=image'\" value='QR Code'>\n";
echo " <input type='button' class='btn' name='' alt='vcard' onclick=\"window.location='contacts_vcard.php?id=$contact_uuid&type=download'\" value='vCard'>\n";
if ($action == "update" && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/invoices')) {
echo " <input type='button' class='btn' name='' alt='invoice' onclick=\"window.location='".PROJECT_PATH."/app/invoices/v_invoices.php?id=$contact_uuid'\" value='Invoices'>\n";
}
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='contacts.php?".$_GET["query_string"]."'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=\"left\" colspan='2'>\n";
echo "The contact is a list of individuals and organizations.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table border='0' cellpadding='3' cellspacing='3' width='100%'>\n";
echo "<tr>\n";
echo "<td width='50%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo "<form method='post' name='frm' action=''>\n";
echo "<table border='0' width='100%'>\n";
echo "<tr>\n";
echo " <td><strong>User Information</strong></td>\n";
echo " <td>&nbsp;</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' style='width:85%;' name='contact_type'>\n";
echo " <option value=''></option>\n";
if ($contact_type == "customer") {
echo " <option value='customer' selected='selected' >Customer</option>\n";
}
else {
echo " <option value='customer'>Customer</option>\n";
}
if ($contact_type == "contractor") {
echo " <option value='contractor' selected='selected' >Contractor</option>\n";
}
else {
echo " <option value='contractor'>Contractor</option>\n";
}
if ($contact_type == "friend") {
echo " <option value='friend' selected='selected' >Friend</option>\n";
}
else {
echo " <option value='friend'>Friend</option>\n";
}
if ($contact_type == "lead") {
echo " <option value='lead' selected='selected' >Lead</option>\n";
}
else {
echo " <option value='lead'>Lead</option>\n";
}
if ($contact_type == "member") {
echo " <option value='member' selected='selected' >Member</option>\n";
}
else {
echo " <option value='member'>Member</option>\n";
}
if ($contact_type == "family") {
echo " <option value='family' selected='selected' >Family</option>\n";
}
else {
echo " <option value='family'>Family</option>\n";
}
if ($contact_type == "subscriber") {
echo " <option value='subscriber' selected='selected' >Subscriber</option>\n";
}
else {
echo " <option value='subscriber'>Subscriber</option>\n";
}
if ($contact_type == "supplier") {
echo " <option value='supplier' selected='selected' >Supplier</option>\n";
}
else {
echo " <option value='supplier'>Supplier</option>\n";
}
if ($contact_type == "provider") {
echo " <option value='provider' selected='selected' >Provider</option>\n";
}
else {
echo " <option value='provider'>Provider</option>\n";
}
if ($contact_type == "user") {
echo " <option value='user' selected='selected' >User</option>\n";
}
else {
echo " <option value='user'>User</option>\n";
}
if ($contact_type == "volunteer") {
echo " <option value='volunteer' selected='selected' >Volunteer</option>\n";
}
else {
echo " <option value='volunteer'>Volunteer</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select the contact type.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Organization:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_organization' maxlength='255' value=\"$contact_organization\">\n";
echo "<br />\n";
echo "Enter the organization.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " First Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_name_given' maxlength='255' value=\"$contact_name_given\">\n";
echo "<br />\n";
echo "Enter the given name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Last Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_name_family' maxlength='255' value=\"$contact_name_family\">\n";
echo "<br />\n";
echo "Enter the family name.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Nickname:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_nickname' maxlength='255' value=\"$contact_nickname\">\n";
echo "<br />\n";
echo "Enter the nickname.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Title:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_title' maxlength='255' value=\"$contact_title\">\n";
echo "<br />\n";
echo "Enter the title.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Role:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_role' maxlength='255' value=\"$contact_role\">\n";
echo "<br />\n";
echo "Enter the role.\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td><strong>Contact Information</strong></td>\n";
//echo "<td>&nbsp;</td>\n";
//echo "<tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Email:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_email' maxlength='255' value=\"$contact_email\">\n";
echo "<br />\n";
echo "Enter the email address.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " URL:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_url' maxlength='255' value='$contact_url'>\n";
echo "<br />\n";
echo "Enter the website address.\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td><strong>Additional Information</strong></td>\n";
//echo "<td>&nbsp;</td>\n";
//echo "<tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Time Zone:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_time_zone' maxlength='255' value=\"$contact_time_zone\">\n";
echo "<br />\n";
echo "Enter the time zone.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Notes:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' style='width:85%;' type='text' name='contact_note' maxlength='255' value='$contact_note'>\n";
echo "<br />\n";
echo "Enter the notes.\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='contact_uuid' value='$contact_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "</td>\n";
echo "<td width='50%' class='' valign='top' align='center'>\n";
//echo " <img src='contacts_vcard.php?id=$contact_uuid&type=image' width='90%'><br /><br />\n";
if ($action == "update") {
require "contact_phones.php";
require "contact_addresses.php";
require "contact_notes.php";
//echo "<br/><br/>\n";
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
if ($action == "update") {
echo "<br/>\n";
}
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,202 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('contacts_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
//create the vcard object
require_once "includes/class_vcard.php";
$vcard = new vcard();
//get the contact id
$contact_uuid = $_GET["id"];
//get the contact's information
$sql = "";
$sql .= "select * from v_contacts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_uuid = '$contact_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$contact_type = $row["contact_type"];
$contact_organization = $row["contact_organization"];
$contact_name_given = $row["contact_name_given"];
$contact_name_family = $row["contact_name_family"];
$contact_nickname = $row["contact_nickname"];
$contact_title = $row["contact_title"];
$contact_role = $row["contact_role"];
$contact_email = $row["contact_email"];
$contact_url = $row["contact_url"];
$contact_time_zone = $row["contact_time_zone"];
$contact_note = $row["contact_note"];
break; //limit to 1 row
}
unset ($prep_statement);
$vcard->data['company'] = $contact_organization;
$vcard->data['first_name'] = $contact_name_given;
$vcard->data['last_name'] = $contact_name_family;
$vcard->data['contact_email1'] = $contact_email;
$vcard->data['contact_url'] = $contact_url;
if ($_GET['type'] == "image" || $_GET['type'] == "html") {
//don't add this to the QR code at this time
}
else {
$vcard->data['display_name'] = $contact_name_given." ".$contact_name_family;
$vcard->data['contact_nickname'] = $contact_nickname;
$vcard->data['contact_title'] = $contact_title;
$vcard->data['contact_role'] = $contact_role;
$vcard->data['timezone'] = $contact_time_zone;
$vcard->data['contact_note'] = $contact_note;
}
//get the contact's telephone numbers
$sql = "";
$sql .= "select * from v_contact_phones ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_uuid = '$contact_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$phone_type = $row["phone_type"];
$phone_number = $row["phone_number"];
$vcard->data[$phone_type.'_tel'] = $phone_number;
}
unset ($prep_statement);
//get the contact's addresses
if ($_GET['type'] == "image" || $_GET['type'] == "html") {
//don't add this to the QR code at this time
}
else {
$sql = "";
$sql .= "select * from v_contact_addresses ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_uuid = '$contact_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$address_type = $row["address_type"];
$address_street = $row["address_street"];
$address_extended = $row["address_extended"];
$address_locality = $row["address_locality"];
$address_region = $row["address_region"];
$address_postal_code = $row["address_postal_code"];
$address_country = $row["address_country"];
$address_latitude = $row["address_latitude"];
$address_longitude = $row["address_longitude"];
$address_type = strtolower(trim($address_type));
$vcard->data[$address_type.'_address'] = $address_street;
$vcard->data[$address_type.'_extended_address'] = $address_extended;
$vcard->data[$address_type.'_city'] = $address_locality;
$vcard->data[$address_type.'_state'] = $address_region;
$vcard->data[$address_type.'_postal_code'] = $address_postal_code;
$vcard->data[$address_type.'_country'] = $address_country;
}
unset ($prep_statement);
}
//download the vcard
if ($_GET['type'] == "download") {
$vcard->download();
}
//show the vcard in an text qr code
if ($_GET['type'] == "text") {
$vcard->build();
$content = $vcard->card;
echo $content;
}
//show the vcard in an image qr code
if ($_GET['type'] == "image" || $_GET['type'] == "html") {
$vcard->build();
$content = $vcard->card;
//include
require_once "includes/qr/qrcode.php";
//error correction level
//QR_ERROR_CORRECT_LEVEL_L : $e = 0;
//QR_ERROR_CORRECT_LEVEL_M : $e = 1;
//QR_ERROR_CORRECT_LEVEL_Q : $e = 2;
//QR_ERROR_CORRECT_LEVEL_H : $e = 3;
//get the qr object
$qr = QRCode::getMinimumQRCode($content, QR_ERROR_CORRECT_LEVEL_L);
}
//show the vcard as an png image
if ($_GET['type'] == "image") {
header("Content-type: image/png");
$im = $qr->createImage(5, 10);
imagepng($im);
imagedestroy($im);
}
//show the vcard in an html qr code
if ($_GET['type'] == "html") {
$qr->make();
$qr->printHTML();
}
}
/*
//additional un accounted fields
additional_name
name_prefix
name_suffix
department
work_po_box
home_po_box
home_extended_address
home_address
home_city
home_state
home_postal_code
home_country
pager_tel
contact_email2
photo
birthday
sort_string
*/
?>

50
app/contacts/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

351
app/content/app_config.php Normal file
View File

@@ -0,0 +1,351 @@
<?php
//application details
$apps[$x]['name'] = "Content Manager";
$apps[$x]['uuid'] = '892c8d0b-bfa5-1bdf-e090-a974da7a7c5e';
$apps[$x]['category'] = 'System';
$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'] = 'Manage Content for any page in the interface.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Content Manager';
$apps[$x]['menu'][0]['uuid'] = '90397352-395c-40f6-2087-887144abc06d';
$apps[$x]['menu'][0]['parent_uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/content/rsslist.php';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'content_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'content_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'content_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'content_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_rss';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'][] = 'rssid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'][] = 'rss_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'rss_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_language';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsslanguage';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_category';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsscategory';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_category';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubcategory';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_title';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsstitle';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_link';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsslink';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssdesc';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_img';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssimg';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'bytea';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'blob';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'blob';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_optional_1';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssoptional1';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_optional_2';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssoptional2';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_optional_3';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssoptional3';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_optional_4';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssoptional4';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_optional_5';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssoptional5';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_add_date';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssadddate';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_add_user';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssadduser';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_del_date';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssdeldate';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_del_user';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssdeluser';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_order';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssorder';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_content';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsscontent';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_group';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssgroup';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_rss_sub';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'][] = 'rsssubid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'][] = 'rss_sub_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'rss_sub_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssid';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'rss_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_rss';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'rss_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_language';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssublanguage';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_title';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubtitle';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_link';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssublink';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubdesc';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_optional_1';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssuboptional1';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_optional_2';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssuboptional2';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_optional_3';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssuboptional3';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_optional_4';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssuboptional4';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_optional_5';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssuboptional5';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_add_date';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubadddate';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_add_user';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubadduser';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_del_user';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubdeluser';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_del_date';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubdeldate';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_parent_id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubparentid';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$y = 2; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_rss_sub_category';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'][] = 'rsssubcategoryid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'][] = 'rss_sub_category_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'rss_sub_category_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_category_language';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubcategorylanguage';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_category';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsscategory';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_category';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubcategory';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_category_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rsssubcategorydesc';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_add_user';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssadduser';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'rss_sub_add_date';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'rssadddate';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>

32
app/content/config.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
$module_title = 'Content';
$rss_category = 'content';
$rss_sub_show = 0; //1 = yes, 0 = no
$rss_sub_title = 'Content';
?>

50
app/content/index.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
return; //disable
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "config.php";
session_start();
require_once "includes/header.php";
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"\" href=\"rss.php\" />\n";
$_GET["c"] = "html";
require_once "rss.php";
require_once "includes/footer.php";
return;
?>

50
app/content/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

44
app/content/rss.css Normal file
View File

@@ -0,0 +1,44 @@
rss {
display: block;
font-family: verdana, arial;
}
title {
display: block;
margin: 5px;
padding: 2px;
color: #77A3EF;
border-bottom: 1px solid #77A3EF;
}
link {
display: block;
font-size: small;
padding-left: 10px;
}
description {
display: block;
font-size: small;
padding-left: 10px;
}
item {
display: block;
padding: 2px 30px 2px 30px;
}
description {
display: block;
background-color: #FCFCFC;
margin: 20px;
text-align: left;
padding: 5px;
color: #7f7f7f;
border: 1px solid #EEEEEE;
}
/* all hidden elements */
language, lastBuildDate, ttl, guid, category, pubDate, copyright, webmaster, comments {
display: none;
}

244
app/content/rss.php Normal file
View File

@@ -0,0 +1,244 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
return; //disable
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//include module specific information
if (strlen($mod_config_path)==0) {
include "config.php";
}
else {
//$mod_config_path = "/news"; //examples
//$mod_config_path = "/app/news"; //examples
include $mod_config_path.'/config.php';
}
$rss_css_url = 'http://'.$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"];
$rss_css_url = str_replace ("rss.php", "rss.css", $rss_css_url);
$content_type = $_GET["c"];
//echo "contenttype $content_type";
if (strlen($_GET["rss_category"]) > 0) {
$rss_category = $_GET["rss_category"];
}
if (strlen($content_type) == 0) {
$content_type = "rss"; //define default contenttype
}
if ($content_type == "html") {
session_start();
}
//echo $rss_css_url;
//exit;
if ($content_type == "rss") {
header('Content-Type: text/xml');
echo '<?xml version="1.0" ?'.'>';
echo '<?xml-stylesheet type="text/css" href="'.$rss_css_url.'" ?'.'>';
//echo '<?xml-stylesheet type="text/css" href="http://'.$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"].'" ?'.'>';
//echo "\n";
echo "<rss version=\"2.0\">\n";
echo "<channel>\n";
echo "<title>$module_title RSS Feed</title>\n";
//echo "<link>http://www.xul.fr/</link>\n";
echo "<description>Task List for RSS...</description>\n";
echo "<language>en-US</language>\n";
//echo "<copyright></copyright>\n";
//echo "<image>\n";
//echo " <url>http://www.xul.fr/xul-icon.gif</url>\n";
//echo " <link>http://www.xul.fr/index.html</link>\n";
//echo "</image>";
}
$sql = "";
$sql .= "select * from v_rss ";
$sql .= "where rss_category = '$rss_category' ";
$sql .= "and length(rss_del_date) = 0 ";
$sql .= "or rss_category = '$rss_category' ";
$sql .= "and rss_del_date is null ";
$sql .= "order by rss_uuid asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$last_cat = "";
$count = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$rss_uuid = $row["rss_uuid"];
$rss_title = $row["rss_title"];
$rss_description = $row["rss_description"];
$rss_link = $row["rss_link"];
//$rss_description = $row[rss_sub_description];
//$rss_description = str_replace ("\r\n", "<br>", $rss_description);
//$rss_description = str_replace ("\n", "<br>", $rss_description);
if ($content_type == "rss") {
$rss_title = htmlentities($rss_title);
$rss_description = htmlentities($rss_description);
echo "<item>\n";
echo "<title>".$rss_title."</title>\n";
echo "<description>".$rss_description."</description>\n";
echo "<link>".$rss_link."</link>\n";
//echo "<pubDate>12 Mar 2007 19:38:06 GMT</pubDate>\n";
//echo "<guid isPermaLink='true'>http://www.google.com/log/123</guid>\n";
//echo "<comments>http://www.google.com/log/121#comments</comments>\n";
//echo "<category>Web Design</category>";
echo "</item>\n";
echo "\n";
}
else {
if (strlen($rss_link) > 0) {
echo "<b><a href='$rss_link'>".$rss_title."</a></b><br>\n";
}
else {
echo "<b>".$rss_title."</b><br>\n";
}
echo "".$rss_description."\n";
echo "<br><br>";
if ($rss_sub_show == 1) {
//--- Begin Sub List -------------------------------------------------------
echo "<br><br><br>";
echo "<b>$rss_sub_title</b><br>";
$sql = "";
$sql .= "select * from v_rss_sub ";
$sql .= "where rss_uuid = '$rss_uuid' ";
$sql .= "and length(rss_sub_del_date) = 0 ";
$sql .= "or rss_uuid = '$rss_uuid' ";
$sql .= "and rss_sub_del_date is null ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement_2 = $db->prepare($sql);
$prep_statement_2->execute();
$result2 = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count2 = count($result2);
$c2 = 0;
$row_style["0"] = "background-color: #F5F5DC;";
$row_style["1"] = "background-color: #FFFFFF;";
echo "<div align='left'>\n";
//echo " <b>Notes</b>";
echo "<table width='75%' border='1' cellpadding='1' cellspacing='1'>\n";
//echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
if ($result_count == 0) { //no results
echo "<tr><td>&nbsp;</td></tr>";
}
else {
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
foreach($result2 as $row2) {
echo "<tr style='".$row_style[$c]."'>\n";
//echo "<td valign='top'>".$rss_uuid."</td>";
//echo "<td valign='top'>&nbsp;<b>".$row2[rss_sub_title]."</b>&nbsp;</td>";
//echo "<td valign='top'>&nbsp;".$row2[rss_sub_link]."&nbsp;</td>";
echo "<td valign='top' width='200'>";
echo " <b>".$row2[rss_sub_title]."</b>";
echo "</td>";
echo "<td valign='top'>".$row2[rss_sub_add_date]."</td>";
//echo "<td valign='top'>".$row2[rss_sub_optional_1]."</td>";
//echo "<td valign='top'>".$row2[rss_sub_optional_2]."</td>";
//echo "<td valign='top'>".$row2[rss_sub_optional_3]."</td>";
//echo "<td valign='top'>".$row2[rss_sub_optional_4]."</td>";
//echo "<td valign='top'>".$row2[rss_sub_optional_5]."</td>";
//echo "<td valign='top'>".$row2[rss_sub_add_user]."</td>";
echo "<td valign='top' align='right'>";
echo " &nbsp;";
//echo " <input type='button' class='btn' name='' onclick=\"window.location='rsssubupdate.php?rss_uuid=".$rss_uuid."&rss_sub_uuid=".$row2[rss_sub_uuid]."'\" value='Update'>";
echo " &nbsp; \n";
//echo " <a href='rsssubupdate.php?rss_uuid=".$rss_uuid."&rss_sub_uuid=".$row2[rss_sub_uuid]."'>Update</a>&nbsp;";
echo "</td>";
$rss_sub_description = $row2[rss_sub_description];
//$rss_sub_description = str_replace ("\r\n", "<br>", $rss_sub_description);
//$rss_sub_description = str_replace ("\n", "<br>", $rss_sub_description);
echo "</tr>";
echo "<tr style='".$row_style[$c]."'>\n";
echo "<td valign='top' width='300' colspan='3'>";
echo "".$rss_sub_description."&nbsp;";
echo "</td>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c2==0) { $c2=1; } else { $c2=0; }
} //end foreach
unset($sql, $result, $row_count);
echo "</table>\n";
echo "</div>\n";
echo " <br><br>";
echo " </td>\n";
echo "</tr>\n";
} //end if results
echo "</table>\n";
//--- End Sub List -------------------------------------------------------
}
}
//echo "<item>\n";
//echo "<title> ".$row["favname"]."</title>\n";
//echo "<description>".$row["favdesc"]."</description>\n";
//echo "<link>".$row["favurl"]."</link>\n";
//echo "</item>\n";
//$last_cat = $row["favcat"];
$count++;
}
if ($content_type == "rss") {
echo "</channel>\n";
echo "\n";
echo "</rss>\n";
}
?>

347
app/content/rssadd.php Normal file
View File

@@ -0,0 +1,347 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
//get the http values and set them as variables
$rss_sub_category = check_str($_POST["rss_sub_category"]);
$rss_title = check_str($_POST["rss_title"]);
$rss_link = check_str($_POST["rss_link"]);
$rss_description = check_str($_POST["rss_description"]);
$rss_img = check_str($_POST["rss_img"]);
$rss_optional_1 = check_str($_POST["rss_optional_1"]);
$rss_optional_2 = check_str($_POST["rss_optional_2"]);
$rss_optional_3 = check_str($_POST["rss_optional_3"]);
$rss_optional_4 = check_str($_POST["rss_optional_4"]);
$rss_optional_5 = check_str($_POST["rss_optional_5"]);
$rss_group = check_str($_POST["rss_group"]);
$rss_order = check_str($_POST["rss_order"]);
//insert the data into the database
$rss_uuid = uuid();
$sql = "insert into v_rss ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "rss_uuid, ";
$sql .= "rss_category, ";
$sql .= "rss_sub_category, ";
$sql .= "rss_title, ";
$sql .= "rss_link, ";
$sql .= "rss_description, ";
$sql .= "rss_img, ";
$sql .= "rss_optional_1, ";
$sql .= "rss_optional_2, ";
$sql .= "rss_optional_3, ";
$sql .= "rss_optional_4, ";
$sql .= "rss_optional_5, ";
$sql .= "rss_group, ";
$sql .= "rss_order, ";
$sql .= "rss_add_date, ";
$sql .= "rss_add_user ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$rss_uuid', ";
$sql .= "'$rss_category', ";
$sql .= "'$rss_sub_category', ";
$sql .= "'$rss_title', ";
$sql .= "'$rss_link', ";
$sql .= "'$rss_description', ";
$sql .= "'$rss_img', ";
$sql .= "'$rss_optional_1', ";
$sql .= "'$rss_optional_2', ";
$sql .= "'$rss_optional_3', ";
$sql .= "'$rss_optional_4', ";
$sql .= "'$rss_optional_5', ";
$sql .= "'$rss_group', ";
$sql .= "'$rss_order', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION["username"]."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=rsslist.php\">\n";
echo "<div align='center'>";
echo "Add Complete";
echo "</div>";
require_once "includes/footer.php";
return;
}
require_once "includes/header.php";
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/tiny_mce')) {
if ($rss_optional_1 == "text/html") {
require_once "includes/wysiwyg.php";
}
}
else {
//--- Begin: Edit Area -----------------------------------------------------
echo " <script language=\"javascript\" type=\"text/javascript\" src=\"".PROJECT_PATH."/includes/edit_area/edit_area_full.js\"></script>\n";
echo " <!-- -->\n";
echo " <script language=\"Javascript\" type=\"text/javascript\">\n";
echo " editAreaLoader.init({\n";
echo " id: \"rss_description\" // id of the textarea to transform //, |, help\n";
echo " ,start_highlight: true\n";
echo " ,font_size: \"8\"\n";
echo " ,allow_toggle: false\n";
echo " ,language: \"en\"\n";
echo " ,syntax: \"html\"\n";
echo " ,toolbar: \"search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\" //new_document,\n";
echo " ,plugins: \"charmap\"\n";
echo " ,charmap_default: \"arrows\"\n";
echo " });\n";
echo " </script>";
//--- End: Edit Area -------------------------------------------------------
}
echo "<div align='center'>";
echo "<table border='0' width='100%' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\" width='100%'>\n";
echo "<form method='post' action=''>";
echo "<table width='100%' cellpadding='6' cellspacing='0'>";
echo "<tr>\n";
echo "<td width='30%' nowrap valign='top'><b>Content Add</b></td>\n";
echo "<td width='70%' align='right' valign='top'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='rsslist.php'\" value='Back'><br /><br /></td>\n";
echo "</tr>\n";
//echo " <tr>";
//echo " <td class='vncellreq'>Category:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_category' value='$rss_category'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq' nowrap>Sub Category:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_sub_category' value='$rss_sub_category'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td width='30%' class='vncellreq' nowrap>Title:</td>";
echo " <td width='70%' class='vtable' width='100%'><input type='text' class='formfld' name='rss_title' value='$rss_title'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Link:</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='rss_link' value='$rss_link'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Group:</td>";
echo " <td class='vtable'>";
//echo " <input type='text' class='formfld' name='menuparentid' value='$menuparentid'>";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select name=\"rss_group\" class='formfld'>\n";
echo "<option value=\"\">public</option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$count = count($result);
foreach($result as $field) {
if ($rss_group == $field[group_name]) {
echo "<option value='".$field[group_name]."' selected>".$field[group_name]."</option>\n";
}
else {
echo "<option value='".$field[group_name]."'>".$field[group_name]."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo " </td>";
echo " </tr>";
/*
echo " <tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " Template: \n";
echo " </td>\n";
echo " <td class=\"vtable\">\n";
echo "<select id='rss_sub_category' name='rss_sub_category' class='formfld' style=''>\n";
echo "<option value=''></option>\n";
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != ".svn" && is_dir($theme_dir.'/'.$file)) {
if ($file == $rss_sub_category) {
echo "<option value='$file' selected='selected'>$file</option>\n";
}
else {
echo "<option value='$file'>$file</option>\n";
}
}
}
closedir($handle);
}
echo " </select>\n";
echo " <br />\n";
echo " Select a template to set as the default and then press save.<br />\n";
echo " </td>\n";
echo " </tr>\n";
*/
echo " <tr>";
echo " <td class='vncellreq'>Type:</td>";
echo " <td class='vtable'>";
echo " <select name=\"rss_optional_1\" class='formfld'>\n";
if ($rss_optional_1 == "text/html") { echo "<option value=\"text/html\" selected>text/html</option>\n"; }
else { echo "<option value=\"text/html\">text/html</option>\n"; }
if ($rss_optional_1 == "text/javascript") { echo "<option value=\"text/javascript\" selected>text/javascript</option>\n"; }
else { echo "<option value=\"text/javascript\">text/javascript</option>\n"; }
echo " </select>";
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Order:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='rss_order' class='formfld'>\n";
if (strlen(htmlspecialchars($rss_order))> 0) {
echo " <option selected='yes' value='".htmlspecialchars($rss_order)."'>".htmlspecialchars($rss_order)."</option>\n";
}
$i=0;
while($i<=999) {
if (strlen($i) == 1) {
echo " <option value='00$i'>00$i</option>\n";
}
if (strlen($i) == 2) {
echo " <option value='0$i'>0$i</option>\n";
}
if (strlen($i) == 3) {
echo " <option value='$i'>$i</option>\n";
}
$i++;
}
echo " </select>\n";
echo "<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
//echo " <td class='vncellreq' valign='top'></td>";
echo " <td class='' colspan='2' align='left'>";
echo " <strong>Content:</strong> ";
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/tiny_mce')) {
echo " &nbsp; &nbsp; &nbsp; editor &nbsp; <a href='#' title='toggle' onclick=\"toogleEditorMode('rss_description'); return false;\">on/off</a><br>";
}
else {
echo " <textarea name='rss_description' id='rss_description' class='formfld' cols='20' style='width: 100%' rows='12' ></textarea>";
}
echo " </td>";
echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Image:</td>";
//echo " <td class='vtable'><input type='text' name='rss_img' value='$rss_img'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Priority:</td>";
//echo " <td class='vtable'>";
//echo " <input type='text' name='rss_optional_1' value='$rss_optional_1'>";
//echo " <select name=\"rss_optional_1\" class='formfld'>\n";
//echo " <option value=\"$rss_optional_1\">$rss_optional_1</option>\n";
//echo " <option value=\"\"></option>\n";
//echo " <option value=\"low\">low</option>\n";
//echo " <option value=\"med\">med</option>\n";
//echo " <option value=\"high\">high</option>\n";
//echo " </select>";
//echo " </td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Status:</td>";
//echo " <td class='vtable'>";
//echo " <input type='text' name='rss_optional_2' value='$rss_optional_2'>";
//echo " <select name=\"rss_optional_2\" class=\"formfld\">\n";
//echo " <option value=\"$rss_optional_2\">$rss_optional_2</option>\n";
//echo " <option value=\"\"></option>\n";
//echo " <option value=\"0\">0</option>\n";
//echo " <option value=\"10\">10</option>\n";
//echo " <option value=\"20\">20</option>\n";
//echo " <option value=\"30\">30</option>\n";
//echo " <option value=\"40\">40</option>\n";
//echo " <option value=\"50\">50</option>\n";
//echo " <option value=\"60\">60</option>\n";
//echo " <option value=\"70\">70</option>\n";
//echo " <option value=\"80\">80</option>\n";
//echo " <option value=\"90\">90</option>\n";
//echo " <option value=\"100\">100</option>\n";
//echo " </select>";
//echo " </td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Optional 3:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_optional_3' value='$rss_optional_3'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Optional 4:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_optional_4' value='$rss_optional_4'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>rss_optional_5:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_optional_5' value='$rss_optional_5'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>rss_add_date:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_add_date' value='$rss_add_date'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td class='' colspan='2' align='right'>";
echo " <input type='submit' class='btn' name='submit' value='Add $module_title'>\n";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,74 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get data from the db
$rss_uuid = $_REQUEST["rss_uuid"];
$sql = "";
$sql .= "select * from v_rss ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
//echo $sql;
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$rss_category = $row["rss_category"];
$rss_sub_category = $row["rss_sub_category"];
$rss_title = $row["rss_title"];
$rss_link = $row["rss_link"];
$rss_description = $row["rss_description"];
$rss_img = $row["rss_img"];
$rss_optional_1 = $row["rss_optional_1"];
$rss_optional_2 = $row["rss_optional_2"];
$rss_optional_3 = $row["rss_optional_3"];
$rss_optional_4 = $row["rss_optional_4"];
$rss_optional_5 = $row["rss_optional_5"];
$rss_add_date = $row["rss_add_date"];
$rss_add_user = $row["rss_add_user"];
$rss_group = $row["rss_group"];
$rss_order = $row["rss_order"];
//$rss_description = str_replace ("\r\n", "<br>", $rss_description);
echo $rss_description;
//return;
break; //limit to 1 row
}
?>

62
app/content/rssdelete.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$rss_uuid = check_str($_GET["rss_uuid"]);
//mark the the item as deleted and who deleted it
$sql = "update v_rss set ";
$sql .= "rss_del_date = now(), ";
$sql .= "rss_del_user = '".$_SESSION["username"]."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=rsslist.php?rss_uuid=$rss_uuid\">\n";
echo "<div align='center'>";
echo "Delete Completed";
echo "</div>";
require_once "includes/footer.php";
return;
}
?>

217
app/content/rsslist.php Normal file
View File

@@ -0,0 +1,217 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (!function_exists('th_order_by')) {
//html table header order by
function th_order_by($field_name, $columntitle, $order_by, $order) {
$html .= "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
$html .= "<a href='?order_by=$field_name&order=desc' title='ascending'>$columntitle</a>";
}
else {
if ($order=="asc") {
$html .= "<a href='?order_by=$field_name&order=desc' title='ascending'>$columntitle</a>";
}
else {
$html .= "<a href='?order_by=$field_name&order=asc' title='descending'>$columntitle</a>";
}
}
$html .= "&nbsp; &nbsp; </th>";
return $html;
}
}
require_once "includes/header.php";
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"\" href=\"rss.php\" />\n";
$order_by = $_GET["order_by"];
$order = $_GET["order"];
echo "<div align='center'>";
echo "<table border='0' width='100%' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo "<table width='100%'>";
echo "<tr>";
echo "<td align='left'>";
echo " <b>$module_title List</b>";
echo "</td>";
echo "<td align='right'>";
//echo " <input type='button' class='btn' name='' onclick=\"window.location='rssadd.php'\" value='Add $module_title'>&nbsp; &nbsp;\n";
echo "</td>";
echo "</tr>";
echo "</table>";
$sql = "";
$sql .= "select * from v_rss ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
$sql .= "and length(rss_del_date) = 0 ";
$sql .= "or domain_uuid = '$domain_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
$sql .= "and rss_del_date is null ";
if (strlen($order_by)> 0) {
$sql .= "order by $order_by $order ";
}
else {
$sql .= "order by rss_order asc ";
}
//echo $sql;
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='left'>\n";
echo "<table width='100%' border='0' cellpadding='2' cellspacing='0'>\n";
echo "<tr>";
echo th_order_by('rss_title', 'Title', $order_by, $order);
echo th_order_by('rss_link', 'Link', $order_by, $order);
//echo th_order_by('rss_sub_category', 'Template', $order_by, $order);
echo th_order_by('rss_group', 'Group', $order_by, $order);
echo th_order_by('rss_order', 'Order', $order_by, $order);
if ($result_count == 0) { //no results
echo "<td align='right' width='21'>\n";
}
else {
echo "<td align='right' width='42'>\n";
}
echo " <a href='rssadd.php' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "</tr>";
if ($result_count > 0) {
foreach($result as $row) {
//print_r( $row );
echo "<tr style='".$row_style[$c]."'>\n";
//echo "<td valign='top'><a href='rssupdate.php?rss_uuid=".$row[rss_uuid]."'>".$row[rss_uuid]."</a></td>";
//echo "<td valign='top'>".$row[rss_category]."</td>";
echo "<td valign='top' nowrap class='".$row_style[$c]."'>&nbsp;".$row[rss_title]."&nbsp;</td>";
echo "<td valign='top' nowrap class='".$row_style[$c]."'>&nbsp;<a href='/index.php?c=".$row[rss_link]."'>".$row[rss_link]."</a>&nbsp;</td>";
//echo "<td valign='top' class='".$row_style[$c]."'>".$row[rss_sub_category]."&nbsp;</td>";
if (strlen($row[rss_group]) > 0) {
echo "<td valign='top' class='".$row_style[$c]."'>".$row[rss_group]."</td>";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>public</td>";
}
//echo "<td valign='top'>".$row[rss_description]."</td>";
//echo "<td valign='top'>".$row[rss_img]."</td>";
//echo "<td valign='top'>&nbsp;".$row[rss_optional_1]."&nbsp;</td>"; //priority
//echo "<td valign='top' class='".$row_style[$c]."'>&nbsp;";
//sif ($row[rss_optional_2]=="100") {
// echo "Complete";
//}
//else {
// echo $row[rss_optional_2]."%";
//}
//echo "&nbsp;</td>"; //completion status
//echo "<td valign='top'>".$row[rss_optional_3]."</td>";
//echo "<td valign='top'>".$row[rss_optional_4]."</td>";
//echo "<td valign='top'>".$row[rss_optional_5]."</td>";
echo "<td valign='top' class='".$row_style[$c]."'>".$row[rss_order]."&nbsp;</td>";
//echo "<td valign='top' align='center'>";
//echo " <input type='button' class='btn' name='' onclick=\"window.location='rssmoveup.php?menuparentid=".$row[menuparentid]."&rss_uuid=".$row[rss_uuid]."&rss_order=".$row[rss_order]."'\" value='<' title='".$row[rss_order].". Move Up'>";
//echo " <input type='button' class='btn' name='' onclick=\"window.location='rssmovedown.php?menuparentid=".$row[menuparentid]."&rss_uuid=".$row[rss_uuid]."&rss_order=".$row[rss_order]."'\" value='>' title='".$row[rss_order].". Move Down'>";
//echo "</td>";
echo " <td valign='top' align='right'>\n";
echo " <a href='rssupdate.php?rss_uuid=".$row[rss_uuid]."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='rssdelete.php?rss_uuid=".$row[rss_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " </td>\n";
//echo "<td valign='top' align='right' class='".$row_style[$c]."'>";
//echo " <input type='button' class='btn' name='' onclick=\"if (confirm('Are you sure you wish to continue?')) { window.location='rssdelete.php?rss_uuid=".$row[rss_uuid]."' }\" value='Delete'>";
//echo "</td>";
echo "</tr>";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='6' align='left'>\n";
echo " <table border='0' 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";
echo " <a href='rssadd.php' alt='add'>$v_link_label_add</a>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo " <br>";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
//echo "<input type='button' class='btn' name='' onclick=\"window.location='rsssearch.php'\" value='Search'>&nbsp; &nbsp;\n";
//echo "<input type='button' class='btn' name='' onclick=\"window.location='rssadd.php'\" value='Add $module_title'>&nbsp; &nbsp;\n";
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?>

View File

@@ -0,0 +1,92 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//move down more than one level at a time
//update v_rss set rss_order = (rss_order+1) where rss_order > 2 or rss_order = 2
if (count($_GET)>0) {
$rss_uuid = check_str($_GET["rss_uuid"]);
$rss_order = check_str($_GET["rss_order"]);
$sql = "SELECT rss_order FROM v_rss ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
$sql .= "order by rss_order desc ";
$sql .= "limit 1 ";
//echo $sql."<br><br>";
//return;
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
//print_r( $row );
$highestrss_order = $row[rss_order];
}
unset($prep_statement);
if ($rss_order != $highestrss_order) {
//move the current item's order number up
$sql = "update v_rss set ";
$sql .= "rss_order = (rss_order-1) "; //move down
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_order = ".($rss_order+1)." ";
$sql .= "and rss_category = '$rss_category' ";
//echo $sql."<br><br>";
$db->exec(check_sql($sql));
unset($sql);
//move the selected item's order number down
$sql = "update v_rss set ";
$sql .= "rss_order = (rss_order+1) "; //move up
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
//echo $sql."<br><br>";
$db->exec(check_sql($sql));
unset($sql);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"1;url=rsslist.php?rss_uuid=$rss_uuid\">\n";
echo "<div align='center'>";
echo "Item Moved Down";
echo "</div>";
require_once "includes/footer.php";
return;
}
?>

76
app/content/rssmoveup.php Normal file
View File

@@ -0,0 +1,76 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//move down more than one level at a time
//update v_rss set rss_order = (rss_order+1) where rss_order > 2 or rss_order = 2
if (count($_GET)>0) {
$rss_uuid = check_str($_GET["rss_uuid"]);
$rss_order = check_str($_GET["rss_order"]);
if ($rss_order != 1) {
//move the current item's order number down
$sql = "update v_rss set ";
$sql .= "rss_order = (rss_order+1) "; //move down
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_order = ".($rss_order-1)." ";
$sql .= "and rss_category = '$rss_category' ";
//echo $sql."<br><br>";
$db->exec(check_sql($sql));
unset($sql);
//move the selected item's order number up
$sql = "update v_rss set ";
$sql .= "rss_order = (rss_order-1) "; //move up
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
//echo $sql."<br><br>";
$db->exec(check_sql($sql));
unset($sql);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"1;url=rsslist.php?rss_uuid=$rss_uuid\">\n";
echo "<div align='center'>";
echo "Item Moved Up";
echo "</div>";
require_once "includes/footer.php";
return;
}
?>

277
app/content/rsssearch.php Normal file
View File

@@ -0,0 +1,277 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
return; //disabled
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$rss_uuid = check_str($_POST["rss_uuid"]);
//$rss_category = check_str($_POST["rss_category"]); //defined in local config.php
$rss_sub_category = check_str($_POST["rss_sub_category"]);
$rss_title = check_str($_POST["rss_title"]);
$rss_link = check_str($_POST["rss_link"]);
$rss_description = check_str($_POST["rss_description"]);
$rss_img = check_str($_POST["rss_img"]);
$rss_optional_1 = check_str($_POST["rss_optional_1"]);
$rss_optional_2 = check_str($_POST["rss_optional_2"]);
$rss_optional_3 = check_str($_POST["rss_optional_3"]);
$rss_optional_4 = check_str($_POST["rss_optional_4"]);
$rss_optional_5 = check_str($_POST["rss_optional_5"]);
$rss_add_date = check_str($_POST["rss_add_date"]);
$rss_add_user = check_str($_POST["rss_add_user"]);
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
$sql = "";
$sql .= "select * from v_rss ";
$sql .= "where ";
if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
if (strlen($rss_category) > 0) { $sql .= "and rss_category like '%$rss_category%' "; }
if (strlen($rss_sub_category) > 0) { $sql .= "and rss_sub_category like '%$rss_sub_category%' "; }
if (strlen($rss_title) > 0) { $sql .= "and rss_title like '%$rss_title%' "; }
if (strlen($rss_link) > 0) { $sql .= "and rss_link like '%$rss_link%' "; }
if (strlen($rss_description) > 0) { $sql .= "and rss_description like '%$rss_description%' "; }
if (strlen($rss_img) > 0) { $sql .= "and rss_img like '%$rss_img%' "; }
if (strlen($rss_optional_1) > 0) { $sql .= "and rss_optional_1 like '%$rss_optional_1%' "; }
if (strlen($rss_optional_2) > 0) { $sql .= "and rss_optional_2 like '%$rss_optional_2%' "; }
if (strlen($rss_optional_3) > 0) { $sql .= "and rss_optional_3 like '%$rss_optional_3%' "; }
if (strlen($rss_optional_4) > 0) { $sql .= "and rss_optional_4 like '%$rss_optional_4%' "; }
if (strlen($rss_optional_5) > 0) { $sql .= "and rss_optional_5 like '%$rss_optional_5%' "; }
if (strlen($rss_add_date) > 0) { $sql .= "and rss_add_date like '%$rss_add_date%' "; }
if (strlen($rss_add_user) > 0) { $sql .= "and rss_add_user like '%$rss_add_user%' "; }
$sql .= "and length(rss_del_date) = 0 ";
$sql .= "or ";
if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
if (strlen($rss_category) > 0) { $sql .= "and rss_category like '%$rss_category%' "; }
if (strlen($rss_sub_category) > 0) { $sql .= "and rss_sub_category like '%$rss_sub_category%' "; }
if (strlen($rss_title) > 0) { $sql .= "and rss_title like '%$rss_title%' "; }
if (strlen($rss_link) > 0) { $sql .= "and rss_link like '%$rss_link%' "; }
if (strlen($rss_description) > 0) { $sql .= "and rss_description like '%$rss_description%' "; }
if (strlen($rss_img) > 0) { $sql .= "and rss_img like '%$rss_img%' "; }
if (strlen($rss_optional_1) > 0) { $sql .= "and rss_optional_1 like '%$rss_optional_1%' "; }
if (strlen($rss_optional_2) > 0) { $sql .= "and rss_optional_2 like '%$rss_optional_2%' "; }
if (strlen($rss_optional_3) > 0) { $sql .= "and rss_optional_3 like '%$rss_optional_3%' "; }
if (strlen($rss_optional_4) > 0) { $sql .= "and rss_optional_4 like '%$rss_optional_4%' "; }
if (strlen($rss_optional_5) > 0) { $sql .= "and rss_optional_5 like '%$rss_optional_5%' "; }
if (strlen($rss_add_date) > 0) { $sql .= "and rss_add_date like '%$rss_add_date%' "; }
if (strlen($rss_add_user) > 0) { $sql .= "and rss_add_user like '%$rss_add_user%' "; }
$sql .= "and rss_del_date is null ";
$sql = trim($sql);
if (substr($sql, -5) == "where"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
if (substr($sql, -3) == " or"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
$sql = str_replace ("where and", "where", $sql);
$sql = str_replace ("or and", "or", $sql);
//echo $sql;
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
$c = 0;
$row_style["0"] = "background-color: #F5F5DC;";
$row_style["1"] = "background-color: #FFFFFF;";
echo "<b>Search Results</b><br>";
echo "<div align='left'>\n";
echo "<table border='0' cellpadding='1' cellspacing='1'>\n";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
if ($result_count == 0) { //no results
echo "<tr><td>&nbsp;</td></tr>";
}
else { //received results
echo "<tr>";
echo "<th nowrap>&nbsp; &nbsp; ID&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; Category&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; Sub Category&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; Title&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_link&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_description&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_img&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_optional_1&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_optional_2&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_optional_3&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_optional_4&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_optional_5&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_add_date&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_add_user&nbsp; &nbsp; </th>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
foreach($result as $row) {
//print_r( $row );
echo "<tr style='".$row_style[$c]."'>\n";
echo "<td valign='top'><a href='rssupdate.php?rss_uuid=".$row[rss_uuid]."'>".$row[rss_uuid]."</a></td>";
echo "<td valign='top'>".$row[rss_category]."</td>";
echo "<td valign='top'>".$row[rss_sub_category]."</td>";
echo "<td valign='top'>".$row[rss_title]."</td>";
//echo "<td valign='top'>".$row[rss_link]."</td>";
//echo "<td valign='top'>".$row[rss_description]."</td>";
//echo "<td valign='top'>".$row[rss_img]."</td>";
//echo "<td valign='top'>".$row[rss_optional_1]."</td>";
//echo "<td valign='top'>".$row[rss_optional_2]."</td>";
//echo "<td valign='top'>".$row[rss_optional_3]."</td>";
//echo "<td valign='top'>".$row[rss_optional_4]."</td>";
//echo "<td valign='top'>".$row[rss_optional_5]."</td>";
//echo "<td valign='top'>".$row[rss_add_date]."</td>";
//echo "<td valign='top'>".$row[rss_add_user]."</td>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach unset($sql, $result, $row_count);
echo "</table>\n";
echo "</div>\n";
echo " <br><br>";
echo " </td>\n";
echo "</tr>\n";
} //end if results
echo "</table>\n";
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
}
else {
echo "\n"; require_once "includes/header.php";
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>Id:</td>";
echo " <td><input type='text' class='txt' name='rss_uuid'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Category:</td>";
echo " <td><input type='text' class='txt' name='rss_category'></td>";
echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_category:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_category'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td>Title:</td>";
echo " <td><input type='text' class='txt' name='rss_title'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Link:</td>";
echo " <td><input type='text' class='txt' name='rss_link'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Desc:</td>";
echo " <td><input type='text' class='txt' name='rss_description'></td>";
echo " </tr>";
//echo " <tr>";
//echo " <td>Image:</td>";
//echo " <td><input type='text' class='txt' name='rss_img'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_optional_1:</td>";
//echo " <td><input type='text' class='txt' name='rss_optional_1'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_optional_2:</td>";
//echo " <td><input type='text' class='txt' name='rss_optional_2'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_optional_3:</td>";
//echo " <td><input type='text' class='txt' name='rss_optional_3'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_optional_4:</td>";
//echo " <td><input type='text' class='txt' name='rss_optional_4'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_optional_5:</td>";
//echo " <td><input type='text' class='txt' name='rss_optional_5'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_add_date:</td>";
//echo " <td><input type='text' class='txt' name='rss_add_date'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_add_user:</td>";
//echo " <td><input type='text' class='txt' name='rss_add_user'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td colspan='2' align='right'><input type='submit' name='submit' class='btn' value='Search'></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
} //end if not post
?>

174
app/content/rsssubadd.php Normal file
View File

@@ -0,0 +1,174 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
$rss_uuid = $_GET["rss_uuid"];
if (count($_POST)>0) {
$rss_uuid = check_str($_POST["rss_uuid"]);
$rss_sub_title = check_str($_POST["rss_sub_title"]);
$rss_sub_link = check_str($_POST["rss_sub_link"]);
$rss_sub_description = check_str($_POST["rss_sub_description"]);
$rss_sub_optional_1 = check_str($_POST["rss_sub_optional_1"]);
$rss_sub_optional_2 = check_str($_POST["rss_sub_optional_2"]);
$rss_sub_optional_3 = check_str($_POST["rss_sub_optional_3"]);
$rss_sub_optional_4 = check_str($_POST["rss_sub_optional_4"]);
$rss_sub_optional_5 = check_str($_POST["rss_sub_optional_5"]);
$rss_sub_add_date = check_str($_POST["rss_sub_add_date"]);
$rss_sub_add_user = check_str($_POST["rss_sub_add_user"]);
$rss_sub_uuid = uuid();
$sql = "insert into v_rss_sub ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "rss_uuid, ";
$sql .= "rss_sub_uuid, ";
$sql .= "rss_sub_title, ";
$sql .= "rss_sub_link, ";
$sql .= "rss_sub_description, ";
$sql .= "rss_sub_optional_1, ";
$sql .= "rss_sub_optional_2, ";
$sql .= "rss_sub_optional_3, ";
$sql .= "rss_sub_optional_4, ";
$sql .= "rss_sub_optional_5, ";
$sql .= "rss_sub_add_date, ";
$sql .= "rss_sub_add_user ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$rss_uuid', ";
$sql .= "'$rss_sub_uuid', ";
$sql .= "'$rss_sub_title', ";
$sql .= "'$rss_sub_link', ";
$sql .= "'$rss_sub_description', ";
$sql .= "'$rss_sub_optional_1', ";
$sql .= "'$rss_sub_optional_2', ";
$sql .= "'$rss_sub_optional_3', ";
$sql .= "'$rss_sub_optional_4', ";
$sql .= "'$rss_sub_optional_5', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION["username"]."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=rsssublist.php?rss_uuid=$rss_uuid\">\n";
echo "<div align='center'>";
echo "Add Complete";
echo "</div>";
require_once "includes/footer.php";
return;
}
//show the header
require_once "includes/header.php";
require_once "includes/wysiwyg.php";
//show the content
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' action=''>";
echo "<table width='100%'>";
echo " <tr>";
echo " <td nowrap>Title:</td>";
echo " <td width='100%'><input type='text' class='txt' name='rss_sub_title'></td>";
echo " </tr>";
//echo " <tr>";
//echo " <td>Link:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_link'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td valign='top'>Description:</td>";
echo " <td>";
echo " <textarea class='txt' rows='12' name='rss_sub_description'></textarea>";
echo " </td>";
echo " </tr>";
/*
echo " <tr>";
echo " <td>rss_sub_optional_1:</td>";
echo " <td><input type='text' name='rss_sub_optional_1'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_optional_2:</td>";
echo " <td><input type='text' name='rss_sub_optional_2'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_optional_3:</td>";
echo " <td><input type='text' name='rss_sub_optional_3'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_optional_4:</td>";
echo " <td><input type='text' name='rss_sub_optional_4'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_optional_5:</td>";
echo " <td><input type='text' name='rss_sub_optional_5'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_add_date:</td>";
echo " <td><input type='text' name='rss_sub_add_date'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_add_user:</td>";
echo " <td><input type='text' name='rss_sub_add_user'></td>";
echo " </tr>";
*/
//echo " <tr>";
//echo " <td>example:</td>";
//echo " <td><textarea name='example'></textarea></td>";
//echo " </tr>"; echo " <tr>";
echo " <td colspan='2' align='right'>";
echo " <input type='hidden' name='rss_uuid' value='$rss_uuid'>";
echo " <input type='submit' name='submit' class='btn' value='Add'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//show the footer
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,117 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$rss_sub_category_uuid = uuid();
$rss_category = check_str($_POST["rss_category"]);
$rss_sub_category = check_str($_POST["rss_sub_category"]);
$rss_sub_category_description = check_str($_POST["rss_sub_category_description"]);
$rss_add_user = check_str($_POST["rss_add_user"]);
$rss_add_date = check_str($_POST["rss_add_date"]);
$sql = "insert into v_rss_sub_category ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "rss_sub_category_uuid, ";
$sql .= "rss_category, ";
$sql .= "rss_sub_category, ";
$sql .= "rss_sub_category_description, ";
$sql .= "rss_add_user, ";
$sql .= "rss_add_date ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$rss_sub_category_uuid', ";
$sql .= "'$rss_category', ";
$sql .= "'$rss_sub_category', ";
$sql .= "'$rss_sub_category_description', ";
$sql .= "'$rss_add_user', ";
$sql .= "'$rss_add_date' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"5;url=rss_sub_categorylist.php\">\n";
echo "Add Complete";
require_once "includes/footer.php";
return;
}
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>RSS Category:</td>";
echo " <td><input type='text' name='rss_category'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_category:</td>";
echo " <td><input type='text' name='rss_sub_category'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_category_description:</td>";
echo " <td><input type='text' name='rss_sub_category_description'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_add_user:</td>";
echo " <td><input type='text' name='rss_add_user'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_add_date:</td>";
echo " <td><input type='text' name='rss_add_date'></td>";
echo " </tr>\n";
echo " <tr>";
echo " <td colspan='2' align='right'><input type='submit' name='submit' value='Add'></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,204 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
$order_by = $_GET["order_by"];
$order = $_GET["order"];
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
$sql = "";
$sql .= "select * from v_rss_sub_category ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
$c = 0;
$row_style["0"] = "background-color: #F5F5DC;";
$row_style["1"] = "background-color: #FFFFFF;";
echo "<div align='left'>\n";
echo "<table border='0' cellpadding='1' cellspacing='1'>\n";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
if ($result_count == 0) { //no results
echo "<tr><td>&nbsp;</td></tr>";
}
else { //received results
echo "<tr>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_category_uuid&order=desc' title='ascending'>rss_sub_category_uuid</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_category_uuid&order=desc' title='ascending'>rss_sub_category_uuid</a>";
}
else {
echo "<a href='?order_by=rss_sub_category_uuid&order=asc' title='descending'>rss_sub_category_uuid</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_category&order=desc' title='ascending'>rss_category</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_category&order=desc' title='ascending'>rss_category</a>";
}
else {
echo "<a href='?order_by=rss_category&order=asc' title='descending'>rss_category</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_category&order=desc' title='ascending'>rss_sub_category</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_category&order=desc' title='ascending'>rss_sub_category</a>";
}
else {
echo "<a href='?order_by=rss_sub_category&order=asc' title='descending'>rss_sub_category</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_category_description&order=desc' title='ascending'>rss_sub_category_description</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_category_description&order=desc' title='ascending'>rss_sub_category_description</a>";
}
else {
echo "<a href='?order_by=rss_sub_category_description&order=asc' title='descending'>rss_sub_category_description</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_add_user&order=desc' title='ascending'>rss_add_user</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_add_user&order=desc' title='ascending'>rss_add_user</a>";
}
else {
echo "<a href='?order_by=rss_add_user&order=asc' title='descending'>rss_add_user</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_add_date&order=desc' title='ascending'>rss_add_date</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_add_date&order=desc' title='ascending'>rss_add_date</a>";
}
else {
echo "<a href='?order_by=rss_add_date&order=asc' title='descending'>rss_add_date</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
foreach($result as $row) {
//print_r( $row );
echo "<tr style='".$row_style[$c]."'>\n";
echo "<td valign='top'><a href='rss_sub_categoryupdate.php?rss_sub_category_uuid=".$row[rss_sub_category_uuid]."'>".$row[rss_sub_category_uuid]."</a></td>";
echo "<td valign='top'>".$row[rss_category]."</td>";
echo "<td valign='top'>".$row[rss_sub_category]."</td>";
echo "<td valign='top'>".$row[rss_sub_category_description]."</td>";
echo "<td valign='top'>".$row[rss_add_user]."</td>";
echo "<td valign='top'>".$row[rss_add_date]."</td>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach unset($sql, $result, $row_count);
echo "</table>\n";
echo "</div>\n";
echo " <br><br>";
echo " </td>\n";
echo "</tr>\n";
} //end if results
echo "</table>\n";
echo "<input type='button' class='btn' name='' onclick=\"window.location='rss_sub_categorysearch.php'\" value='Search'>&nbsp; &nbsp;\n";
echo "<input type='button' class='btn' name='' onclick=\"window.location='rss_sub_categoryadd.php'\" value='Add'>&nbsp; &nbsp;\n";
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?>

View File

@@ -0,0 +1,134 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$rss_sub_category_uuid = check_str($_POST["rss_sub_category_uuid"]);
$rss_category = check_str($_POST["rss_category"]);
$rss_sub_category = check_str($_POST["rss_sub_category"]);
$rss_sub_category_description = check_str($_POST["rss_sub_category_description"]);
$rss_add_user = check_str($_POST["rss_add_user"]);
$rss_add_date = check_str($_POST["rss_add_date"]);
//sql update
$sql = "update v_rss_sub_category set ";
$sql .= "rss_category = '$rss_category', ";
$sql .= "rss_sub_category = '$rss_sub_category', ";
$sql .= "rss_sub_category_description = '$rss_sub_category_description', ";
$sql .= "rss_add_user = '$rss_add_user', ";
$sql .= "rss_add_date = '$rss_add_date' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_sub_category_uuid = '$rss_sub_category_uuid' ";
$count = $db->exec(check_sql($sql));
//echo "Affected Rows: ".$count;
//edit: make sure the meta redirect url is correct
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"5;url=rss_sub_categorylist.php\">\n";
echo "Update Complete";
require_once "includes/footer.php";
return;
}
else {
//get data from the db
$rss_sub_category_uuid = $_GET["rss_sub_category_uuid"];
$sql = "";
$sql .= "select * from v_rss_sub_category ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_sub_category_uuid = '$rss_sub_category_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$rss_category = $row["rss_category"];
$rss_sub_category = $row["rss_sub_category"];
$rss_sub_category_description = $row["rss_sub_category_description"];
$rss_add_user = $row["rss_add_user"];
$rss_add_date = $row["rss_add_date"];
break; //limit to 1 row
}
}
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>rss_category:</td>";
echo " <td><input type='text' name='rss_category' value='$rss_category'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_category:</td>";
echo " <td><input type='text' name='rss_sub_category' value='$rss_sub_category'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_sub_category_description:</td>";
echo " <td><input type='text' name='rss_sub_category_description' value='$rss_sub_category_description'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_add_user:</td>";
echo " <td><input type='text' name='rss_add_user' value='$rss_add_user'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>rss_add_date:</td>";
echo " <td><input type='text' name='rss_add_date' value='$rss_add_date'></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2' align='right'>";
echo " <input type='hidden' name='rss_sub_category_uuid' value='$rss_sub_category_uuid'>";
echo " <input type='submit' name='submit' value='Update'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,60 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$rss_uuid = check_str($_GET["rss_uuid"]);
$rss_sub_uuid = check_str($_GET["rss_sub_uuid"]);
//mark the the item as deleted and who deleted it
$sql = "update v_rss_sub set ";
$sql .= "rss_sub_del_date = now(), ";
$sql .= "rss_sub_del_user = '".$_SESSION["username"]."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_sub_uuid = '$rss_sub_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=rsssublist.php?rss_uuid=$rss_uuid\">\n";
echo "<div align='center'>";
echo "Delete Completed";
echo "</div>";
require_once "includes/footer.php";
return;
}
?>

444
app/content/rsssublist.php Normal file
View File

@@ -0,0 +1,444 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
$rss_uuid = $_GET["rss_uuid"];
$order_by = $_GET["order_by"];
$order = $_GET["order"];
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table width='500' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo " <b>$module_title Details</b>";
$sql = "";
$sql .= "select * from v_rss ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
$sql .= "and length(rss_del_date) = 0 ";
$sql .= "or domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
$sql .= "and rss_del_date is null ";
$sql .= "order by rss_uuid asc ";
//echo $sql;
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
echo "<table border='0' width='100%'>";
if ($result_count == 0) { //no results
echo "<tr><td>&nbsp;</td></tr>";
}
else { //received results
foreach($result as $row) {
//print_r( $row );
//echo "<tr style='".$row_style[$c]."'>\n";
//echo "<tr>";
//echo " <td valign='top'>Title</td>";
//echo " <td valign='top'><a href='rssupdate.php?rss_uuid=".$row[rss_uuid]."'>".$row[rss_uuid]."</a></td>";
//echo "</tr>";
//echo "<td valign='top'>".$row[rss_category]."</td>";
echo "<tr>";
echo " <td valign='top'>Title: &nbsp;</td>";
echo " <td valign='top'><b>".$row[rss_title]."</b></td>";
echo " <td valign='top' align='right'>";
echo " <input type='button' class='btn' name='' onclick=\"window.location='rssupdate.php?rss_uuid=".$row[rss_uuid]."'\" value='Update'>";
echo " </td>";
$rss_description = $row[rss_description];
//$rss_description = str_replace ("\r\n", "<br>", $rss_description);
//$rss_description = str_replace ("\n", "<br>", $rss_description);
echo "</tr>";
echo "<tr>";
echo " <td valign='top'>Template: &nbsp;</td>";
echo " <td valign='top'>".$row[rss_sub_category]."</td>";
echo "</tr>";
echo "<tr>";
echo " <td valign='top'>Group: &nbsp;</td>";
echo " <td valign='top'>".$row[rss_group]."</td>";
echo "</tr>";
if (strlen($row[rss_order]) > 0) {
echo "<tr>";
echo " <td valign='top'>Order: &nbsp;</td>";
echo " <td valign='top'>".$row[rss_order]."</td>";
echo "</tr>";
}
//echo "<td valign='top'>".$row[rss_link]."</td>";
echo " <td valign='top'>Description: &nbsp;</td>";
echo " <td valign='top' colspan='2'>".$rss_description."</td>";
//echo "<td valign='top'>".$row[rss_img]."</td>";
//echo "<tr>";
//echo " <td valign='top'>Priority: &nbsp;</td>";
//echo " <td valign='top' colspan='2'>".$row[rss_optional_1]."</td>"; //priority
//echo "</tr>";
//echo "<tr>";
//echo " <td valign='top'>Status: &nbsp;</td>"; //completion status
//echo " <td valign='top' colspan='2'>";
//echo $row[rss_optional_2];
//if ($row[rss_optional_2]=="100") {
// echo "Complete";
//}
//else {
// echo $row[rss_optional_2]."%";
//}
//echo "</td>"; //completion status
//echo "<td valign='top'>".$row[rss_optional_3]."</td>";
//echo "<td valign='top'>".$row[rss_optional_4]."</td>";
//echo "<td valign='top'>".$row[rss_optional_5]."</td>";
//echo "<td valign='top'>".$row[rss_add_date]."</td>";
//echo "<td valign='top'>".$row[rss_add_user]."</td>";
//echo "<tr>";
//echo " <td valign='top'>";
//echo " <a href='rsssublist.php?rss_uuid=".$row[rss_uuid]."'>Details</a>";
//echo " <input type='button' class='btn' name='' onclick=\"window.location='rsssublist.php?rss_uuid=".$row[rss_uuid]."'\" value='Details'>";
//echo " </td>";
//echo "</tr>";
echo "</tr>";
//echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
}
echo "</table>";
unset($sql, $prep_statement, $result);
if ($rss_sub_show == 1) {
echo "<br><br><br>";
echo "<b>$rss_sub_title</b><br>";
$sql = "";
$sql .= "select * from v_rss_sub ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and length(rss_sub_del_date) = 0 ";
$sql .= "or domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and rss_sub_del_date is null ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
//echo $sql;
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
$c = 0;
$row_style["0"] = "background-color: #F5F5DC;";
$row_style["1"] = "background-color: #FFFFFF;";
echo "<div align='left'>\n";
echo "<table width='100%' border='0' cellpadding='1' cellspacing='1'>\n";
//echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
if ($result_count == 0) { //no results
echo "<tr><td>&nbsp;</td></tr>";
}
else { //received results
echo "<tr>";
/*
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_uuid&order=desc' title='ascending'>rss_sub_uuid</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_uuid&order=desc' title='ascending'>rss_sub_uuid</a>";
}
else {
echo "<a href='?order_by=rss_sub_uuid&order=asc' title='descending'>rss_sub_uuid</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_uuid&order=desc' title='ascending'>rss_uuid</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_uuid&order=desc' title='ascending'>rss_uuid</a>";
}
else {
echo "<a href='?order_by=rss_uuid&order=asc' title='descending'>rss_uuid</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_title&order=desc' title='ascending'>rss_sub_title</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_title&order=desc' title='ascending'>rss_sub_title</a>";
}
else {
echo "<a href='?order_by=rss_sub_title&order=asc' title='descending'>rss_sub_title</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_link&order=desc' title='ascending'>rss_sub_link</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_link&order=desc' title='ascending'>rss_sub_link</a>";
}
else {
echo "<a href='?order_by=rss_sub_link&order=asc' title='descending'>rss_sub_link</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_description&order=desc' title='ascending'>rss_sub_description</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_description&order=desc' title='ascending'>rss_sub_description</a>";
}
else {
echo "<a href='?order_by=rss_sub_description&order=asc' title='descending'>rss_sub_description</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_optional_1&order=desc' title='ascending'>rss_sub_optional_1</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_optional_1&order=desc' title='ascending'>rss_sub_optional_1</a>";
}
else {
echo "<a href='?order_by=rss_sub_optional_1&order=asc' title='descending'>rss_sub_optional_1</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_optional_2&order=desc' title='ascending'>rss_sub_optional_2</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_optional_2&order=desc' title='ascending'>rss_sub_optional_2</a>";
}
else {
echo "<a href='?order_by=rss_sub_optional_2&order=asc' title='descending'>rss_sub_optional_2</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_optional_3&order=desc' title='ascending'>rss_sub_optional_3</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_optional_3&order=desc' title='ascending'>rss_sub_optional_3</a>";
}
else {
echo "<a href='?order_by=rss_sub_optional_3&order=asc' title='descending'>rss_sub_optional_3</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_optional_4&order=desc' title='ascending'>rss_sub_optional_4</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_optional_4&order=desc' title='ascending'>rss_sub_optional_4</a>";
}
else {
echo "<a href='?order_by=rss_sub_optional_4&order=asc' title='descending'>rss_sub_optional_4</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_optional_5&order=desc' title='ascending'>rss_sub_optional_5</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_optional_5&order=desc' title='ascending'>rss_sub_optional_5</a>";
}
else {
echo "<a href='?order_by=rss_sub_optional_5&order=asc' title='descending'>rss_sub_optional_5</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_add_date&order=desc' title='ascending'>rss_sub_add_date</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_add_date&order=desc' title='ascending'>rss_sub_add_date</a>";
}
else {
echo "<a href='?order_by=rss_sub_add_date&order=asc' title='descending'>rss_sub_add_date</a>";
}
}
echo "&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; ";
if (strlen($order_by)==0) {
echo "<a href='?order_by=rss_sub_add_user&order=desc' title='ascending'>rss_sub_add_user</a>";
}
else {
if ($order=="asc") {
echo "<a href='?order_by=rss_sub_add_user&order=desc' title='ascending'>rss_sub_add_user</a>";
}
else {
echo "<a href='?order_by=rss_sub_add_user&order=asc' title='descending'>rss_sub_add_user</a>";
}
}
echo "&nbsp; &nbsp; </th>";
*/
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
foreach($result as $row) {
//print_r( $row );
echo "<tr style='".$row_style[$c]."'>\n";
//echo "<td valign='top'>".$rss_uuid."</td>";
//echo "<td valign='top'>&nbsp;<b>".$row[rss_sub_title]."</b>&nbsp;</td>";
//echo "<td valign='top'>&nbsp;".$row[rss_sub_link]."&nbsp;</td>";
echo "<td valign='top' width='200'>";
echo " <b>".$row[rss_sub_title]."</b>";
echo "</td>";
echo "<td valign='top'>".$row[rss_sub_add_date]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_1]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_2]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_3]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_4]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_5]."</td>";
//echo "<td valign='top'>".$row[rss_sub_add_user]."</td>";
echo "<td valign='top'>";
echo " <input type='button' class='btn' name='' onclick=\"if (confirm('Are you sure you wish to continue?')) { window.location='rsssubdelete.php?rss_uuid=".$row[rss_uuid]."&rss_sub_uuid=".$row[rss_sub_uuid]."' }\" value='Delete'>";
echo "</td>";
echo "<td valign='top' align='right'>";
echo " &nbsp;";
echo " <input type='button' class='btn' name='' onclick=\"window.location='rsssubupdate.php?rss_uuid=".$rss_uuid."&rss_sub_uuid=".$row[rss_sub_uuid]."'\" value='Update'>";
echo " &nbsp; \n";
//echo " <a href='rsssubupdate.php?rss_uuid=".$rss_uuid."&rss_sub_uuid=".$row[rss_sub_uuid]."'>Update</a>&nbsp;";
echo "</td>";
$rss_sub_description = $row[rss_sub_description];
$rss_sub_description = str_replace ("\r\n", "<br>", $rss_sub_description);
$rss_sub_description = str_replace ("\n", "<br>", $rss_sub_description);
echo "</tr>";
echo "<tr style='".$row_style[$c]."'>\n";
echo "<td valign='top' width='300' colspan='4'>";
echo "".$rss_sub_description."&nbsp;";
echo "</td>";
echo "</tr>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach unset($sql, $result, $row_count);
} //end if results
echo "</table>\n";
echo "</div>\n";
} //if ($showrsssub == 1) {
echo " <br><br>";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
//echo "<input type='button' class='btn' name='' onclick=\"window.location='rsssubsearch.php'\" value='Search'>&nbsp; &nbsp;\n";
if ($rss_sub_show == 1) {
echo "<input type='button' class='btn' name='' onclick=\"window.location='rsssubadd.php?rss_uuid=".$rss_uuid."'\" value='Add $rss_sub_title'>&nbsp; &nbsp;\n";
}
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?>

View File

@@ -0,0 +1,260 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$rss_sub_uuid = check_str($_POST["rss_sub_uuid"]);
$rss_uuid = check_str($_POST["rss_uuid"]);
$rss_sub_title = check_str($_POST["rss_sub_title"]);
$rss_sub_link = check_str($_POST["rss_sub_link"]);
$rss_sub_description = check_str($_POST["rss_sub_description"]);
$rss_sub_optional_1 = check_str($_POST["rss_sub_optional_1"]);
$rss_sub_optional_2 = check_str($_POST["rss_sub_optional_2"]);
$rss_sub_optional_3 = check_str($_POST["rss_sub_optional_3"]);
$rss_sub_optional_4 = check_str($_POST["rss_sub_optional_4"]);
$rss_sub_optional_5 = check_str($_POST["rss_sub_optional_5"]);
$rss_sub_add_date = check_str($_POST["rss_sub_add_date"]);
$rss_sub_add_user = check_str($_POST["rss_sub_add_user"]);
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
$sql = "";
$sql .= "select * from v_rss_sub ";
$sql .= "where ";
if (strlen($domain_uuid) > 0) { $sql .= "and rss_sub_uuid = '$domain_uuid' "; }
if (strlen($rss_sub_uuid) > 0) { $sql .= "and rss_sub_uuid like '%$rss_sub_uuid%' "; }
if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
if (strlen($rss_sub_title) > 0) { $sql .= "and rss_sub_title like '%$rss_sub_title%' "; }
if (strlen($rss_sub_link) > 0) { $sql .= "and rss_sub_link like '%$rss_sub_link%' "; }
if (strlen($rss_sub_description) > 0) { $sql .= "and rss_sub_description like '%$rss_sub_description%' "; }
if (strlen($rss_sub_optional_1) > 0) { $sql .= "and rss_sub_optional_1 like '%$rss_sub_optional_1%' "; }
if (strlen($rss_sub_optional_2) > 0) { $sql .= "and rss_sub_optional_2 like '%$rss_sub_optional_2%' "; }
if (strlen($rss_sub_optional_3) > 0) { $sql .= "and rss_sub_optional_3 like '%$rss_sub_optional_3%' "; }
if (strlen($rss_sub_optional_4) > 0) { $sql .= "and rss_sub_optional_4 like '%$rss_sub_optional_4%' "; }
if (strlen($rss_sub_optional_5) > 0) { $sql .= "and rss_sub_optional_5 like '%$rss_sub_optional_5%' "; }
if (strlen($rss_sub_add_date) > 0) { $sql .= "and rss_sub_add_date like '%$rss_sub_add_date%' "; }
if (strlen($rss_sub_add_user) > 0) { $sql .= "and rss_sub_add_user like '%$rss_sub_add_user%' "; }
$sql .= "and length(rss_sub_del_date) = 0 ";
$sql .= "or ";
if (strlen($domain_uuid) > 0) { $sql .= "and rss_sub_uuid = '$domain_uuid' "; }
if (strlen($rss_sub_uuid) > 0) { $sql .= "and rss_sub_uuid like '%$rss_sub_uuid%' "; }
if (strlen($rss_uuid) > 0) { $sql .= "and rss_uuid like '%$rss_uuid%' "; }
if (strlen($rss_sub_title) > 0) { $sql .= "and rss_sub_title like '%$rss_sub_title%' "; }
if (strlen($rss_sub_link) > 0) { $sql .= "and rss_sub_link like '%$rss_sub_link%' "; }
if (strlen($rss_sub_description) > 0) { $sql .= "and rss_sub_description like '%$rss_sub_description%' "; }
if (strlen($rss_sub_optional_1) > 0) { $sql .= "and rss_sub_optional_1 like '%$rss_sub_optional_1%' "; }
if (strlen($rss_sub_optional_2) > 0) { $sql .= "and rss_sub_optional_2 like '%$rss_sub_optional_2%' "; }
if (strlen($rss_sub_optional_3) > 0) { $sql .= "and rss_sub_optional_3 like '%$rss_sub_optional_3%' "; }
if (strlen($rss_sub_optional_4) > 0) { $sql .= "and rss_sub_optional_4 like '%$rss_sub_optional_4%' "; }
if (strlen($rss_sub_optional_5) > 0) { $sql .= "and rss_sub_optional_5 like '%$rss_sub_optional_5%' "; }
if (strlen($rss_sub_add_date) > 0) { $sql .= "and rss_sub_add_date like '%$rss_sub_add_date%' "; }
if (strlen($rss_sub_add_user) > 0) { $sql .= "and rss_sub_add_user like '%$rss_sub_add_user%' "; }
$sql .= "and rss_sub_del_date is null ";
$sql = trim($sql);
if (substr($sql, -5) == "where"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
if (substr($sql, -3) == " or"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
$sql = str_replace ("where and", "where", $sql);
$sql = str_replace ("or and", "or", $sql);
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
$c = 0;
$row_style["0"] = "background-color: #F5F5DC;";
$row_style["1"] = "background-color: #FFFFFF;";
echo "<b>Search Results</b><br>";
echo "<div align='left'>\n";
echo "<table border='0' cellpadding='1' cellspacing='1'>\n";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
if ($result_count == 0) { //no results
echo "<tr><td>&nbsp;</td></tr>";
}
else { //received results
echo "<tr>";
echo "<th nowrap>&nbsp; &nbsp; Sub ID&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; Id&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; Title&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; Link&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_description&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_1&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_2&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_3&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_4&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_optional_5&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_add_date&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; rss_sub_add_user&nbsp; &nbsp; </th>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
foreach($result as $row) {
//print_r( $row );
echo "<tr style='".$row_style[$c]."'>\n";
echo "<td valign='top'><a href='rsssubupdate.php?rss_sub_uuid=".$row[rss_sub_uuid]."'>".$row[rss_sub_uuid]."</a></td>";
echo "<td valign='top'>".$row[rss_uuid]."</td>";
echo "<td valign='top'>".$row[rss_sub_title]."</td>";
//echo "<td valign='top'>".$row[rss_sub_link]."</td>";
//echo "<td valign='top'>".$row[rss_sub_description]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_1]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_2]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_3]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_4]."</td>";
//echo "<td valign='top'>".$row[rss_sub_optional_5]."</td>";
//echo "<td valign='top'>".$row[rss_sub_add_date]."</td>";
//echo "<td valign='top'>".$row[rss_sub_add_user]."</td>";
echo "</tr>";
echo "<tr><td colspan='100%'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
echo "</table>\n";
echo "</div>\n";
echo " <br><br>";
echo " </td>\n";
echo "</tr>\n";
} //end if results
echo "</table>\n";
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
}
else {
echo "\n"; require_once "includes/header.php";
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>Sub ID:</td>";
echo " <td><input type='text' class='txt' name='rss_sub_uuid'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>ID:</td>";
echo " <td><input type='text' class='txt' name='rss_uuid'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Sub Title:</td>";
echo " <td><input type='text' class='txt' name='rss_sub_title'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Sub Link:</td>";
echo " <td><input type='text' class='txt' name='rss_sub_link'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Sub Desc:</td>";
echo " <td><input type='text' class='txt' name='rss_sub_description'></td>";
echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_1:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_optional_1'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_2:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_optional_2'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_3:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_optional_3'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_4:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_optional_4'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_5:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_optional_5'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_add_date:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_add_date'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_add_user:</td>";
//echo " <td><input type='text' class='txt' name='rss_sub_add_user'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td colspan='2' align='right'><input type='submit' name='submit' class='btn' value='Search'></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
} //end if not post
?>

View File

@@ -0,0 +1,206 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
$rss_uuid = $_GET["rss_uuid"];
if (count($_POST)>0 && $_POST["persistform"] == "0") {
$rss_sub_uuid = check_str($_POST["rss_sub_uuid"]);
$rss_uuid = check_str($_POST["rss_uuid"]);
$rss_sub_title = check_str($_POST["rss_sub_title"]);
$rss_sub_link = check_str($_POST["rss_sub_link"]);
$rss_sub_description = check_str($_POST["rss_sub_description"]);
$rss_sub_optional_1 = check_str($_POST["rss_sub_optional_1"]);
$rss_sub_optional_2 = check_str($_POST["rss_sub_optional_2"]);
$rss_sub_optional_3 = check_str($_POST["rss_sub_optional_3"]);
$rss_sub_optional_4 = check_str($_POST["rss_sub_optional_4"]);
$rss_sub_optional_5 = check_str($_POST["rss_sub_optional_5"]);
$rss_sub_add_date = check_str($_POST["rss_sub_add_date"]);
$rss_sub_add_user = check_str($_POST["rss_sub_add_user"]);
$msg = '';
if (strlen($rss_uuid) == 0) { $msg .= "Error missing rss_uuid.<br>\n"; }
if (strlen($rss_sub_uuid) == 0) { $msg .= "Error missing rss_sub_uuid.<br>\n"; }
//if (strlen($rss_sub_title) == 0) { $msg .= "Please provide a title.<br>\n"; }
if (strlen($rss_sub_description) == 0) { $msg .= "Please provide a description.<br>\n"; }
if (strlen($msg) > 0) {
require_once "includes/persistform.php";
require_once "includes/header.php";
echo "<div align='center' style='' >";
echo "<table>";
echo "<tr>";
echo "<td>";
echo " <div class='borderlight' align='left' style='padding:10px;'>";
echo " $msg";
echo " <br>";
echo " <div align='center'>".persistform($_POST)."</div>";
echo " </div>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
return;
}
//sql update
$sql = "update v_rss_sub set ";
//$sql .= "rss_uuid = '$rss_uuid', ";
$sql .= "rss_sub_title = '$rss_sub_title', ";
$sql .= "rss_sub_link = '$rss_sub_link', ";
$sql .= "rss_sub_description = '$rss_sub_description', ";
$sql .= "rss_sub_optional_1 = '$rss_sub_optional_1', ";
$sql .= "rss_sub_optional_2 = '$rss_sub_optional_2', ";
$sql .= "rss_sub_optional_3 = '$rss_sub_optional_3', ";
$sql .= "rss_sub_optional_4 = '$rss_sub_optional_4', ";
$sql .= "rss_sub_optional_5 = '$rss_sub_optional_5' ";
//$sql .= "rss_sub_add_date = now(), ";
//$sql .= "rss_sub_add_user = '".$_SESSION["username"]."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_sub_uuid = '$rss_sub_uuid' ";
//$sql .= "and rss_uuid = '$rss_uuid' ";
$count = $db->exec(check_sql($sql));
//echo "Affected Rows: ".$count;
//edit: make sure the meta redirect url is correct
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=rsssublist.php?rss_uuid=$rss_uuid&rss_sub_uuid=$rss_sub_uuid\">\n";
echo "<div align='center'>";
echo "Update Complete";
echo "</div>";
require_once "includes/footer.php";
return;
}
else {
//get data from the db
$rss_sub_uuid = $_GET["rss_sub_uuid"];
$sql = "";
$sql .= "select * from v_rss_sub ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_sub_uuid = '$rss_sub_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
//$rss_uuid = $row["rss_uuid"];
$rss_sub_title = $row["rss_sub_title"];
$rss_sub_link = $row["rss_sub_link"];
$rss_sub_description = $row["rss_sub_description"];
$rss_sub_optional_1 = $row["rss_sub_optional_1"];
$rss_sub_optional_2 = $row["rss_sub_optional_2"];
$rss_sub_optional_3 = $row["rss_sub_optional_3"];
$rss_sub_optional_4 = $row["rss_sub_optional_4"];
$rss_sub_optional_5 = $row["rss_sub_optional_5"];
$rss_sub_add_date = $row["rss_sub_add_date"];
$rss_sub_add_user = $row["rss_sub_add_user"];
break; //limit to 1 row
}
}
//show the header
require_once "includes/header.php";
require_once "includes/wysiwyg.php";
//show the content
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' action=''>";
echo "<table width='100%'>";
//echo " <tr>";
//echo " <td>rss_uuid:</td>";
//echo " <td><input type='text' name='rss_uuid' class='txt' value='$rss_uuid'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td nowrap>Sub Title:</td>";
echo " <td width='100%'><input type='text' name='rss_sub_title' class='txt' value='$rss_sub_title'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Sub Link:</td>";
echo " <td><input type='text' name='rss_sub_link' class='txt' value='$rss_sub_link'></td>";
echo " </tr>";
echo " <tr>";
echo " <td valign='top'>Description:</td>";
echo " <td>";
echo " <textarea name='rss_sub_description' rows='12' class='txt'>$rss_sub_description</textarea>";
echo " </td>";
echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_1:</td>";
//echo " <td><input type='text' name='rss_sub_optional_1' value='$rss_sub_optional_1'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_2:</td>";
//echo " <td><input type='text' name='rss_sub_optional_2' value='$rss_sub_optional_2'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_3:</td>";
//echo " <td><input type='text' name='rss_sub_optional_3' value='$rss_sub_optional_3'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_4:</td>";
//echo " <td><input type='text' name='rss_sub_optional_4' value='$rss_sub_optional_4'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td>rss_sub_optional_5:</td>";
//echo " <td><input type='text' name='rss_sub_optional_5' value='$rss_sub_optional_5'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td colspan='2' align='right'>";
echo " <input type='hidden' name='rss_uuid' value='$rss_uuid'>";
echo " <input type='hidden' name='persistform' value='0'>";
echo " <input type='hidden' name='rss_sub_uuid' value='$rss_sub_uuid'>";
echo " <input type='submit' name='submit' class='btn' value='Update'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//show the footer
require_once "includes/footer.php";
?>

392
app/content/rssupdate.php Normal file
View File

@@ -0,0 +1,392 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "config.php";
if (permission_exists('content_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$rss_uuid = check_str($_POST["rss_uuid"]);
//$rss_category = check_str($_POST["rss_category"]); //defined in local config.php
$rss_sub_category = check_str($_POST["rss_sub_category"]);
$rss_title = check_str($_POST["rss_title"]);
$rss_link = check_str($_POST["rss_link"]);
$rss_description = check_str($_POST["rss_description"]);
$rss_group = check_str($_POST["rss_group"]);
$rss_order = check_str($_POST["rss_order"]);
//$rss_description = str_replace ("<br />\r\n<br />", "<br />", $rss_description);
//$rss_description = str_replace ("<br />\n<br />", "<br />", $rss_description);
//$rss_description = str_replace ("<p>", "", $rss_description);
//$rss_description = str_replace ("</p>", "<br />", $rss_description);
$rss_img = check_str($_POST["rss_img"]);
$rss_optional_1 = check_str($_POST["rss_optional_1"]);
$rss_optional_2 = check_str($_POST["rss_optional_2"]);
//$rss_optional_3 = check_str($_POST["rss_optional_3"]);
//$rss_optional_4 = check_str($_POST["rss_optional_4"]);
//$rss_optional_5 = check_str($_POST["rss_optional_5"]);
//sql update
$sql = "update v_rss set ";
$sql .= "rss_sub_category = '$rss_sub_category', ";
$sql .= "rss_title = '$rss_title', ";
$sql .= "rss_link = '$rss_link', ";
$sql .= "rss_description = '$rss_description', ";
$sql .= "rss_img = '$rss_img', ";
$sql .= "rss_optional_1 = '$rss_optional_1', ";
$sql .= "rss_optional_2 = '$rss_optional_2', ";
//$sql .= "rss_optional_3 = '$rss_optional_3', ";
//$sql .= "rss_optional_4 = '$rss_optional_4', ";
//$sql .= "rss_optional_5 = '$rss_optional_5', ";
//$sql .= "rss_add_date = '$rss_add_date', ";
$sql .= "rss_group = '$rss_group', ";
$sql .= "rss_order = '$rss_order' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$sql .= "and rss_category = '$rss_category' ";
//echo $sql;
//return;
$count = $db->exec(check_sql($sql));
//echo $sql."<br>";
//echo "Affected Rows: ".$count;
//exit;
//edit: make sure the meta redirect url is correct
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=rsslist.php\">\n";
echo "<div align='center'>";
echo "Update Complete";
echo "</div>";
require_once "includes/footer.php";
return;
}
else {
//get data from the db
$rss_uuid = $_GET["rss_uuid"];
$sql = "";
$sql .= "select * from v_rss ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and rss_uuid = '$rss_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$rss_category = $row["rss_category"];
$rss_sub_category = $row["rss_sub_category"];
$rss_optional_1 = $row["rss_optional_1"];
$rss_title = $row["rss_title"];
$rss_link = $row["rss_link"];
$rss_description = $row["rss_description"];
if ($rss_optional_1 == "text/html") { //type
$rss_description = htmlentities($rss_description);
}
$rss_img = $row["rss_img"];
$rss_optional_2 = $row["rss_optional_2"];
$rss_optional_3 = $row["rss_optional_3"];
$rss_optional_4 = $row["rss_optional_4"];
$rss_optional_5 = $row["rss_optional_5"];
$rss_add_date = $row["rss_add_date"];
$rss_add_user = $row["rss_add_user"];
$rss_group = $row["rss_group"];
$rss_order = $row["rss_order"];
//$rss_description = str_replace ("\r\n", "<br>", $rss_description);
//echo $rss_description;
//return;
break; //limit to 1 row
}
}
require_once "includes/header.php";
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/tiny_mce')) {
if ($rss_optional_1 == "text/html") {
require_once "includes/wysiwyg.php";
}
}
else {
//--- Begin: Edit Area -----------------------------------------------------
echo " <script language=\"javascript\" type=\"text/javascript\" src=\"".PROJECT_PATH."/includes/edit_area/edit_area_full.js\"></script>\n";
echo " <!-- -->\n";
echo " <script language=\"Javascript\" type=\"text/javascript\">\n";
echo " editAreaLoader.init({\n";
echo " id: \"rss_description\" // id of the textarea to transform //, |, help\n";
echo " ,start_highlight: true\n";
echo " ,font_size: \"8\"\n";
echo " ,allow_toggle: false\n";
echo " ,language: \"en\"\n";
echo " ,syntax: \"html\"\n";
echo " ,toolbar: \"search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\" //new_document,\n";
echo " ,plugins: \"charmap\"\n";
echo " ,charmap_default: \"arrows\"\n";
echo " });\n";
echo " </script>";
//--- End: Edit Area -------------------------------------------------------
}
echo "<div align='center'>";
echo "<table border='0' width='90%' cellpadding='0' cellspacing='0'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\" width='100%'>\n";
//echo " <br>";
echo "<form method='post' action=''>";
echo "<table width='100%' cellpadding='6' cellspacing='0'>";
echo "<tr>\n";
echo "<td width='30%' nowrap valign='top'><b>Content Edit</b></td>\n";
echo "<td width='70%' align='right' valign='top'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='rsslist.php'\" value='Back'><br /><br /></td>\n";
echo "</tr>\n";
//echo " <tr>";
//echo " <td class='vncellreq'>Category:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_category' value='$rss_category'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq' nowrap>Sub Category:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_sub_category' value='$rss_sub_category'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td width='30%' class='vncellreq' nowrap>Title:</td>";
echo " <td width='70%' class='vtable' width='100%'><input type='text' class='formfld' name='rss_title' value='$rss_title'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Link:</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='rss_link' value='$rss_link'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Group:</td>";
echo " <td class='vtable'>";
//echo " <input type='text' class='formfld' name='menuparentid' value='$menuparentid'>";
//---- Begin Select List --------------------
$sql = "SELECT * FROM v_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select name=\"rss_group\" class='formfld'>\n";
echo "<option value=\"\">public</option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//$count = count($result);
foreach($result as $field) {
if ($rss_group == $field[group_name]) {
echo "<option value='".$field[group_name]."' selected>".$field[group_name]."</option>\n";
}
else {
echo "<option value='".$field[group_name]."'>".$field[group_name]."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
//---- End Select List --------------------
echo " </td>";
echo " </tr>";
/*
echo " <tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " Template: \n";
echo " </td>\n";
echo " <td class=\"vtable\">\n";
echo "<select id='rss_sub_category' name='rss_sub_category' class='formfld' style=''>\n";
echo "<option value=''></option>\n";
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != ".svn" && is_dir($theme_dir.'/'.$file)) {
if ($file == $rss_sub_category) {
echo "<option value='$file' selected='selected'>$file</option>\n";
}
else {
echo "<option value='$file'>$file</option>\n";
}
}
}
closedir($handle);
}
echo " </select>\n";
echo " <br />\n";
echo " Select a template to set as the default and then press save.<br />\n";
echo " </td>\n";
echo " </tr>\n";
*/
echo " <tr>";
echo " <td class='vncellreq'>Type:</td>";
echo " <td class='vtable'>";
echo " <select name=\"rss_optional_1\" class='formfld'>\n";
if ($rss_optional_1 == "text/html") { echo "<option value=\"text/html\" selected>text/html</option>\n"; }
else { echo "<option value=\"text/html\">text/html</option>\n"; }
if ($rss_optional_1 == "text/javascript") { echo "<option value=\"text/javascript\" selected>text/javascript</option>\n"; }
else { echo "<option value=\"text/javascript\">text/javascript</option>\n"; }
echo " </select>";
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Order:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='rss_order' class='formfld'>\n";
if (strlen(htmlspecialchars($rss_order))> 0) {
echo " <option selected='yes' value='".htmlspecialchars($rss_order)."'>".htmlspecialchars($rss_order)."</option>\n";
}
$i=0;
while($i<=999) {
if (strlen($i) == 1) {
echo " <option value='00$i'>00$i</option>\n";
}
if (strlen($i) == 2) {
echo " <option value='0$i'>0$i</option>\n";
}
if (strlen($i) == 3) {
echo " <option value='$i'>$i</option>\n";
}
$i++;
}
echo " </select>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td class='' colspan='2' align='left'>";
echo " <strong>Content:</strong> ";
if ($rss_optional_1 == "text/html") {
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/tiny_mce')) {
echo " &nbsp; &nbsp; &nbsp; editor &nbsp; <a href='#' title='toggle' onclick=\"toogleEditorMode('rss_description'); return false;\">on/off</a><br>";
}
echo " <textarea name='rss_description' id='rss_description' class='formfld' cols='20' style='width: 100%' rows='12' >$rss_description</textarea>";
}
if ($rss_optional_1 == "text/javascript") {
echo " <textarea name='rss_description' id='rss_description' class='formfld' cols='20' style='width: 100%' rows='12' ></textarea>";
}
echo " </td>";
echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Image:</td>";
//echo " <td class='vtable'><input type='text' name='rss_img' value='$rss_img'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Priority:</td>";
//echo " <td class='vtable'>";
//echo " <input type='text' name='rss_optional_1' value='$rss_optional_1'>";
//echo " <select name=\"rss_optional_1\" class='formfld'>\n";
//echo " <option value=\"$rss_optional_1\">$rss_optional_1</option>\n";
//echo " <option value=\"\"></option>\n";
//echo " <option value=\"low\">low</option>\n";
//echo " <option value=\"med\">med</option>\n";
//echo " <option value=\"high\">high</option>\n";
//echo " </select>";
//echo " </td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Status:</td>";
//echo " <td class='vtable'>";
//echo " <input type='text' name='rss_optional_2' value='$rss_optional_2'>";
//echo " <select name=\"rss_optional_2\" class=\"formfld\">\n";
//echo " <option value=\"$rss_optional_2\">$rss_optional_2</option>\n";
//echo " <option value=\"\"></option>\n";
//echo " <option value=\"0\">0</option>\n";
//echo " <option value=\"10\">10</option>\n";
//echo " <option value=\"20\">20</option>\n";
//echo " <option value=\"30\">30</option>\n";
//echo " <option value=\"40\">40</option>\n";
//echo " <option value=\"50\">50</option>\n";
//echo " <option value=\"60\">60</option>\n";
//echo " <option value=\"70\">70</option>\n";
//echo " <option value=\"80\">80</option>\n";
//echo " <option value=\"90\">90</option>\n";
//echo " <option value=\"100\">100</option>\n";
//echo " </select>";
//echo " </td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Optional 3:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_optional_3' value='$rss_optional_3'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>Optional 4:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_optional_4' value='$rss_optional_4'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>rss_optional_5:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_optional_5' value='$rss_optional_5'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncellreq'>rss_add_date:</td>";
//echo " <td class='vtable'><input type='text' class='formfld' name='rss_add_date' value='$rss_add_date'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td class='' colspan='2' align='right'>";
//echo "<input type=\"button\" value=\"Load\" onclick=\"document.getElementById('rss_description').innerHTML = ajaxresponse;\" />";
//echo "<input type=\"button\" value=\"Load\" onclick=\"ajaxLoad('rss_description', ajaxresponse);\" />";
echo " <input type='hidden' name='rss_uuid' value='$rss_uuid'>";
echo " <input type='submit' class='btn' name='submit' value='Save'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
if ($rss_optional_1 == "text/javascript") {
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo " document.getElementById('rss_description').innerHTML = ajaxresponse;\n";
echo "</script>\n";
}
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>

View File

@@ -0,0 +1,75 @@
<?php
//application details
$apps[$x]['name'] = 'Destinations';
$apps[$x]['uuid'] = '5ec89622-b19c-3559-64f0-afde802ab139';
$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'] = 'Used to define external destination numbers.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Destinations';
$apps[$x]['menu'][0]['uuid'] = 'fd2a708a-ff03-c707-c19d-5a4194375eba';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/destinations/destinations.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
$apps[$x]['menu'][0]['groups'][] = 'admin';
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = 'destination_view';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'destination_add';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'destination_edit';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'destination_delete';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_destinations';
$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'] = 'destination_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_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'] = 'destination_context';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the context.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_extension';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the extension.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the description.';
$z++;
?>

View File

@@ -0,0 +1,134 @@
<?php
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/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>Destinations</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 " Used to provide a simple way of directing a call through the dialplan to find its destination.<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_destinations ";
$sql .= " where domain_uuid = '$domain_uuid' ";
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_destinations ";
$sql .= " where domain_uuid = '$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('destination_name', 'Name', $order_by, $order);
echo th_order_by('destination_context', 'Context', $order_by, $order);
echo th_order_by('destination_extension', 'Extension', $order_by, $order);
echo th_order_by('destination_enabled', 'Enabled', $order_by, $order);
echo th_order_by('destination_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n";
echo " <a href='destinations_edit.php' alt='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['destination_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_context']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_extension']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='destinations_edit.php?id=".$row['destination_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='destinations_delete.php?id=".$row['destination_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " </td>\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='6' 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";
echo " <a href='destinations_edit.php' alt='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 "includes/footer.php";
?>

View File

@@ -0,0 +1,35 @@
<?php
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
if (strlen($id)>0) {
$sql = "";
$sql .= "delete from v_destinations ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and destination_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=destinations.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -0,0 +1,249 @@
<?php
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$destination_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$destination_name = check_str($_POST["destination_name"]);
$destination_context = check_str($_POST["destination_context"]);
$destination_extension = check_str($_POST["destination_extension"]);
$destination_enabled = check_str($_POST["destination_enabled"]);
$destination_description = check_str($_POST["destination_description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$destination_uuid = check_str($_POST["destination_uuid"]);
}
//check for all required data
//if (strlen($destination_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
//if (strlen($destination_context) == 0) { $msg .= "Please provide: Context<br>\n"; }
//if (strlen($destination_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
//if (strlen($destination_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
//if (strlen($destination_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$sql = "insert into v_destinations ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "destination_uuid, ";
$sql .= "destination_name, ";
$sql .= "destination_context, ";
$sql .= "destination_extension, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$destination_name', ";
$sql .= "'$destination_context', ";
$sql .= "'$destination_extension', ";
$sql .= "'$destination_enabled', ";
$sql .= "'$destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=destinations.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_destinations set ";
$sql .= "destination_name = '$destination_name', ";
$sql .= "destination_context = '$destination_context', ";
$sql .= "destination_extension = '$destination_extension', ";
$sql .= "destination_enabled = '$destination_enabled', ";
$sql .= "destination_description = '$destination_description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and destination_uuid = '$destination_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=destinations.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$destination_uuid = $_GET["id"];
$sql = "select * from v_destinations ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and destination_uuid = '$destination_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
foreach ($result as &$row) {
$destination_name = $row["destination_name"];
$destination_context = $row["destination_context"];
$destination_extension = $row["destination_extension"];
$destination_enabled = $row["destination_enabled"];
$destination_description = $row["destination_description"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
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>Destination Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Destination Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='destinations.php'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "An alias for a call destination. The destination will use the dialplan to find it its target.<br /><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='destination_name' maxlength='255' value=\"$destination_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 " Context:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_context' maxlength='255' value=\"$destination_context\">\n";
echo "<br />\n";
echo "Enter the context.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Extension:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_extension' maxlength='255' value=\"$destination_extension\">\n";
echo "<br />\n";
echo "Enter the extension.\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='destination_enabled'>\n";
echo " <option value=''></option>\n";
if ($destination_enabled == "true") {
echo " <option value='true' SELECTED >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($destination_enabled == "false") {
echo " <option value='false' SELECTED >false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Description:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_description' maxlength='255' value=\"$destination_description\">\n";
echo "<br />\n";
echo "Enter the description.\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='destination_uuid' value='$destination_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>

50
app/destinations/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
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'] );
}
?>

160
app/dialplan/app_config.php Normal file
View File

@@ -0,0 +1,160 @@
<?php
//application details
$apps[$x]['name'] = "Dialplan Manager";
$apps[$x]['uuid'] = '742714e5-8cdf-32fd-462c-cbe7e3d655db';
$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'] = 'The dialplan is used to setup call destinations based on conditions and context. You can use the dialplan to send calls to gateways, auto attendants, external numbers, to scripts, or any destination.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Dialplan';
$apps[$x]['menu'][0]['uuid'] = 'b94e8bd9-9eb5-e427-9c26-ff7a6c21552a';
$apps[$x]['menu'][0]['parent_uuid'] = '';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/dialplan/dialplans.php';
$apps[$x]['menu'][0]['order'] = '15';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
$apps[$x]['menu'][1]['title']['en'] = 'Dialplan Manager';
$apps[$x]['menu'][1]['uuid'] = '52929fee-81d3-4d94-50b7-64842d9393c2';
$apps[$x]['menu'][1]['parent_uuid'] = 'b94e8bd9-9eb5-e427-9c26-ff7a6c21552a';
$apps[$x]['menu'][1]['category'] = 'internal';
$apps[$x]['menu'][1]['path'] = '/app/dialplan/dialplans.php';
$apps[$x]['menu'][1]['groups'][] = 'admin';
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'dialplan_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'dialplan_add';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'dialplan_edit';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'dialplan_delete';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'dialplan_advanced_view';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
$apps[$x]['permissions'][5]['name'] = 'dialplan_advanced_edit';
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_dialplans';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'app_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]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_context';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_continue';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_order';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_dialplan_details';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_dialplans';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'dialplan_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_tag';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_data';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_break';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_inline';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_group';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dialplan_detail_order';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>

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