aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2024-11-09 11:27:53 +0100
committerMario Vavti <mario@mariovavti.com>2024-11-09 11:27:53 +0100
commit954d92c354aef93cac7079472c55b53ac4a07d2a (patch)
tree9ece7278658a82e7f21e71a8cdc7cc13f5d91aed /Zotlabs
parent8dbebc2b426ac3a27d2476acb6ccc2f353f4212a (diff)
parent14207c68ca451c365b3fe1f8d267409da39f9498 (diff)
downloadvolse-hubzilla-954d92c354aef93cac7079472c55b53ac4a07d2a.tar.gz
volse-hubzilla-954d92c354aef93cac7079472c55b53ac4a07d2a.tar.bz2
volse-hubzilla-954d92c354aef93cac7079472c55b53ac4a07d2a.zip
Merge branch 'dev' into containers
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Admin/Addons.php4
-rw-r--r--Zotlabs/Module/Admin/Themes.php2
-rw-r--r--Zotlabs/Module/Apporder.php4
-rw-r--r--Zotlabs/Module/Apps.php4
-rw-r--r--Zotlabs/Module/Chatsvc.php2
-rw-r--r--Zotlabs/Module/Cloud.php8
-rw-r--r--Zotlabs/Module/Notify.php4
-rw-r--r--Zotlabs/Module/Permcat.php4
-rw-r--r--Zotlabs/Module/Snap.php20
-rw-r--r--Zotlabs/Thumbs/Epubthumb.php47
10 files changed, 54 insertions, 45 deletions
diff --git a/Zotlabs/Module/Admin/Addons.php b/Zotlabs/Module/Admin/Addons.php
index 681eed750..0cb173e7c 100644
--- a/Zotlabs/Module/Admin/Addons.php
+++ b/Zotlabs/Module/Admin/Addons.php
@@ -3,8 +3,8 @@
namespace Zotlabs\Module\Admin;
use App;
-use \Zotlabs\Lib\Config;
-use \Michelf\MarkdownExtra;
+use Zotlabs\Lib\Config;
+use Michelf\MarkdownExtra;
class Addons {
diff --git a/Zotlabs/Module/Admin/Themes.php b/Zotlabs/Module/Admin/Themes.php
index 6793f56b1..09fec9725 100644
--- a/Zotlabs/Module/Admin/Themes.php
+++ b/Zotlabs/Module/Admin/Themes.php
@@ -2,7 +2,7 @@
namespace Zotlabs\Module\Admin;
-use \Michelf\MarkdownExtra;
+use Michelf\MarkdownExtra;
use Zotlabs\Lib\Config;
/**
diff --git a/Zotlabs/Module/Apporder.php b/Zotlabs/Module/Apporder.php
index 313c2df50..579ca738c 100644
--- a/Zotlabs/Module/Apporder.php
+++ b/Zotlabs/Module/Apporder.php
@@ -2,7 +2,7 @@
namespace Zotlabs\Module;
-use \Zotlabs\Lib as Zlib;
+use Zotlabs\Lib as Zlib;
class Apporder extends \Zotlabs\Web\Controller {
@@ -25,7 +25,7 @@ class Apporder extends \Zotlabs\Web\Controller {
$syslist[] = Zlib\Apps::app_encode($li);
}
}
-
+
Zlib\Apps::translate_system_apps($syslist);
usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare');
diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php
index a8817111e..97e1b237f 100644
--- a/Zotlabs/Module/Apps.php
+++ b/Zotlabs/Module/Apps.php
@@ -1,8 +1,8 @@
<?php
namespace Zotlabs\Module;
-use \Zotlabs\Lib\Config;
-use \Zotlabs\Lib as Zlib;
+use Zotlabs\Lib\Config;
+use Zotlabs\Lib as Zlib;
class Apps extends \Zotlabs\Web\Controller {
diff --git a/Zotlabs/Module/Chatsvc.php b/Zotlabs/Module/Chatsvc.php
index 2f2784fc4..e9dfb2a4b 100644
--- a/Zotlabs/Module/Chatsvc.php
+++ b/Zotlabs/Module/Chatsvc.php
@@ -4,7 +4,7 @@ namespace Zotlabs\Module;
require_once('include/security.php');
-use \Zotlabs\Lib as Zlib;
+use Zotlabs\Lib as Zlib;
class Chatsvc extends \Zotlabs\Web\Controller {
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 527b06b3a..510f91c1e 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -8,10 +8,10 @@ namespace Zotlabs\Module;
*/
use Sabre\DAV as SDAV;
-use \Zotlabs\Web\Controller;
-use \Zotlabs\Storage\BasicAuth;
-use \Zotlabs\Storage\Directory;
-use \Zotlabs\Storage\Browser;
+use Zotlabs\Web\Controller;
+use Zotlabs\Storage\BasicAuth;
+use Zotlabs\Storage\Directory;
+use Zotlabs\Storage\Browser;
// composer autoloader for SabreDAV
diff --git a/Zotlabs/Module/Notify.php b/Zotlabs/Module/Notify.php
index 0af2ec93a..7a7becbc8 100644
--- a/Zotlabs/Module/Notify.php
+++ b/Zotlabs/Module/Notify.php
@@ -1,8 +1,8 @@
<?php
namespace Zotlabs\Module;
-use \Zotlabs\Lib\PConfig;
-use \Zotlabs\Web\Controller;
+use Zotlabs\Lib\PConfig;
+use Zotlabs\Web\Controller;
class Notify extends Controller {
diff --git a/Zotlabs/Module/Permcat.php b/Zotlabs/Module/Permcat.php
index 064c9cefb..0335c7bc6 100644
--- a/Zotlabs/Module/Permcat.php
+++ b/Zotlabs/Module/Permcat.php
@@ -2,7 +2,7 @@
namespace Zotlabs\Module;
-use \Zotlabs\Lib as Zlib;
+use Zotlabs\Lib as Zlib;
class Permcat extends \Zotlabs\Web\Controller {
@@ -22,4 +22,4 @@ class Permcat extends \Zotlabs\Web\Controller {
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Snap.php b/Zotlabs/Module/Snap.php
index 89aebc097..770ba07c2 100644
--- a/Zotlabs/Module/Snap.php
+++ b/Zotlabs/Module/Snap.php
@@ -8,8 +8,8 @@ namespace Zotlabs\Module;
* Module for accessing the DAV storage area from a DAV client.
*/
-use \Sabre\DAV as SDAV;
-use \Zotlabs\Storage;
+use Sabre\DAV as SDAV;
+use Zotlabs\Storage;
// composer autoloader for SabreDAV
require_once('vendor/autoload.php');
@@ -24,7 +24,7 @@ require_once('vendor/autoload.php');
class Snap extends \Zotlabs\Web\Controller {
function init() {
-
+
// workaround for HTTP-auth in CGI mode
if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
$userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
@@ -43,20 +43,20 @@ class Snap extends \Zotlabs\Web\Controller {
$_SERVER['PHP_AUTH_PW'] = $password;
}
}
-
+
if (! is_dir('store'))
os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
-
+
$which = null;
if (argc() > 1)
$which = argv(1);
-
+
$profile = 0;
-
+
if($which)
profile_load( $which, $profile);
else
- killme();
+ killme();
if($_SERVER['PHP_AUTH_USER'] && $_SERVER['PHP_AUTH_USER'] !== $which)
killme();
@@ -68,7 +68,7 @@ class Snap extends \Zotlabs\Web\Controller {
}
if(! in_array(strtolower($_SERVER['REQUEST_METHOD']),['propfind','get','head']))
- killme();
+ killme();
$auth = new \Zotlabs\Storage\BasicAuth();
$auth->setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . 'WebDAV');
@@ -101,5 +101,5 @@ class Snap extends \Zotlabs\Web\Controller {
killme();
}
-
+
}
diff --git a/Zotlabs/Thumbs/Epubthumb.php b/Zotlabs/Thumbs/Epubthumb.php
index 6ebbd8933..b50583e30 100644
--- a/Zotlabs/Thumbs/Epubthumb.php
+++ b/Zotlabs/Thumbs/Epubthumb.php
@@ -2,31 +2,33 @@
namespace Zotlabs\Thumbs;
-require_once 'library/epub-meta/epub.php';
+use SebLucas\EPubMeta\EPub;
+use GdImage;
/**
- * @brief Thumbnail creation for epub files.
- *
+ * Thumbnail creation for epub files.
*/
class Epubthumb {
/**
- * @brief Match for application/epub+zip.
+ * Match for application/epub+zip.
*
* @param string $type MimeType
* @return boolean
*/
- function Match($type) {
- return(($type === 'application/epub+zip') ? true : false );
+ function Match(string $type): bool {
+ return $type === 'application/epub+zip';
}
/**
- * @brief
+ * Create the thumbnail if the Epub has a cover.
*
* @param array $attach
* @param number $preview_style unused
* @param number $height (optional) default 300
* @param number $width (optional) default 300
+ *
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function Thumb($attach, $preview_style, $height = 300, $width = 300) {
@@ -35,26 +37,33 @@ class Epubthumb {
return;
}
- $photo = false;
-
- $ep = new \EPub($file);
- $data = $ep->Cover();
-
- if($data['found']) {
- $photo = $data['data'];
- }
+ $image = $this->getCover($file);
- if($photo) {
- $image = imagecreatefromstring($photo);
- $dest = imagecreatetruecolor($width, $height);
+ if ($image) {
$srcwidth = imagesx($image);
$srcheight = imagesy($image);
+ $dest = imagecreatetruecolor($width, $height);
imagealphablending($dest, false);
imagesavealpha($dest, true);
+
imagecopyresampled($dest, $image, 0, 0, 0, 0, $width, $height, $srcwidth, $srcheight);
+
+ imagejpeg($dest, "{$file}.thumb");
+
imagedestroy($image);
- imagejpeg($dest, dbunescbin($attach['content']) . '.thumb');
+ imagedestroy($dest);
+ }
+ }
+
+ private function getCover(string $filename): GdImage|false {
+ $epub = new EPub($filename);
+ $cover = $epub->getCover();
+
+ if (! empty($cover)) {
+ return imagecreatefromstring($cover);
+ } else {
+ return false;
}
}
}