Seite 1 von 1

Fehlerbehebung bei AFK Manager

Verfasst: 01.08.2012 00:14
von Secretly
Hallo,

ich habe mal die Debug-Funktion angeschaltet und da hagelte es bei mir einige Fehlermeldungen, welche ich gern beheben würde, aber leider nicht so "eingearbeitet" bin, dass ich wüsste wo ich anfangen müsste:
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 164: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 164: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 170: Undefined variable: start
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 179: Undefined index: num_afkstatus
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4837: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3872)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4839: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3872)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4840: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3872)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4841: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3872)
Ich habe den AFK-Manager eingebaut mit ein paar kleinen Änderungen. Ich weiß, ich muss limit, staart und num_afkstatus definieren, aber wie weiß ich leider nicht.

Mein Einbau in der index.php ist:

Code: Alles auswählen

// AFK Manager 
if (isset($config['afkmanager_afk_autoafk']))
{
	global $cache;
	$cache->purge();
	if ($config['afkmanager_afk_autoafk'])
	{
		$check_time = (int) gmdate('mdY',time() + (3600 * ($config['board_timezone'] + $config['board_dst'])));
		if ( $config['afkmanager_afk_autoafk_check'] != $check_time)
		{
			if (!function_exists('afkmanager_autoafk_users'))
			{
				include($phpbb_root_path . 'includes/functions_afkmanager.' . $phpEx);
			}
			afkmanager_autoafk_users();
			set_config('afkmanager_afk_autoafk_check', $check_time);
		}
	}
}	
				$sql = 'SELECT username, user_afkstatus, user_id
						FROM ' . $table_prefix . 'users
						WHERE user_afkstatus = 1
						ORDER BY username ASC';
				//$result = $db->sql_query($sql);
				$result = $db->sql_query_limit($sql, $limit, $start);


				//echo $config['afkmanager_afk_posting_enable'];

				//while ($row = $db->sql_fetchrow($result))
				while($row = $db->sql_fetchrow($result, $limit, $start))
				{
					$template->assign_block_vars('afkers', array( 
						'AFKER_ID'					=> $row['user_id'],
						'AFKER_LINK'				=> append_sid('memberlist.php?mode=viewprofile&u=' . $row['user_id']),
						'AFKER_NAME'				=> $row['username'],
						'AFKER_STATUS'				=> $row['user_afkstatus'],
					));
				}
$total_afkstatus	= $config['num_afkstatus'];
// AFK Manager 
Daher hoffe ich mal, dass jemand mir helfen kann, so dass ich mir beim nächsten Mal hoffentlich selbst helfen kann.

Re: Fehlerbehebung bei AFK Manager

Verfasst: 01.08.2012 02:43
von darkonia
der mod ist schon seit ewigen zeiten [ABD] ... irwie klar das er nicht richtig geht mit phpbb 3.0.10

Re: Fehlerbehebung bei AFK Manager

Verfasst: 01.08.2012 12:12
von Secretly
Der Mod funktioniert, wie man auch hier sieht (unten sind die abwesenden User aufgelistet und im Profil steht wie lange sie abwesend sind) ;) Ich möchte lediglich die Fehler die durch meine "Änderungen" entstanden sind beheben.

Re: Fehlerbehebung bei AFK Manager

Verfasst: 01.08.2012 12:43
von BNa
Zu 1
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 164: Undefined variable: limit
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 164: Undefined variable: start
Kommt daher:

Code: Alles auswählen

$result = $db->sql_query_limit($sql, $limit, $start);
Erklärung: $limit und $start sind nicht definiert. Logo, tauchen ja nirgendwo auf, bzw. wurden vorher nicht definiert.
Solange Du keine Pagination benutzt oder Dich damit nicht auskennst, halte das Script so einfach wie möglich, also schreibe (erstmal):

Code: Alles auswählen

$result = $db->sql_query($sql);
Zu 2
[phpBB Debug] PHP Notice: in file [ROOT]/index.php on line 179: Undefined index: num_afkstatus
Kommt daher:

Code: Alles auswählen

$config['num_afkstatus'] 
Erklärung: Der DB Eintrag in der CONFIG_TABLE namens num_afkstatus fehlt. Ist also undefiniert. Erzeuge den Eintrag via set_config('num_afkstatus','dein_string'); als string() oder set_config('num_afkstatus',3); als int() oder whatever (einfach in die index.php einfügen und die Datei ein zweimal F5'en, dann wieder entfernen) und sieh zu, das der Wert zukünftig bedient wird (woher er auch immer kommt, bzw, normalerweise befüllt wird).

Re: Fehlerbehebung bei AFK Manager

Verfasst: 01.08.2012 17:31
von Secretly
Danke :) Ich habe tatsächlich gar keine Fehlermeldung mehr.

Code: Alles auswählen

while($row = $db->sql_fetchrow($result, $limit, $start))
habe ich noch gegen:

Code: Alles auswählen

//while ($row = $db->sql_fetchrow($result))
ausgetauscht

und

Code: Alles auswählen

$total_afkstatus   = $config['num_afkstatus'];
Habe ich ganz weggenommen und jetzt geht es :) Danke BNa

Re: Fehlerbehebung bei AFK Manager

Verfasst: 01.08.2012 20:04
von BNa
Kein Problem. Das hier hatte ich garnicht gesehen
Secretly hat geschrieben:

Code: Alles auswählen

while($row = $db->sql_fetchrow($result, $limit, $start))
und war natürlich Quark an der Stelle bzw. doppelt gemoppelt.