vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Improved Thread Preview Hack (https://vborg.vbsupport.ru/showthread.php?t=35645)

inetd 05-09-2002 03:45 PM

Quote:

Originally posted by inetd
Don't show preview for some threads... :(
nakkid, please help me with this bug.

TECK 05-09-2002 07:33 PM

hmmm... i didnt actually look at the search file made by nick, only at the the code i inserted in forumdispaly.php first.
i tested the code listed below in search.php and it worked perfectly for me. here it is what i did...

Find:
Code:

    $sql="
    SELECT $dotuserid $distinct
      thread.threadid,thread.threadid AS postid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,
      thread.views,thread.pollid,thread.open,thread.lastpost AS postdateline,thread.lastpost,thread.lastposter,
      forum.forumid,forum.title AS forumtitle,forum.allowicons,attach,
      thread.postusername AS usrname,
      user.userid AS postuserid,
      threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle
    FROM
      thread,forum".iif(strpos($search[query],"searchindex")>0,",searchindex","")."
    LEFT JOIN user ON user.username=thread.postusername
    LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
    $dotjoin

REPLACE it with:
Code:

    $sql="
    SELECT $dotuserid $distinct
      thread.threadid,thread.threadid AS postid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,
      thread.views,thread.pollid,thread.open,thread.lastpost AS postdateline,thread.lastpost,thread.lastposter,
      forum.forumid,forum.title AS forumtitle,forum.allowicons,attach,
      thread.postusername AS usrname,
      user.userid AS postuserid,
      threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle,
      post2.pagetext as pagetext
    FROM
      thread,forum".iif(strpos($search[query],"searchindex")>0,",searchindex","")."
    LEFT JOIN user ON user.username=thread.postusername
    LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
    LEFT JOIN post AS post2 ON thread.firstpostid=post2.postid
    $dotjoin

Find:
Code:

        // get first 30 chars of post title
        if (trim($searchresult[posttitle])=="") {
          $searchresult[posttitle]=substr($searchresult[pagetext],0,50);
          if (strlen($searchresult[posttitle])>50) {
            $spacepos=strpos($searchresult[posttitle]." "," ",50);
            if ($spacepos!=0) {
              $searchresult[posttitle]=substr($searchresult[posttitle],0,$spacepos)."...";
            }
          }
        }

BELOW this, add:
Code:

        // get first 100 chars of post message
        if (strlen($searchresult[pagetext])>100) {
          $searchresult[message]=censortext(substr($searchresult[pagetext],0,97).'...');
        } else {
          $searchresult[message]=censortext(searchresult[pagetext]);
        }
        $searchresult[message]=preg_replace("/\[[^\]]\]/","",$searchresult[message]);
        $searchresult[message]=str_replace("\"","",$searchresult[message]);

In 'searchresultbit_threadonly' template, find:
Code:

<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords">$searchresult[threadtitle]</a>
REPLACE it with:
Code:

<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="$searchresult[message]">$searchresult[threadtitle]</a>
i personally didnt like the fact that the preview text is not censored, so i added also the censor function. let me know if it worked. :)

TECK 05-09-2002 07:38 PM

this was tested in VB225.
i think where most of the people make the mistake is the query change. thare are 2 queries that look almost identical there, in search.php...
btw, there is nothing wrong with nick's file.

N!ck 05-09-2002 11:31 PM

Quote:

Originally posted by nakkid
nick, i think you forgot one little detail.. if the thread is deleted, the previewpostid will still be there. you could do this:

open functions.php and go to [high]deletethread()[/high] function.
find:
Code:

    $DB_site->query("DELETE FROM thread WHERE threadid='$threadid'");
BELOW this, add:
Code:

    $DB_site->query("DELETE FROM thread WHERE firstpostid='$firstpostid'");
let me know what you think.

i'm not sure exactly what more doing this would accomplish...? the first query will delete the whole row, including firstpostid...

TECK 05-10-2002 12:29 AM

you are correct. sorry, i didnt realised.
in other order, you think was a good idea that i added the censortext function?
thanks for the input.

N!ck 05-10-2002 12:48 AM

it's definitely something i didn't think of :D

TECK 05-10-2002 02:59 AM

i'm glad you like it. :)

N!ck 05-10-2002 12:59 PM

i'll put this information on post #1

inetd 05-10-2002 06:52 PM

when i inserted
Code:

        // get first 100 chars of post message
        if (strlen($searchresult[pagetext])>100) {
          $searchresult[message]=censortext(substr($searchresult[pagetext],0,97).'...');
        } else {
          $searchresult[message]=censortext(searchresult[pagetext]);
        }
        $searchresult[message]=preg_replace("/\[[^\]]\]/","",$searchresult[message]);
        $searchresult[message]=str_replace("\"","",$searchresult[message]);

in search.php, i see blank page :(

N!ck 05-12-2002 11:40 PM

yeah?


All times are GMT. The time now is 10:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01191 seconds
  • Memory Usage 1,750KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete