Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues
Author Message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1772

PostPosted: Mon Dec 13, 2010 7:47 am Reply with quote

hi guys!

i have a question about a part of modules/Search/index.php:

Code:
printf('<tr><td><img src="images/folders.gif" border="0" alt="" />&nbsp;<font class="option"><a href="%s"><b>%s</b></a></font><br /><font class="content">'._CONTRIBUTEDBY.' '.$informant.'<br />'._POSTEDBY.' <a href="%s">%s</a>',$furl,$title,$url,$aid,$informant);


in this line are two hyperlinks. the first is the story-link and the 2nd display the name of the author.
story-link:
Code:
<font class="option"><a href="%s"><b>%s</b></a></font>


author's name:
Code:
'._POSTEDBY.' <a href="%s">%s</a>'


i want edit the link to the author's name. but if i take a look with the browser in the the sourcecode, then i found this link without a target:

Code:
<a href="">author's name</a>'


if i click on this "empty" link, then i come to a empty search result. my article was posted with the god-admin, is this the problem or how can i fix this? where is the %s determined?

if i remove the %s from this hyperlink, then its turn off the display of the complete link.

greetz


Last edited by neralex on Mon Dec 13, 2010 3:32 pm; edited 3 times in total 
View user's profile Send private message
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Mon Dec 13, 2010 10:04 am Reply with quote

It looks to me like you may have found a bug. If you look at the code:

Code:
 printf('<tr><td><img src="images/folders.gif" border="0" alt="" />&nbsp;<font class="option"><a href="%s"><b>%s</b></a></font><br /><font class="content">'._CONTRIBUTEDBY.' '.$informant.'<br/>'._POSTEDBY.' <a href="%s">%s</a>',$furl,$title,$url,$aid,$informant);                            echo ' '._ON.' '.$datetime.'<br />'.$match



which by the way is seriously misformatted according to our "standards", you will see that there are four %s's. The variable substitutions that should take place are:

$furl into first %s
$title into second %s
$url into third %s
$aid into the fourth %s
poor $informant has no where to go -- although it is echoed out after the _CONTRIBUTEDBY constant earlier.

I don't have time to experiment but I'd guess that the second instance of the variable $informant could be removed ... the one after the ",$furl ..."

That may not explain your problem however. It does look to me like $aid, which is the administrator who posted the article should be put into the line you quoted:

'._POSTEDBY.' <a href="">author's name</a>'

The value of $aid is retrieved from the stories table with:

Code:
while($row5 = $db->sql_fetchrow($result5) and $x < $offset) {

                            $sid = intval($row5['sid']);
                            $aid = stripslashes($row5['aid']);


up around line 200 of the current code. Of course there's an extraneous stripslashes in there too ... filtering is totally screwed up in this program ... but I suspect that if you look at the table in phpmyadmin you'll find a missing aid field. Or else throw some diagnostics in and echo it out after you retrieve it and see what's going on.

Sorry, I don't have the time to dig any deeper. If you don't understand the way %s are substituted into a printf statement take a look at the PHP manual.
 
View user's profile Send private message Visit poster's website
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Dec 13, 2010 11:27 am Reply with quote

I'll post a revised index.php tonight if I get time.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
neralex







PostPosted: Mon Dec 13, 2010 3:31 pm Reply with quote

fkelly wrote:
'._POSTEDBY.' <a href="">author's name</a>'

it was a copy&paste failure of me:
the correct output on my browser is (author's name = expample for username):
Code:
<a href="">author's name</a>


and thanks for your answers!! palbin thx for your time and your great work.

btw: i can't answer directly to this post of you. i found no buttouns to "submit" or "preview"
 
fkelly







PostPosted: Mon Dec 13, 2010 3:53 pm Reply with quote

It still looks to me like the value for $aid should be within the double quotes after <a href=

Just checking my stories table in phpmyadmin. The field aid, which goes into the variable $aid ... while it may syntantically be interpreted as "author's id" is really the id of the administrator who posted the article. It can be the same as the "informant" who is the true author of the article but it isn't where a normal user (non-admin) submitted the article.

So you should not have a null value between those quotes ... unless I am misinterpreting what you are saying. You really might want to take a look at your stories table and make sure that the aid field is getting filled. And maybe Palbin will be able to shed more light when he gets a chance to look at this.
 
neralex







PostPosted: Mon Dec 13, 2010 3:59 pm Reply with quote

to 1st search: i will check this!

to 2nd forum: i mean your post here in this forumthread. if i click on the "quote button" in your post, then i become this error and can't find the buttons. try it self: [ Only registered users can see links on this board! Get registered or login! ]
 
fkelly







PostPosted: Mon Dec 13, 2010 4:24 pm Reply with quote

I don't know what the quote button in forums is supposed to do. I've clicked around on it as you suggested and get flaky looking results. But honestly, I don't care: I don't use it anyway and I stay out of the Forums code wherever possible. If you have an issue with it, it would be best to start a separate thread. Mixing technical issues in the same thread is a sure way to confusion and I admit to being confused by this. Let's deal with the search issues here and get them resolved.
 
neralex







PostPosted: Mon Dec 13, 2010 4:36 pm Reply with quote

okay. the search thing is my goal!
 
Palbin







PostPosted: Mon Dec 13, 2010 4:48 pm Reply with quote

neralex, we are aware of the quote problem.
 
Palbin







PostPosted: Sat Dec 18, 2010 11:04 am Reply with quote

neralex, try this new index.php out.
[ Only registered users can see links on this board! Get registered or login! ]

It is not perfect, but I can not make it better until the next release.
 
neralex







PostPosted: Sat Dec 18, 2010 2:42 pm Reply with quote

Palbin, thanx! it works perfekt for me!

you have one little freespace in a generated url:

search:
Code:
echo '<br /><br /><div style="text-align: center;"><a href="modules.php?name=' . $module_name . '&amp;author=' . $author . '&amp;topic=' . $row['topic'] . '&amp;min=' . $max . '&amp;query=' . urlencode($query) .' &amp;type=' . $type . '&amp;category=' . $category . '">';

you found in this line:
Code:
' &amp;type=' . $type . '

remove the freespace before the &amp;:
Code:
'&amp;type=' . $type . '

...and my validator counts to 0 warnings! great work!

RavensScripts
 
Palbin







PostPosted: Sat Dec 18, 2010 4:44 pm Reply with quote

Thanks! Fixed.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©