1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-20 23:41:29 +02:00

[ticket/11700] Move all recent code to namespaces

PHPBB3-11700
This commit is contained in:
Nils Adermann
2013-09-10 14:01:09 +02:00
parent 196e1813cd
commit b95fdacdd3
420 changed files with 2316 additions and 1840 deletions

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification;
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_exception extends \Exception
class exception extends \Exception
{
public function __toString()
{

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Notifications service class
* @package notifications
*/
class phpbb_notification_manager
class manager
{
/** @var array */
protected $notification_types;
@@ -30,16 +32,16 @@ class phpbb_notification_manager
/** @var ContainerBuilder */
protected $phpbb_container;
/** @var phpbb_user_loader */
/** @var \phpbb\user_loader */
protected $user_loader;
/** @var phpbb_db_driver */
/** @var \phpbb\db\driver\driver */
protected $db;
/** @var phpbb_cache_service */
/** @var \phpbb\cache\service */
protected $cache;
/** @var phpbb_user */
/** @var \phpbb\user */
protected $user;
/** @var string */
@@ -63,17 +65,17 @@ class phpbb_notification_manager
* @param array $notification_types
* @param array $notification_methods
* @param ContainerBuilder $phpbb_container
* @param phpbb_user_loader $user_loader
* @param phpbb_db_driver $db
* @param phpbb_user $user
* @param \phpbb\user_loader $user_loader
* @param \phpbb\db\driver\driver $db
* @param \phpbb\user $user
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $notification_types_table
* @param string $notifications_table
* @param string $user_notifications_table
* @return phpbb_notification_manager
* @return \phpbb\notification\manager
*/
public function __construct($notification_types, $notification_methods, $phpbb_container, phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
{
$this->notification_types = $notification_types;
$this->notification_methods = $notification_methods;
@@ -377,8 +379,8 @@ class phpbb_notification_manager
// Never send notifications to the anonymous user!
unset($notify_users[ANONYMOUS]);
// Make sure not to send new notifications to users who've already been notified about this item
// This may happen when an item was added, but now new users are able to see the item
// Make sure not to send new \notifications to users who've already been notified about this item
// This may happen when an item was added, but now new \users are able to see the item
$sql = 'SELECT n.user_id
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
WHERE n.notification_type_id = ' . (int) $notification_type_id . '
@@ -402,7 +404,7 @@ class phpbb_notification_manager
$pre_create_data = $notification->pre_create_insert_array($data, $notify_users);
unset($notification);
$insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $this->notifications_table);
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->notifications_table);
// Go through each user so we can insert a row in the DB and then notify them by their desired means
foreach ($notify_users as $user => $methods)
@@ -525,7 +527,7 @@ class phpbb_notification_manager
{
$type = $this->get_item_type_class($type_name);
if ($type instanceof phpbb_notification_type_type_interface && $type->is_available())
if ($type instanceof \phpbb\notification\type\type_interface && $type->is_available())
{
$options = array_merge(array(
'id' => $type->get_type(),
@@ -561,7 +563,7 @@ class phpbb_notification_manager
{
$method = $this->get_method_class($method_name);
if ($method instanceof phpbb_notification_method_method_interface && $method->is_available())
if ($method instanceof \phpbb\notification\method\method_interface && $method->is_available())
{
$subscription_methods[$method_name] = array(
'id' => $method->get_type(),
@@ -873,7 +875,7 @@ class phpbb_notification_manager
{
if (!isset($this->notification_types[$notification_type_name]) && !isset($this->notification_types['notification.type.' . $notification_type_name]))
{
throw new phpbb_notification_exception($this->user->lang('NOTIFICATION_TYPE_NOT_EXIST', $notification_type_name));
throw new \phpbb\notification\exception($this->user->lang('NOTIFICATION_TYPE_NOT_EXIST', $notification_type_name));
}
$sql = 'INSERT INTO ' . $this->notification_types_table . ' ' . $this->db->sql_build_array('INSERT', array(

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\method;
/**
* @ignore
*/
@@ -19,33 +21,33 @@ if (!defined('IN_PHPBB'))
* Base notifications method class
* @package notifications
*/
abstract class phpbb_notification_method_base implements phpbb_notification_method_method_interface
abstract class base implements \phpbb\notification\method\method_interface
{
/** @var phpbb_notification_manager */
/** @var \phpbb\notification\manager */
protected $notification_manager;
/** @var phpbb_user_loader */
/** @var \phpbb\user_loader */
protected $user_loader;
/** @var phpbb_db_driver */
/** @var \phpbb\db\driver\driver */
protected $db;
/** @var phpbb_cache_driver_driver_interface */
/** @var \phpbb\cache\driver\driver_interface */
protected $cache;
/** @var phpbb_template */
/** @var \phpbb\template\template */
protected $template;
/** @var phpbb_extension_manager */
/** @var \phpbb\extension\manager */
protected $extension_manager;
/** @var phpbb_user */
/** @var \phpbb\user */
protected $user;
/** @var phpbb_auth */
/** @var \phpbb\auth\auth */
protected $auth;
/** @var phpbb_config */
/** @var \phpbb\config\config */
protected $config;
/** @var string */
@@ -64,17 +66,17 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth
/**
* Notification Method Base Constructor
*
* @param phpbb_user_loader $user_loader
* @param phpbb_db_driver $db
* @param phpbb_cache_driver_driver_interface $cache
* @param phpbb_user $user
* @param phpbb_auth $auth
* @param phpbb_config $config
* @param \phpbb\user_loader $user_loader
* @param \phpbb\db\driver\driver $db
* @param \phpbb\cache\driver\driver_interface $cache
* @param \phpbb\user $user
* @param \phpbb\auth\auth $auth
* @param \phpbb\config\config $config
* @param string $phpbb_root_path
* @param string $php_ext
* @return phpbb_notification_method_base
* @return \phpbb\notification\method\base
*/
public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext)
{
$this->user_loader = $user_loader;
$this->db = $db;
@@ -89,9 +91,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth
/**
* Set notification manager (required)
*
* @param phpbb_notification_manager $notification_manager
* @param \phpbb\notification\manager $notification_manager
*/
public function set_notification_manager(phpbb_notification_manager $notification_manager)
public function set_notification_manager(\phpbb\notification\manager $notification_manager)
{
$this->notification_manager = $notification_manager;
}
@@ -99,9 +101,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth
/**
* Add a notification to the queue
*
* @param phpbb_notification_type_type_interface $notification
* @param \phpbb\notification\type\type_interface $notification
*/
public function add_to_queue(phpbb_notification_type_type_interface $notification)
public function add_to_queue(\phpbb\notification\type\type_interface $notification)
{
$this->queue[] = $notification;
}

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\method;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_method_email extends phpbb_notification_method_messenger_base
class email extends \phpbb\notification\method\messenger_base
{
/**
* Get notification method name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\method;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_method_jabber extends phpbb_notification_method_messenger_base
class jabber extends \phpbb\notification\method\messenger_base
{
/**
* Get notification method name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\method;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
abstract class phpbb_notification_method_messenger_base extends phpbb_notification_method_base
abstract class messenger_base extends \phpbb\notification\method\base
{
/**
* Notify using phpBB messenger
@@ -60,7 +62,7 @@ abstract class phpbb_notification_method_messenger_base extends phpbb_notificati
{
include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
}
$messenger = new messenger();
$messenger = new \messenger();
$board_url = generate_board_url();
// Time to go through the queue and send emails

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\method;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Base notifications method interface
* @package notifications
*/
interface phpbb_notification_method_method_interface
interface method_interface
{
/**
* Get notification method name
@@ -37,9 +39,9 @@ interface phpbb_notification_method_method_interface
/**
* Add a notification to the queue
*
* @param phpbb_notification_type_type_interface $notification
* @param \phpbb\notification\type\type_interface $notification
*/
public function add_to_queue(phpbb_notification_type_type_interface $notification);
public function add_to_queue(\phpbb\notification\type\type_interface $notification);
/**
* Parse the queue and notify the users

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_approve_post extends phpbb_notification_type_post
class approve_post extends \phpbb\notification\type\post
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_approve_topic extends phpbb_notification_type_topic
class approve_topic extends \phpbb\notification\type\topic
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -19,30 +21,30 @@ if (!defined('IN_PHPBB'))
* Base notifications class
* @package notifications
*/
abstract class phpbb_notification_type_base implements phpbb_notification_type_type_interface
abstract class base implements \phpbb\notification\type\type_interface
{
/** @var phpbb_notification_manager */
/** @var \phpbb\notification\manager */
protected $notification_manager;
/** @var phpbb_user_loader */
/** @var \phpbb\user_loader */
protected $user_loader;
/** @var phpbb_db_driver */
/** @var \phpbb\db\driver\driver */
protected $db;
/** @var phpbb_cache_driver_driver_interface */
/** @var \phpbb\cache\driver\driver_interface */
protected $cache;
/** @var phpbb_template */
/** @var \phpbb\template\template */
protected $template;
/** @var phpbb_user */
/** @var \phpbb\user */
protected $user;
/** @var phpbb_auth */
/** @var \phpbb\auth\auth */
protected $auth;
/** @var phpbb_config */
/** @var \phpbb\config\config */
protected $config;
/** @var string */
@@ -94,20 +96,20 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_t
/**
* Notification Type Base Constructor
*
* @param phpbb_user_loader $user_loader
* @param phpbb_db_driver $db
* @param phpbb_cache_driver_driver_interface $cache
* @param phpbb_user $user
* @param phpbb_auth $auth
* @param phpbb_config $config
* @param \phpbb\user_loader $user_loader
* @param \phpbb\db\driver\driver $db
* @param \phpbb\cache\driver\driver_interface $cache
* @param \phpbb\user $user
* @param \phpbb\auth\auth $auth
* @param \phpbb\config\config $config
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $notification_types_table
* @param string $notifications_table
* @param string $user_notifications_table
* @return phpbb_notification_type_base
* @return \phpbb\notification\type\base
*/
public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
{
$this->user_loader = $user_loader;
$this->db = $db;
@@ -127,9 +129,9 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_t
/**
* Set notification manager (required)
*
* @param phpbb_notification_manager $notification_manager
* @param \phpbb\notification\manager $notification_manager
*/
public function set_notification_manager(phpbb_notification_manager $notification_manager)
public function set_notification_manager(\phpbb\notification\manager $notification_manager)
{
$this->notification_manager = $notification_manager;
@@ -143,7 +145,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_t
*/
public function set_initial_data($data = array())
{
// The row from the database (unless this is a new notification we're going to add)
// The row from the database (unless this is a new \notification we're going to add)
$this->data = $data;
$this->data['notification_data'] = (isset($this->data['notification_data'])) ? unserialize($this->data['notification_data']) : array();
}
@@ -220,9 +222,9 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_t
{
// Defaults
$this->data = array_merge(array(
'item_id' => static::get_item_id($type_data),
'item_id' => \static::get_item_id($type_data),
'notification_type_id' => $this->notification_type_id,
'item_parent_id' => static::get_item_parent_id($type_data),
'item_parent_id' => \static::get_item_parent_id($type_data),
'notification_time' => time(),
'notification_read' => false,

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_bookmark extends phpbb_notification_type_post
class bookmark extends \phpbb\notification\type\post
{
/**
* Get notification type name
@@ -112,7 +114,7 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// Do not create a new notification
// Do not create a new \notification
unset($notify_users[$row['user_id']]);
$notification = $this->notification_manager->get_item_type_class($this->get_type(), $row);

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_disapprove_post extends phpbb_notification_type_approve_post
class disapprove_post extends \phpbb\notification\type\approve_post
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_disapprove_topic extends phpbb_notification_type_approve_topic
class disapprove_topic extends \phpbb\notification\type\approve_topic
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_pm extends phpbb_notification_type_base
class pm extends \phpbb\notification\type\base
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_post extends phpbb_notification_type_base
class post extends \phpbb\notification\type\base
{
/**
* Get notification type name
@@ -147,7 +149,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// Do not create a new notification
// Do not create a new \notification
unset($notify_users[$row['user_id']]);
$notification = $this->notification_manager->get_item_type_class($this->get_type(), $row);

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
class post_in_queue extends \phpbb\notification\type\post
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_quote extends phpbb_notification_type_post
class quote extends \phpbb\notification\type\post
{
/**
* Get notification type name
@@ -131,7 +133,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
// Do not create a new notification
// Do not create a new \notification
unset($notify_users[$row['user_id']]);
$notification = $this->notification_manager->get_item_type_class($this->get_type(), $row);
@@ -166,7 +168,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
}
$this->db->sql_freeresult($result);
// Find the new users to notify
// Find the new \users to notify
$notifications = $this->find_users_for_notification($post);
// Find the notifications we must delete

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
class report_pm extends \phpbb\notification\type\pm
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_report_pm_closed extends phpbb_notification_type_pm
class report_pm_closed extends \phpbb\notification\type\pm
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_report_post extends phpbb_notification_type_post_in_queue
class report_post extends \phpbb\notification\type\post_in_queue
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_report_post_closed extends phpbb_notification_type_post
class report_post_closed extends \phpbb\notification\type\post
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -17,11 +19,11 @@ if (!defined('IN_PHPBB'))
/**
* Topic notifications class
* This class handles notifications for new topics
* This class handles notifications for new \topics
*
* @package notifications
*/
class phpbb_notification_type_topic extends phpbb_notification_type_base
class topic extends \phpbb\notification\type\base
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_topic
class topic_in_queue extends \phpbb\notification\type\topic
{
/**
* Get notification type name

View File

@@ -7,6 +7,8 @@
*
*/
namespace phpbb\notification\type;
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Base notifications interface
* @package notifications
*/
interface phpbb_notification_type_type_interface
interface type_interface
{
/**
* Get notification type name