Update video.php
This commit is contained in:
parent
aa2134bde4
commit
497114e8e1
|
@ -17,20 +17,26 @@
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( !canView( 'Events' ) ) {
|
if ( !canView( 'Events' ) ) {
|
||||||
$view = "error";
|
$view = "error";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('includes/Event.php');
|
require_once('includes/Event.php');
|
||||||
|
|
||||||
$eid = validInt($_REQUEST['eid']);
|
$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 = '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 );
|
$sql_values = array( $eid );
|
||||||
|
|
||||||
if ( $user['MonitorIds'] ) {
|
if ( $user['MonitorIds'] ) {
|
||||||
$monitor_ids = explode( ',', $user['MonitorIds'] );
|
$monitor_ids = explode( ',', $user['MonitorIds'] );
|
||||||
$sql .= ' AND MonitorId IN (' .implode( ',', array_fill(0,count($monitor_ids),'?') ) . ')';
|
$sql .= ' AND MonitorId IN (' .implode( ',', array_fill(0,count($monitor_ids),'?') ) . ')';
|
||||||
$sql_values = array_merge( $sql_values, $monitor_ids );
|
$sql_values = array_merge( $sql_values, $monitor_ids );
|
||||||
}
|
}
|
||||||
$event = dbFetchOne( $sql, NULL, $sql_values );
|
$event = dbFetchOne( $sql, NULL, $sql_values );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['rate'] ) )
|
if ( isset( $_REQUEST['rate'] ) )
|
||||||
$rate = validInt($_REQUEST['rate']);
|
$rate = validInt($_REQUEST['rate']);
|
||||||
else
|
else
|
||||||
|
@ -39,8 +45,10 @@ if ( isset( $_REQUEST['scale'] ) )
|
||||||
$scale = validInt($_REQUEST['scale']);
|
$scale = validInt($_REQUEST['scale']);
|
||||||
else
|
else
|
||||||
$scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
$scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
||||||
|
|
||||||
$Event = new Event( $event['Id'] );
|
$Event = new Event( $event['Id'] );
|
||||||
$eventPath = $Event->Path();
|
$eventPath = $Event->Path();
|
||||||
|
|
||||||
$videoFormats = array();
|
$videoFormats = array();
|
||||||
$ffmpegFormats = preg_split( '/\s+/', ZM_FFMPEG_FORMATS );
|
$ffmpegFormats = preg_split( '/\s+/', ZM_FFMPEG_FORMATS );
|
||||||
foreach ( $ffmpegFormats as $ffmpegFormat ) {
|
foreach ( $ffmpegFormats as $ffmpegFormat ) {
|
||||||
|
@ -53,6 +61,7 @@ foreach ( $ffmpegFormats as $ffmpegFormat ) {
|
||||||
$videoFormats[$ffmpegFormat] = $ffmpegFormat;
|
$videoFormats[$ffmpegFormat] = $ffmpegFormat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$videoFiles = array();
|
$videoFiles = array();
|
||||||
if ( $dir = opendir( $eventPath ) ) {
|
if ( $dir = opendir( $eventPath ) ) {
|
||||||
while ( ($file = readdir( $dir )) !== false ) {
|
while ( ($file = readdir( $dir )) !== false ) {
|
||||||
|
@ -65,11 +74,13 @@ if ( $dir = opendir( $eventPath ) ) {
|
||||||
}
|
}
|
||||||
closedir( $dir );
|
closedir( $dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($_REQUEST['deleteIndex']) ) {
|
if ( isset($_REQUEST['deleteIndex']) ) {
|
||||||
$deleteIndex = validInt($_REQUEST['deleteIndex']);
|
$deleteIndex = validInt($_REQUEST['deleteIndex']);
|
||||||
unlink( $videoFiles[$deleteIndex] );
|
unlink( $videoFiles[$deleteIndex] );
|
||||||
unset( $videoFiles[$deleteIndex] );
|
unset( $videoFiles[$deleteIndex] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($_REQUEST['downloadIndex']) ) {
|
if ( isset($_REQUEST['downloadIndex']) ) {
|
||||||
$downloadIndex = validInt($_REQUEST['downloadIndex']);
|
$downloadIndex = validInt($_REQUEST['downloadIndex']);
|
||||||
header( "Pragma: public" );
|
header( "Pragma: public" );
|
||||||
|
@ -84,7 +95,9 @@ if ( isset($_REQUEST['downloadIndex']) ) {
|
||||||
readfile( $videoFiles[$downloadIndex] );
|
readfile( $videoFiles[$downloadIndex] );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$focusWindow = true;
|
$focusWindow = true;
|
||||||
|
|
||||||
xhtmlHeaders(__FILE__, translate('Video') );
|
xhtmlHeaders(__FILE__, translate('Video') );
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue