From cb4726e0765c52fbfd2cf31e53bb535788730b6b Mon Sep 17 00:00:00 2001 From: Zankaria Date: Fri, 15 Mar 2024 10:08:34 +0100 Subject: [PATCH] post.php: trim --- post.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/post.php b/post.php index ac7fde4b..45750c0d 100644 --- a/post.php +++ b/post.php @@ -565,7 +565,7 @@ function handle_report() ); // You can get your webhook endpoint from your Slack settings - // For some reason using the configuration key doesn't work + // For some reason using the configuration key doesn't work $ch = curl_init($config['slack_incoming_webhook_endpoint']); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); @@ -1278,28 +1278,28 @@ function handle_post() $file['width'] = $size[0]; $file['height'] = $size[1]; } - /*if (($file['extension'] == "epub" && $config['epub_file_thumbnail'])){ + /*if (($file['extension'] == "epub" && $config['epub_file_thumbnail'])){ $path = $file['thumb']; // Open epub // Get file list // Check if cover file exists according to regex if it does use it - // Otherwise check if metadata file exists, and if does get rootfile and search for manifest for cover file name + // Otherwise check if metadata file exists, and if does get rootfile and search for manifest for cover file name // Otherwise Check if other image files exist and use them, based on criteria to pick the best one. - // Once we have filename extract said file from epub to file['thumb'] location. + // Once we have filename extract said file from epub to file['thumb'] location. $zip = new ZipArchive(); if(@$zip->open($path)){ $filename = ""; // Go looking for a file name, current implementation just uses regex but should fallback to // getting all images and then choosing one. - for( $i = 0; $i < $zip->numFiles; $i++ ){ - $stat = $zip->statIndex( $i ); + for( $i = 0; $i < $zip->numFiles; $i++ ){ + $stat = $zip->statIndex( $i ); $matches = array(); if (preg_match('/.*cover.*\.(jpg|jpeg|png)/', $stat['name'], $matches)) { $filename = $matches[0]; - break; + break; } - } - // We have a cover filename to extract. + } + // We have a cover filename to extract. if (strlen($filename) > 0){ //$zip->extractTo(dirname($file['thumb']), array($filename)); } @@ -1311,9 +1311,9 @@ function handle_post() else { $error = 1; } - + if ($error){ - $path = sprintf($config['file_thumb'],isset($config['file_icons'][$file['extension']]) ? $config['file_icons'][$file['extension']] : $config['file_icons']['default']); + $path = sprintf($config['file_thumb'],isset($config['file_icons'][$file['extension']]) ? $config['file_icons'][$file['extension']] : $config['file_icons']['default']); } $file['thumb'] = basename($file['thumb']);