From 68371f344508967e27dd37197ba3f050d202429b Mon Sep 17 00:00:00 2001
From: blackcoder87 <blackcoder@gmx.de>
Date: Wed, 9 Aug 2023 20:17:16 +0200
Subject: [PATCH] Use ilch_html and purify()

Further updated icons for fontawesome 6.
---
 config/config.php                     | 13 ++++++++-----
 controllers/admin/Index.php           |  8 ++++----
 controllers/admin/Settings.php        |  6 +++---
 mappers/HoererCharts.php              |  4 ++--
 translations/de.php                   |  2 +-
 views/admin/index/index.php           | 20 ++++++++++----------
 views/admin/settings/index.php        |  4 ++--
 views/admin/settings/votedatetime.php |  4 ++--
 views/index/index.php                 |  6 +++---
 views/index/treat.php                 |  2 +-
 10 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/config/config.php b/config/config.php
index 163db7b..f3081fe 100644
--- a/config/config.php
+++ b/config/config.php
@@ -13,8 +13,8 @@ class Config extends \Ilch\Config\Install
 {
     public $config = [
         'key' => 'radiohoerercharts',
-        'version' => '1.7.0',
-        'icon_small' => 'fa-list-ol',
+        'version' => '1.8.0',
+        'icon_small' => 'fa-solid fa-list-ol',
         'author' => 'Reilard, Dennis alias hhunderter',
         'link' => 'https://github.com/hhunderter/radiohoerercharts',
         'official' => false,
@@ -28,8 +28,8 @@ class Config extends \Ilch\Config\Install
                 'description' => 'Here you can manage your Listener Charts.',
             ],
         ],
-        'ilchCore' => '2.1.41',
-        'phpVersion' => '7.0',
+        'ilchCore' => '2.1.52',
+        'phpVersion' => '7.3',
     ];
 
     public function install()
@@ -164,7 +164,7 @@ public function getUpdate($installedVersion)
                 $databaseConfig->set('radio_hoerercharts_Program_Name', 'Hörercharts');
                 $fields = [
                     'author' => 'Reilard, Dennis alias hhunderter',
-                    'icon_small' => 'fa-list-ol'
+                    'icon_small' => 'fa-solid fa-list-ol'
                 ];
                 $this->db()->update('modules')
                 ->values($fields)
@@ -320,6 +320,9 @@ public function getUpdate($installedVersion)
                 ->values($fields)
                 ->where(['key' => 'radiohoerercharts'])
                 ->execute();
+            case "1.7.0":
+                // Update icons for fontawesome 6
+                $this->db()->query("UPDATE `[prefix]_modules` SET `icon_small` = '" . $this->config['icon_small'] . "' WHERE `key` = '" . $this->config['key'] . "';");
 
         }
         return 'Update function executed.';
diff --git a/controllers/admin/Index.php b/controllers/admin/Index.php
index fc4bd33..db296e0 100644
--- a/controllers/admin/Index.php
+++ b/controllers/admin/Index.php
@@ -25,19 +25,19 @@ public function init()
             [
                 'name' => 'manage',
                 'active' => false,
-                'icon' => 'fas fa-th-list',
+                'icon' => 'fa-solid fa-table-list',
                 'url' => $this->getLayout()->getUrl(['controller' => 'index', 'action' => 'index'])
             ],
             [
                 'name' => 'reset',
                 'active' => false,
-                'icon' => 'fas fa-trash-alt',
+                'icon' => 'fa-solid fa-trash-can',
                 'url' => $this->getLayout()->getUrl(['controller' => 'index', 'action' => 'reset'])
             ],
             [
                 'name' => 'settings',
                 'active' => false,
-                'icon' => 'fas fa-cogs',
+                'icon' => 'fa-solid fa-gears',
                 'url' => $this->getLayout()->getUrl(['controller' => 'settings', 'action' => 'index'])
             ]
         ];
@@ -46,7 +46,7 @@ public function init()
             $items[0][0] = [
                     'name' => 'add',
                     'active' => false,
-                    'icon' => 'fas fa-plus-circle',
+                    'icon' => 'fa-solid fa-circle-plus',
                     'url' => $this->getLayout()->getUrl(['controller' => 'index', 'action' => 'treat'])
                 ];
             if ($this->getRequest()->getActionName() == 'treat') {
diff --git a/controllers/admin/Settings.php b/controllers/admin/Settings.php
index 1e73d5d..446aeb3 100644
--- a/controllers/admin/Settings.php
+++ b/controllers/admin/Settings.php
@@ -17,19 +17,19 @@ public function init()
             [
                 'name' => 'manage',
                 'active' => false,
-                'icon' => 'fas fa-th-list',
+                'icon' => 'fa-solid fa-table-list',
                 'url' => $this->getLayout()->getUrl(['controller' => 'index', 'action' => 'index'])
             ],
             [
                 'name' => 'reset',
                 'active' => false,
-                'icon' => 'fas fa-trash-alt',
+                'icon' => 'fa-solid fa-trash-can',
                 'url' => $this->getLayout()->getUrl(['controller' => 'index', 'action' => 'reset'])
             ],
             [
                 'name' => 'settings',
                 'active' => true,
-                'icon' => 'fas fa-cogs',
+                'icon' => 'fa-solid fa-gears',
                 'url' => $this->getLayout()->getUrl(['controller' => 'settings', 'action' => 'index'])
             ]
         ];
diff --git a/mappers/HoererCharts.php b/mappers/HoererCharts.php
index 837f7b3..02beaf0 100644
--- a/mappers/HoererCharts.php
+++ b/mappers/HoererCharts.php
@@ -301,8 +301,8 @@ public function getStars(int $votes = 0, bool $showstars = false)
             }
 
             $stars = '';
-            for ($i = 1; $i <= $starcount; $i++) $stars .= '<i class="fas fa-star text-warning"></i>';
-            for ($i = 1; $i <= 5-$starcount; $i++) $stars .= '<i class="far fa-star text-secondary"></i>';
+            for ($i = 1; $i <= $starcount; $i++) $stars .= '<i class="fa-solid fa-star text-warning"></i>';
+            for ($i = 1; $i <= 5-$starcount; $i++) $stars .= '<i class="fa-regular fa-star text-secondary"></i>';
         } else {
             $stars = $votes;
         }
diff --git a/translations/de.php b/translations/de.php
index 08cc749..906e428 100644
--- a/translations/de.php
+++ b/translations/de.php
@@ -35,7 +35,7 @@
     'active' => 'Aktiv',
     'active_list' => 'Aktive Liste',
     'list' => 'Liste',
-    'show_registered_by' => '"Eingetragen von" Info aneigen?',
+    'show_registered_by' => '"Eingetragen von" Info anzeigen?',
     'show_artwork' => 'Cover anzeigen',
     'show_artworkText' => '',
     'selectactive_list' => '',
diff --git a/views/admin/index/index.php b/views/admin/index/index.php
index 369b378..ba5b2c6 100644
--- a/views/admin/index/index.php
+++ b/views/admin/index/index.php
@@ -4,7 +4,7 @@
 <?php if (!$this->get('suggestion') && !$this->get('list')) {
     ?>
     <div class="col-lg-6">
-        <?=$this->getTrans('votedatetime') ?><?=$this->get('votedatetime') ?> <a href="javascript:votedatetime()" title="<?=$this->getTrans('edit') ?>"><span class="fas fa-edit text-success"></span></a>
+        <?=$this->getTrans('votedatetime') ?><?=$this->get('votedatetime') ?> <a href="javascript:votedatetime()" title="<?=$this->getTrans('edit') ?>"><span class="fa-solid fa-pen-to-square text-success"></span></a>
     </div>
     <div class="form-group">
         <label for="filterlist" class="col-lg-2 control-label">
@@ -104,7 +104,7 @@
                         <?php foreach ($this->get('listentries') as $entry) { 
                         $listentries[] = $entry->getHId();
                         ?>
-                            <li class="handle_li" value="<?=$entry->getHId() ?>"><div><span class="fa fa-sort"></span> <?=$entry->getEntry()->getInterpret() ?> - <?=$entry->getEntry()->getSongTitel() ?></div></li>
+                            <li class="handle_li" value="<?=$entry->getHId() ?>"><div><span class="fa-solid fa-sort"></span> <?=$entry->getEntry()->getInterpret() ?> - <?=$entry->getEntry()->getSongTitel() ?></div></li>
                         <?php } ?>
                         </ol>
                     </div>
@@ -114,7 +114,7 @@
                             <ol id="entries" class="sortable connectedSortable">
                             <?php foreach ($this->get('entries') as $entry) { ?>
                                 <?php if (!in_array($entry->getId(), $listentries)) { ?>
-                                <li class="handle_li" value="<?=$entry->getId() ?>"><div><span class="fa fa-sort"></span> <?=$entry->getInterpret() ?> - <?=$entry->getSongTitel() ?></div></li>
+                                <li class="handle_li" value="<?=$entry->getId() ?>"><div><span class="fa-solid fa-sort"></span> <?=$entry->getInterpret() ?> - <?=$entry->getSongTitel() ?></div></li>
                                 <?php } ?>
                             <?php } ?>
                             </ol>
@@ -168,13 +168,13 @@
                     <th>
                         <a href="<?=$this->getUrl(array_merge(['column' => 'interpret'], $urladd)) ?>" title="<?=$this->getTrans('interpret') ?>">
                         <?=$this->getTrans('interpret') ?>
-                        <i class="fas fa-sort<?php echo $this->get('sort_column') == 'interpret' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
+                        <i class="fa-solid fa-sort<?php echo $this->get('sort_column') == 'interpret' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
                         </a>
                     </th>
                     <th>
                         <a href="<?=$this->getUrl(array_merge(['column' => 'songtitel'], $urladd)) ?>" title="<?=$this->getTrans('songtitel') ?>">
                         <?=$this->getTrans('songtitel') ?>
-                        <i class="fas fa-sort<?php echo $this->get('sort_column') == 'songtitel' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
+                        <i class="fa-solid fa-sort<?php echo $this->get('sort_column') == 'songtitel' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
                         </a>
                     </th>
                     <?php if (!$this->get('suggestion')) {
@@ -182,7 +182,7 @@
                     <th>
                         <a href="<?=$this->getUrl(array_merge(['column' => 'votes'], $urladd)) ?>" title="<?=$this->getTrans('vote') ?>">
                         <?=$this->getTrans('vote') ?>
-                        <i class="fas fa-sort<?php echo $this->get('sort_column') == 'votes' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
+                        <i class="fa-solid fa-sort<?php echo $this->get('sort_column') == 'votes' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
                         </a>
                     </th>
                     <?php
@@ -190,13 +190,13 @@
                     <th>
                         <a href="<?=$this->getUrl(array_merge(['column' => 'datecreate'], $urladd)) ?>" title="<?=$this->getTrans('datecreate') ?>">
                         <?=$this->getTrans('datecreate') ?>
-                        <i class="fas fa-sort<?php echo $this->get('sort_column') == 'datecreate' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
+                        <i class="fa-solid fa-sort<?php echo $this->get('sort_column') == 'datecreate' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
                         </a>
                     </th>
                     <th>
                         <a href="<?=$this->getUrl(array_merge(['column' => 'user'], $urladd)) ?>" title="<?=$this->getTrans('user') ?>">
                         <?=$this->getTrans('user') ?>
-                        <i class="fas fa-sort<?php echo $this->get('sort_column') == 'user' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
+                        <i class="fa-solid fa-sort<?php echo $this->get('sort_column') == 'user' ? '-' . str_replace(['ASC', 'DESC'], ['up', 'down'], $this->get('sort_order')) : ''; ?>"></i>
                         </a>
                     </th>
                 </tr>
@@ -212,13 +212,13 @@
                         <?php if (!$this->get('suggestion')) {
                 ?>
                             <a href="<?=$this->getUrl(['action' => 'update', 'id' => $entry->getId(), 'status_man' => -1], null, true) ?>">
-                                <span class="far fa-<?=($entry->getSetFree()?'check-':'') ?>square text-info"></span>
+                                <span class="fa-regular fa-<?=($entry->getSetFree()?'check-':'') ?>square text-info"></span>
                             </a>
                         <?php
             } else {
                 ?>
                             <a href="<?=$this->getUrl(['action' => 'suggestionenable', 'id' => $entry->getId()], null, true) ?>">
-                                <span class="fas fa-reply text-info"></span>
+                                <span class="fa-solid fa-reply text-info"></span>
                             </a>
                         <?php
             } ?>
diff --git a/views/admin/settings/index.php b/views/admin/settings/index.php
index 1502ff1..a943eaf 100644
--- a/views/admin/settings/index.php
+++ b/views/admin/settings/index.php
@@ -205,7 +205,7 @@ class="form-control"
             <textarea class="form-control ckeditor"
                       id="votetext_de"
                       name="votetext_de"
-                      toolbar="ilch_bbcode"
+                      toolbar="ilch_html"
                       required><?=$this->escape($this->originalInput('votetext_de', $this->get('votetext_de'))) ?></textarea>
         </div>
         <div class="form-group col-lg-6">
@@ -213,7 +213,7 @@ class="form-control"
             <textarea class="form-control ckeditor"
                       id="votetext_en"
                       name="votetext_en"
-                      toolbar="ilch_bbcode"
+                      toolbar="ilch_html"
                       required><?=$this->escape($this->originalInput('votetext_en', $this->get('votetext_en'))) ?></textarea>
         </div>
     </div>
diff --git a/views/admin/settings/votedatetime.php b/views/admin/settings/votedatetime.php
index d2b1c2c..085318a 100644
--- a/views/admin/settings/votedatetime.php
+++ b/views/admin/settings/votedatetime.php
@@ -17,7 +17,7 @@ class="form-control"
                    name="start_datetime"
                    value="<?=$start_datetime ?>" />
             <span class="input-group-addon">
-                <span class="fas fa-calendar"></span>
+                <span class="fa-solid fa-calendar"></span>
             </span>
         </div>
     </div>
@@ -34,7 +34,7 @@ class="form-control"
                    name="end_datetime"
                    value="<?=$end_datetime ?>" />
             <span class="input-group-addon">
-                <span class="fas fa-calendar"></span>
+                <span class="fa-solid fa-calendar"></span>
             </span>
         </div>
     </div>
diff --git a/views/index/index.php b/views/index/index.php
index 4ac5848..9d3553e 100644
--- a/views/index/index.php
+++ b/views/index/index.php
@@ -14,7 +14,7 @@
 </h1>
 <div class="teams" id="hoerercharts-container">
     <div class="col-lg-12" id="hoerercharts-form-container">
-    <?=nl2br($this->getHtmlFromBBCode($this->escape($this->get('hoererchartsMapper')->getvotetext()))) ?>
+    <?=$this->purify($this->get('hoererchartsMapper')->getvotetext()) ?>
     <?=((!$this->getUser() and !$hoererchartsconfig['guestallow'])?'':$this->getTrans('votetextvote')) ?><br><br>
     <?php if ($this->get('voted')) {
         ?>
@@ -103,7 +103,7 @@
                     <?php if ($hoererchartsconfig['show_registered_by']) {
                     ?>
                     <?php $User = $userMapper->getUserById($entry->getUser_Id()); ?>
-                    <td><span class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="left" title="<?=$this->getTrans('registered_by') ?>: <?=(!$User?$this->getTrans('guest'):$this->escape($User->getName())) ?>"></span></td>
+                    <td><span class="fa-solid fa-circle-info text-info" data-toggle="tooltip" data-placement="left" title="<?=$this->getTrans('registered_by') ?>: <?=(!$User?$this->getTrans('guest'):$this->escape($User->getName())) ?>"></span></td>
                     <?php
                     } ?>
                 </tr>
@@ -190,7 +190,7 @@
                         <?php if ($hoererchartsconfig['show_registered_by']) {
                         ?>
                         <?php $User = $userMapper->getUserById($entry->getUser_Id()); ?>
-                        <td><span class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="left" title="<?=$this->getTrans('registered_by') ?>: <?=(!$User?$this->getTrans('guest'):$this->escape($User->getName())) ?>"></span></td>
+                        <td><span class="fa-solid fa-circle-info text-info" data-toggle="tooltip" data-placement="left" title="<?=$this->getTrans('registered_by') ?>: <?=(!$User?$this->getTrans('guest'):$this->escape($User->getName())) ?>"></span></td>
                         <?php
                         } ?>
                     </tr>
diff --git a/views/index/treat.php b/views/index/treat.php
index 922f3ee..a51177b 100644
--- a/views/index/treat.php
+++ b/views/index/treat.php
@@ -48,7 +48,7 @@ class="form-control"
                             document.getElementById('captcha').src='<?=$this->getUrl() ?>/application/libraries/Captcha/Captcha.php?'+Math.random();
                             document.getElementById('captcha-form').focus();"
                        id="change-image">
-                        <i class="fas fa-sync"></i>
+                        <i class="fa-solid fa-rotate"></i>
                     </a>
                 </span>
             </div>