Automatic push 4.2.3

This commit is contained in:
chevereto
2024-11-18 12:51:08 +00:00
parent 7c29ba0424
commit 0ad52d80f1
51 changed files with 9309 additions and 4815 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Chevereto.
*
* (c) Rodolfo Berrios <rodolfo@chevereto.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Chevereto\Legacy\Classes;
use FilterIterator;
class ImporterFilterIterator extends FilterIterator
{
protected $fileinfo;
public function accept(): bool
{
$this->fileinfo = $this->getInnerIterator()->current();
if ($this->fileinfo->isFile() && (preg_match(Import::imageExtensionsRegex(), (string) $this->fileinfo) == false || $this->filterAssets())) {
return false;
}
return !($this->fileinfo->isDir() && $this->filterAssets());
}
protected function filterAssets()
{
return $this->fileinfo->getBasename() == '.assets' || basename($this->fileinfo->getPath()) == '.assets';
}
}

View File

@@ -488,31 +488,33 @@ class Listing
$tableTagsFiles = $tables['tags_files'];
$relationTagIdColumn = 'tag_file_tag_id';
$tableImages = $tables['images'];
$tagPivot = 'tag_file_file_id';
$tagSql = <<<MySQL
EXISTS (
SELECT *
SELECT `{$tagPivot}`
FROM `{$tableTagsFiles}`
WHERE `{$relationTagIdColumn}` IN ({$inTagsSQL})
AND `tag_file_file_id` = {$tableImages}.image_id
AND `{$tagPivot}` = {$tableImages}.image_id
MySQL;
if ($this->type === 'albums') {
$tableRelation = $tables['tags_albums'];
$relationTagIdColumn = 'tag_album_tag_id';
$tableAlbums = $tables['albums'];
$tagPivot = 'tag_album_album_id';
$tagSql = <<<MySQL
EXISTS (
SELECT *
SELECT `{$tagPivot}`
FROM `{$tableRelation}`
WHERE `{$relationTagIdColumn}` IN ({$inTagsSQL})
AND `tag_album_album_id` = {$tableAlbums}.album_id
AND `{$tagPivot}` = {$tableAlbums}.album_id
AND `tag_album_count` > 0
MySQL;
}
if ($this->tagsMatch === 'all') {
$tagBinds[':tag_count'] = count($this->tagsIds);
$tagSql .= " HAVING COUNT(`{$relationTagIdColumn}`) = :tag_count";
$tagSql .= ' HAVING COUNT(*) = :tag_count';
}
$tagSql .= ')';
if ($this->where === '') {

View File

@@ -252,7 +252,7 @@ class User
'Email: %email',
'Status: %status',
'IP: %registration_ip',
'Date (GMT): %date_gmt',
'Date (UTC): %date_gmt',
'',
'You can disable these notifications on %configure',
]);
@@ -723,7 +723,7 @@ class User
if (isset($user['twitter_username'])) {
$user['twitter'] = [
'username' => $user['twitter_username'],
'url' => 'http://twitter.com/' . $user['twitter_username'],
'url' => 'https://twitter.com/' . $user['twitter_username'],
];
}
unset($user['twitter_username']);

View File

@@ -233,7 +233,7 @@ function get_share_links(array $share_element = [])
'label' => 'Email',
],
'facebook' => [
'url' => 'http://www.facebook.com/share.php?u=%URL%',
'url' => 'https://www.facebook.com/share.php?u=%URL%',
'label' => 'Facebook',
],
'x-twitter' => [
@@ -270,15 +270,15 @@ function get_share_links(array $share_element = [])
'label' => '分享到QQ',
],
'reddit' => [
'url' => 'http://old.reddit.com/submit?type=link&url=%URL%&title=%TITLE%&text=%DESCRIPTION%',
'url' => 'https://old.reddit.com/submit?type=link&url=%URL%&title=%TITLE%&text=%DESCRIPTION%',
'label' => 'reddit',
],
'vk' => [
'url' => 'http://vk.com/share.php?url=%URL%',
'url' => 'https://vk.com/share.php?url=%URL%',
'label' => 'VK',
],
'blogger' => [
'url' => 'http://www.blogger.com/blog-this.g?n=%TITLE%&source=&b=%HTML%',
'url' => 'https://www.blogger.com/blog-this.g?n=%TITLE%&source=&b=%HTML%',
'label' => 'Blogger',
],
'tumblr' => [
@@ -286,7 +286,7 @@ function get_share_links(array $share_element = [])
'label' => 'Tumblr.',
],
'pinterest' => [
'url' => 'http://www.pinterest.com/pin/create/bookmarklet/?media=%IMAGE%&url=%URL%&is_video=false&description=%DESCRIPTION%&title=%TITLE%',
'url' => 'https://www.pinterest.com/pin/create/bookmarklet/?media=%IMAGE%&url=%URL%&is_video=false&description=%DESCRIPTION%&title=%TITLE%',
'label' => 'Pinterest',
],
];
@@ -353,7 +353,7 @@ function get_cookie_law_banner()
{
return '<div id="cookie-law-banner" data-cookie="CHV_COOKIE_LAW_DISPLAY"><div class="c24 center-box position-relative"><p class="">' . _s('We use our own and third party cookies to improve your browsing experience and our services. If you continue using our website is understood that you accept this %cookie_policy_link.', [
'%cookie_policy_link' => '<a href="' . get_base_url('page/privacy') . '">' . _s('cookie policy') . '</a>',
]) . '</p><a data-action="cookie-law-close" title="' . _s('I understand') . '" class="cookie-law-close"><span class="icon fas fa-times"></span></a></div></div>' . "\n\n";
]) . '</p><a data-action="cookie-law-close" title="' . _s('I understand') . '" class="cookie-law-close"><span class="icon fas fa-close"></span></a></div></div>' . "\n\n";
}
// Sensitive Cookie law display
function display_cookie_law_banner()
@@ -678,7 +678,7 @@ function replace_tpl_string(string $search, $replace, string $subject)
$subject
);
}
// http://stackoverflow.com/a/9546215
// https://stackoverflow.com/a/9546215
function flatten_array($array, $prefix = '')
{
$result = [];
@@ -1112,6 +1112,11 @@ var disqus_config = function() {
s.setAttribute("data-timestamp", +new Date());
(d.head || d.body).appendChild(s);
})();
document.addEventListener("paletteChanged", function (e) {
if (document.readyState == "complete") {
DISQUS.reset({ reload: true, config: disqus_config });
}
});
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>', [
'%page_url' => Handler::var('canonical') ?? get_current_url(removeQs: ['lang'], public: true),

View File

@@ -37,6 +37,7 @@ use Chevereto\Vars\PostVar;
use Chevereto\Vars\RequestVar;
use Chevereto\Vars\ServerVar;
use Chevereto\Vars\SessionVar;
use ErrorException;
use Exception;
use Intervention\Image\ImageManagerStatic;
use LogicException;
@@ -49,6 +50,7 @@ use Throwable;
use function Chevere\Filesystem\filePhpForPath;
use function Chevere\Message\message;
use function Chevere\Parameter\cast;
use function Chevere\Parameter\getType;
use function Chevere\Writer\streamFor;
use function Chevere\Writer\writers;
use function Chevereto\Legacy\G\absolute_to_url;
@@ -1081,7 +1083,6 @@ function loaderHandler(
'CHEVERETO_EDITION' => 'free',
'CHEVERETO_ENABLE_API_GUEST' => '0',
'CHEVERETO_ENABLE_BANNERS' => '0',
'CHEVERETO_ENABLE_BULK_IMPORTER' => '0',
'CHEVERETO_ENABLE_CAPTCHA' => '0',
'CHEVERETO_ENABLE_CONSENT_SCREEN' => '0',
'CHEVERETO_ENABLE_COOKIE_COMPLIANCE' => '0',
@@ -1168,7 +1169,21 @@ function loaderHandler(
$envVar['CHEVERETO_XRDEBUG_HOST'] = 'host.docker.internal';
}
}
$envVar = array_map('strval', $envVar);
foreach ($envVar as &$envValue) {
if (is_string($envValue)) {
continue;
}
try {
$envValue = (string) $envValue;
} catch (ErrorException) {
$type = getType($envValue);
$envValue = match ($type) {
'array' => '[]',
default => '',
};
}
}
new EnvVar($envVar);
new ServerVar(array_merge($envDefault, $env, $_server));
new CookieVar($_cookie);