Added classAudioFile PHP library for WAV file format validation in Audio Store
git-svn-id: svn://192.168.202.10@3397 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -5549,12 +5549,13 @@ if ($SSscript_remove_js > 0)
|
||||
# 210317-1211 - Fixes for better consistency in password change process, Issue #1261
|
||||
# 210317-1736 - Added the ability to see orphan Remote Agent entries(with no valid User account)
|
||||
# 210317-2329 - Added system settings for agent_hidden_sound and added more browser_alert_sounds
|
||||
# 210321-0120 - Added classAudioFile PHP library
|
||||
#
|
||||
|
||||
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
|
||||
|
||||
$admin_version = '2.14-804a';
|
||||
$build = '210317-2329';
|
||||
$admin_version = '2.14-805a';
|
||||
$build = '210321-0120';
|
||||
|
||||
$STARTtime = date("U");
|
||||
$SQLdate = date("Y-m-d H:i:s");
|
||||
@@ -46766,6 +46767,14 @@ if ($ADD==999995)
|
||||
echo "<td align=right valign=top><B><font size=2>"._QXZ("Copyright").": </B></td><td align=left><font size=1> "._QXZ("The Chart.js javascript library was written by Chart.js Contributors").", © 2018</td></tr>\n";
|
||||
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top><B><font size=2>"._QXZ("License").": </B></td><td align=left><font size=1> "._QXZ("Chart.js is licensed under the")." <a href=\"https://github.com/chartjs/Chart.js/blob/master/LICENSE.md\" target=\"_blank\">MIT "._QXZ("open source license")."</a></td></tr>\n";
|
||||
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top nowrap><B><font size=2>"._QXZ("Source Code").": </B></td><td align=left><font size=1> "._QXZ("Chart.js original source code is available at")." <a href=\"https://github.com/chartjs/Chart.js\" target=\"_blank\">"._QXZ("this link")."</a>.</td></tr>\n";
|
||||
|
||||
echo "<tr><td colspan=3> </tr>";
|
||||
|
||||
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=middle rowspan=3 nowrap><B><font size=3>"._QXZ("classAudioFile").": </B></td>";
|
||||
echo "<td align=right valign=top><B><font size=2>"._QXZ("Copyright").": </B></td><td align=left><font size=1> "._QXZ("The classAudioFile PHP library was written by Michael Kamleitner").", © 2003</td></tr>\n";
|
||||
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top><B><font size=2>"._QXZ("License").": </B></td><td align=left><font size=1> "._QXZ("classAudioFile is licensed under the")." <a href=\"http://www.opensource.org/licenses/gpl-license.html\" target=\"_blank\">GPL "._QXZ("open source license")."</a></td></tr>\n";
|
||||
echo "<tr bgcolor=#$SSstd_row4_background><td align=right valign=top nowrap><B><font size=2>"._QXZ("Source Code").": </B></td><td align=left><font size=1> "._QXZ("classAudioFile original source code is available at")." <a href=\"https://www.phpclasses.org/audiofile\" target=\"_blank\">"._QXZ("this link")."</a>.</td></tr>\n";
|
||||
|
||||
echo "</TABLE></center>\n";
|
||||
}
|
||||
##### END copyright trademark license page #####
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# audio_store.php
|
||||
#
|
||||
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# Central Audio Storage script
|
||||
#
|
||||
@@ -31,10 +31,11 @@
|
||||
# 180508-0115 - Added new help display
|
||||
# 180618-2300 - Modified calls to audio file chooser function
|
||||
# 201002-1536 - Allowed for secure sounds_web_server setting
|
||||
# 210321-0131 - Added classAudioFile PHP library for WAV file format validation
|
||||
#
|
||||
|
||||
$version = '2.14-23';
|
||||
$build = '201002-1536';
|
||||
$version = '2.14-24';
|
||||
$build = '210321-0131';
|
||||
|
||||
$MT[0]='';
|
||||
|
||||
@@ -548,7 +549,38 @@ if ($action == "MANUALUPLOAD")
|
||||
copy($AF_path, "$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
|
||||
chmod("$WeBServeRRooT/$sounds_web_directory/$audiofile_name", 0766);
|
||||
|
||||
echo _QXZ("SUCCESS").": $audiofile_name "._QXZ("uploaded")." "._QXZ("size").":" . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "\n";
|
||||
echo "<BR>"._QXZ("SUCCESS").": $audiofile_name "._QXZ("uploaded")." "._QXZ("size").":" . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "<BR><BR>\n";
|
||||
|
||||
if (preg_match("/\.wav$/", $audiofile_name))
|
||||
{
|
||||
require ('classAudioFile.php');
|
||||
|
||||
$AF = new AudioFile;
|
||||
$AF->loadFile("$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
|
||||
|
||||
$wav_type = $AF->wave_type;
|
||||
$wav_compression = $AF->getCompression ($AF->wave_compression);
|
||||
$wav_channels = $AF->wave_channels;
|
||||
$wav_framerate = $AF->wave_framerate;
|
||||
$wav_bits=$AF->wave_bits;
|
||||
$invalid_wav=0;
|
||||
|
||||
if (!preg_match('/^wav/i',$wav_type)) {$invalid_wav++;}
|
||||
if (!preg_match('/^pcm/i',$wav_compression)) {$invalid_wav++;}
|
||||
if ($wav_channels > 1) {$invalid_wav++;}
|
||||
if ( ($wav_framerate > 8000) or ($wav_framerate < 8000) ) {$invalid_wav++;}
|
||||
if ( ($wav_bits > 16) or ($wav_bits < 16) ) {$invalid_wav++;}
|
||||
|
||||
if ($invalid_wav > 0)
|
||||
{
|
||||
echo " <BR><BR><font color=red>"._QXZ("INVALID WAV FILE FORMAT").": ($audiofile_name)</font><BR> </FONT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>$wav_type "._QXZ("channels").": $wav_channels "._QXZ("framerate").": $wav_framerate "._QXZ("bits").": $wav_bits "._QXZ("compression").": $wav_compression<BR><BR><BR>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo " </FONT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=1>"._QXZ("WAV FILE FORMAT VALIDATED").": $wav_type "._QXZ("channels").": $wav_channels "._QXZ("framerate").": $wav_framerate "._QXZ("bits").": $wav_bits "._QXZ("compression").": $wav_compression<BR><BR>\n";
|
||||
}
|
||||
echo "</FONT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=3>";
|
||||
}
|
||||
|
||||
$stmt="UPDATE servers SET sounds_update='Y';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
@@ -557,7 +589,7 @@ if ($action == "MANUALUPLOAD")
|
||||
$SQL_log = "$stmt|";
|
||||
$SQL_log = preg_replace('/;/', '', $SQL_log);
|
||||
$SQL_log = addslashes($SQL_log);
|
||||
$stmt="INSERT INTO vicidial_admin_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='AUDIOSTORE', event_type='LOAD', record_id='manualupload', event_code='$audiofile_name " . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "', event_sql=\"$SQL_log\", event_notes='$audiofile_name $AF_path $AF_orig';";
|
||||
$stmt="INSERT INTO vicidial_admin_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='AUDIOSTORE', event_type='LOAD', record_id='manualupload', event_code='$audiofile_name " . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "', event_sql=\"$SQL_log\", event_notes='$audiofile_name $AF_path $AF_orig Invalid: $invalid_wav $wav_type "._QXZ("channels").": $wav_channels "._QXZ("framerate").": $wav_framerate "._QXZ("bits").": $wav_bits "._QXZ("compression").": $wav_compression';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
# version: 20210319035001
|
||||
# version: 20210321012401
|
||||
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
|
||||
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
|
||||
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
|
||||
@@ -790,7 +790,7 @@ shifts-shift_length Shift Length <QXZ>This is the time in Hours and Minutes that
|
||||
shifts-shift_weekdays Shift Weekdays <QXZ>In this section you should choose the days of the week that this shift is active.</QXZ>
|
||||
shifts-report_option Report Option <QXZ>This option allows this specific shift to show up in selected reports that support this option.</QXZ>
|
||||
shifts-report_rank Report Rank <QXZ>This option allows you to rank shifts in selected reports that support this option.</QXZ>
|
||||
audio_store Audio Store <QXZ>This utility allows you to upload audio files to the web server so that they can be distributed to all of the system servers in a multi-server cluster. An important note, only two audio file types will work, .wav files that are PCM Mono 16bit 8k and .gsm files that are 8bit 8k. Please verify that your files are properly formatted before uploading them here.</QXZ>
|
||||
audio_store Audio Store <QXZ>This utility allows you to upload audio files to the web server so that they can be distributed to all of the system servers in a multi-server cluster. An important note, only two audio file types will work: <BR>.wav files that are PCM Mono 16bit 8k<BR> (for example: 1 channel, 8000 framerate, 16 bits, pcm uncompressed)<BR> and .gsm files that are 8bit 8k. <BR>Please verify that your files are properly formatted before uploading them here. After you have uploaded a .wav file, this page will attempt to validate the format of the file. If you see a red warning message, please re-format your audio file and upload it again. Uploading a file of the same filename will replace the older version of the same file on the audio store.</QXZ>
|
||||
music_on_hold-moh_id Music On Hold ID <QXZ>This is the short name of a Music On Hold entry. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 100 characters, minimum of 2 characters.</QXZ>
|
||||
music_on_hold-moh_name Music On Hold Name <QXZ>This is a more descriptive name of the Music On Hold entry. This is a short summary of the Music On Hold context and will show as a comment in the musiconhold conf file. max 255 characters, minimum of 2 characters.</QXZ>
|
||||
music_on_hold-active Active <QXZ>This option allows you to set the Music On Hold entry to active or inactive. Inactive will remove the entry from the conf files.</QXZ>
|
||||
|
||||
Reference in New Issue
Block a user