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 5380 2011-02-21 12:04:43Z Tomm $
| * $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 243 | Zeile 244 |
---|
// Normal moderators $moderated_forums = '0'; while($forum = $db->fetch_array($query))
|
// Normal moderators $moderated_forums = '0'; while($forum = $db->fetch_array($query))
|
{
| {
|
$moderated_forums .= ','.$forum['fid']; } $unapproved_where = "(t.visible>0 OR (t.visible=0 AND t.fid IN ({$moderated_forums})))";
| $moderated_forums .= ','.$forum['fid']; } $unapproved_where = "(t.visible>0 OR (t.visible=0 AND t.fid IN ({$moderated_forums})))";
|
Zeile 270 | Zeile 271 |
---|
$search['threads'] = implode(",", $threads); } // No results.
|
$search['threads'] = implode(",", $threads); } // No results.
|
else
| else
|
{ error($lang->error_nosearchresults); }
| { error($lang->error_nosearchresults); }
|
Zeile 278 | Zeile 279 |
---|
} // 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
|
{
| {
|
$where_conditions = "t.tid IN (".$search['threads'].")"; $query = $db->simple_select("threads t", "COUNT(t.tid) AS resultcount", $where_conditions. " AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%' {$limitsql}"); $count = $db->fetch_array($query);
| $where_conditions = "t.tid IN (".$search['threads'].")"; $query = $db->simple_select("threads t", "COUNT(t.tid) AS resultcount", $where_conditions. " AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%' {$limitsql}"); $count = $db->fetch_array($query);
|
Zeile 286 | Zeile 287 |
---|
if(!$count['resultcount']) { error($lang->error_nosearchresults);
|
if(!$count['resultcount']) { error($lang->error_nosearchresults);
|
}
| }
|
$threadcount = $count['resultcount'];
|
$threadcount = $count['resultcount'];
|
| } $permsql = ""; $onlyusfids = array(); // Check group permissions if we can't view threads not started by us $group_permissions = forum_permissions(); foreach($group_permissions as $fid => $forum_permissions) { if($forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid; } } if(!empty($onlyusfids)) { $permsql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))"; } $unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $permsql .= " AND t.fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $permsql .= " AND t.fid NOT IN ($inactiveforums)";
|
} // Begin selecting matching threads, cache them.
| } // Begin selecting matching threads, cache them.
|
Zeile 302 | Zeile 331 |
---|
FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid) LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid=t.prefix)
|
FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid) LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid=t.prefix)
|
WHERE $where_conditions AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%'
| WHERE $where_conditions AND {$unapproved_where} {$permsql} AND t.closed NOT LIKE 'moved|%'
|
ORDER BY $sortfield $order LIMIT $start, $perpage ");
| ORDER BY $sortfield $order LIMIT $start, $perpage ");
|
Zeile 325 | Zeile 354 |
---|
while($thread = $db->fetch_array($query)) { $thread_cache[$thread['tid']]['dot_icon'] = 1;
|
while($thread = $db->fetch_array($query)) { $thread_cache[$thread['tid']]['dot_icon'] = 1;
|
} }
| } }
|
// Fetch the read threads. if($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0)
|
// Fetch the read threads. if($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0)
|
{
| {
|
$query = $db->simple_select("threadsread", "tid,dateline", "uid='".$mybb->user['uid']."' AND tid IN(".$thread_ids.")"); while($readthread = $db->fetch_array($query)) { $thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline']; }
|
$query = $db->simple_select("threadsread", "tid,dateline", "uid='".$mybb->user['uid']."' AND tid IN(".$thread_ids.")"); while($readthread = $db->fetch_array($query)) { $thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline']; }
|
| }
if(!$mybb->settings['maxmultipagelinks']) { $mybb->settings['maxmultipagelinks'] = 5;
|
}
foreach($thread_cache as $thread)
| }
foreach($thread_cache as $thread)
|
Zeile 416 | Zeile 450 |
---|
else { $last_read = $read_cutoff;
|
else { $last_read = $read_cutoff;
|
} } else
| } } else
|
{ $last_read = my_get_array_cookie("threadread", $thread['tid']); }
| { $last_read = my_get_array_cookie("threadread", $thread['tid']); }
|
Zeile 473 | 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")."\";"); }
|
Zeile 526 | Zeile 560 |
---|
}
// If this user is the author of the thread and it is not closed or they are a moderator, they can edit
|
}
// If this user is the author of the thread and it is not closed or they are a moderator, they can edit
|
if(($thread['uid'] == $mybb->user['uid'] && $thread['closed'] != 1 && $mybb->user['uid'] != 0 && $fpermissions[$thread['fid']]['caneditposts'] == 1) || is_moderator($fid, "caneditposts"))
| if(($thread['uid'] == $mybb->user['uid'] && $thread['closed'] != 1 && $mybb->user['uid'] != 0 && $fpermissions[$thread['fid']]['caneditposts'] == 1) || is_moderator($thread['fid'], "caneditposts"))
|
{ $inline_edit_class = "subject_editable"; }
| { $inline_edit_class = "subject_editable"; }
|
Zeile 566 | Zeile 600 |
---|
elseif($is_mod) { eval("\$inline_mod_checkbox = \"".$templates->get("search_results_threads_nocheck")."\";");
|
elseif($is_mod) { eval("\$inline_mod_checkbox = \"".$templates->get("search_results_threads_nocheck")."\";");
|
}
| }
|
$plugins->run_hooks("search_results_thread"); eval("\$results .= \"".$templates->get("search_results_threads_thread")."\";"); }
| $plugins->run_hooks("search_results_thread"); eval("\$results .= \"".$templates->get("search_results_threads_thread")."\";"); }
|
Zeile 586 | Zeile 620 |
---|
if($upper > $threadcount) { $upper = $threadcount;
|
if($upper > $threadcount) { $upper = $threadcount;
|
}
| }
|
// Inline Thread Moderation Options if($is_mod)
| // Inline Thread Moderation Options if($is_mod)
|
Zeile 641 | Zeile 675 |
---|
// Super moderators (and admins) $p_unapproved_where = "visible >= 0"; $t_unapproved_where = "visible < 0";
|
// Super moderators (and admins) $p_unapproved_where = "visible >= 0"; $t_unapproved_where = "visible < 0";
|
}
| }
|
elseif($db->num_rows($query)) { // Normal moderators
| elseif($db->num_rows($query)) { // Normal moderators
|
Zeile 660 | Zeile 694 |
---|
$p_unapproved_where = 'visible=1'; $t_unapproved_where = 'visible < 1'; }
|
$p_unapproved_where = 'visible=1'; $t_unapproved_where = 'visible < 1'; }
|
|
|
$post_cache_options = array(); if(intval($mybb->settings['searchhardlimit']) > 0) {
| $post_cache_options = array(); if(intval($mybb->settings['searchhardlimit']) > 0) {
|
Zeile 678 | Zeile 712 |
---|
// Make sure the posts we're viewing we have permission to view. $query = $db->simple_select("posts", "pid, tid", "pid IN(".$db->escape_string($search['posts']).") AND {$p_unapproved_where}", $post_cache_options); while($post = $db->fetch_array($query))
|
// Make sure the posts we're viewing we have permission to view. $query = $db->simple_select("posts", "pid, tid", "pid IN(".$db->escape_string($search['posts']).") AND {$p_unapproved_where}", $post_cache_options); while($post = $db->fetch_array($query))
|
{
| {
|
$pids[$post['pid']] = $post['tid']; $tids[$post['tid']][$post['pid']] = $post['pid']; }
| $pids[$post['pid']] = $post['tid']; $tids[$post['tid']][$post['pid']] = $post['pid']; }
|
Zeile 714 | Zeile 748 |
---|
// 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));
|
|
|
$tids = implode(",", array_keys($tids)); // Read threads
| $tids = implode(",", array_keys($tids)); // Read threads
|
Zeile 724 | Zeile 758 |
---|
while($readthread = $db->fetch_array($query)) { $readthreads[$readthread['tid']] = $readthread['dateline'];
|
while($readthread = $db->fetch_array($query)) { $readthreads[$readthread['tid']] = $readthread['dateline'];
|
}
| }
|
}
$dot_icon = array();
| }
$dot_icon = array();
|
Zeile 788 | 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 813 | 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 {
|