Recordings: Add data size when displaying base64 recordings, other misc minor issues. Phrases: Removed escaping on Recording options in select.

This commit is contained in:
Nate 2019-09-10 07:59:37 -06:00
parent 8068a89a3a
commit 95bc79c039
3 changed files with 65 additions and 36 deletions

View File

@ -288,10 +288,10 @@
echo "opt_group.label = \"".$text['label-recordings']."\";\n"; echo "opt_group.label = \"".$text['label-recordings']."\";\n";
foreach ($recordings as &$row) { foreach ($recordings as &$row) {
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') { if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
echo "opt_group.appendChild(new Option(\"".escape($row["recording_name"])."\", \"\${lua streamfile.lua ".escape($row["recording_filename"])."}\"));\n"; echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"\${lua streamfile.lua ".$row["recording_filename"]."}\"));\n";
} }
else { else {
echo "opt_group.appendChild(new Option(\"".escape($row["recording_name"])."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.escape($row["recording_filename"])."\"));\n"; echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row["recording_filename"]."\"));\n";
} }
} }
echo "obj_action.appendChild(opt_group);\n"; echo "obj_action.appendChild(opt_group);\n";
@ -419,7 +419,7 @@
echo "<tr>"; echo "<tr>";
echo "<td class='vncell' valign='top'>".$text['label-structure']."</td>"; echo "<td class='vncell' valign='top'>".$text['label-structure']."</td>";
echo "<td class='vtable' align='left'>"; echo "<td class='vtable' align='left'>";
echo " <table width='59%' border='0' cellpadding='0' cellspacing='0'>\n"; echo " <table border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td class='vtable'>".$text['label-function']."</td>\n"; echo " <td class='vtable'>".$text['label-function']."</td>\n";
echo " <td class='vtable'>".$text['label-action']."</td>\n"; echo " <td class='vtable'>".$text['label-action']."</td>\n";

View File

@ -221,25 +221,45 @@ $text['label-file_name']['ru-ru'] = "Имя файла";
$text['label-file_name']['sv-se'] = "Fil-namn"; $text['label-file_name']['sv-se'] = "Fil-namn";
$text['label-file_name']['uk-ua'] = "Назва файлу"; $text['label-file_name']['uk-ua'] = "Назва файлу";
$text['label-file-size']['en-us'] = "File Size"; $text['label-file_size']['en-us'] = "File Size";
$text['label-file-size']['ar-eg'] = ""; $text['label-file_size']['ar-eg'] = "";
$text['label-file-size']['de-at'] = "Dateigröße"; //copied from de-de $text['label-file_size']['de-at'] = "Dateigröße"; //copied from de-de
$text['label-file-size']['de-ch'] = "Dateigröße"; //copied from de-de $text['label-file_size']['de-ch'] = "Dateigröße"; //copied from de-de
$text['label-file-size']['de-de'] = "Dateigröße"; $text['label-file_size']['de-de'] = "Dateigröße";
$text['label-file-size']['es-cl'] = "Tamaño del archivo"; $text['label-file_size']['es-cl'] = "Tamaño del archivo";
$text['label-file-size']['es-mx'] = "Tamaño del archivo"; //copied from es-cl $text['label-file_size']['es-mx'] = "Tamaño del archivo"; //copied from es-cl
$text['label-file-size']['fr-ca'] = "Taille de Fichier"; //copied from fr-fr $text['label-file_size']['fr-ca'] = "Taille de Fichier"; //copied from fr-fr
$text['label-file-size']['fr-fr'] = "Taille de Fichier"; $text['label-file_size']['fr-fr'] = "Taille de Fichier";
$text['label-file-size']['he-il'] = ""; $text['label-file_size']['he-il'] = "";
$text['label-file-size']['it-it'] = "Dimensioni File"; $text['label-file_size']['it-it'] = "Dimensioni File";
$text['label-file-size']['nl-nl'] = ""; $text['label-file_size']['nl-nl'] = "";
$text['label-file-size']['pl-pl'] = "Rozmiar pliku"; $text['label-file_size']['pl-pl'] = "Rozmiar pliku";
$text['label-file-size']['pt-br'] = "Tamanho do arquivo"; $text['label-file_size']['pt-br'] = "Tamanho do arquivo";
$text['label-file-size']['pt-pt'] = "Tamanho do Ficheiro"; $text['label-file_size']['pt-pt'] = "Tamanho do Ficheiro";
$text['label-file-size']['ro-ro'] = ""; $text['label-file_size']['ro-ro'] = "";
$text['label-file-size']['ru-ru'] = "Размер файла"; $text['label-file_size']['ru-ru'] = "Размер файла";
$text['label-file-size']['sv-se'] = "Filstorlek"; $text['label-file_size']['sv-se'] = "Filstorlek";
$text['label-file-size']['uk-ua'] = "Розмір файлу"; $text['label-file_size']['uk-ua'] = "Розмір файлу";
$text['label-size']['en-us'] = "Size";
$text['label-size']['ar-eg'] = "";
$text['label-size']['de-at'] = "Dateigröße"; //copied from de-de
$text['label-size']['de-ch'] = "Dateigröße"; //copied from de-de
$text['label-size']['de-de'] = "Dateigröße";
$text['label-size']['es-cl'] = "Tamaño del archivo";
$text['label-size']['es-mx'] = "Tamaño del archivo"; //copied from es-cl
$text['label-size']['fr-ca'] = "Taille de Fichier"; //copied from fr-fr
$text['label-size']['fr-fr'] = "Taille de Fichier";
$text['label-size']['he-il'] = "";
$text['label-size']['it-it'] = "Dimensioni File";
$text['label-size']['nl-nl'] = "";
$text['label-size']['pl-pl'] = "Rozmiar pliku";
$text['label-size']['pt-br'] = "Tamanho do arquivo";
$text['label-size']['pt-pt'] = "Tamanho do Ficheiro";
$text['label-size']['ro-ro'] = "";
$text['label-size']['ru-ru'] = "Размер файла";
$text['label-size']['sv-se'] = "Filstorlek";
$text['label-size']['uk-ua'] = "Розмір файлу";
$text['label-file']['en-us'] = "Filename (Download)"; $text['label-file']['en-us'] = "Filename (Download)";
$text['label-file']['ar-eg'] = ""; $text['label-file']['ar-eg'] = "";

View File

@ -285,7 +285,13 @@
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
//get the recordings from the database //get the recordings from the database
$sql = str_replace('count(*)', 'recording_uuid, domain_uuid, recording_filename, recording_name, recording_description', $sql); if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
switch ($db_type) {
case 'pgsql': $sql_file_size = "length(decode(recording_base64,'base64')) as recording_size, "; break;
case 'mysql': $sql_file_size = "length(from_base64(recording_base64)) as recording_size, "; break;
}
}
$sql = str_replace('count(*)', 'recording_uuid, domain_uuid, recording_filename, '.$sql_file_size.' recording_name, recording_description', $sql);
$sql .= order_by($order_by, $order); $sql .= order_by($order_by, $order);
$sql .= limit_offset($rows_per_page, $offset); $sql .= limit_offset($rows_per_page, $offset);
$database = new database; $database = new database;
@ -298,7 +304,7 @@
$row_style["1"] = "row_style1"; $row_style["1"] = "row_style1";
//include the header //include the header
$document['title'] = $text['title']; $document['title'] = $text['title-recordings'];
require_once "resources/header.php"; require_once "resources/header.php";
//begin the content //begin the content
@ -323,12 +329,14 @@
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n"; echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo th_order_by('recording_name', $text['label-recording_name'], $order_by, $order); echo th_order_by('recording_name', $text['label-recording_name'], $order_by, $order);
if (permission_exists('recording_play') || permission_exists('recording_download')) {
echo "<th class='listhdr' nowrap style='text-align: center; padding: 0 30px 0 20px;'>".$text['label-tools']."</th>\n";
}
if ($_SESSION['recordings']['storage_type']['text'] != 'base64') { if ($_SESSION['recordings']['storage_type']['text'] != 'base64') {
echo th_order_by('recording_filename', $text['label-file_name'], $order_by, $order); echo th_order_by('recording_filename', $text['label-file_name'], $order_by, $order);
} }
echo "<th class='listhdr' nowrap>".$text['label-tools']."</th>\n"; echo "<th class='listhdr' style='text-align: center;' nowrap>".($_SESSION['recordings']['storage_type']['text'] == 'base64' ? $text['label-size'] : $text['label-file_size'])."</th>\n";
if ($_SESSION['recordings']['storage_type']['text'] != 'base64') { if ($_SESSION['recordings']['storage_type']['text'] != 'base64') {
echo "<th class='listhdr' style='text-align: center;' nowrap>".$text['label-file-size']."</th>\n";
echo "<th class='listhdr' style='text-align: center;'>".$text['label-uploaded']."</th>\n"; echo "<th class='listhdr' style='text-align: center;'>".$text['label-uploaded']."</th>\n";
} }
echo th_order_by('recording_description', $text['label-description'], $order_by, $order); echo th_order_by('recording_description', $text['label-description'], $order_by, $order);
@ -336,9 +344,8 @@
echo "</tr>\n"; echo "</tr>\n";
//calculate colspan for progress bar //calculate colspan for progress bar
$colspan = 6; //max $colspan = 4; //min
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') { $colspan = $colspan - 2; } if ($_SESSION['recordings']['storage_type']['text'] != 'base64') { $colspan += 2; }
if (!(permission_exists('recording_edit') || permission_exists('recording_delete'))) { $colspan = $colspan - 1; }
if (is_array($recordings) && @sizeof($recordings) != 0) { if (is_array($recordings) && @sizeof($recordings) != 0) {
foreach($recordings as $row) { foreach($recordings as $row) {
@ -349,11 +356,8 @@
$tr_link = (permission_exists('recording_edit')) ? "href='recording_edit.php?id=".escape($row['recording_uuid'])."'" : null; $tr_link = (permission_exists('recording_edit')) ? "href='recording_edit.php?id=".escape($row['recording_uuid'])."'" : null;
echo "<tr ".$tr_link.">\n"; echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['recording_name'])."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['recording_name'])."</td>\n";
if ($_SESSION['recordings']['storage_type']['text'] != 'base64') {
echo " <td valign='top' class='".$row_style[$c]."'>".str_replace('_', '_&#8203;', escape($row['recording_filename']))."</td>\n";
}
if (permission_exists('recording_play') || permission_exists('recording_download')) { if (permission_exists('recording_play') || permission_exists('recording_download')) {
echo " <td valign='top' class='".$row_style[$c]." row_style_slim tr_link_void' style='width: 55px;'>"; echo " <td valign='top' class='".$row_style[$c]." row_style_slim tr_link_void' style='text-align: center; padding: 2px 30px 0 20px;'>";
if (permission_exists('recording_play')) { if (permission_exists('recording_play')) {
$recording_file_path = $row['recording_filename']; $recording_file_path = $row['recording_filename'];
$recording_file_name = strtolower(pathinfo($recording_file_path, PATHINFO_BASENAME)); $recording_file_name = strtolower(pathinfo($recording_file_path, PATHINFO_BASENAME));
@ -372,6 +376,13 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_SESSION['recordings']['storage_type']['text'] != 'base64') { if ($_SESSION['recordings']['storage_type']['text'] != 'base64') {
echo " <td valign='top' class='".$row_style[$c]."'>".str_replace('_', '_&#8203;', escape($row['recording_filename']))."</td>\n";
}
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
$file_size = byte_convert($row['recording_size']);
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center; white-space: nowrap;'>".$file_size."</td>\n";
}
else {
$file_name = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename']; $file_name = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename'];
if (file_exists($file_name)) { if (file_exists($file_name)) {
$file_size = filesize($file_name); $file_size = filesize($file_name);
@ -379,11 +390,9 @@
$file_date = date("M d, Y H:i:s", filemtime($file_name)); $file_date = date("M d, Y H:i:s", filemtime($file_name));
} }
else { else {
$file_size = ''; unset($file_size, $file_date);
$file_date = '';
} }
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center; white-space: nowrap;'>".$file_size."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center; white-space: nowrap;'>".$file_size."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$file_date."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$file_date."</td>\n";
} }
echo " <td valign='top' class='row_stylebg' width='30%'>".escape($row['recording_description'])."&nbsp;</td>\n"; echo " <td valign='top' class='row_stylebg' width='30%'>".escape($row['recording_description'])."&nbsp;</td>\n";