From 84329fb6ff1e06e02be2b2f21a09a28216c3409b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 9 Dec 2013 05:36:26 -0800 Subject: [PATCH] check that uploads are WebM files --- posthandler.php | 1 + videodata.php | 1 + 2 files changed, 2 insertions(+) diff --git a/posthandler.php b/posthandler.php index f2f60291..639254e1 100644 --- a/posthandler.php +++ b/posthandler.php @@ -6,6 +6,7 @@ function postHandler($post) { if ($post->has_file && $post->extension == 'webm') { require_once dirname(__FILE__) . '/videodata.php'; $videoDetails = videoData($post->file_path); + if (!isset($videoDetails['container']) || $videoDetails['container'] != 'webm') return "not a WebM file"; // Set thumbnail $thumbName = $board['dir'] . $config['dir']['thumb'] . $post->file_id . '.webm'; diff --git a/videodata.php b/videodata.php index 1b1e7eb6..9bf26396 100644 --- a/videodata.php +++ b/videodata.php @@ -107,6 +107,7 @@ function videoData($filename) { try { $root = readMatroska($fileHandle); + $data['container'] = $root->get('EBML')->get('DocType'); // Locate segment information and tracks $segment = $root->get('Segment');