From b30eafd055ce17e0b838f45a987aca25418b206e Mon Sep 17 00:00:00 2001 From: Tobias Krais Date: Fri, 24 Mar 2023 13:15:11 +0100 Subject: [PATCH] a lot bugfixes --- install.php | 2 +- lib/d2u_guestbook_lang_helper.php | 4 +- lib/d2u_guestbook_module_manager.php | 2 +- modules/60/1/output.php | 131 ++++++++++++++------------- modules/60/1/style.css | 4 +- modules/60/2/output.php | 45 +++++---- modules/60/2/style.css | 22 ++--- modules/60/3/output.php | 119 +++++++++++++----------- pages/setup.php | 6 +- 9 files changed, 183 insertions(+), 152 deletions(-) diff --git a/install.php b/install.php index bbeeec2..714ab90 100644 --- a/install.php +++ b/install.php @@ -28,7 +28,7 @@ 12); $modules[] = new D2UModule('60-2', 'D2U Guestbook - Infobox Bewertung', - 2); + 3); $modules[] = new D2UModule('60-3', 'D2U Guestbook - Gästebuch ohne Tabs', 10); diff --git a/lib/d2u_guestbook_lang_helper.php b/lib/d2u_guestbook_lang_helper.php index 394eb89..ece60ae 100644 --- a/lib/d2u_guestbook_lang_helper.php +++ b/lib/d2u_guestbook_lang_helper.php @@ -26,6 +26,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper 'd2u_guestbook_form_validate_spam_detected' => 'Your message was classified as spam, because not visible fields were filled in.', 'd2u_guestbook_form_validate_title' => 'Failure sending message:', 'd2u_guestbook_no' => 'No', + 'd2u_guestbook_no_entries' => 'Currently there are noch entries or ratings available.', 'd2u_guestbook_oclock' => 'h', 'd2u_guestbook_page' => 'Page', 'd2u_guestbook_rating' => 'Customer quality and service rating', @@ -41,7 +42,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper * value the replacement. */ protected array $replacements_german = [ - 'd2u_guestbook_form_email' => 'E-Mail-SAdresse', + 'd2u_guestbook_form_email' => 'E-Mail-Adresse', 'd2u_guestbook_form_message' => 'Nachricht', 'd2u_guestbook_form_name' => 'Name', 'd2u_guestbook_form_privacy_policy' => 'Ich willige in die Speicherung und Verarbeitung meiner Kontakt- und Nutzungsdaten durch den Betreiber des Gästebuches ein. Über den Umfang der Datenverarbeitung habe ich mich hier informiert. Ich habe das Recht dieser Verwendung jederzeit unter den im Impressum angegebenen Kontaktdaten zu widersprechen.', @@ -58,6 +59,7 @@ class d2u_guestbook_lang_helper extends \D2U_Helper\ALangHelper 'd2u_guestbook_form_validate_spam_detected' => 'Ihr Eintrag wurde als Spam eingestuft, da nicht sichtbare Felder ausgefüllt wurden.', 'd2u_guestbook_form_validate_title' => 'Fehler beim Senden:', 'd2u_guestbook_no' => 'Nein', + 'd2u_guestbook_no_entries' => 'Es sind noch keine Gästebucheinträge und Bewertungen vorhanden.', 'd2u_guestbook_oclock' => 'Uhr', 'd2u_guestbook_page' => 'Seite', 'd2u_guestbook_rating' => 'Kundenbewertung in Qualität, Service und Zuverlässigkeit', diff --git a/lib/d2u_guestbook_module_manager.php b/lib/d2u_guestbook_module_manager.php index a3c3f98..38d4a9f 100644 --- a/lib/d2u_guestbook_module_manager.php +++ b/lib/d2u_guestbook_module_manager.php @@ -18,7 +18,7 @@ public static function getModules() 12); $modules[] = new D2UModule('60-2', 'D2U Guestbook - Infobox Bewertung', - 2); + 3); $modules[] = new D2UModule('60-3', 'D2U Guestbook - Gästebuch ohne Tabs', 10); diff --git a/modules/60/1/output.php b/modules/60/1/output.php index ffeb67e..7e41cec 100644 --- a/modules/60/1/output.php +++ b/modules/60/1/output.php @@ -45,52 +45,58 @@ function sendAdminNotification($yform) $entries = \D2U_Guestbook\Entry::getAll(true); $page_no = 0; -for ($i = 0; $i < count($entries); ++$i) { - $entry = $entries[$i]; - - if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) { - ++$page_no; - if (1 != $page_no) { - echo ''; +if(0 === count($entries)) { + echo '

'. \Sprog\Wildcard::get('d2u_guestbook_no_entries') . '

'; +} +else { + for ($i = 0; $i < count($entries); ++$i) { + $entry = $entries[$i]; + + if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) { + ++$page_no; + if (1 != $page_no) { + echo ''; + } + echo '
'; // Pagination div } - echo '
'; // Pagination div - } - echo '
'; - - echo '
'; - echo '
'; - echo '
'; - if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) { - echo ''; - echo $entry->name .' '; - echo ''; - } else { - echo $entry->name; - } - echo '
'; - echo '
'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'
'; - echo '
'; - echo '
'; - - echo '
'; - echo '
'; - echo '
'. nl2br($entry->description) .'
'; - if (!$hide_rating && $entry->rating > 0) { - echo '
'. $tag_open .'d2u_guestbook_rating'. $tag_close .': '; - for ($j = 1; $j <= 5; ++$j) { - if ($j <= $entry->rating) { - echo ' '; - } else { - echo ' '; - } + echo '
'; + + echo '
'; + echo '
'; + echo '
'; + if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) { + echo ''; + echo $entry->name .' '; + echo ''; + } else { + echo $entry->name; } echo '
'; - } - echo '
'; - echo '
'; + echo '
'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'
'; + echo '
'; + echo '
'; + + echo '
'; + echo '
'; + echo '
'. nl2br($entry->description) .'
'; + if (!$hide_rating && $entry->rating > 0) { + echo '
'. $tag_open .'d2u_guestbook_rating'. $tag_close .': '; + for ($j = 1; $j <= 5; ++$j) { + if ($j <= $entry->rating) { + echo ' '; + } else { + echo ' '; + } + } + echo '
'; + } + echo '
'; + echo '
'; - echo '
'; + echo '
'; + echo '
'; + } } echo '
'; // tab_guestbook @@ -119,8 +125,6 @@ function changePage(pageno) { echo '
'; } -echo ''; - // Entry Form echo '
'; echo '
'; @@ -128,32 +132,35 @@ function changePage(pageno) { echo '
'. $tag_open .'d2u_guestbook_tab_write'. $tag_close .''; ?> '; +$stars = ''; +for($i = 1; $i <= 5; $i++) { + $stars .= ' '; +} $form_data = ' text|name|'. $tag_open .'d2u_guestbook_form_name'. $tag_close .' * email|email|'. $tag_open .'d2u_guestbook_form_email'. $tag_close .' @@ -183,11 +190,12 @@ function click_stars(wert) { $yform = new rex_yform(); $yform->setFormData(trim($form_data)); -$yform->setObjectparams('real_field_names', true); +$yform->setObjectparams('csrf_protection', false); +$yform->setObjectparams('Error-occured', $tag_open .'d2u_guestbook_form_validate_title'. $tag_close); $yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId())); $yform->setObjectparams('form_anchor', 'tab_write'); -$yform->setObjectparams('Error-occured', $tag_open .'d2u_guestbook_form_validate_title'. $tag_close); $yform->setObjectparams('form_name', 'd2u_guestbook_module_60_1_'. rand(1, 100)); +$yform->setObjectparams('real_field_names', true); // action - showtext $yform->setActionField('showtext', [$tag_open .'d2u_guestbook_form_thanks'. $tag_close]); @@ -199,6 +207,9 @@ function click_stars(wert) { // End request form echo '
'; // tab_write +echo '
'; // tab_content + +echo ''; echo ''; echo ''; ?> @@ -210,7 +221,5 @@ function click_stars(wert) { }); // set stars on failure page correctly - set_stars($('input[name=rating]').val()); - - - \ No newline at end of file + d2u_guestbook_module_60_1_set_stars($('input[name=rating]').val()); + \ No newline at end of file diff --git a/modules/60/1/style.css b/modules/60/1/style.css index 9f67a5c..1b98259 100644 --- a/modules/60/1/style.css +++ b/modules/60/1/style.css @@ -50,7 +50,9 @@ a.recommendation:hover { content: "\f006"; } - +#guestbook_tabs { + border-bottom: none; +} #guestbook_tabs a.active { background-color: navi_color_bg; } diff --git a/modules/60/2/output.php b/modules/60/2/output.php index a5f0bfd..4740c67 100644 --- a/modules/60/2/output.php +++ b/modules/60/2/output.php @@ -9,34 +9,39 @@ $rating = round(D2U_Guestbook\Entry::getRating(), 1); $num_recommendations = D2U_Guestbook\Entry::getRecommendation(); - +$entries = D2U_Guestbook\Entry::getAll(true); ?>
getConfig('guestbook_article_id')) .'" class="recommendation">'; + if(0 === count($entries)) { + echo '

'. \Sprog\Wildcard::get('d2u_guestbook_no_entries') . '

'; } - echo ''; - if ($show_link) { - echo ''; - echo ''; - } - echo $tag_open .'d2u_guestbook_recommended_pre'. $tag_close .' '. $num_recommendations .' '. $tag_open .'d2u_guestbook_recommended_post'. $tag_close; - if ($show_link) { - echo ''; } ?>
diff --git a/modules/60/2/style.css b/modules/60/2/style.css index 3703316..425da5c 100644 --- a/modules/60/2/style.css +++ b/modules/60/2/style.css @@ -9,18 +9,18 @@ url("./assets/addons/be_style/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular") format('svg'); } -.right { - text-align: right; -} -.entry-body { - padding: 0.25em 1em 2em 1em; -} -.entry-header { - background-color: article_color_box; - border-bottom: 1px solid navi_color_bg; - padding: 0.25em 1em; + +article .infobox-header { + background-color: article_color_h; + color: #ffffff; + padding: 0.25em 0.75em; + text-align: center; +} +article .infobox { + border: 1px solid article_color_h; + margin-bottom: 1em; width: 100%; -} + } .recommendation-stars { font-size: 1.5em; } diff --git a/modules/60/3/output.php b/modules/60/3/output.php index 7e11755..900e13e 100644 --- a/modules/60/3/output.php +++ b/modules/60/3/output.php @@ -21,32 +21,35 @@ function sendAdminNotification($yform) echo '
'. $tag_open .'d2u_guestbook_tab_write'. $tag_close .''; ?> '; + $stars = ''; + for($i = 1; $i <= 5; $i++) { + $stars .= ' '; + } $form_data = ' text|name|'. $tag_open .'d2u_guestbook_form_name'. $tag_close .' * email|email|'. $tag_open .'d2u_guestbook_form_email'. $tag_close .' @@ -76,10 +79,11 @@ function click_stars(wert) { $yform = new rex_yform(); $yform->setFormData(trim($form_data)); - $yform->setObjectparams('real_field_names', true); - $yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId(), null, ['entry' => 'add'])); + $yform->setObjectparams('csrf_protection', false); $yform->setObjectparams('Error-occured', $tag_open .'d2u_guestbook_form_validate_title'. $tag_close); + $yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId(), null, ['entry' => 'add'])); $yform->setObjectparams('form_name', 'd2u_guestbook_module_60_3_'. rand(1, 100)); + $yform->setObjectparams('real_field_names', true); // action - showtext $yform->setActionField('showtext', [$tag_open .'d2u_guestbook_form_thanks'. $tag_close]); @@ -89,60 +93,65 @@ function click_stars(wert) { echo '
'; // End request form } else { + $entries = D2U_Guestbook\Entry::getAll(true); + $page_no = 0; // Add entry button echo '
'; - echo '

'; + if(0 === count($entries)) { + echo '

'. \Sprog\Wildcard::get('d2u_guestbook_no_entries') . '

'; + } + echo '

'; echo '
'; // Entries echo '
'; - $entries = D2U_Guestbook\Entry::getAll(true); - $page_no = 0; - for ($i = 0; $i < count($entries); ++$i) { - $entry = $entries[$i]; + if(count($entries) > 0) { + for ($i = 0; $i < count($entries); ++$i) { + $entry = $entries[$i]; - if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) { - ++$page_no; - if (1 != $page_no) { - echo '
'; + if (0 == $i % rex_config::get('d2u_guestbook', 'no_entries_page', 10)) { + ++$page_no; + if (1 != $page_no) { + echo '
'; + } + echo '
'; // Pagination div } - echo '
'; // Pagination div - } - echo '
'; - echo '
'; - echo '
'; - echo '
'. $tag_open .'d2u_guestbook_form_name'. $tag_close .': '; - if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) { - echo ''; - echo $entry->name .' '; - echo ''; - } else { - echo $entry->name; - } - echo '
'; - echo '
'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'
'; - echo '
'; - echo '
'; + echo '
'; + echo '
'; + echo '
'; + echo '
'. $tag_open .'d2u_guestbook_form_name'. $tag_close .': '; + if ('' != $entry->email && 'true' == rex_config::get('d2u_guestbook', 'allow_answer', 'false')) { + echo ''; + echo $entry->name .' '; + echo ''; + } else { + echo $entry->name; + } + echo '
'; + echo '
'. date('d.m.Y H:i', strtotime($entry->create_date)) .' '. $tag_open .'d2u_guestbook_oclock'. $tag_close .'
'; + echo '
'; + echo '
'; - echo '
'; - echo '
'; - echo '
'. nl2br($entry->description) .'
'; - if ($entry->rating > 0) { - echo '
'. $tag_open .'d2u_guestbook_rating'. $tag_close .': '; - for ($j = 1; $j <= 5; ++$j) { - if ($j <= $entry->rating) { - echo ' '; - } else { - echo ' '; + echo '
'; + echo '
'; + echo '
'. nl2br($entry->description) .'
'; + if ($entry->rating > 0) { + echo '
'. $tag_open .'d2u_guestbook_rating'. $tag_close .': '; + for ($j = 1; $j <= 5; ++$j) { + if ($j <= $entry->rating) { + echo ' '; + } else { + echo ' '; + } } + echo '
'; } - echo '
'; - } - echo '
'; - echo '
'; + echo '
'; + echo '
'; - echo '
'; + echo '
'; + } } echo '
'; // End pagination // Page selection diff --git a/pages/setup.php b/pages/setup.php index 876526d..5aea7f0 100644 --- a/pages/setup.php +++ b/pages/setup.php @@ -44,6 +44,9 @@ Verzeichnis im Pfad modules/60/Nummer des Moduls/styles.css.

Beispielseiten

1.0.9: