mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11103] Output the notifications to the template
For now, just dumping the notifications in the header. PHPBB3-11103
This commit is contained in:
@@ -4778,7 +4778,7 @@ function phpbb_http_login($param)
|
||||
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
|
||||
{
|
||||
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
|
||||
global $phpbb_dispatcher;
|
||||
global $phpbb_dispatcher, $phpbb_container;
|
||||
|
||||
if (defined('HEADER_INC'))
|
||||
{
|
||||
@@ -5092,6 +5092,13 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||
'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')),
|
||||
));
|
||||
|
||||
// Output the notifications
|
||||
$phpbb_notifications = $phpbb_container->get('notifications');
|
||||
foreach ($phpbb_notifications->load_notifications() as $notification)
|
||||
{
|
||||
$notification->display();
|
||||
}
|
||||
|
||||
// application/xhtml+xml not used because of IE
|
||||
header('Content-type: text/html; charset=UTF-8');
|
||||
|
||||
|
@@ -87,14 +87,14 @@ class phpbb_notifications_service
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$type_class_name = $this->get_type_class_name($row['type'], true);
|
||||
$type_class_name = $this->get_type_class_name($row['item_type'], true);
|
||||
|
||||
$notification = new $type_class_name($this->phpbb_container, $row);
|
||||
$notification->users($this->users);
|
||||
|
||||
$user_ids = array_merge($user_ids, $notification->users_to_query());
|
||||
|
||||
$notifications[] = $notification();
|
||||
$notifications[] = $notification;
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
|
@@ -85,7 +85,7 @@ abstract class phpbb_notifications_type_base implements phpbb_notifications_type
|
||||
*/
|
||||
protected function get_data($name)
|
||||
{
|
||||
return $this->data['data'][$name];
|
||||
return (isset($this->data['data'][$name])) ? $this->data['data'][$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,18 @@ abstract class phpbb_notifications_type_base implements phpbb_notifications_type
|
||||
*/
|
||||
public function users(&$users)
|
||||
{
|
||||
$this->users = $users;
|
||||
$this->users = &$users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a user row from our users cache
|
||||
*
|
||||
* @param int $user_id
|
||||
* @return array
|
||||
*/
|
||||
protected function get_user($user_id)
|
||||
{
|
||||
return $this->users[$user_id];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -37,7 +37,18 @@ class phpbb_notifications_type_post extends phpbb_notifications_type_base
|
||||
*/
|
||||
public function get_title()
|
||||
{
|
||||
return $this->data['post_username'] . ' posted in the topic ' . censor_text($this->data['topic_title']);
|
||||
if ($this->get_data('post_username'))
|
||||
{
|
||||
$username = $this->get_data('post_username');
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_data = $this->get_user($this->get_data('poster_id'));
|
||||
|
||||
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||
}
|
||||
|
||||
return $username . ' posted in the topic ' . censor_text($this->get_data('topic_title'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user