2012-06-04 16:58:40 +02:00
|
|
|
<?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>
|
2012-11-24 17:50:27 +01:00
|
|
|
James Rose <james.o.rose@gmail.com>
|
2012-06-04 16:58:40 +02:00
|
|
|
*/
|
|
|
|
|
include "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2013-09-21 23:45:35 +02:00
|
|
|
if (permission_exists('recording_add') || permission_exists('recording_edit')) {
|
2012-06-04 16:58:40 +02:00
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-24 17:50:27 +01:00
|
|
|
//add multi-lingual support
|
2015-01-18 11:06:08 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2012-11-24 17:50:27 +01:00
|
|
|
|
2015-04-25 14:26:31 +02:00
|
|
|
//get recording id
|
2012-06-04 16:58:40 +02:00
|
|
|
if (isset($_REQUEST["id"])) {
|
|
|
|
|
$recording_uuid = check_str($_REQUEST["id"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get the form value and set to php variables
|
2015-04-25 14:26:31 +02:00
|
|
|
if (count($_POST) > 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
$recording_filename = check_str($_POST["recording_filename"]);
|
2015-04-25 14:26:31 +02:00
|
|
|
$recording_filename_original = check_str($_POST["recording_filename_original"]);
|
2012-06-04 16:58:40 +02:00
|
|
|
$recording_name = check_str($_POST["recording_name"]);
|
|
|
|
|
$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);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-25 14:26:31 +02:00
|
|
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|
|
|
|
//get recording uuid to edit
|
2012-06-04 16:58:40 +02:00
|
|
|
$recording_uuid = check_str($_POST["recording_uuid"]);
|
|
|
|
|
|
|
|
|
|
//check for all required data
|
2015-04-25 14:26:31 +02:00
|
|
|
$msg = '';
|
2012-11-24 17:50:27 +01:00
|
|
|
if (strlen($recording_filename) == 0) { $msg .= $text['label-edit-file']."<br>\n"; }
|
|
|
|
|
if (strlen($recording_name) == 0) { $msg .= $text['label-edit-recording']."<br>\n"; }
|
2012-06-04 16:58:40 +02:00
|
|
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2013-07-06 08:21:12 +02:00
|
|
|
require_once "resources/persist_form_var.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table><tr><td>\n";
|
|
|
|
|
echo $msg."<br />";
|
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
|
persistformvar($_POST);
|
|
|
|
|
echo "</div>\n";
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-25 14:26:31 +02:00
|
|
|
//update the database
|
2012-06-04 16:58:40 +02:00
|
|
|
if ($_POST["persistformvar"] != "true") {
|
2015-04-25 14:26:31 +02:00
|
|
|
if (permission_exists('recording_edit')) {
|
2012-06-04 16:58:40 +02:00
|
|
|
//if file name is not the same then rename the file
|
2015-04-25 14:26:31 +02:00
|
|
|
if ($recording_filename != $recording_filename_original) {
|
|
|
|
|
rename($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename_original, $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename);
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//update the database with the new data
|
|
|
|
|
$sql = "update v_recordings set ";
|
2015-04-25 14:26:31 +02:00
|
|
|
$sql .= "domain_uuid = '".$domain_uuid."', ";
|
|
|
|
|
$sql .= "recording_filename = '".$recording_filename."', ";
|
|
|
|
|
$sql .= "recording_name = '".$recording_name."', ";
|
|
|
|
|
$sql .= "recording_description = '".$recording_description."' ";
|
|
|
|
|
$sql .= "where domain_uuid = '".$domain_uuid."'";
|
|
|
|
|
$sql .= "and recording_uuid = '".$recording_uuid."'";
|
2012-06-04 16:58:40 +02:00
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
unset($sql);
|
|
|
|
|
|
2014-02-23 08:43:37 +01:00
|
|
|
$_SESSION["message"] = $text['message-update'];
|
|
|
|
|
header("Location: recordings.php");
|
2012-06-04 16:58:40 +02:00
|
|
|
return;
|
2015-04-25 14:26:31 +02:00
|
|
|
} //if (permission_exists('recording_edit')) {
|
2012-06-04 16:58:40 +02:00
|
|
|
} //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"];
|
2012-11-24 02:28:25 +01:00
|
|
|
$sql = "select * from v_recordings ";
|
2015-04-25 14:26:31 +02:00
|
|
|
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
|
|
|
|
$sql .= "and recording_uuid = '".$recording_uuid."' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
foreach ($result as &$row) {
|
|
|
|
|
$recording_filename = $row["recording_filename"];
|
|
|
|
|
$recording_name = $row["recording_name"];
|
|
|
|
|
$recording_description = $row["recording_description"];
|
|
|
|
|
break; //limit to 1 row
|
|
|
|
|
}
|
|
|
|
|
unset ($prep_statement);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//show the header
|
2015-04-25 14:26:31 +02:00
|
|
|
$document['title'] = $text['title-edit'];
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//show the content
|
|
|
|
|
echo "<form method='post' name='frm' action=''>\n";
|
|
|
|
|
|
2015-04-25 14:26:31 +02:00
|
|
|
echo "<table border='0' cellpadding='0' cellspacing='0' align='right'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2015-04-25 14:26:31 +02:00
|
|
|
echo "<td nowrap='nowrap'>";
|
2014-04-27 01:37:41 +02:00
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='recordings.php'\" value='".$text['button-back']."'>";
|
|
|
|
|
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
|
|
|
|
echo "</td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
2015-04-25 14:26:31 +02:00
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
echo "<b>".$text['title-edit']."</b>\n";
|
|
|
|
|
echo "<br /><br />\n";
|
|
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
2015-04-25 14:26:31 +02:00
|
|
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap>\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo " ".$text['label-recording_name']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
2015-04-25 14:26:31 +02:00
|
|
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo " <input class='formfld' type='text' name='recording_name' maxlength='255' value=\"$recording_name\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<br />\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo $text['description-recording']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo " ".$text['label-file_name']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo " <input class='formfld' type='text' name='recording_filename' maxlength='255' value=\"$recording_filename\">\n";
|
2015-04-25 14:26:31 +02:00
|
|
|
echo " <input type='hidden' name='recording_filename_original' value=\"$recording_filename\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<br />\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo $text['message-file']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " Description\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
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";
|
2012-11-24 17:50:27 +01:00
|
|
|
echo $text['description-description']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td colspan='2' align='right'>\n";
|
2015-04-25 14:26:31 +02:00
|
|
|
echo " <input type='hidden' name='recording_uuid' value='".$recording_uuid."'>\n";
|
2015-02-15 10:20:19 +01:00
|
|
|
echo " <br>";
|
2015-02-15 08:59:02 +01:00
|
|
|
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo "</table>";
|
2015-02-15 08:59:02 +01:00
|
|
|
echo "<br><br>";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
|
|
//include the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
?>
|