From 438c51507600a0ba0ed5d2da9742d9f3ab8e85b4 Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Thu, 8 Aug 2013 13:36:13 +0200 Subject: [PATCH] [add] empty folder can be delete --- images/confirm.svg | 556 +++++++++++++++++++++++++++++++++++++++++++++ inc/content.php | 29 ++- index.php | 31 ++- style.css | 37 +++ 4 files changed, 639 insertions(+), 14 deletions(-) create mode 100644 images/confirm.svg diff --git a/images/confirm.svg b/images/confirm.svg new file mode 100644 index 0000000..74d63c5 --- /dev/null +++ b/images/confirm.svg @@ -0,0 +1,556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + Shadow opacity : 30, 15, 10, (8) + + Bevel opacity : 30 / 10 + Bevel opacity : 75 / 15 + + + + + diff --git a/inc/content.php b/inc/content.php index a53091c..b749af2 100644 --- a/inc/content.php +++ b/inc/content.php @@ -103,11 +103,12 @@ if (empty($ci['bc'])) { $listCurrentDir = listCurrentDir($path); $listCurrentFile = listVideo($path); -if(!empty($listCurrentFile) && count($listCurrentFile) > 1 && $ci['ac'] !== 'view'){ + +if (!empty($listCurrentFile) && count($listCurrentFile) > 1 && $ci['ac'] !== 'view') { echo '
'; } @@ -125,11 +126,21 @@ if (!empty($breadcrumb)) { } } echo ''; + +if ($_SESSION['log'] === true && empty($listCurrentDir) && empty($listCurrentFile)) { + if ($ci['ac'] === 'confDel') { + echo '
+ Yes + No +
'; + } else { + echo 'Delete this directory'; + } +} + echo '
'; - - if (!empty($listCurrentDir) && $ci['ac'] !== 'view') { - $listCurrentDir = sortDir($listCurrentDir,$fullListDir); + $listCurrentDir = sortDir($listCurrentDir, $fullListDir); foreach ($listCurrentDir as $key => $value) { $thumbnail = getThumbnail($path, $key); if (empty($thumbnail)) { @@ -140,7 +151,7 @@ if (!empty($listCurrentDir) && $ci['ac'] !== 'view') { } } if (!empty($listCurrentFile) && $ci['ac'] !== 'view') { - $listCurrentFile = sortFile($listCurrentFile, $fullListFile,$ci['sort']); + $listCurrentFile = sortFile($listCurrentFile, $fullListFile, $ci['sort']); foreach ($listCurrentFile as $key => $value) { if ($key == 'thumb') { continue; @@ -205,7 +216,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { Url - ', $videoInfo['url'], ' + ', $videoInfo['url'], ' Duration @@ -218,7 +229,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { Via '; if (!empty($videoInfo['via'])) { - echo '', $videoInfo['via'], ''; + echo '', $videoInfo['via'], ''; } else { echo ''; } diff --git a/index.php b/index.php index ad7ac41..62b3db6 100644 --- a/index.php +++ b/index.php @@ -152,7 +152,7 @@ function genToken() { function verifToken($token) { if ($token !== $_SESSION['token'] || $_SESSION['tokenTime'] <= time() - 24000) { ban(); - die('So Long, and Thanks for All the Fish.'); + die('Tinker say : I have several theories I would like to put into practice.'); } } @@ -196,9 +196,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 '

'; @@ -245,6 +245,20 @@ function renDir($dir, $breadcrumb, $fullListDir) { } } +function removeDir($dir, $fullListDir) { + $path = chunk_split($dir, 8, '/'); + if (empty($dir) || !file_exists($GLOBALS['config']['VIDEODIR'].'/'.$path) || !is_dir($GLOBALS['config']['VIDEODIR'].'/'.$path)) { + die('Victory is 10% inspiration, 90% decapitation! '); + } else { + $parent = substr($dir, 0, -8); + $currentDir = getCurrentDir($dir); + rmdir($GLOBALS['config']['VIDEODIR'].'/'.$path); + unset($fullListDir[$currentDir]); + file_put_contents($GLOBALS['config']['LISTDIR'], ""); + return $parent; + } +} + function addVideo($ci, $fullListFile) { $nameHash = substr(sha1($ci['name'].$ci['url']), 0, 10); $url = escapeshellcmd($ci['url']); @@ -527,17 +541,24 @@ if (isset($ci['ac']) && !empty($ci['ac'])) { if ($ci['ac'] === 'view' && !empty($ci['op']) && (int)$ci['op'] === 3) { verifToken($ci['token']); if ($_SESSION['log'] !== true) { - die('Tinker say : Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew'); + die('Tinker say : Blinded you, with Science! '); } $defineThumb = defineThumb($ci['bc'], $ci['file']); } if ($ci['ac'] === 'viewQueue') { verifToken($ci['token']); if ($_SESSION['log'] !== true) { - die('Tinker say : Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew'); + die('Tinker say : Seek the heat! '); } $page = 'admin'; } + if ($ci['ac'] === 'del') { + verifToken($ci['token']); + if ($_SESSION['log'] !== true) { + die('Tinker say : wonder what.. This does? '); + } + $ci['bc'] = removeDir($ci['bc'], $fullListDir); + } } if (isset($ci['dl']) && !empty($ci['dl'])) { sendVideo($ci['bc'], $ci['dl']); diff --git a/style.css b/style.css index 12e260b..4c5eee0 100644 --- a/style.css +++ b/style.css @@ -207,4 +207,41 @@ video { #toolbar img { height: 2em; width: 2em; +} + +.delete { + background-image: url("images/delete.svg"); + background-position: left center; + background-repeat: no-repeat; + background-size: 32px; + padding-left: 32px; + text-decoration: none; +} + +.confirm { + width: 14em; + margin: 0 auto; + text-align: center; + border: 2px solid #dfdfdf; + background-color: #dfdfdf; + border-radius: 0.2em; + padding: 1.2em; +} + +.confirm a { + padding: 0.5em 1em; + display: inline-block; + border-radius: 0.2em; + margin: 0 0.4em; + color:#262626; + font-weight: bold; + text-decoration : none; +} + +.confirm .valid { + background-color : #9bd840; +} + +.confirm .cancel { + background-color : #e74638; } \ No newline at end of file