user-gallery: backlink to entries - link to drafts

Creating and modifying plugins.
Post Reply
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

user-gallery: backlink to entries - link to drafts

Post by stm999999999 »

hello,

as I see there is a little bug:

on the image pages there is a list of entries using this picture. But it links to entries which are not published, too.

for the static pages it works well.
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: user-gallery: backlink to entries - link to drafts

Post by garvinhicking »

Hi!

The references are counted using visits to the image within an entry...so once it lands in the references-DB table, s9y cannot see if the entry is a drafted or undrafted one, without performing an performance-intense DB crossjoin.

However, in real world this shouldn't be a real problem because the drafts cannot be seen online?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

Äh, what reference-table?

If I see it correct, the code is

Code: Select all

$q = "SELECT e.id, e.timestamp, e.title 
FROM {$serendipity['dbPrefix']}entries AS e 
WHERE (MATCH(e.title, e.body, e.extended) AGAINST ('" . serendipity_db_escape_string($big) . "') 
OR MATCH(e.title, e.body, e.extended) AGAINST ('" . serendipity_db_escape_string($thumb) . "')) 
AND (e.body REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")' 
OR e.extended REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")') 
ORDER BY e.timestamp DESC"; 
$e = serendipity_db_query($q, false, 'assoc');
Should it be not possible to make it like the static pages:

Code: Select all

        $q = "SELECT s.*
                FROM {$serendipity['dbPrefix']}staticpages AS s
               WHERE (MATCH(headline,content) AGAINST('" . serendipity_db_escape_string($big) . "')
                  OR MATCH(headline,content) AGAINST('" . serendipity_db_escape_string($thumb) . "'))
                 AND (s.content    REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")'
                  OR s.content REGEXP '(" . preg_quote(serendipity_db_escape_String($thumb)) . "|" . preg_quote(serendipity_db_escape_string($big)) . ")')
                 AND s.publishstatus = 1
                 AND s.pass = ''
                 GROUP BY s.id
            ORDER BY s.timestamp DESC";
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

From which file/line are you taking this code?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

serendipity_event_usergallery.php

Line:1160 and 1214
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Argl. It seems I should pay attention to posting subject lines :-D

Sorry for misreading you like that. I just committed a patch to version 2.23 of that plugin that should now take 'e.isdraft' into appreciation.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

;-)

Thanks!
Ciao, Stephan
Post Reply