[add] fix manual generation and preview
This commit is contained in:
parent
1ef67023fe
commit
54760730bf
1 changed files with 10 additions and 4 deletions
|
@ -82,7 +82,9 @@ function manualGen($hash, $log) {
|
|||
$line = explode(' --- ', $line);
|
||||
$hash = sha1($GLOBALS['config']['salt'].rawurldecode($line[1]));
|
||||
file_put_contents('cache/tmp/manual.txt', $line[1]);
|
||||
exec('bin/thumb_server.sh manual '.escapeshellarg($hash).' '.escapeshellarg($line[3]).' '.escapeshellarg($line[4]).' 0 1', $result);
|
||||
chdir('bin/');
|
||||
exec('bash thumb_server.sh manual '.escapeshellarg($hash).' '.escapeshellarg($line[3]).' '.escapeshellarg($line[4]).' 0 1', $result);
|
||||
chdir('../');
|
||||
if ((int)$result[0] === 1) {
|
||||
$res['success'] = 1;
|
||||
$res['filePath'] = pathForFile($line[4], $hash).'.png';
|
||||
|
@ -108,10 +110,13 @@ function tryRootDomain($hash, $log) {
|
|||
$parts = parse_url($line[1]);
|
||||
$url = $parts['scheme'].'://'.trim($parts['host']);
|
||||
file_put_contents('cache/tmp/manual.txt', $url);
|
||||
exec('bin/thumb_server.sh manual '.escapeshellarg($hash).' '.escapeshellarg($line[3]).' '.escapeshellarg($line[4]).' 0 1', $result);
|
||||
chdir('bin/');
|
||||
exec('bash thumb_server.sh manual '.escapeshellarg($hash).' '.escapeshellarg($line[3]).' '.escapeshellarg($line[4]).' 0 1', $result);
|
||||
chdir('../');
|
||||
if ((int)$result[0] === 1) {
|
||||
$res['success'] = 1;
|
||||
$res['filePath'] = pathForFile($line[4], $hash).'.png';
|
||||
$res['base64'] = 'data:image/png;base64,'.base64_encode(file_get_contents($res['filePath']));
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +160,7 @@ echo '<div class="hMenu">
|
|||
</ul>
|
||||
</div>
|
||||
<div id="log">';
|
||||
if ($ui['ac'] === 'delete') {
|
||||
if (isset($ui['ac']) && $ui['ac'] === 'delete') {
|
||||
if (isset($ui['deleteUrl']) && testValidUrl($ui['deleteUrl']) !== true) {
|
||||
unset($ui['deleteUrl']);
|
||||
echo '<div>Not a valid url.</div>';
|
||||
|
@ -211,6 +216,7 @@ if (isset($ui['log']) && ($ui['log'] === 'suspect' || $ui['log'] === 'retry' ||
|
|||
}
|
||||
if (isset($ui['cache']) && (int)$ui['cache'] === 1) {
|
||||
$success['filePath'] = pathForFile($ui['s'], $ui['hash']).'.png';
|
||||
$success['base64'] = 'data:image/png;base64,'.base64_encode(file_get_contents($success['filePath']));
|
||||
if (!file_exists($success['filePath'])) {
|
||||
$success['base64'] = 'data:image/png;base64,'.base64_encode(file_get_contents('bin/error.png'));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue