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; } } $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; } } } 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'); 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')); ?>