From b6a1885167c40e67f13f86c4a61216e83c04adcb Mon Sep 17 00:00:00 2001 From: digital-gnome <31593470+digital-gnome@users.noreply.github.com> Date: Sat, 18 Nov 2017 19:02:56 -0500 Subject: [PATCH 1/9] fix generated video download (#2002) Fixes out of memory php error when downloading large generated video files --- web/skins/classic/views/video.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index cfbb6f929..6a20ed319 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -101,6 +101,9 @@ if ( isset($_REQUEST['downloadIndex']) ) header( "Content-Transfer-Encoding: binary" ); header( "Content-Type: application/force-download" ); header( "Content-Length: ".filesize($videoFiles[$downloadIndex]) ); + while ( ob_get_level() > 0 ) { + ob_end_clean(); + } readfile( $videoFiles[$downloadIndex] ); exit; } From 50a63c7899074355daeb322466184d027afa4ff5 Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 11:31:39 +0330 Subject: [PATCH 2/9] Create DCS3415.pm D-Link DCS-3415 IP Control Protocol --- .../lib/ZoneMinder/Control/DCS3415.pm | 195 ++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm new file mode 100644 index 000000000..2db704320 --- /dev/null +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/DCS3415.pm @@ -0,0 +1,195 @@ +# ========================================================================== +# +# ZoneMinder D-Link DCS-3415 IP Control Protocol Module, 2018-03-04, 0.1 +# Copyright (C) 2015-2018 Habib Kamei +# +# Modified for use with D-Link DCS-3415 IP Camera by Habib Kamei +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# ========================================================================== +# +# This module contains the implementation of the D-Link DCS-3415 device control protocol +# +#=========================================================================== + +package ZoneMinder::Control::DCS3415; + +use 5.006; +use strict; +use warnings; + +require ZoneMinder::Base; +require ZoneMinder::Control; + +our @ISA = qw(ZoneMinder::Control); + +# ========================================================================== +# +# D-Link DCS-3415 Control Protocol +# +# On ControlAddress use the format : +# USERNAME:PASSWORD@ADDRESS:PORT +# eg : admin:@10.1.2.1:80 +# zoneuser:zonepass@192.168.0.20:40000 +# +# ========================================================================== + +use ZoneMinder::Logger qw(:all); +use ZoneMinder::Config qw(:all); + +use Time::HiRes qw( usleep ); + +sub new +{ + my $class = shift; + my $id = shift; + my $self = ZoneMinder::Control->new( $id ); + bless( $self, $class ); + srand( time() ); + return $self; +} + +our $AUTOLOAD; + +sub AUTOLOAD +{ + my $self = shift; + my $class = ref( ) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( exists($self->{$name}) ) + { + return( $self->{$name} ); + } + Fatal( "Can't access $name member of object of class $class" ); +} + +sub open +{ + my $self = shift; + + $self->loadMonitor(); + + use LWP::UserAgent; + $self->{ua} = LWP::UserAgent->new; + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); + + $self->{state} = 'open'; +} + +sub close +{ + my $self = shift; + $self->{state} = 'closed'; +} + +sub printMsg +{ + my $self = shift; + my $msg = shift; + my $msg_len = length($msg); + + Debug( $msg."[".$msg_len."]" ); +} + +sub sendCmd +{ + my $self = shift; + my $cmd = shift; + my $result = undef; + printMsg( $cmd, "Tx" ); + + my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/cgi-bin/viewer/$cmd" ); + my $res = $self->{ua}->request($req); + + + if ( $res->is_success ) + { + $result = !undef; + } + else + { + Error( "Error check failed:'".$res->status_line()."'" ); + } + + return( $result ); +} + +#Zoom In +sub Tele +{ + my $self = shift; + Debug( "Zoom Tele" ); + my $cmd = "camctrl.cgi?channel=0&camid=1&zoom=tele"; + $self->sendCmd( $cmd ); +} + +#Zoom Out +sub Wide +{ + my $self = shift; + Debug( "Zoom Wide" ); + my $cmd = "camctrl.cgi?channel=0&camid=1&zoom=wide"; + $self->sendCmd( $cmd ); +} + +#Focus Near +sub Near +{ + my $self = shift; + Debug( "Focus Near" ); + my $cmd = "camctrl.cgi?channel=0&camid=1&focus=near"; + $self->sendCmd( $cmd ); +} + +#Focus Far +sub Far +{ + my $self = shift; + Debug( "Focus Far" ); + my $cmd = "camctrl.cgi?channel=0&camid=1&focus=far"; + $self->sendCmd( $cmd ); +} + +1; +__END__ +# Below is stub documentation for your module. You'd better edit it! +=head1 NAME +ZoneMinder::Database - Perl extension for blah blah blah +=head1 SYNOPSIS + use ZoneMinder::Database; + blah blah blah +=head1 DESCRIPTION +Stub documentation for ZoneMinder, created by h2xs. It looks like the +author of the extension was negligent enough to leave the stub +unedited. +Blah blah blah. +=head2 EXPORT +None by default. +=head1 SEE ALSO +Mention other useful documentation such as the documentation of +related modules or operating system documentation (such as man pages +in UNIX), or any relevant external documentation such as RFCs or +standards. +If you have a mailing list set up for your module, mention it here. +If you have a web site set up for your module, mention it here. +=head1 AUTHOR +Philip Coombes, Ephilip.coombes@zoneminder.comE +=head1 COPYRIGHT AND LICENSE +Copyright (C) 2001-2008 Philip Coombes +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.8.3 or, +at your option, any later version of Perl 5 you may have available. +=cut From afff20a06bd1ab99c537ce9512431192d98bc3b2 Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 19:48:01 +0330 Subject: [PATCH 3/9] Update video.php --- web/skins/classic/views/video.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index 6a20ed319..cfbb6f929 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -101,9 +101,6 @@ if ( isset($_REQUEST['downloadIndex']) ) header( "Content-Transfer-Encoding: binary" ); header( "Content-Type: application/force-download" ); header( "Content-Length: ".filesize($videoFiles[$downloadIndex]) ); - while ( ob_get_level() > 0 ) { - ob_end_clean(); - } readfile( $videoFiles[$downloadIndex] ); exit; } From 661827a7b42a212f05a2c36f6b93b5b3a9a224f0 Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 19:52:01 +0330 Subject: [PATCH 4/9] Update video.php --- web/skins/classic/views/video.php | 199 ++++++++++++------------------ 1 file changed, 80 insertions(+), 119 deletions(-) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index cfbb6f929..be198177c 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -17,96 +17,74 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // - -if ( !canView( 'Events' ) ) -{ - $view = "error"; - return; +if ( !canView( 'Events' ) ) { + $view = "error"; + return; } - +require_once('includes/Event.php'); $eid = validInt($_REQUEST['eid']); - $sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'; $sql_values = array( $eid ); - if ( $user['MonitorIds'] ) { - $monitor_ids = explode( ',', $user['MonitorIds'] ); - $sql .= ' AND MonitorId IN (' .implode( ',', array_fill(0,count($monitor_ids),'?') ) . ')'; - $sql_values = array_merge( $sql_values, $monitor_ids ); + $monitor_ids = explode( ',', $user['MonitorIds'] ); + $sql .= ' AND MonitorId IN (' .implode( ',', array_fill(0,count($monitor_ids),'?') ) . ')'; + $sql_values = array_merge( $sql_values, $monitor_ids ); } $event = dbFetchOne( $sql, NULL, $sql_values ); - if ( isset( $_REQUEST['rate'] ) ) - $rate = validInt($_REQUEST['rate']); + $rate = validInt($_REQUEST['rate']); else - $rate = reScale( RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE ); + $rate = reScale( RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE ); if ( isset( $_REQUEST['scale'] ) ) - $scale = validInt($_REQUEST['scale']); + $scale = validInt($_REQUEST['scale']); else - $scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); - -$eventPath = ZM_DIR_EVENTS.'/'.getEventPath( $event ); - + $scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); +$Event = new Event( $event['Id'] ); +$eventPath = $Event->Path(); $videoFormats = array(); $ffmpegFormats = preg_split( '/\s+/', ZM_FFMPEG_FORMATS ); -foreach ( $ffmpegFormats as $ffmpegFormat ) -{ - if ( preg_match( '/^([^*]+)(\*\*?)$/', $ffmpegFormat, $matches ) ) - { - $videoFormats[$matches[1]] = $matches[1]; - if ( !isset($videoFormat) && $matches[2] == "*" ) - { - $videoFormat = $matches[1]; - } - } - else - { - $videoFormats[$ffmpegFormat] = $ffmpegFormat; +foreach ( $ffmpegFormats as $ffmpegFormat ) { + if ( preg_match( '/^([^*]+)(\*\*?)$/', $ffmpegFormat, $matches ) ) { + $videoFormats[$matches[1]] = $matches[1]; + if ( !isset($videoFormat) && $matches[2] == '*' ) { + $videoFormat = $matches[1]; } + } else { + $videoFormats[$ffmpegFormat] = $ffmpegFormat; + } } - $videoFiles = array(); -if ( $dir = opendir( $eventPath ) ) -{ - while ( ($file = readdir( $dir )) !== false ) - { - $file = $eventPath.'/'.$file; - if ( is_file( $file ) ) - { - if ( preg_match( '/\.(?:'.join( '|', $videoFormats ).')$/', $file ) ) - { - $videoFiles[] = $file; - } - } +if ( $dir = opendir( $eventPath ) ) { + while ( ($file = readdir( $dir )) !== false ) { + $file = $eventPath.'/'.$file; + if ( is_file( $file ) ) { + if ( preg_match( '/\.(?:'.join( '|', $videoFormats ).')$/', $file ) ) { + $videoFiles[] = $file; + } } - closedir( $dir ); + } + closedir( $dir ); } - -if ( isset($_REQUEST['deleteIndex']) ) -{ - $deleteIndex = validInt($_REQUEST['deleteIndex']); - unlink( $videoFiles[$deleteIndex] ); - unset( $videoFiles[$deleteIndex] ); +if ( isset($_REQUEST['deleteIndex']) ) { + $deleteIndex = validInt($_REQUEST['deleteIndex']); + unlink( $videoFiles[$deleteIndex] ); + unset( $videoFiles[$deleteIndex] ); } - -if ( isset($_REQUEST['downloadIndex']) ) -{ - $downloadIndex = validInt($_REQUEST['downloadIndex']); - header( "Pragma: public" ); - header( "Expires: 0" ); - header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); - header( "Cache-Control: private", false ); // required by certain browsers - header( "Content-Description: File Transfer" ); - header( 'Content-disposition: attachment; filename="'.basename($videoFiles[$downloadIndex]).'"' ); // basename is required because the video index contains the path and firefox doesn't strip the path but simply replaces the slashes with an underscore. - header( "Content-Transfer-Encoding: binary" ); - header( "Content-Type: application/force-download" ); - header( "Content-Length: ".filesize($videoFiles[$downloadIndex]) ); - readfile( $videoFiles[$downloadIndex] ); - exit; +if ( isset($_REQUEST['downloadIndex']) ) { + $downloadIndex = validInt($_REQUEST['downloadIndex']); + header( "Pragma: public" ); + header( "Expires: 0" ); + header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); + header( "Cache-Control: private", false ); // required by certain browsers + header( "Content-Description: File Transfer" ); + header( 'Content-disposition: attachment; filename="'.basename($videoFiles[$downloadIndex]).'"' ); // basename is required because the video index contains the path and firefox doesn't strip the path but simply replaces the slashes with an underscore. + header( "Content-Transfer-Encoding: binary" ); + header( "Content-Type: application/force-download" ); + header( "Content-Length: ".filesize($videoFiles[$downloadIndex]) ); + readfile( $videoFiles[$downloadIndex] ); + exit; } - $focusWindow = true; - xhtmlHeaders(__FILE__, translate('Video') ); ?> @@ -119,19 +97,16 @@ xhtmlHeaders(__FILE__, translate('Video') );

@@ -158,29 +133,23 @@ else disabled="disabled"/>

@@ -194,32 +163,24 @@ else 0 ) - { - preg_match( '/^(.+)-((?:r[_\d]+)|(?:F[_\d]+))-((?:s[_\d]+)|(?:S[0-9a-z]+))\.([^.]+)$/', $file, $matches ); - if ( preg_match( '/^r(.+)$/', $matches[2], $temp_matches ) ) - { - $rate = (int)(100 * preg_replace( '/_/', '.', $temp_matches[1] ) ); - $rateText = isset($rates[$rate])?$rates[$rate]:($rate."x"); - } - elseif ( preg_match( '/^F(.+)$/', $matches[2], $temp_matches ) ) - { - $rateText = $temp_matches[1]."fps"; - } - if ( preg_match( '/^s(.+)$/', $matches[3], $temp_matches ) ) - { - $scale = (int)(100 * preg_replace( '/_/', '.', $temp_matches[1] ) ); - $scaleText = isset($scales[$scale])?$scales[$scale]:($scale."x"); - } - elseif ( preg_match( '/^S(.+)$/', $matches[3], $temp_matches ) ) - { - $scaleText = $temp_matches[1]; - } - $width = $scale?reScale( $event['Width'], $scale ):$event['Width']; - $height = $scale?reScale( $event['Height'], $scale ):$event['Height']; + $index = 0; + foreach ( $videoFiles as $file ) { + if ( filesize( $file ) > 0 ) { + preg_match( '/^(.+)-((?:r[_\d]+)|(?:F[_\d]+))-((?:s[_\d]+)|(?:S[0-9a-z]+))\.([^.]+)$/', $file, $matches ); + if ( preg_match( '/^r(.+)$/', $matches[2], $temp_matches ) ) { + $rate = (int)(100 * preg_replace( '/_/', '.', $temp_matches[1] ) ); + $rateText = isset($rates[$rate])?$rates[$rate]:($rate."x"); + } elseif ( preg_match( '/^F(.+)$/', $matches[2], $temp_matches ) ) { + $rateText = $temp_matches[1]."fps"; + } + if ( preg_match( '/^s(.+)$/', $matches[3], $temp_matches ) ) { + $scale = (int)(100 * preg_replace( '/_/', '.', $temp_matches[1] ) ); + $scaleText = isset($scales[$scale])?$scales[$scale]:($scale."x"); + } elseif ( preg_match( '/^S(.+)$/', $matches[3], $temp_matches ) ) { + $scaleText = $temp_matches[1]; + } + $width = $scale?reScale( $event['Width'], $scale ):$event['Width']; + $height = $scale?reScale( $event['Height'], $scale ):$event['Height']; ?> @@ -229,14 +190,14 @@ else
 /  / 
From 7a589398a78bbe212e7a3067b8decd6c58278c6f Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 19:53:26 +0330 Subject: [PATCH 5/9] Update video.php --- web/skins/classic/views/video.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index be198177c..dca6feafc 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -183,7 +183,7 @@ if ( isset($_REQUEST['showIndex']) ) { $height = $scale?reScale( $event['Height'], $scale ):$event['Height']; ?> - + From 8a6b57c1a0ccaabbc4965ca8afda4ca55f8f1906 Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 19:54:24 +0330 Subject: [PATCH 6/9] Update video.php --- web/skins/classic/views/video.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index dca6feafc..be198177c 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -183,7 +183,7 @@ if ( isset($_REQUEST['showIndex']) ) { $height = $scale?reScale( $event['Height'], $scale ):$event['Height']; ?> - + From aa2134bde46dd2daf042bf3c4782e6e5d1fb7c9c Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 19:59:06 +0330 Subject: [PATCH 7/9] Update zm_create.sql.in --- db/zm_create.sql.in | 1 + 1 file changed, 1 insertion(+) diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index 138b08313..cca1d333b 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -596,6 +596,7 @@ INSERT INTO `Controls` VALUES (NULL,'Vivotek ePTZ','Remote','Vivotek_ePTZ',0,0,1 INSERT INTO `Controls` VALUES (NULL,'Netcat ONVIF','Ffmpeg','Netcat',0,0,1,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,100,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,100,5,5,0,0,0,1,255,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); INSERT INTO `Controls` VALUES (NULL,'Keekoon','Remote','Keekoon', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); INSERT INTO `Controls` VALUES (NULL,'HikVision','Local','',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,20,1,1,1,1,0,0,0,1,1,0,0,0,0,1,1,100,0,0,1,0,0,0,0,1,1,100,1,0,0,0); +INSERT INTO `Controls` VALUES (NULL,'D-LINK DCS-3415','Remote','DCS3415',0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); -- -- Add some monitor preset values From 497114e8e18be61f472c87c1f75490ae7b87385b Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 20:11:02 +0330 Subject: [PATCH 8/9] Update video.php --- web/skins/classic/views/video.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index be198177c..75cc8c8ed 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -17,20 +17,26 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // + if ( !canView( 'Events' ) ) { $view = "error"; return; } + require_once('includes/Event.php'); + $eid = validInt($_REQUEST['eid']); + $sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'; $sql_values = array( $eid ); + if ( $user['MonitorIds'] ) { $monitor_ids = explode( ',', $user['MonitorIds'] ); $sql .= ' AND MonitorId IN (' .implode( ',', array_fill(0,count($monitor_ids),'?') ) . ')'; $sql_values = array_merge( $sql_values, $monitor_ids ); } $event = dbFetchOne( $sql, NULL, $sql_values ); + if ( isset( $_REQUEST['rate'] ) ) $rate = validInt($_REQUEST['rate']); else @@ -39,8 +45,10 @@ if ( isset( $_REQUEST['scale'] ) ) $scale = validInt($_REQUEST['scale']); else $scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); + $Event = new Event( $event['Id'] ); $eventPath = $Event->Path(); + $videoFormats = array(); $ffmpegFormats = preg_split( '/\s+/', ZM_FFMPEG_FORMATS ); foreach ( $ffmpegFormats as $ffmpegFormat ) { @@ -53,6 +61,7 @@ foreach ( $ffmpegFormats as $ffmpegFormat ) { $videoFormats[$ffmpegFormat] = $ffmpegFormat; } } + $videoFiles = array(); if ( $dir = opendir( $eventPath ) ) { while ( ($file = readdir( $dir )) !== false ) { @@ -65,11 +74,13 @@ if ( $dir = opendir( $eventPath ) ) { } closedir( $dir ); } + if ( isset($_REQUEST['deleteIndex']) ) { $deleteIndex = validInt($_REQUEST['deleteIndex']); unlink( $videoFiles[$deleteIndex] ); unset( $videoFiles[$deleteIndex] ); } + if ( isset($_REQUEST['downloadIndex']) ) { $downloadIndex = validInt($_REQUEST['downloadIndex']); header( "Pragma: public" ); @@ -84,7 +95,9 @@ if ( isset($_REQUEST['downloadIndex']) ) { readfile( $videoFiles[$downloadIndex] ); exit; } + $focusWindow = true; + xhtmlHeaders(__FILE__, translate('Video') ); ?> From 80116aa44c8751fb8f80015c607adb10abfb7197 Mon Sep 17 00:00:00 2001 From: habibapp1365 Date: Tue, 6 Mar 2018 20:12:47 +0330 Subject: [PATCH 9/9] Update video.php --- web/skins/classic/views/video.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index 75cc8c8ed..be198177c 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -17,26 +17,20 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // - if ( !canView( 'Events' ) ) { $view = "error"; return; } - require_once('includes/Event.php'); - $eid = validInt($_REQUEST['eid']); - $sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'; $sql_values = array( $eid ); - if ( $user['MonitorIds'] ) { $monitor_ids = explode( ',', $user['MonitorIds'] ); $sql .= ' AND MonitorId IN (' .implode( ',', array_fill(0,count($monitor_ids),'?') ) . ')'; $sql_values = array_merge( $sql_values, $monitor_ids ); } $event = dbFetchOne( $sql, NULL, $sql_values ); - if ( isset( $_REQUEST['rate'] ) ) $rate = validInt($_REQUEST['rate']); else @@ -45,10 +39,8 @@ if ( isset( $_REQUEST['scale'] ) ) $scale = validInt($_REQUEST['scale']); else $scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); - $Event = new Event( $event['Id'] ); $eventPath = $Event->Path(); - $videoFormats = array(); $ffmpegFormats = preg_split( '/\s+/', ZM_FFMPEG_FORMATS ); foreach ( $ffmpegFormats as $ffmpegFormat ) { @@ -61,7 +53,6 @@ foreach ( $ffmpegFormats as $ffmpegFormat ) { $videoFormats[$ffmpegFormat] = $ffmpegFormat; } } - $videoFiles = array(); if ( $dir = opendir( $eventPath ) ) { while ( ($file = readdir( $dir )) !== false ) { @@ -74,13 +65,11 @@ if ( $dir = opendir( $eventPath ) ) { } closedir( $dir ); } - if ( isset($_REQUEST['deleteIndex']) ) { $deleteIndex = validInt($_REQUEST['deleteIndex']); unlink( $videoFiles[$deleteIndex] ); unset( $videoFiles[$deleteIndex] ); } - if ( isset($_REQUEST['downloadIndex']) ) { $downloadIndex = validInt($_REQUEST['downloadIndex']); header( "Pragma: public" ); @@ -95,9 +84,7 @@ if ( isset($_REQUEST['downloadIndex']) ) { readfile( $videoFiles[$downloadIndex] ); exit; } - $focusWindow = true; - xhtmlHeaders(__FILE__, translate('Video') ); ?>