Seite 1 von 1

Ungewollte Benachrichtigung bei jedem Beitrag für Admin

Verfasst: 12.07.2005 07:58
von Icebyte
Hi,

ich glaube, der Betreff sagt es schon - ich bekomme neuerdings für jeden Beitrag in meinem Forum eine Notification - unabhängig davon, ob ich in diesem Thread etwas gepostet habe - oder ihn gar abonniert habe. Klicke ich in den entsprechenden Mails auf den Unwatch-Link, lande ich nicht bei der "Sie beobachten diesen Thread nicht mehr"-Seite, sondern sofort beim entsprechenden Thread - bekomme ich die Mail und schaue vorab im Forum vorbei, sieht man eindeutig, daß ich das Thema nicht beobachte.

Als Sahnehäubchen kommt noch hinzu, daß ich manchmal die deutsche und die englische Benachrichtigung für ein und den selben Thread bekomme ....

Ja, ich habe die topics_watch-Tabelle als erstes überprüft für meine user_id - leer.

Ich werde noch zum Elch :roll:

Es wurde in letzter Zeit - zumindest nicht wissentlich - keine Änderungen vorgenommen - ich bin der einzige Admin. Der letzte Schitt war der Upgrade auf 2.016 - am selben Tag, an dem es rauskam, das Probleme existiert aber erst seit ein paar Tagen.

Ich wäre sehr dankbar für Hlfestellungen, wen ihr weitere Infos braucht, sagt Bescheid. Es ist übrigens nur der Admin-Account betroffen, alle anderen User haben - soweit ich das überblicken kann - nach Stichproben bzw. Nachfragen - keine Probleme.

Bye, Icebyte

Verfasst: 14.07.2005 02:04
von QCO
wen ihr weitere Infos braucht, sagt Bescheid.
Also ein guter Ansatz wären mal die Stellen deines Codes, wo das Board E-Mails verschickt.
Das sollte eigentlich nur in der Funktion user_notification() [includes/functions_post.php] passieren.
Wenn du PHP-Grundkenntnisse hast, kannst du dort auch selbst mal schauen, ob du was verdächtiges findest. Besonders solltest du auf evtl. Stellen achten, an denen du etwas gemoddet hast (denn dadurch wird das Problem entstanden sein)
Poste/verlinke also mal diesen Teil. Außerdem kannst du auch sonst mal in der posting.php und includes/functions_post.php nach Schlagwörtern wie 'emailer' oder 'send()' suchen und schauen, ob du einen Mailaufruf an einer nicht eingeplanten Stelle findest.

Verfasst: 14.07.2005 07:18
von Icebyte
Hi QCO,

das ist kein Problem - aber vorerst mal noch ein paar Detailinfos. Ich habe inzwischen den betroffenen Acocunt mal ein wenig verändert - ich habe ihn vom Administrator auf einen normalen User heruntergestuft - Problem bleibt unverändert - weiterhin bekommt dieser User Notification-E-Mails (ein anderer User wurde natürlich als Admin angelegt, mit anderer E-Mail-Adresse, dieser bekommt keine Mails).

Vielleicht sei noch erwähnt, das der bisherige Problem-Admin die gleiche Mailadresse wie das Board hatte - auch nach der Herabstufung zum Normaluser. Diese beim ehemaligen Admin hinterlegte Adresse habe ich jetzt als letzen Schritt ebenfalls geändert - und jetzt kommt's : trotz dieser Änderung kommen die E-Mails von der Board-Adresse an die Board-Adresse - es scheint also, ob es nicht der Account ist, sondern so, als ob sich das Board selbst mit E-Mails versorgen würde ... ?

Die posting.php und die functions_post.php habe ich schon mal angeschaut - sieht für mich ok aus (soweit ich das beurteilen kann). Die functions_post.php hatte ich schonmal beäugt. Das Problem für mich ist auch generell : wie läuft das Prozedere im Board ab - welches Skript überprüft welche Parameter ? Wie gesagt, laut watch-Tabelle dürfte gar nichts ankommen (aber wie gesagt, scheint ja nicht mit einem bestimmten Acocunt zusammenzuhängen, siehe oben).

Ok, hier schon mal der Code-Ausschnitt von der functions_post.php

Code: Alles auswählen

//
// Handle user notification on new post
//
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
	global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
	global $userdata, $user_ip;

	$current_time = time();

	if ($mode == 'delete')
	{
		$delete_sql = (!$post_data['first_post'] && !$post_data['last_post']) ? " AND user_id = " . $userdata['user_id'] : '';
		$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = $topic_id" . $delete_sql;
		if (!$db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Could not change topic notify data', '', __LINE__, __FILE__, $sql);
		}
	}
	else 
	{
		if ($mode == 'reply')
		{
			$sql = "SELECT ban_userid 
				FROM " . BANLIST_TABLE;
			if (!($result = $db->sql_query($sql)))
			{
				message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
			}

			$user_id_sql = '';
			while ($row = $db->sql_fetchrow($result))
			{
				if (isset($row['ban_userid']) && !empty($row['ban_userid']))
				{
					$user_id_sql .= ', ' . $row['ban_userid'];
				}
			}

			$sql = "SELECT u.user_id, u.user_email, u.user_lang 
				FROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " u 
				WHERE tw.topic_id = $topic_id 
					AND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . ") 
					AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " 
					AND u.user_id = tw.user_id";
			if (!($result = $db->sql_query($sql)))
			{
				message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
			}

			$update_watched_sql = '';
			$bcc_list_ary = array();
			
			if ($row = $db->sql_fetchrow($result))
			{
				// Sixty second limit
				@set_time_limit(60);

				do
				{
					if ($row['user_email'] != '')
					{
						$bcc_list_ary[$row['user_lang']][] = $row['user_email'];
					}
					$update_watched_sql .= ($update_watched_sql != '') ? ', ' . $row['user_id'] : $row['user_id'];
				}
				while ($row = $db->sql_fetchrow($result));

				//
				// Let's do some checking to make sure that mass mail functions
				// are working in win32 versions of php.
				//
				if (preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
				{
					$ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var';

					// We are running on windows, force delivery to use our smtp functions
					// since php's are broken by default
					$board_config['smtp_delivery'] = 1;
					$board_config['smtp_host'] = @$ini_val('SMTP');
				}

				if (sizeof($bcc_list_ary))
				{
					include($phpbb_root_path . 'includes/emailer.'.$phpEx);
					$emailer = new emailer($board_config['smtp_delivery']);

					$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
					$script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
					$server_name = trim($board_config['server_name']);
					$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
					$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';

					$orig_word = array();
					$replacement_word = array();
					obtain_word_list($orig_word, $replacement_word);

					$emailer->from($board_config['board_email']);
					$emailer->replyto($board_config['board_email']);

					$topic_title = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, unprepare_message($topic_title)) : unprepare_message($topic_title);

					@reset($bcc_list_ary);
					while (list($user_lang, $bcc_list) = each($bcc_list_ary))
					{
						$emailer->use_template('topic_notify', $user_lang);
		
						for ($i = 0; $i < count($bcc_list); $i++)
						{
							$emailer->bcc($bcc_list[$i]);
						}

						// The Topic_reply_notification lang string below will be used
						// if for some reason the mail template subject cannot be read 
						// ... note it will not necessarily be in the posters own language!
						$emailer->set_subject($lang['Topic_reply_notification']); 
						
						// This is a nasty kludge to remove the username var ... till (if?)
						// translators update their templates
						$emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);

						$emailer->assign_vars(array(
							'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
							'SITENAME' => $board_config['sitename'],
							'TOPIC_TITLE' => $topic_title, 

							'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "=$post_id#$post_id",
							'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
						);

						$emailer->send();
						$emailer->reset();
					}
				}
			}
			$db->sql_freeresult($result);

			if ($update_watched_sql != '')
			{
				$sql = "UPDATE " . TOPICS_WATCH_TABLE . "
					SET notify_status = " . TOPIC_WATCH_NOTIFIED . "
					WHERE topic_id = $topic_id
						AND user_id IN ($update_watched_sql)";
				$db->sql_query($sql);
			}
		}

		$sql = "SELECT topic_id 
			FROM " . TOPICS_WATCH_TABLE . "
			WHERE topic_id = $topic_id
				AND user_id = " . $userdata['user_id'];
		if (!($result = $db->sql_query($sql)))
		{
			message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
		}

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

		if (!$notify_user && !empty($row['topic_id']))
		{
			$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
				WHERE topic_id = $topic_id
					AND user_id = " . $userdata['user_id'];
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql);
			}
		}
		else if ($notify_user && empty($row['topic_id']))
		{
			$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
				VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql);
			}
		}
	}
}
Danke vorab für eure/deine Mühe, ich werd hier echt noch bekloppt :x

Bye, Ice

Verfasst: 14.07.2005 07:25
von Icebyte
Hi,

noch zum Thema Modding - in den letzten Wochen wurde nur das Intro/Portal-Mod eingebaut (da waren beide o.g. Skripte nicht betroffen) und es erfolgte der Upgrade auf 2.0.16. (ebenso)

Übrigens kommen scheinbar nicht für alle Threads Notifications - heute morgen gab es 4 Threads mit neuen Posts, aber ich habe nur 3 Benachrichtigungen bekommen. Was übrigens auch ein interessanter Effekt ist : manchmal bekomme ich die Notifications in 2-facher Ausführung - in deutsch und in englisch ...

Bye, Ice

Verfasst: 14.07.2005 13:37
von Icebyte
Hi,

kurz als Zwischeninfo - der Fehler tritt nicht mehr auf, nachdem auch die Board-Adresse (die identisch mit Mail-Adresse des Admins war) ausgewechselt wurde - muß aber noch überprüfen, woran es im Detail lag.

Melde mich bei Interesse gerne nochmal und poste noch eine Abschlußinfo bei Bedarf ;-)

Dankeschön für die Mühe erst einmal !

Bye, Ice