Search url changed? Search url changed?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Search url changed?

Started by nickelas, June 10, 2010, 02:31:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nickelas

There are pages linking to my gallery in the format:
http://uppsalafoto.se/galleri/thumbnails.php?album=search&search=domkyrka
(where domkyrka could be any keyword)
After upgrading to 1.5.6 it seems the links are not working. On the search page the link is now displayed as:
http://uppsalafoto.se/galleri/thumbnails.php?album=search&keywords=on&search=domkyrka

- Is a .htaccess redirect the way to solve it (any tips on a general rule appreciated) or is there a simpler way?

Thanks
http://uppsalafoto.se/galleri/
Human

Joachim Müller

Not sure what you mean - http://uppsalafoto.se/galleri/thumbnails.php?album=search&search=domkyrka works exactly as expected and displays 375 results on 6 pages. When using the search form, there are more GET parameters in the URL (out of the box http://uppsalafoto.se/galleri/thumbnails.php?search=domkyrka&submit=search&album=search&title=on&newer_than=&caption=on&older_than=&keywords=on&type=AND when performing a search for "domkyrka"), but the results are exactly the same - you just leave off the default parameters and thus shorten the URL back to  http://uppsalafoto.se/galleri/thumbnails.php?album=search&search=domkyrka if you feel like it. What's your issue?

Joachim

P.S. In cpg1.4.x, the search form used to be POST-driven and only accepted GET parameters as a hidden feature. Now this feature no longer is obfuscted, but visible to everyone. Why do you bother

P.P.S. We can not support you on webserver setup issues. Coming up with custom rewrite rules for your .htaccess files definitely falls into the category "webserver setup". Definitely doesn't fall into the category "regular Coppermine support"

nickelas

Glad to hear the link worked - for me no images are found if I remove &keywords=on
Human

Αndré

Quote from: Joachim Müller on June 10, 2010, 03:17:33 PM
Not sure what you mean - http://uppsalafoto.se/galleri/thumbnails.php?album=search&search=domkyrka works exactly as expected and displays 375 results on 6 pages. When using the search form, there are more GET parameters in the URL (out of the box http://uppsalafoto.se/galleri/thumbnails.php?search=domkyrka&submit=search&album=search&title=on&newer_than=&caption=on&older_than=&keywords=on&type=AND when performing a search for "domkyrka"), but the results are exactly the same - you just leave off the default parameters and thus shorten the URL back to  http://uppsalafoto.se/galleri/thumbnails.php?album=search&search=domkyrka if you feel like it. What's your issue?
That's half true. We changed the code to drop not submitted values, because users had issues while performing different searches (criteria from the old search applied to the new search). See here.


Quote from: nickelas on June 10, 2010, 02:31:45 PM
Is a .htaccess redirect the way to solve it (any tips on a general rule appreciated) or is there a simpler way?
Needs no core file changes. So it's probably the simplest solution. You need mod_rewrite enabled on your server to solve it with the help of an redirection rule.

Αndré

Quote from: nickelas on June 10, 2010, 03:56:03 PM
Glad to hear the link worked - for me no images are found if I remove &keywords=on
It worked for me only on the first time. If you visit that link once more you get no results.

Joachim Müller

Quote from: Αndré on June 10, 2010, 04:01:11 PM
It worked for me only on the first time. If you visit that link once more you get no results.
Correct. Sorry for the misleading answer.

@André: I'm not happy with the current solution. If no GET parameter is given at all for a specific checkbox, we should assume defaults imo to be able to come up with search URLs that are more user friendly. I understand that this can be tricky, since there is actually no data submit by a form for an empty checkbox. The workaround would be some JS tricks, which can of course fail as well. I'll try to come up with a solution for this issue.

Αndré

I'll wait excitedly for your solution 8)

Joachim Müller

Don't expect it too soon - FIFA worldcup will start tomorrow, which means that I'll be sort-off "away" all the time ;)

phill104

I never had you down as a football fan. Germany won't be in the competition long so you'll be back very quickly.
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

Quote from: Phill Luckhurst on June 10, 2010, 08:21:42 PM
Germany won't be in the competition long so you'll be back very quickly.
;D

Joachim Müller

[off topic]
Quote from: Phill Luckhurst on June 10, 2010, 08:21:42 PM
I never had you down as a football fan.
Hm, let me quote some older postings of mine:
Quote from: Joachim Müller on March 04, 2010, 08:36:14 AMHehe, thanks: I worked on that frantically yesterday evening untill the football match Germany vs. Argentina started, that's why I haven't replied earlier - the game had already started when I committed. We lost :'(
Quote from: Joachim Müller on November 17, 2007, 07:09:38 PMItaly is leading by one goal to zero right at the beginning of the second half. But I'm not sure if all coppermine devs are so keen on Soccer  ;)  - I don't think that it's so popular in India. I'm aware that many people in Iran are soccer fans  ;D
Quote from: Joachim Müller on June 11, 2006, 03:00:29 PM
I'll be away (sort off) during the Soccer Worldcup 2006. That is, I'll be here most of the time in body, but not in spirit ;). For those who reside in parts of the world where soccer is not that popular: it's our national passtime, and from June 9th on, the Worldcup takes place in Germany for one month, so I'll spend a lot of time watching the matches with friends.
I'll be "really" away from 2006-06-23 on for ten days or so in Switzerland.
Quote from: Joachim Müller on June 19, 2004, 11:51:26 PMcurrently the European Soccer Championship 2004 "needs" my full attention, with two great matches to watch every day  ;) - that's 3 to 4 hours in front of the tv... [/ot]


Quote from: Phill Luckhurst on June 10, 2010, 08:21:42 PMGermany won't be in the competition long so you'll be back very quickly.
Hehe, let's wait and see then - the last 10 tournaments or so (in fact during my entire life time) I can not remember when England won it or remained in the competition longer than Germany ;D. Maybe because they didn't qualify for all those tournaments ;)
[/off topic]

Joachim Müller

43 hours to the classic match. I'm really looking forward to it. I hope you're not going to be mad at me after our win ;)

phill104

It is bound to end in penalties.
It is a mistake to think you can solve any major problems just with potatoes.

Joachim Müller

Suggestion@devs: to populate defaults and thus allow shorter search URLs, edit thumbnails.php, findif ($superCage->get->keyExists('search')) {

    // find out if a parameter has been submitted at all
    $allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type');

    foreach ($allowed as $key) {
        if ($superCage->get->keyExists($key)) {
            $USER['search']['params'][$key] = $superCage->get->getEscaped($key);
        } else {
            unset($USER['search']['params'][$key]);
        }
    }
and replace withif ($superCage->get->keyExists('search')) {



    // find out if a parameter has been submitted at all

    $allowed = array('title' => 'on', 'caption' => 'on', 'keywords' => 'on', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type' => 'AND');


    foreach ($allowed as $key => $value) {

        if ($superCage->get->keyExists($key)) {

            $USER['search']['params'][$key] = $superCage->get->getEscaped($key);

        } else {

            if ($value != '') {
                $USER['search']['params'][$key] = $value;
            } else {
                unset($USER['search']['params'][$key]);
            }

        }

    }
What do you think of that proposal?

Joachim

[ot]
Sorry, it didn't end in penalties as you feared, but I still hope you're not mad at me ;). The second English goal was good imo: if wishful thinking mattered in football I would have prefered it if the referee would have seen it as goal as well, as it gives a bitter taste to the entire game result that it didn't count.
[/ot]

phill104

[ot]I'm not too bothered, it means all the chavs will take the flags of their cars etc and I can get back to a propper sport such as Rugby[/ot]
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

Quote from: Joachim Müller on June 28, 2010, 09:34:05 AM
$allowed = array('title' => 'on', 'caption' => 'on', 'keywords' => 'on', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type' => 'AND');
If the user unchecks e.g. caption, it will still searched in the caption of the files. So we cannot implement this solution.

Joachim Müller

You're of course right - I should have looked into this in detail - we'll need some hidden fields that get populated by JS then.

Αndré

Do you remember support requests like 'Album password box does not appear'? I'm sure that we get new support requests if users have disabled JS in their browser and try to search sth. in their gallery. Is it worth the trouble just to get shorter urls?

The only solution to get shorter urls and create a fool proof search form is using radio buttons instead of check boxes.

Joachim Müller

I will of course have to take that into account - search engine spiders don't have JavaScript neither.

Αndré

So maybe the best solution is the following?

- Use radio buttons on the search form
- Replace radio buttons with checkboxes + hidden form field via JS. Use checkbox to set/update the value of the appropriate hidden form field