Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: search.php 5442 2011-04-16 09:09:38Z jammerx2 $
| * $Id$
|
*/
| */
|
Zeile 184 | Zeile 184 |
---|
ORDER BY pid, disporder ");
|
ORDER BY pid, disporder ");
|
$forumsread = unserialize($mybb->cookies['mybb']['forumread']);
| $forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
|
} else {
| } else {
|
Zeile 197 | Zeile 197 |
---|
ORDER BY pid, disporder "); }
|
ORDER BY pid, disporder "); }
|
|
|
while($forum = $db->fetch_array($query)) { if($mybb->user['uid'] == 0)
| while($forum = $db->fetch_array($query)) { if($mybb->user['uid'] == 0)
|
Zeile 204 | Zeile 205 |
---|
if($forumsread[$forum['fid']]) { $forum['lastread'] = $forumsread[$forum['fid']];
|
if($forumsread[$forum['fid']]) { $forum['lastread'] = $forumsread[$forum['fid']];
|
} }
| } }
|
$readforums[$forum['fid']] = $forum['lastread']; } $fpermissions = forum_permissions();
| $readforums[$forum['fid']] = $forum['lastread']; } $fpermissions = forum_permissions();
|
Zeile 214 | Zeile 215 |
---|
$inlinemodcol = $inlinecookie = ''; $is_mod = $is_supermod = false; if($mybb->usergroup['issupermod'])
|
$inlinemodcol = $inlinecookie = ''; $is_mod = $is_supermod = false; if($mybb->usergroup['issupermod'])
|
{
| {
|
$is_supermod = true; } if($is_supermod || is_moderator())
| $is_supermod = true; } if($is_supermod || is_moderator())
|
Zeile 260 | Zeile 261 |
---|
$where_conditions = $search['querycache']; $query = $db->simple_select("threads t", "t.tid", $where_conditions. " AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%' {$limitsql}"); while($thread = $db->fetch_array($query))
|
$where_conditions = $search['querycache']; $query = $db->simple_select("threads t", "t.tid", $where_conditions. " AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%' {$limitsql}"); while($thread = $db->fetch_array($query))
|
{
| {
|
$threads[$thread['tid']] = $thread['tid']; $threadcount++;
|
$threads[$thread['tid']] = $thread['tid']; $threadcount++;
|
}
| }
|
// Build our list of threads. if($threadcount > 0)
|
// Build our list of threads. if($threadcount > 0)
|
{
| {
|
$search['threads'] = implode(",", $threads);
|
$search['threads'] = implode(",", $threads);
|
}
| }
|
// No results.
|
// No results.
|
else { error($lang->error_nosearchresults); } $where_conditions = "t.tid IN (".$search['threads'].")";
| else { error($lang->error_nosearchresults); } $where_conditions = "t.tid IN (".$search['threads'].")";
|
} // This search doesn't use a query cache, results stored in search table. else
| } // This search doesn't use a query cache, results stored in search table. else
|
Zeile 284 | Zeile 285 |
---|
$count = $db->fetch_array($query);
if(!$count['resultcount'])
|
$count = $db->fetch_array($query);
if(!$count['resultcount'])
|
{
| {
|
error($lang->error_nosearchresults); } $threadcount = $count['resultcount'];
| error($lang->error_nosearchresults); } $threadcount = $count['resultcount'];
|
Zeile 303 | Zeile 304 |
---|
} } if(!empty($onlyusfids))
|
} } if(!empty($onlyusfids))
|
{
| {
|
$permsql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))"; }
| $permsql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))"; }
|
Zeile 342 | Zeile 343 |
---|
$thread_ids = implode(",", array_keys($thread_cache)); if(empty($thread_ids))
|
$thread_ids = implode(",", array_keys($thread_cache)); if(empty($thread_ids))
|
{
| {
|
error($lang->error_nosearchresults); }
| error($lang->error_nosearchresults); }
|
Zeile 350 | Zeile 351 |
---|
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $thread_cache) { $query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='".$mybb->user['uid']."' AND tid IN(".$thread_ids.")");
|
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $thread_cache) { $query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='".$mybb->user['uid']."' AND tid IN(".$thread_ids.")");
|
while($thread = $db->fetch_array($query)) {
| while($thread = $db->fetch_array($query)) {
|
$thread_cache[$thread['tid']]['dot_icon'] = 1; } }
| $thread_cache[$thread['tid']]['dot_icon'] = 1; } }
|
Zeile 365 | Zeile 366 |
---|
$thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline']; } }
|
$thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline']; } }
|
| if(!$mybb->settings['maxmultipagelinks']) { $mybb->settings['maxmultipagelinks'] = 5; }
|
foreach($thread_cache as $thread) { $bgcolor = alt_trow();
| foreach($thread_cache as $thread) { $bgcolor = alt_trow();
|
Zeile 394 | Zeile 400 |
---|
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
if($icon_cache[$thread['icon']])
|
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
if($icon_cache[$thread['icon']])
|
{
| {
|
$posticon = $icon_cache[$thread['icon']]; $icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";
|
$posticon = $icon_cache[$thread['icon']]; $icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";
|
}
| }
|
else
|
else
|
{
| {
|
$icon = " "; } if($thread['poll'])
|
$icon = " "; } if($thread['poll'])
|
{
| {
|
$prefix = $lang->poll_prefix; }
| $prefix = $lang->poll_prefix; }
|
Zeile 423 | Zeile 429 |
---|
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) { $forum_read = $readforums[$thread['fid']];
|
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) { $forum_read = $readforums[$thread['fid']];
|
$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24; if($forum_read == 0 || $forum_read < $read_cutoff) { $forum_read = $read_cutoff; }
| $read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24; if($forum_read == 0 || $forum_read < $read_cutoff) { $forum_read = $read_cutoff; }
|
} else
|
} else
|
{
| {
|
$forum_read = $forumsread[$thread['fid']]; } if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read) { if($thread['lastread'])
|
$forum_read = $forumsread[$thread['fid']]; } if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read) { if($thread['lastread'])
|
{
| {
|
$last_read = $thread['lastread']; } else
| $last_read = $thread['lastread']; } else
|
Zeile 457 | Zeile 463 |
---|
}
if($thread['lastpost'] > $last_read && $last_read)
|
}
if($thread['lastpost'] > $last_read && $last_read)
|
{
| {
|
$folder .= "new"; $new_class = "subject_new"; $folder_label .= $lang->icon_new;
| $folder .= "new"; $new_class = "subject_new"; $folder_label .= $lang->icon_new;
|
Zeile 477 | Zeile 483 |
---|
$folder_label .= $lang->icon_hot; } if($thread['closed'] == 1)
|
$folder_label .= $lang->icon_hot; } if($thread['closed'] == 1)
|
{
| {
|
$folder .= "lock"; $folder_label .= $lang->icon_lock; }
| $folder .= "lock"; $folder_label .= $lang->icon_lock; }
|
Zeile 486 | Zeile 492 |
---|
if(!$mybb->settings['postsperpage']) { $mybb->settings['postperpage'] = 20;
|
if(!$mybb->settings['postsperpage']) { $mybb->settings['postperpage'] = 20;
|
}
| }
|
$thread['pages'] = 0; $thread['multipage'] = '';
| $thread['pages'] = 0; $thread['multipage'] = '';
|
Zeile 501 | Zeile 507 |
---|
{ $thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage']; $thread['pages'] = ceil($thread['pages']);
|
{ $thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage']; $thread['pages'] = ceil($thread['pages']);
|
if($thread['pages'] > 4)
| if($thread['pages'] > $mybb->settings['maxmultipagelinks'])
|
{
|
{
|
$pagesstop = 4;
| $pagesstop = $mybb->settings['maxmultipagelinks'] - 1;
|
$page_link = get_thread_link($thread['tid'], $thread['pages']).$highlight; eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
|
$page_link = get_thread_link($thread['tid'], $thread['pages']).$highlight; eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
|
} else
| } else
|
{ $pagesstop = $thread['pages'];
|
{ $pagesstop = $thread['pages'];
|
}
| }
|
for($i = 1; $i <= $pagesstop; ++$i) { $page_link = get_thread_link($thread['tid'], $i).$highlight; eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";"); } eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");
|
for($i = 1; $i <= $pagesstop; ++$i) { $page_link = get_thread_link($thread['tid'], $i).$highlight; eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";"); } eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");
|
}
| }
|
else { $threadpages = '';
| else { $threadpages = '';
|
Zeile 535 | Zeile 541 |
---|
if($lastposteruid == 0) { $lastposterlink = $lastposter;
|
if($lastposteruid == 0) { $lastposterlink = $lastposter;
|
} else
| } else
|
{ $lastposterlink = build_profile_link($lastposter, $lastposteruid); }
| { $lastposterlink = build_profile_link($lastposter, $lastposteruid); }
|
Zeile 575 | Zeile 581 |
---|
{ $attachment_count = $lang->attachment_count; }
|
{ $attachment_count = $lang->attachment_count; }
|
|
|
eval("\$attachment_count = \"".$templates->get("forumdisplay_thread_attachment_count")."\";");
|
eval("\$attachment_count = \"".$templates->get("forumdisplay_thread_attachment_count")."\";");
|
}
| }
|
else { $attachment_count = ''; }
$inline_edit_tid = $thread['tid'];
|
else { $attachment_count = ''; }
$inline_edit_tid = $thread['tid'];
|
|
|
// Inline thread moderation $inline_mod_checkbox = ''; if($is_supermod || is_moderator($thread['fid']))
|
// Inline thread moderation $inline_mod_checkbox = ''; if($is_supermod || is_moderator($thread['fid']))
|
{
| {
|
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_threads_inlinecheck")."\";"); } elseif($is_mod)
|
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_threads_inlinecheck")."\";"); } elseif($is_mod)
|
{
| {
|
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_threads_nocheck")."\";"); }
| eval("\$inline_mod_checkbox = \"".$templates->get("search_results_threads_nocheck")."\";"); }
|
Zeile 600 | Zeile 606 |
---|
eval("\$results .= \"".$templates->get("search_results_threads_thread")."\";"); } if(!$results)
|
eval("\$results .= \"".$templates->get("search_results_threads_thread")."\";"); } if(!$results)
|
{ error($lang->error_nosearchresults);
| { error($lang->error_nosearchresults);
|
} else {
| } else {
|
Zeile 637 | Zeile 643 |
---|
} while($tool = $db->fetch_array($query))
|
} while($tool = $db->fetch_array($query))
|
{
| {
|
eval("\$customthreadtools .= \"".$templates->get("search_results_threads_inlinemoderation_custom_tool")."\";");
|
eval("\$customthreadtools .= \"".$templates->get("search_results_threads_inlinemoderation_custom_tool")."\";");
|
}
| }
|
// Build inline moderation dropdown if(!empty($customthreadtools)) { eval("\$customthreadtools = \"".$templates->get("search_results_threads_inlinemoderation_custom")."\";"); } eval("\$inlinemod = \"".$templates->get("search_results_threads_inlinemoderation")."\";");
|
// Build inline moderation dropdown if(!empty($customthreadtools)) { eval("\$customthreadtools = \"".$templates->get("search_results_threads_inlinemoderation_custom")."\";"); } eval("\$inlinemod = \"".$templates->get("search_results_threads_inlinemoderation")."\";");
|
}
| }
|
$plugins->run_hooks("search_results_end");
|
$plugins->run_hooks("search_results_end");
|
|
|
eval("\$searchresults = \"".$templates->get("search_results_threads")."\";"); output_page($searchresults); } else // Displaying results as posts { if(!$search['posts'])
|
eval("\$searchresults = \"".$templates->get("search_results_threads")."\";"); output_page($searchresults); } else // Displaying results as posts { if(!$search['posts'])
|
{ error($lang->error_nosearchresults); } $postcount = 0;
| { error($lang->error_nosearchresults); } $postcount = 0;
|
// Moderators can view unapproved threads $query = $db->simple_select("moderators", "fid", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')"); if($mybb->usergroup['issupermod'] == 1)
| // Moderators can view unapproved threads $query = $db->simple_select("moderators", "fid", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')"); if($mybb->usergroup['issupermod'] == 1)
|
Zeile 671 | Zeile 677 |
---|
$t_unapproved_where = "visible < 0"; } elseif($db->num_rows($query))
|
$t_unapproved_where = "visible < 0"; } elseif($db->num_rows($query))
|
{
| {
|
// Normal moderators $moderated_forums = '0'; while($forum = $db->fetch_array($query))
| // Normal moderators $moderated_forums = '0'; while($forum = $db->fetch_array($query))
|
Zeile 681 | Zeile 687 |
---|
} $p_unapproved_where = "visible >= 0"; $t_unapproved_where = "visible < 0 AND fid NOT IN ({$moderated_forums})";
|
} $p_unapproved_where = "visible >= 0"; $t_unapproved_where = "visible < 0 AND fid NOT IN ({$moderated_forums})";
|
}
| }
|
else { // Normal users
| else { // Normal users
|
Zeile 699 | Zeile 705 |
---|
{ $post_cache_options['order_by'] = str_replace('p.', '', $sortfield); $post_cache_options['order_dir'] = $order;
|
{ $post_cache_options['order_by'] = str_replace('p.', '', $sortfield); $post_cache_options['order_dir'] = $order;
|
}
| }
|
$tids = array(); $pids = array(); // Make sure the posts we're viewing we have permission to view.
| $tids = array(); $pids = array(); // Make sure the posts we're viewing we have permission to view.
|
Zeile 709 | Zeile 715 |
---|
{ $pids[$post['pid']] = $post['tid']; $tids[$post['tid']][$post['pid']] = $post['pid'];
|
{ $pids[$post['pid']] = $post['tid']; $tids[$post['tid']][$post['pid']] = $post['pid'];
|
}
| }
|
if(!empty($pids)) { $temp_pids = array();
| if(!empty($pids)) { $temp_pids = array();
|
Zeile 738 | Zeile 744 |
---|
if(!$postcount) { error($lang->error_nosearchresults);
|
if(!$postcount) { error($lang->error_nosearchresults);
|
}
| }
|
// And now we have our sanatized post list $search['posts'] = implode(',', array_keys($pids));
| // And now we have our sanatized post list $search['posts'] = implode(',', array_keys($pids));
|
Zeile 794 | Zeile 800 |
---|
{ $posticon = $icon_cache[$post['icon']]; $icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";
|
{ $posticon = $icon_cache[$post['icon']]; $icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";
|
} else {
| } else {
|
$icon = " "; }
| $icon = " "; }
|
Zeile 816 | Zeile 822 |
---|
$donenew = 0; $last_read = 0; $post['thread_lastread'] = $readthreads[$post['tid']];
|
$donenew = 0; $last_read = 0; $post['thread_lastread'] = $readthreads[$post['tid']];
|
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forumread)
| if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) { $forum_read = $readforums[$post['fid']]; $read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24; if($forum_read == 0 || $forum_read < $read_cutoff) { $forum_read = $read_cutoff; } } else { $forum_read = $forumsread[$post['fid']]; }
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forum_read)
|
{ $cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24; if($post['thread_lastpost'] > $cutoff)
| { $cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24; if($post['thread_lastpost'] > $cutoff)
|
Zeile 841 | Zeile 863 |
---|
if(!$last_read) { $readcookie = $threadread = my_get_array_cookie("threadread", $post['tid']);
|
if(!$last_read) { $readcookie = $threadread = my_get_array_cookie("threadread", $post['tid']);
|
if($readcookie > $forumread)
| if($readcookie > $forum_read)
|
{ $last_read = $readcookie; }
|
{ $last_read = $readcookie; }
|
elseif($forumread > $mybb->user['lastvisit'])
| elseif($forum_read > $mybb->user['lastvisit'])
|
{
|
{
|
$last_read = $forumread;
| $last_read = $forum_read;
|
} else {
| } else {
|