Zeile 13 | Zeile 13 |
---|
define('THIS_SCRIPT', 'search.php');
$templatelist = "search,forumdisplay_thread_gotounread,search_results_threads_thread,search_results_threads,search_results_posts,search_results_posts_post,search_results_icon,search_forumlist_forum,search_forumlist";
|
define('THIS_SCRIPT', 'search.php');
$templatelist = "search,forumdisplay_thread_gotounread,search_results_threads_thread,search_results_threads,search_results_posts,search_results_posts_post,search_results_icon,search_forumlist_forum,search_forumlist";
|
$templatelist .= ",multipage,multipage_breadcrumb,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,forumdisplay_thread_multipage_more,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage"; $templatelist .= ",search_results_posts_inlinecheck,search_results_posts_nocheck,search_results_threads_inlinecheck,search_results_threads_nocheck,search_results_inlinemodcol,search_results_posts_inlinemoderation_custom_tool"; $templatelist .= ",search_results_posts_inlinemoderation_custom,search_results_posts_inlinemoderation,search_results_threads_inlinemoderation_custom_tool,search_results_threads_inlinemoderation_custom,search_results_threads_inlinemoderation,search_orderarrow,search_moderator_options"; $templatelist .= ",forumdisplay_thread_attachment_count,search_threads_inlinemoderation_selectall,search_posts_inlinemoderation_selectall,post_prefixselect_prefix,post_prefixselect_multiple";
| $templatelist .= ",multipage,multipage_breadcrumb,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start"; $templatelist .= ",search_results_posts_inlinecheck,search_results_posts_nocheck,search_results_threads_inlinecheck,search_results_threads_nocheck,search_results_inlinemodcol,search_results_inlinemodcol_empty,search_results_posts_inlinemoderation_custom_tool"; $templatelist .= ",search_results_posts_inlinemoderation_custom,search_results_posts_inlinemoderation,search_results_threads_inlinemoderation_custom_tool,search_results_threads_inlinemoderation_custom,search_results_threads_inlinemoderation"; $templatelist .= ",forumdisplay_thread_attachment_count,search_threads_inlinemoderation_selectall,search_posts_inlinemoderation_selectall,post_prefixselect_prefix,post_prefixselect_multiple,search_orderarrow"; $templatelist .= ",search_results_posts_forumlink,search_results_threads_forumlink,forumdisplay_thread_multipage_more,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage,search_moderator_options";
|
require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
| require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
|
Zeile 59 | Zeile 60 |
---|
$query = $db->simple_select("searchlog", "*", "sid='$sid'"); $search = $db->fetch_array($query);
|
$query = $db->simple_select("searchlog", "*", "sid='$sid'"); $search = $db->fetch_array($query);
|
if(!$search['sid'])
| if(!$search)
|
{ error($lang->error_invalidsearch); }
| { error($lang->error_invalidsearch); }
|
Zeile 89 | Zeile 90 |
---|
} break; case "forum":
|
} break; case "forum":
|
$sortfield = "t.fid";
| $sortfield = "f.name";
|
break; case "starter": if($search['resulttype'] == "threads")
| break; case "starter": if($search['resulttype'] == "threads")
|
Zeile 103 | Zeile 104 |
---|
break; case "lastpost": default:
|
break; case "lastpost": default:
|
if($search['resulttype'] == "threads")
| if(isset($search['resulttype']) && $search['resulttype'] == "threads")
|
{ $sortfield = "t.lastpost"; $sortby = "lastpost";
| { $sortfield = "t.lastpost"; $sortby = "lastpost";
|
Zeile 151 | Zeile 152 |
---|
// Work out if we have terms to highlight $highlight = "";
|
// Work out if we have terms to highlight $highlight = "";
|
if($search['keywords'])
| if(!empty($search['keywords']))
|
{ if($mybb->seo_support == true) {
| { if($mybb->seo_support == true) {
|
Zeile 166 | Zeile 167 |
---|
$sorturl = "search.php?action=results&sid={$sid}"; $thread_url = ""; $post_url = "";
|
$sorturl = "search.php?action=results&sid={$sid}"; $thread_url = ""; $post_url = "";
|
|
|
$orderarrow = array('replies' => '', 'views' => '', 'subject' => '', 'forum' => '', 'starter' => '', 'lastpost' => '', 'dateline' => '');
|
$orderarrow = array('replies' => '', 'views' => '', 'subject' => '', 'forum' => '', 'starter' => '', 'lastpost' => '', 'dateline' => '');
|
eval("\$orderarrow['$sortby'] = \"".$templates->get("search_orderarrow")."\";");
| eval("\$orderarrow['$sortby'] = \"".$templates->get("search_orderarrow")."\";");
|
// Read some caches we will be using $forumcache = $cache->read("forums"); $icon_cache = $cache->read("posticons");
|
// Read some caches we will be using $forumcache = $cache->read("forums"); $icon_cache = $cache->read("posticons");
|
|
|
$threads = array();
if($mybb->user['uid'] == 0)
| $threads = array();
if($mybb->user['uid'] == 0)
|
Zeile 184 | Zeile 185 |
---|
SELECT fid FROM ".TABLE_PREFIX."forums WHERE active != 0
|
SELECT fid FROM ".TABLE_PREFIX."forums WHERE active != 0
|
ORDER BY pid, disporder ");
$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
| ORDER BY pid, disporder ");
if(isset($mybb->cookies['mybb']['forumread'])) { $forumsread = my_unserialize($mybb->cookies['mybb']['forumread'], false); } else { $forumsread = array(); }
|
} else {
| } else {
|
Zeile 204 | Zeile 212 |
---|
while($forum = $db->fetch_array($query)) { if($mybb->user['uid'] == 0)
|
while($forum = $db->fetch_array($query)) { if($mybb->user['uid'] == 0)
|
{ if($forumsread[$forum['fid']])
| { if(!empty($forumsread[$forum['fid']]))
|
{ $forum['lastread'] = $forumsread[$forum['fid']]; } }
|
{ $forum['lastread'] = $forumsread[$forum['fid']]; } }
|
$readforums[$forum['fid']] = $forum['lastread']; }
| if(isset($forum['lastread'])) { $readforums[$forum['fid']] = $forum['lastread']; } else { $readforums[$forum['fid']] = ''; } }
|
$fpermissions = forum_permissions();
// Inline Mod Column for moderators
|
$fpermissions = forum_permissions();
// Inline Mod Column for moderators
|
$inlinemodcol = $inlinecookie = ''; $is_mod = $is_supermod = false;
| $inlinemodcol = $inlinecookie = $inline_edit_js = ''; $is_mod = $is_supermod = $show_inline_moderation = false;
|
if($mybb->usergroup['issupermod'])
|
if($mybb->usergroup['issupermod'])
|
{
| {
|
$is_supermod = true; } if($is_supermod || is_moderator())
|
$is_supermod = true; } if($is_supermod || is_moderator())
|
{ eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol")."\";");
| {
|
$inlinecookie = "inlinemod_search".$sid; $inlinecount = 0; $is_mod = true;
| $inlinecookie = "inlinemod_search".$sid; $inlinecount = 0; $is_mod = true;
|
Zeile 231 | Zeile 246 |
---|
}
// Show search results as 'threads'
|
}
// Show search results as 'threads'
|
if($search['resulttype'] == "threads")
| if(isset($search['resulttype']) && $search['resulttype'] == "threads")
|
{ $threadcount = 0;
|
{ $threadcount = 0;
|
// Moderators can view unapproved threads $query = $db->simple_select("moderators", "fid, canviewunapprove, canviewdeleted", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')"); if($mybb->usergroup['issupermod'] == 1) { // Super moderators (and admins) $unapproved_where = "t.visible>=-1"; } elseif($db->num_rows($query)) { // Normal moderators $unapprove_forums = array(); $deleted_forums = array(); $unapproved_where = '(t.visible = 1'; while($moderator = $db->fetch_array($query)) { if($moderator['canviewunapprove'] == 1) { $unapprove_forums[] = $moderator['fid']; }
if($moderator['canviewdeleted'] == 1) { $deleted_forums[] = $moderator['fid']; } }
if(!empty($unapprove_forums)) { $unapproved_where .= " OR (t.visible = 0 AND t.fid IN(".implode(',', $unapprove_forums)."))"; } if(!empty($deleted_forums)) { $unapproved_where .= " OR (t.visible = -1 AND t.fid IN(".implode(',', $deleted_forums)."))"; } $unapproved_where .= ')'; } else { // Normal users $unapproved_where = 't.visible>0'; }
| // Moderators can view unapproved threads and deleted threads from forums they moderate $unapproved_where_t = get_visible_where('t');
|
// If we have saved WHERE conditions, execute them if($search['querycache'] != "") { $where_conditions = $search['querycache'];
|
// If we have saved WHERE conditions, execute them if($search['querycache'] != "") { $where_conditions = $search['querycache'];
|
$query = $db->simple_select("threads t", "t.tid", $where_conditions. " AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%' ORDER BY t.lastpost DESC {$limitsql}");
| $query = $db->simple_select("threads t", "t.tid", $where_conditions. " AND ({$unapproved_where_t}) AND t.closed NOT LIKE 'moved|%' ORDER BY t.lastpost DESC {$limitsql}");
|
while($thread = $db->fetch_array($query)) { $threads[$thread['tid']] = $thread['tid'];
| while($thread = $db->fetch_array($query)) { $threads[$thread['tid']] = $thread['tid'];
|
Zeile 303 | Zeile 279 |
---|
else { $where_conditions = "t.tid IN (".$search['threads'].")";
|
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}");
| $query = $db->simple_select("threads t", "COUNT(t.tid) AS resultcount", $where_conditions. " AND ({$unapproved_where_t}) AND t.closed NOT LIKE 'moved|%' {$limitsql}");
|
$count = $db->fetch_array($query);
if(!$count['resultcount']) { error($lang->error_nosearchresults);
|
$count = $db->fetch_array($query);
if(!$count['resultcount']) { error($lang->error_nosearchresults);
|
}
| }
|
$threadcount = $count['resultcount']; }
| $threadcount = $count['resultcount']; }
|
Zeile 339 | Zeile 315 |
---|
if($inactiveforums) { $permsql .= " AND t.fid NOT IN ($inactiveforums)";
|
if($inactiveforums) { $permsql .= " AND t.fid NOT IN ($inactiveforums)";
|
| }
$pages = ceil($threadcount / $perpage); if($page > $pages) { $start = 0; $page = 1;
|
}
// Begin selecting matching threads, cache them.
| }
// Begin selecting matching threads, cache them.
|
Zeile 352 | Zeile 335 |
---|
SELECT t.*, u.username AS userusername FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
|
SELECT t.*, u.username AS userusername FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
|
WHERE $where_conditions AND {$unapproved_where} {$permsql} AND t.closed NOT LIKE 'moved|%'
| LEFT JOIN ".TABLE_PREFIX."forums f ON (t.fid=f.fid) WHERE $where_conditions AND ({$unapproved_where_t}) {$permsql} AND t.closed NOT LIKE 'moved|%'
|
ORDER BY $sortfield $order LIMIT $start, $perpage ");
| ORDER BY $sortfield $order LIMIT $start, $perpage ");
|
Zeile 378 | Zeile 362 |
---|
// Fetch dot icons if enabled if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $thread_cache) {
|
// Fetch dot icons if enabled if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $thread_cache) {
|
$p_unapproved_where = str_replace('t.', '', $unapproved_where); $query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='{$mybb->user['uid']}' AND tid IN({$thread_ids}) AND {$p_unapproved_where}");
| $unapproved_where_p = str_replace('t.', '', $unapproved_where_t); $query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='{$mybb->user['uid']}' AND tid IN({$thread_ids}) AND ({$unapproved_where_p})");
|
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;
|
Zeile 400 | Zeile 384 |
---|
{ $mybb->settings['maxmultipagelinks'] = 5; }
|
{ $mybb->settings['maxmultipagelinks'] = 5; }
|
|
|
$results = '';
foreach($thread_cache as $thread)
| $results = '';
foreach($thread_cache as $thread)
|
Zeile 411 | Zeile 395 |
---|
// Unapproved colour if($thread['visible'] == 0)
|
// Unapproved colour if($thread['visible'] == 0)
|
{
| {
|
$bgcolor = 'trow_shaded'; } elseif($thread['visible'] == -1)
| $bgcolor = 'trow_shaded'; } elseif($thread['visible'] == -1)
|
Zeile 422 | Zeile 406 |
---|
if($thread['userusername']) { $thread['username'] = $thread['userusername'];
|
if($thread['userusername']) { $thread['username'] = $thread['userusername'];
|
}
| } $thread['username'] = htmlspecialchars_uni($thread['username']);
|
$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
// If this thread has a prefix, insert a space between prefix and subject
| $thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
// If this thread has a prefix, insert a space between prefix and subject
|
Zeile 476 | Zeile 461 |
---|
} else {
|
} else {
|
$forum_read = $forumsread[$thread['fid']];
| if(isset($forumsread[$thread['fid']])) { $forum_read = $forumsread[$thread['fid']]; } else { $forum_read = ''; }
|
}
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read) {
|
}
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read) {
|
if($thread['lastread']) {
| if(isset($thread['lastread'])) {
|
$last_read = $thread['lastread']; } else { $last_read = $read_cutoff;
|
$last_read = $thread['lastread']; } 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']);
|
}
if($forum_read > $last_read)
| }
if($forum_read > $last_read)
|
{ $last_read = $forum_read; }
| { $last_read = $forum_read; }
|
Zeile 508 | Zeile 500 |
---|
$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost").$highlight; eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";"); $unreadpost = 1;
|
$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost").$highlight; eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";"); $unreadpost = 1;
|
} else {
| } else {
|
$new_class = 'subject_old'; $folder_label .= $lang->icon_no_new; }
| $new_class = 'subject_old'; $folder_label .= $lang->icon_no_new; }
|
Zeile 522 | Zeile 514 |
---|
} if($thread['closed'] == 1) {
|
} if($thread['closed'] == 1) {
|
$folder .= "lock"; $folder_label .= $lang->icon_lock;
| $folder .= "close"; $folder_label .= $lang->icon_close;
|
} $folder .= "folder";
| } $folder .= "folder";
|
Zeile 537 | Zeile 529 |
---|
$threadpages = ''; $morelink = ''; $thread['posts'] = $thread['replies'] + 1;
|
$threadpages = ''; $morelink = ''; $thread['posts'] = $thread['replies'] + 1;
|
if(is_moderator($thread['fid'], "canviewunapprove"))
| if(is_moderator($thread['fid'], "canviewdeleted") == true || is_moderator($thread['fid'], "canviewunapprove") == true)
|
{
|
{
|
$thread['posts'] += $thread['unapprovedposts'];
| if(is_moderator($thread['fid'], "canviewdeleted") == true) { $thread['posts'] += $thread['deletedposts']; } if(is_moderator($thread['fid'], "canviewunapprove") == true) { $thread['posts'] += $thread['unapprovedposts']; }
|
}
|
}
|
if(is_moderator($thread['fid'], "canviewdeleted"))
| elseif($group_permissions[$thread['fid']]['canviewdeletionnotice'] != 0)
|
{ $thread['posts'] += $thread['deletedposts']; }
| { $thread['posts'] += $thread['deletedposts']; }
|
Zeile 555 | Zeile 554 |
---|
$pagesstop = $mybb->settings['maxmultipagelinks'] - 1; $page_link = get_thread_link($thread['tid'], $thread['pages']).$highlight; eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
|
$pagesstop = $mybb->settings['maxmultipagelinks'] - 1; $page_link = get_thread_link($thread['tid'], $thread['pages']).$highlight; eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
|
} else {
| } else {
|
$pagesstop = $thread['pages']; } for($i = 1; $i <= $pagesstop; ++$i)
| $pagesstop = $thread['pages']; } for($i = 1; $i <= $pagesstop; ++$i)
|
Zeile 566 | Zeile 565 |
---|
eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";"); } eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");
|
eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";"); } eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");
|
}
| }
|
else { $threadpages = '';
| else { $threadpages = '';
|
Zeile 574 | Zeile 573 |
---|
$thread['multipage'] = ''; } $lastpostdate = my_date('relative', $thread['lastpost']);
|
$thread['multipage'] = ''; } $lastpostdate = my_date('relative', $thread['lastpost']);
|
$lastposter = $thread['lastposter'];
| |
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost"); $lastposteruid = $thread['lastposteruid'];
|
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost"); $lastposteruid = $thread['lastposteruid'];
|
| if(!$lastposteruid && !$thread['lastposter']) { $lastposter = htmlspecialchars_uni($lang->guest); } else { $lastposter = htmlspecialchars_uni($thread['lastposter']); }
|
$thread_link = get_thread_link($thread['tid']);
// Don't link to guest's profiles (they have no profile).
| $thread_link = get_thread_link($thread['tid']);
// Don't link to guest's profiles (they have no profile).
|
Zeile 592 | Zeile 598 |
---|
$thread['replies'] = my_number_format($thread['replies']); $thread['views'] = my_number_format($thread['views']);
|
$thread['replies'] = my_number_format($thread['replies']); $thread['views'] = my_number_format($thread['views']);
|
| $thread['forumlink'] = '';
|
if($forumcache[$thread['fid']]) {
|
if($forumcache[$thread['fid']]) {
|
$thread['forumlink'] = "<a href=\"".get_forum_link($thread['fid'])."\">".$forumcache[$thread['fid']]['name']."</a>"; } else { $thread['forumlink'] = "";
| $thread['forumlink_link'] = get_forum_link($thread['fid']); $thread['forumlink_name'] = $forumcache[$thread['fid']]['name']; eval("\$thread['forumlink'] = \"".$templates->get("search_results_threads_forumlink")."\";");
|
}
// 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
|
Zeile 636 | Zeile 641 |
---|
$inline_mod_checkbox = ''; if($is_supermod || is_moderator($thread['fid'])) {
|
$inline_mod_checkbox = ''; if($is_supermod || is_moderator($thread['fid'])) {
|
if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$thread['tid']}|"))
| if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$thread['tid']}|") !== false)
|
{ $inlinecheck = "checked=\"checked\""; ++$inlinecount;
| { $inlinecheck = "checked=\"checked\""; ++$inlinecount;
|
Zeile 645 | Zeile 650 |
---|
{ $inlinecheck = ''; }
|
{ $inlinecheck = ''; }
|
| // If this user is allowed to use the inline moderation tools for at least one thread, include the necessary scripts $show_inline_moderation = true;
|
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)
|
Zeile 664 | Zeile 673 |
---|
{ $upper = $threadcount; }
|
{ $upper = $threadcount; }
|
| $selectall = ''; $inlinemod = '';
|
// Inline Thread Moderation Options
|
// Inline Thread Moderation Options
|
if($is_mod)
| if($show_inline_moderation)
|
{
|
{
|
| eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol")."\";");
|
// If user has moderation tools available, prepare the Select All feature $lang->page_selected = $lang->sprintf($lang->page_selected, count($thread_cache)); $lang->all_selected = $lang->sprintf($lang->all_selected, (int)$threadcount);
| // If user has moderation tools available, prepare the Select All feature $lang->page_selected = $lang->sprintf($lang->page_selected, count($thread_cache)); $lang->all_selected = $lang->sprintf($lang->all_selected, (int)$threadcount);
|
Zeile 687 | Zeile 701 |
---|
while($tool = $db->fetch_array($query)) {
|
while($tool = $db->fetch_array($query)) {
|
| $tool['name'] = htmlspecialchars_uni($tool['name']);
|
eval("\$customthreadtools .= \"".$templates->get("search_results_threads_inlinemoderation_custom_tool")."\";"); } // Build inline moderation dropdown
| eval("\$customthreadtools .= \"".$templates->get("search_results_threads_inlinemoderation_custom_tool")."\";"); } // Build inline moderation dropdown
|
Zeile 695 | Zeile 710 |
---|
eval("\$customthreadtools = \"".$templates->get("search_results_threads_inlinemoderation_custom")."\";"); } eval("\$inlinemod = \"".$templates->get("search_results_threads_inlinemoderation")."\";");
|
eval("\$customthreadtools = \"".$templates->get("search_results_threads_inlinemoderation_custom")."\";"); } eval("\$inlinemod = \"".$templates->get("search_results_threads_inlinemoderation")."\";");
|
| } elseif($is_mod) { eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol_empty")."\";");
|
}
$plugins->run_hooks("search_results_end");
| }
$plugins->run_hooks("search_results_end");
|
Zeile 704 | Zeile 723 |
---|
} else // Displaying results as posts {
|
} else // Displaying results as posts {
|
if(!$search['posts'])
| if(empty($search['posts']))
|
{ error($lang->error_nosearchresults);
|
{ error($lang->error_nosearchresults);
|
}
| }
|
$postcount = 0;
|
$postcount = 0;
|
// Moderators can view unapproved threads $query = $db->simple_select("moderators", "fid, canviewunapprove, canviewdeleted", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')"); if($mybb->usergroup['issupermod'] == 1) { // Super moderators (and admins) $unapproved_where = "visible >= -1"; } elseif($db->num_rows($query)) { // Normal moderators $unapprove_forums = array(); $deleted_forums = array(); $unapproved_where = '(visible = 1';
while($moderator = $db->fetch_array($query)) { if($moderator['canviewunapprove'] == 1) { $unapprove_forums[] = $moderator['fid']; }
if($moderator['canviewdeleted'] == 1) { $deleted_forums[] = $moderator['fid']; } }
if(!empty($unapprove_forums)) { $unapproved_where .= " OR (visible = 0 AND fid IN(".implode(',', $unapprove_forums)."))"; } if(!empty($deleted_forums)) { $unapproved_where .= " OR (visible = -1 AND fid IN(".implode(',', $deleted_forums)."))"; } $unapproved_where .= ')'; } else { // Normal users $unapproved_where = 'visible = 1'; }
| // Moderators can view unapproved threads and deleted threads from forums they moderate $unapproved_where = get_visible_where();
|
$post_cache_options = array(); if((int)$mybb->settings['searchhardlimit'] > 0)
| $post_cache_options = array(); if((int)$mybb->settings['searchhardlimit'] > 0)
|
Zeile 769 | Zeile 748 |
---|
$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.
|
$query = $db->simple_select("posts", "pid, tid", "pid IN(".$db->escape_string($search['posts']).") AND {$unapproved_where}", $post_cache_options);
| $query = $db->simple_select("posts", "pid, tid", "pid IN(".$db->escape_string($search['posts']).") AND ({$unapproved_where})", $post_cache_options);
|
while($post = $db->fetch_array($query)) { $pids[$post['pid']] = $post['tid'];
| while($post = $db->fetch_array($query)) { $pids[$post['pid']] = $post['tid'];
|
Zeile 789 | Zeile 768 |
---|
if(!empty($forum_permissions['canonlyviewownthreads'])) { $onlyusfids[] = $fid;
|
if(!empty($forum_permissions['canonlyviewownthreads'])) { $onlyusfids[] = $fid;
|
} }
| } }
|
if($onlyusfids) {
| if($onlyusfids) {
|
Zeile 798 | Zeile 777 |
---|
} $unsearchforums = get_unsearchable_forums(); if($unsearchforums)
|
} $unsearchforums = get_unsearchable_forums(); if($unsearchforums)
|
{
| {
|
$permsql .= " OR fid IN ($unsearchforums)";
|
$permsql .= " OR fid IN ($unsearchforums)";
|
}
| }
|
$inactiveforums = get_inactive_forums(); if($inactiveforums) { $permsql .= " OR fid IN ($inactiveforums)";
|
$inactiveforums = get_inactive_forums(); if($inactiveforums) { $permsql .= " OR fid IN ($inactiveforums)";
|
}
// Check the thread records as well. If we don't have permissions, remove them from the listing. $query = $db->simple_select("threads", "tid", "tid IN(".$db->escape_string(implode(',', $pids)).") AND ({$unapproved_where}{$permsql} OR closed LIKE 'moved|%')");
| }
// Find threads in our list that we don't have permission to view and remove them $query = $db->simple_select("threads", "tid", "tid IN(".$db->escape_string(implode(',', array_keys($tids))).") AND (NOT ({$unapproved_where}){$permsql} OR closed LIKE 'moved|%')");
|
while($thread = $db->fetch_array($query)) {
|
while($thread = $db->fetch_array($query)) {
|
if(array_key_exists($thread['tid'], $tids) != true)
| if(array_key_exists($thread['tid'], $tids))
|
{ $temp_pids = $tids[$thread['tid']]; foreach($temp_pids as $pid)
| { $temp_pids = $tids[$thread['tid']]; foreach($temp_pids as $pid)
|
Zeile 819 | Zeile 798 |
---|
unset($pids[$pid]); unset($tids[$thread['tid']]); }
|
unset($pids[$pid]); unset($tids[$thread['tid']]); }
|
| unset($tids[$thread['tid']]);
|
} } unset($temp_pids);
| } } unset($temp_pids);
|
Zeile 826 | Zeile 806 |
---|
// Declare our post count $postcount = count($pids);
|
// Declare our post count $postcount = count($pids);
|
|
|
if(!$postcount) { error($lang->error_nosearchresults);
| if(!$postcount) { error($lang->error_nosearchresults);
|
Zeile 850 | Zeile 830 |
---|
$dot_icon = array(); if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] != 0) {
|
$dot_icon = array(); if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] != 0) {
|
$query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='{$mybb->user['uid']}' AND tid IN({$db->escape_string($tids)}) AND {$unapproved_where}");
| $query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='{$mybb->user['uid']}' AND tid IN({$db->escape_string($tids)}) AND ({$unapproved_where})");
|
while($post = $db->fetch_array($query)) { $dot_icon[$post['tid']] = true;
| while($post = $db->fetch_array($query)) { $dot_icon[$post['tid']] = true;
|
Zeile 858 | Zeile 838 |
---|
}
$results = '';
|
}
$results = '';
|
| $pages = ceil($postcount / $perpage); if($page > $pages) { $start = 0; $page = 1; }
|
$query = $db->query(" SELECT p.*, u.username AS userusername, t.subject AS thread_subject, t.replies AS thread_replies, t.views AS thread_views, t.lastpost AS thread_lastpost, t.closed AS thread_closed, t.uid as thread_uid FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
$query = $db->query(" SELECT p.*, u.username AS userusername, t.subject AS thread_subject, t.replies AS thread_replies, t.views AS thread_views, t.lastpost AS thread_lastpost, t.closed AS thread_closed, t.uid as thread_uid FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
| LEFT JOIN ".TABLE_PREFIX."forums f ON (t.fid=f.fid)
|
WHERE p.pid IN (".$db->escape_string($search['posts']).") ORDER BY $sortfield $order LIMIT $start, $perpage
| WHERE p.pid IN (".$db->escape_string($search['posts']).") ORDER BY $sortfield $order LIMIT $start, $perpage
|
Zeile 876 | Zeile 864 |
---|
$bgcolor = 'trow_shaded'; } elseif($post['visible'] == -1)
|
$bgcolor = 'trow_shaded'; } elseif($post['visible'] == -1)
|
{
| {
|
$bgcolor = 'trow_shaded trow_deleted';
|
$bgcolor = 'trow_shaded trow_deleted';
|
}
| }
|
if($post['userusername'])
|
if($post['userusername'])
|
{
| {
|
$post['username'] = $post['userusername']; }
|
$post['username'] = $post['userusername']; }
|
| $post['username'] = htmlspecialchars_uni($post['username']);
|
$post['profilelink'] = build_profile_link($post['username'], $post['uid']); $post['subject'] = $parser->parse_badwords($post['subject']); $post['thread_subject'] = $parser->parse_badwords($post['thread_subject']);
| $post['profilelink'] = build_profile_link($post['username'], $post['uid']); $post['subject'] = $parser->parse_badwords($post['subject']); $post['thread_subject'] = $parser->parse_badwords($post['thread_subject']);
|
Zeile 896 | Zeile 885 |
---|
$posticon['name'] = htmlspecialchars_uni($posticon['name']); eval("\$icon = \"".$templates->get("search_results_icon")."\";"); }
|
$posticon['name'] = htmlspecialchars_uni($posticon['name']); eval("\$icon = \"".$templates->get("search_results_icon")."\";"); }
|
else { $icon = " "; }
if(!empty($forumcache[$thread['fid']])) { $post['forumlink'] = "<a href=\"".get_forum_link($post['fid'])."\">".$forumcache[$post['fid']]['name']."</a>"; } else { $post['forumlink'] = ""; }
| else { $icon = " "; }
$post['forumlink'] = ''; if(!empty($forumcache[$post['fid']])) { $post['forumlink_link'] = get_forum_link($post['fid']); $post['forumlink_name'] = $forumcache[$post['fid']]['name']; eval("\$post['forumlink'] = \"".$templates->get("search_results_posts_forumlink")."\";"); }
|
// Determine the folder $folder = ''; $folder_label = '';
| // Determine the folder $folder = ''; $folder_label = '';
|
Zeile 916 | Zeile 905 |
---|
$isnew = 0; $donenew = 0; $last_read = 0;
|
$isnew = 0; $donenew = 0; $last_read = 0;
|
$post['thread_lastread'] = $readthreads[$post['tid']];
| if(isset($readthreads[$post['tid']])) { $post['thread_lastread'] = $readthreads[$post['tid']]; } else { $post['thread_lastread'] = ''; }
|
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
| if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
|
Zeile 930 | Zeile 927 |
---|
} else {
|
} else {
|
$forum_read = $forumsread[$post['fid']];
| if(isset($forumsread[$post['fid']])) { $forum_read = $forumsread[$post['fid']]; } else { $forum_read = ''; }
|
}
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forum_read)
| }
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forum_read)
|
Zeile 965 | Zeile 969 |
---|
elseif($forum_read > $mybb->user['lastvisit']) { $last_read = $forum_read;
|
elseif($forum_read > $mybb->user['lastvisit']) { $last_read = $forum_read;
|
}
| }
|
else { $last_read = $mybb->user['lastvisit'];
| else { $last_read = $mybb->user['lastvisit'];
|
Zeile 976 | Zeile 980 |
---|
{ $folder .= "new"; $folder_label .= $lang->icon_new;
|
{ $folder .= "new"; $folder_label .= $lang->icon_new;
|
| $thread['newpostlink'] = get_thread_link($post['tid'], 0, "newpost");
|
eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";"); $unreadpost = 1; }
| eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";"); $unreadpost = 1; }
|
Zeile 991 | Zeile 996 |
---|
} if($post['thread_closed'] == 1) {
|
} if($post['thread_closed'] == 1) {
|
$folder .= "lock"; $folder_label .= $lang->icon_lock;
| $folder .= "close"; $folder_label .= $lang->icon_close;
|
} $folder .= "folder";
$post['thread_replies'] = my_number_format($post['thread_replies']); $post['thread_views'] = my_number_format($post['thread_views']);
|
} $folder .= "folder";
$post['thread_replies'] = my_number_format($post['thread_replies']); $post['thread_views'] = my_number_format($post['thread_views']);
|
| $post['forumlink'] = '';
|
if($forumcache[$post['fid']]) {
|
if($forumcache[$post['fid']]) {
|
$post['forumlink'] = "<a href=\"".get_forum_link($post['fid'])."\">".$forumcache[$post['fid']]['name']."</a>"; } else { $post['forumlink'] = "";
| $post['forumlink_link'] = get_forum_link($post['fid']); $post['forumlink_name'] = $forumcache[$post['fid']]['name']; eval("\$post['forumlink'] = \"".$templates->get("search_results_posts_forumlink")."\";");
|
}
if(!$post['subject']) { $post['subject'] = $post['message'];
|
}
if(!$post['subject']) { $post['subject'] = $post['message'];
|
}
| }
|
if(my_strlen($post['subject']) > 50) { $post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50)."...");
| if(my_strlen($post['subject']) > 50) { $post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50)."...");
|
Zeile 1026 | Zeile 1030 |
---|
'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0,
|
'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0,
|
| 'me_username' => $post['username'],
|
'filter_badwords' => 1 );
|
'filter_badwords' => 1 );
|
$post['message'] = strip_tags($parser->parse_message($post['message'], $parser_options));
| $post['message'] = strip_tags($parser->text_parse_message($post['message'], $parser_options));
|
if(my_strlen($post['message']) > 200) { $prev = my_substr($post['message'], 0, 200)."...";
| if(my_strlen($post['message']) > 200) { $prev = my_substr($post['message'], 0, 200)."...";
|
Zeile 1046 | Zeile 1051 |
---|
$inline_mod_checkbox = ''; if($is_supermod || is_moderator($post['fid'])) {
|
$inline_mod_checkbox = ''; if($is_supermod || is_moderator($post['fid'])) {
|
if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$post['pid']}|"))
| if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$post['pid']}|") !== false)
|
{ $inlinecheck = "checked=\"checked\""; ++$inlinecount;
| { $inlinecheck = "checked=\"checked\""; ++$inlinecount;
|
Zeile 1055 | Zeile 1060 |
---|
{ $inlinecheck = ''; }
|
{ $inlinecheck = ''; }
|
| $show_inline_moderation = true;
|
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_posts_inlinecheck")."\";"); } elseif($is_mod)
| eval("\$inline_mod_checkbox = \"".$templates->get("search_results_posts_inlinecheck")."\";"); } elseif($is_mod)
|
Zeile 1074 | Zeile 1082 |
---|
{ $upper = $postcount; }
|
{ $upper = $postcount; }
|
| $selectall = ''; $inlinemod = '';
|
// Inline Post Moderation Options
|
// Inline Post Moderation Options
|
if($is_mod)
| if($show_inline_moderation)
|
{
|
{
|
| eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol")."\";");
|
// If user has moderation tools available, prepare the Select All feature $num_results = $db->num_rows($query); $lang->page_selected = $lang->sprintf($lang->page_selected, (int)$num_results);
| // If user has moderation tools available, prepare the Select All feature $num_results = $db->num_rows($query); $lang->page_selected = $lang->sprintf($lang->page_selected, (int)$num_results);
|
Zeile 1106 | Zeile 1119 |
---|
eval("\$customposttools = \"".$templates->get("search_results_posts_inlinemoderation_custom")."\";"); } eval("\$inlinemod = \"".$templates->get("search_results_posts_inlinemoderation")."\";");
|
eval("\$customposttools = \"".$templates->get("search_results_posts_inlinemoderation_custom")."\";"); } eval("\$inlinemod = \"".$templates->get("search_results_posts_inlinemoderation")."\";");
|
| } elseif($is_mod) { eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol_empty")."\";");
|
}
$plugins->run_hooks("search_results_end");
| }
$plugins->run_hooks("search_results_end");
|
Zeile 1128 | Zeile 1145 |
---|
{ $where_sql .= " AND fid NOT IN ($inactiveforums)"; }
|
{ $where_sql .= " AND fid NOT IN ($inactiveforums)"; }
|
| // Moderators can view unapproved threads and deleted threads from forums they moderate $unapproved_where = get_visible_where(); $where_sql .= " AND ({$unapproved_where})";
$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(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid; } } if(!empty($onlyusfids)) { $where_sql .= " AND fid NOT IN(".implode(',', $onlyusfids).")"; }
$options = array( 'order_by' => 'dateline DESC, pid DESC', );
// Do we have a hard search limit? if($mybb->settings['searchhardlimit'] > 0) { $options['limit'] = (int)$mybb->settings['searchhardlimit']; }
$pids = ''; $comma = ''; $query = $db->simple_select("posts", "pid", "{$where_sql}", $options); while($pid = $db->fetch_field($query, "pid")) { $pids .= $comma.$pid; $comma = ','; }
$tids = ''; $comma = ''; $query = $db->simple_select("threads", "tid", $where_sql); while($tid = $db->fetch_field($query, "tid")) { $tids .= $comma.$tid; $comma = ','; }
$sid = md5(uniqid(microtime(), true)); $searcharray = array( "sid" => $db->escape_string($sid), "uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip), "threads" => $db->escape_string($tids), "posts" => $db->escape_string($pids), "resulttype" => "posts", "querycache" => '', "keywords" => '' ); $plugins->run_hooks("search_do_search_process"); $db->insert_query("searchlog", $searcharray); redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); } elseif($mybb->input['action'] == "finduser") { $where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $where_sql .= " AND fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $where_sql .= " AND fid NOT IN ($inactiveforums)"; }
// Moderators can view unapproved threads and deleted threads from forums they moderate $unapproved_where = get_visible_where(); $where_sql .= " AND ({$unapproved_where})";
|
$permsql = ""; $onlyusfids = array();
| $permsql = ""; $onlyusfids = array();
|
Zeile 1143 | Zeile 1244 |
---|
} if(!empty($onlyusfids)) {
|
} if(!empty($onlyusfids)) {
|
$where_sql .= " AND fid NOT IN(".implode(',', $onlyusfids).")";
| $where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))";
|
}
$options = array(
|
}
$options = array(
|
'order_by' => 'dateline', 'order_dir' => 'desc'
| 'order_by' => 'dateline DESC, pid DESC',
|
);
// Do we have a hard search limit?
| );
// Do we have a hard search limit?
|
Zeile 1162 | Zeile 1262 |
---|
$query = $db->simple_select("posts", "pid", "{$where_sql}", $options); while($pid = $db->fetch_field($query, "pid")) {
|
$query = $db->simple_select("posts", "pid", "{$where_sql}", $options); while($pid = $db->fetch_field($query, "pid")) {
|
$pids .= $comma.$pid; $comma = ',';
| $pids .= $comma.$pid; $comma = ',';
|
}
$tids = '';
| }
$tids = '';
|
Zeile 1171 | Zeile 1271 |
---|
$query = $db->simple_select("threads", "tid", $where_sql); while($tid = $db->fetch_field($query, "tid")) {
|
$query = $db->simple_select("threads", "tid", $where_sql); while($tid = $db->fetch_field($query, "tid")) {
|
$tids .= $comma.$tid; $comma = ','; }
$sid = md5(uniqid(microtime(), true)); $searcharray = array( "sid" => $db->escape_string($sid), "uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip), "threads" => $db->escape_string($tids), "posts" => $db->escape_string($pids), "resulttype" => "posts", "querycache" => '', "keywords" => '' ); $plugins->run_hooks("search_do_search_process"); $db->insert_query("searchlog", $searcharray); redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); } elseif($mybb->input['action'] == "finduser") { $where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $where_sql .= " AND fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $where_sql .= " AND fid NOT IN ($inactiveforums)"; }
$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(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid; } } if(!empty($onlyusfids)) { $where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))"; }
$options = array( 'order_by' => 'dateline', 'order_dir' => 'desc' );
// Do we have a hard search limit? if($mybb->settings['searchhardlimit'] > 0) { $options['limit'] = (int)$mybb->settings['searchhardlimit']; }
$pids = ''; $comma = ''; $query = $db->simple_select("posts", "pid", "{$where_sql}", $options); while($pid = $db->fetch_field($query, "pid")) { $pids .= $comma.$pid; $comma = ','; }
$tids = ''; $comma = ''; $query = $db->simple_select("threads", "tid", $where_sql); while($tid = $db->fetch_field($query, "tid")) { $tids .= $comma.$tid; $comma = ',';
| $tids .= $comma.$tid; $comma = ',';
|
}
$sid = md5(uniqid(microtime(), true));
| }
$sid = md5(uniqid(microtime(), true));
|
Zeile 1269 | Zeile 1292 |
---|
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); } elseif($mybb->input['action'] == "finduserthreads")
|
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); } elseif($mybb->input['action'] == "finduserthreads")
|
{ $where_sql = "t.uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $where_sql .= " AND t.fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $where_sql .= " AND t.fid NOT IN ($inactiveforums)"; }
$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(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid; } } if(!empty($onlyusfids)) { $where_sql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))"; }
| { $where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $where_sql .= " AND fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $where_sql .= " AND fid NOT IN ($inactiveforums)"; }
// Moderators can view unapproved threads and deleted threads from forums they moderate $unapproved_where = get_visible_where(); $where_sql .= " AND ({$unapproved_where})";
$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(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid; } } if(!empty($onlyusfids)) { $where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))"; }
$tids = ''; $comma = ''; $query = $db->simple_select("threads", "tid", $where_sql); while($tid = $db->fetch_field($query, "tid")) { $tids .= $comma.$tid; $comma = ','; }
|
$sid = md5(uniqid(microtime(), true)); $searcharray = array(
| $sid = md5(uniqid(microtime(), true)); $searcharray = array(
|
Zeile 1306 | Zeile 1342 |
---|
"uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip),
|
"uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip),
|
"threads" => '',
| "threads" => $db->escape_string($tids),
|
"posts" => '', "resulttype" => "threads", "querycache" => $db->escape_string($where_sql),
| "posts" => '', "resulttype" => "threads", "querycache" => $db->escape_string($where_sql),
|
Zeile 1317 | Zeile 1353 |
---|
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); } elseif($mybb->input['action'] == "getnew")
|
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); } elseif($mybb->input['action'] == "getnew")
|
{
$where_sql = "t.lastpost >= '".(int)$mybb->user['lastvisit']."'";
if($mybb->get_input('fid', MyBB::INPUT_INT)) { $where_sql .= " AND t.fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'"; } else if($mybb->get_input('fids')) { $fids = explode(',', $mybb->get_input('fids')); foreach($fids as $key => $fid) { $fids[$key] = (int)$fid; }
if(!empty($fids)) { $where_sql .= " AND t.fid IN (".implode(',', $fids).")"; } }
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $where_sql .= " AND t.fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $where_sql .= " AND t.fid NOT IN ($inactiveforums)"; }
| {
$where_sql = "lastpost >= '".(int)$mybb->user['lastvisit']."'";
if($mybb->get_input('fid', MyBB::INPUT_INT)) { $where_sql .= " AND fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'"; } else if($mybb->get_input('fids')) { $fids = explode(',', $mybb->get_input('fids')); foreach($fids as $key => $fid) { $fids[$key] = (int)$fid; }
if(!empty($fids)) { $where_sql .= " AND fid IN (".implode(',', $fids).")"; } }
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $where_sql .= " AND fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $where_sql .= " AND fid NOT IN ($inactiveforums)"; }
// Moderators can view unapproved threads and deleted threads from forums they moderate $unapproved_where = get_visible_where(); $where_sql .= " AND ({$unapproved_where})";
|
$permsql = ""; $onlyusfids = array();
|
$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)
| // Check group permissions if we can't view threads not started by us $group_permissions = forum_permissions(); foreach($group_permissions as $fid => $forum_permissions)
|
Zeile 1361 | Zeile 1401 |
---|
{ $onlyusfids[] = $fid; }
|
{ $onlyusfids[] = $fid; }
|
}
| }
|
if(!empty($onlyusfids)) {
|
if(!empty($onlyusfids)) {
|
$where_sql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))";
| $where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))"; }
$tids = ''; $comma = ''; $query = $db->simple_select("threads", "tid", $where_sql); while($tid = $db->fetch_field($query, "tid")) { $tids .= $comma.$tid; $comma = ',';
|
}
$sid = md5(uniqid(microtime(), true));
| }
$sid = md5(uniqid(microtime(), true));
|
Zeile 1373 | Zeile 1422 |
---|
"uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip),
|
"uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip),
|
"threads" => '',
| "threads" => $db->escape_string($tids),
|
"posts" => '', "resulttype" => "threads", "querycache" => $db->escape_string($where_sql),
| "posts" => '', "resulttype" => "threads", "querycache" => $db->escape_string($where_sql),
|
Zeile 1389 | Zeile 1438 |
---|
if($mybb->get_input('days', MyBB::INPUT_INT) < 1) { $days = 1;
|
if($mybb->get_input('days', MyBB::INPUT_INT) < 1) { $days = 1;
|
} else { $days = $mybb->get_input('days', MyBB::INPUT_INT); } $datecut = TIME_NOW-(86400*$days);
| } else { $days = $mybb->get_input('days', MyBB::INPUT_INT); } $datecut = TIME_NOW-(86400*$days);
|
|
|
$where_sql = "t.lastpost >='".$datecut."'";
| $where_sql = "lastpost >='".$datecut."'";
|
if($mybb->get_input('fid', MyBB::INPUT_INT)) {
|
if($mybb->get_input('fid', MyBB::INPUT_INT)) {
|
$where_sql .= " AND t.fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";
| $where_sql .= " AND fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";
|
} else if($mybb->get_input('fids')) {
| } else if($mybb->get_input('fids')) {
|
Zeile 1412 | Zeile 1461 |
---|
if(!empty($fids)) {
|
if(!empty($fids)) {
|
$where_sql .= " AND t.fid IN (".implode(',', $fids).")";
| $where_sql .= " AND fid IN (".implode(',', $fids).")";
|
} }
$unsearchforums = get_unsearchable_forums(); if($unsearchforums)
|
} }
$unsearchforums = get_unsearchable_forums(); if($unsearchforums)
|
{ $where_sql .= " AND t.fid NOT IN ($unsearchforums)"; }
| { $where_sql .= " AND fid NOT IN ($unsearchforums)"; }
|
$inactiveforums = get_inactive_forums(); if($inactiveforums)
|
$inactiveforums = get_inactive_forums(); if($inactiveforums)
|
{ $where_sql .= " AND t.fid NOT IN ($inactiveforums)"; }
| { $where_sql .= " AND fid NOT IN ($inactiveforums)"; }
// Moderators can view unapproved threads and deleted threads from forums they moderate $unapproved_where = get_visible_where(); $where_sql .= " AND ({$unapproved_where})";
|
$permsql = ""; $onlyusfids = array();
| $permsql = ""; $onlyusfids = array();
|
Zeile 1437 | Zeile 1490 |
---|
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid;
|
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid;
|
} } if(!empty($onlyusfids)) { $where_sql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))"; }
| } } if(!empty($onlyusfids)) { $where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))"; }
$tids = ''; $comma = ''; $query = $db->simple_select("threads", "tid", $where_sql); while($tid = $db->fetch_field($query, "tid")) { $tids .= $comma.$tid; $comma = ','; }
|
$sid = md5(uniqid(microtime(), true)); $searcharray = array( "sid" => $db->escape_string($sid), "uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip),
|
$sid = md5(uniqid(microtime(), true)); $searcharray = array( "sid" => $db->escape_string($sid), "uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "ipaddress" => $db->escape_binary($session->packedip),
|
"threads" => '',
| "threads" => $db->escape_string($tids),
|
"posts" => '', "resulttype" => "threads", "querycache" => $db->escape_string($where_sql),
| "posts" => '', "resulttype" => "threads", "querycache" => $db->escape_string($where_sql),
|
Zeile 1461 | Zeile 1523 |
---|
$db->insert_query("searchlog", $searcharray); redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); }
|
$db->insert_query("searchlog", $searcharray); redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults); }
|
elseif($mybb->input['action'] == "do_search" && $mybb->request_method == "post")
| elseif($mybb->input['action'] == "do_search")
|
{ $plugins->run_hooks("search_do_search_start");
|
{ $plugins->run_hooks("search_do_search_start");
|
// Check if search flood checking is enabled and user is not admin if($mybb->settings['searchfloodtime'] > 0 && $mybb->usergroup['cancp'] != 1) {
| // Check if search flood checking is enabled and user is not admin if($mybb->settings['searchfloodtime'] > 0 && $mybb->usergroup['cancp'] != 1) {
|
// Fetch the time this user last searched if($mybb->user['uid'])
|
// Fetch the time this user last searched if($mybb->user['uid'])
|
{
| {
|
$conditions = "uid='{$mybb->user['uid']}'"; } else
| $conditions = "uid='{$mybb->user['uid']}'"; } else
|
Zeile 1481 | Zeile 1543 |
---|
$query = $db->simple_select("searchlog", "*", "$conditions AND dateline > '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC")); $last_search = $db->fetch_array($query); // Users last search was within the flood time, show the error
|
$query = $db->simple_select("searchlog", "*", "$conditions AND dateline > '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC")); $last_search = $db->fetch_array($query); // Users last search was within the flood time, show the error
|
if($last_search['sid'])
| if(!empty($last_search['sid']))
|
{ $remaining_time = $mybb->settings['searchfloodtime']-(TIME_NOW-$last_search['dateline']); if($remaining_time == 1)
|
{ $remaining_time = $mybb->settings['searchfloodtime']-(TIME_NOW-$last_search['dateline']); if($remaining_time == 1)
|
{
| {
|
$lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']); } else {
|
$lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']); } else {
|
$lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding, $mybb->settings['searchfloodtime'], $remaining_time);
| $lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding, $mybb->settings['searchfloodtime'], $remaining_time);
|
} error($lang->error_searchflooding); } } if($mybb->get_input('showresults') == "threads")
|
} error($lang->error_searchflooding); } } if($mybb->get_input('showresults') == "threads")
|
{
| {
|
$resulttype = "threads"; } else {
|
$resulttype = "threads"; } else {
|
$resulttype = "posts";
| $resulttype = "posts"; }
if(isset($mybb->input['forums']) && is_array($mybb->input['forums'])) { $forums = $mybb->get_input('forums', MyBB::INPUT_ARRAY); } else { $forums = array($mybb->get_input('forums'));
|
}
$search_data = array(
| }
$search_data = array(
|
Zeile 1511 | Zeile 1582 |
---|
"matchusername" => $mybb->get_input('matchusername', MyBB::INPUT_INT), "postdate" => $mybb->get_input('postdate', MyBB::INPUT_INT), "pddir" => $mybb->get_input('pddir', MyBB::INPUT_INT),
|
"matchusername" => $mybb->get_input('matchusername', MyBB::INPUT_INT), "postdate" => $mybb->get_input('postdate', MyBB::INPUT_INT), "pddir" => $mybb->get_input('pddir', MyBB::INPUT_INT),
|
"forums" => $mybb->input['forums'],
| "forums" => $forums,
|
"findthreadst" => $mybb->get_input('findthreadst', MyBB::INPUT_INT), "numreplies" => $mybb->get_input('numreplies', MyBB::INPUT_INT), "threadprefix" => $mybb->get_input('threadprefix', MyBB::INPUT_ARRAY)
| "findthreadst" => $mybb->get_input('findthreadst', MyBB::INPUT_INT), "numreplies" => $mybb->get_input('numreplies', MyBB::INPUT_INT), "threadprefix" => $mybb->get_input('threadprefix', MyBB::INPUT_ARRAY)
|
Zeile 1531 | Zeile 1602 |
---|
else { $search_results = perform_search_mysql($search_data);
|
else { $search_results = perform_search_mysql($search_data);
|
} } else {
| } } else {
|
error($lang->error_no_search_support); } $sid = md5(uniqid(microtime(), true));
| error($lang->error_no_search_support); } $sid = md5(uniqid(microtime(), true));
|
Zeile 1556 | Zeile 1627 |
---|
if(my_strtolower($mybb->get_input('sortordr')) == "asc" || my_strtolower($mybb->get_input('sortordr') == "desc")) { $sortorder = $mybb->get_input('sortordr');
|
if(my_strtolower($mybb->get_input('sortordr')) == "asc" || my_strtolower($mybb->get_input('sortordr') == "desc")) { $sortorder = $mybb->get_input('sortordr');
|
}
| }
|
else { $sortorder = "desc";
| else { $sortorder = "desc";
|
Zeile 1612 | Zeile 1683 |
---|
$query = $db->simple_select("searchlog", "*", "$conditions AND dateline > '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC")); $last_search = $db->fetch_array($query);
|
$query = $db->simple_select("searchlog", "*", "$conditions AND dateline > '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC")); $last_search = $db->fetch_array($query);
|
// We shouldn't show remaining time if time is 0 or under. $remaining_time = $mybb->settings['searchfloodtime']-(TIME_NOW-$last_search['dateline']); // Users last search was within the flood time, show the error. if($last_search['sid'] && $remaining_time > 0)
| if($last_search)
|
{
|
{
|
if($remaining_time == 1) { $lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']); } else
| // We shouldn't show remaining time if time is 0 or under. $remaining_time = $mybb->settings['searchfloodtime']-(TIME_NOW-$last_search['dateline']); // Users last search was within the flood time, show the error. if($remaining_time > 0)
|
{
|
{
|
$lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding, $mybb->settings['searchfloodtime'], $remaining_time);
| if($remaining_time == 1) { $lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']); } else { $lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding, $mybb->settings['searchfloodtime'], $remaining_time); } error($lang->error_searchflooding);
|
}
|
}
|
error($lang->error_searchflooding);
| |
} }
| } }
|