- Liittynyt
- 17.4.2002
- Viestejä
- 268
query_first("SELECT threadid FROM post WHERE postid='$postid'"); $threadid=$getthread[threadid]; } $threadid = intval($threadid); $thread = verifyid("thread",$threadid,1,1); if (!$thread['visible']) { $idname="thread"; eval("standarderror(\"".gettemplate("error_invalidid")."\");"); exit; } $forum=getforuminfo($thread['forumid']); $getperms=getpermissions($thread['forumid'],-1,-1,$forum['parentlist']); if (!$getperms['canview']) { show_nopermission(); } if (!$getperms['canviewothers'] and ($thread['postuserid']!=$bbuserinfo['userid'] or $bbuserinfo['userid']==0)) { show_nopermission(); } $bbcodeon=iif($forum[allowbbcode],$ontext,$offtext); $imgcodeon=iif($forum[allowimages],$ontext,$offtext); $htmlcodeon=iif($forum[allowhtml],$ontext,$offtext); $smilieson=iif($forum[allowsmilies],$ontext,$offtext); $post=$DB_site->query_first(" SELECT post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,".iif($forum[allowicons],'icon.title as icontitle,icon.iconpath,','')." attachment.attachmentid,attachment.filename,attachment.visible AS attachmentvisible,attachment.counter ".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline","")." FROM post ".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')." LEFT JOIN user ON user.userid=post.userid LEFT JOIN userfield ON userfield.userid=user.userid ".iif ($avatarenabled,"LEFT JOIN avatar ON avatar.avatarid=user.avatarid LEFT JOIN customavatar ON customavatar.userid=user.userid","")." LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid WHERE post.postid = '$postid' "); if (!$getperms['cangetattachment']) { $viewattachedimages=0; } $postbits = getpostbit($post); updateuserforum($thread['forumid']); eval("dooutput(\"".gettemplate("showpost")."\");"); exit; } // ############################################################################## // ############################# SHOW THREAD #################################### // ############################################################################## $templatesused = 'showthread_ratingdisplay,postbit_search,postbit_buddy,postbit_ignore,postbit_useremail,icq,aim,yahoo,postbit_homepage,postbit_profile,postbit_ip_show,postbit_ip_hidden,postbit,postbit_sendpm,postbit_avatar,postbit_offline,postbit_online,postbit_editedby,postbit_signature,postbit_attachment,postbit_attachmentimage,showthread_adminoptions,showthread_threadrate,showthread_pollresults_voted,showthread_pollresults_closed,showthread_firstunread,showthread_nextnewestthread,showthread_nextoldestthread,forumrules,showthread'; require('./global.php'); // words to highlight from the search engine $replacewords = array(); if (isset($highlight) && $highlight != '') { $highlight = urldecode($highlight); $highlightwords=explode(" ",str_replace("/","\/",quotemeta($highlight))); while (list($key,$val)=each($highlightwords)) { $val = strtolower($val); if ($val=='or' OR $val=='and' OR $val=='not') { continue; } if ($allowwildcards) { $val = str_replace("\*", "[a-zA-z]+", $val); } $replacewords[$key]="$val"; } } // oldest first or newest first if ($postorder==0) { $postorder=""; } else { $postorder="DESC"; } // goto last post if ($goto=="lastpost") { if (isset($threadid) and $threadid!=0) { $threadid = verifyid("thread",$threadid); if ($getlastpost=$DB_site->query_first("SELECT postid,post.dateline FROM post,thread WHERE post.threadid=thread.threadid AND thread.threadid='$threadid' AND post.visible=1 AND thread.visible=1 ORDER BY post.dateline DESC LIMIT 1")) { header("Location: showthread.php?s=$session[sessionhash]&postid=$getlastpost[postid]#post$getlastpost[postid]"); exit; } } if (isset($forumid) and $forumid!=0) { $foruminfo=verifyid("forum",$forumid,1,1); $forumid=$foruminfo['forumid']; $forumslist = ""; $getchildforums=$DB_site->query("SELECT forumid,parentlist FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',$forumid,')>0"); while ($getchildforum=$DB_site->fetch_array($getchildforums)) { if ($getchildforum[forumid]==$forumid) { $parentlist=$getchildforum[parentlist]; } $forumslist.=",$getchildforum[forumid]"; } $thread=$DB_site->query_first("SELECT threadid FROM thread WHERE forumid IN (0$forumslist) AND visible=1 AND (sticky=1 OR sticky=0) AND lastpost>='".($foruminfo[lastpost]-30)."' AND open<>10 ORDER BY lastpost DESC LIMIT 1"); if ($getlastpost=$DB_site->query_first("SELECT postid FROM post WHERE threadid='$thread[threadid]' AND visible=1 ORDER BY postid DESC LIMIT 1")) { header("Location: showthread.php?s=$session[sessionhash]&postid=$getlastpost[postid]#post$getlastpost[postid]"); exit; } } } // goto newest post if ($goto=="newpost") { $threadid = verifyid("thread",$threadid); if (($tview = get_bbarraycookie('threadview', $threadid)) > $bbuserinfo['lastvisit']) { $bbuserinfo['lastvisit'] = $tview; } if ($posts=$DB_site->query_first("SELECT postid,dateline FROM post WHERE post.threadid=$threadid AND post.visible=1 AND post.dateline>'$bbuserinfo[lastvisit]' ORDER BY dateline LIMIT 1")) { header("Location: showthread.php?s=$session[sessionhash]&postid=$posts[postid]#post$posts[postid]"); exit; } else { header("Location: showthread.php?s=$session[sessionhash]&threadid=$threadid&goto=lastpost"); exit; } } if ($goto=="nextnewest") { $thread = verifyid("thread",$threadid,1,1); if ($getnextnewest=$DB_site->query_first("SELECT threadid FROM thread WHERE forumid='$thread[forumid]' AND lastpost>'$thread[lastpost]' AND visible=1 AND open<>10 ORDER BY lastpost LIMIT 1")) { $threadid=$getnextnewest[threadid]; unset ($thread); } else { eval("standarderror(\"".gettemplate