diff --git a/resources/php/open.php b/resources/php/open.php index 8560229..8c33989 100644 --- a/resources/php/open.php +++ b/resources/php/open.php @@ -2,19 +2,20 @@ function openFile($FILE) { include 'config.php'; + $EXTNSN = strtolower(pathinfo($FILE, PATHINFO_EXTENSION)); - if (preg_match('(.mkv|.avi|.flv|.mov|.m4v|.mpg|.wmv|.mpeg)', strtolower($FILE)) === 1) { + if (preg_match('(mkv|avi|flv|mov|m4v|mpg|wmv|mpeg)', $EXTNSN) === 1) { shell_exec($MEDIAPLAYER . " \"" . $FILE . "\" &"); - } else if (preg_match('(.png|.jpg|.jpeg|.gif)', strtolower($FILE)) === 1) { + } else if (preg_match('(png|jpg|jpeg|gif)', $EXTNSN) === 1) { shell_exec($IMGVIEWER . ' "' . $FILE . '" &'); - } else if (preg_match('(.psf|.mp3|.ogg|.flac)', strtolower($FILE)) === 1) { + } else if (preg_match('(psf|mp3|ogg|flac)', $EXTNSN) === 1) { shell_exec($MUSICPLAYER . ' "' . $FILE . '" &'); - } else if (preg_match('(.txt)', strtolower($FILE)) === 1) { + } else if (preg_match('(txt)', $EXTNSN) === 1) { shell_exec($TEXTVIEWER . ' "' . $FILE . '" &'); - } else if (preg_match('(.pdf)', strtolower($FILE)) === 1) { + } else if (preg_match('(pdf)', $EXTNSN) === 1) { shell_exec($PDFVIEWER . ' "' . $FILE . '" &'); // Has to be below b/c pdf somehow regesters and an office app.... wtf.... - } else if (preg_match('(.odt|.doc|.docx|.rtf)', strtolower($FILE)) === 1) { +} else if (preg_match('(odt|doc|docx|rtf)', $EXTNSN) === 1) { shell_exec($OFFICEPROG . ' "' . $FILE . '" &'); } }