Page 1 of 1
[F I X E D] exit.php not redirecting (CVS)
Posted: Fri Jul 09, 2004 4:37 pm
by stephanb
I used a html-nugget sidebar to put in some websites I visit. The html content are only simple <a> tags. S9y generates invalid content:
It generates: http:// <weblog url> /exit.php?url_id=Y for every entry.
mysql> select * from serendipity_references; does not list the html nugget urls, which makes sense.
So I assume I cannot track exits throughout my htmlnugget.
Any idea how to fix this by either disabling the tracking for the html nugget, or to fix tracking?
/Stephan
Re: exit.php not redirecting
Posted: Fri Jul 09, 2004 7:08 pm
by garvinhicking
I guess you're using latest CVS snapshot then?
That's quite weird your getting this behaviour. In case a link is not found inside the references table, it should use old style redirection with the ?url= parameter instead of ?url_id.
Could you please open plugins/serendipity_event_trackexits/serendipity_event_trackexits.php and locate this line:
Code: Select all
if (isset($this->links[$url])) {
return sprintf(
'<a%shref="%sexit.php?url_id=%s%s" title="%s" onmouseover="window.status=\'%s\';return true;" onmouseout="window.status=\'\';return true;"',
$buffer[1],
$serendipity['baseURL'],
$this->links[$url],
($entry_id != 0) ? '&entry_id=' . $entry_id : '',
$url,
$url
);
} else {
return sprintf(
'<a%shref="%sexit.php?url=%s%s" title="%s" onmouseover="window.status=\'%s\';return true;" onmouseout="window.status=\'\';return true;"',
$buffer[1],
$serendipity['baseURL'],
base64_encode($url),
($entry_id != 0) ? '&entry_id=' . $entry_id : '',
$url,
$url
);
}
Then please change it temporarily to:
Code: Select all
if (isset($this->links[$url])) {
echo 'Found URL <u>' . $url . '</u> in array ' . $this->links[$url] . '!<br />';
echo 'Buffer is: ' . print_r($buffer, true) . '<br />';
return sprintf(
'<a%shref="%sexit.php?url_id=%s%s" title="%s" onmouseover="window.status=\'%s\';return true;" onmouseout="window.status=\'\';return true;"',
$buffer[1],
$serendipity['baseURL'],
$this->links[$url],
($entry_id != 0) ? '&entry_id=' . $entry_id : '',
$url,
$url
);
} else {
echo 'Using old style.<br />';
echo 'Buffer is: ' . print_r($buffer, true) . '<br />';
return sprintf(
'<a%shref="%sexit.php?url=%s%s" title="%s" onmouseover="window.status=\'%s\';return true;" onmouseout="window.status=\'\';return true;"',
$buffer[1],
$serendipity['baseURL'],
base64_encode($url),
($entry_id != 0) ? '&entry_id=' . $entry_id : '',
$url,
$url
);
}
And please report the output. And please tell which database you are using (postgre, mysql, sqlite). Thanks!
Regards,
Garvin.
Posted: Fri Jul 09, 2004 7:20 pm
by stephanb
Found URL
http://www.rtp.org/ in array Y!
Buffer is: Array ( [0] => [2] => " [3] =>
www.rtp.org/ [4] => " )
I'm using mysql.
Posted: Fri Jul 09, 2004 7:27 pm
by stephanb
Hold on, looking further I found that $this->links is not filled correctly. Somehow the SQL statement that is supposed to fill this array in serendipity_db_query() is erroring.
$this->links is defined as the mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Lemme see where serendipity_db_query() goes wrong here:
Code: Select all
$this->links = serendipity_db_query("SELECT id, link FROM {$serendipity['dbPrefix']}references WHERE entry_id = {$serendipity['encodeExitsCallback_entry_id']}", false, 'both', false, 'link', 'id');
/Stephan
Posted: Fri Jul 09, 2004 7:40 pm
by stephanb
Code: Select all
"SELECT id, link FROM serendipity_references WHERE entry_id = "
This is how that code evals. There is a definite 'quotation error' there.
Correct me if I'm misinterpreting things here
./Stephan
SOLUTION ?
Posted: Fri Jul 09, 2004 7:50 pm
by stephanb
Code: Select all
$this->links = serendipity_db_query("SELECT id, link FROM {$serendipity['dbPrefix']}references WHERE entry_id = {$serendipity['encodeExitsCallback_entry_id']}", false, 'both', false, 'link', 'id');
needs to be replaced with
Code: Select all
$this->links = serendipity_db_query("SELECT id, link FROM {$serendipity['dbPrefix']}references WHERE entry_id = '{$serendipity['encodeExitsCallback_entry_id']}'", false, 'both', false, 'link', 'id');
The only difference is that I quoted the $serendipity['encodeExitsCallback_entry_id'] variable so the SQL string will eval into:
Code: Select all
"SELECT id, link FROM serendipity_references WHERE entry_id = '' "
Re: SOLUTION ?
Posted: Fri Jul 09, 2004 9:09 pm
by garvinhicking
Hi Stephan!
Thanks a lot for your debugging! I have commited a different patch (
http://garv.info/files/te.diff) to CVS now, which should be somehwat 'cleaner', but basically achieves the same like you coded.
Regards,
Garvin.
Posted: Fri Jul 09, 2004 9:26 pm
by stephanb
You're welcome
glad I could be of help.
I just started to use s9y two days ago to document my move to the USA, and I have to day I really really like it. Keep up the good work!
/Stephan
Re: SOLUTION ?
Posted: Fri Jul 09, 2004 9:58 pm
by stephanb
garvinhicking wrote:Hi Stephan!
Thanks a lot for your debugging! I have commited a different patch (
http://garv.info/files/te.diff) to CVS now, which should be somehwat 'cleaner', but basically achieves the same like you coded.
Is there a delay in the CVS reproductions ?
When I try to checkout the newer entry, I still get :
Code: Select all
<?php # $Id: serendipity_event_trackexits.php,v 1.10 2004/07/05 08:25:50 garvinhicking Exp $
and this is not your updated version with the patch in it.
Re: SOLUTION ?
Posted: Fri Jul 09, 2004 10:18 pm
by garvinhicking
Yes, there sadly is a 24hour delay for anonymous CVS access, so you sadly have to wait. But if you're familar with patch/diff utils you could download the link I gave you and you'll have the patch I committed.
Regards,
Garvin.
Posted: Fri Jul 09, 2004 10:19 pm
by stephanb
I have it already, just wondered