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
+100
View File
@@ -0,0 +1,100 @@
<?php
//application details
$apps[$x]['name'] = "Recordings";
$apps[$x]['uuid'] = '83913217-c7a2-9e90-925d-a866eb40b60e';
$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'] = 'Manager recordings primarily used with an IVR.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Recordings';
$apps[$x]['menu'][0]['uuid'] = 'e4290fd2-3ccc-a758-1714-660d38453104';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/recordings/v_recordings.php';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'recordings_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'recordings_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'recordings_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'recordings_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'recordings_upload';
$apps[$x]['permissions'][4]['groups'][] = 'admin';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
$apps[$x]['permissions'][5]['name'] = 'recordings_play';
$apps[$x]['permissions'][5]['groups'][] = 'user';
$apps[$x]['permissions'][5]['groups'][] = 'admin';
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
$apps[$x]['permissions'][6]['name'] = 'recordings_download';
$apps[$x]['permissions'][6]['groups'][] = 'user';
$apps[$x]['permissions'][6]['groups'][] = 'admin';
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_recordings';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'recording_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'] = 'recording_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'] = 'recording_filename';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'filename';
$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'] = 'recording_name';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'recordingname';
$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'] = 'recording_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'descr';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>
+30
View File
@@ -0,0 +1,30 @@
<?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>
*/
//if the recordings directory doesn't exist then create it
if (!is_readable($_SESSION['switch']['recordings']['dir'])) { mkdir($_SESSION['switch']['recordings']['dir'],0777,true); }
?>
+50
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'] );
}
?>
Binary file not shown.
+294
View File
@@ -0,0 +1,294 @@
<?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('recordings_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/paging.php";
//set the max php execution time
ini_set(max_execution_time,7200);
//get the http get values and set them as php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//download the recordings
if ($_GET['a'] == "download" && permission_exists('recordings_download')) {
session_cache_limiter('public');
if ($_GET['type'] = "rec") {
if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.base64_decode($_GET['filename']))) {
$fd = fopen($_SESSION['switch']['recordings']['dir'].'/'.base64_decode($_GET['filename']), "rb");
if ($_GET['t'] == "bin") {
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="'.base64_decode($_GET['filename']).'"');
}
else {
$file_ext = substr(base64_decode($_GET['filename']), -3);
if ($file_ext == "wav") {
header("Content-Type: audio/x-wav");
}
if ($file_ext == "mp3") {
header("Content-Type: audio/mp3");
}
}
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Length: " . filesize($_SESSION['switch']['recordings']['dir'].'/'.base64_decode($_GET['filename'])));
fpassthru($fd);
}
}
exit;
}
//upload the recording
if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('recordings_upload')) {
if ($_POST['type'] == 'rec') {
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$_FILES['ulfile']['name']);
$savemsg = "Uploaded file to ".$_SESSION['switch']['recordings']['dir']."/". htmlentities($_FILES['ulfile']['name']);
//system('chmod -R 744 '.$_SESSION['switch']['recordings']['dir'].'*');
unset($_POST['txtCommand']);
}
}
//build a list of recordings
$config_recording_list = '|';
$i = 0;
$sql = "";
$sql .= "select * from v_recordings ";
$sql .= "where 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) {
$config_recording_list .= $row['recording_filename']."|";
}
unset ($prep_statement);
//add recordings to the database
if (is_dir($_SESSION['switch']['recordings']['dir'].'/')) {
if ($dh = opendir($_SESSION['switch']['recordings']['dir'].'/')) {
while (($file = readdir($dh)) !== false) {
if (filetype($_SESSION['switch']['recordings']['dir']."/".$file) == "file") {
if (strpos($config_recording_list, "|".$file) === false) {
//echo "The $file was not found<br/>";
//file not found add it to the database
$a_file = explode("\.", $file);
$recording_uuid = uuid();
$sql = "insert into v_recordings ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "recording_uuid, ";
$sql .= "recording_filename, ";
$sql .= "recording_name, ";
$sql .= "recording_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$recording_uuid', ";
$sql .= "'$file', ";
$sql .= "'".$a_file[0]."', ";
$sql .= "'auto' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
}
}
closedir($dh);
}
}
//include the header
require_once "includes/header.php";
//begin the content
echo "<script>\n";
echo "function EvalSound(soundobj) {\n";
echo " var thissound= eval(\"document.\"+soundobj);\n";
echo " thissound.Play();\n";
echo "}\n";
echo "</script>";
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'><p><span class=\"vexpl\"><span class=\"red\"><strong>Recordings:<br>\n";
echo " </strong></span>\n";
echo " To make a recording dial *732 or you can make a\n";
echo " 16bit 8khz/16khz Mono WAV file then copy it to the\n";
echo " following directory then refresh the page to play it back.\n";
echo " Click on the 'Filename' to download it or the 'Recording Name' to\n";
echo " play the audio.\n";
echo " </span></p></td>\n";
echo " </tr>\n";
echo "</table>";
echo "<br />\n";
echo "<form action=\"\" method=\"POST\" enctype=\"multipart/form-data\" name=\"frmUpload\" onSubmit=\"\">\n";
echo " <table border='0' width='100%'>\n";
echo " <tr>\n";
echo " <td align='left' width='50%'>\n";
if ($v_path_show) {
echo "<b>location:</b> \n";
echo $_SESSION['switch']['recordings']['dir'];
}
echo " </td>\n";
echo " <td valign=\"top\" class=\"label\">\n";
echo " <input name=\"type\" type=\"hidden\" value=\"rec\">\n";
echo " </td>\n";
echo " <td valign=\"top\" align='right' class=\"label\" nowrap>\n";
echo " File to upload:\n";
echo " <input name=\"ulfile\" type=\"file\" class=\"btn\" id=\"ulfile\">\n";
echo " <input name=\"submit\" type=\"submit\" class=\"btn\" id=\"upload\" value=\"Upload\">\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</form>";
$sql = "";
$sql .= "select * from v_recordings ";
$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_recordings ";
$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 "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('recording_filename', 'Filename (download)', $order_by, $order);
echo th_order_by('recording_name', 'Recording Name (play)', $order_by, $order);
echo "<th width=\"10%\" class=\"listhdr\" nowrap>Size</th>\n";
echo th_order_by('recording_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('recordings_add')) {
echo " <a href='v_recordings_edit.php' alt='add'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename']);
$tmp_filesize = byte_convert($tmp_filesize);
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo " <a href=\"v_recordings.php?a=download&type=rec&t=bin&filename=".base64_encode($row['recording_filename'])."\">\n";
echo $row['recording_filename'];
echo " </a>";
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo " <a href=\"javascript:void(0);\" onclick=\"window.open('v_recordings_play.php?a=download&type=moh&filename=".base64_encode($row['recording_filename'])."', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')\">\n";
echo $row['recording_name'];
echo " </a>";
echo "</td>\n";
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
echo " ".$tmp_filesize;
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."' width='30%'>".$row['recording_description']."</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('recordings_edit')) {
echo " <a href='v_recordings_edit.php?id=".$row['recording_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('recordings_delete')) {
echo " <a href='v_recordings_delete.php?id=".$row['recording_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 "</table>\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('recordings_add')) {
echo " <a href='v_recordings_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>\n";
echo "<br>\n";
echo "<br>\n";
echo "<br>\n";
//include the footer
require_once "includes/footer.php";
?>
+75
View File
@@ -0,0 +1,75 @@
<?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('recordings_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_GET)>0) {
$id = $_GET["id"];
}
if (strlen($id)>0) {
//get filename
$sql = "select * from v_recordings ";
$sql .= "where recording_uuid = '$id' ";
$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) {
$filename = $row["recording_filename"];
break; //limit to 1 row
}
unset ($prep_statement);
//delete recording from the database
$sql = "delete from v_recordings ";
$sql .= "where recording_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//delete the recording
unlink($_SESSION['switch']['recordings']['dir']."/".$filename);
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_recordings.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>
+271
View File
@@ -0,0 +1,271 @@
<?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('recordings_add') || permission_exists('recordings_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the action as an add or an update
if (isset($_REQUEST["id"])) {
$action = "update";
$recording_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get the form value and set to php variables
if (count($_POST)>0) {
$recording_filename = check_str($_POST["recording_filename"]);
$recording_name = check_str($_POST["recording_name"]);
//$recording_uuid = check_str($_POST["recording_uuid"]);
$recording_description = check_str($_POST["recording_description"]);
//clean the recording filename and name
$recording_filename = str_replace(" ", "_", $recording_filename);
$recording_filename = str_replace("'", "", $recording_filename);
$recording_name = str_replace(" ", "_", $recording_name);
$recording_name = str_replace("'", "", $recording_name);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$recording_uuid = check_str($_POST["recording_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
if (strlen($recording_filename) == 0) { $msg .= "Please provide: Filename (download)<br>\n"; }
if (strlen($recording_name) == 0) { $msg .= "Please provide: Recording Name (play)<br>\n"; }
//if (strlen($recording_uuid) == 0) { $msg .= "Please provide: recording_uuid<br>\n"; }
//if (strlen($recording_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" && permission_exists('recordings_add')) {
$recording_uuid = uuid();
$sql = "insert into v_recordings ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "recording_uuid, ";
$sql .= "recording_filename, ";
$sql .= "recording_name, ";
$sql .= "recording_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$recording_uuid', ";
$sql .= "'$recording_filename', ";
$sql .= "'$recording_name', ";
$sql .= "'$recording_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_recordings.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('recordings_edit')) {
//get the original filename
$sql = "";
$sql .= "select * from v_recordings ";
$sql .= "where recording_uuid = '$recording_uuid' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
//echo "sql: ".$sql."<br />\n";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$recording_filename_orig = $row["recording_filename"];
break; //limit to 1 row
}
unset ($prep_statement);
//if file name is not the same then rename the file
if ($recording_filename != $recording_filename_orig) {
//echo "orig: ".$_SESSION['switch']['recordings']['dir'].'/'.$recording_filename_orig."<br />\n";
//echo "new: ".$_SESSION['switch']['recordings']['dir'].'/'.$recording_filename."<br />\n";
rename($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename_orig, $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename);
}
//update the database with the new data
$sql = "update v_recordings set ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "recording_filename = '$recording_filename', ";
$sql .= "recording_name = '$recording_name', ";
//$sql .= "recording_uuid = '$recording_uuid', ";
$sql .= "recording_description = '$recording_description' ";
$sql .= "where domain_uuid = '$domain_uuid'";
$sql .= "and recording_uuid = '$recording_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_recordings.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") {
$recording_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_recordings ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and recording_uuid = '$recording_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
$recording_filename = $row["recording_filename"];
$recording_name = $row["recording_name"];
//$recording_uuid = $row["recording_uuid"];
$recording_description = $row["recording_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='2'>\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><b>Add Recording</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap><b>Edit Recording</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_recordings.php'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Filename (download):\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='recording_filename' maxlength='255' value=\"$recording_filename\">\n";
echo "<br />\n";
echo "Name of the file. example.wav\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Recording Name (play):\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='recording_name' maxlength='255' value=\"$recording_name\">\n";
echo "<br />\n";
echo "Recording Name. example: recordingx\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
//echo " recording_uuid:\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='recording_uuid' maxlength='255' value=\"$recording_uuid\">\n";
//echo "<br />\n";
//echo "\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='recording_description' maxlength='255' value=\"$recording_description\">\n";
echo "<br />\n";
echo "You may enter a description here for your reference (not parsed).\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='recording_uuid' value='$recording_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";
?>
+78
View File
@@ -0,0 +1,78 @@
<?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('recordings_play')) {
//access granted
}
else {
echo "access denied";
exit;
}
$filename = base64_decode($_GET['filename']);
$type = $_GET['type']; //moh //rec
?>
<html>
<head>
</head>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align='center'>
<b>file: <?php echo $filename ?></b>
</td>
</tr>
<tr>
<td align='center'>
<?php
$file_ext = substr($filename, -3);
if ($file_ext == "wav") {
//HTML5 method
echo "<audio src=\"http://localhost:8000/mod/recordings/v_recordings.php?a=download&type=".$type."&filename=".base64_encode($filename)."\" autoplay=\"autoplay\">";
echo "</audio>";
echo "<embed src=\"v_recordings.php?a=download&type=".$type."&filename=".base64_encode($filename)."\" autostart=\"true\" width=\"300\" height=\"90\" name=\"sound_".$filename."\" enablejavascript=\"true\">\n";
}
if ($file_ext == "mp3") {
echo "<object type=\"application/x-shockwave-flash\" width=\"400\" height=\"17\" data=\"slim.swf?autoplay=true&song_title=".urlencode($filename)."&song_url=v_recordings.php?a=download&type=".$type."&filename=".base64_encode($filename)."\">\n";
echo "<param name=\"movie\" value=\"slim.swf?autoplay=true&song_url=v_recordings.php?a=download&type=".$type."&filename=".base64_encode($filename)."\" />\n";
echo "<param name=\"quality\" value=\"high\"/>\n";
echo "<param name=\"bgcolor\" value=\"#E6E6E6\"/>\n";
echo "</object>\n";
}
?>
</td>
</tr>
</table>
</body>
</html>