';
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 '
';
@@ -251,7 +252,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
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 = '') {
';
@@ -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;
}
|