PDA

View Full Version : [Fixed] Not approved ( visible = 0 ) threads displayed in search !



Burns
Fri 12th Jul '02, 7:09pm
Not approved ( they have visible = 0 attributes in DB )
threads displayed in search results

The user just need to choose "Show results as posts",
and viola, he can see all the posts,
which was not approved yet !
( the link to the post is sure not working,
but the user see the title and even part of the text in this view )

"Show results as threads" - only approved threads are displayed.

Also only unapproved threads are displayed,
unapproved posts ( in approved threads ) - not

I hoped so much my forum finaly goes live this weekend,
but that's really bug, i will not be able to open the forum till it's fixed...

I would appreciate a lot if anyone give me a tip
at which line ( around which line ) should i fix search.php,
because the file is so huge, it would take me forever to find it :confused:

Thanks in advance
Burns

Burns
Fri 12th Jul '02, 9:33pm
hm... i checked the "post" table,
the first(initial) post of the thread ( the only one in the thread )
is not set to visible=0, it's 1,
guess if the user choose "Show results as posts",
it search.php is looking for the post's "visible" attribute ?

What would be easier to fix,
check in search.php "visible" attribute of the thread of the post,
or change the script, which set the thread but not the initial post
to visible=0 ?

Please help !

Scott MacVicar
Fri 12th Jul '02, 9:50pm
I think I understand what your saying, if a thread is to be verified the visible column in the thread table is set to 0 but the visible column in the post table is set to 1 which the search.php file looks for hence you are getting these un-verified threads appearing.

Am i correct?

Burns
Fri 12th Jul '02, 10:00pm
Originally posted by PPN
I think I understand what your saying, if a thread is to be verified the visible column in the thread table is set to 0 but the visible column in the post table is set to 1 which the search.php file looks for hence you are getting these un-verified threads appearing.

Am i correct?
Exactly

Scott MacVicar
Fri 12th Jul '02, 10:02pm
Are you running 2.2.6?

I have had problems recreating this error can you pm me instructions on how you are re-creating this error?

I have created a couple of threads which have been put in the moderation queue but I have no idea what your putting in to the search form.

Scott

Scott MacVicar
Fri 12th Jul '02, 10:17pm
I managed to re-create it and I have a fix which works on my forums. Im not sure of the implications of the fix so I will check with a developer tonight to double check it.

Scott

Burns
Fri 12th Jul '02, 10:19pm
Yes, it's 2.2.6,
and i have Moderation per user group ( by FireFly ),
as well as well known Thread Spinner installed
( no other hacks besides small modification
in mod/moderatate.php which shouls not affect it... )

Search options are:
Search By User Name ( Match exact name ) +
Search entire posts +
Any Date and newer +
Last posting date in descending order +

Burns
Fri 12th Jul '02, 10:27pm
Originally posted by PPN
I managed to re-create it and I have a fix which works on my forums. Im not sure of the implications of the fix so I will check with a developer tonight to double check it.

Scott
thank you
If it already works, i would risk to use not-tested version, and test it ;)
( since my forum is not open for public yet, i still can alter with it without danger,
and DB is backup'ed )
Could you PM me the patched file ?

Scott MacVicar
Fri 12th Jul '02, 10:30pm
Ill wait for a developer to reply, they'll may have a better fix than what I have and if not then Ill post it here for everyone to see.

Burns
Fri 12th Jul '02, 10:45pm
ok, i understand ;)

Burns
Sat 13th Jul '02, 11:12am
Hm... sorry, i ready don't understand what harm and to who would it do,
if you PM me the hacked php or 2.,
or few lines ( "old"... ---> "new"... )

- i have assured that i take all responsability for whatever can happen to my board,
even if it explode ;)
( and it's not "live" either yet )
- if there is any severe bug, i find, i will PM you, no blame for you
- i'm the only one who asked now, vB is 2.2.6(!) by now;
how is it posssible, it was not reported/fixed yet ?
The only answer i have is - probably no one really need it
( at least not as much as me )

If you don't, i will just lose this time...
( will try to fix it myself, but i doubt it will work :( )

Burns
Sat 13th Jul '02, 12:14pm
hehe...

I think i got it now, it seems to work...

But i'm still very interested in your solution,
because it must be better then mine ;)

Scott MacVicar
Sat 13th Jul '02, 3:50pm
Well none of the devs have posted saying theres anything wrong with the code so here it is,

open search.php

find


$getpostids=$DB_site->query("
SELECT
post.postid".
iif(strlen(strpos(" $orderbysql","posttext")),",IF(post.title='',LEFT(post.pagetext,50),post.titl e) AS posttext","").
iif(strlen(strpos(" $orderbysql","usrname")),",IF(post.userid=0,post.username,user.username) AS usrname","").
"
FROM
post".
iif(strlen(strpos($search[query],"searchindex")),",searchindex","").
iif(strlen(strpos(" $orderbysql","thread.")) or strlen(strpos($search[query],"thread.")) or strlen(strpos($orderbysql,"forum.")) or strlen(strpos($search[query],"forum."))," LEFT JOIN thread ON thread.threadid=post.threadid ","").
iif(strlen(strpos(" $orderbysql","forum.")) or strlen(strpos($search[query],"forum."))," LEFT JOIN forum ON thread.forumid=forum.forumid ","").
iif(strlen(strpos(" $orderbysql","usrname"))," LEFT JOIN user ON (post.userid=user.userid) ","").
"
WHERE
post.visible=1 AND $newpostsql $search[query]
ORDER BY
$orderbysql
LIMIT ".($limitlower-1).",$perpage
");

change to


$getpostids=$DB_site->query("
SELECT
post.postid, thread.visible".
iif(strlen(strpos(" $orderbysql","posttext")),",IF(post.title='',LEFT(post.pagetext,50),post.titl e) AS posttext","").
iif(strlen(strpos(" $orderbysql","usrname")),",IF(post.userid=0,post.username,user.username) AS usrname","").
"
FROM
post".
iif(strlen(strpos($search[query],"searchindex")),",searchindex","").
" LEFT JOIN thread ON thread.threadid=post.threadid".
iif(strlen(strpos(" $orderbysql","forum.")) or strlen(strpos($search[query],"forum."))," LEFT JOIN forum ON thread.forumid=forum.forumid ","").
iif(strlen(strpos(" $orderbysql","usrname"))," LEFT JOIN user ON (post.userid=user.userid) ","").
"
WHERE
post.visible=1 AND thread.visible=1 AND $newpostsql $search[query]
ORDER BY
$orderbysql
LIMIT ".($limitlower-1).",$perpage
");

Burns
Sat 13th Jul '02, 6:02pm
thanks a lot !