Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2   Go Down

Author Topic: Search url changed?  (Read 7622 times)

0 Members and 1 Guest are viewing this topic.

nickelas

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Search url changed?
« on: June 10, 2010, 02:31:45 pm »

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/
Logged
Human

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #1 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?

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"
Logged

nickelas

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: Search url changed?
« Reply #2 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
Logged
Human

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Search url changed?
« Reply #3 on: June 10, 2010, 04:00:27 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.


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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Search url changed?
« Reply #4 on: June 10, 2010, 04:01:11 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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #5 on: June 10, 2010, 04:37:43 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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Search url changed?
« Reply #6 on: June 10, 2010, 05:20:55 pm »

I'll wait excitedly for your solution 8)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #7 on: June 10, 2010, 05:32:10 pm »

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

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4822
    • Windsurf.me
Re: Search url changed?
« Reply #8 on: June 10, 2010, 08:21:42 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Search url changed?
« Reply #9 on: June 10, 2010, 08:46:53 pm »

Germany won't be in the competition long so you'll be back very quickly.
;D
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #10 on: June 11, 2010, 07:34:44 am »

[off topic]
I never had you down as a football fan.
Hm, let me quote some older postings of mine:
Hehe, 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 :'(
Italy 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
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.
currently 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]

Germany 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]
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #11 on: June 25, 2010, 06:32:51 pm »

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 ;)
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4822
    • Windsurf.me
Re: Search url changed?
« Reply #12 on: June 25, 2010, 07:05:44 pm »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #13 on: June 28, 2010, 09:34:05 am »

Suggestion@devs: to populate defaults and thus allow shorter search URLs, edit thumbnails.php, find
Code: [Select]
if ($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 with
Code: [Select]
if ($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]
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4822
    • Windsurf.me
Re: Search url changed?
« Reply #14 on: June 28, 2010, 10:25:12 am »

[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]
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Search url changed?
« Reply #15 on: June 28, 2010, 12:24:02 pm »

Code: [Select]
$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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #16 on: June 28, 2010, 03:10:13 pm »

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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Search url changed?
« Reply #17 on: June 28, 2010, 03:21:21 pm »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search url changed?
« Reply #18 on: June 28, 2010, 03:25:01 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Search url changed?
« Reply #19 on: June 28, 2010, 03:48:31 pm »

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
Logged
Pages: [1] 2   Go Up
 

Page created in 0.025 seconds with 20 queries.