Vergleich inc/functions_search.php - 1.8.6 - 1.8.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 229Zeile 229
 */
function clean_keywords($keywords)
{

 */
function clean_keywords($keywords)
{

 
	global $db;


	$keywords = my_strtolower($keywords);

	$keywords = my_strtolower($keywords);

	$keywords = str_replace("%", "\\%", $keywords);

	$keywords = $db->escape_string_like($keywords);

	$keywords = preg_replace("#\*{2,}#s", "*", $keywords);
$keywords = str_replace("*", "%", $keywords);

	$keywords = preg_replace("#\*{2,}#s", "*", $keywords);
$keywords = str_replace("*", "%", $keywords);

	$keywords = preg_replace("#([\[\]\|\.\,:'])#s", " ", $keywords);

 
	$keywords = preg_replace("#\s+#s", " ", $keywords);

	$keywords = preg_replace("#\s+#s", " ", $keywords);

 
	$keywords = str_replace('\\"', '"', $keywords);


// Search for "and" or "or" and remove if it's at the beginning
$keywords = trim($keywords);


// Search for "and" or "or" and remove if it's at the beginning
$keywords = trim($keywords);

Zeile 545Zeile 547
					if($search['message'] == 1)
{
$message_lookin .= " $boolean {$mfield} LIKE '%{$phrase}%'";

					if($search['message'] == 1)
{
$message_lookin .= " $boolean {$mfield} LIKE '%{$phrase}%'";

					}
$boolean = 'AND';
}

// Check to see if we have any search terms and not a malformed SQL string

					}
$boolean = 'AND';
}

// Check to see if we have any search terms and not a malformed SQL string

				$error = false;
if($search['subject'] && $search['message'] && $subject_lookin == " AND (")
{

				$error = false;
if($search['subject'] && $search['message'] && $subject_lookin == " AND (")
{

Zeile 583Zeile 585
			}

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

			}

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

			{

			{

				$message_lookin .= ")";
}


				$message_lookin .= ")";
}


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

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





		switch($db->type)

		switch($db->type)

		{

		{

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

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

Zeile 642Zeile 644
		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 681Zeile 683
			$statussql[] = " status='3' ";
}
if($search['status']['forwarded'])

			$statussql[] = " status='3' ";
}
if($search['status']['forwarded'])

		{

		{

			$statussql[] = " status='4' ";
}
if($search['status']['read'])

			$statussql[] = " status='4' ";
}
if($search['status']['read'])

Zeile 695Zeile 697
		}
$statussql = implode("OR", $statussql);
$searchsql .= $statussql.")";

		}
$statussql = implode("OR", $statussql);
$searchsql .= $statussql.")";

	}


	}


	// Run the search
$pms = array();
$query = $db->simple_select("privatemessages", "pmid", $searchsql);
while($pm = $db->fetch_array($query))

	// Run the search
$pms = array();
$query = $db->simple_select("privatemessages", "pmid", $searchsql);
while($pm = $db->fetch_array($query))

	{
$pms[$pm['pmid']] = $pm['pmid'];
}

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

	{
$pms[$pm['pmid']] = $pm['pmid'];
}

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

	$pms = implode(',', $pms);

return array(

	$pms = implode(',', $pms);

return array(

Zeile 728Zeile 730

$keywords = clean_keywords($search['keywords']);
if(!$keywords && !$search['sender'])


$keywords = clean_keywords($search['keywords']);
if(!$keywords && !$search['sender'])

	{

	{

		error($lang->error_nosearchterms);
}


		error($lang->error_nosearchterms);
}


Zeile 768Zeile 770
			}

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

			}

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

			{

			{

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


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


Zeile 828Zeile 830
							}
// Add terms to search query
if($search['name'] == 1)

							}
// Add terms to search query
if($search['name'] == 1)

							{

							{

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

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

Zeile 868Zeile 870
					$error = true;
}
elseif(!$search['name'] && $search['document'] && $document_lookin == " {$string} (")

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

				{

				{

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

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

Zeile 1092Zeile 1094
		if($search['matchusername'])
{
$user = get_user_by_username($search['author']);

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

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




			if($user)
{
$userids[] = $user['uid'];
}

		}
else
{

		}
else
{

Zeile 1506Zeile 1511
		if($search['matchusername'])
{
$user = get_user_by_username($search['author']);

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

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




			if($user)
{
$userids[] = $user['uid'];
}

		}
else
{

		}
else
{