Vergleich inc/functions_search.php - 1.2.0 - 1.2.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * $Id: functions_search.php 2163 2006-08-30 05:53:05Z chris $

 * $Id: functions_search.php 2299 2006-09-30 17:22:05Z Tikitiki $

 */

/**

 */

/**

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

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

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

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

	$pid = intval($pid);

	$pid = intval($pid);

	if(!is_array($forumcache))

	if(!is_array($forum_cache))

	{
// Get Forums
$query = $db->query("SELECT f.* FROM ".TABLE_PREFIX."forums f ORDER BY f.pid, f.disporder");
while($forum = $db->fetch_array($query))
{

	{
// Get Forums
$query = $db->query("SELECT f.* FROM ".TABLE_PREFIX."forums f ORDER BY f.pid, f.disporder");
while($forum = $db->fetch_array($query))
{

			$forumcache[$forum['fid']] = $forum;

			$forum_cache[$forum['fid']] = $forum;

		}
}
if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();
}

		}
}
if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();
}

	foreach($forumcache as $fid => $forum)

	foreach($forum_cache as $fid => $forum)

	{
if($permissioncache[$forum['fid']])
{

	{
if($permissioncache[$forum['fid']])
{

Zeile 127Zeile 127
			if($_COOKIE['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
{
$pwverified = 0;

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

 
			}
}

$parents = explode(",", $forum['parentlist']);
if(is_array($parents))
{
foreach($parents as $parent)
{
if($forum_cache[$parent]['active'] == "no")
{
$forum['active'] = "no";
}

			}
}


			}
}


Zeile 256Zeile 268

/**
* Perform a thread and post search under MySQL or MySQLi


/**
* Perform a thread and post search under MySQL or MySQLi

 *
* @param array Array of search data

 *
* @param array Array of search data

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

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

Zeile 361Zeile 373
			if($search['postthread'] == 1)
{
$message_lookin = " AND LOWER(p.message) LIKE '%".$keywords."%'";

			if($search['postthread'] == 1)
{
$message_lookin = " AND LOWER(p.message) LIKE '%".$keywords."%'";

			}
}
}
$post_usersql = "";
$thread_usersql = "";
if($search['author'])
{
$userids = array();
if($search['matchusername'])
{
$query = $db->query("SELECT uid FROM ".TABLE_PREFIX."users WHERE username='".$db->escape_string($search['author'])."'");
}
else
{
$search['author'] = strtolower($search['author']);
$query = $db->query("SELECT uid FROM ".TABLE_PREFIX."users WHERE LOWER(username) LIKE '%".$db->escape_string($search['author'])."%'");
}
while($user = $db->fetch_array($query))
{
$userids[] = $user['uid'];
}
if(count($userids) < 1)
{
error($lang->error_nosearchresults);
}

			}
}
}
$post_usersql = "";
$thread_usersql = "";
if($search['author'])
{
$userids = array();
if($search['matchusername'])
{
$query = $db->query("SELECT uid FROM ".TABLE_PREFIX."users WHERE username='".$db->escape_string($search['author'])."'");
}
else
{
$search['author'] = strtolower($search['author']);
$query = $db->query("SELECT uid FROM ".TABLE_PREFIX."users WHERE LOWER(username) LIKE '%".$db->escape_string($search['author'])."%'");
}
while($user = $db->fetch_array($query))
{
$userids[] = $user['uid'];
}
if(count($userids) < 1)
{
error($lang->error_nosearchresults);
}

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

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

Zeile 399Zeile 411
		if($search['pddir'] == 0)
{
$datecut = "<=";

		if($search['pddir'] == 0)
{
$datecut = "<=";

		}
else
{

		}
else
{

			$datecut = ">=";

			$datecut = ">=";

		}

		}

		$datelimit = $now-(86400 * $search['postdate']);
$datecut .= "'$datelimit'";

		$datelimit = $now-(86400 * $search['postdate']);
$datecut .= "'$datelimit'";

		$post_datecut = "p.dateline $datecut";
$thread_datecut = "t.dateline $datecut";














		$post_datecut = " AND p.dateline $datecut";
$thread_datecut = " AND t.dateline $datecut";
}

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

	}

$forumin = "";

	}

$forumin = "";

Zeile 450Zeile 475
	}
$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)";

	}

// Searching both posts and thread titles

	}

// Searching both posts and thread titles

Zeile 459Zeile 484
	$posts = array();
$firstposts = array();
if($search['postthread'] == 1)

	$posts = array();
$firstposts = array();
if($search['postthread'] == 1)

	{

	{

		$searchtype = "titles";

		$searchtype = "titles";

		$query = $db->query("
SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin
");
while($thread = $db->fetch_array($query))
{
$threads[$thread['tid']] = $thread['tid'];

		$query = $db->query("
SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin
");
while($thread = $db->fetch_array($query))
{
$threads[$thread['tid']] = $thread['tid'];

			if($thread['firstpost'])
{
$posts[$thread['tid']] = $thread['firstpost'];

			if($thread['firstpost'])
{
$posts[$thread['tid']] = $thread['firstpost'];

Zeile 478Zeile 503
			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 $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

			WHERE 1=1 $post_datecut $thread_replycut $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

		");
while($post = $db->fetch_array($query))
{
$posts[$post['pid']] = $post['pid'];
$threads[$post['tid']] = $post['tid'];

		");
while($post = $db->fetch_array($query))
{
$posts[$post['pid']] = $post['pid'];
$threads[$post['tid']] = $post['tid'];

		}
if(count($posts) < 1 && count($threads) < 1)

		}
if(count($posts) < 1 && count($threads) < 1)

		{
error($lang->error_nosearchresults);
}

		{
error($lang->error_nosearchresults);
}

Zeile 500Zeile 525
		$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 $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

			WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

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

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

Zeile 518Zeile 543
		$threads = implode(",", $threads);
$firstposts = implode(",", $firstposts);
if($firstposts)

		$threads = implode(",", $threads);
$firstposts = implode(",", $firstposts);
if($firstposts)

		{

		{

			$query = $db->query("
SELECT p.pid
FROM ".TABLE_PREFIX."posts p

			$query = $db->query("
SELECT p.pid
FROM ".TABLE_PREFIX."posts p

Zeile 647Zeile 672
		}
$datelimit = $now-(86400 * $search['postdate']);
$datecut .= "'$datelimit'";

		}
$datelimit = $now-(86400 * $search['postdate']);
$datecut .= "'$datelimit'";

		$post_datecut = "p.dateline $datecut";
$thread_datecut = "t.dateline $datecut";














		$post_datecut = " AND p.dateline $datecut";
$thread_datecut = " AND t.dateline $datecut";
}

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

	}

$forumin = "";

	}

$forumin = "";

Zeile 705Zeile 743
		$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 $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin

			WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin

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

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

Zeile 719Zeile 757
			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 $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

			WHERE 1=1 $post_datecut $thread_replycut $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

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

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

Zeile 741Zeile 779
		$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 $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

			WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

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

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