Seite 1 von 2

Probleme mit Search.php

Verfasst: 03.09.2006 12:32
von Kewwwin
Hallo,

ich habe ein Problem. Ich komme nicht mehr (auch Nicht-Addis) in den Suchbereich des Forums. Wenn ich also auf Suchen klicke, kommt nur eine Fehlermeldung Zeile 1445 sagt es mir. Wenn ich diese Klammer aber entferne, zeigt er wieder einen anderen Fehler an.

Kann mir jemand helfen? Der Link zur Dtaei: http://www.GegenTokioHotel.net/Forum/search.txt

Verfasst: 03.09.2006 12:49
von Olli Oberhausen
Mach doch mal eine schließende klammer "}" vor:

//
// Delete old data from the search result table
//


Gruß, Olli

Verfasst: 03.09.2006 12:58
von Kewwwin
Okay habe ich gemacht jetzt zeigt es --> Parse error: syntax error, unexpected '}' in /hp/af/ac/vc/www/Forum/search.php on line 852 --> an.

Alter Link --> neue Datei

Wie gesagt, die Suche funzt nicht. Könnt es ja selber probieren unetr http://www.GegenTokioHotel.net/Forum/index.php

Verfasst: 03.09.2006 13:21
von Dave
Suche und entferne:

Code: Alles auswählen

}
else if ( $search_profile != '' && $search_keywords == '' && $search_profile != '*' && $search_profile != '?' )
{
	$search_keywords = str_replace('*', '', $search_profile);
	$search_keywords = str_replace('?', '', $search_profile);

	if ( $search_field_select == 0 )
	{
		$search_fields = $search_profile_fields_sql;
	}
	else
	{
		$search_fields = $search_profile_fields[$search_field_select];
	}

	$sql = "SELECT ".$search_fields.", user_id FROM ".USERS_TABLE."
		WHERE user_active = 1
		AND disallow_profile_search = 0";
	if ( !$result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, 'Could not read user profile data', '', __LINE__, __FILE__, $sql);
	}
	$search_profile_string = $userid = array();
	while ( $row = $db->sql_fetchrow($result) )
	{
		if ( $search_field_select == 0 )
		{
			$i = 1;
			$search_string = '';
			foreach($search_profile_fields as $profile_field)
			{
				$search_string .= ( empty($search_string) ) ? $row[$profile_field] : ' '.$row[$profile_field];
			}
			$search_profile_string[] = $search_string;
		}
		else
		{
			$search_profile_string[] = $row[$search_profile_fields[$search_field_select]];
		}
		$userid[] = $row['user_id'];
	}
	$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');

	$split_search = array();
	$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ?  split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);

	$userids = '';
	for ( $i = 0; $i < count($search_profile_string); $i++)
	{
		foreach($split_search as $search_word)
		{
			if ( @eregi($search_word, $search_profile_string[$i]) )
			{
				$userids .= ( empty($userids) ) ? $userid[$i] : ', '.$userid[$i];
			}
		}
	}

	if ( $userids != '' )
	{
		$page_title = $lang['Search_profile'];
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		$template->set_filenames(array(
			'body' => 'search_results_profiles.tpl')
		);

		$sql = "SELECT user_id, username FROM ".USERS_TABLE."
			WHERE user_active = 1
			AND user_id IN ($userids)
			ORDER BY username $sort_dir";
		if ( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not read user profile data', '', __LINE__, __FILE__, $sql);
		}

		$result_user_list = '';
		while ( $row = $db->sql_fetchrow($result) )
		{
			$user = '<a href="'.append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$row['user_id']).'" class="gen">'.$row['username'].'</a>';
			$result_user_list .= ( $result_user_list == '' ) ? $user : '<b>,</b> '.$user;
		}

		$template->assign_vars(array(
			'ROW_CLASS' => $theme['td_class1'],
			'PROFILE_FIELDS' => implode(', ', $search_profile_fields_names),
			'SEARCH_STRING' => $search_keywords,
			'RESULT_USER_LIST' => $result_user_list,
			'L_SEARCH_MATCHES' => $page_title,
			'L_AUTHOR' => $lang['User'],
			'L_SEARCH' => $lang['Search'],
			'U_SEARCH' => append_sid("search.$phpEx"))
		);

		$template->pparse('body');

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

		exit;
	}
	else
	{
		message_die(GENERAL_MESSAGE, $lang['No_search_match']);
	}
}
}
Damit sollte die Suche wieder klappen... Nun hast du nen Mod eingebaut miz dem man die Profile durchsuchen kann... Weißt du noch welcher Mod das war? Denn da hast du einen Fehler gemacht beim einbauen. Es kommt nämlich 100pro nicht an die stelle.

Mein Tipp:
Suche:

Code: Alles auswählen

  }

//
// Search forum
//
Ersetze mit:

Code: Alles auswählen

}
else if ( $search_profile != '' && $search_keywords == '' && $search_profile != '*' && $search_profile != '?' )
{
	$search_keywords = str_replace('*', '', $search_profile);
	$search_keywords = str_replace('?', '', $search_profile);

	if ( $search_field_select == 0 )
	{
		$search_fields = $search_profile_fields_sql;
	}
	else
	{
		$search_fields = $search_profile_fields[$search_field_select];
	}

	$sql = "SELECT ".$search_fields.", user_id FROM ".USERS_TABLE."
		WHERE user_active = 1
		AND disallow_profile_search = 0";
	if ( !$result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, 'Could not read user profile data', '', __LINE__, __FILE__, $sql);
	}
	$search_profile_string = $userid = array();
	while ( $row = $db->sql_fetchrow($result) )
	{
		if ( $search_field_select == 0 )
		{
			$i = 1;
			$search_string = '';
			foreach($search_profile_fields as $profile_field)
			{
				$search_string .= ( empty($search_string) ) ? $row[$profile_field] : ' '.$row[$profile_field];
			}
			$search_profile_string[] = $search_string;
		}
		else
		{
			$search_profile_string[] = $row[$search_profile_fields[$search_field_select]];
		}
		$userid[] = $row['user_id'];
	}
	$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');

	$split_search = array();
	$split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ?  split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);

	$userids = '';
	for ( $i = 0; $i < count($search_profile_string); $i++)
	{
		foreach($split_search as $search_word)
		{
			if ( @eregi($search_word, $search_profile_string[$i]) )
			{
				$userids .= ( empty($userids) ) ? $userid[$i] : ', '.$userid[$i];
			}
		}
	}

	if ( $userids != '' )
	{
		$page_title = $lang['Search_profile'];
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		$template->set_filenames(array(
			'body' => 'search_results_profiles.tpl')
		);

		$sql = "SELECT user_id, username FROM ".USERS_TABLE."
			WHERE user_active = 1
			AND user_id IN ($userids)
			ORDER BY username $sort_dir";
		if ( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not read user profile data', '', __LINE__, __FILE__, $sql);
		}

		$result_user_list = '';
		while ( $row = $db->sql_fetchrow($result) )
		{
			$user = '<a href="'.append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$row['user_id']).'" class="gen">'.$row['username'].'</a>';
			$result_user_list .= ( $result_user_list == '' ) ? $user : '<b>,</b> '.$user;
		}

		$template->assign_vars(array(
			'ROW_CLASS' => $theme['td_class1'],
			'PROFILE_FIELDS' => implode(', ', $search_profile_fields_names),
			'SEARCH_STRING' => $search_keywords,
			'RESULT_USER_LIST' => $result_user_list,
			'L_SEARCH_MATCHES' => $page_title,
			'L_AUTHOR' => $lang['User'],
			'L_SEARCH' => $lang['Search'],
			'U_SEARCH' => append_sid("search.$phpEx"))
		);

		$template->pparse('body');

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

		exit;
	}
	else
	{
		message_die(GENERAL_MESSAGE, $lang['No_search_match']);
	}
}
//
// Search forum
//

Verfasst: 03.09.2006 13:21
von Olli Oberhausen
Sorry, hab ich total verwurstelt...

Du schließt die eine if abfrage vorzeitig durch deine profilsuche.

Füge deinen

Code: Alles auswählen

else if ( $search_profile != '' && $search_keywords == '' && $search_profile != '*' && $search_profile != '?' )
{ 
*****
}
Block mal in zeile 1341 ein, da wo sich die originale if abfrage schließt.

Verfasst: 03.09.2006 13:26
von Kewwwin
@dave and @olli

Ich kenn mich jetzt nicht mehr aus. Soll ich zuerst wieder die Klammer einfügen (siehe Beitrag2) und dann den Code löschen, wie in Beitrag4???????

Also das war der search_in_user_profiles_1_0_8 Mod

Verfasst: 03.09.2006 13:32
von Dave
Hi

Hier findest du eine hoffentlich funktionierende search.php...

MfG
Dave

Verfasst: 03.09.2006 13:33
von Kewwwin
Ist das jetzt wieder die Standard search.php oder die modifizierte

Verfasst: 03.09.2006 13:34
von Dave
Die modifizierte ;)

Verfasst: 03.09.2006 13:40
von Kewwwin
Danke funktioniert.

Vielen, vielen Dank.

Hat nir echt geholfen. Wenn ich wieder Probleme hab, melde ich mich wieder.