Vergleich inc/functions_search.php - 1.8.18 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 54Zeile 54
						$optionselected = '';
$selecteddone = "0";
}

						$optionselected = '';
$selecteddone = "0";
}

					if($forum['password'] != '')
{
if($mybb->cookies['forumpass'][$forum['fid']] === md5($mybb->user['uid'].$forum['password']))
{
$pwverified = 1;
}
else
{
$pwverified = 0;
}
}
if(empty($forum['password']) || $pwverified == 1)

					if(forum_password_validated($forum, true))












					{
eval("\$forumlistbits .= \"".$templates->get("search_forumlist_forum")."\";");
}

					{
eval("\$forumlistbits .= \"".$templates->get("search_forumlist_forum")."\";");
}

Zeile 114Zeile 103
	foreach($forum_cache as $fid => $forum)
{
if($permissioncache[$forum['fid']])

	foreach($forum_cache as $fid => $forum)
{
if($permissioncache[$forum['fid']])

		{

		{

			$perms = $permissioncache[$forum['fid']];

			$perms = $permissioncache[$forum['fid']];

		}

		}

		else

		else

		{

		{

			$perms = $mybb->usergroup;

			$perms = $mybb->usergroup;

		}

$pwverified = 1;
if($forum['password'] != '')
{
if(!my_hash_equals($mybb->cookies['forumpass'][$forum['fid']], md5($mybb->user['uid'].$forum['password'])))
{
$pwverified = 0;
}

 
		}

$parents = explode(",", $forum['parentlist']);

		}

$parents = explode(",", $forum['parentlist']);

Zeile 143Zeile 123
			}
}


			}
}


		if($perms['canview'] != 1 || $perms['cansearch'] != 1 || $pwverified == 0 || $forum['active'] == 0)

		if($perms['canview'] != 1 || $perms['cansearch'] != 1 || !forum_password_validated($forum, true) || $forum['active'] == 0)

		{
if($unsearchableforums)
{

		{
if($unsearchableforums)
{

Zeile 168Zeile 148
	}

return $unsearchable;

	}

return $unsearchable;

 
}

/**
* Build query condition for threads/posts the user is allowed to see.
* Will return for example:
* - visible = 1 - for normal users
* - visible >= -1 - for admins & super mods
* - (visible = 1 OR (visible = ? AND fid IN ...)) - for forum moderators
*
* @param string $table_alias The alias of the table eg t to use t.visible instead of visible
* @return string the query condition
*/
function get_visible_where($table_alias = null)
{
global $db, $mybb;

$aliasdot = '';
if(!empty($table_alias))
{
$aliasdot = $table_alias.'.';
}

if($mybb->usergroup['issupermod'] == 1)
{
// Super moderators (and admins)
return "{$aliasdot}visible >= -1";
}
elseif(is_moderator())
{
// Normal moderators
$unapprove_forums = array();
$deleted_forums = array();
$unapproved_where = "({$aliasdot}visible = 1";

$moderated_fids = get_moderated_fids($mybb->user['uid']);

if($moderated_fids !== false)
{
foreach($moderated_fids as $fid)
{
if(!is_moderator($fid))
{
// Shouldn't occur.
continue;
}

// Use moderates this forum
$modperms = get_moderator_permissions($fid, $mybb->user['uid']);

if($modperms['canviewunapprove'] == 1)
{
$unapprove_forums[] = $fid;
}

if($modperms['canviewdeleted'] == 1)
{
$deleted_forums[] = $fid;
}
}

if(!empty($unapprove_forums))
{
$unapproved_where .= " OR ({$aliasdot}visible = 0 AND {$aliasdot}fid IN(".implode(',', $unapprove_forums)."))";
}
if(!empty($deleted_forums))
{
$unapproved_where .= " OR ({$aliasdot}visible = -1 AND {$aliasdot}fid IN(".implode(',', $deleted_forums)."))";
}
$unapproved_where .= ')';

return $unapproved_where;
}
}

// Normal users
if($mybb->user['uid'] > 0 && $mybb->settings['showownunapproved'] == 1)
{
return "({$aliasdot}visible = 1 OR ({$aliasdot}visible = 0 AND {$aliasdot}uid = {$mybb->user['uid']}))";
}
return "{$aliasdot}visible = 1";

}

/**

}

/**

Zeile 202Zeile 262
	$pass_fids = array();
foreach($fids as $fid)
{

	$pass_fids = array();
foreach($fids as $fid)
{

		if(empty($forum_cache[$fid]['password']))
{
continue;
}

if(md5($mybb->user['uid'].$forum_cache[$fid]['password']) !== $mybb->cookies['forumpass'][$fid])

		if(!forum_password_validated($forum_cache[$fid], true))






		{
$pass_fids[] = $fid;

		{
$pass_fids[] = $fid;

			$child_list = get_child_list($fid);
}

if(is_array($child_list))
{
$pass_fids = array_merge($pass_fids, $child_list);

			$pass_fids = array_merge($pass_fids, get_child_list($fid));






		}
}
return array_unique($pass_fids);

		}
}
return array_unique($pass_fids);

Zeile 272Zeile 322
	// Separate braces for further processing
$keywords = preg_replace("#((\+|-|<|>|~)?\(|\))#s", " $1 ", $keywords);
$keywords = preg_replace("#\s+#s", " ", $keywords);

	// Separate braces for further processing
$keywords = preg_replace("#((\+|-|<|>|~)?\(|\))#s", " $1 ", $keywords);
$keywords = preg_replace("#\s+#s", " ", $keywords);

 

global $mybb;

$min_word_length = (int) $mybb->settings['minsearchword'];
if($min_word_length <= 0)
{
$min_word_length = 3;
}
$min_word_length -= 1;

$word_length_regex = '';
if($min_word_length > 1)
{
$word_length_regex = "{1,{$min_word_length}}";
}

// Replaces less than 3 characters
$keywords = preg_replace("/(\b.{$word_length_regex})(\s)|(\b.{$word_length_regex}$)/u", '$2', $keywords);
// Collapse multiple spaces
$keywords = preg_replace('/(\s)+/', '$1', $keywords);
$keywords = trim($keywords);


$words = array(array());



$words = array(array());


Zeile 296Zeile 367
				// Phrases do not need further processing
$words[$depth][] = "{$boolean[$depth]}\"{$phrase}\"";
$boolean[$depth] = $phrase_operator = '+';

				// Phrases do not need further processing
$words[$depth][] = "{$boolean[$depth]}\"{$phrase}\"";
$boolean[$depth] = $phrase_operator = '+';

			}

			}

			else
{
// Split words

			else
{
// Split words

Zeile 390Zeile 461
					}
}
}

					}
}
}

		}

		}

		$inquote = !$inquote;
}


		$inquote = !$inquote;
}


Zeile 457Zeile 528
			{
$string = "OR";
$subject_lookin = " AND (";

			{
$string = "OR";
$subject_lookin = " AND (";

			}

if($search['message'] == 1)
{

			}

if($search['message'] == 1)
{

				$message_lookin = " {$string} (";
}


				$message_lookin = " {$string} (";
}


Zeile 556Zeile 627
				if($search['subject'] && $search['message'] && $subject_lookin == " AND (")
{
// We're looking for anything, check for a subject lookin

				if($search['subject'] && $search['message'] && $subject_lookin == " AND (")
{
// We're looking for anything, check for a subject lookin

					$error = true;
}

					$error = true;
}

				elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (")
{
// Just in a subject?

				elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (")
{
// Just in a subject?

					$error = true;

					$error = true;

				}
elseif(!$search['subject'] && $search['message'] && $message_lookin == " {$string} (")

				}
elseif(!$search['subject'] && $search['message'] && $message_lookin == " {$string} (")

				{

				{

					// Just in a message?
$error = true;

					// Just in a message?
$error = true;

				}

				}


if($error == true)
{


if($error == true)
{

Zeile 582Zeile 653
			if($search['subject'] == 1)
{
$subject_lookin .= ")";

			if($search['subject'] == 1)
{
$subject_lookin .= ")";

			}

			}


if($search['message'] == 1)
{


if($search['message'] == 1)
{

Zeile 630Zeile 701
			case 'mysql':
case 'mysqli':
$field = 'username';

			case 'mysql':
case 'mysqli':
$field = 'username';

				break;

				break;

			default:
$field = 'LOWER(username)';
break;

			default:
$field = 'LOWER(username)';
break;

Zeile 644Zeile 715
		if(count($userids) < 1)
{
error($lang->error_nosearchresults);

		if(count($userids) < 1)
{
error($lang->error_nosearchresults);

		}

		}

		else
{
$userids = implode(',', $userids);

		else
{
$userids = implode(',', $userids);

Zeile 653Zeile 724
	}

if(!is_array($search['folder']))

	}

if(!is_array($search['folder']))

	{
$search['folder'] = array($search['folder']);

	{
$search['folder'] = array($search['folder']);

	}

if(!empty($search['folder']))

	}

if(!empty($search['folder']))

Zeile 745Zeile 816
	{
$mybb->settings['minsearchword'] = 3;
}

	{
$mybb->settings['minsearchword'] = 3;
}





	$name_lookin = "";
$document_lookin = "";
$searchsql = "enabled='1'";

	$name_lookin = "";
$document_lookin = "";
$searchsql = "enabled='1'";

Zeile 814Zeile 885
								elseif($search['name'] && !$search['document'] && $name_lookin == " AND (")
{
// Just in a name?

								elseif($search['name'] && !$search['document'] && $name_lookin == " AND (")
{
// Just in a name?

									continue;
}

									continue;
}

								elseif(!$search['name'] && $search['document'] && $document_lookin == " {$string} (")
{
// Just in a document?
continue;
}

								elseif(!$search['name'] && $search['document'] && $document_lookin == " {$string} (")
{
// Just in a document?
continue;
}

							}

							}


$boolean = $word;


$boolean = $word;

						}

						}

						// Otherwise check the length of the word as it is a normal search term
else
{

						// Otherwise check the length of the word as it is a normal search term
else
{

Zeile 839Zeile 910
							if($search['name'] == 1)
{
$name_lookin .= " $boolean {$nfield} LIKE '%{$word}%'";

							if($search['name'] == 1)
{
$name_lookin .= " $boolean {$nfield} LIKE '%{$word}%'";

							}
if($search['document'] == 1)
{
$document_lookin .= " $boolean {$dfield} LIKE '%{$word}%'";
}
}
}
}
// In the middle of a quote (phrase)
else
{

							}
if($search['document'] == 1)
{
$document_lookin .= " $boolean {$dfield} LIKE '%{$word}%'";
}
}
}
}
// In the middle of a quote (phrase)
else
{

					$phrase = str_replace(array("+", "-", "*"), '', trim($phrase));
if(my_strlen($phrase) < $mybb->settings['minsearchword'])
{

					$phrase = str_replace(array("+", "-", "*"), '', trim($phrase));
if(my_strlen($phrase) < $mybb->settings['minsearchword'])
{

Zeile 862Zeile 933
					{
$document_lookin .= " $boolean {$dfield} LIKE '%{$phrase}%'";
}

					{
$document_lookin .= " $boolean {$dfield} LIKE '%{$phrase}%'";
}

				}

				}


// Check to see if we have any search terms and not a malformed SQL string
$error = false;


// Check to see if we have any search terms and not a malformed SQL string
$error = false;

Zeile 874Zeile 945
				elseif($search['name'] && !$search['document'] && $name_lookin == " AND (")
{
// Just in a name?

				elseif($search['name'] && !$search['document'] && $name_lookin == " AND (")
{
// Just in a name?

					$error = true;

					$error = true;

				}
elseif(!$search['name'] && $search['document'] && $document_lookin == " {$string} (")

				}
elseif(!$search['name'] && $search['document'] && $document_lookin == " {$string} (")

				{

				{

					// Just in a document?
$error = true;

					// Just in a document?
$error = true;

				}

				}


if($error == true)
{


if($error == true)
{

Zeile 898Zeile 969
			}

if($search['document'] == 1)

			}

if($search['document'] == 1)

			{

			{

				$document_lookin .= ")";
}


				$document_lookin .= ")";
}


Zeile 908Zeile 979
		{
$keywords = str_replace("\"", '', trim($keywords));
if(my_strlen($keywords) < $mybb->settings['minsearchword'])

		{
$keywords = str_replace("\"", '', trim($keywords));
if(my_strlen($keywords) < $mybb->settings['minsearchword'])

			{

			{

				$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']);
error($lang->error_minsearchlength);

				$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']);
error($lang->error_minsearchlength);

			}

			}


// If we're looking in both, then find matches in either the name or the document
if($search['name'] == 1 && $search['document'] == 1)


// If we're looking in both, then find matches in either the name or the document
if($search['name'] == 1 && $search['document'] == 1)

Zeile 923Zeile 994
				if($search['name'] == 1)
{
$searchsql .= " AND {$nfield} LIKE '%{$keywords}%'";

				if($search['name'] == 1)
{
$searchsql .= " AND {$nfield} LIKE '%{$keywords}%'";

				}

				}


if($search['document'] == 1)
{


if($search['document'] == 1)
{

Zeile 963Zeile 1034
	global $mybb, $db, $lang, $cache;

$keywords = clean_keywords($search['keywords']);

	global $mybb, $db, $lang, $cache;

$keywords = clean_keywords($search['keywords']);

	if(!$keywords && !$search['author'])
{
error($lang->error_nosearchterms);
}








	if($mybb->settings['minsearchword'] < 1)
{
$mybb->settings['minsearchword'] = 3;
}

	if($mybb->settings['minsearchword'] < 1)
{
$mybb->settings['minsearchword'] = 3;
}





	$subject_lookin = $message_lookin = '';
if($keywords)
{

	$subject_lookin = $message_lookin = '';
if($keywords)
{

Zeile 1021Zeile 1088
						if($i % 2 && ($word == "and" || $word == "or"))
{
if($i <= 1 && $subject_lookin == " AND (")

						if($i % 2 && ($word == "and" || $word == "or"))
{
if($i <= 1 && $subject_lookin == " AND (")

							{

							{

								continue;
}


								continue;
}


Zeile 1033Zeile 1100
							$word = trim($word);
// Word is too short - show error message
if(my_strlen($word) < $mybb->settings['minsearchword'])

							$word = trim($word);
// Word is too short - show error message
if(my_strlen($word) < $mybb->settings['minsearchword'])

							{

							{

								$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']);
error($lang->error_minsearchlength);

								$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']);
error($lang->error_minsearchlength);

							}

							}

							// Add terms to search query
$subject_lookin .= " $boolean {$tfield} LIKE '%{$word}%'";
if($search['postthread'] == 1)

							// Add terms to search query
$subject_lookin .= " $boolean {$tfield} LIKE '%{$word}%'";
if($search['postthread'] == 1)

Zeile 1045Zeile 1112
							}
$boolean = 'AND';
}

							}
$boolean = 'AND';
}

					}

					}

				}
// In the middle of a quote (phrase)
else

				}
// In the middle of a quote (phrase)
else

Zeile 1089Zeile 1156
			if($search['postthread'] == 1)
{
$message_lookin = " AND {$pfield} LIKE '%{$keywords}%'";

			if($search['postthread'] == 1)
{
$message_lookin = " AND {$pfield} LIKE '%{$keywords}%'";

			}
}

			}
}

	}
$post_usersql = '';
$thread_usersql = '';

	}
$post_usersql = '';
$thread_usersql = '';

Zeile 1099Zeile 1166
		$userids = array();
$search['author'] = my_strtolower($search['author']);
if($search['matchusername'])

		$userids = array();
$search['author'] = my_strtolower($search['author']);
if($search['matchusername'])

		{

		{

			$user = get_user_by_username($search['author']);
if($user)

			$user = get_user_by_username($search['author']);
if($user)

			{

			{

				$userids[] = $user['uid'];
}
}

				$userids[] = $user['uid'];
}
}

Zeile 1113Zeile 1180
				case 'mysql':
case 'mysqli':
$field = 'username';

				case 'mysql':
case 'mysqli':
$field = 'username';

					break;

					break;

				default:
$field = 'LOWER(username)';
break;

				default:
$field = 'LOWER(username)';
break;

Zeile 1182Zeile 1249
		$thread_prefixcut .= " AND t.prefix='$threadprefix' ";
}
else

		$thread_prefixcut .= " AND t.prefix='$threadprefix' ";
}
else

	{

	{

		if(count($prefixlist) > 1)
{
$thread_prefixcut = " AND t.prefix IN (".implode(',', $prefixlist).")";

		if(count($prefixlist) > 1)
{
$thread_prefixcut = " AND t.prefix IN (".implode(',', $prefixlist).")";

Zeile 1228Zeile 1295
			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))
{
$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)";

			}
}
}
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)

	}
$inactiveforums = get_inactive_forums();
if($inactiveforums)

	{

	{

		$permsql .= " AND t.fid NOT IN ($inactiveforums)";
}

		$permsql .= " AND t.fid NOT IN ($inactiveforums)";
}


$visiblesql = $post_visiblesql = $plain_post_visiblesql = "";


$visiblesql = $post_visiblesql = $plain_post_visiblesql = $unapproved_where_t = $unapproved_where_p = "";

	if(isset($search['visible']))
{
if($search['visible'] == 1)

	if(isset($search['visible']))
{
if($search['visible'] == 1)

Zeile 1263Zeile 1330
		elseif($search['visible'] == -1)
{
$visiblesql = " AND t.visible = '-1'";

		elseif($search['visible'] == -1)
{
$visiblesql = " AND t.visible = '-1'";


if($search['postthread'] == 1)
{


if($search['postthread'] == 1)
{

				$post_visiblesql = " AND p.visible = '-1'";
$plain_post_visiblesql = " AND visible = '-1'";

				$post_visiblesql = " AND p.visible = '-1'";
$plain_post_visiblesql = " AND visible = '-1'";

			}
}

			}
}

		else
{
$visiblesql = " AND t.visible == '0'";

		else
{
$visiblesql = " AND t.visible == '0'";





			if($search['postthread'] == 1)
{
$post_visiblesql = " AND p.visible == '0'";

			if($search['postthread'] == 1)
{
$post_visiblesql = " AND p.visible == '0'";

Zeile 1281Zeile 1348
			}
}
}

			}
}
}

 

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where_t = get_visible_where('t');
$unapproved_where_p = get_visible_where('p');


// Searching a specific thread?
$tidsql = '';


// Searching a specific thread?
$tidsql = '';

Zeile 1307Zeile 1378
			$query = $db->query("
SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t

			$query = $db->query("
SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t

				WHERE 1=1 {$thread_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$thread_usersql} {$permsql} {$visiblesql} AND t.closed NOT LIKE 'moved|%' {$subject_lookin}

				WHERE 1=1 {$thread_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$thread_usersql} {$permsql} {$visiblesql} AND ({$unapproved_where_t}) AND t.closed NOT LIKE 'moved|%' {$subject_lookin}

				{$limitsql}
");
while($thread = $db->fetch_array($query))

				{$limitsql}
");
while($thread = $db->fetch_array($query))

Zeile 1324Zeile 1395
			SELECT p.pid, p.tid
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

			SELECT p.pid, p.tid
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

			WHERE 1=1 {$post_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$post_usersql} {$permsql} {$tidsql} {$visiblesql} {$post_visiblesql} AND t.closed NOT LIKE 'moved|%' {$message_lookin}

			WHERE 1=1 {$post_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$post_usersql} {$permsql} {$tidsql} {$visiblesql} {$post_visiblesql} AND ({$unapproved_where_t}) AND ({$unapproved_where_p}) AND t.closed NOT LIKE 'moved|%' {$message_lookin}

			{$limitsql}
");
while($post = $db->fetch_array($query))

			{$limitsql}
");
while($post = $db->fetch_array($query))

Zeile 1339Zeile 1410
		}
$threads = implode(',', $threads);
$posts = implode(',', $posts);

		}
$threads = implode(',', $threads);
$posts = implode(',', $posts);


}


}

	// Searching only thread titles
else
{

	// Searching only thread titles
else
{

Zeile 1393Zeile 1464
	global $mybb, $db, $lang;

$keywords = clean_keywords_ft($search['keywords']);

	global $mybb, $db, $lang;

$keywords = clean_keywords_ft($search['keywords']);

	if(!$keywords && !$search['author'])
{
error($lang->error_nosearchterms);
}

 




	// Attempt to determine minimum word length from MySQL for fulltext searches
$query = $db->query("SHOW VARIABLES LIKE 'ft_min_word_len';");
$min_length = $db->fetch_field($query, 'Value');
if(is_numeric($min_length))
{
$mybb->settings['minsearchword'] = $min_length;
}
// Otherwise, could not fetch - default back to MySQL fulltext default setting
else

	if($mybb->settings['minsearchword'] < 1)









	{
$mybb->settings['minsearchword'] = 4;
}

	{
$mybb->settings['minsearchword'] = 4;
}

Zeile 1444Zeile 1503
				if(my_strlen($phrase) < $mybb->settings['minsearchword'])
{
$all_too_short = true;

				if(my_strlen($phrase) < $mybb->settings['minsearchword'])
{
$all_too_short = true;

				}

				}

				else
{
$all_too_short = false;

				else
{
$all_too_short = false;

Zeile 1469Zeile 1528
		$userids = array();
$search['author'] = my_strtolower($search['author']);
if($search['matchusername'])

		$userids = array();
$search['author'] = my_strtolower($search['author']);
if($search['matchusername'])

		{

		{

			$user = get_user_by_username($search['author']);
if($user)
{

			$user = get_user_by_username($search['author']);
if($user)
{

Zeile 1517Zeile 1576

$thread_replycut = '';
if($search['numreplies'] != '' && $search['findthreadst'])


$thread_replycut = '';
if($search['numreplies'] != '' && $search['findthreadst'])

	{

	{

		if((int)$search['findthreadst'] == 1)
{
$thread_replycut = " AND t.replies >= '".(int)$search['numreplies']."'";
}
else

		if((int)$search['findthreadst'] == 1)
{
$thread_replycut = " AND t.replies >= '".(int)$search['numreplies']."'";
}
else

		{

		{

			$thread_replycut = " AND t.replies <= '".(int)$search['numreplies']."'";

			$thread_replycut = " AND t.replies <= '".(int)$search['numreplies']."'";

		}
}

		}
}


$thread_prefixcut = '';
$prefixlist = array();


$thread_prefixcut = '';
$prefixlist = array();

Zeile 1541Zeile 1600
	if(count($prefixlist) == 1)
{
$thread_prefixcut .= " AND t.prefix='$threadprefix' ";

	if(count($prefixlist) == 1)
{
$thread_prefixcut .= " AND t.prefix='$threadprefix' ";

	}

	}

	else
{
if(count($prefixlist) > 1)

	else
{
if(count($prefixlist) > 1)

Zeile 1606Zeile 1665
		$permsql .= " AND t.fid NOT IN ($inactiveforums)";
}


		$permsql .= " AND t.fid NOT IN ($inactiveforums)";
}


	$visiblesql = $post_visiblesql = $plain_post_visiblesql = "";

	$visiblesql = $post_visiblesql = $plain_post_visiblesql = $unapproved_where_t = $unapproved_where_p = "";

	if(isset($search['visible']))
{
if($search['visible'] == 1)

	if(isset($search['visible']))
{
if($search['visible'] == 1)

Zeile 1640Zeile 1699
			}
}
}

			}
}
}

 

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where_t = get_visible_where('t');
$unapproved_where_p = get_visible_where('p');


// Searching a specific thread?
if($search['tid'])


// Searching a specific thread?
if($search['tid'])

Zeile 1665Zeile 1728
			$query = $db->query("
SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t

			$query = $db->query("
SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t

				WHERE 1=1 {$thread_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$thread_usersql} {$permsql} {$visiblesql} AND t.closed NOT LIKE 'moved|%' {$subject_lookin}

				WHERE 1=1 {$thread_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$thread_usersql} {$permsql} {$visiblesql} AND ({$unapproved_where_t}) AND t.closed NOT LIKE 'moved|%' {$subject_lookin}

				{$limitsql}
");
while($thread = $db->fetch_array($query))

				{$limitsql}
");
while($thread = $db->fetch_array($query))

Zeile 1682Zeile 1745
			SELECT p.pid, p.tid
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

			SELECT p.pid, p.tid
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

			WHERE 1=1 {$post_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$post_usersql} {$permsql} {$tidsql} {$post_visiblesql} {$visiblesql} AND t.closed NOT LIKE 'moved|%' {$message_lookin}

			WHERE 1=1 {$post_datecut} {$thread_replycut} {$thread_prefixcut} {$forumin} {$post_usersql} {$permsql} {$tidsql} {$post_visiblesql} {$visiblesql} AND ({$unapproved_where_t}) AND {$unapproved_where_p} AND t.closed NOT LIKE 'moved|%' {$message_lookin}

			{$limitsql}
");
while($post = $db->fetch_array($query))

			{$limitsql}
");
while($post = $db->fetch_array($query))