[fix] error when import dir

This commit is contained in:
Knah Tsaeb 2015-02-20 11:51:52 +01:00
parent 35e5873456
commit 743b37c375

View file

@ -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?>");
@ -277,9 +283,9 @@ function n_print($data, $name = '') {
<fieldset style="border: 1px solid orange; padding: 5px;color:#1E1915; background-color: #fff;">';
echo '
<legend style="border:1px solid orange;padding: 1px;background-color:#eee;color:orange;">
', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '
', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '
</legend>';
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
echo '
</fieldset>
<br />';
@ -513,12 +519,12 @@ function makeRss($breadcrumb, $fullListFile) {
exit();
}
function updateVideoInfo($dc,$file) {
function updateVideoInfo($dc, $file) {
$path = chunk_split($dc, 8, '/');
$file = escapeshellcmd($file);
$bc = escapeshellcmd($path);
if( !is_file('bin/getInfo.sh')){
return 'You need configure bin/getInfo.sh';
if (!is_file('bin/getInfo.sh')) {
return 'You need configure bin/getInfo.sh';
}
exec('bash bin/getInfo.sh '.$file.' '.$bc, $result);
$jsonFile = json_decode(file_get_contents($GLOBALS['config']['VIDEODIR'].'/'.$path.$file.'.info.json'));
@ -823,8 +829,8 @@ if (isset($ci['ac']) && !empty($ci['ac'])) {
die('Tinker say : Blinded you, with Science! ');
}
$updateInfo = updateVideoInfo($ci['bc'], $ci['file']);
if($updateInfo !== true){
echo '<div class="error">',$updateInfo,'</div>';
if ($updateInfo !== true) {
echo '<div class="error">', $updateInfo, '</div>';
}
}
if ($ci['ac'] === 'viewQueue' || $ci['ac'] === 'clearCache') {
@ -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