Skip to content

Commit

Permalink
bugfix search
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasKrais committed Mar 24, 2023
1 parent cb96498 commit 1ee5c1f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
11 changes: 6 additions & 5 deletions fragments/d2u_template_search_icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
spam_protection|honeypot|Bitte nicht ausfüllen|'. \Sprog\Wildcard::get('d2u_helper_module_14_validate_spam_detected') .'|0'. PHP_EOL;
$yform->setFormData(trim($form_data));

$yform->setObjectparams('submit_btn_show', false);
$yform->setObjectparams('csrf_protection', false);
$yform->setObjectparams('Error-occured', \Sprog\Wildcard::get('d2u_helper_module_form_validate_title'));
$yform->setObjectparams('form_action', rex_getUrl($article_id_search));
$yform->setObjectparams('form_anchor', 'search-field');
$yform->setObjectparams('Error-occured', \Sprog\Wildcard::get('d2u_helper_module_form_validate_title'));
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('form_name', 'd2u_helper_search_box_'. rand(1, 100));
$yform->setObjectparams('form_showformafterupdate', true);
$yform->setObjectparams('hide_top_warning_messages', true);
$yform->setObjectparams('hide_field_warning_messages', true);
$yform->setObjectparams('form_name', 'd2u_helper_search_box_'. rand(1, 100));
$yform->setObjectparams('hide_top_warning_messages', true);
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('submit_btn_show', false);

echo $yform->getForm();

Expand Down
2 changes: 1 addition & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
4);
$modules[] = new D2UModule('14-1',
'Search It Suchmodul',
4);
5);
$modules[] = new D2UModule('15-1',
'Kategorie mit Liste der Unterkategorien',
3);
Expand Down
2 changes: 1 addition & 1 deletion lib/D2UModuleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static function getModules()
4);
$modules[] = new D2UModule('14-1',
'Search It Suchmodul',
4);
5);
$modules[] = new D2UModule('15-1',
'Kategorie mit Liste der Unterkategorien',
3);
Expand Down
5 changes: 3 additions & 2 deletions modules/11/1/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@

$yform->setFormData(trim($form_data));

$yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId()));
$yform->setObjectparams('csrf_protection', false);
$yform->setObjectparams('Error-occured', \Sprog\Wildcard::get('d2u_helper_module_form_validate_title'));
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('form_action', rex_getUrl(rex_article::getCurrentId()));
$yform->setObjectparams('form_name', 'd2u_helper_module_11_1_'. rand(1, 100));
$yform->setObjectparams('real_field_names', true);

// action - showtext
$yform->setActionField('showtext', [\Sprog\Wildcard::get('d2u_helper_module_form_thanks')]);
Expand Down
16 changes: 9 additions & 7 deletions modules/14/1/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
spam_protection|honeypot|Bitte nicht ausfüllen|'. $tag_open .'d2u_helper_module_14_validate_spam_detected'. $tag_close .'|0'. PHP_EOL;
$yform->setFormData(trim($form_data));

$yform->setObjectparams('submit_btn_show', false);
$yform->setObjectparams('csrf_protection', false);
$yform->setObjectparams('Error-occured', \Sprog\Wildcard::get('d2u_helper_module_form_validate_title'));
$yform->setObjectparams('form_action', rex_getUrl());
$yform->setObjectparams('form_anchor', 'search-field');
$yform->setObjectparams('Error-occured', \Sprog\Wildcard::get('d2u_helper_module_form_validate_title'));
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('form_showformafterupdate', true);
$yform->setObjectparams('form_name', 'd2u_helper_module_14_1_'. rand(1, 100));
$yform->setObjectparams('form_showformafterupdate', true);
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('submit_btn_show', false);

echo $yform->getForm();

if (rex_plugin::get('search_it', 'autocomplete')->isAvailable()) {
Expand Down Expand Up @@ -72,7 +74,7 @@

echo '<a name="search-results"></a>';
echo '<h2 class="search_it-headline">'. $tag_open .'d2u_helper_module_14_search_results'. $tag_close .'</h2>';
if ($result['count']) {
if ((int) $result['count'] > 0) {
// Pagination
$pagination = '';
if ($result['count'] > $limit) {
Expand Down Expand Up @@ -112,8 +114,8 @@
} elseif ('url' === $hit['type']) {
// url hits
$url_sql = rex_sql::factory();
$url_sql->setTable(rex::getTablePrefix() . \Url\UrlManagerSql::TABLE_NAME);
$url_sql->setWhere("url_hash = '". $hit['fid'] ."'");
$url_sql->setQuery('SELECT * FROM '. rex::getTablePrefix() . \Url\UrlManagerSql::TABLE_NAME .' WHERE url_hash = "'. $hit['fid'] .'"');

// Check in case URL IDs changed
if ($url_sql->getRows() > 0) {
$article_hit = rex_article::get((int) $url_sql->getValue('article_id'));
Expand Down
4 changes: 2 additions & 2 deletions pages/help.changelog.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div class="panel panel-edit">
<header class="panel-heading"><div class="panel-title">D2U Helper Changelog</div></header>
<div class="panel-body">
<p>1.10.3-DEV</p>
<p>1.10.3</p>
<ul>
<li>...</li>
<li>Modul 14-1 "Search It Suchmodul": Fehlerbehebung für Sucheergebnissen mit URLs aus dem URL Addon.</li>
</ul>
<p>1.10.2</p>
<ul>
Expand Down

0 comments on commit 1ee5c1f

Please sign in to comment.