From 75f9010806c19faeb88f06b10d48aba3918a4d17 Mon Sep 17 00:00:00 2001 From: Sascha Brendel Date: Wed, 19 Oct 2016 00:24:53 +0200 Subject: [PATCH] Improved and signed code. --- Dockerfile | 4 ++-- html/video/AtomicParsleyFile.php | 16 ++++------------ tests/AtomicParsleyFileTest.php | 4 +--- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f1f1aa..f88f220 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN hg clone https://bitbucket.org/wez/atomicparsley \ && ./autogen.sh \ && ./configure \ && make \ - && make install + && make install # Download and install phpunit RUN wget https://phar.phpunit.de/phpunit.phar \ @@ -43,4 +43,4 @@ RUN composer install WORKDIR /var/www/html EXPOSE 80 -CMD ["apache2-foreground"] \ No newline at end of file +CMD ["apache2-foreground"] diff --git a/html/video/AtomicParsleyFile.php b/html/video/AtomicParsleyFile.php index e5cd5bf..7de75cb 100644 --- a/html/video/AtomicParsleyFile.php +++ b/html/video/AtomicParsleyFile.php @@ -39,7 +39,6 @@ class AtomicParsleyFile /** * AtomicParsleyFile constructor. - * */ public function __construct($loadFileFromPath = null) { @@ -87,7 +86,7 @@ public function readMetadata() { $this->setGenre(substr($entry, 23)); else if(strpos($entry, 'Atom "©cmt"') !== false) $this->setComment(substr($entry, 23)); - else if(strpos($entry, 'Atom "©day"') !== false) + else if(strpos($entry, 'Atom "©day"') !== false) $this->setYear(substr($entry, 23)); else if(strpos($entry, 'Atom "©lyr"') !== false) $this->setLyrics(substr($entry, 23)); @@ -145,22 +144,17 @@ public function save() { if(($success !== false) && filesize($this->getFullFilepath()) > 100){ foreach ($this->getMetadataBag() as $key => $value) { - $oldFilepath = $this->getFullFilepath(); - $this->filename = md5(microtime()) . ".mp4"; $success = exec("AtomicParsley " . - $oldFilepath . + $this->getFullFilepath() . $key . " " . $value . - // $key . " \"$(cat " . $dummyValueFilepath . ")\"". - " -o " . $this->getFullFilepath() + " --overWrite " ); - if ($success === false) + if ($success === false) return false; } return true; } - - return false; } @@ -323,8 +317,6 @@ public function isShort() { return $this->short; } - - /** * Gets the value of filename. * diff --git a/tests/AtomicParsleyFileTest.php b/tests/AtomicParsleyFileTest.php index 22ddd2b..58db31b 100644 --- a/tests/AtomicParsleyFileTest.php +++ b/tests/AtomicParsleyFileTest.php @@ -122,9 +122,7 @@ public function the_user_can_enter_special_char_in_album_field() /** @test */ public function the_user_can_enter_much_text_in_longdesc_field() { - $content = iconv('UTF-16', 'UTF-16', file_get_contents('/var/www/attacker/web/video/xss.txt')); - - + $content = iconv('UTF-16', 'UTF-16', file_get_contents('/var/www/html/video/xss.txt')); $file = new AtomicParsleyFile(); $file->setLongdesc($content);