From edb84ae6b4b2ef646e2604d6566932246daf53b1 Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Wed, 21 Aug 2013 09:13:22 +0200 Subject: [PATCH] [fix] bad path when adding video or import dir --- bin/cronTask.sh.sample | 2 +- index.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/cronTask.sh.sample b/bin/cronTask.sh.sample index 9d92fa1..3b59ccf 100644 --- a/bin/cronTask.sh.sample +++ b/bin/cronTask.sh.sample @@ -26,7 +26,7 @@ do then rm $file sleep 1 - mv $urlHash* $finalDest$destination + mv $urlHash* $destination fi done < $file fi diff --git a/index.php b/index.php index 77a74b9..23741e3 100644 --- a/index.php +++ b/index.php @@ -239,7 +239,7 @@ function importDir($bc, $fullListDir, $fullListFile) { 'uploadDateSort' => $value['uploadDateSort'] ); $url = escapeshellcmd($value['url']); - $data = $key.' '.$url.' '.$_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['VIDEODIR'].'/'.$path.$file['hash']."\n"; + $data = $key.' '.$url.' '.$_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['VIDEODIR'].'/'.$path.$file['hash'].'/'."\n"; file_put_contents($GLOBALS['config']['TMPDIR'].'/'.$key.'.hash', $data); } file_put_contents($GLOBALS['config']['LISTFILE'], ""); @@ -285,9 +285,9 @@ function n_print($data, $name = '') {
'; echo ' - ', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], ' + ', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], ' '; - echo '
',                   htmlentities(print_r($data, 1)), '
'; + echo '
',                    htmlentities(print_r($data, 1)), '
'; echo '

'; @@ -352,7 +352,11 @@ function removeDir($dir, $fullListDir) { function addVideo($ci, $fullListFile) { $nameHash = substr(sha1($ci['name'].$ci['url']), 0, 10); $url = escapeshellcmd($ci['url']); - $path = chunk_split($ci['bc'], 8, '/'); + if (!empty($ci['bc'])) { + $path = chunk_split($ci['bc'], 8, '/'); + } else { + $path = ''; + } $data = $nameHash.' '.$url.' '.$_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['VIDEODIR'].'/'.$path."\n"; file_put_contents($GLOBALS['config']['TMPDIR'].'/'.$nameHash.'.hash', $data); $fullListFile[$nameHash] = array(