SMF Forum Problem

  • #1
B

Bruno_2k

Bekanntes Mitglied
Themenersteller
Dabei seit
02.11.2004
Beiträge
725
Reaktionspunkte
0
hi

Ich habe schon wieder ein Problem. Und zwar mit dem SMF Forum.
Es wird mir immer Folgende Fehlermeldung angezeiht:
Notice: Only variables should be assigned by reference in /usr/export/www/vhosts/funnetwork/hosting/bbosch/ff/forum/Sources/Subs.php on line 232

Was mache ich falsch? Und wie kann ich das abstellen?

Hier noch der Code der Subs.php
Code:
<?php
if (!defined('SMF'))
	die('Hacking attempt...');

// Do a query. Takes care of errors too.
function db_query($db_string, $file, $line)
{
	global $db_cache, $db_count, $db_connection;

	// One more query....
	$db_count = !isset($db_count) ? 1 : $db_count + 1;

	// Debugging.
	if (isset($GLOBALS['db_show_debug']) && $GLOBALS['db_show_debug'] === true)
	{
		$db_cache[$db_count]['q'] = $db_string;
		$db_cache[$db_count]['f'] = $file;
		$db_cache[$db_count]['l'] = $line;
		$st = explode('->, microtime());
	}
     // [b]Das ist die besagte Zeile[/b]
	$ret = &mysql_query($db_string, $db_connection);
	if ($ret === false)
		$ret = db_error($db_string, $file, $line);

	// Debugging.
	if (isset($GLOBALS['db_show_debug']) && $GLOBALS['db_show_debug'] === true)
	{
		$end = explode('->, microtime());
		$db_cache[$db_count]['t'] = $end[0] + $end[1] - $st[0] - $st[1];
	}

	return $ret;
}

function db_affected_rows()
{
	global $db_connection;

	return mysql_affected_rows($db_connection);
}

function db_insert_id()
{
	global $db_connection;

	return mysql_insert_id($db_connection);
}

// Update the last message in a board, and its parents.
function updateLastMessages($setboards)
{
	global $db_prefix, $board_info, $board;

	if (!is_array($setboards))
		$setboards = array($setboards);

	// Find the latest message on this board. (highest ID_MSG)
	$result = db_query(
		SELECT ID_BOARD, MAX(ID_MSG) AS ID_MSG, MAX(posterTime) AS posterTime
		FROM {$db_prefix}messages
		WHERE ID_BOARD . (count($setboards) == 1 ?  = $setboards[0] :-> IN (' . implode(',->, $setboards) .->)') . 
		GROUP BY ID_BOARD, __FILE__, __LINE__);
	$setboards = array_flip($setboards);
	while ($row = mysql_fetch_assoc($result))
	{
		// Okay, this board is done ;).
		unset($setboards[$row['ID_BOARD']]);

		// Update the board!
		db_query(
			UPDATE {$db_prefix}boards
			SET ID_LAST_MSG = $row[ID_MSG], lastUpdated = $row[posterTime]
			WHERE ID_BOARD = $row[ID_BOARD]
			LIMIT 1, __FILE__, __LINE__);

		// The loadBoard function hasn't loaded this board yet?
		if (empty($board) || $board != $row['ID_BOARD'])
			$the_parent_boards = getBoardParents($row['ID_BOARD']);
		else
			$the_parent_boards = $board_info['parent_boards'];

		if (isset($the_parent_boards[$row['ID_BOARD']]))
			unset($the_parent_boards[$row['ID_BOARD']]);

		$the_parent_boards = array_keys($the_parent_boards);

		// If the board has parents update them too.
		if (!empty($the_parent_boards))
		{
			db_query(
				UPDATE {$db_prefix}boards
				SET lastUpdated = $row[posterTime]
				WHERE ID_BOARD IN ( . implode(',', $the_parent_boards) . )
					AND lastUpdated < $row[posterTime]
					AND childLevel != 0
				LIMIT  . count($the_parent_boards), __FILE__, __LINE__);

			// Don't do them twice.
			foreach ($the_parent_boards as $ID_BOARD)
				if (isset($setboards[$ID_BOARD]))
					unset($setboards[$ID_BOARD]);
		}
	}

	if (!empty($setboards))
		db_query(
			UPDATE {$db_prefix}boards
			SET ID_LAST_MSG = 0
			WHERE ID_BOARD IN ( . implode(',->, array_keys($setboards)) . )
			LIMIT 1, __FILE__, __LINE__);
}

// Update some basic statistics...
function updateStats($type, $condition =->1')
{
	global $db_prefix, $sourcedir, $modSettings;

	switch ($type)
	{
		case->member':
			// Update the latest member (highest ID_MEMBER) and count.
			$result = db_query(
				SELECT COUNT(ID_MEMBER), MAX(ID_MEMBER)
				FROM {$db_prefix}members, __FILE__, __LINE__);
			list ($memberCount, $latestmember) = mysql_fetch_row($result);
			mysql_free_result($result);

			// Get the latest member's display name.
			$result = db_query(
				SELECT IFNULL(realName, memberName) AS realName
				FROM {$db_prefix}members
				WHERE ID_MEMBER =  . (int) $latestmember . 
				LIMIT 1, __FILE__, __LINE__);
			list ($latestRealName) = mysql_fetch_row($result);
			mysql_free_result($result);

			// Update the amount of members awaiting approval.
			if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2)
			{
				$result = db_query(
					SELECT COUNT(ID_MEMBER)
					FROM {$db_prefix}members
					WHERE is_activated = 0
						AND validation_code =->', __FILE__, __LINE__);
				list ($unapprovedCount) = mysql_fetch_row($result);
				mysql_free_result($result);
			}
			else
				$unapprovedCount = $modSettings['unapprovedMembers'];

			updateSettings(array(
				'latestMember' => $latestmember,
				'latestRealName' => $latestRealName,
				'memberCount' => $memberCount,
				'unapprovedMembers' => $unapprovedCount
			));
		break;
		case->message':
			// Get the number of messages...
			$result = db_query(
				SELECT COUNT(ID_MSG) AS totalMessages, MAX(ID_MSG) AS maxMsgID
				FROM {$db_prefix}messages, __FILE__, __LINE__);
			$row = mysql_fetch_assoc($result);
			mysql_free_result($result);

			updateSettings(array(
				'totalMessages' => $row['totalMessages'],
				'maxMsgID' => $row['maxMsgID']
			));
		break;
		case->topic':
			// Get the number of topics.
			$result = db_query(
				SELECT COUNT(ID_TOPIC) AS totalTopics
				FROM {$db_prefix}topics, __FILE__, __LINE__);
			$row = mysql_fetch_assoc($result);
			mysql_free_result($result);

			updateSettings(array('totalTopics' => $row['totalTopics']));
		break;
		case->calendar':
			require_once($sourcedir .->/Calendar.php');

			// Calculate the YYYY-MM-DD of the lowest and highest days.
			$low_date = strftime('%Y-%m-%d', forum_time(false) - 24 * 3600);
			$high_date = strftime('%Y-%m-%d', forum_time(false) + $modSettings['cal_days_for_index'] * 24 * 3600);

			$holidays = calendarHolidayArray($low_date, $high_date);
			$bday = calendarBirthdayArray($low_date, $high_date);
			$events = calendarEventArray($low_date, $high_date, false);

			// Cache the results in the settings.
			updateSettings(array(
				'cal_today_updated' => strftime('%Y%m%d', forum_time(false)),
				'cal_today_holiday' => addslashes(serialize($holidays)),
				'cal_today_birthday' => addslashes(serialize($bday)),
				'cal_today_event' => addslashes(serialize($events))
			));
		break;
		case->postgroups':
			// Fetch postgroups.
			$request = db_query(
				SELECT ID_GROUP, minPosts
				FROM {$db_prefix}membergroups
				WHERE minPosts != -1, __FILE__, __LINE__);
			$postgroups = array();
			while ($row = mysql_fetch_assoc($request))
				$postgroups[$row['ID_GROUP']] = $row['minPosts'];
			mysql_free_result($request);

			// Oh great, they've screwed their post groups.
			if (empty($postgroups))
				return;

			// Sort them this way because if it's done with MySQL it causes a filesort :(.
			arsort($postgroups);

			// Set all membergroups from most posts to least posts.
			$conditions =->';
			foreach ($postgroups as $id => $minPosts)
			{
				$conditions .=->
						WHEN posts >=-> . $minPosts . (!empty($lastMin) ?-> AND posts <=-> . $lastMin :->') .-> THEN-> . $id;
				$lastMin = $minPosts;
			}

			// A big fat CASE WHEN... END is faster than a zillion UPDATE's ;).
			db_query(
				UPDATE {$db_prefix}members
				SET ID_POST_GROUP = CASE$conditions
						ELSE 0
					END . ($condition !=->1' ? 
				WHERE $condition :->'), __FILE__, __LINE__);
		break;
	}
}

// Assumes the data has been slashed.
function updateMemberData($members, $data)
{
	global $db_prefix;

	$setString =->';
	foreach ($data as $var => $val)
	{
		if ($val ===->+')
			$val = $var .-> + 1';
		elseif ($val ===->-')
			$val = $var .-> - 1';

		$setString .= 
			$var = $val,;
	}

	if (is_array($members))
		$condition =->ID_MEMBER IN (' . implode(',->, $members) .->)
		LIMIT-> . count($members);
	elseif ($members === null)
		$condition =->1';
	else
		$condition =->ID_MEMBER =-> . $members .->
		LIMIT 1';

	db_query(
		UPDATE {$db_prefix}members
		SET . substr($setString, 0, -1) .->
		WHERE-> . $condition, __FILE__, __LINE__);

	if (isset($data['posts']))
		updateStats('postgroups', $condition);
}


// Updates the settings table as well as $modSettings
// All input variables and values are assumed to have escaped apostrophes(')!
function updateSettings($changeArray)
{
	global $db_prefix, $modSettings;

	if (empty($changeArray) || !is_array($changeArray))
		return;

	$replaceArray = array();
	foreach ($changeArray as $variable => $value)
	{
		// Don't bother if it's already like that ;).
		if (isset($modSettings[$variable]) && $modSettings[$variable] == stripslashes($value))
			continue;

		$replaceArray[] = ('$variable',->$value');
		$modSettings[$variable] = stripslashes($value);
	}

	if (empty($replaceArray))
		return;

	db_query(
		REPLACE INTO {$db_prefix}settings
			(variable, value)
		VALUES  . implode(',
			', $replaceArray), __FILE__, __LINE__);
}
?>
Skript wurde stark gekürtzt ;)


Danke für eure Mühe
mfg Bene

PS: Bitte beachtet, dass ich überhaut kein PHP spreche ;)
 
  • #2
Mach mal die Referenz weg, also so:

Code:
<?php
....
$ret = mysql_query($db_string, $db_connection);
....
?>
 
  • #3
hi

Danke, funzt einwandfrei bis sehr gut ;D

mfg Bene
 
Thema:

SMF Forum Problem

ANGEBOTE & SPONSOREN

Statistik des Forums

Themen
113.838
Beiträge
707.959
Mitglieder
51.491
Neuestes Mitglied
haraldmuc
Oben