[fix] error when import dir
This commit is contained in:
parent
35e5873456
commit
c17942470e
|
@ -3,30 +3,40 @@ require 'inc/topMenu.php';
|
|||
if (!empty($ci['ac']) && $ci['ac'] === 'login') {
|
||||
echo '<form action="?" method="post">
|
||||
<fieldset>
|
||||
<legend>Login</login>
|
||||
<legend>Login</legend>
|
||||
<p>
|
||||
<label>Login</label>
|
||||
<input type="text" name="loginName" required />
|
||||
</p>
|
||||
<p>
|
||||
<label>Password</label>
|
||||
<input type="password" name="loginPass" required />
|
||||
</p>
|
||||
<p>
|
||||
<input type="hidden" name="op" value="2"/>
|
||||
<input type="hidden" name="ac" value="login"/>
|
||||
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
|
||||
<input type="hidden" name="token" value="', $token, '"/>
|
||||
<input type="submit" />
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
if (!empty($ci['ac']) && $ci['ac'] === 'newDir' && isLog()) {
|
||||
echo '<form action="?" method="post">
|
||||
<fieldset>
|
||||
<p>
|
||||
<legend>New directory</legend>
|
||||
<label>Name</label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" name="newDir" autofocus/>
|
||||
<input type="hidden" name="op" value="1"/>
|
||||
<input type="hidden" name="ac" value="newDir" />
|
||||
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
|
||||
<input type="hidden" name="token" value="', $token, '"/>
|
||||
<input type="submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
@ -36,13 +46,17 @@ if (!empty($ci['ac']) && $ci['ac'] === 'renDir' && isLog()) {
|
|||
echo '<form action="?" method="post">
|
||||
<fieldset>
|
||||
<legend>', $fullListDir[$currentDir], '</legend>
|
||||
<p>
|
||||
<label>New name</label>
|
||||
<input type="text" name="renDir" value="', $fullListDir[$currentDir], '" autofocus/>
|
||||
<input type="text" name="renDir" value="', $fullListDir[$currentDir], '" autofocus autocomplete="off"/>
|
||||
</p>
|
||||
<p>
|
||||
<input type="hidden" name="op" value="1"/>
|
||||
<input type="hidden" name="ac" value="renDir" />
|
||||
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
|
||||
<input type="hidden" name="token" value="', $token, '"/>
|
||||
<input type="submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
@ -51,25 +65,33 @@ if (!empty($ci['ac']) && $ci['ac'] === 'addVideo' && isLog()) {
|
|||
echo '<form action="?" method="post">
|
||||
<fieldset>
|
||||
<legend>New video</legend>
|
||||
<p>
|
||||
<label>Url</label>
|
||||
<input type="url" name="url" autofocus/>
|
||||
<input type="url" name="url" autofocus autocomplete="off"/>
|
||||
</p>
|
||||
<p>
|
||||
<label>Name</label>
|
||||
<input type="text" name="name"/>
|
||||
<input type="text" name="name" autocomplete="off"/>
|
||||
</p>
|
||||
<p>
|
||||
<label>Description</label>
|
||||
<textarea name="desc"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label>Via</label>
|
||||
<input type="url" name="via" />
|
||||
<label>Licence</label>
|
||||
<select name="licence">
|
||||
<option>CC-NC</option>
|
||||
</select>
|
||||
<input type="url" name="via" autocomplete="off"/>
|
||||
</p>
|
||||
<p>
|
||||
<label>Direct download</label>
|
||||
<input type="checkbox" name="ddl" value="1"/>
|
||||
</p>
|
||||
<p>
|
||||
<input type="hidden" name="op" value="1"/>
|
||||
<input type="hidden" name="ac" value="addVideo" />
|
||||
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
|
||||
<input type="hidden" name="token" value="', $token, '"/>
|
||||
<input type="submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
@ -77,13 +99,17 @@ if (!empty($ci['ac']) && $ci['ac'] === 'addThumbnail' && isLog()) {
|
|||
echo '<form action="?" method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
<legend>Add thumbnail</legend>
|
||||
<p>
|
||||
<label>Thumbnail</label>
|
||||
<input type="file" name="file" />
|
||||
</p>
|
||||
<p>
|
||||
<input type="hidden" name="op" value="1"/>
|
||||
<input type="hidden" name="ac" value="addThumbnail" />
|
||||
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
|
||||
<input type="hidden" name="token" value="', $token, '"/>
|
||||
<input type="submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
@ -91,13 +117,17 @@ if (!empty($ci['ac']) && $ci['ac'] === 'importDirForm' && isLog()) {
|
|||
echo '<form action="?" method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
<legend>Add dir</legend>
|
||||
<p>
|
||||
<label>Directory</label>
|
||||
<input type="file" name="file" />
|
||||
</p>
|
||||
<p>
|
||||
<input type="hidden" name="op" value="1"/>
|
||||
<input type="hidden" name="ac" value="importDir" />
|
||||
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
|
||||
<input type="hidden" name="token" value="', $token, '"/>
|
||||
<input type="submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
@ -281,10 +311,6 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
|
|||
}
|
||||
echo '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Licence</th>
|
||||
<td>', $videoInfo['licence'], '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Download</th>
|
||||
<td><a href="', $downloadLink, '">Download</a></td>
|
||||
|
|
|
@ -131,6 +131,12 @@ function logout() {
|
|||
session_unset();
|
||||
}
|
||||
|
||||
// In a string, converts urls to clickable links.
|
||||
// src = https://github.com/sebsauvage/Shaarli/blob/master/index.php
|
||||
function text2clickable($url) {
|
||||
return preg_replace('!(((?:https?|ftp|file)://|apt:|magnet:)\S+[[:alnum:]]/?)!si', '<a href="'.$redir.'$1" rel="nofollow">$1</a>', $url);
|
||||
}
|
||||
|
||||
function getCurrentDir($bc) {
|
||||
$currentDir = end(str_split($bc, 8));
|
||||
return $currentDir;
|
||||
|
@ -231,7 +237,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 = '0 '.$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'], "<?php\n\$fullListFile=".var_export($fullListFile, true).";\n?>");
|
||||
|
@ -877,6 +883,7 @@ if ($ci['ac'] === 'logout') {
|
|||
<meta charset="utf-8">
|
||||
<title>SoViGall - Personal Video Gallery</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
|
23
style.css
23
style.css
|
@ -238,6 +238,29 @@ a {
|
|||
margin: 0.4em auto;
|
||||
}
|
||||
|
||||
form {
|
||||
width: 50%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
textarea {
|
||||
height: 8em;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
display: inline;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
input, select, options {
|
||||
color: #262626;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue