Skip to content

Commit

Permalink
Merge pull request #736 from hhunderter/Version-2.1.52---Beta
Browse files Browse the repository at this point in the history
V2.1.52
  • Loading branch information
hhunderter authored Aug 20, 2023
2 parents 73ae397 + bcd5cd3 commit 619a311
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 28 deletions.
14 changes: 10 additions & 4 deletions application/libraries/Ilch/Config/Install.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<?php

/**
* @copyright Ilch 2
* @package ilch
*/

namespace Ilch\Config;

use Ilch\Registry;

class Install extends \Ilch\Mapper
{
/**
* @var \Ilch\Translator
* @var \Ilch\Translator|null
*/
private $translator;

/**
* @param \Ilch\Translator $translator
* @param null|\Ilch\Translator $translator
*/
public function __construct(\Ilch\Translator $translator = null)
public function __construct(?\Ilch\Translator $translator = null)
{
$this->translator = $translator;
parent::__construct();
Expand All @@ -25,8 +28,11 @@ public function __construct(\Ilch\Translator $translator = null)
/**
* @return \Ilch\Translator
*/
public function getTranslator()
public function getTranslator(): \Ilch\Translator
{
if (!$this->translator) {
$this->translator = Registry::get('translator');
}
return $this->translator;
}
}
2 changes: 1 addition & 1 deletion application/modules/admin/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ public function getUpdate($installedVersion)

$notificationModel->setModule('bbcodeconvert');
$notificationModel->setMessage($message[$this->getTranslator()->shortenLocale($this->getTranslator()->getLocale())]);
$notificationModel->setURL(BASE_URL . '/' . 'admin/admin/modules/notinstalled');
$notificationModel->setURL(BASE_URL . '/index.php/' . 'admin/admin/modules/notinstalled');
$notificationModel->setType('bbcodeconvertAvailableForInstallation');

$notificationsMapper->addNotification($notificationModel);
Expand Down
17 changes: 10 additions & 7 deletions application/modules/bbcodeconvert/controllers/admin/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function indexAction()
->set('installedSupportedLayouts', $installedSupportedLayouts)
->set('maintenanceModeEnabled', $this->getConfig()->get('maintenance_mode'))
->set('lastBackup', $backupMapper->getLastBackup())
->set('converted', (json_decode($this->getConfig()->get('bbcodeconvert_converted'), true)) ?? [])
->set('converted', (json_decode($this->getConfig()->get('bbcodeconvert_converted') ?? '', true)) ?? [])
->set('getHtmlFromBBCodeExists', $getHtmlFromBBCodeExists);
}

Expand Down Expand Up @@ -169,7 +169,7 @@ public function convertAction()
$converted[$value['key']] = $value['completed'];
}

$knownConverted = (json_decode($this->getConfig()->get('bbcodeconvert_converted'), true)) ?? [];
$knownConverted = (json_decode($this->getConfig()->get('bbcodeconvert_converted') ?? '', true)) ?? [];
$knownConverted = array_merge($knownConverted, $converted);
$this->getConfig()->set('bbcodeconvert_converted', json_encode($knownConverted));

Expand Down Expand Up @@ -221,7 +221,7 @@ public function getCount(string $key): int
$textsMapper->table = 'kvticket';
break;
case 'radiohoerercharts':
// table: config, column: value, datatype: VARCHAR(191)
// table: config, column: value, datatype: TEXT
return 2;
case 'teams':
// table: teams_joins, column: text, datatype: LONGTEXT
Expand Down Expand Up @@ -435,11 +435,14 @@ public function convert(string $key, int $index, int $progress, string $currentT
// table: admin_layoutadvsettings, column: value, datatype: TEXT
$layoutAdvSettingsMapper = new LayoutAdvSettings();

$model[] = $layoutAdvSettingsMapper->getSetting('privatlayout', 'siteInfo');
$model[0]->setValue(nl2br($this->getView()->getHtmlFromBBCode($model[0]->getValue())));
$model = $layoutAdvSettingsMapper->getSetting('privatlayout', 'siteInfo');

if (!empty($model)) {
$model->setValue(nl2br($this->getView()->getHtmlFromBBCode($model->getValue())));

if (strlen($model[0]->getValue()) <= self::limitText) {
$layoutAdvSettingsMapper->save($model);
if (strlen($model->getValue()) <= self::limitText) {
$layoutAdvSettingsMapper->save([$model]);
}
}

return ['completed' => true, 'index' => 0, 'progress' => 1];
Expand Down
5 changes: 4 additions & 1 deletion application/modules/bbcodeconvert/translations/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
'radiohoerercharts' => 'Radio Hörer Charts',
'teams' => 'Teams',
'user' => 'Benutzer',
'privatlayout' => 'Ilch-Privat',
'noModulesToConvert' => 'Keine unterstützen Module gefunden.',
'noLayoutsToConvert' => 'Keine unterstützen Layouts gefunden.',
'menuConvert' => 'BBCode-Konvertierung',
'menuOverview' => 'Übersicht',
'menuNote' => 'Hinweis',
Expand All @@ -28,7 +31,7 @@
'warningMaintenanceMode' => 'Es wird empfohlen die Seite vor der Konvertierung von Inhalten in den Wartungsmodus zu versetzen.',
'warningBackup' => 'Es wird dringend empfohlen vor der Konvertierung eine Sicherheitskopie der Datenbank zu erstellen. Letzte Sicherheitskopie vom: %s',
'noBackup' => 'Keine Sicherheitskopie gefunden!',
'infoMessage' => 'Die folgenden unterstützten Module und Layouts wurden gefunden und können konvertiert werden, indem Sie ausgewählt werden und die Konvertierung gestartet wird:',
'infoMessage' => 'Die unten aufgelisteten unterstützten Module und Layouts wurden gefunden und können konvertiert werden. Hierzu wählen Sie sie aus und starten über das untere Menü die Konvertierung. Die Seite während der Konvertierung bitte nicht schließen. Sie wird sich während der Konvertierung mehrfach aktualisieren bis die Konvertierung abgeschlossen ist.',
'convert' => 'konvertieren',
'confirmConvert' => 'Wollen Sie die Konvertierung für die ausgewählten Module und Layouts starten?',
'redirectAfterPause' => 'Diese Seite leitet nach 3 Sekunden weiter um die Arbeit fortzusetzen.',
Expand Down
5 changes: 4 additions & 1 deletion application/modules/bbcodeconvert/translations/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
'radiohoerercharts' => 'Radio Listener Charts',
'teams' => 'Teams',
'user' => 'User',
'privatlayout' => 'Ilch-Privat',
'noModulesToConvert' => 'No supported modules found.',
'noLayoutsToConvert' => 'No supported layouts found.',
'menuConvert' => 'BBCode conversion',
'menuOverview' => 'Overview',
'menuNote' => 'About',
Expand All @@ -28,7 +31,7 @@
'warningMaintenanceMode' => 'It is recommended to set the site to maintenance mode before converting content.',
'warningBackup' => 'It is strongly recommended to create a backup before converting content. Last backup created on: %s',
'noBackup' => 'No backup found!',
'infoMessage' => 'The following supported modules and layouts where found an can be converted by selecting them and starting the conversion:',
'infoMessage' => 'The supported modules and layouts listed below where found and can be converted. Choose the ones you wish to convert and start the conversion by the menu at the bottom. Please don\'t close the page while the conversion is running. The page gets refreshed several times until the conversion is done.',
'convert' => 'convert',
'confirmConvert' => 'Do you want to start the convertion for the selected modules and layouts?',
'redirectAfterPause' => 'The page will redirect after a delay of 3 seconds to continue the work.',
Expand Down
9 changes: 9 additions & 0 deletions application/modules/bbcodeconvert/views/admin/index/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

<form class="form-horizontal" method="POST" action="">
<?=$this->getTokenField() ?>
<?php if (!empty($this->get('installedSupportedModules'))) : ?>
<div class="table-responsive">
<table id="sortTable" class="table table-hover table-striped">
<colgroup>
Expand Down Expand Up @@ -60,7 +61,11 @@
</tbody>
</table>
</div>
<?php else : ?>
<p><?=$this->getTrans('noModulesToConvert') ?></p>
<?php endif; ?>

<?php if (!empty($this->get('installedSupportedLayouts'))) : ?>
<div class="table-responsive">
<table id="sortTable" class="table table-hover table-striped">
<colgroup>
Expand Down Expand Up @@ -89,6 +94,10 @@
</tbody>
</table>
</div>
<?php else : ?>
<p><?=$this->getTrans('noLayoutsToConvert') ?></p>
<?php endif; ?>


<div class="content_savebox">
<input type="hidden" class="content_savebox_hidden" name="action" value="convert" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<?=$topic->getTopicTitle() ?>
</a>
<?php if ($topic->getType() == '1'): ?>
<i class="fa-solid fa-table-cellsumb-tack"></i>
<i class="fa-solid fa-thumbtack"></i>
<?php endif; ?>
<br>
<div class="small">
Expand Down
2 changes: 1 addition & 1 deletion application/modules/forum/views/showactivetopics/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<?=$topic->getTopicTitle() ?>
</a>
<?php if ($topic->getType() == '1'): ?>
<i class="fa-solid fa-table-cellsumb-tack"></i>
<i class="fa-solid fa-thumbtack"></i>
<?php endif; ?>
<br>
<div class="small">
Expand Down
2 changes: 1 addition & 1 deletion application/modules/forum/views/shownewposts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<?=$topic->getTopicTitle() ?>
</a>
<?php if ($topic->getType() == '1'): ?>
<i class="fa-solid fa-table-cellsumb-tack"></i>
<i class="fa-solid fa-thumbtack"></i>
<?php endif; ?>
<br>
<div class="small">
Expand Down
4 changes: 2 additions & 2 deletions application/modules/forum/views/showposts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@
?>
<?php if ($this->getUser() && !in_array($this->getUser()->getId(), $votes)) : ?>
<a class="btn btn-sm btn-default btn-hover-success" href="<?=$this->getUrl(['id' => $post->getId(), 'action' => 'vote', 'topicid' => $this->getRequest()->getParam('topicid')]) ?>" title="<?=$this->getTrans('iLike') ?>">
<i class="fa-solid fa-table-cellsumbs-up"></i> <?=$countOfVotes ?>
<i class="fa-solid fa-thumbs-up"></i> <?=$countOfVotes ?>
</a>
<?php else: ?>
<button class="btn btn-sm btn-default btn-success">
<i class="fa-solid fa-table-cellsumbs-up"></i> <?=$countOfVotes ?>
<i class="fa-solid fa-thumbs-up"></i> <?=$countOfVotes ?>
</button>
<?php endif; ?>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion application/modules/forum/views/showtopics/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<?=$this->escape($topic->getTopicTitle()) ?>
</a>
<?php if ($topic->getType() == '1'): ?>
<i class="fa-solid fa-table-cellsumb-tack"></i>
<i class="fa-solid fa-thumbtack"></i>
<?php endif; ?>
<br>
<div class="small">
Expand Down
8 changes: 4 additions & 4 deletions application/modules/shoutbox/mappers/Shoutbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Shoutbox extends \Ilch\Mapper
/**
* Check if DB-Table exists
*
* @return boolean
* @return bool
* @throws \Ilch\Database\Exception
* @since 1.5.0
*/
Expand All @@ -33,7 +33,7 @@ public function checkDB(): bool
* @param array $where
* @param array $orderBy
* @param \Ilch\Pagination|null $pagination
* @return ShoutboxModel[]|null
* @return ShoutboxModel[]|array
* @since 1.5.0
*/
public function getEntriesBy(array $where = [], array $orderBy = ['text' => 'ASC'], ?\Ilch\Pagination $pagination = null): ?array
Expand All @@ -54,7 +54,7 @@ public function getEntriesBy(array $where = [], array $orderBy = ['text' => 'ASC

$entryArray = $result->fetchRows();
if (empty($entryArray)) {
return null;
return [];
}

$entries = [];
Expand Down Expand Up @@ -121,7 +121,7 @@ public function save(ShoutboxModel $shoutbox): int
/**
* Deletes shoutbox with given id.
*
* @param integer $id
* @param int $id
* @return bool
*/
public function delete(int $id): bool
Expand Down
9 changes: 5 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright Ilch 2
* @package ilch
Expand All @@ -12,7 +13,7 @@
error_reporting(E_ALL);

$isHttps = $_SERVER['HTTPS'] ?? $_SERVER['HTTP_X_FORWARDED_PROTO'] ?? null;
$isHttps = $isHttps && ( strcasecmp('on', $isHttps) == 0 || strcasecmp('https', $isHttps) == 0);
$isHttps = $isHttps && (strcasecmp('on', $isHttps) == 0 || strcasecmp('https', $isHttps) == 0);

define('ISHTTPSPAGE', $isHttps);

Expand All @@ -29,23 +30,23 @@
$serverTimeZone = @date_default_timezone_get();
date_default_timezone_set('UTC');

define('VERSION', '2.1.51');
define('VERSION', '2.1.52');
define('SERVER_TIMEZONE', $serverTimeZone);
define('DEFAULT_MODULE', 'page');
define('DEFAULT_LAYOUT', 'index');
define('DEBUG_MODE', true);

// Path could not be under root.
define('ROOT_PATH', __DIR__);
define('APPLICATION_PATH', __DIR__.'/application');
define('APPLICATION_PATH', __DIR__ . '/application');
define('CONFIG_PATH', APPLICATION_PATH);

$rewriteBaseParts = explode('index.php', str_replace('Index.php', 'index.php', $_SERVER['PHP_SELF']));
$rewriteBaseParts = rtrim(reset($rewriteBaseParts), '/');

define('REWRITE_BASE', $rewriteBaseParts);
$protocol = ISHTTPSPAGE ? 'https' : 'http';
define('BASE_URL', $protocol.'://'.$_SERVER['HTTP_HOST'].REWRITE_BASE);
define('BASE_URL', $protocol . '://' . $_SERVER['HTTP_HOST'] . REWRITE_BASE);

//Get Platform-Version from User-Agent Client Hints
header("Accept-CH: Sec-CH-UA, Sec-CH-UA-Platform-Version");
Expand Down

0 comments on commit 619a311

Please sign in to comment.