frage zum activity-mod!!!

Du suchst einen bestimmten Mod, weißt aber nicht genau wo bzw. ob er überhaupt existiert? Wenn dir dieser Artikel nicht weiterhilft, kannst du hier den von dir gewünschten/gesuchten Mod beschreiben ...
Falls ein Mod-Autor eine der Anfragen hier aufnimmt um einen neuen Mod zu entwicklen, geht's in phpBB 2.0: Mods in Entwicklung weiter.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

neeeeeeeeeeeee... hab deine antwort nach meinem post erst gelesen!

natürlich hab ich ein back-up gemacht ;-)
Allen einen lieben Gruss
Tanja
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

ausserdem erscheint folgender fehler auf der hauptseite :-(

Code: Alles auswählen

Parse error: parse error in /kunden/77856_44869/phpBB2/includes/functions_search.php on line 500

Warning: Cannot modify header information - headers already sent by (output started at /kunden/77856_44869/phpBB2/includes/functions_search.php:500) in /kunden/77856_44869/phpBB2/includes/page_header.php on line 820

Warning: Cannot modify header information - headers already sent by (output started at /kunden/77856_44869/phpBB2/includes/functions_search.php:500) in /kunden/77856_44869/phpBB2/includes/page_header.php on line 822

Warning: Cannot modify header information - headers already sent by (output started at /kunden/77856_44869/phpBB2/includes/functions_search.php:500) in /kunden/77856_44869/phpBB2/includes/page_header.php on line 823
Allen einen lieben Gruss
Tanja
Benutzeravatar
rabbit
Ehemaliger Übersetzer
Beiträge: 4199
Registriert: 14.06.2003 22:09
Wohnort: Hildesheim
Kontaktdaten:

Beitrag von rabbit »

deine erste fehlermeldung scheint zu bedeuten, dass eine datei im template-ordner nicht existiert. prüfe bitte noch mal, ob du alle zum MOD gehörigen dateien an ihren platz geladen hast.

und dann bitte mal deine functions_search.php als .txt datei hier verlinken. :)
Offizieller Übersetzer des Categories Hierarchy MOD 2.1.x
Deutscher UserGuide für den Categories Hierarchy MOD v2.1.4
Empfohlener Hoster: All-Inkl.com
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

also eigentlich hab ich alles haarklein und super genau bearbeitet.. punkt für punkt und eigentlich dürfte echt nix fehlen!!

wo genau ist denn die functions_search.php ?
in welchem ordner???
Allen einen lieben Gruss
Tanja
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

schon gut..

includes...
ich suche ;-)
Allen einen lieben Gruss
Tanja
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

Code: Alles auswählen

<?php
/***************************************************************************
*                              functions_search.php
*                              -------------------
*     begin                : Wed Sep 05 2001
*     copyright            : (C) 2002 The phpBB Group
*     email                : support@phpbb.com
*
*     $Id: functions_search.php,v 1.8.2.16 2003/06/30 17:18:37 acydburn Exp $
*
****************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

// BEGIN Quiz Hack
if ( defined('FUNCTIONS_SEARCH_INCLUDED') )
{
	return;
}
define('FUNCTIONS_SEARCH_INCLUDED', true);
// END Quiz Hackfunction clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
{
	static $drop_char_match =   array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!');
	static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '',  '',   ' ', ' ', ' ', ' ', '',  ' ', ' ', '',  ' ',  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ',  ' ', ' ');

	$entry = ' ' . strip_tags(strtolower($entry)) . ' ';

	if ( $mode == 'post' )
	{
		// Replace line endings by a space
		$entry = preg_replace('/[\n\r]/is', ' ', $entry); 
		// HTML entities like &nbsp;
		$entry = preg_replace('/\b&[a-z]+;\b/', ' ', $entry); 
		// Remove URL's
		$entry = preg_replace('/\b[a-z0-9]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?/', ' ', $entry); 
		// Quickly remove BBcode.
		$entry = preg_replace('/\[img:[a-z0-9]{10,}\].*?\[\/img:[a-z0-9]{10,}\]/', ' ', $entry); 
		$entry = preg_replace('/\[\/?url(=.*?)?\]/', ' ', $entry);
		$entry = preg_replace('/\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]/', ' ', $entry);
	}
	else if ( $mode == 'search' ) 
	{
		$entry = str_replace(' +', ' and ', $entry);
		$entry = str_replace(' -', ' not ', $entry);
	}

	//
	// Filter out strange characters like ^, $, &, change "it's" to "its"
	//
	for($i = 0; $i < count($drop_char_match); $i++)
	{
		$entry =  str_replace($drop_char_match[$i], $drop_char_replace[$i], $entry);
	}

	if ( $mode == 'post' )
	{
		$entry = str_replace('*', ' ', $entry);

		// 'words' that consist of <3 or >20 characters are removed.
		$entry = preg_replace('/[ ]([\S]{1,2}|[\S]{21,})[ ]/',' ', $entry);
	}

	if ( !empty($stopword_list) )
	{
		for ($j = 0; $j < count($stopword_list); $j++)
		{
			$stopword = trim($stopword_list[$j]);

			if ( $mode == 'post' || ( $stopword != 'not' && $stopword != 'and' && $stopword != 'or' ) )
			{
				$entry = str_replace(' ' . trim($stopword) . ' ', ' ', $entry);
			}
		}
	}

	if ( !empty($synonym_list) )
	{
		for ($j = 0; $j < count($synonym_list); $j++)
		{
			list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_list[$j])));
			if ( $mode == 'post' || ( $match_synonym != 'not' && $match_synonym != 'and' && $match_synonym != 'or' ) )
			{
				$entry =  str_replace(' ' . trim($match_synonym) . ' ', ' ' . trim($replace_synonym) . ' ', $entry);
			}
		}
	}

	return $entry;
}

function split_words(&$entry, $mode = 'post')
{
	// If you experience problems with the new method, uncomment this block.
/*	
	$rex = ( $mode == 'post' ) ? "/\b([\w±µ-ÿ][\w±µ-ÿ']*[\w±µ-ÿ]+|[\w±µ-ÿ]+?)\b/" : '/(\*?[a-z0-9±µ-ÿ]+\*?)|\b([a-z0-9±µ-ÿ]+)\b/';
	preg_match_all($rex, $entry, $split_entries);

	return $split_entries[1];
*/
	// Trim 1+ spaces to one space and split this trimmed string into words.
	return explode(' ', trim(preg_replace('#\s+#', ' ', $entry)));
}

function add_search_words($mode, $post_id, $post_text, $post_title = '')
{
	global $db, $phpbb_root_path, $board_config, $lang;

	$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_stopwords.txt"); 
	$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_synonyms.txt"); 

	$search_raw_words = array();
	$search_raw_words['text'] = split_words(clean_words('post', $post_text, $stopword_array, $synonym_array));
	$search_raw_words['title'] = split_words(clean_words('post', $post_title, $stopword_array, $synonym_array));

	@set_time_limit(0);

	$word = array();
	$word_insert_sql = array();
	while ( list($word_in, $search_matches) = @each($search_raw_words) )
	{
		$word_insert_sql[$word_in] = '';
		if ( !empty($search_matches) )
		{
			for ($i = 0; $i < count($search_matches); $i++)
			{ 
				$search_matches[$i] = trim($search_matches[$i]);

				if( $search_matches[$i] != '' ) 
				{
					$word[] = $search_matches[$i];
					if ( !strstr($word_insert_sql[$word_in], "'" . $search_matches[$i] . "'") )
					{
						$word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != "" ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'";
					}
				} 
			}
		}
	}

	if ( count($word) )
	{
		sort($word);

		$prev_word = '';
		$word_text_sql = '';
		$temp_word = array();
		for($i = 0; $i < count($word); $i++)
		{
			if ( $word[$i] != $prev_word )
			{
				$temp_word[] = $word[$i];
				$word_text_sql .= ( ( $word_text_sql != '' ) ? ', ' : '' ) . "'" . $word[$i] . "'";
			}
			$prev_word = $word[$i];
		}
		$word = $temp_word;

		$check_words = array();
		switch( SQL_LAYER )
		{
			case 'postgresql':
			case 'msaccess':
			case 'mssql-odbc':
			case 'oracle':
			case 'db2':
				$sql = "SELECT word_id, word_text     
					FROM " . SEARCH_WORD_TABLE . " 
					WHERE word_text IN ($word_text_sql)";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not select words', '', __LINE__, __FILE__, $sql);
				}

				while ( $row = $db->sql_fetchrow($result) )
				{
					$check_words[$row['word_text']] = $row['word_id'];
				}
				break;
		}

		$value_sql = '';
		$match_word = array();
		for ($i = 0; $i < count($word); $i++)
		{ 
			$new_match = true;
			if ( isset($check_words[$word[$i]]) )
			{
				$new_match = false;
			}

			if ( $new_match )
			{
				switch( SQL_LAYER )
				{
					case 'mysql':
					case 'mysql4':
						$value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\', 0)';
						break;
					case 'mssql':
						$value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "', 0";
						break;
					default:
						$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
							VALUES ('" . $word[$i] . "', 0)"; 
						if( !$db->sql_query($sql) )
						{
							message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
						}
						break;
				}
			}
		}

		if ( $value_sql != '' )
		{
			switch ( SQL_LAYER )
			{
				case 'mysql':
				case 'mysql4':
					$sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
						VALUES $value_sql"; 
					break;
				case 'mssql':
					$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
						$value_sql"; 
					break;
			}

			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	while( list($word_in, $match_sql) = @each($word_insert_sql) )
	{
		$title_match = ( $word_in == 'title' ) ? 1 : 0;

		if ( $match_sql != '' )
		{
			$sql = "INSERT IGNORE INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) 
				SELECT $post_id, word_id, $title_match  
					FROM " . SEARCH_WORD_TABLE . " 
					WHERE word_text IN ($match_sql)"; 
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	if ($mode == 'single')
	{
		remove_common('single', 4/10, $word);
	}

	return;
}

//
// Check if specified words are too common now
//
function remove_common($mode, $fraction, $word_id_list = array())
{
	global $db;

	$sql = "SELECT COUNT(post_id) AS total_posts 
		FROM " . POSTS_TABLE;
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain post count', '', __LINE__, __FILE__, $sql);
	}

	$row = $db->sql_fetchrow($result);

	if ( $row['total_posts'] >= 100 )
	{
		$common_threshold = floor($row['total_posts'] * $fraction);

		if ( $mode == 'single' && count($word_id_list) )
		{
			$word_id_sql = '';
			for($i = 0; $i < count($word_id_list); $i++)
			{
				$word_id_sql .= ( ( $word_id_sql != '' ) ? ', ' : '' ) . "'" . $word_id_list[$i] . "'";
			}

			$sql = "SELECT m.word_id 
				FROM " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w 
				WHERE w.word_text IN ($word_id_sql)  
					AND m.word_id = w.word_id 
				GROUP BY m.word_id 
				HAVING COUNT(m.word_id) > $common_threshold";
		}
		else 
		{
			$sql = "SELECT word_id 
				FROM " . SEARCH_MATCH_TABLE . " 
				GROUP BY word_id 
				HAVING COUNT(word_id) > $common_threshold";
		}

		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain common word list', '', __LINE__, __FILE__, $sql);
		}

		$common_word_id = '';
		while ( $row = $db->sql_fetchrow($result) )
		{
			$common_word_id .= ( ( $common_word_id != '' ) ? ', ' : '' ) . $row['word_id'];
		}
		$db->sql_freeresult($result);

		if ( $common_word_id != '' )
		{
			$sql = "UPDATE " . SEARCH_WORD_TABLE . "
				SET word_common = " . TRUE . " 
				WHERE word_id IN ($common_word_id)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
			}

			$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "  
				WHERE word_id IN ($common_word_id)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete word match entry', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	return;
}

function remove_search_post($post_id_sql)
{
	global $db;

	$words_removed = false;

	switch ( SQL_LAYER )
	{
		case 'mysql':
		case 'mysql4':
			$sql = "SELECT word_id 
				FROM " . SEARCH_MATCH_TABLE . " 
				WHERE post_id IN ($post_id_sql) 
				GROUP BY word_id";
			if ( $result = $db->sql_query($sql) )
			{
				$word_id_sql = '';
				while ( $row = $db->sql_fetchrow($result) )
				{
					$word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; 
				}

				$sql = "SELECT word_id 
					FROM " . SEARCH_MATCH_TABLE . " 
					WHERE word_id IN ($word_id_sql) 
					GROUP BY word_id 
					HAVING COUNT(word_id) = 1";
				if ( $result = $db->sql_query($sql) )
				{
					$word_id_sql = '';
					while ( $row = $db->sql_fetchrow($result) )
					{
						$word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; 
					}

					if ( $word_id_sql != '' )
					{
						$sql = "DELETE FROM " . SEARCH_WORD_TABLE . " 
							WHERE word_id IN ($word_id_sql)";
						if ( !$db->sql_query($sql) )
						{
							message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
						}

						$words_removed = $db->sql_affectedrows();
					}
				}
			}
			break;

		default:
			$sql = "DELETE FROM " . SEARCH_WORD_TABLE . " 
				WHERE word_id IN ( 
					SELECT word_id 
					FROM " . SEARCH_MATCH_TABLE . " 
					WHERE word_id IN ( 
						SELECT word_id 
						FROM " . SEARCH_MATCH_TABLE . " 
						WHERE post_id IN ($post_id_sql) 
						GROUP BY word_id 
					) 
					GROUP BY word_id 
					HAVING COUNT(word_id) = 1
				)"; 
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete old words from word table', '', __LINE__, __FILE__, $sql);
			}

			$words_removed = $db->sql_affectedrows();

			break;
	}

	$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "  
		WHERE post_id IN ($post_id_sql)";
	if ( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
	}

	return $words_removed;
}

//
// Username search
//
function username_search($search_match)
{
	global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
	global $starttime, $gen_simple_header;
	//-- mod : profile cp ------------------------------------------------------------------------------ 
//-- add 
   global $admin_level, $level_prior; 
//-- fin mod : profile cp -------------------------------------------------------------------------- 
	
	$gen_simple_header = TRUE;

	global $HTTP_GET_VARS; // ADDED BY Quiz Hack$username_list = '';
	if ( !empty($search_match) )
	{
		$username_search = preg_replace('/\*/', '%', trim(strip_tags($search_match)));

		$sql = "SELECT username 
			FROM " . USERS_TABLE . " 
			WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' AND user_id <> " . ANONYMOUS . "
			ORDER BY username";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql);
		}

		if ( $row = $db->sql_fetchrow($result) )
		{
			do
			{
				$username_list .= '<option value="' . $row['username'] . '">' . $row['username'] . '</option>';
			}
			while ( $row = $db->sql_fetchrow($result) );
		}
		else
		{
			$username_list .= '<option>' . $lang['No_match']. '</option>';
		}
		$db->sql_freeresult($result);
	}

	$page_title = $lang['Search'];
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);

	$template->set_filenames(array(
		'search_user_body' => 'search_username.tpl')
	);

	$template->assign_vars(array(
		'USERNAME' => ( !empty($search_match) ) ? strip_tags($search_match) : '', 

		'L_CLOSE_WINDOW' => $lang['Close_window'], 
		'L_SEARCH_USERNAME' => $lang['Find_username'], 
		'L_UPDATE_USERNAME' => $lang['Select_username'], 
		'L_SELECT' => $lang['Select'], 
		'L_SEARCH' => $lang['Search'], 
		'L_SEARCH_EXPLAIN' => $lang['Search_author_explain'], 
		'L_CLOSE_WINDOW' => $lang['Close_window'], 

		// BEGIN Quiz Hack
		'S_FORM' => !empty($HTTP_GET_VARS['form']) ? $HTTP_GET_VARS['form'] : 'post',
		'S_FIELD' => !empty($HTTP_GET_VARS['field']) ? $HTTP_GET_VARS['field'] : 'username',
		// END Quiz Hack'S_USERNAME_OPTIONS' => $username_list, 
		'S_SEARCH_ACTION' => append_sid("search.$phpEx?mode=searchuser" . ( !empty($HTTP_GET_VARS['form']) ? ( '&form=' . $HTTP_GET_VARS['form'] ) : '') . ( !empty($HTTP_GET_VARS['field']) ? ( '&field=' . $HTTP_GET_VARS['field'] ) : '') )) // ADDED  . ( !empty($HTTP_GET_VARS['form']) ? ( '&form=' . $HTTP_GET_VARS['form'] ) : '') . ( !empty($HTTP_GET_VARS['field']) ? ( '&field=' . $HTTP_GET_VARS['field'] ) : '') BY Quiz Hack
	);

	if ( $username_list != '' )
	{
		$template->assign_block_vars('switch_select_name', array());// BEGIN Quiz Hack
	else
	{
		$template->assign_block_vars('switch_no_name', array());
	}
	// END Quiz Hack
	}

	$template->pparse('search_user_body');

	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

	return;
}

?>
das ist sie!
Allen einen lieben Gruss
Tanja
Benutzeravatar
rabbit
Ehemaliger Übersetzer
Beiträge: 4199
Registriert: 14.06.2003 22:09
Wohnort: Hildesheim
Kontaktdaten:

Beitrag von rabbit »

zaubermaus hat geschrieben:also eigentlich hab ich alles haarklein und super genau bearbeitet..
so, so... :wink:


suche in includes/functions_search.php:

Code: Alles auswählen

if ( $username_list != '' ) 
   { 
      $template->assign_block_vars('switch_select_name', array());// BEGIN Quiz Hack 
   else 
   { 
      $template->assign_block_vars('switch_no_name', array()); 
   } 
   // END Quiz Hack 
   } 

   $template->pparse('search_user_body'); 
und ersetze mit:

Code: Alles auswählen

if ( $username_list != '' ) 
   { 
      $template->assign_block_vars('switch_select_name', array());

}
// BEGIN Quiz Hack 
   else 
   { 
      $template->assign_block_vars('switch_no_name', array()); 
   } 
   // END Quiz Hack 
    

   $template->pparse('search_user_body'); 
tip: wenn da AFTER, ADD steht, immer in eine neue zeile den code einfügen, nie direkt hinter den gesuchten code. und auf geschweifte klammern achten, die übersieht man leicht. ;)

und ich geh' jetzt in die heia, muss morgen früh hoch... gute nacht und mach' nicht mehr soviel. :)
Offizieller Übersetzer des Categories Hierarchy MOD 2.1.x
Deutscher UserGuide für den Categories Hierarchy MOD v2.1.4
Empfohlener Hoster: All-Inkl.com
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

noch ein schwerwiegender fehler *heul*

es kann keiner mehr auf beiträge antworten :cry:

wenn ich auf antworten klicke, erscheint folgende fehlermeldung:

Code: Alles auswählen

Parse error: parse error, expecting `')'' in /kunden/77856_44869/phpBB2/posting.php on line 38
Allen einen lieben Gruss
Tanja
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

[quote="rabbit"]

suche in includes/functions_search.php:

Code: Alles auswählen

if ( $username_list != '' ) 
   { 
      $template->assign_block_vars('switch_select_name', array());// BEGIN Quiz Hack 
   else 
   { 
      $template->assign_block_vars('switch_no_name', array()); 
   } 
   // END Quiz Hack 
   } 

   $template->pparse('search_user_body'); 
und ersetze mit:

Code: Alles auswählen

if ( $username_list != '' ) 
   { 
      $template->assign_block_vars('switch_select_name', array());

}
// BEGIN Quiz Hack 
   else 
   { 
      $template->assign_block_vars('switch_no_name', array()); 
   } 
   // END Quiz Hack 
    

   $template->pparse('search_user_body'); 
das find ich da nicht *heul*
Allen einen lieben Gruss
Tanja
zaubermaus
Mitglied
Beiträge: 100
Registriert: 04.11.2004 22:47
Wohnort: NRW

Beitrag von zaubermaus »

*schniiiiiiiiiiiiieeeeeeeeeeeeef*

jetzt kann keiner mehr was schreiben *heul*

nuja....

ich wünsch dir eine gute n8 und sweet dreams 4 u !

hoffe, du findest morgen mal zeit für mich ;-)
wär dir irre dankbar!!!

hier allerdings mal eine FUNCTIONS_SEARCH:

Code: Alles auswählen

<?php
/***************************************************************************
*                              functions_search.php
*                              -------------------
*     begin                : Wed Sep 05 2001
*     copyright            : (C) 2002 The phpBB Group
*     email                : support@phpbb.com
*
*     $Id: functions_search.php,v 1.8.2.16 2003/06/30 17:18:37 acydburn Exp $
*
****************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

// BEGIN Quiz Hack
if ( defined('FUNCTIONS_SEARCH_INCLUDED') )
{
	return;
}
define('FUNCTIONS_SEARCH_INCLUDED', true);
// END Quiz Hackfunction clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
{
	static $drop_char_match =   array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!');
	static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '',  '',   ' ', ' ', ' ', ' ', '',  ' ', ' ', '',  ' ',  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ',  ' ', ' ');

	$entry = ' ' . strip_tags(strtolower($entry)) . ' ';

	if ( $mode == 'post' )
	{
		// Replace line endings by a space
		$entry = preg_replace('/[\n\r]/is', ' ', $entry); 
		// HTML entities like &nbsp;
		$entry = preg_replace('/\b&[a-z]+;\b/', ' ', $entry); 
		// Remove URL's
		$entry = preg_replace('/\b[a-z0-9]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?/', ' ', $entry); 
		// Quickly remove BBcode.
		$entry = preg_replace('/\[img:[a-z0-9]{10,}\].*?\[\/img:[a-z0-9]{10,}\]/', ' ', $entry); 
		$entry = preg_replace('/\[\/?url(=.*?)?\]/', ' ', $entry);
		$entry = preg_replace('/\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]/', ' ', $entry);
	}
	else if ( $mode == 'search' ) 
	{
		$entry = str_replace(' +', ' and ', $entry);
		$entry = str_replace(' -', ' not ', $entry);
	}

	//
	// Filter out strange characters like ^, $, &, change "it's" to "its"
	//
	for($i = 0; $i < count($drop_char_match); $i++)
	{
		$entry =  str_replace($drop_char_match[$i], $drop_char_replace[$i], $entry);
	}

	if ( $mode == 'post' )
	{
		$entry = str_replace('*', ' ', $entry);

		// 'words' that consist of <3 or >20 characters are removed.
		$entry = preg_replace('/[ ]([\S]{1,2}|[\S]{21,})[ ]/',' ', $entry);
	}

	if ( !empty($stopword_list) )
	{
		for ($j = 0; $j < count($stopword_list); $j++)
		{
			$stopword = trim($stopword_list[$j]);

			if ( $mode == 'post' || ( $stopword != 'not' && $stopword != 'and' && $stopword != 'or' ) )
			{
				$entry = str_replace(' ' . trim($stopword) . ' ', ' ', $entry);
			}
		}
	}

	if ( !empty($synonym_list) )
	{
		for ($j = 0; $j < count($synonym_list); $j++)
		{
			list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_list[$j])));
			if ( $mode == 'post' || ( $match_synonym != 'not' && $match_synonym != 'and' && $match_synonym != 'or' ) )
			{
				$entry =  str_replace(' ' . trim($match_synonym) . ' ', ' ' . trim($replace_synonym) . ' ', $entry);
			}
		}
	}

	return $entry;
}

function split_words(&$entry, $mode = 'post')
{
	// If you experience problems with the new method, uncomment this block.
/*	
	$rex = ( $mode == 'post' ) ? "/\b([\w±µ-ÿ][\w±µ-ÿ']*[\w±µ-ÿ]+|[\w±µ-ÿ]+?)\b/" : '/(\*?[a-z0-9±µ-ÿ]+\*?)|\b([a-z0-9±µ-ÿ]+)\b/';
	preg_match_all($rex, $entry, $split_entries);

	return $split_entries[1];
*/
	// Trim 1+ spaces to one space and split this trimmed string into words.
	return explode(' ', trim(preg_replace('#\s+#', ' ', $entry)));
}

function add_search_words($mode, $post_id, $post_text, $post_title = '')
{
	global $db, $phpbb_root_path, $board_config, $lang;

	$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_stopwords.txt"); 
	$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_synonyms.txt"); 

	$search_raw_words = array();
	$search_raw_words['text'] = split_words(clean_words('post', $post_text, $stopword_array, $synonym_array));
	$search_raw_words['title'] = split_words(clean_words('post', $post_title, $stopword_array, $synonym_array));

	@set_time_limit(0);

	$word = array();
	$word_insert_sql = array();
	while ( list($word_in, $search_matches) = @each($search_raw_words) )
	{
		$word_insert_sql[$word_in] = '';
		if ( !empty($search_matches) )
		{
			for ($i = 0; $i < count($search_matches); $i++)
			{ 
				$search_matches[$i] = trim($search_matches[$i]);

				if( $search_matches[$i] != '' ) 
				{
					$word[] = $search_matches[$i];
					if ( !strstr($word_insert_sql[$word_in], "'" . $search_matches[$i] . "'") )
					{
						$word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != "" ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'";
					}
				} 
			}
		}
	}

	if ( count($word) )
	{
		sort($word);

		$prev_word = '';
		$word_text_sql = '';
		$temp_word = array();
		for($i = 0; $i < count($word); $i++)
		{
			if ( $word[$i] != $prev_word )
			{
				$temp_word[] = $word[$i];
				$word_text_sql .= ( ( $word_text_sql != '' ) ? ', ' : '' ) . "'" . $word[$i] . "'";
			}
			$prev_word = $word[$i];
		}
		$word = $temp_word;

		$check_words = array();
		switch( SQL_LAYER )
		{
			case 'postgresql':
			case 'msaccess':
			case 'mssql-odbc':
			case 'oracle':
			case 'db2':
				$sql = "SELECT word_id, word_text     
					FROM " . SEARCH_WORD_TABLE . " 
					WHERE word_text IN ($word_text_sql)";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not select words', '', __LINE__, __FILE__, $sql);
				}

				while ( $row = $db->sql_fetchrow($result) )
				{
					$check_words[$row['word_text']] = $row['word_id'];
				}
				break;
		}

		$value_sql = '';
		$match_word = array();
		for ($i = 0; $i < count($word); $i++)
		{ 
			$new_match = true;
			if ( isset($check_words[$word[$i]]) )
			{
				$new_match = false;
			}

			if ( $new_match )
			{
				switch( SQL_LAYER )
				{
					case 'mysql':
					case 'mysql4':
						$value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\', 0)';
						break;
					case 'mssql':
						$value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "', 0";
						break;
					default:
						$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
							VALUES ('" . $word[$i] . "', 0)"; 
						if( !$db->sql_query($sql) )
						{
							message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
						}
						break;
				}
			}
		}

		if ( $value_sql != '' )
		{
			switch ( SQL_LAYER )
			{
				case 'mysql':
				case 'mysql4':
					$sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
						VALUES $value_sql"; 
					break;
				case 'mssql':
					$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common) 
						$value_sql"; 
					break;
			}

			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	while( list($word_in, $match_sql) = @each($word_insert_sql) )
	{
		$title_match = ( $word_in == 'title' ) ? 1 : 0;

		if ( $match_sql != '' )
		{
			$sql = "INSERT IGNORE INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) 
				SELECT $post_id, word_id, $title_match  
					FROM " . SEARCH_WORD_TABLE . " 
					WHERE word_text IN ($match_sql)"; 
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	if ($mode == 'single')
	{
		remove_common('single', 4/10, $word);
	}

	return;
}

//
// Check if specified words are too common now
//
function remove_common($mode, $fraction, $word_id_list = array())
{
	global $db;

	$sql = "SELECT COUNT(post_id) AS total_posts 
		FROM " . POSTS_TABLE;
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain post count', '', __LINE__, __FILE__, $sql);
	}

	$row = $db->sql_fetchrow($result);

	if ( $row['total_posts'] >= 100 )
	{
		$common_threshold = floor($row['total_posts'] * $fraction);

		if ( $mode == 'single' && count($word_id_list) )
		{
			$word_id_sql = '';
			for($i = 0; $i < count($word_id_list); $i++)
			{
				$word_id_sql .= ( ( $word_id_sql != '' ) ? ', ' : '' ) . "'" . $word_id_list[$i] . "'";
			}

			$sql = "SELECT m.word_id 
				FROM " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w 
				WHERE w.word_text IN ($word_id_sql)  
					AND m.word_id = w.word_id 
				GROUP BY m.word_id 
				HAVING COUNT(m.word_id) > $common_threshold";
		}
		else 
		{
			$sql = "SELECT word_id 
				FROM " . SEARCH_MATCH_TABLE . " 
				GROUP BY word_id 
				HAVING COUNT(word_id) > $common_threshold";
		}

		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain common word list', '', __LINE__, __FILE__, $sql);
		}

		$common_word_id = '';
		while ( $row = $db->sql_fetchrow($result) )
		{
			$common_word_id .= ( ( $common_word_id != '' ) ? ', ' : '' ) . $row['word_id'];
		}
		$db->sql_freeresult($result);

		if ( $common_word_id != '' )
		{
			$sql = "UPDATE " . SEARCH_WORD_TABLE . "
				SET word_common = " . TRUE . " 
				WHERE word_id IN ($common_word_id)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
			}

			$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "  
				WHERE word_id IN ($common_word_id)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete word match entry', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	return;
}

function remove_search_post($post_id_sql)
{
	global $db;

	$words_removed = false;

	switch ( SQL_LAYER )
	{
		case 'mysql':
		case 'mysql4':
			$sql = "SELECT word_id 
				FROM " . SEARCH_MATCH_TABLE . " 
				WHERE post_id IN ($post_id_sql) 
				GROUP BY word_id";
			if ( $result = $db->sql_query($sql) )
			{
				$word_id_sql = '';
				while ( $row = $db->sql_fetchrow($result) )
				{
					$word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; 
				}

				$sql = "SELECT word_id 
					FROM " . SEARCH_MATCH_TABLE . " 
					WHERE word_id IN ($word_id_sql) 
					GROUP BY word_id 
					HAVING COUNT(word_id) = 1";
				if ( $result = $db->sql_query($sql) )
				{
					$word_id_sql = '';
					while ( $row = $db->sql_fetchrow($result) )
					{
						$word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; 
					}

					if ( $word_id_sql != '' )
					{
						$sql = "DELETE FROM " . SEARCH_WORD_TABLE . " 
							WHERE word_id IN ($word_id_sql)";
						if ( !$db->sql_query($sql) )
						{
							message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql);
						}

						$words_removed = $db->sql_affectedrows();
					}
				}
			}
			break;

		default:
			$sql = "DELETE FROM " . SEARCH_WORD_TABLE . " 
				WHERE word_id IN ( 
					SELECT word_id 
					FROM " . SEARCH_MATCH_TABLE . " 
					WHERE word_id IN ( 
						SELECT word_id 
						FROM " . SEARCH_MATCH_TABLE . " 
						WHERE post_id IN ($post_id_sql) 
						GROUP BY word_id 
					) 
					GROUP BY word_id 
					HAVING COUNT(word_id) = 1
				)"; 
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete old words from word table', '', __LINE__, __FILE__, $sql);
			}

			$words_removed = $db->sql_affectedrows();

			break;
	}

	$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "  
		WHERE post_id IN ($post_id_sql)";
	if ( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
	}

	return $words_removed;
}

//
// Username search
//
function username_search($search_match)
{
	global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
	global $starttime, $gen_simple_header;
	//-- mod : profile cp ------------------------------------------------------------------------------ 
//-- add 
   global $admin_level, $level_prior; 
//-- fin mod : profile cp -------------------------------------------------------------------------- 
	
	$gen_simple_header = TRUE;

	global $HTTP_GET_VARS; // ADDED BY Quiz Hack$username_list = '';
	if ( !empty($search_match) )
	{
		$username_search = preg_replace('/\*/', '%', trim(strip_tags($search_match)));

		$sql = "SELECT username 
			FROM " . USERS_TABLE . " 
			WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "' AND user_id <> " . ANONYMOUS . "
			ORDER BY username";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql);
		}

		if ( $row = $db->sql_fetchrow($result) )
		{
			do
			{
				$username_list .= '<option value="' . $row['username'] . '">' . $row['username'] . '</option>';
			}
			while ( $row = $db->sql_fetchrow($result) );
		}
		else
		{
			$username_list .= '<option>' . $lang['No_match']. '</option>';
		}
		$db->sql_freeresult($result);
	}

	$page_title = $lang['Search'];
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);

	$template->set_filenames(array(
		'search_user_body' => 'search_username.tpl')
	);

	$template->assign_vars(array(
		'USERNAME' => ( !empty($search_match) ) ? strip_tags($search_match) : '', 

		'L_CLOSE_WINDOW' => $lang['Close_window'], 
		'L_SEARCH_USERNAME' => $lang['Find_username'], 
		'L_UPDATE_USERNAME' => $lang['Select_username'], 
		'L_SELECT' => $lang['Select'], 
		'L_SEARCH' => $lang['Search'], 
		'L_SEARCH_EXPLAIN' => $lang['Search_author_explain'], 
		'L_CLOSE_WINDOW' => $lang['Close_window'], 

		// BEGIN Quiz Hack
		'S_FORM' => !empty($HTTP_GET_VARS['form']) ? $HTTP_GET_VARS['form'] : 'post',
		'S_FIELD' => !empty($HTTP_GET_VARS['field']) ? $HTTP_GET_VARS['field'] : 'username',
		// END Quiz Hack'S_USERNAME_OPTIONS' => $username_list, 
		'S_SEARCH_ACTION' => append_sid("search.$phpEx?mode=searchuser" . ( !empty($HTTP_GET_VARS['form']) ? ( '&form=' . $HTTP_GET_VARS['form'] ) : '') . ( !empty($HTTP_GET_VARS['field']) ? ( '&field=' . $HTTP_GET_VARS['field'] ) : '') )) // ADDED  . ( !empty($HTTP_GET_VARS['form']) ? ( '&form=' . $HTTP_GET_VARS['form'] ) : '') . ( !empty($HTTP_GET_VARS['field']) ? ( '&field=' . $HTTP_GET_VARS['field'] ) : '') BY Quiz Hack
	);

	if ( $username_list != '' )
	{
		$template->assign_block_vars('switch_select_name', array());// BEGIN Quiz Hack
	else
	{
		$template->assign_block_vars('switch_no_name', array());
	}
	// END Quiz Hack
	}

	$template->pparse('search_user_body');

	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

	return;
}

?>
Allen einen lieben Gruss
Tanja
Antworten

Zurück zu „phpBB 2.0: Mod Suche/Anfragen“