forked from leftypol/leftypol
post.php: trim
This commit is contained in:
parent
b742445f50
commit
cb4726e076
1 changed files with 11 additions and 11 deletions
22
post.php
22
post.php
|
@ -565,7 +565,7 @@ function handle_report()
|
||||||
);
|
);
|
||||||
|
|
||||||
// You can get your webhook endpoint from your Slack settings
|
// 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']);
|
$ch = curl_init($config['slack_incoming_webhook_endpoint']);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
@ -1278,28 +1278,28 @@ function handle_post()
|
||||||
$file['width'] = $size[0];
|
$file['width'] = $size[0];
|
||||||
$file['height'] = $size[1];
|
$file['height'] = $size[1];
|
||||||
}
|
}
|
||||||
/*if (($file['extension'] == "epub" && $config['epub_file_thumbnail'])){
|
/*if (($file['extension'] == "epub" && $config['epub_file_thumbnail'])){
|
||||||
$path = $file['thumb'];
|
$path = $file['thumb'];
|
||||||
// Open epub
|
// Open epub
|
||||||
// Get file list
|
// Get file list
|
||||||
// Check if cover file exists according to regex if it does use it
|
// 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.
|
// 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();
|
$zip = new ZipArchive();
|
||||||
if(@$zip->open($path)){
|
if(@$zip->open($path)){
|
||||||
$filename = "";
|
$filename = "";
|
||||||
// Go looking for a file name, current implementation just uses regex but should fallback to
|
// Go looking for a file name, current implementation just uses regex but should fallback to
|
||||||
// getting all images and then choosing one.
|
// getting all images and then choosing one.
|
||||||
for( $i = 0; $i < $zip->numFiles; $i++ ){
|
for( $i = 0; $i < $zip->numFiles; $i++ ){
|
||||||
$stat = $zip->statIndex( $i );
|
$stat = $zip->statIndex( $i );
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (preg_match('/.*cover.*\.(jpg|jpeg|png)/', $stat['name'], $matches)) {
|
if (preg_match('/.*cover.*\.(jpg|jpeg|png)/', $stat['name'], $matches)) {
|
||||||
$filename = $matches[0];
|
$filename = $matches[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We have a cover filename to extract.
|
// We have a cover filename to extract.
|
||||||
if (strlen($filename) > 0){
|
if (strlen($filename) > 0){
|
||||||
//$zip->extractTo(dirname($file['thumb']), array($filename));
|
//$zip->extractTo(dirname($file['thumb']), array($filename));
|
||||||
}
|
}
|
||||||
|
@ -1311,9 +1311,9 @@ function handle_post()
|
||||||
else {
|
else {
|
||||||
$error = 1;
|
$error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error){
|
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']);
|
$file['thumb'] = basename($file['thumb']);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue