From 8d7bee11797664047be923bdcf84e71ca8df61e2 Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Fri, 20 Dec 2013 16:10:56 +0100 Subject: [PATCH] [add] move video to other place --- images/IconsSources | 2 + images/IconsSources~ | 0 images/cut.svg | 532 +++++++++++++++++++++++++++++++++++++++++++ images/paste.svg | 428 ++++++++++++++++++++++++++++++++++ inc/admin.php | 3 +- inc/content.php | 23 +- inc/topMenu.php | 2 +- index.php | 60 +++-- style.css | 16 +- 9 files changed, 1028 insertions(+), 38 deletions(-) create mode 100644 images/IconsSources create mode 100644 images/IconsSources~ create mode 100644 images/cut.svg create mode 100644 images/paste.svg diff --git a/images/IconsSources b/images/IconsSources new file mode 100644 index 0000000..709a567 --- /dev/null +++ b/images/IconsSources @@ -0,0 +1,2 @@ +Faenza +Tango diff --git a/images/IconsSources~ b/images/IconsSources~ new file mode 100644 index 0000000..e69de29 diff --git a/images/cut.svg b/images/cut.svg new file mode 100644 index 0000000..1d0edf0 --- /dev/null +++ b/images/cut.svg @@ -0,0 +1,532 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + Shadow opacity : 30, 15, 10, (8) + + Bevel opacity : 30 / 10 + Bevel opacity : 75 / 15 + + + + + diff --git a/images/paste.svg b/images/paste.svg new file mode 100644 index 0000000..6408aaf --- /dev/null +++ b/images/paste.svg @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inc/admin.php b/inc/admin.php index 8ff85b0..00d533f 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -46,5 +46,4 @@ if (!empty($breadcrumb)) { } $i++; } -} -echo ''; \ No newline at end of file +} \ No newline at end of file diff --git a/inc/content.php b/inc/content.php index f4a25a3..1c19abd 100644 --- a/inc/content.php +++ b/inc/content.php @@ -84,7 +84,8 @@ if (!empty($ci['ac']) && $ci['ac'] === 'addThumbnail' && isLog()) { '; -}if (!empty($ci['ac']) && $ci['ac'] === 'importDirForm' && isLog()) { +} +if (!empty($ci['ac']) && $ci['ac'] === 'importDirForm' && isLog()) { echo '
Add dir @@ -113,10 +114,8 @@ if (empty($ci['bc'])) { $breadcrumb = makeBreadcrumb($ci['bc'], $fullListDir); $nbBread = count($breadcrumb); } - $listCurrentDir = listCurrentDir($path); $listCurrentFile = listVideo($path); - if (!empty($listCurrentFile) && count($listCurrentFile) > 1 && $ci['ac'] !== 'view') { echo '
    @@ -139,7 +138,9 @@ if (!empty($breadcrumb)) { } } echo '
'; - +if (isset($_SESSION['cutFile']) && !empty($_SESSION['cutFile'])) { + echo ''; +} if (empty($listCurrentDir) && empty($listCurrentFile)) { if ($ci['ac'] === 'confDelDir' && isLog()) { echo '
@@ -151,7 +152,6 @@ if (empty($listCurrentDir) && empty($listCurrentFile)) { echo 'Delete this directory'; } } - if ($ci['op'] === 'confDelVideo' && isLog()) { echo '

Delete this file

@@ -159,7 +159,6 @@ if ($ci['op'] === 'confDelVideo' && isLog()) { No
'; } - echo '
'; if (!empty($listCurrentDir) && $ci['ac'] !== 'view') { $listCurrentDir = sortDir($listCurrentDir, $fullListDir); @@ -201,7 +200,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { updateFileInfo($videoInfo['hash'], $fullTitle, $uploadDate); $videoInfo['title'] = $fullTitle = $videoInfo['originalTitle'].' ('.$videoInfo['originalTitle'].')'; $videoInfo['uploadDateSort'] = $videoInfo['uploadDate']; - deleteCache($ci['bc'], $ci['file'], $ci['sort'],true); + deleteCache($ci['bc'], $ci['file'], $ci['sort'], true); } else { $fullTitle = $videoInfo['title'].' ('.$videoInfo['originalTitle'].')'; } @@ -223,6 +222,8 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { } if ($_SESSION['log'] === true) { echo '
+ Cut this video + Paste this video Use this thumbnail for folder thumbnail Delete this video
'; @@ -251,7 +252,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { Url - ', $videoInfo['url'], ' + ', $videoInfo['url'], ' Duration @@ -262,13 +263,13 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { ', $videoInfo['size'], ' Publish date - ', date("d m Y", strtotime($videoInfo['uploadDate'])), ' + ', date("d m Y", strtotime($videoInfo['uploadDate'])), ' Via '; if (!empty($videoInfo['via'])) { - echo '', $videoInfo['via'], ''; + echo '', $videoInfo['via'], ''; } else { echo ''; } @@ -289,4 +290,4 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
'; } -?> +?> \ No newline at end of file diff --git a/inc/topMenu.php b/inc/topMenu.php index 65041c4..448ac5a 100644 --- a/inc/topMenu.php +++ b/inc/topMenu.php @@ -21,4 +21,4 @@
  • Login
  • '; } -?> \ No newline at end of file +echo '
    '; \ No newline at end of file diff --git a/index.php b/index.php index 77a74b9..54a336a 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,6 @@ error_reporting(E_ALL ^ E_NOTICE); session_start(); $startTime = microtime(true); date_default_timezone_set('UTC'); - ##### Default config ###### # create option.php in # # root folder of sovigall # @@ -24,7 +23,8 @@ $GLOBALS['config']['CONFIG_FILE'] = $GLOBALS['config']['DATADIR'].'/config.php'; $GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php'; // Ban IP after this many failures. $GLOBALS['config']['BAN_AFTER'] = 4; -// Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 minutes) +// Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 +// minutes) $GLOBALS['config']['BAN_DURATION'] = 1800; // Use cache $GLOBALS['config']['USECACHE'] = true; @@ -35,11 +35,9 @@ $GLOBALS['config']['PAGECACHE'] = 'pagecache'; // xsendfile (use x-sendfile) // php $GLOBALS['config']['DOWNLOAD_METHOD'] = 'xsendfile'; - if (file_exists($GLOBALS['config']['DATADIR'].'/'.'option.php')) { require_once $GLOBALS['config']['DATADIR'].'/'.'option.php'; } - if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); @@ -50,7 +48,6 @@ if (get_magic_quotes_gpc()) { $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } - /* PHP < 5.4 use htmlentities with ISO-8859-1 charset by default * PHP > 5.4 use htmlentities with UTF-8 charset by default * see http://php.net/manual/fr/function.htmlentities.php @@ -63,15 +60,12 @@ function myHtmlentities($var) { $ci = array_merge($_POST, $_GET, $_COOKIE); $ci = array_map('myHtmlentities', $ci); $_SESSION['bc'] = $ci['bc']; - if (!file_exists($GLOBALS['config']['CONFIG_FILE']) || strlen(file_get_contents($GLOBALS['config']['CONFIG_FILE'])) == 0) { $page = install($ci); } - require $GLOBALS['config']['CONFIG_FILE']; require $GLOBALS['config']['LISTDIR']; require $GLOBALS['config']['LISTFILE']; - function install($ci) { if (!is_dir($GLOBALS['config']['DATADIR']) && !mkdir($GLOBALS['config']['DATADIR'], 0755)) { die('Error on create dir "DATADIR".'); @@ -104,7 +98,6 @@ function install($ci) { touch($GLOBALS['config']['LISTFILE']); } $page = 'install'; - if ($ci['install'] == 'install') { verifToken($ci['token']); $GLOBALS['loginName']['salt'] = hash('sha256', uniqid(rand(), true).'_'.mt_rand()); @@ -180,7 +173,6 @@ function exportDir($bc, $fullListDir, $fullListFile) { ), '', $value); $exportFile['listFile'][$hash] = $fullListFile[$hash]; } - $fileSize = mb_strlen(json_encode($exportFile, '8bit')); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); @@ -228,7 +220,6 @@ function importDir($bc, $fullListDir, $fullListFile) { } $fullListDir[$file['hash']] = $file['name']; file_put_contents($GLOBALS['config']['LISTDIR'], ""); - foreach ($file['listFile'] as $key => $value) { $fullListFile[$key] = array( 'title' => $value['title'], @@ -285,9 +276,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 '

    '; @@ -319,7 +310,6 @@ function renDir($dir, $breadcrumb, $fullListDir) { $dirHash = substr(sha1($dir.microtime(true)), 0, 8); $fullListDir[$dirHash] = $dir; $path = chunk_split($breadcrumb, 8, '/'); - if (rename($GLOBALS['config']['VIDEODIR'].'/'.$path, $GLOBALS['config']['VIDEODIR'].'/'.substr($path, 0, -9).'/'.$dirHash)) { unset($fullListDir[$currentDir]); file_put_contents($GLOBALS['config']['LISTDIR'], ""); @@ -368,7 +358,6 @@ function addVideo($ci, $fullListFile) { function deleteVideo($bc, $file) { $path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/'); $pathAndFile = $path.$file; - if ((file_exists($pathAndFile.'.jpg') || file_exists($pathAndFile.'.webm')) && !is_dir($pathAndFile) && $file === $_SESSION['video']) { $listFile = (glob($path.$_SESSION['video']."*")); foreach ($listFile as $value) { @@ -379,6 +368,25 @@ function deleteVideo($bc, $file) { } } +function cutVideo($bc, $file) { + $path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/'); + $pathAndFile = $path.$file; + $_SESSION['cutFile'] = $file; + $_SESSION['cutPathFile'] = $path; +} + +function pasteVideo($bc) { + $finalDest = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/'); + $file = $_SESSION['cutFile']; + $path = $_SESSION['cutPathFile']; + $allFile = glob($path.$file."*"); + foreach ($allFile as $value) { + $destName = pathinfo($value); + rename($value, $finalDest.$destName['basename']); + } + unset($_SESSION['cutPathFile'], $_SESSION['cutFile']); +} + function updateFileInfo($hash, $title, $uploadDate) { global $fullListFile; $fullListFile[$hash]['title'] = $title; @@ -458,9 +466,7 @@ function getVideoInfo($file, $dir, $fullListFile) { $jsonSize = explode(' - ', htmlentities($jsonInfo -> format)); $jsonSize = explode('x', $jsonSize[1]); $size = $jsonSize[1].'x'.$jsonSize[0]; - $time = gmdate('H\hi\ms\s', $jsonInfo -> duration); - $info = array( 'hash' => $file, 'title' => $postInfo['title'], @@ -572,13 +578,11 @@ function makeThumb($path, $file) { $height = 200; list($width_orig, $height_orig) = getimagesize($filename); $ratio_orig = $width_orig / $height_orig; - if ($width / $height > $ratio_orig) { $width = $height * $ratio_orig; } else { $height = $width / $ratio_orig; } - $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); @@ -594,7 +598,6 @@ function sendVideo($bc, $file) { $fileNameTesrt = 'tttt.webm'; $fileSize = filesize($GLOBALS['config']['VIDEODIR'].'/'.$path.$file.'.webm'); $pathAndFile = $GLOBALS['config']['VIDEODIR'].'/'.$path.$file.'.webm'; - if ($GLOBALS['config']['DOWNLOAD_METHOD'] === 'php') { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); @@ -675,7 +678,6 @@ if (!empty($ci['ac']) && $ci['ac'] === 'login' && !empty($ci['op']) && (int)$ci[ unset($ci['op'], $ci['ac']); } } - if (isset($ci['ac']) && !empty($ci['ac'])) { if ($ci['ac'] === 'renDir' && !empty($ci['op']) && (int)$ci['op'] === 1) { verifToken($ci['token']); @@ -684,14 +686,12 @@ if (isset($ci['ac']) && !empty($ci['ac'])) { $ci['bc'] = $renDir['bc']; $fullListDir = $renDir['fullListDir']; } - if ($ci['ac'] === 'newDir' && !empty($ci['op']) && (int)$ci['op'] === 1) { verifToken($ci['token']); $addDir = addDir($ci['newDir'], $ci['bc'], $fullListDir); deleteCache($ci['bc'], $ci['file'], $ci['sort'], true); $fullListDir = $addDir['fullListDir']; } - if ($ci['ac'] === 'addVideo' && !empty($ci['op']) && (int)$ci['op'] === 1) { verifToken($ci['token']); $addVideo = addVideo($ci, $fullListFile); @@ -721,6 +721,13 @@ if (isset($ci['ac']) && !empty($ci['ac'])) { $defineThumb = defineThumb($ci['bc'], $ci['file']); deleteCache($ci['bc'], '', $ci['sort'], true); } + if ($ci['ac'] === 'view' && !empty($ci['op']) && $ci['op'] === 'cutVideo') { + verifToken($ci['token']); + if (!isLog()) { + die('Tinker say : Blinded you, with Science! '); + } + cutVideo($ci['bc'], $ci['file']); + } if ($ci['ac'] === 'viewQueue' || $ci['ac'] === 'clearCache') { verifToken($ci['token']); if (!isLog()) { @@ -754,6 +761,13 @@ if ($ci['ac'] === 'importDir' && $ci['op'] === '1') { } importDir($ci['bc'], $fullListDir, $fullListFile); } +if (!empty($ci['op']) && $ci['op'] == 'paste') { + verifToken($ci['token']); + if (!isLog()) { + die('Tinker say : Blinded you, with Science! '); + } + pasteVideo($ci['bc']); +} if ($ci['ac'] === 'logout') { logout(); } diff --git a/style.css b/style.css index bd76d02..0cfdc5f 100644 --- a/style.css +++ b/style.css @@ -81,6 +81,20 @@ body { max-width: 260px; } +.paste { + height: 2em; + margin: 0; + padding: 0.2em; + border: 2px solid #dfdfdf; + border-radius: 0.2em; + background-color: #262626; + display: inline-block; +} + +.paste a { + text-decoration: none; +} + .dir, .video { background-image: url("images/folder.svg"); background-repeat: no-repeat; @@ -199,7 +213,7 @@ video { #toolbar { border-radius: 0.2em; background-color: #141414; - width: auto; + width: 60%; margin: 0 auto 1.1em auto; height: 2.3em; }