Vergleich inc/functions_search.php - 1.8.28 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 83Zeile 83
 */
function get_unsearchable_forums($pid=0, $first=1)
{

 */
function get_unsearchable_forums($pid=0, $first=1)
{

	global $db, $forum_cache, $permissioncache, $mybb, $unsearchableforums, $unsearchable, $templates, $forumpass;

	global $forum_cache, $permissioncache, $mybb, $unsearchableforums, $unsearchable, $templates, $forumpass;


$pid = (int)$pid;

if(!is_array($forum_cache))
{


$pid = (int)$pid;

if(!is_array($forum_cache))
{

		// Get Forums
$query = $db->simple_select("forums", "fid,parentlist,password,active", '', array('order_by' => 'pid, disporder'));
while($forum = $db->fetch_array($query))
{
$forum_cache[$forum['fid']] = $forum;
}

		cache_forums();






	}
if(!is_array($permissioncache))
{

	}
if(!is_array($permissioncache))
{

Zeile 360Zeile 355
	// Brace depth
$depth = 0;
$phrase_operator = '+';

	// Brace depth
$depth = 0;
$phrase_operator = '+';

 
	$inquote = false;

	foreach($keywords as $phrase)
{
$phrase = trim($phrase);

	foreach($keywords as $phrase)
{
$phrase = trim($phrase);

Zeile 492Zeile 488
 * @return array Array of search data with results mixed in
*/
function privatemessage_perform_search_mysql($search)

 * @return array Array of search data with results mixed in
*/
function privatemessage_perform_search_mysql($search)

{
global $mybb, $db, $lang;

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

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

{
global $mybb, $db, $lang;

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

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

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


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


Zeile 655Zeile 651
				}

$inquote = !$inquote;

				}

$inquote = !$inquote;

			}

			}


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


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

Zeile 699Zeile 695
	}

if($search['sender'])

	}

if($search['sender'])

	{
$userids = array();
$search['sender'] = my_strtolower($search['sender']);

switch($db->type)
{
case 'mysql':
case 'mysqli':

	{
$userids = array();
$search['sender'] = my_strtolower($search['sender']);

switch($db->type)
{
case 'mysql':
case 'mysqli':

				$field = 'username';
break;
default:

				$field = 'username';
break;
default:

Zeile 746Zeile 742
		if($folderids)
{
$searchsql .= " AND folder IN (".$folderids.")";

		if($folderids)
{
$searchsql .= " AND folder IN (".$folderids.")";

		}
}


		}
}


	if($search['status'])
{
$searchsql .= " AND (";

	if($search['status'])
{
$searchsql .= " AND (";

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

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





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

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

Zeile 899Zeile 895
									// Just in a document?
continue;
}

									// Just in a document?
continue;
}

							}

$boolean = $word;
}
// Otherwise check the length of the word as it is a normal search term
else
{
$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']);

							}

$boolean = $word;
}
// Otherwise check the length of the word as it is a normal search term
else
{
$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);
}
// Add terms to search query

								error($lang->error_minsearchlength);
}
// Add terms to search query

Zeile 1243Zeile 1239

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


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

	if($search['threadprefix'] && $search['threadprefix'][0] != 'any')

	if(!empty($search['threadprefix']) && $search['threadprefix'][0] != 'any')

	{
foreach($search['threadprefix'] as $threadprefix)
{

	{
foreach($search['threadprefix'] as $threadprefix)
{

Zeile 1302Zeile 1298
			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)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
$permsql .= " AND t.fid NOT IN ($inactiveforums)";
}

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


$visiblesql = $post_visiblesql = $plain_post_visiblesql = $unapproved_where_t = $unapproved_where_p = "";
if(isset($search['visible']))


$visiblesql = $post_visiblesql = $plain_post_visiblesql = $unapproved_where_t = $unapproved_where_p = "";
if(isset($search['visible']))

Zeile 1531Zeile 1527
	}
$post_usersql = '';
$thread_usersql = '';

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

	if($search['author'])

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

	{
$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'];
}
}

		else
{
$query = $db->simple_select("users", "uid", "username LIKE '%".$db->escape_string_like($search['author'])."%'");

		else
{
$query = $db->simple_select("users", "uid", "username LIKE '%".$db->escape_string_like($search['author'])."%'");

Zeile 1551Zeile 1547
			{
$userids[] = $user['uid'];
}

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

		}

		}


if(count($userids) < 1)


if(count($userids) < 1)

		{
error($lang->error_nosearchresults);
}

		{
error($lang->error_nosearchresults);
}

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

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

Zeile 1565Zeile 1561
		}
}
$datecut = $thread_datecut = $post_datecut = '';

		}
}
$datecut = $thread_datecut = $post_datecut = '';

	if($search['postdate'])

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

	{
if($search['pddir'] == 0)
{

	{
if($search['pddir'] == 0)
{

Zeile 1583Zeile 1579
	}

$thread_replycut = '';

	}

$thread_replycut = '';

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

	if(!empty($search['numreplies']) && $search['findthreadst'])

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

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

		}

		}

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

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

Zeile 1597Zeile 1593

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


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

	if($search['threadprefix'] && $search['threadprefix'][0] != 'any')
{

	if(!empty($search['threadprefix']) && $search['threadprefix'][0] != 'any')
{

		foreach($search['threadprefix'] as $threadprefix)
{
$threadprefix = (int)$threadprefix;
$prefixlist[] = $threadprefix;
}

		foreach($search['threadprefix'] as $threadprefix)
{
$threadprefix = (int)$threadprefix;
$prefixlist[] = $threadprefix;
}

	}

	}

	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 1652Zeile 1648
	$group_permissions = forum_permissions();
foreach($group_permissions as $fid => $forum_permissions)
{

	$group_permissions = forum_permissions();
foreach($group_permissions as $fid => $forum_permissions)
{

		if($forum_permissions['canonlyviewownthreads'] == 1)

		if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)

		{
$onlyusfids[] = $fid;
}

		{
$onlyusfids[] = $fid;
}

Zeile 1714Zeile 1710

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


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

	if($search['tid'])

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

	{
$tidsql = " AND t.tid='".(int)$search['tid']."'";

	{
$tidsql = " AND t.tid='".(int)$search['tid']."'";

	}

	}


$limitsql = '';
if((int)$mybb->settings['searchhardlimit'] > 0)


$limitsql = '';
if((int)$mybb->settings['searchhardlimit'] > 0)

	{

	{

		$limitsql = "LIMIT ".(int)$mybb->settings['searchhardlimit'];
}


		$limitsql = "LIMIT ".(int)$mybb->settings['searchhardlimit'];
}


Zeile 1732Zeile 1728
	if($search['postthread'] == 1)
{
// No need to search subjects when looking for results within a specific thread

	if($search['postthread'] == 1)
{
// No need to search subjects when looking for results within a specific thread

		if(!$search['tid'])

		if(empty($search['tid']))

		{
$query = $db->query("
SELECT t.tid, t.firstpost

		{
$query = $db->query("
SELECT t.tid, t.firstpost