From b81613e5e57fd208e832637b6886abf9ec806c4b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 12:25:28 -0400 Subject: [ticket/11700] With namespaces interface will no longer be a valid classname PHPBB3-11700 --- phpBB/phpbb/auth/provider/interface.php | 105 ------------ phpBB/phpbb/auth/provider/provider_interface.php | 105 ++++++++++++ phpBB/phpbb/avatar/driver/driver_interface.php | 116 +++++++++++++ phpBB/phpbb/avatar/driver/interface.php | 116 ------------- phpBB/phpbb/cache/driver/driver_interface.php | 144 ++++++++++++++++ phpBB/phpbb/cache/driver/interface.php | 144 ---------------- phpBB/phpbb/db/migration/tool/interface.php | 33 ---- phpBB/phpbb/db/migration/tool/tool_interface.php | 33 ++++ phpBB/phpbb/extension/extension_interface.php | 67 ++++++++ phpBB/phpbb/extension/interface.php | 67 -------- .../groupposition/groupposition_interface.php | 84 +++++++++ phpBB/phpbb/groupposition/interface.php | 84 --------- phpBB/phpbb/log/interface.php | 106 ------------ phpBB/phpbb/log/log_interface.php | 106 ++++++++++++ phpBB/phpbb/notification/method/interface.php | 48 ------ .../phpbb/notification/method/method_interface.php | 48 ++++++ phpBB/phpbb/notification/type/interface.php | 189 --------------------- phpBB/phpbb/notification/type/type_interface.php | 189 +++++++++++++++++++++ phpBB/phpbb/request/interface.php | 139 --------------- phpBB/phpbb/request/request_interface.php | 139 +++++++++++++++ phpBB/phpbb/tree/interface.php | 122 ------------- phpBB/phpbb/tree/tree_interface.php | 122 +++++++++++++ 22 files changed, 1153 insertions(+), 1153 deletions(-) delete mode 100644 phpBB/phpbb/auth/provider/interface.php create mode 100644 phpBB/phpbb/auth/provider/provider_interface.php create mode 100644 phpBB/phpbb/avatar/driver/driver_interface.php delete mode 100644 phpBB/phpbb/avatar/driver/interface.php create mode 100644 phpBB/phpbb/cache/driver/driver_interface.php delete mode 100644 phpBB/phpbb/cache/driver/interface.php delete mode 100644 phpBB/phpbb/db/migration/tool/interface.php create mode 100644 phpBB/phpbb/db/migration/tool/tool_interface.php create mode 100644 phpBB/phpbb/extension/extension_interface.php delete mode 100644 phpBB/phpbb/extension/interface.php create mode 100644 phpBB/phpbb/groupposition/groupposition_interface.php delete mode 100644 phpBB/phpbb/groupposition/interface.php delete mode 100644 phpBB/phpbb/log/interface.php create mode 100644 phpBB/phpbb/log/log_interface.php delete mode 100644 phpBB/phpbb/notification/method/interface.php create mode 100644 phpBB/phpbb/notification/method/method_interface.php delete mode 100644 phpBB/phpbb/notification/type/interface.php create mode 100644 phpBB/phpbb/notification/type/type_interface.php delete mode 100644 phpBB/phpbb/request/interface.php create mode 100644 phpBB/phpbb/request/request_interface.php delete mode 100644 phpBB/phpbb/tree/interface.php create mode 100644 phpBB/phpbb/tree/tree_interface.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php deleted file mode 100644 index 47043bc107..0000000000 --- a/phpBB/phpbb/auth/provider/interface.php +++ /dev/null @@ -1,105 +0,0 @@ - status constant - * 'error_msg' => string - * 'user_row' => array - * ) - */ - public function login($username, $password); - - /** - * Autologin function - * - * @return array|null containing the user row, empty if no auto login - * should take place, or null if not impletmented. - */ - public function autologin(); - - /** - * This function is used to output any required fields in the authentication - * admin panel. It also defines any required configuration table fields. - * - * @return array|null Returns null if not implemented or an array of the - * configuration fields of the provider. - */ - public function acp(); - - /** - * This function updates the template with variables related to the acp - * options with whatever configuraton values are passed to it as an array. - * It then returns the name of the acp file related to this authentication - * provider. - * @param array $new_config Contains the new configuration values that - * have been set in acp_board. - * @return array|null Returns null if not implemented or an array with - * the template file name and an array of the vars - * that the template needs that must conform to the - * following example: - * array( - * 'TEMPLATE_FILE' => string, - * 'TEMPLATE_VARS' => array(...), - * ) - */ - public function get_acp_template($new_config); - - /** - * Performs additional actions during logout. - * - * @param array $data An array corresponding to - * phpbb_session::data - * @param boolean $new_session True for a new session, false for no new - * session. - */ - public function logout($data, $new_session); - - /** - * The session validation function checks whether the user is still logged - * into phpBB. - * - * @param array $user - * @return boolean true if the given user is authenticated, false if the - * session should be closed, or null if not implemented. - */ - public function validate_session($user); -} diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php new file mode 100644 index 0000000000..baf55c7a86 --- /dev/null +++ b/phpBB/phpbb/auth/provider/provider_interface.php @@ -0,0 +1,105 @@ + status constant + * 'error_msg' => string + * 'user_row' => array + * ) + */ + public function login($username, $password); + + /** + * Autologin function + * + * @return array|null containing the user row, empty if no auto login + * should take place, or null if not impletmented. + */ + public function autologin(); + + /** + * This function is used to output any required fields in the authentication + * admin panel. It also defines any required configuration table fields. + * + * @return array|null Returns null if not implemented or an array of the + * configuration fields of the provider. + */ + public function acp(); + + /** + * This function updates the template with variables related to the acp + * options with whatever configuraton values are passed to it as an array. + * It then returns the name of the acp file related to this authentication + * provider. + * @param array $new_config Contains the new configuration values that + * have been set in acp_board. + * @return array|null Returns null if not implemented or an array with + * the template file name and an array of the vars + * that the template needs that must conform to the + * following example: + * array( + * 'TEMPLATE_FILE' => string, + * 'TEMPLATE_VARS' => array(...), + * ) + */ + public function get_acp_template($new_config); + + /** + * Performs additional actions during logout. + * + * @param array $data An array corresponding to + * phpbb_session::data + * @param boolean $new_session True for a new session, false for no new + * session. + */ + public function logout($data, $new_session); + + /** + * The session validation function checks whether the user is still logged + * into phpBB. + * + * @param array $user + * @return boolean true if the given user is authenticated, false if the + * session should be closed, or null if not implemented. + */ + public function validate_session($user); +} diff --git a/phpBB/phpbb/avatar/driver/driver_interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php new file mode 100644 index 0000000000..0a44a7a1fe --- /dev/null +++ b/phpBB/phpbb/avatar/driver/driver_interface.php @@ -0,0 +1,116 @@ + '', 'width' => 0, 'height' => 0] + */ + public function get_data($row); + + /** + * Returns custom html if it is needed for displaying this avatar + * + * @param phpbb_user $user phpBB user object + * @param array $row User data or group data that has been cleaned with + * phpbb_avatar_manager::clean_row + * @param string $alt Alternate text for avatar image + * + * @return string HTML + */ + public function get_custom_html($user, $row, $alt = ''); + + /** + * Prepare form for changing the settings of this avatar + * + * @param phpbb_request $request Request object + * @param phpbb_template $template Template object + * @param phpbb_user $user User object + * @param array $row User data or group data that has been cleaned with + * phpbb_avatar_manager::clean_row + * @param array &$error Reference to an error array that is filled by this + * function. Key values can either be a string with a language key or + * an array that will be passed to vsprintf() with the language key in + * the first array key. + * + * @return bool True if form has been successfully prepared + */ + public function prepare_form($request, $template, $user, $row, &$error); + + /** + * Prepare form for changing the acp settings of this avatar + * + * @param phpbb_user $user phpBB user object + * + * @return array Array of configuration options as consumed by acp_board. + * The setting for enabling/disabling the avatar will be handled by + * the avatar manager. + */ + public function prepare_form_acp($user); + + /** + * Process form data + * + * @param phpbb_request $request Request object + * @param phpbb_template $template Template object + * @param phpbb_user $user User object + * @param array $row User data or group data that has been cleaned with + * phpbb_avatar_manager::clean_row + * @param array &$error Reference to an error array that is filled by this + * function. Key values can either be a string with a language key or + * an array that will be passed to vsprintf() with the language key in + * the first array key. + * + * @return array Array containing the avatar data as follows: + * ['avatar'], ['avatar_width'], ['avatar_height'] + */ + public function process_form($request, $template, $user, $row, &$error); + + /** + * Delete avatar + * + * @param array $row User data or group data that has been cleaned with + * phpbb_avatar_manager::clean_row + * + * @return bool True if avatar has been deleted or there is no need to delete, + * i.e. when the avatar is not hosted locally. + */ + public function delete($row); + + /** + * Get the avatar driver's template name + * + * @return string Avatar driver's template name + */ + public function get_template_name(); +} diff --git a/phpBB/phpbb/avatar/driver/interface.php b/phpBB/phpbb/avatar/driver/interface.php deleted file mode 100644 index 3d62969aef..0000000000 --- a/phpBB/phpbb/avatar/driver/interface.php +++ /dev/null @@ -1,116 +0,0 @@ - '', 'width' => 0, 'height' => 0] - */ - public function get_data($row); - - /** - * Returns custom html if it is needed for displaying this avatar - * - * @param phpbb_user $user phpBB user object - * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row - * @param string $alt Alternate text for avatar image - * - * @return string HTML - */ - public function get_custom_html($user, $row, $alt = ''); - - /** - * Prepare form for changing the settings of this avatar - * - * @param phpbb_request $request Request object - * @param phpbb_template $template Template object - * @param phpbb_user $user User object - * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row - * @param array &$error Reference to an error array that is filled by this - * function. Key values can either be a string with a language key or - * an array that will be passed to vsprintf() with the language key in - * the first array key. - * - * @return bool True if form has been successfully prepared - */ - public function prepare_form($request, $template, $user, $row, &$error); - - /** - * Prepare form for changing the acp settings of this avatar - * - * @param phpbb_user $user phpBB user object - * - * @return array Array of configuration options as consumed by acp_board. - * The setting for enabling/disabling the avatar will be handled by - * the avatar manager. - */ - public function prepare_form_acp($user); - - /** - * Process form data - * - * @param phpbb_request $request Request object - * @param phpbb_template $template Template object - * @param phpbb_user $user User object - * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row - * @param array &$error Reference to an error array that is filled by this - * function. Key values can either be a string with a language key or - * an array that will be passed to vsprintf() with the language key in - * the first array key. - * - * @return array Array containing the avatar data as follows: - * ['avatar'], ['avatar_width'], ['avatar_height'] - */ - public function process_form($request, $template, $user, $row, &$error); - - /** - * Delete avatar - * - * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row - * - * @return bool True if avatar has been deleted or there is no need to delete, - * i.e. when the avatar is not hosted locally. - */ - public function delete($row); - - /** - * Get the avatar driver's template name - * - * @return string Avatar driver's template name - */ - public function get_template_name(); -} diff --git a/phpBB/phpbb/cache/driver/driver_interface.php b/phpBB/phpbb/cache/driver/driver_interface.php new file mode 100644 index 0000000000..34028b82e2 --- /dev/null +++ b/phpBB/phpbb/cache/driver/driver_interface.php @@ -0,0 +1,144 @@ + array of users and user types that should not receive notifications from this type because they've already been notified - * e.g.: array(2 => array(''), 3 => array('', 'email'), ...) - * - * @return array - */ - public function find_users_for_notification($type_data, $options); - - /** - * Users needed to query before this notification can be displayed - * - * @return array Array of user_ids - */ - public function users_to_query(); - - /** - * Get the special items to load - * - * @return array Data will be combined sent to load_special() so you can run a single query and get data required for this notification type - */ - public function get_load_special(); - - /** - * Load the special items - * - * @param array $data Data from get_load_special() - * @param array $notifications Array of notifications (key is notification_id, value is the notification objects) - */ - public function load_special($data, $notifications); - - /** - * Get the HTML formatted title of this notification - * - * @return string - */ - public function get_title(); - - /** - * Get the url to this item - * - * @return string URL - */ - public function get_url(); - - /** - * URL to unsubscribe to this notification - * - * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item - */ - public function get_unsubscribe_url($method); - - /** - * Get the user's avatar (the user who caused the notification typically) - * - * @return string - */ - public function get_avatar(); - - /** - * Prepare to output the notification to the template - */ - public function prepare_for_display(); - - /** - * Get email template - * - * @return string|bool - */ - public function get_email_template(); - - /** - * Get email template variables - * - * @return array - */ - public function get_email_template_variables(); - - /** - * Pre create insert array function - * This allows you to perform certain actions, like run a query - * and load data, before create_insert_array() is run. The data - * returned from this function will be sent to create_insert_array(). - * - * @param array $type_data The type specific data - * @param array $notify_users Notify users list - * Formated from find_users_for_notification() - * @return array Whatever you want to send to create_insert_array(). - */ - public function pre_create_insert_array($type_data, $notify_users); - - /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $type_data The type specific data - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database - */ - public function create_insert_array($type_data, $pre_create_data); - - /** - * Function for preparing the data for update in an SQL query - * (The service handles insertion) - * - * @param array $type_data Data unique to this notification type - * - * @return array Array of data ready to be updated in the database - */ - public function create_update_array($type_data); - - /** - * Mark this item read - * - * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) - * @return string - */ - public function mark_read($return); - - /** - * Mark this item unread - * - * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) - * @return string - */ - public function mark_unread($return); -} diff --git a/phpBB/phpbb/notification/type/type_interface.php b/phpBB/phpbb/notification/type/type_interface.php new file mode 100644 index 0000000000..f9c65f7286 --- /dev/null +++ b/phpBB/phpbb/notification/type/type_interface.php @@ -0,0 +1,189 @@ + array of users and user types that should not receive notifications from this type because they've already been notified + * e.g.: array(2 => array(''), 3 => array('', 'email'), ...) + * + * @return array + */ + public function find_users_for_notification($type_data, $options); + + /** + * Users needed to query before this notification can be displayed + * + * @return array Array of user_ids + */ + public function users_to_query(); + + /** + * Get the special items to load + * + * @return array Data will be combined sent to load_special() so you can run a single query and get data required for this notification type + */ + public function get_load_special(); + + /** + * Load the special items + * + * @param array $data Data from get_load_special() + * @param array $notifications Array of notifications (key is notification_id, value is the notification objects) + */ + public function load_special($data, $notifications); + + /** + * Get the HTML formatted title of this notification + * + * @return string + */ + public function get_title(); + + /** + * Get the url to this item + * + * @return string URL + */ + public function get_url(); + + /** + * URL to unsubscribe to this notification + * + * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + */ + public function get_unsubscribe_url($method); + + /** + * Get the user's avatar (the user who caused the notification typically) + * + * @return string + */ + public function get_avatar(); + + /** + * Prepare to output the notification to the template + */ + public function prepare_for_display(); + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template(); + + /** + * Get email template variables + * + * @return array + */ + public function get_email_template_variables(); + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $type_data The type specific data + * @param array $notify_users Notify users list + * Formated from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($type_data, $notify_users); + + /** + * Function for preparing the data for insertion in an SQL query + * (The service handles insertion) + * + * @param array $type_data The type specific data + * @param array $pre_create_data Data from pre_create_insert_array() + * + * @return array Array of data ready to be inserted into the database + */ + public function create_insert_array($type_data, $pre_create_data); + + /** + * Function for preparing the data for update in an SQL query + * (The service handles insertion) + * + * @param array $type_data Data unique to this notification type + * + * @return array Array of data ready to be updated in the database + */ + public function create_update_array($type_data); + + /** + * Mark this item read + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string + */ + public function mark_read($return); + + /** + * Mark this item unread + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string + */ + public function mark_unread($return); +} diff --git a/phpBB/phpbb/request/interface.php b/phpBB/phpbb/request/interface.php deleted file mode 100644 index 741db35917..0000000000 --- a/phpBB/phpbb/request/interface.php +++ /dev/null @@ -1,139 +0,0 @@ - "a") - * then specifying array("var", 1) as the name will return "a". - * @param mixed $default A default value that is returned if the variable was not set. - * This function will always return a value of the same type as the default. - * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters - * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global - * Specifies which super global should be used - * - * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the - * the same as that of $default. If the variable is not set $default is returned. - */ - public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST); - - /** - * Shortcut method to retrieve SERVER variables. - * - * @param string|array $var_name See phpbb_request_interface::variable - * @param mixed $default See phpbb_request_interface::variable - * - * @return mixed The server variable value. - */ - public function server($var_name, $default = ''); - - /** - * Shortcut method to retrieve the value of client HTTP headers. - * - * @param string|array $header_name The name of the header to retrieve. - * @param mixed $default See phpbb_request_interface::variable - * - * @return mixed The header value. - */ - public function header($var_name, $default = ''); - - /** - * Checks whether a certain variable was sent via POST. - * To make sure that a request was sent using POST you should call this function - * on at least one variable. - * - * @param string $name The name of the form variable which should have a - * _p suffix to indicate the check in the code that creates the form too. - * - * @return bool True if the variable was set in a POST request, false otherwise. - */ - public function is_set_post($name); - - /** - * Checks whether a certain variable is set in one of the super global - * arrays. - * - * @param string $var Name of the variable - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global - * Specifies the super global which shall be checked - * - * @return bool True if the variable was sent as input - */ - public function is_set($var, $super_global = phpbb_request_interface::REQUEST); - - /** - * Checks whether the current request is an AJAX request (XMLHttpRequest) - * - * @return bool True if the current request is an ajax request - */ - public function is_ajax(); - - /** - * Checks if the current request is happening over HTTPS. - * - * @return bool True if the request is secure. - */ - public function is_secure(); - - /** - * Returns all variable names for a given super global - * - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global - * The super global from which names shall be taken - * - * @return array All variable names that are set for the super global. - * Pay attention when using these, they are unsanitised! - */ - public function variable_names($super_global = phpbb_request_interface::REQUEST); -} diff --git a/phpBB/phpbb/request/request_interface.php b/phpBB/phpbb/request/request_interface.php new file mode 100644 index 0000000000..482f0f1287 --- /dev/null +++ b/phpBB/phpbb/request/request_interface.php @@ -0,0 +1,139 @@ + "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST); + + /** + * Shortcut method to retrieve SERVER variables. + * + * @param string|array $var_name See phpbb_request_interface::variable + * @param mixed $default See phpbb_request_interface::variable + * + * @return mixed The server variable value. + */ + public function server($var_name, $default = ''); + + /** + * Shortcut method to retrieve the value of client HTTP headers. + * + * @param string|array $header_name The name of the header to retrieve. + * @param mixed $default See phpbb_request_interface::variable + * + * @return mixed The header value. + */ + public function header($var_name, $default = ''); + + /** + * Checks whether a certain variable was sent via POST. + * To make sure that a request was sent using POST you should call this function + * on at least one variable. + * + * @param string $name The name of the form variable which should have a + * _p suffix to indicate the check in the code that creates the form too. + * + * @return bool True if the variable was set in a POST request, false otherwise. + */ + public function is_set_post($name); + + /** + * Checks whether a certain variable is set in one of the super global + * arrays. + * + * @param string $var Name of the variable + * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies the super global which shall be checked + * + * @return bool True if the variable was sent as input + */ + public function is_set($var, $super_global = phpbb_request_interface::REQUEST); + + /** + * Checks whether the current request is an AJAX request (XMLHttpRequest) + * + * @return bool True if the current request is an ajax request + */ + public function is_ajax(); + + /** + * Checks if the current request is happening over HTTPS. + * + * @return bool True if the request is secure. + */ + public function is_secure(); + + /** + * Returns all variable names for a given super global + * + * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * The super global from which names shall be taken + * + * @return array All variable names that are set for the super global. + * Pay attention when using these, they are unsanitised! + */ + public function variable_names($super_global = phpbb_request_interface::REQUEST); +} diff --git a/phpBB/phpbb/tree/interface.php b/phpBB/phpbb/tree/interface.php deleted file mode 100644 index cc8aab2115..0000000000 --- a/phpBB/phpbb/tree/interface.php +++ /dev/null @@ -1,122 +0,0 @@ - down, > 0 => up - * @return bool True if the item was moved - */ - public function move($item_id, $delta); - - /** - * Move an item down by 1 - * - * @param int $item_id The item to be moved - * @return bool True if the item was moved - */ - public function move_down($item_id); - - /** - * Move an item up by 1 - * - * @param int $item_id The item to be moved - * @return bool True if the item was moved - */ - public function move_up($item_id); - - /** - * Moves all children of one item to another item - * - * If the new parent already has children, the new children are appended - * to the list. - * - * @param int $current_parent_id The current parent item - * @param int $new_parent_id The new parent item - * @return bool True if any items where moved - */ - public function move_children($current_parent_id, $new_parent_id); - - /** - * Change parent item - * - * Moves the item to the bottom of the new parent's list of children - * - * @param int $item_id The item to be moved - * @param int $new_parent_id The new parent item - * @return bool True if the parent was set successfully - */ - public function change_parent($item_id, $new_parent_id); - - /** - * Get all items that are either ancestors or descendants of the item - * - * @param int $item_id Id of the item to retrieve the ancestors/descendants from - * @param bool $order_asc Order the items ascendingly (most outer ancestor first) - * @param bool $include_item Should the item matching the given item id be included in the list as well - * @return array Array of items (containing all columns from the item table) - * ID => Item data - */ - public function get_path_and_subtree_data($item_id, $order_asc, $include_item); - - /** - * Get all of the item's ancestors - * - * @param int $item_id Id of the item to retrieve the ancestors from - * @param bool $order_asc Order the items ascendingly (most outer ancestor first) - * @param bool $include_item Should the item matching the given item id be included in the list as well - * @return array Array of items (containing all columns from the item table) - * ID => Item data - */ - public function get_path_data($item_id, $order_asc, $include_item); - - /** - * Get all of the item's descendants - * - * @param int $item_id Id of the item to retrieve the descendants from - * @param bool $order_asc Order the items ascendingly - * @param bool $include_item Should the item matching the given item id be included in the list as well - * @return array Array of items (containing all columns from the item table) - * ID => Item data - */ - public function get_subtree_data($item_id, $order_asc, $include_item); -} diff --git a/phpBB/phpbb/tree/tree_interface.php b/phpBB/phpbb/tree/tree_interface.php new file mode 100644 index 0000000000..80d3c4377c --- /dev/null +++ b/phpBB/phpbb/tree/tree_interface.php @@ -0,0 +1,122 @@ + down, > 0 => up + * @return bool True if the item was moved + */ + public function move($item_id, $delta); + + /** + * Move an item down by 1 + * + * @param int $item_id The item to be moved + * @return bool True if the item was moved + */ + public function move_down($item_id); + + /** + * Move an item up by 1 + * + * @param int $item_id The item to be moved + * @return bool True if the item was moved + */ + public function move_up($item_id); + + /** + * Moves all children of one item to another item + * + * If the new parent already has children, the new children are appended + * to the list. + * + * @param int $current_parent_id The current parent item + * @param int $new_parent_id The new parent item + * @return bool True if any items where moved + */ + public function move_children($current_parent_id, $new_parent_id); + + /** + * Change parent item + * + * Moves the item to the bottom of the new parent's list of children + * + * @param int $item_id The item to be moved + * @param int $new_parent_id The new parent item + * @return bool True if the parent was set successfully + */ + public function change_parent($item_id, $new_parent_id); + + /** + * Get all items that are either ancestors or descendants of the item + * + * @param int $item_id Id of the item to retrieve the ancestors/descendants from + * @param bool $order_asc Order the items ascendingly (most outer ancestor first) + * @param bool $include_item Should the item matching the given item id be included in the list as well + * @return array Array of items (containing all columns from the item table) + * ID => Item data + */ + public function get_path_and_subtree_data($item_id, $order_asc, $include_item); + + /** + * Get all of the item's ancestors + * + * @param int $item_id Id of the item to retrieve the ancestors from + * @param bool $order_asc Order the items ascendingly (most outer ancestor first) + * @param bool $include_item Should the item matching the given item id be included in the list as well + * @return array Array of items (containing all columns from the item table) + * ID => Item data + */ + public function get_path_data($item_id, $order_asc, $include_item); + + /** + * Get all of the item's descendants + * + * @param int $item_id Id of the item to retrieve the descendants from + * @param bool $order_asc Order the items ascendingly + * @param bool $include_item Should the item matching the given item id be included in the list as well + * @return array Array of items (containing all columns from the item table) + * ID => Item data + */ + public function get_subtree_data($item_id, $order_asc, $include_item); +} -- cgit v1.2.1 From da2752e4004b296ae5acdd08b7c0a758d8f61e9d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 13:30:52 -0400 Subject: [ticket/11700] Modify all code to use the new interface names PHPBB3-11700 --- phpBB/phpbb/auth/provider/apache.php | 8 ++-- phpBB/phpbb/auth/provider/base.php | 2 +- phpBB/phpbb/avatar/driver/driver.php | 8 ++-- phpBB/phpbb/cache/driver/base.php | 2 +- phpBB/phpbb/cache/service.php | 12 ++--- phpBB/phpbb/class_loader.php | 8 ++-- phpBB/phpbb/config/db.php | 6 +-- phpBB/phpbb/cron/task/core/prune_forum.php | 6 +-- phpBB/phpbb/cron/task/core/tidy_cache.php | 4 +- phpBB/phpbb/cron/task/parametrized.php | 6 +-- phpBB/phpbb/db/migration/tool/config.php | 2 +- phpBB/phpbb/db/migration/tool/module.php | 2 +- phpBB/phpbb/db/migration/tool/permission.php | 2 +- phpBB/phpbb/extension/base.php | 2 +- phpBB/phpbb/extension/finder.php | 4 +- phpBB/phpbb/extension/manager.php | 6 +-- phpBB/phpbb/feed/base.php | 6 +-- phpBB/phpbb/groupposition/legend.php | 2 +- phpBB/phpbb/groupposition/teampage.php | 8 ++-- phpBB/phpbb/hook/finder.php | 4 +- phpBB/phpbb/log/log.php | 2 +- phpBB/phpbb/notification/manager.php | 4 +- phpBB/phpbb/notification/method/base.php | 12 ++--- .../phpbb/notification/method/method_interface.php | 4 +- phpBB/phpbb/notification/type/base.php | 8 ++-- phpBB/phpbb/request/deactivated_super_global.php | 10 ++-- phpBB/phpbb/request/request.php | 56 +++++++++++----------- phpBB/phpbb/request/request_interface.php | 22 ++++----- phpBB/phpbb/session.php | 6 +-- phpBB/phpbb/tree/nestedset.php | 2 +- 30 files changed, 113 insertions(+), 113 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php index 2e80436f78..a7148c634a 100644 --- a/phpBB/phpbb/auth/provider/apache.php +++ b/phpBB/phpbb/auth/provider/apache.php @@ -47,7 +47,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base */ public function init() { - if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) + if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) { return $this->user->lang['APACHE_SETUP_BEFORE_USE']; } @@ -78,7 +78,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base ); } - if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER)) { return array( 'status' => LOGIN_ERROR_EXTERNAL_AUTH, @@ -149,7 +149,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base */ public function autologin() { - if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER)) { return array(); } @@ -241,7 +241,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base public function validate_session($user) { // Check if PHP_AUTH_USER is set and handle this case - if ($this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER)) + if ($this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER)) { $php_auth_user = $this->request->server('PHP_AUTH_USER'); diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php index 7eaf8bb2d3..626ad8478f 100644 --- a/phpBB/phpbb/auth/provider/base.php +++ b/phpBB/phpbb/auth/provider/base.php @@ -20,7 +20,7 @@ if (!defined('IN_PHPBB')) * * @package auth */ -abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface +abstract class phpbb_auth_provider_base implements phpbb_auth_provider_provider_interface { /** * {@inheritdoc} diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index 29c58d4e62..a125759e3f 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) * Base class for avatar drivers * @package phpBB3 */ -abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface +abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interface { /** * Avatar driver name @@ -47,7 +47,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface /** * Cache driver - * @var phpbb_cache_driver_interface + * @var phpbb_cache_driver_driver_interface */ protected $cache; @@ -73,9 +73,9 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface * @param phpbb_request $request Request object * @param string $phpbb_root_path Path to the phpBB root * @param string $php_ext PHP file extension - * @param phpbb_cache_driver_interface $cache Cache driver + * @param phpbb_cache_driver_driver_interface $cache Cache driver */ - public function __construct(phpbb_config $config, $phpbb_root_path, $php_ext, phpbb_cache_driver_interface $cache = null) + public function __construct(phpbb_config $config, $phpbb_root_path, $php_ext, phpbb_cache_driver_driver_interface $cache = null) { $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index 32e04f813a..7ee7e82ad5 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -18,6 +18,6 @@ if (!defined('IN_PHPBB')) /** * @package acm */ -abstract class phpbb_cache_driver_base implements phpbb_cache_driver_interface +abstract class phpbb_cache_driver_base implements phpbb_cache_driver_driver_interface { } diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index 69c5e0fdd0..02dd3d48a9 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -24,7 +24,7 @@ class phpbb_cache_service /** * Cache driver. * - * @var phpbb_cache_driver_interface + * @var phpbb_cache_driver_driver_interface */ protected $driver; @@ -59,13 +59,13 @@ class phpbb_cache_service /** * Creates a cache service around a cache driver * - * @param phpbb_cache_driver_interface $driver The cache driver + * @param phpbb_cache_driver_driver_interface $driver The cache driver * @param phpbb_config $config The config * @param phpbb_db_driver $db Database connection * @param string $phpbb_root_path Root path * @param string $php_ext PHP extension */ - public function __construct(phpbb_cache_driver_interface $driver, phpbb_config $config, phpbb_db_driver $db, $phpbb_root_path, $php_ext) + public function __construct(phpbb_cache_driver_driver_interface $driver, phpbb_config $config, phpbb_db_driver $db, $phpbb_root_path, $php_ext) { $this->set_driver($driver); $this->config = $config; @@ -77,7 +77,7 @@ class phpbb_cache_service /** * Returns the cache driver used by this cache service. * - * @return phpbb_cache_driver_interface The cache driver + * @return phpbb_cache_driver_driver_interface The cache driver */ public function get_driver() { @@ -87,9 +87,9 @@ class phpbb_cache_service /** * Replaces the cache driver used by this cache service. * - * @param phpbb_cache_driver_interface $driver The cache driver + * @param phpbb_cache_driver_driver_interface $driver The cache driver */ - public function set_driver(phpbb_cache_driver_interface $driver) + public function set_driver(phpbb_cache_driver_driver_interface $driver) { $this->driver = $driver; } diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php index 02a2d584dc..78467a044c 100644 --- a/phpBB/phpbb/class_loader.php +++ b/phpBB/phpbb/class_loader.php @@ -50,9 +50,9 @@ class phpbb_class_loader * @param string $prefix Required class name prefix for files to be loaded * @param string $path Directory to load files from * @param string $php_ext The file extension for PHP files - * @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface. + * @param phpbb_cache_driver_driver_interface $cache An implementation of the phpBB cache interface. */ - public function __construct($prefix, $path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null) + public function __construct($prefix, $path, $php_ext = 'php', phpbb_cache_driver_driver_interface $cache = null) { $this->prefix = $prefix; $this->path = $path; @@ -66,9 +66,9 @@ class phpbb_class_loader * the class loader will resolve paths by checking for the existance of every * directory in the class name every time. * - * @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface. + * @param phpbb_cache_driver_driver_interface $cache An implementation of the phpBB cache interface. */ - public function set_cache(phpbb_cache_driver_interface $cache = null) + public function set_cache(phpbb_cache_driver_driver_interface $cache = null) { if ($cache) { diff --git a/phpBB/phpbb/config/db.php b/phpBB/phpbb/config/db.php index b18369a479..25647e1d0b 100644 --- a/phpBB/phpbb/config/db.php +++ b/phpBB/phpbb/config/db.php @@ -23,7 +23,7 @@ class phpbb_config_db extends phpbb_config { /** * Cache instance - * @var phpbb_cache_driver_interface + * @var phpbb_cache_driver_driver_interface */ protected $cache; @@ -43,10 +43,10 @@ class phpbb_config_db extends phpbb_config * Creates a configuration container with a default set of values * * @param phpbb_db_driver $db Database connection - * @param phpbb_cache_driver_interface $cache Cache instance + * @param phpbb_cache_driver_driver_interface $cache Cache instance * @param string $table Configuration table name */ - public function __construct(phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $table) + public function __construct(phpbb_db_driver $db, phpbb_cache_driver_driver_interface $cache, $table) { $this->db = $db; $this->cache = $cache; diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php index e3c497f072..0e4c75c77f 100644 --- a/phpBB/phpbb/cron/task/core/prune_forum.php +++ b/phpBB/phpbb/cron/task/core/prune_forum.php @@ -132,15 +132,15 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p /** * Parses parameters found in $request, which is an instance of - * phpbb_request_interface. + * phpbb_request_request_interface. * * It is expected to have a key f whose value is id of the forum to be pruned. * - * @param phpbb_request_interface $request Request object. + * @param phpbb_request_request_interface $request Request object. * * @return null */ - public function parse_parameters(phpbb_request_interface $request) + public function parse_parameters(phpbb_request_request_interface $request) { $this->forum_data = null; if ($request->is_set('f')) diff --git a/phpBB/phpbb/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php index 16a45dae7c..4618e8200e 100644 --- a/phpBB/phpbb/cron/task/core/tidy_cache.php +++ b/phpBB/phpbb/cron/task/core/tidy_cache.php @@ -29,9 +29,9 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base * Constructor. * * @param phpbb_config $config The config - * @param phpbb_cache_driver_interface $cache The cache driver + * @param phpbb_cache_driver_driver_interface $cache The cache driver */ - public function __construct(phpbb_config $config, phpbb_cache_driver_interface $cache) + public function __construct(phpbb_config $config, phpbb_cache_driver_driver_interface $cache) { $this->config = $config; $this->cache = $cache; diff --git a/phpBB/phpbb/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php index 5f0e46eafc..9a6a55c6bc 100644 --- a/phpBB/phpbb/cron/task/parametrized.php +++ b/phpBB/phpbb/cron/task/parametrized.php @@ -39,14 +39,14 @@ interface phpbb_cron_task_parametrized extends phpbb_cron_task /** * Parses parameters found in $request, which is an instance of - * phpbb_request_interface. + * phpbb_request_request_interface. * * $request contains user input and must not be trusted. * Cron task must validate all data before using it. * - * @param phpbb_request_interface $request Request object. + * @param phpbb_request_request_interface $request Request object. * * @return null */ - public function parse_parameters(phpbb_request_interface $request); + public function parse_parameters(phpbb_request_request_interface $request); } diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 0b626bf455..5dd47cfa60 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -12,7 +12,7 @@ * * @package db */ -class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interface +class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_tool_interface { /** @var phpbb_config */ protected $config; diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index ac4d2c9bd7..8ed2a933ff 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -12,7 +12,7 @@ * * @package db */ -class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interface +class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_interface { /** @var phpbb_cache_service */ protected $cache; diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index 2f09c0ac72..f1140d0759 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -12,7 +12,7 @@ * * @package db */ -class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_interface +class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool_interface { /** @var phpbb_auth */ protected $auth; diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index c4462b64d8..de18998106 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * * @package extension */ -class phpbb_extension_base implements phpbb_extension_interface +class phpbb_extension_base implements phpbb_extension_extension_interface { /** @var ContainerInterface */ protected $container; diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index 155a41cda5..1569c90eb8 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -57,12 +57,12 @@ class phpbb_extension_finder * extensions and their locations * @param phpbb_filesystem $filesystem Filesystem instance * @param string $phpbb_root_path Path to the phpbb root directory - * @param phpbb_cache_driver_interface $cache A cache instance or null + * @param phpbb_cache_driver_driver_interface $cache A cache instance or null * @param string $php_ext php file extension * @param string $cache_name The name of the cache variable, defaults to * _ext_finder */ - public function __construct(phpbb_extension_manager $extension_manager, phpbb_filesystem $filesystem, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') + public function __construct(phpbb_extension_manager $extension_manager, phpbb_filesystem $filesystem, $phpbb_root_path = '', phpbb_cache_driver_driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') { $this->extension_manager = $extension_manager; $this->filesystem = $filesystem; diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 4451049d04..f9f722f773 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -46,10 +46,10 @@ class phpbb_extension_manager * @param string $extension_table The name of the table holding extensions * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $php_ext php file extension - * @param phpbb_cache_driver_interface $cache A cache instance or null + * @param phpbb_cache_driver_driver_interface $cache A cache instance or null * @param string $cache_name The name of the cache variable, defaults to _ext */ - public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext') + public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', phpbb_cache_driver_driver_interface $cache = null, $cache_name = '_ext') { $this->container = $container; $this->phpbb_root_path = $phpbb_root_path; @@ -126,7 +126,7 @@ class phpbb_extension_manager * Instantiates the extension meta class for the extension with the given name * * @param string $name The extension name - * @return phpbb_extension_interface Instance of the extension meta class or + * @return phpbb_extension_extension_interface Instance of the extension meta class or * phpbb_extension_base if the class does not exist */ public function get_extension($name) diff --git a/phpBB/phpbb/feed/base.php b/phpBB/phpbb/feed/base.php index 296d830932..9a38e604a3 100644 --- a/phpBB/phpbb/feed/base.php +++ b/phpBB/phpbb/feed/base.php @@ -34,7 +34,7 @@ abstract class phpbb_feed_base /** @var phpbb_db_driver */ protected $db; - /** @var phpbb_cache_driver_interface */ + /** @var phpbb_cache_driver_driver_interface */ protected $cache; /** @var phpbb_user */ @@ -77,14 +77,14 @@ abstract class phpbb_feed_base * @param phpbb_feed_helper $helper Feed helper * @param phpbb_config $config Config object * @param phpbb_db_driver $db Database connection - * @param phpbb_cache_driver_interface $cache Cache object + * @param phpbb_cache_driver_driver_interface $cache Cache object * @param phpbb_user $user User object * @param phpbb_auth $auth Auth object * @param phpbb_content_visibility $content_visibility Auth object * @param string $phpEx php file extension * @return null */ - function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, phpbb_content_visibility $content_visibility, $phpEx) + function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, phpbb_content_visibility $content_visibility, $phpEx) { $this->config = $config; $this->helper = $helper; diff --git a/phpBB/phpbb/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php index 7fddadde99..5cbc26f528 100644 --- a/phpBB/phpbb/groupposition/legend.php +++ b/phpBB/phpbb/groupposition/legend.php @@ -23,7 +23,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_groupposition_legend implements phpbb_groupposition_interface +class phpbb_groupposition_legend implements phpbb_groupposition_groupposition_interface { /** * Group is not displayed diff --git a/phpBB/phpbb/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php index 7c758199e7..6a0601da63 100644 --- a/phpBB/phpbb/groupposition/teampage.php +++ b/phpBB/phpbb/groupposition/teampage.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_groupposition_teampage implements phpbb_groupposition_interface +class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_interface { /** * Group is not displayed @@ -48,7 +48,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_interface /** * Cache object - * @var phpbb_cache_driver_interface + * @var phpbb_cache_driver_driver_interface */ protected $cache; @@ -57,9 +57,9 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_interface * * @param phpbb_db_driver $db Database object * @param phpbb_user $user User object - * @param phpbb_cache_driver_interface $cache Cache object + * @param phpbb_cache_driver_driver_interface $cache Cache object */ - public function __construct(phpbb_db_driver $db, phpbb_user $user, phpbb_cache_driver_interface $cache) + public function __construct(phpbb_db_driver $db, phpbb_user $user, phpbb_cache_driver_driver_interface $cache) { $this->db = $db; $this->user = $user; diff --git a/phpBB/phpbb/hook/finder.php b/phpBB/phpbb/hook/finder.php index 7b0412f733..3f9758211d 100644 --- a/phpBB/phpbb/hook/finder.php +++ b/phpBB/phpbb/hook/finder.php @@ -31,9 +31,9 @@ class phpbb_hook_finder * * @param string $phpbb_root_path Path to the phpbb root directory * @param string $php_ext php file extension - * @param phpbb_cache_driver_interface $cache A cache instance or null + * @param phpbb_cache_driver_driver_interface $cache A cache instance or null */ - public function __construct($phpbb_root_path, $php_ext, phpbb_cache_driver_interface $cache = null) + public function __construct($phpbb_root_path, $php_ext, phpbb_cache_driver_driver_interface $cache = null) { $this->phpbb_root_path = $phpbb_root_path; $this->cache = $cache; diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 7a26858348..0a755b5c78 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -20,7 +20,7 @@ if (!defined('IN_PHPBB')) * * @package phpbb_log */ -class phpbb_log implements phpbb_log_interface +class phpbb_log implements phpbb_log_log_interface { /** * If set, administrative user profile links will be returned and messages diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 97833710c0..32e0ef50bc 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -525,7 +525,7 @@ class phpbb_notification_manager { $type = $this->get_item_type_class($type_name); - if ($type instanceof phpbb_notification_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 +561,7 @@ class phpbb_notification_manager { $method = $this->get_method_class($method_name); - if ($method instanceof phpbb_notification_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(), diff --git a/phpBB/phpbb/notification/method/base.php b/phpBB/phpbb/notification/method/base.php index b633956d01..fbff75b59f 100644 --- a/phpBB/phpbb/notification/method/base.php +++ b/phpBB/phpbb/notification/method/base.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) * Base notifications method class * @package notifications */ -abstract class phpbb_notification_method_base implements phpbb_notification_method_interface +abstract class phpbb_notification_method_base implements phpbb_notification_method_method_interface { /** @var phpbb_notification_manager */ protected $notification_manager; @@ -30,7 +30,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth /** @var phpbb_db_driver */ protected $db; - /** @var phpbb_cache_driver_interface */ + /** @var phpbb_cache_driver_driver_interface */ protected $cache; /** @var phpbb_template */ @@ -66,7 +66,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth * * @param phpbb_user_loader $user_loader * @param phpbb_db_driver $db - * @param phpbb_cache_driver_interface $cache + * @param phpbb_cache_driver_driver_interface $cache * @param phpbb_user $user * @param phpbb_auth $auth * @param phpbb_config $config @@ -74,7 +74,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth * @param string $php_ext * @return phpbb_notification_method_base */ - public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_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 $db, phpbb_cache_driver_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { $this->user_loader = $user_loader; $this->db = $db; @@ -99,9 +99,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth /** * Add a notification to the queue * - * @param phpbb_notification_type_interface $notification + * @param phpbb_notification_type_type_interface $notification */ - public function add_to_queue(phpbb_notification_type_interface $notification) + public function add_to_queue(phpbb_notification_type_type_interface $notification) { $this->queue[] = $notification; } diff --git a/phpBB/phpbb/notification/method/method_interface.php b/phpBB/phpbb/notification/method/method_interface.php index b3ca757d5f..bd21d924e4 100644 --- a/phpBB/phpbb/notification/method/method_interface.php +++ b/phpBB/phpbb/notification/method/method_interface.php @@ -37,9 +37,9 @@ interface phpbb_notification_method_method_interface /** * Add a notification to the queue * - * @param phpbb_notification_type_interface $notification + * @param phpbb_notification_type_type_interface $notification */ - public function add_to_queue(phpbb_notification_type_interface $notification); + public function add_to_queue(phpbb_notification_type_type_interface $notification); /** * Parse the queue and notify the users diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 46517f1c9b..a7434fc9a7 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) * Base notifications class * @package notifications */ -abstract class phpbb_notification_type_base implements phpbb_notification_type_interface +abstract class phpbb_notification_type_base implements phpbb_notification_type_type_interface { /** @var phpbb_notification_manager */ protected $notification_manager; @@ -30,7 +30,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i /** @var phpbb_db_driver */ protected $db; - /** @var phpbb_cache_driver_interface */ + /** @var phpbb_cache_driver_driver_interface */ protected $cache; /** @var phpbb_template */ @@ -96,7 +96,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i * * @param phpbb_user_loader $user_loader * @param phpbb_db_driver $db - * @param phpbb_cache_driver_interface $cache + * @param phpbb_cache_driver_driver_interface $cache * @param phpbb_user $user * @param phpbb_auth $auth * @param phpbb_config $config @@ -107,7 +107,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i * @param string $user_notifications_table * @return phpbb_notification_type_base */ - public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_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 $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) { $this->user_loader = $user_loader; $this->db = $db; diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php index cc05847ec7..9ca0f462b4 100644 --- a/phpBB/phpbb/request/deactivated_super_global.php +++ b/phpBB/phpbb/request/deactivated_super_global.php @@ -29,23 +29,23 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable, private $name; /** - * @var phpbb_request_interface::POST|GET|REQUEST|COOKIE Super global constant. + * @var phpbb_request_request_interface::POST|GET|REQUEST|COOKIE Super global constant. */ private $super_global; /** - * @var phpbb_request_interface The request class instance holding the actual request data. + * @var phpbb_request_request_interface The request class instance holding the actual request data. */ private $request; /** * Constructor generates an error message fitting the super global to be used within the other functions. * - * @param phpbb_request_interface $request A request class instance holding the real super global data. + * @param phpbb_request_request_interface $request A request class instance holding the real super global data. * @param string $name Name of the super global this is a replacement for - e.g. '_GET'. - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global The variable's super global constant. + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global The variable's super global constant. */ - public function __construct(phpbb_request_interface $request, $name, $super_global) + public function __construct(phpbb_request_request_interface $request, $name, $super_global) { $this->request = $request; $this->name = $name; diff --git a/phpBB/phpbb/request/request.php b/phpBB/phpbb/request/request.php index ae3c526d89..8c5bc12d96 100644 --- a/phpBB/phpbb/request/request.php +++ b/phpBB/phpbb/request/request.php @@ -23,18 +23,18 @@ if (!defined('IN_PHPBB')) * * @package phpbb_request */ -class phpbb_request implements phpbb_request_interface +class phpbb_request implements phpbb_request_request_interface { /** * @var array The names of super global variables that this class should protect if super globals are disabled. */ protected $super_globals = array( - phpbb_request_interface::POST => '_POST', - phpbb_request_interface::GET => '_GET', - phpbb_request_interface::REQUEST => '_REQUEST', - phpbb_request_interface::COOKIE => '_COOKIE', - phpbb_request_interface::SERVER => '_SERVER', - phpbb_request_interface::FILES => '_FILES', + phpbb_request_request_interface::POST => '_POST', + phpbb_request_request_interface::GET => '_GET', + phpbb_request_request_interface::REQUEST => '_REQUEST', + phpbb_request_request_interface::COOKIE => '_COOKIE', + phpbb_request_request_interface::SERVER => '_SERVER', + phpbb_request_request_interface::FILES => '_FILES', ); /** @@ -78,8 +78,8 @@ class phpbb_request implements phpbb_request_interface } // simulate request_order = GP - $this->original_request = $this->input[phpbb_request_interface::REQUEST]; - $this->input[phpbb_request_interface::REQUEST] = $this->input[phpbb_request_interface::POST] + $this->input[phpbb_request_interface::GET]; + $this->original_request = $this->input[phpbb_request_request_interface::REQUEST]; + $this->input[phpbb_request_request_interface::REQUEST] = $this->input[phpbb_request_request_interface::POST] + $this->input[phpbb_request_request_interface::GET]; if ($disable_super_globals) { @@ -144,10 +144,10 @@ class phpbb_request implements phpbb_request_interface * @param string $var_name The name of the variable that shall be overwritten * @param mixed $value The value which the variable shall contain. * If this is null the variable will be unset. - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global shall be changed */ - public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST) + public function overwrite($var_name, $value, $super_global = phpbb_request_request_interface::REQUEST) { if (!isset($this->super_globals[$super_global])) { @@ -193,13 +193,13 @@ class phpbb_request implements phpbb_request_interface * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global should be used * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST) + public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST) { return $this->_variable($var_name, $default, $multibyte, $super_global, true); } @@ -217,13 +217,13 @@ class phpbb_request implements phpbb_request_interface * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global should be used * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - public function untrimmed_variable($var_name, $default, $multibyte, $super_global = phpbb_request_interface::REQUEST) + public function untrimmed_variable($var_name, $default, $multibyte, $super_global = phpbb_request_request_interface::REQUEST) { return $this->_variable($var_name, $default, $multibyte, $super_global, false); } @@ -234,8 +234,8 @@ class phpbb_request implements phpbb_request_interface * Also fall back to getenv(), some CGI setups may need it (probably not, but * whatever). * - * @param string|array $var_name See phpbb_request_interface::variable - * @param mixed $Default See phpbb_request_interface::variable + * @param string|array $var_name See phpbb_request_request_interface::variable + * @param mixed $Default See phpbb_request_request_interface::variable * * @return mixed The server variable value. */ @@ -243,9 +243,9 @@ class phpbb_request implements phpbb_request_interface { $multibyte = true; - if ($this->is_set($var_name, phpbb_request_interface::SERVER)) + if ($this->is_set($var_name, phpbb_request_request_interface::SERVER)) { - return $this->variable($var_name, $default, $multibyte, phpbb_request_interface::SERVER); + return $this->variable($var_name, $default, $multibyte, phpbb_request_request_interface::SERVER); } else { @@ -259,7 +259,7 @@ class phpbb_request implements phpbb_request_interface * Shortcut method to retrieve the value of client HTTP headers. * * @param string|array $header_name The name of the header to retrieve. - * @param mixed $default See phpbb_request_interface::variable + * @param mixed $default See phpbb_request_request_interface::variable * * @return mixed The header value. */ @@ -279,7 +279,7 @@ class phpbb_request implements phpbb_request_interface */ public function file($form_name) { - return $this->variable($form_name, array('name' => 'none'), false, phpbb_request_interface::FILES); + return $this->variable($form_name, array('name' => 'none'), false, phpbb_request_request_interface::FILES); } /** @@ -294,7 +294,7 @@ class phpbb_request implements phpbb_request_interface */ public function is_set_post($name) { - return $this->is_set($name, phpbb_request_interface::POST); + return $this->is_set($name, phpbb_request_request_interface::POST); } /** @@ -302,12 +302,12 @@ class phpbb_request implements phpbb_request_interface * arrays. * * @param string $var Name of the variable - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies the super global which shall be checked * * @return bool True if the variable was sent as input */ - public function is_set($var, $super_global = phpbb_request_interface::REQUEST) + public function is_set($var, $super_global = phpbb_request_request_interface::REQUEST) { return isset($this->input[$super_global][$var]); } @@ -335,13 +335,13 @@ class phpbb_request implements phpbb_request_interface /** * Returns all variable names for a given super global * - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * The super global from which names shall be taken * * @return array All variable names that are set for the super global. * Pay attention when using these, they are unsanitised! */ - public function variable_names($super_global = phpbb_request_interface::REQUEST) + public function variable_names($super_global = phpbb_request_request_interface::REQUEST) { if (!isset($this->input[$super_global])) { @@ -362,14 +362,14 @@ class phpbb_request implements phpbb_request_interface * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global should be used * @param bool $trim Indicates whether trim() should be applied to string values. * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - protected function _variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST, $trim = true) + protected function _variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST, $trim = true) { $path = false; diff --git a/phpBB/phpbb/request/request_interface.php b/phpBB/phpbb/request/request_interface.php index 482f0f1287..2c804cd7fd 100644 --- a/phpBB/phpbb/request/request_interface.php +++ b/phpBB/phpbb/request/request_interface.php @@ -43,10 +43,10 @@ interface phpbb_request_request_interface * @param string $var_name The name of the variable that shall be overwritten * @param mixed $value The value which the variable shall contain. * If this is null the variable will be unset. - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global shall be changed */ - public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST); + public function overwrite($var_name, $value, $super_global = phpbb_request_request_interface::REQUEST); /** * Central type safe input handling function. @@ -60,19 +60,19 @@ interface phpbb_request_request_interface * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global should be used * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST); + public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST); /** * Shortcut method to retrieve SERVER variables. * - * @param string|array $var_name See phpbb_request_interface::variable - * @param mixed $default See phpbb_request_interface::variable + * @param string|array $var_name See phpbb_request_request_interface::variable + * @param mixed $default See phpbb_request_request_interface::variable * * @return mixed The server variable value. */ @@ -82,7 +82,7 @@ interface phpbb_request_request_interface * Shortcut method to retrieve the value of client HTTP headers. * * @param string|array $header_name The name of the header to retrieve. - * @param mixed $default See phpbb_request_interface::variable + * @param mixed $default See phpbb_request_request_interface::variable * * @return mixed The header value. */ @@ -105,12 +105,12 @@ interface phpbb_request_request_interface * arrays. * * @param string $var Name of the variable - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies the super global which shall be checked * * @return bool True if the variable was sent as input */ - public function is_set($var, $super_global = phpbb_request_interface::REQUEST); + public function is_set($var, $super_global = phpbb_request_request_interface::REQUEST); /** * Checks whether the current request is an AJAX request (XMLHttpRequest) @@ -129,11 +129,11 @@ interface phpbb_request_request_interface /** * Returns all variable names for a given super global * - * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global * The super global from which names shall be taken * * @return array All variable names that are set for the super global. * Pay attention when using these, they are unsanitised! */ - public function variable_names($super_global = phpbb_request_interface::REQUEST); + public function variable_names($super_global = phpbb_request_request_interface::REQUEST); } diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index e0585b1523..3bff91e275 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -243,7 +243,7 @@ class phpbb_session $this->forwarded_for = ''; } - if ($request->is_set($config['cookie_name'] . '_sid', phpbb_request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', phpbb_request_interface::COOKIE)) + if ($request->is_set($config['cookie_name'] . '_sid', phpbb_request_request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', phpbb_request_request_interface::COOKIE)) { $this->cookie_data['u'] = request_var($config['cookie_name'] . '_u', 0, false, true); $this->cookie_data['k'] = request_var($config['cookie_name'] . '_k', '', false, true); @@ -405,9 +405,9 @@ class phpbb_session $provider = $phpbb_container->get('auth.provider.' . $method); - if (!($provider instanceof phpbb_auth_provider_interface)) + if (!($provider instanceof phpbb_auth_provider_provider_interface)) { - throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface'); + throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_provider_interface'); } $ret = $provider->validate_session($this->data); diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php index 4d851a87a8..79853eeaa1 100644 --- a/phpBB/phpbb/tree/nestedset.php +++ b/phpBB/phpbb/tree/nestedset.php @@ -15,7 +15,7 @@ if (!defined('IN_PHPBB')) exit; } -abstract class phpbb_tree_nestedset implements phpbb_tree_interface +abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface { /** @var phpbb_db_driver */ protected $db; -- cgit v1.2.1 From d4d3d311b926cf3d0df4b3c6ccc4731a0345ca18 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 13:54:56 -0400 Subject: [ticket/11700] Implement namespace loading in the class loader PHPBB3-11700 --- phpBB/phpbb/class_loader.php | 49 ++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php index 78467a044c..bcd05e5853 100644 --- a/phpBB/phpbb/class_loader.php +++ b/phpBB/phpbb/class_loader.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -28,9 +30,9 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_class_loader +class class_loader { - private $prefix; + private $namespace; private $path; private $php_ext; private $cache; @@ -44,17 +46,17 @@ class phpbb_class_loader private $cached_paths = array(); /** - * Creates a new phpbb_class_loader, which loads files with the given + * Creates a new \phpbb\class_loader, which loads files with the given * file extension from the given path. * - * @param string $prefix Required class name prefix for files to be loaded + * @param string $namespace Required namespace for files to be loaded * @param string $path Directory to load files from * @param string $php_ext The file extension for PHP files - * @param phpbb_cache_driver_driver_interface $cache An implementation of the phpBB cache interface. + * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface. */ - public function __construct($prefix, $path, $php_ext = 'php', phpbb_cache_driver_driver_interface $cache = null) + public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null) { - $this->prefix = $prefix; + $this->namespace = $namespace; $this->path = $path; $this->php_ext = $php_ext; @@ -66,13 +68,13 @@ class phpbb_class_loader * the class loader will resolve paths by checking for the existance of every * directory in the class name every time. * - * @param phpbb_cache_driver_driver_interface $cache An implementation of the phpBB cache interface. + * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface. */ - public function set_cache(phpbb_cache_driver_driver_interface $cache = null) + public function set_cache(\phpbb\cache\driver\driver_interface $cache = null) { if ($cache) { - $this->cached_paths = $cache->get('class_loader_' . $this->prefix); + $this->cached_paths = $cache->get('class_loader_' . str_replace('\\', '__', $this->namespace)); if ($this->cached_paths === false) { @@ -102,8 +104,8 @@ class phpbb_class_loader /** * Resolves a phpBB class name to a relative path which can be included. * - * @param string $class The class name to resolve, must have a phpbb_ - * prefix + * @param string $class The class name to resolve, must be in the + * namespace the loader was constructed with * @return string|bool A relative path to the file containing the * class or false if looking it up failed. */ @@ -114,27 +116,12 @@ class phpbb_class_loader return $this->path . $this->cached_paths[$class] . '.' . $this->php_ext; } - if (!preg_match('/^' . $this->prefix . '[a-zA-Z0-9_]+$/', $class)) + if (!preg_match('/^' . preg_quote($this->namespace, '/') . '[a-zA-Z0-9_\\\\]+$/', $class)) { return false; } - $parts = explode('_', substr($class, strlen($this->prefix))); - - $dirs = ''; - - for ($i = 0, $n = sizeof($parts); $i < $n && is_dir($this->path . $dirs . $parts[$i]); $i++) - { - $dirs .= $parts[$i] . '/'; - } - - // no file name left => use last dir name as file name - if ($i == sizeof($parts)) - { - $parts[] = $parts[$i - 1]; - } - - $relative_path = $dirs . implode(array_slice($parts, $i, sizeof($parts) - $i), '_'); + $relative_path = str_replace('\\', '/', substr($class, strlen($this->namespace))); if (!file_exists($this->path . $relative_path . '.' . $this->php_ext)) { @@ -144,7 +131,7 @@ class phpbb_class_loader if ($this->cache) { $this->cached_paths[$class] = $relative_path; - $this->cache->put('class_loader_' . $this->prefix, $this->cached_paths); + $this->cache->put('class_loader_' . str_replace('\\', '__', $this->namespace), $this->cached_paths); } return $this->path . $relative_path . '.' . $this->php_ext; @@ -157,7 +144,7 @@ class phpbb_class_loader */ public function load_class($class) { - if (substr($class, 0, strlen($this->prefix)) === $this->prefix) + if (substr($class, 0, strlen($this->namespace)) === $this->namespace) { $path = $this->resolve_path($class); -- cgit v1.2.1 From 62b33968c2ef7c5bf264f8af2a39eac2183148f7 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 15:38:04 -0400 Subject: [ticket/11700] include and define are not valid class names PHPBB3-11700 --- phpBB/phpbb/template/twig/extension.php | 4 +- phpBB/phpbb/template/twig/node/define.php | 58 ------------------- phpBB/phpbb/template/twig/node/definenode.php | 58 +++++++++++++++++++ phpBB/phpbb/template/twig/node/include.php | 56 ------------------ phpBB/phpbb/template/twig/node/includenode.php | 56 ++++++++++++++++++ phpBB/phpbb/template/twig/tokenparser/define.php | 66 ---------------------- .../template/twig/tokenparser/defineparser.php | 66 ++++++++++++++++++++++ phpBB/phpbb/template/twig/tokenparser/include.php | 46 --------------- .../template/twig/tokenparser/includeparser.php | 46 +++++++++++++++ 9 files changed, 228 insertions(+), 228 deletions(-) delete mode 100644 phpBB/phpbb/template/twig/node/define.php create mode 100644 phpBB/phpbb/template/twig/node/definenode.php delete mode 100644 phpBB/phpbb/template/twig/node/include.php create mode 100644 phpBB/phpbb/template/twig/node/includenode.php delete mode 100644 phpBB/phpbb/template/twig/tokenparser/define.php create mode 100644 phpBB/phpbb/template/twig/tokenparser/defineparser.php delete mode 100644 phpBB/phpbb/template/twig/tokenparser/include.php create mode 100644 phpBB/phpbb/template/twig/tokenparser/includeparser.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index c279726434..2adee07c8c 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -54,8 +54,8 @@ class phpbb_template_twig_extension extends Twig_Extension public function getTokenParsers() { return array( - new phpbb_template_twig_tokenparser_define, - new phpbb_template_twig_tokenparser_include, + new phpbb_template_twig_tokenparser_defineparser, + new phpbb_template_twig_tokenparser_includeparser, new phpbb_template_twig_tokenparser_includejs, new phpbb_template_twig_tokenparser_includecss, new phpbb_template_twig_tokenparser_event, diff --git a/phpBB/phpbb/template/twig/node/define.php b/phpBB/phpbb/template/twig/node/define.php deleted file mode 100644 index fcb19cc773..0000000000 --- a/phpBB/phpbb/template/twig/node/define.php +++ /dev/null @@ -1,58 +0,0 @@ - $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); - } - - /** - * Compiles the node to PHP. - * - * @param Twig_Compiler A Twig_Compiler instance - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if ($this->getAttribute('capture')) { - $compiler - ->write("ob_start();\n") - ->subcompile($this->getNode('value')) - ; - - $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new Twig_Markup(\$value, \$this->env->getCharset());\n"); - } - else - { - $compiler - ->write("\$value = ") - ->subcompile($this->getNode('value')) - ->raw(";\n") - ; - } - - $compiler - ->write("\$context['definition']->set('") - ->raw($this->getNode('name')->getAttribute('name')) - ->raw("', \$value);\n") - ; - } -} diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php new file mode 100644 index 0000000000..247b908337 --- /dev/null +++ b/phpBB/phpbb/template/twig/node/definenode.php @@ -0,0 +1,58 @@ + $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if ($this->getAttribute('capture')) { + $compiler + ->write("ob_start();\n") + ->subcompile($this->getNode('value')) + ; + + $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new Twig_Markup(\$value, \$this->env->getCharset());\n"); + } + else + { + $compiler + ->write("\$value = ") + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + + $compiler + ->write("\$context['definition']->set('") + ->raw($this->getNode('name')->getAttribute('name')) + ->raw("', \$value);\n") + ; + } +} diff --git a/phpBB/phpbb/template/twig/node/include.php b/phpBB/phpbb/template/twig/node/include.php deleted file mode 100644 index 5c6ae1bbcf..0000000000 --- a/phpBB/phpbb/template/twig/node/include.php +++ /dev/null @@ -1,56 +0,0 @@ -addDebugInfo($this); - - $compiler - ->write("\$location = ") - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ->write("\$namespace = false;\n") - ->write("if (strpos(\$location, '@') === 0) {\n") - ->indent() - ->write("\$namespace = substr(\$location, 1, strpos(\$location, '/') - 1);\n") - ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") - - // We set the namespace lookup order to be this namespace first, then the main path - ->write("\$this->env->setNamespaceLookUpOrder(array(\$namespace, '__main__'));\n") - ->outdent() - ->write("}\n") - ; - - parent::compile($compiler); - - $compiler - ->write("if (\$namespace) {\n") - ->indent() - ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") - ->outdent() - ->write("}\n") - ; - } -} diff --git a/phpBB/phpbb/template/twig/node/includenode.php b/phpBB/phpbb/template/twig/node/includenode.php new file mode 100644 index 0000000000..c5d1c6be51 --- /dev/null +++ b/phpBB/phpbb/template/twig/node/includenode.php @@ -0,0 +1,56 @@ +addDebugInfo($this); + + $compiler + ->write("\$location = ") + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ->write("\$namespace = false;\n") + ->write("if (strpos(\$location, '@') === 0) {\n") + ->indent() + ->write("\$namespace = substr(\$location, 1, strpos(\$location, '/') - 1);\n") + ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n") + + // We set the namespace lookup order to be this namespace first, then the main path + ->write("\$this->env->setNamespaceLookUpOrder(array(\$namespace, '__main__'));\n") + ->outdent() + ->write("}\n") + ; + + parent::compile($compiler); + + $compiler + ->write("if (\$namespace) {\n") + ->indent() + ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n") + ->outdent() + ->write("}\n") + ; + } +} diff --git a/phpBB/phpbb/template/twig/tokenparser/define.php b/phpBB/phpbb/template/twig/tokenparser/define.php deleted file mode 100644 index 4ea15388c4..0000000000 --- a/phpBB/phpbb/template/twig/tokenparser/define.php +++ /dev/null @@ -1,66 +0,0 @@ -getLine(); - $stream = $this->parser->getStream(); - $name = $this->parser->getExpressionParser()->parseExpression(); - - $capture = false; - if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) { - $stream->next(); - $value = $this->parser->getExpressionParser()->parseExpression(); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } else { - $capture = true; - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } - - return new phpbb_template_twig_node_define($capture, $name, $value, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('ENDDEFINE'); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'DEFINE'; - } -} diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php new file mode 100644 index 0000000000..db023c67bf --- /dev/null +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -0,0 +1,66 @@ +getLine(); + $stream = $this->parser->getStream(); + $name = $this->parser->getExpressionParser()->parseExpression(); + + $capture = false; + if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) { + $stream->next(); + $value = $this->parser->getExpressionParser()->parseExpression(); + + $stream->expect(Twig_Token::BLOCK_END_TYPE); + } else { + $capture = true; + + $stream->expect(Twig_Token::BLOCK_END_TYPE); + + $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + } + + return new phpbb_template_twig_node_definenode($capture, $name, $value, $lineno, $this->getTag()); + } + + public function decideBlockEnd(Twig_Token $token) + { + return $token->test('ENDDEFINE'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'DEFINE'; + } +} diff --git a/phpBB/phpbb/template/twig/tokenparser/include.php b/phpBB/phpbb/template/twig/tokenparser/include.php deleted file mode 100644 index 520f9fd1a0..0000000000 --- a/phpBB/phpbb/template/twig/tokenparser/include.php +++ /dev/null @@ -1,46 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - return new phpbb_template_twig_node_include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'INCLUDE'; - } -} diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php new file mode 100644 index 0000000000..79c53630d0 --- /dev/null +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -0,0 +1,46 @@ +parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + return new phpbb_template_twig_node_includenode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDE'; + } +} -- cgit v1.2.1 From adc58ba0848a23555044dd76d0b03b9055c81f40 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 16:28:30 -0400 Subject: [ticket/11700] Use a new style constructor for the error collector PHPBB3-11700 --- phpBB/phpbb/error_collector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 358da747b8..0a6462d046 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -19,7 +19,7 @@ class phpbb_error_collector { var $errors; - function phpbb_error_collector() + function __construct() { $this->errors = array(); } -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- phpBB/phpbb/auth/auth.php | 8 ++- phpBB/phpbb/auth/provider/apache.php | 26 ++++---- phpBB/phpbb/auth/provider/base.php | 4 +- phpBB/phpbb/auth/provider/db.php | 20 +++--- phpBB/phpbb/auth/provider/ldap.php | 12 ++-- phpBB/phpbb/auth/provider/provider_interface.php | 10 +-- phpBB/phpbb/avatar/driver/driver.php | 16 +++-- phpBB/phpbb/avatar/driver/driver_interface.php | 30 +++++---- phpBB/phpbb/avatar/driver/gravatar.php | 4 +- phpBB/phpbb/avatar/driver/local.php | 8 ++- phpBB/phpbb/avatar/driver/remote.php | 8 ++- phpBB/phpbb/avatar/driver/upload.php | 6 +- phpBB/phpbb/avatar/manager.php | 16 +++-- phpBB/phpbb/cache/driver/apc.php | 4 +- phpBB/phpbb/cache/driver/base.php | 4 +- phpBB/phpbb/cache/driver/driver_interface.php | 12 ++-- phpBB/phpbb/cache/driver/eaccelerator.php | 4 +- phpBB/phpbb/cache/driver/file.php | 8 ++- phpBB/phpbb/cache/driver/memcache.php | 6 +- phpBB/phpbb/cache/driver/memory.php | 6 +- phpBB/phpbb/cache/driver/null.php | 6 +- phpBB/phpbb/cache/driver/redis.php | 10 +-- phpBB/phpbb/cache/driver/wincache.php | 4 +- phpBB/phpbb/cache/driver/xcache.php | 4 +- phpBB/phpbb/cache/service.php | 24 +++---- phpBB/phpbb/config/config.php | 8 ++- phpBB/phpbb/config/db.php | 16 +++-- phpBB/phpbb/config/db_text.php | 12 ++-- phpBB/phpbb/content_visibility.php | 18 +++--- phpBB/phpbb/controller/exception.php | 4 +- phpBB/phpbb/controller/helper.php | 16 +++-- phpBB/phpbb/controller/provider.php | 6 +- phpBB/phpbb/controller/resolver.php | 30 +++++---- phpBB/phpbb/cron/manager.php | 24 +++---- phpBB/phpbb/cron/task/base.php | 4 +- phpBB/phpbb/cron/task/core/prune_all_forums.php | 10 +-- phpBB/phpbb/cron/task/core/prune_forum.php | 16 +++-- phpBB/phpbb/cron/task/core/queue.php | 10 +-- phpBB/phpbb/cron/task/core/tidy_cache.php | 10 +-- phpBB/phpbb/cron/task/core/tidy_database.php | 8 ++- phpBB/phpbb/cron/task/core/tidy_search.php | 14 ++-- phpBB/phpbb/cron/task/core/tidy_sessions.php | 10 +-- phpBB/phpbb/cron/task/core/tidy_warnings.php | 8 ++- phpBB/phpbb/cron/task/parametrized.php | 10 +-- phpBB/phpbb/cron/task/task.php | 4 +- phpBB/phpbb/cron/task/wrapper.php | 10 +-- phpBB/phpbb/datetime.php | 8 ++- phpBB/phpbb/db/driver/driver.php | 8 ++- phpBB/phpbb/db/driver/firebird.php | 4 +- phpBB/phpbb/db/driver/mssql.php | 4 +- phpBB/phpbb/db/driver/mssql_base.php | 4 +- phpBB/phpbb/db/driver/mssql_odbc.php | 4 +- phpBB/phpbb/db/driver/mssqlnative.php | 6 +- phpBB/phpbb/db/driver/mysql.php | 4 +- phpBB/phpbb/db/driver/mysql_base.php | 4 +- phpBB/phpbb/db/driver/mysqli.php | 4 +- phpBB/phpbb/db/driver/oracle.php | 4 +- phpBB/phpbb/db/driver/postgres.php | 8 ++- phpBB/phpbb/db/driver/sqlite.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_10.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_11.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_3.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_4.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php | 6 +- phpBB/phpbb/db/migration/data/30x/3_0_5.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php | 4 +- .../phpbb/db/migration/data/30x/3_0_5_rc1part2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_6.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php | 14 ++-- phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php | 6 +- phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_7.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_8.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_9.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php | 4 +- phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php | 4 +- .../db/migration/data/30x/local_url_bbcode.php | 6 +- phpBB/phpbb/db/migration/data/310/avatars.php | 4 +- phpBB/phpbb/db/migration/data/310/boardindex.php | 4 +- .../phpbb/db/migration/data/310/config_db_text.php | 4 +- phpBB/phpbb/db/migration/data/310/dev.php | 16 +++-- phpBB/phpbb/db/migration/data/310/extensions.php | 4 +- .../db/migration/data/310/forgot_password.php | 4 +- .../phpbb/db/migration/data/310/jquery_update.php | 6 +- .../data/310/notification_options_reconvert.php | 16 +++-- .../phpbb/db/migration/data/310/notifications.php | 6 +- .../data/310/notifications_schema_fix.php | 6 +- .../migration/data/310/reported_posts_display.php | 4 +- .../migration/data/310/signature_module_auth.php | 4 +- .../phpbb/db/migration/data/310/softdelete_p1.php | 6 +- .../phpbb/db/migration/data/310/softdelete_p2.php | 8 ++- .../db/migration/data/310/style_update_p1.php | 6 +- .../db/migration/data/310/style_update_p2.php | 6 +- phpBB/phpbb/db/migration/data/310/teampage.php | 6 +- phpBB/phpbb/db/migration/data/310/timezone.php | 8 ++- phpBB/phpbb/db/migration/data/310/timezone_p2.php | 6 +- phpBB/phpbb/db/migration/exception.php | 12 ++-- phpBB/phpbb/db/migration/migration.php | 18 +++--- phpBB/phpbb/db/migration/tool/config.php | 16 +++-- phpBB/phpbb/db/migration/tool/module.php | 36 ++++++----- phpBB/phpbb/db/migration/tool/permission.php | 32 +++++----- phpBB/phpbb/db/migration/tool/tool_interface.php | 4 +- phpBB/phpbb/db/migrator.php | 40 ++++++------ phpBB/phpbb/db/sql_insert_buffer.php | 12 ++-- phpBB/phpbb/db/tools.php | 26 ++++---- phpBB/phpbb/di/extension/config.php | 4 +- phpBB/phpbb/di/extension/core.php | 4 +- phpBB/phpbb/di/extension/ext.php | 4 +- phpBB/phpbb/di/pass/collection_pass.php | 4 +- phpBB/phpbb/di/pass/kernel_pass.php | 12 ++-- phpBB/phpbb/di/service_collection.php | 4 +- phpBB/phpbb/error_collector.php | 4 +- phpBB/phpbb/event/data.php | 4 +- phpBB/phpbb/event/dispatcher.php | 6 +- phpBB/phpbb/event/extension_subscriber_loader.php | 6 +- phpBB/phpbb/event/kernel_exception_subscriber.php | 18 +++--- phpBB/phpbb/event/kernel_request_subscriber.php | 16 +++-- phpBB/phpbb/event/kernel_terminate_subscriber.php | 6 +- phpBB/phpbb/extension/base.php | 12 ++-- phpBB/phpbb/extension/exception.php | 4 +- phpBB/phpbb/extension/extension_interface.php | 4 +- phpBB/phpbb/extension/finder.php | 36 ++++++----- phpBB/phpbb/extension/manager.php | 38 +++++------ phpBB/phpbb/extension/metadata_manager.php | 34 +++++----- phpBB/phpbb/extension/provider.php | 12 ++-- phpBB/phpbb/feed/base.php | 32 +++++----- phpBB/phpbb/feed/factory.php | 14 ++-- phpBB/phpbb/feed/forum.php | 6 +- phpBB/phpbb/feed/forums.php | 4 +- phpBB/phpbb/feed/helper.php | 14 ++-- phpBB/phpbb/feed/news.php | 4 +- phpBB/phpbb/feed/overall.php | 4 +- phpBB/phpbb/feed/post_base.php | 4 +- phpBB/phpbb/feed/topic.php | 6 +- phpBB/phpbb/feed/topic_base.php | 4 +- phpBB/phpbb/feed/topics.php | 4 +- phpBB/phpbb/feed/topics_active.php | 4 +- phpBB/phpbb/filesystem.php | 4 +- phpBB/phpbb/groupposition/exception.php | 4 +- .../groupposition/groupposition_interface.php | 4 +- phpBB/phpbb/groupposition/legend.php | 16 +++-- phpBB/phpbb/groupposition/teampage.php | 32 +++++----- phpBB/phpbb/hook/finder.php | 10 +-- phpBB/phpbb/json_response.php | 4 +- phpBB/phpbb/lock/db.php | 12 ++-- phpBB/phpbb/lock/flock.php | 4 +- phpBB/phpbb/log/log.php | 22 ++++--- phpBB/phpbb/log/log_interface.php | 8 ++- phpBB/phpbb/notification/exception.php | 4 +- phpBB/phpbb/notification/manager.php | 34 +++++----- phpBB/phpbb/notification/method/base.php | 46 +++++++------- phpBB/phpbb/notification/method/email.php | 4 +- phpBB/phpbb/notification/method/jabber.php | 4 +- phpBB/phpbb/notification/method/messenger_base.php | 6 +- .../phpbb/notification/method/method_interface.php | 8 ++- phpBB/phpbb/notification/type/approve_post.php | 4 +- phpBB/phpbb/notification/type/approve_topic.php | 4 +- phpBB/phpbb/notification/type/base.php | 46 +++++++------- phpBB/phpbb/notification/type/bookmark.php | 6 +- phpBB/phpbb/notification/type/disapprove_post.php | 4 +- phpBB/phpbb/notification/type/disapprove_topic.php | 4 +- phpBB/phpbb/notification/type/pm.php | 4 +- phpBB/phpbb/notification/type/post.php | 6 +- phpBB/phpbb/notification/type/post_in_queue.php | 4 +- phpBB/phpbb/notification/type/quote.php | 8 ++- phpBB/phpbb/notification/type/report_pm.php | 4 +- phpBB/phpbb/notification/type/report_pm_closed.php | 4 +- phpBB/phpbb/notification/type/report_post.php | 4 +- .../phpbb/notification/type/report_post_closed.php | 4 +- phpBB/phpbb/notification/type/topic.php | 6 +- phpBB/phpbb/notification/type/topic_in_queue.php | 4 +- phpBB/phpbb/notification/type/type_interface.php | 4 +- phpBB/phpbb/php/ini.php | 4 +- phpBB/phpbb/request/deactivated_super_global.php | 24 +++---- phpBB/phpbb/request/request.php | 74 +++++++++++----------- phpBB/phpbb/request/request_interface.php | 30 +++++---- phpBB/phpbb/request/type_cast_helper.php | 8 ++- phpBB/phpbb/request/type_cast_helper_interface.php | 8 ++- phpBB/phpbb/search/base.php | 8 ++- phpBB/phpbb/search/fulltext_mysql.php | 16 +++-- phpBB/phpbb/search/fulltext_native.php | 22 ++++--- phpBB/phpbb/search/fulltext_postgres.php | 16 +++-- phpBB/phpbb/search/fulltext_sphinx.php | 26 ++++---- phpBB/phpbb/search/sphinx/config.php | 34 +++++----- phpBB/phpbb/search/sphinx/config_comment.php | 8 ++- phpBB/phpbb/search/sphinx/config_section.php | 26 ++++---- phpBB/phpbb/search/sphinx/config_variable.php | 8 ++- phpBB/phpbb/session.php | 26 ++++---- phpBB/phpbb/style/extension_path_provider.php | 12 ++-- phpBB/phpbb/style/path_provider.php | 6 +- phpBB/phpbb/style/path_provider_interface.php | 4 +- phpBB/phpbb/style/resource_locator.php | 4 +- phpBB/phpbb/style/style.php | 22 ++++--- phpBB/phpbb/template/asset.php | 4 +- phpBB/phpbb/template/context.php | 12 ++-- phpBB/phpbb/template/locator.php | 4 +- phpBB/phpbb/template/template.php | 28 ++++---- phpBB/phpbb/template/twig/definition.php | 8 ++- phpBB/phpbb/template/twig/environment.php | 14 ++-- phpBB/phpbb/template/twig/extension.php | 68 ++++++++++---------- phpBB/phpbb/template/twig/lexer.php | 4 +- phpBB/phpbb/template/twig/node/definenode.php | 10 +-- phpBB/phpbb/template/twig/node/event.php | 10 +-- .../twig/node/expression/binary/equalequal.php | 6 +- .../twig/node/expression/binary/notequalequal.php | 6 +- phpBB/phpbb/template/twig/node/includeasset.php | 10 +-- phpBB/phpbb/template/twig/node/includecss.php | 6 +- phpBB/phpbb/template/twig/node/includejs.php | 6 +- phpBB/phpbb/template/twig/node/includenode.php | 6 +- phpBB/phpbb/template/twig/node/includephp.php | 10 +-- phpBB/phpbb/template/twig/node/php.php | 8 ++- .../template/twig/tokenparser/defineparser.php | 18 +++--- phpBB/phpbb/template/twig/tokenparser/event.php | 10 +-- .../phpbb/template/twig/tokenparser/includecss.php | 10 +-- .../phpbb/template/twig/tokenparser/includejs.php | 10 +-- .../template/twig/tokenparser/includeparser.php | 8 ++- .../phpbb/template/twig/tokenparser/includephp.php | 14 ++-- phpBB/phpbb/template/twig/tokenparser/php.php | 14 ++-- phpBB/phpbb/template/twig/twig.php | 60 +++++++++--------- phpBB/phpbb/tree/nestedset.php | 38 +++++------ phpBB/phpbb/tree/nestedset_forum.php | 10 +-- phpBB/phpbb/tree/tree_interface.php | 8 ++- phpBB/phpbb/user.php | 28 ++++---- phpBB/phpbb/user_loader.php | 10 +-- 243 files changed, 1533 insertions(+), 1047 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index 279959974d..804e1ce44b 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Permission/Auth class * @package phpBB3 */ -class phpbb_auth +class auth { var $acl = array(); var $cache = array(); @@ -92,7 +94,7 @@ class phpbb_auth } } - // If a bitstring within the list does not match the options, we have a user with incorrect permissions set and need to renew them + // If a bitstring within the list does not match the options, we have a user with incorrect permissions set and need to renew \them if ($renew) { $this->acl_cache($userdata); @@ -993,7 +995,7 @@ class phpbb_auth // Successful session creation if ($result === true) { - // If admin re-authentication we remove the old session entry because a new one has been created... + // If admin re-authentication we remove the old session entry because a new \one has been created... if ($admin) { // the login array is used because the user ids do not differ for re-authentication diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php index a7148c634a..cd1330e7b0 100644 --- a/phpBB/phpbb/auth/provider/apache.php +++ b/phpBB/phpbb/auth/provider/apache.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider; + /** * @ignore */ @@ -20,19 +22,19 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_apache extends phpbb_auth_provider_base +class apache extends \phpbb\auth\provider\base { /** * Apache Authentication Constructor * - * @param phpbb_db_driver $db - * @param phpbb_config $config - * @param phpbb_request $request - * @param phpbb_user $user + * @param \phpbb\db\driver\driver $db + * @param \phpbb\config\config $config + * @param \phpbb\request\request $request + * @param \phpbb\user $user * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -47,7 +49,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base */ public function init() { - if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) + if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) { return $this->user->lang['APACHE_SETUP_BEFORE_USE']; } @@ -78,7 +80,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base ); } - if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER)) + if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER)) { return array( 'status' => LOGIN_ERROR_EXTERNAL_AUTH, @@ -149,7 +151,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base */ public function autologin() { - if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER)) + if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER)) { return array(); } @@ -202,8 +204,8 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base * This function generates an array which can be passed to the user_add * function in order to create a user * - * @param string $username The username of the new user. - * @param string $password The password of the new user. + * @param string $username The username of the new \user. + * @param string $password The password of the new \user. * @return array Contains data that can be passed directly to * the user_add function. */ @@ -241,7 +243,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base public function validate_session($user) { // Check if PHP_AUTH_USER is set and handle this case - if ($this->request->is_set('PHP_AUTH_USER', phpbb_request_request_interface::SERVER)) + if ($this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER)) { $php_auth_user = $this->request->server('PHP_AUTH_USER'); diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php index 626ad8478f..f0a2a2f68c 100644 --- a/phpBB/phpbb/auth/provider/base.php +++ b/phpBB/phpbb/auth/provider/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package auth */ -abstract class phpbb_auth_provider_base implements phpbb_auth_provider_provider_interface +abstract class base implements \phpbb\auth\provider\provider_interface { /** * {@inheritdoc} diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index 0934c56d9b..f613bafc6a 100644 --- a/phpBB/phpbb/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider; + /** * @ignore */ @@ -22,20 +24,20 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_db extends phpbb_auth_provider_base +class db extends \phpbb\auth\provider\base { /** * Database Authentication Constructor * - * @param phpbb_db_driver $db - * @param phpbb_config $config - * @param phpbb_request $request - * @param phpbb_user $user + * @param \phpbb\db\driver\driver $db + * @param \phpbb\config\config $config + * @param \phpbb\request\request $request + * @param \phpbb\user $user * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -149,7 +151,7 @@ class phpbb_auth_provider_db extends phpbb_auth_provider_base include ($this->phpbb_root_path . 'includes/captcha/captcha_factory.' . $this->php_ext); } - $captcha = phpbb_captcha_factory::get_instance($this->config['captcha_plugin']); + $captcha = \phpbb_captcha_factory::get_instance($this->config['captcha_plugin']); $captcha->init(CONFIRM_LOGIN); $vc_response = $captcha->validate($row); if ($vc_response) @@ -202,7 +204,7 @@ class phpbb_auth_provider_db extends phpbb_auth_provider_base { $hash = phpbb_hash($password_new_format); - // Update the password in the users table to the new format and remove user_pass_convert flag + // Update the password in the users table to the new \format and remove user_pass_convert flag $sql = 'UPDATE ' . USERS_TABLE . ' SET user_password = \'' . $this->db->sql_escape($hash) . '\', user_pass_convert = 0 @@ -239,7 +241,7 @@ class phpbb_auth_provider_db extends phpbb_auth_provider_base { $hash = phpbb_hash($password); - // Update the password in the users table to the new format + // Update the password in the users table to the new \format $sql = 'UPDATE ' . USERS_TABLE . " SET user_password = '" . $this->db->sql_escape($hash) . "', user_pass_convert = 0 diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php index 0196529408..9d29789567 100644 --- a/phpBB/phpbb/auth/provider/ldap.php +++ b/phpBB/phpbb/auth/provider/ldap.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider; + /** * @ignore */ @@ -22,16 +24,16 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_ldap extends phpbb_auth_provider_base +class ldap extends \phpbb\auth\provider\base { /** * LDAP Authentication Constructor * - * @param phpbb_db_driver $db - * @param phpbb_config $config - * @param phpbb_user $user + * @param \phpbb\db\driver\driver $db + * @param \phpbb\config\config $config + * @param \phpbb\user $user */ - public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_user $user) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\user $user) { $this->db = $db; $this->config = $config; diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php index baf55c7a86..8df2043375 100644 --- a/phpBB/phpbb/auth/provider/provider_interface.php +++ b/phpBB/phpbb/auth/provider/provider_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package auth */ -interface phpbb_auth_provider_provider_interface +interface provider_interface { /** * Checks whether the user is currently identified to the authentication @@ -70,7 +72,7 @@ interface phpbb_auth_provider_provider_interface * options with whatever configuraton values are passed to it as an array. * It then returns the name of the acp file related to this authentication * provider. - * @param array $new_config Contains the new configuration values that + * @param array $new_config Contains the new \configuration values that * have been set in acp_board. * @return array|null Returns null if not implemented or an array with * the template file name and an array of the vars @@ -87,8 +89,8 @@ interface phpbb_auth_provider_provider_interface * Performs additional actions during logout. * * @param array $data An array corresponding to - * phpbb_session::data - * @param boolean $new_session True for a new session, false for no new + * \phpbb\session::data + * @param boolean $new_session True for a new \session, false for no new * session. */ public function logout($data, $new_session); diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index a125759e3f..d688e7d70c 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Base class for avatar drivers * @package phpBB3 */ -abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interface +abstract class driver implements \phpbb\avatar\driver\driver_interface { /** * Avatar driver name @@ -29,7 +31,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interfa /** * Current board configuration - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; @@ -47,7 +49,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interfa /** * Cache driver - * @var phpbb_cache_driver_driver_interface + * @var \phpbb\cache\driver\driver_interface */ protected $cache; @@ -69,13 +71,13 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interfa /** * Construct a driver object * - * @param phpbb_config $config phpBB configuration - * @param phpbb_request $request Request object + * @param \phpbb\config\config $config phpBB configuration + * @param \phpbb\request\request $request Request object * @param string $phpbb_root_path Path to the phpBB root * @param string $php_ext PHP file extension - * @param phpbb_cache_driver_driver_interface $cache Cache driver + * @param \phpbb\cache\driver\driver_interface $cache Cache driver */ - public function __construct(phpbb_config $config, $phpbb_root_path, $php_ext, phpbb_cache_driver_driver_interface $cache = null) + public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null) { $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/phpbb/avatar/driver/driver_interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php index 0a44a7a1fe..d9540c19db 100644 --- a/phpBB/phpbb/avatar/driver/driver_interface.php +++ b/phpBB/phpbb/avatar/driver/driver_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Interface for avatar drivers * @package phpBB3 */ -interface phpbb_avatar_driver_driver_interface +interface driver_interface { /** * Returns the name of the driver. @@ -32,7 +34,7 @@ interface phpbb_avatar_driver_driver_interface * Get the avatar url and dimensions * * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row + * \phpbb\avatar\manager::clean_row * @return array Avatar data, must have keys src, width and height, e.g. * ['src' => '', 'width' => 0, 'height' => 0] */ @@ -41,9 +43,9 @@ interface phpbb_avatar_driver_driver_interface /** * Returns custom html if it is needed for displaying this avatar * - * @param phpbb_user $user phpBB user object + * @param \phpbb\user $user phpBB user object * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row + * \phpbb\avatar\manager::clean_row * @param string $alt Alternate text for avatar image * * @return string HTML @@ -53,11 +55,11 @@ interface phpbb_avatar_driver_driver_interface /** * Prepare form for changing the settings of this avatar * - * @param phpbb_request $request Request object - * @param phpbb_template $template Template object - * @param phpbb_user $user User object + * @param \phpbb\request\request $request Request object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row + * \phpbb\avatar\manager::clean_row * @param array &$error Reference to an error array that is filled by this * function. Key values can either be a string with a language key or * an array that will be passed to vsprintf() with the language key in @@ -70,7 +72,7 @@ interface phpbb_avatar_driver_driver_interface /** * Prepare form for changing the acp settings of this avatar * - * @param phpbb_user $user phpBB user object + * @param \phpbb\user $user phpBB user object * * @return array Array of configuration options as consumed by acp_board. * The setting for enabling/disabling the avatar will be handled by @@ -81,11 +83,11 @@ interface phpbb_avatar_driver_driver_interface /** * Process form data * - * @param phpbb_request $request Request object - * @param phpbb_template $template Template object - * @param phpbb_user $user User object + * @param \phpbb\request\request $request Request object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row + * \phpbb\avatar\manager::clean_row * @param array &$error Reference to an error array that is filled by this * function. Key values can either be a string with a language key or * an array that will be passed to vsprintf() with the language key in @@ -100,7 +102,7 @@ interface phpbb_avatar_driver_driver_interface * Delete avatar * * @param array $row User data or group data that has been cleaned with - * phpbb_avatar_manager::clean_row + * \phpbb\avatar\manager::clean_row * * @return bool True if avatar has been deleted or there is no need to delete, * i.e. when the avatar is not hosted locally. diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php index d559da1c0d..3ad783932e 100644 --- a/phpBB/phpbb/avatar/driver/gravatar.php +++ b/phpBB/phpbb/avatar/driver/gravatar.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Handles avatars hosted at gravatar.com * @package phpBB3 */ -class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver +class gravatar extends \phpbb\avatar\driver\driver { /** * The URL for the gravatar service diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index f4bcd4ce74..d779099c46 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Handles avatars selected from the board gallery * @package phpBB3 */ -class phpbb_avatar_driver_local extends phpbb_avatar_driver +class local extends \phpbb\avatar\driver\driver { /** * @inheritdoc @@ -144,7 +146,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver * Get a list of avatars that are locally available * Results get cached for 24 hours (86400 seconds) * - * @param phpbb_user $user User object + * @param \phpbb\user $user User object * * @return array Array containing the locally available avatars */ @@ -157,7 +159,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver $avatar_list = array(); $path = $this->phpbb_root_path . $this->config['avatar_gallery_path']; - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS), RecursiveIteratorIterator::SELF_FIRST); + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS), \RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file_info) { $file_path = $file_info->getPath(); diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php index 7da58107a1..1e29fb5735 100644 --- a/phpBB/phpbb/avatar/driver/remote.php +++ b/phpBB/phpbb/avatar/driver/remote.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Handles avatars hosted remotely * @package phpBB3 */ -class phpbb_avatar_driver_remote extends phpbb_avatar_driver +class remote extends \phpbb\avatar\driver\driver { /** * @inheritdoc @@ -120,8 +122,8 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext); } - $types = fileupload::image_types(); - $extension = strtolower(filespec::get_extension($url)); + $types = \fileupload::image_types(); + $extension = strtolower(\filespec::get_extension($url)); if (!empty($image_data) && (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]]))) { diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 685ac4f349..377c9a0b04 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Handles avatars uploaded to the board * @package phpBB3 */ -class phpbb_avatar_driver_upload extends phpbb_avatar_driver +class upload extends \phpbb\avatar\driver\driver { /** * @inheritdoc @@ -66,7 +68,7 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext); } - $upload = new fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false)); + $upload = new \fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false)); $url = $request->variable('avatar_upload_url', ''); $upload_file = $request->file('avatar_upload_file'); diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 58d994c3c0..717ba00ed7 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar; + /** * @ignore */ @@ -18,11 +20,11 @@ if (!defined('IN_PHPBB')) /** * @package avatar */ -class phpbb_avatar_manager +class manager { /** * phpBB configuration - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; @@ -59,11 +61,11 @@ class phpbb_avatar_manager /** * Construct an avatar manager object * - * @param phpbb_config $config phpBB configuration + * @param \phpbb\config\config $config phpBB configuration * @param array $avatar_drivers Avatar drivers passed via the service container * @param object $container Container object */ - public function __construct(phpbb_config $config, $avatar_drivers, $container) + public function __construct(\phpbb\config\config $config, $avatar_drivers, $container) { $this->config = $config; $this->avatar_drivers = $avatar_drivers; @@ -194,7 +196,7 @@ class phpbb_avatar_manager $keys = array_keys($row); $values = array_values($row); - $keys = array_map(array('phpbb_avatar_manager', 'strip_prefix'), $keys); + $keys = array_map(array('\phpbb\avatar\manager', 'strip_prefix'), $keys); return array_combine($keys, $values); } @@ -281,7 +283,7 @@ class phpbb_avatar_manager /** * Replace "error" strings with their real, localized form * - * @param phpbb_user phpBB User object + * @param \phpbb\user phpBB User object * @param array $error Array containing error strings * Key values can either be a string with a language key or an array * that will be passed to vsprintf() with the language key in the @@ -289,7 +291,7 @@ class phpbb_avatar_manager * * @return array Array containing the localized error strings */ - public function localize_errors(phpbb_user $user, $error) + public function localize_errors(\phpbb\user $user, $error) { foreach ($error as $key => $lang) { diff --git a/phpBB/phpbb/cache/driver/apc.php b/phpBB/phpbb/cache/driver/apc.php index 0516b669c8..ce72ec6134 100644 --- a/phpBB/phpbb/cache/driver/apc.php +++ b/phpBB/phpbb/cache/driver/apc.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * ACM for APC * @package acm */ -class phpbb_cache_driver_apc extends phpbb_cache_driver_memory +class apc extends \phpbb\cache\driver\memory { var $extension = 'apc'; diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index 7ee7e82ad5..90185a00d2 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -18,6 +20,6 @@ if (!defined('IN_PHPBB')) /** * @package acm */ -abstract class phpbb_cache_driver_base implements phpbb_cache_driver_driver_interface +abstract class base implements \phpbb\cache\driver\driver_interface { } diff --git a/phpBB/phpbb/cache/driver/driver_interface.php b/phpBB/phpbb/cache/driver/driver_interface.php index 34028b82e2..34c60b5935 100644 --- a/phpBB/phpbb/cache/driver/driver_interface.php +++ b/phpBB/phpbb/cache/driver/driver_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package acm */ -interface phpbb_cache_driver_driver_interface +interface driver_interface { /** * Load global cache @@ -85,10 +87,10 @@ interface phpbb_cache_driver_driver_interface * result to persistent storage. In other words, there is no need * to call save() afterwards. * - * @param phpbb_db_driver $db Database connection + * @param \phpbb\db\driver\driver $db Database connection * @param string $query SQL query, should be used for generating storage key - * @param mixed $query_result The result from dbal::sql_query, to be passed to - * dbal::sql_fetchrow to get all rows and store them + * @param mixed $query_result The result from \dbal::sql_query, to be passed to + * \dbal::sql_fetchrow to get all rows and store them * in cache. * @param int $ttl Time to live, after this timeout the query should * expire from the cache. @@ -96,7 +98,7 @@ interface phpbb_cache_driver_driver_interface * representing the query should be returned. Otherwise * the original $query_result should be returned. */ - public function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl); + public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl); /** * Check if result for a given SQL query exists in cache. diff --git a/phpBB/phpbb/cache/driver/eaccelerator.php b/phpBB/phpbb/cache/driver/eaccelerator.php index 257b90c76e..72c0d77d02 100644 --- a/phpBB/phpbb/cache/driver/eaccelerator.php +++ b/phpBB/phpbb/cache/driver/eaccelerator.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * @package acm * @todo Missing locks from destroy() talk with David */ -class phpbb_cache_driver_eaccelerator extends phpbb_cache_driver_memory +class eaccelerator extends \phpbb\cache\driver\memory { var $extension = 'eaccelerator'; var $function = 'eaccelerator_get'; diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 85decbe3e8..6e88499577 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * ACM File Based Caching * @package acm */ -class phpbb_cache_driver_file extends phpbb_cache_driver_base +class file extends \phpbb\cache\driver\base { var $vars = array(); var $var_expires = array(); @@ -369,7 +371,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base /** * {@inheritDoc} */ - function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl) + function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); @@ -651,7 +653,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base $file = "{$this->cache_dir}$filename.$phpEx"; - $lock = new phpbb_lock_flock($file); + $lock = new \phpbb\lock\flock($file); $lock->acquire(); if ($handle = @fopen($file, 'wb')) diff --git a/phpBB/phpbb/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php index 3fd16b23b0..84fe68ae49 100644 --- a/phpBB/phpbb/cache/driver/memcache.php +++ b/phpBB/phpbb/cache/driver/memcache.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -40,7 +42,7 @@ if (!defined('PHPBB_ACM_MEMCACHE')) * ACM for Memcached * @package acm */ -class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory +class memcache extends \phpbb\cache\driver\memory { var $extension = 'memcache'; @@ -52,7 +54,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory // Call the parent constructor parent::__construct(); - $this->memcache = new Memcache; + $this->memcache = new \Memcache; foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u) { $parts = explode('/', $u); diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index f77a1df316..5a9861913f 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * ACM Abstract Memory Class * @package acm */ -abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base +abstract class memory extends \phpbb\cache\driver\base { var $key_prefix; @@ -285,7 +287,7 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base /** * {@inheritDoc} */ - function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl) + function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); diff --git a/phpBB/phpbb/cache/driver/null.php b/phpBB/phpbb/cache/driver/null.php index 2fadc27ba3..c03319ad61 100644 --- a/phpBB/phpbb/cache/driver/null.php +++ b/phpBB/phpbb/cache/driver/null.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * ACM Null Caching * @package acm */ -class phpbb_cache_driver_null extends phpbb_cache_driver_base +class null extends \phpbb\cache\driver\base { /** * Set cache path @@ -107,7 +109,7 @@ class phpbb_cache_driver_null extends phpbb_cache_driver_base /** * {@inheritDoc} */ - function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl) + function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl) { return $query_result; } diff --git a/phpBB/phpbb/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php index 960735b673..317d07428a 100644 --- a/phpBB/phpbb/cache/driver/redis.php +++ b/phpBB/phpbb/cache/driver/redis.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -33,7 +35,7 @@ if (!defined('PHPBB_ACM_REDIS_HOST')) * * @package acm */ -class phpbb_cache_driver_redis extends phpbb_cache_driver_memory +class redis extends \phpbb\cache\driver\memory { var $extension = 'redis'; @@ -56,7 +58,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory // Call the parent constructor parent::__construct(); - $this->redis = new Redis(); + $this->redis = new \Redis(); $args = func_get_args(); if (!empty($args)) @@ -83,8 +85,8 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory } } - $this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); - $this->redis->setOption(Redis::OPT_PREFIX, $this->key_prefix); + $this->redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP); + $this->redis->setOption(\Redis::OPT_PREFIX, $this->key_prefix); if (defined('PHPBB_ACM_REDIS_DB')) { diff --git a/phpBB/phpbb/cache/driver/wincache.php b/phpBB/phpbb/cache/driver/wincache.php index 58f3b4a581..a0b24e4a1f 100644 --- a/phpBB/phpbb/cache/driver/wincache.php +++ b/phpBB/phpbb/cache/driver/wincache.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * ACM for WinCache * @package acm */ -class phpbb_cache_driver_wincache extends phpbb_cache_driver_memory +class wincache extends \phpbb\cache\driver\memory { var $extension = 'wincache'; diff --git a/phpBB/phpbb/cache/driver/xcache.php b/phpBB/phpbb/cache/driver/xcache.php index 06c5fafd97..fdcbf7e4b5 100644 --- a/phpBB/phpbb/cache/driver/xcache.php +++ b/phpBB/phpbb/cache/driver/xcache.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache\driver; + /** * @ignore */ @@ -24,7 +26,7 @@ if (!defined('IN_PHPBB')) * - xcache.admin.enable_auth = off (or xcache.admin.user and xcache.admin.password set) * */ -class phpbb_cache_driver_xcache extends phpbb_cache_driver_memory +class xcache extends \phpbb\cache\driver\memory { var $extension = 'XCache'; diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index 02dd3d48a9..da8f4eb8d8 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cache; + /** * @ignore */ @@ -19,26 +21,26 @@ if (!defined('IN_PHPBB')) * Class for grabbing/handling cached entries * @package acm */ -class phpbb_cache_service +class service { /** * Cache driver. * - * @var phpbb_cache_driver_driver_interface + * @var \phpbb\cache\driver\driver_interface */ protected $driver; /** * The config. * - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * Database connection. * - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; @@ -59,13 +61,13 @@ class phpbb_cache_service /** * Creates a cache service around a cache driver * - * @param phpbb_cache_driver_driver_interface $driver The cache driver - * @param phpbb_config $config The config - * @param phpbb_db_driver $db Database connection + * @param \phpbb\cache\driver\driver_interface $driver The cache driver + * @param \phpbb\config\config $config The config + * @param \phpbb\db\driver\driver $db Database connection * @param string $phpbb_root_path Root path * @param string $php_ext PHP extension */ - public function __construct(phpbb_cache_driver_driver_interface $driver, phpbb_config $config, phpbb_db_driver $db, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext) { $this->set_driver($driver); $this->config = $config; @@ -77,7 +79,7 @@ class phpbb_cache_service /** * Returns the cache driver used by this cache service. * - * @return phpbb_cache_driver_driver_interface The cache driver + * @return \phpbb\cache\driver\driver_interface The cache driver */ public function get_driver() { @@ -87,9 +89,9 @@ class phpbb_cache_service /** * Replaces the cache driver used by this cache service. * - * @param phpbb_cache_driver_driver_interface $driver The cache driver + * @param \phpbb\cache\driver\driver_interface $driver The cache driver */ - public function set_driver(phpbb_cache_driver_driver_interface $driver) + public function set_driver(\phpbb\cache\driver\driver_interface $driver) { $this->driver = $driver; } diff --git a/phpBB/phpbb/config/config.php b/phpBB/phpbb/config/config.php index 4b533dd55c..dc865df707 100644 --- a/phpBB/phpbb/config/config.php +++ b/phpBB/phpbb/config/config.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\config; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Configuration container class * @package phpBB3 */ -class phpbb_config implements ArrayAccess, IteratorAggregate, Countable +class config implements \ArrayAccess, \IteratorAggregate, \Countable { /** * The configuration data @@ -44,7 +46,7 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable */ public function getIterator() { - return new ArrayIterator($this->config); + return new \ArrayIterator($this->config); } /** @@ -90,7 +92,7 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable */ public function offsetUnset($key) { - trigger_error('Config values have to be deleted explicitly with the phpbb_config::delete($key) method.', E_USER_ERROR); + trigger_error('Config values have to be deleted explicitly with the \phpbb\config\config::delete($key) method.', E_USER_ERROR); } /** diff --git a/phpBB/phpbb/config/db.php b/phpBB/phpbb/config/db.php index 25647e1d0b..7174327ef3 100644 --- a/phpBB/phpbb/config/db.php +++ b/phpBB/phpbb/config/db.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\config; + /** * @ignore */ @@ -19,17 +21,17 @@ if (!defined('IN_PHPBB')) * Configuration container class * @package phpBB3 */ -class phpbb_config_db extends phpbb_config +class db extends \phpbb\config\config { /** * Cache instance - * @var phpbb_cache_driver_driver_interface + * @var \phpbb\cache\driver\driver_interface */ protected $cache; /** * Database connection - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; @@ -42,11 +44,11 @@ class phpbb_config_db extends phpbb_config /** * Creates a configuration container with a default set of values * - * @param phpbb_db_driver $db Database connection - * @param phpbb_cache_driver_driver_interface $cache Cache instance + * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\cache\driver\driver_interface $cache Cache instance * @param string $table Configuration table name */ - public function __construct(phpbb_db_driver $db, phpbb_cache_driver_driver_interface $cache, $table) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $table) { $this->db = $db; $this->cache = $cache; @@ -176,7 +178,7 @@ class phpbb_config_db extends phpbb_config /** * Increments an integer config value directly in the database. * - * Using this method instead of setting the new value directly avoids race + * Using this method instead of setting the new \value directly avoids race * conditions and unlike set_atomic it cannot fail. * * @param string $key The configuration option's name diff --git a/phpBB/phpbb/config/db_text.php b/phpBB/phpbb/config/db_text.php index b365cb5c77..3ee3351e19 100644 --- a/phpBB/phpbb/config/db_text.php +++ b/phpBB/phpbb/config/db_text.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\config; + /** * @ignore */ @@ -17,16 +19,16 @@ if (!defined('IN_PHPBB')) /** * Manages configuration options with an arbitrary length value stored in a TEXT -* column. In constrast to class phpbb_config_db, values are never cached and +* column. In constrast to class \phpbb\config\db, values are never cached and * prefetched, but every get operation sends a query to the database. * * @package phpBB3 */ -class phpbb_config_db_text +class db_text { /** * Database connection - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; @@ -37,10 +39,10 @@ class phpbb_config_db_text protected $table; /** - * @param phpbb_db_driver $db Database connection + * @param \phpbb\db\driver\driver $db Database connection * @param string $table Table name */ - public function __construct(phpbb_db_driver $db, $table) + public function __construct(\phpbb\db\driver\driver $db, $table) { $this->db = $db; $this->table = $this->db->sql_escape($table); diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 4ad5f6793e..097a886430 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -20,23 +22,23 @@ if (!defined('IN_PHPBB')) * Handle fetching and setting the visibility for topics and posts * @package phpbb */ -class phpbb_content_visibility +class content_visibility { /** * Database object - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; /** * Auth object - * @var phpbb_auth + * @var \phpbb\auth\auth */ protected $auth; @@ -55,14 +57,14 @@ class phpbb_content_visibility /** * Constructor * - * @param phpbb_auth $auth Auth object - * @param phpbb_db_driver $db Database object - * @param phpbb_user $user User object + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\user $user User object * @param string $phpbb_root_path Root path * @param string $php_ext PHP Extension * @return null */ - public function __construct(phpbb_auth $auth, phpbb_db_driver $db, phpbb_user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) + public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) { $this->auth = $auth; $this->db = $db; diff --git a/phpBB/phpbb/controller/exception.php b/phpBB/phpbb/controller/exception.php index faa8b6b584..e8694b8bcf 100644 --- a/phpBB/phpbb/controller/exception.php +++ b/phpBB/phpbb/controller/exception.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\controller; + /** * @ignore */ @@ -19,6 +21,6 @@ if (!defined('IN_PHPBB')) * Controller exception class * @package phpBB3 */ -class phpbb_controller_exception extends RuntimeException +class exception extends \RuntimeException { } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 74410ddfd1..f1cc29f21b 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\controller; + /** * @ignore */ @@ -21,17 +23,17 @@ use Symfony\Component\HttpFoundation\Response; * Controller helper class, contains methods that do things for controllers * @package phpBB3 */ -class phpbb_controller_helper +class helper { /** * Template object - * @var phpbb_template + * @var \phpbb\template\template */ protected $template; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -50,12 +52,12 @@ class phpbb_controller_helper /** * Constructor * - * @param phpbb_template $template Template object - * @param phpbb_user $user User object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object * @param string $phpbb_root_path phpBB root path * @param string $php_ext PHP extension */ - public function __construct(phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, $phpbb_root_path, $php_ext) { $this->template = $template; $this->user = $user; @@ -81,7 +83,7 @@ class phpbb_controller_helper page_footer(true, false, false); - return new Response($this->template->assign_display('body'), $status_code); + return new \Response($this->template->assign_display('body'), $status_code); } /** diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php index b2a5b9f6b2..3aad08e3aa 100644 --- a/phpBB/phpbb/controller/provider.php +++ b/phpBB/phpbb/controller/provider.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\controller; + /** * @ignore */ @@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator; * Controller interface * @package phpBB3 */ -class phpbb_controller_provider +class provider { /** * YAML file(s) containing route information @@ -48,7 +50,7 @@ class phpbb_controller_provider * * @return The current instance of this object for method chaining */ - public function import_paths_from_finder(phpbb_extension_finder $finder) + public function import_paths_from_finder(\phpbb\extension\finder $finder) { // We hardcode the path to the core config directory // because the finder cannot find it diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 95dfc8da8e..5c1f5e836e 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\controller; + /** * @ignore */ @@ -23,11 +25,11 @@ use Symfony\Component\HttpFoundation\Request; * Controller manager class * @package phpBB3 */ -class phpbb_controller_resolver implements ControllerResolverInterface +class resolver implements ControllerResolverInterface { /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -38,19 +40,19 @@ class phpbb_controller_resolver implements ControllerResolverInterface protected $container; /** - * phpbb_style object - * @var phpbb_style + * \phpbb\style\style object + * @var \phpbb\style\style */ protected $style; /** * Construct method * - * @param phpbb_user $user User Object + * @param \phpbb\user $user User Object * @param ContainerInterface $container ContainerInterface object - * @param phpbb_style $style + * @param \phpbb\style\style $style */ - public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null) + public function __construct(\phpbb\user $user, ContainerInterface $container, \phpbb\style\style $style = null) { $this->user = $user; $this->container = $container; @@ -62,7 +64,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface * * @param Symfony\Component\HttpFoundation\Request $request Symfony Request object * @return bool|Callable Callable or false - * @throws phpbb_controller_exception + * @throws \phpbb\controller\exception */ public function getController(Request $request) { @@ -70,20 +72,20 @@ class phpbb_controller_resolver implements ControllerResolverInterface if (!$controller) { - throw new phpbb_controller_exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']); + throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']); } // Require a method name along with the service name if (stripos($controller, ':') === false) { - throw new phpbb_controller_exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']); + throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']); } list($service, $method) = explode(':', $controller); if (!$this->container->has($service)) { - throw new phpbb_controller_exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service)); + throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service)); } $controller_object = $this->container->get($service); @@ -118,13 +120,13 @@ class phpbb_controller_resolver implements ControllerResolverInterface * @param Symfony\Component\HttpFoundation\Request $request Symfony Request object * @param mixed $controller A callable (controller class, method) * @return bool False - * @throws phpbb_controller_exception + * @throws \phpbb\controller\exception */ public function getArguments(Request $request, $controller) { // At this point, $controller contains the object and method name list($object, $method) = $controller; - $mirror = new ReflectionMethod($object, $method); + $mirror = new \ReflectionMethod($object, $method); $arguments = array(); $parameters = $mirror->getParameters(); @@ -145,7 +147,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface } else { - throw new phpbb_controller_exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name)); + throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name)); } } diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php index 84c9650830..f58ba64a3d 100644 --- a/phpBB/phpbb/cron/manager.php +++ b/phpBB/phpbb/cron/manager.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron; + /** * @ignore */ @@ -22,10 +24,10 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_manager +class manager { /** - * Set of phpbb_cron_task_wrapper objects. + * Set of \phpbb\cron\task\wrapper objects. * Array holding all tasks that have been found. * * @var array @@ -52,7 +54,7 @@ class phpbb_cron_manager * Loads tasks given by name, wraps them * and puts them into $this->tasks. * - * @param array|Traversable $tasks Array of instances of phpbb_cron_task + * @param array|Traversable $tasks Array of instances of \phpbb\cron\task\task * * @return null */ @@ -71,7 +73,7 @@ class phpbb_cron_manager * * If no tasks are ready, null is returned. * - * @return phpbb_cron_task_wrapper|null + * @return \phpbb\cron\task\wrapper|null */ public function find_one_ready_task() { @@ -88,7 +90,7 @@ class phpbb_cron_manager /** * Finds all tasks that are ready to run. * - * @return array List of tasks which are ready to run (wrapped in phpbb_cron_task_wrapper). + * @return array List of tasks which are ready to run (wrapped in \phpbb\cron\task\wrapper). */ public function find_all_ready_tasks() { @@ -111,7 +113,7 @@ class phpbb_cron_manager * Web runner uses this method to resolve names to tasks. * * @param string $name Name of the task to look up. - * @return phpbb_cron_task A task corresponding to the given name, or null. + * @return \phpbb\cron\task\task A task corresponding to the given name, or null. */ public function find_task($name) { @@ -126,13 +128,13 @@ class phpbb_cron_manager } /** - * Wraps a task inside an instance of phpbb_cron_task_wrapper. + * Wraps a task inside an instance of \phpbb\cron\task\wrapper. * - * @param phpbb_cron_task $task The task. - * @return phpbb_cron_task_wrapper The wrapped task. + * @param \phpbb\cron\task\task $task The task. + * @return \phpbb\cron\task\wrapper The wrapped task. */ - public function wrap_task(phpbb_cron_task $task) + public function wrap_task(\phpbb\cron\task\task $task) { - return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->php_ext); + return new \phpbb\cron\task\wrapper($task, $this->phpbb_root_path, $this->php_ext); } } diff --git a/phpBB/phpbb/cron/task/base.php b/phpBB/phpbb/cron/task/base.php index 94a2f267b4..f30c9daf1b 100644 --- a/phpBB/phpbb/cron/task/base.php +++ b/phpBB/phpbb/cron/task/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task; + /** * @ignore */ @@ -26,7 +28,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -abstract class phpbb_cron_task_base implements phpbb_cron_task +abstract class base implements \phpbb\cron\task\task { private $name; diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php index 2c5d38cec0..8e3ef25ce6 100644 --- a/phpBB/phpbb/cron/task/core/prune_all_forums.php +++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -24,7 +26,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base +class prune_all_forums extends \phpbb\cron\task\base { protected $phpbb_root_path; protected $php_ext; @@ -36,10 +38,10 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base * * @param string $phpbb_root_path The root path * @param string $php_ext The PHP extension - * @param phpbb_config $config The config - * @param phpbb_db_driver $db The db connection + * @param \phpbb\config\config $config The config + * @param \phpbb\db\driver\driver $db The db connection */ - public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db) + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php index 0e4c75c77f..f14ab7b702 100644 --- a/phpBB/phpbb/cron/task/core/prune_forum.php +++ b/phpBB/phpbb/cron/task/core/prune_forum.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -24,7 +26,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized +class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\parametrized { protected $phpbb_root_path; protected $php_ext; @@ -46,10 +48,10 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p * * @param string $phpbb_root_path The root path * @param string $php_ext The PHP extension - * @param phpbb_config $config The config - * @param phpbb_db_driver $db The db connection + * @param \phpbb\config\config $config The config + * @param \phpbb\db\driver\driver $db The db connection */ - public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db) + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -132,15 +134,15 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p /** * Parses parameters found in $request, which is an instance of - * phpbb_request_request_interface. + * \phpbb\request\request_interface. * * It is expected to have a key f whose value is id of the forum to be pruned. * - * @param phpbb_request_request_interface $request Request object. + * @param \phpbb\request\request_interface $request Request object. * * @return null */ - public function parse_parameters(phpbb_request_request_interface $request) + public function parse_parameters(\phpbb\request\request_interface $request) { $this->forum_data = null; if ($request->is_set('f')) diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index 732f9c6bea..cb13df86df 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_queue extends phpbb_cron_task_base +class queue extends \phpbb\cron\task\base { protected $phpbb_root_path; protected $php_ext; @@ -31,9 +33,9 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base * * @param string $phpbb_root_path The root path * @param string $php_ext The PHP extension - * @param phpbb_config $config The config + * @param \phpbb\config\config $config The config */ - public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; @@ -51,7 +53,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base { include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); } - $queue = new queue(); + $queue = new \queue(); $queue->process(); } diff --git a/phpBB/phpbb/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php index 4618e8200e..021d5fd8a3 100644 --- a/phpBB/phpbb/cron/task/core/tidy_cache.php +++ b/phpBB/phpbb/cron/task/core/tidy_cache.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base +class tidy_cache extends \phpbb\cron\task\base { protected $config; protected $cache; @@ -28,10 +30,10 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base /** * Constructor. * - * @param phpbb_config $config The config - * @param phpbb_cache_driver_driver_interface $cache The cache driver + * @param \phpbb\config\config $config The config + * @param \phpbb\cache\driver\driver_interface $cache The cache driver */ - public function __construct(phpbb_config $config, phpbb_cache_driver_driver_interface $cache) + public function __construct(\phpbb\config\config $config, \phpbb\cache\driver\driver_interface $cache) { $this->config = $config; $this->cache = $cache; diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php index b882e7b500..d03cba1d86 100644 --- a/phpBB/phpbb/cron/task/core/tidy_database.php +++ b/phpBB/phpbb/cron/task/core/tidy_database.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base +class tidy_database extends \phpbb\cron\task\base { protected $phpbb_root_path; protected $php_ext; @@ -31,9 +33,9 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base * * @param string $phpbb_root_path The root path * @param string $php_ext The PHP extension - * @param phpbb_config $config The config + * @param \phpbb\config\config $config The config */ - public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php index a3d5b7dbd2..ebd0d86cbc 100644 --- a/phpBB/phpbb/cron/task/core/tidy_search.php +++ b/phpBB/phpbb/cron/task/core/tidy_search.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base +class tidy_search extends \phpbb\cron\task\base { protected $phpbb_root_path; protected $php_ext; @@ -36,12 +38,12 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base * * @param string $phpbb_root_path The root path * @param string $php_ext The PHP extension - * @param phpbb_auth $auth The auth - * @param phpbb_config $config The config - * @param phpbb_db_driver $db The db connection - * @param phpbb_user $user The user + * @param \phpbb\auth\auth $auth The auth + * @param \phpbb\config\config $config The config + * @param \phpbb\db\driver\driver $db The db connection + * @param \phpbb\user $user The user */ - public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, phpbb_db_driver $db, phpbb_user $user) + public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\user $user) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/phpbb/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php index 95f55235c9..5df019ae46 100644 --- a/phpBB/phpbb/cron/task/core/tidy_sessions.php +++ b/phpBB/phpbb/cron/task/core/tidy_sessions.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base +class tidy_sessions extends \phpbb\cron\task\base { protected $config; protected $user; @@ -28,10 +30,10 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base /** * Constructor. * - * @param phpbb_config $config The config - * @param phpbb_user $user The user + * @param \phpbb\config\config $config The config + * @param \phpbb\user $user The user */ - public function __construct(phpbb_config $config, phpbb_user $user) + public function __construct(\phpbb\config\config $config, \phpbb\user $user) { $this->config = $config; $this->user = $user; diff --git a/phpBB/phpbb/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php index 2a7798e56e..1cc0abbe88 100644 --- a/phpBB/phpbb/cron/task/core/tidy_warnings.php +++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task\core; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base +class tidy_warnings extends \phpbb\cron\task\base { protected $phpbb_root_path; protected $php_ext; @@ -33,9 +35,9 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base * * @param string $phpbb_root_path The root path * @param string $php_ext The PHP extension - * @param phpbb_config $config The config + * @param \phpbb\config\config $config The config */ - public function __construct($phpbb_root_path, $php_ext, phpbb_config $config) + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/phpbb/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php index 9a6a55c6bc..1d2f449c58 100644 --- a/phpBB/phpbb/cron/task/parametrized.php +++ b/phpBB/phpbb/cron/task/parametrized.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task; + /** * @ignore */ @@ -26,7 +28,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -interface phpbb_cron_task_parametrized extends phpbb_cron_task +interface parametrized extends \phpbb\cron\task\task { /** * Returns parameters of this cron task as an array. @@ -39,14 +41,14 @@ interface phpbb_cron_task_parametrized extends phpbb_cron_task /** * Parses parameters found in $request, which is an instance of - * phpbb_request_request_interface. + * \phpbb\request\request_interface. * * $request contains user input and must not be trusted. * Cron task must validate all data before using it. * - * @param phpbb_request_request_interface $request Request object. + * @param \phpbb\request\request_interface $request Request object. * * @return null */ - public function parse_parameters(phpbb_request_request_interface $request); + public function parse_parameters(\phpbb\request\request_interface $request); } diff --git a/phpBB/phpbb/cron/task/task.php b/phpBB/phpbb/cron/task/task.php index 2d585df96d..84218c4fc9 100644 --- a/phpBB/phpbb/cron/task/task.php +++ b/phpBB/phpbb/cron/task/task.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Cron task interface * @package phpBB3 */ -interface phpbb_cron_task +interface task { /** * Returns the name of the task. diff --git a/phpBB/phpbb/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php index 386fb5b383..aa015966c6 100644 --- a/phpBB/phpbb/cron/task/wrapper.php +++ b/phpBB/phpbb/cron/task/wrapper.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\cron\task; + /** * @ignore */ @@ -21,7 +23,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_cron_task_wrapper +class wrapper { protected $task; protected $phpbb_root_path; @@ -32,9 +34,9 @@ class phpbb_cron_task_wrapper * * Wraps a task $task, which must implement cron_task interface. * - * @param phpbb_cron_task $task The cron task to wrap. + * @param \phpbb\cron\task\task $task The cron task to wrap. */ - public function __construct(phpbb_cron_task $task, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\cron\task\task $task, $phpbb_root_path, $php_ext) { $this->task = $task; $this->phpbb_root_path = $phpbb_root_path; @@ -51,7 +53,7 @@ class phpbb_cron_task_wrapper */ public function is_parametrized() { - return $this->task instanceof phpbb_cron_task_parametrized; + return $this->task instanceof \phpbb\cron\task\parametrized; } /** diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index 3c6d4971b9..2d48c8311e 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -6,11 +6,13 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 */ +namespace phpbb; + /** * phpBB custom extensions to the PHP DateTime class * This handles the relative formats phpBB employs */ -class phpbb_datetime extends DateTime +class datetime extends \DateTime { /** * String used to wrap the date segment which should be replaced by today/tomorrow/yesterday @@ -28,14 +30,14 @@ class phpbb_datetime extends DateTime static protected $format_cache = array(); /** - * Constructs a new instance of phpbb_datetime, expanded to include an argument to inject + * Constructs a new \instance of \phpbb\datetime, expanded to include an argument to inject * the user context and modify the timezone to the users selected timezone if one is not set. * * @param string $time String in a format accepted by strtotime(). * @param DateTimeZone $timezone Time zone of the time. * @param user User object for context. */ - public function __construct($user, $time = 'now', DateTimeZone $timezone = null) + public function __construct($user, $time = 'now', \DateTimeZone $timezone = null) { $this->user = $user; $timezone = $timezone ?: $this->user->timezone; diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 08c966c07a..a266b2aa48 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Database Abstraction Layer * @package dbal */ -class phpbb_db_driver +class driver { var $db_connect_id; var $query_result; @@ -272,7 +274,7 @@ class phpbb_db_driver * Correctly adjust LIKE expression for special characters * Some DBMS are handling them in a different way * - * @param string $expression The expression to use. Every wildcard is escaped, except $this->any_char and $this->one_char + * @param string $expression The expression to use. Every wildcard is escaped, \except $this->any_char and $this->one_char * @return string LIKE expression including the keyword! */ function sql_like_expression($expression) @@ -450,7 +452,7 @@ class phpbb_db_driver * @param string $field name of the sql column that shall be compared * @param array $array array of values that are allowed (IN) or not allowed (NOT IN) * @param bool $negate true for NOT IN (), false for IN () (default) - * @param bool $allow_empty_set If true, allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false. + * @param bool $allow_empty_set If true, \allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false. */ function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) { diff --git a/phpBB/phpbb/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php index 787c28b812..2df5eaf369 100644 --- a/phpBB/phpbb/db/driver/firebird.php +++ b/phpBB/phpbb/db/driver/firebird.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * Minimum Requirement is Firebird 2.1 * @package dbal */ -class phpbb_db_driver_firebird extends phpbb_db_driver +class firebird extends \phpbb\db\driver\driver { var $last_query_text = ''; var $service_handle = false; diff --git a/phpBB/phpbb/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php index 89c2c2351b..4d2cd287da 100644 --- a/phpBB/phpbb/db/driver/mssql.php +++ b/phpBB/phpbb/db/driver/mssql.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * Minimum Requirement is MSSQL 2000+ * @package dbal */ -class phpbb_db_driver_mssql extends phpbb_db_driver +class mssql extends \phpbb\db\driver\driver { var $connect_error = ''; diff --git a/phpBB/phpbb/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php index 56c111c871..57c4e0f1fd 100644 --- a/phpBB/phpbb/db/driver/mssql_base.php +++ b/phpBB/phpbb/db/driver/mssql_base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * MSSQL Database Base Abstraction Layer * @package dbal */ -abstract class phpbb_db_driver_mssql_base extends phpbb_db_driver +abstract class mssql_base extends \phpbb\db\driver\driver { /** * {@inheritDoc} diff --git a/phpBB/phpbb/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php index a1d1a5d5dd..9db34a69fb 100644 --- a/phpBB/phpbb/db/driver/mssql_odbc.php +++ b/phpBB/phpbb/db/driver/mssql_odbc.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -26,7 +28,7 @@ if (!defined('IN_PHPBB')) * * @package dbal */ -class phpbb_db_driver_mssql_odbc extends phpbb_db_driver_mssql_base +class mssql_odbc extends \phpbb\db\driver\mssql_base { var $last_query_text = ''; var $connect_error = ''; diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 28fc88298a..e6002fe1a3 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -11,6 +11,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -56,7 +58,7 @@ class result_mssqlnative { if (is_array($value)) { - $obj->$key = new stdClass(); + $obj->$key = new \stdClass(); array_to_obj($value, $obj->$key); } else @@ -191,7 +193,7 @@ class result_mssqlnative /** * @package dbal */ -class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base +class mssqlnative extends \phpbb\db\driver\mssql_base { var $m_insert_id = NULL; var $last_query_text = ''; diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php index f3744ac09d..c76126763d 100644 --- a/phpBB/phpbb/db/driver/mysql.php +++ b/phpBB/phpbb/db/driver/mysql.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -24,7 +26,7 @@ if (!defined('IN_PHPBB')) * MySQL 5.0+ * @package dbal */ -class phpbb_db_driver_mysql extends phpbb_db_driver_mysql_base +class mysql extends \phpbb\db\driver\mysql_base { var $multi_insert = true; var $connect_error = ''; diff --git a/phpBB/phpbb/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php index ba44ea61aa..8f2f66674b 100644 --- a/phpBB/phpbb/db/driver/mysql_base.php +++ b/phpBB/phpbb/db/driver/mysql_base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Abstract MySQL Database Base Abstraction Layer * @package dbal */ -abstract class phpbb_db_driver_mysql_base extends phpbb_db_driver +abstract class mysql_base extends \phpbb\db\driver\driver { /** * {@inheritDoc} diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php index 0f7a73ee6e..4d0e43b464 100644 --- a/phpBB/phpbb/db/driver/mysqli.php +++ b/phpBB/phpbb/db/driver/mysqli.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -21,7 +23,7 @@ if (!defined('IN_PHPBB')) * MySQL 4.1+ or MySQL 5.0+ * @package dbal */ -class phpbb_db_driver_mysqli extends phpbb_db_driver_mysql_base +class mysqli extends \phpbb\db\driver\mysql_base { var $multi_insert = true; var $connect_error = ''; diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index e21e07055d..5dfab21455 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Oracle Database Abstraction Layer * @package dbal */ -class phpbb_db_driver_oracle extends phpbb_db_driver +class oracle extends \phpbb\db\driver\driver { var $last_query_text = ''; var $connect_error = ''; diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 14854d179d..7a98b90c73 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * Minimum Requirement is Version 7.3+ * @package dbal */ -class phpbb_db_driver_postgres extends phpbb_db_driver +class postgres extends \phpbb\db\driver\driver { var $last_query_text = ''; var $connect_error = ''; @@ -84,7 +86,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver $this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?'; return $this->sql_error(''); } - $collector = new phpbb_error_collector; + $collector = new \phpbb\error_collector; $collector->install(); $this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW); } @@ -95,7 +97,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver $this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?'; return $this->sql_error(''); } - $collector = new phpbb_error_collector; + $collector = new \phpbb\error_collector; $collector->install(); $this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW); } diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php index 7188f0daa2..a548fd2618 100644 --- a/phpBB/phpbb/db/driver/sqlite.php +++ b/phpBB/phpbb/db/driver/sqlite.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\driver; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * Minimum Requirement: 2.8.2+ * @package dbal */ -class phpbb_db_driver_sqlite extends phpbb_db_driver +class sqlite extends \phpbb\db\driver\driver { var $connect_error = ''; diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1.php index c996a0138a..2fe0addc06 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/30x/3_0_10.php index 122f93d6b4..cdf824a9ff 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_10 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_10 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php index 0ed05812dc..ee05fcabaa 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_10_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php index b14b3b00aa..f53a4b0d97 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_10_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php index 473057d65d..20456e0458 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_10_rc3 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/30x/3_0_11.php index e063c699cc..5b842cba4b 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_11 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_11 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php index dddfc0e0e7..1d484a97ca 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_11_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php index fac8523e8c..b7e475a87b 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_11_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php index 6a31a51201..f1692f8ef7 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php @@ -7,9 +7,11 @@ * */ +namespace phpbb\db\migration\datax; + /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 **/ -class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration +class 3_0_12_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php index 562ccf077c..0444de4ac2 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_1_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2.php index eed5acef82..4f9278e2fa 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php index a960e90765..8f709fb769 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_2_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php index 8917dfea77..ecbe8bf808 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_2_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/30x/3_0_3.php index 8984cf7b76..5f94bd9018 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_3.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_3 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_3 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php index 4b102e1a2e..631d382135 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_3_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/30x/3_0_4.php index 9a0c132e78..369f23f7e7 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_4.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_4 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_4 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php index 8ad75a557b..f98d7a59d0 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_4_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -82,7 +84,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration public function update_custom_profile_fields() { - // Update the Custom Profile Fields based on previous settings to the new format + // Update the Custom Profile Fields based on previous settings to the new \format $sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide FROM ' . PROFILE_FIELDS_TABLE; $result = $this->db->sql_query($sql); diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/30x/3_0_5.php index 16d2dee457..9265f09b39 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_5 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_5 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php index ea17cc1e31..b99313de5d 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_5_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php index 8538347b1a..65787f9310 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_5_rc1part2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/30x/3_0_6.php index bb651dc7cd..382fb6cde2 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_6 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_6 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php index 38c282ebf0..0b54c3b195 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_6_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -214,7 +216,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration $group_id = $this->db->sql_nextid(); } - // Insert new user role... at the end of the chain + // Insert new \user role... at the end of the chain $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . " WHERE role_name = 'ROLE_USER_NEW_MEMBER' @@ -239,7 +241,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration $u_role = $this->db->sql_nextid(); // Now add the correct data to the roles... - // The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups + // The standard role says that new \users are not able to send a PM, Mass PM, are not able to PM groups $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')"; $this->sql_query($sql); @@ -248,7 +250,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration $this->sql_query($sql); } - // Insert new forum role + // Insert new \forum role $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . " WHERE role_name = 'ROLE_FORUM_NEW_MEMBER' @@ -276,7 +278,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration $this->sql_query($sql); } - // Set every members user_new column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) + // Set every members user_new \column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) $sql = 'SELECT 1 FROM ' . USERS_TABLE . ' WHERE user_new = 0'; @@ -318,7 +320,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration // Clear permissions... include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); - $auth_admin = new auth_admin(); + $auth_admin = new \auth_admin(); $auth_admin->acl_clear_prefetch(); } } diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php index a939dbd489..041224d19a 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_6_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php index b3f09d8ab8..3183c16efd 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_6_rc3 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -30,7 +32,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration public function update_cp_fields() { - // Update the Custom Profile Fields based on previous settings to the new format + // Update the Custom Profile Fields based on previous settings to the new \format $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . ' SET field_show_on_vt = 1 WHERE field_hide = 0 diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php index fc2923f99b..7d75b12130 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_6_rc4 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/30x/3_0_7.php index 9ff2e9e4ab..1b1e5d0373 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_7 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_7 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php index c9cc9d19ac..a45c9c3c14 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_7_pl1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_7_pl1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php index ffebf66f2d..dab90512ab 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_7_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php index 55bc2bc679..ea430740c6 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_7_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/30x/3_0_8.php index 8998ef9627..c08a74e5ee 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_8.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_8.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_8 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_8 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php index aeff35333e..dce88e249e 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_8_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/30x/3_0_9.php index d5269ea6f0..8254ac8561 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_9 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_9 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php index 4c345b429b..14e0fe6013 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_9_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php index c0e662aa45..44fd789353 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_9_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php index d6d1f14b2e..e4102fb193 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_9_rc3 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php index e673249343..5896d11ba5 100644 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php +++ b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class 3_0_9_rc4 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php index f324b8880d..360daed437 100644 --- a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php +++ b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_30x_local_url_bbcode extends phpbb_db_migration +namespace phpbb\db\migration\datax; + +class local_url_bbcode extends \phpbb\db\migration\migration { static public function depends_on() { @@ -44,7 +46,7 @@ class phpbb_db_migration_data_30x_local_url_bbcode extends phpbb_db_migration $bbcode_match = $row['bbcode_match']; $bbcode_tpl = $row['bbcode_tpl']; - $acp_bbcodes = new acp_bbcodes(); + $acp_bbcodes = new \acp_bbcodes(); $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl); $sql = 'UPDATE ' . BBCODES_TABLE . ' diff --git a/phpBB/phpbb/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/310/avatars.php index 79547337f7..0d539d0c75 100644 --- a/phpBB/phpbb/db/migration/data/310/avatars.php +++ b/phpBB/phpbb/db/migration/data/310/avatars.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_avatars extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class avatars extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/310/boardindex.php index 965e32c15c..ee403a7360 100644 --- a/phpBB/phpbb/db/migration/data/310/boardindex.php +++ b/phpBB/phpbb/db/migration/data/310/boardindex.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_boardindex extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class boardindex extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/310/config_db_text.php index 89f211adda..932edf39d7 100644 --- a/phpBB/phpbb/db/migration/data/310/config_db_text.php +++ b/phpBB/phpbb/db/migration/data/310/config_db_text.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_config_db_text extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class config_db_text extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/310/dev.php index 0fc2950987..702073bcdd 100644 --- a/phpBB/phpbb/db/migration/data/310/dev.php +++ b/phpBB/phpbb/db/migration/data/310/dev.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_dev extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class dev extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -17,10 +19,10 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration static public function depends_on() { return array( - 'phpbb_db_migration_data_310_extensions', - 'phpbb_db_migration_data_310_style_update_p2', - 'phpbb_db_migration_data_310_timezone_p2', - 'phpbb_db_migration_data_310_reported_posts_display', + '\phpbb\db\migration\data0\extensions', + '\phpbb\db\migration\data0\style_update_p2', + '\phpbb\db\migration\data0\timezone_p2', + '\phpbb\db\migration\data0\reported_posts_display', ); } @@ -183,7 +185,7 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration public function move_customise_modules() { - // Move language management to new location in the Customise tab + // Move language management to new \location in the Customise tab // First get language module id $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " WHERE module_basename = 'acp_language'"; @@ -206,7 +208,7 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration { include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext); } - $module_manager = new acp_modules(); + $module_manager = new \acp_modules(); $module_manager->module_class = 'acp'; $module_manager->move_module($language_module_id, $language_management_module_id); } diff --git a/phpBB/phpbb/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/310/extensions.php index 6a9caa1cfc..fde2038cca 100644 --- a/phpBB/phpbb/db/migration/data/310/extensions.php +++ b/phpBB/phpbb/db/migration/data/310/extensions.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_extensions extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class extensions extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/310/forgot_password.php index a553e51f35..9a42565223 100644 --- a/phpBB/phpbb/db/migration/data/310/forgot_password.php +++ b/phpBB/phpbb/db/migration/data/310/forgot_password.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_forgot_password extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class forgot_password extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/310/jquery_update.php index dc49f74fcb..2b30e2dd3b 100644 --- a/phpBB/phpbb/db/migration/data/310/jquery_update.php +++ b/phpBB/phpbb/db/migration/data/310/jquery_update.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_jquery_update extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class jquery_update extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -17,7 +19,7 @@ class phpbb_db_migration_data_310_jquery_update extends phpbb_db_migration static public function depends_on() { return array( - 'phpbb_db_migration_data_310_dev', + '\phpbb\db\migration\data0\dev', ); } diff --git a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php index d994d7ec5f..482051c287 100644 --- a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php +++ b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php @@ -7,11 +7,13 @@ * */ -class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class notification_options_reconvert extends \phpbb\db\migration\migration { static public function depends_on() { - return array('phpbb_db_migration_data_310_notifications_schema_fix'); + return array('\phpbb\db\migration\data0\notifications_schema_fix'); } public function update_data() @@ -24,7 +26,7 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d public function convert_notifications() { $insert_table = $this->table_prefix . 'user_notifications'; - $insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $insert_table); + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $insert_table); $this->perform_conversion($insert_buffer, $insert_table); } @@ -32,10 +34,10 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d /** * Perform the conversion (separate for testability) * - * @param phpbb_db_sql_insert_buffer $insert_buffer + * @param \phpbb\db\sql_insert_buffer $insert_buffer * @param string $insert_table */ - public function perform_conversion(phpbb_db_sql_insert_buffer $insert_buffer, $insert_table) + public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $insert_table) { $sql = 'DELETE FROM ' . $insert_table; $this->db->sql_query($sql); @@ -94,13 +96,13 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d /** * Insert method rows to DB * - * @param phpbb_db_sql_insert_buffer $insert_buffer + * @param \phpbb\db\sql_insert_buffer $insert_buffer * @param string $item_type * @param int $item_id * @param int $user_id * @param string $methods */ - protected function add_method_rows(phpbb_db_sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods) + protected function add_method_rows(\phpbb\db\sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods) { $row_base = array( 'item_type' => $item_type, diff --git a/phpBB/phpbb/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/310/notifications.php index 17c939d95a..f5bd9ebf07 100644 --- a/phpBB/phpbb/db/migration/data/310/notifications.php +++ b/phpBB/phpbb/db/migration/data/310/notifications.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_notifications extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class notifications extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration static public function depends_on() { - return array('phpbb_db_migration_data_310_dev'); + return array('\phpbb\db\migration\data0\dev'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php index 27e63e10d0..fa2da6fe92 100644 --- a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php +++ b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php @@ -7,11 +7,13 @@ * */ -class phpbb_db_migration_data_310_notifications_schema_fix extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class notifications_schema_fix extends \phpbb\db\migration\migration { static public function depends_on() { - return array('phpbb_db_migration_data_310_notifications'); + return array('\phpbb\db\migration\data0\notifications'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php index 80a0a0e43f..ef35f48970 100644 --- a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php +++ b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_reported_posts_display extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class reported_posts_display extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php index e4fbb27bcb..27585fec10 100644 --- a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php +++ b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class signature_module_auth extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php index 84f8eebd4a..22ee78bb22 100644 --- a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php +++ b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class softdelete_p1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration static public function depends_on() { - return array('phpbb_db_migration_data_310_dev'); + return array('\phpbb\db\migration\data0\dev'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php index 7320a2c2bf..698e44fab7 100644 --- a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php +++ b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_softdelete_p2 extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class softdelete_p2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -17,8 +19,8 @@ class phpbb_db_migration_data_310_softdelete_p2 extends phpbb_db_migration static public function depends_on() { return array( - 'phpbb_db_migration_data_310_dev', - 'phpbb_db_migration_data_310_softdelete_p1', + '\phpbb\db\migration\data0\dev', + '\phpbb\db\migration\data0\softdelete_p1', ); } diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/310/style_update_p1.php index d43537559d..fe60993f20 100644 --- a/phpBB/phpbb/db/migration/data/310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/310/style_update_p1.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class style_update_p1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -59,7 +61,7 @@ class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration // Get list of valid 3.1 styles $available_styles = array('prosilver'); - $iterator = new DirectoryIterator($this->phpbb_root_path . 'styles'); + $iterator = new \DirectoryIterator($this->phpbb_root_path . 'styles'); $skip_dirs = array('.', '..', 'prosilver'); foreach ($iterator as $fileinfo) { diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/310/style_update_p2.php index 7b10518a66..3f6477b7cb 100644 --- a/phpBB/phpbb/db/migration/data/310/style_update_p2.php +++ b/phpBB/phpbb/db/migration/data/310/style_update_p2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class style_update_p2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration static public function depends_on() { - return array('phpbb_db_migration_data_310_style_update_p1'); + return array('\phpbb\db\migration\data0\style_update_p1'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/310/teampage.php index 4e77da17b7..605156dc41 100644 --- a/phpBB/phpbb/db/migration/data/310/teampage.php +++ b/phpBB/phpbb/db/migration/data/310/teampage.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_teampage extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class teampage extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_teampage extends phpbb_db_migration static public function depends_on() { - return array('phpbb_db_migration_data_310_dev'); + return array('\phpbb\db\migration\data0\dev'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/310/timezone.php index 6e50cbe45f..97fea19a64 100644 --- a/phpBB/phpbb/db/migration/data/310/timezone.php +++ b/phpBB/phpbb/db/migration/data/310/timezone.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_timezone extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class timezone extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -63,12 +65,12 @@ class phpbb_db_migration_data_310_timezone extends phpbb_db_migration } /** - * Determine the new timezone for a given phpBB 3.0 timezone and + * Determine the new \timezone for a given phpBB 3.0 timezone and * "Daylight Saving Time" option * * @param $timezone float Users timezone in 3.0 * @param $dst int Users daylight saving time - * @return string Users new php Timezone which is used since 3.1 + * @return string Users new \php Timezone which is used since 3.1 */ public function convert_phpbb30_timezone($timezone, $dst) { diff --git a/phpBB/phpbb/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/310/timezone_p2.php index 113b979e4f..0c174b0d56 100644 --- a/phpBB/phpbb/db/migration/data/310/timezone_p2.php +++ b/phpBB/phpbb/db/migration/data/310/timezone_p2.php @@ -7,7 +7,9 @@ * */ -class phpbb_db_migration_data_310_timezone_p2 extends phpbb_db_migration +namespace phpbb\db\migration\data0; + +class timezone_p2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_timezone_p2 extends phpbb_db_migration static public function depends_on() { - return array('phpbb_db_migration_data_310_timezone'); + return array('\phpbb\db\migration\data0\timezone'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php index e84330dd71..8bf18dec68 100644 --- a/phpBB/phpbb/db/migration/exception.php +++ b/phpBB/phpbb/db/migration/exception.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\migration; + /** * @ignore */ @@ -16,11 +18,11 @@ if (!defined('IN_PHPBB')) } /** -* The migrator is responsible for applying new migrations in the correct order. +* The migrator is responsible for applying new \migrations in the correct order. * * @package db */ -class phpbb_db_migration_exception extends \Exception +class exception extends \Exception { /** * Extra parameters sent to exception to aid in debugging @@ -64,12 +66,12 @@ class phpbb_db_migration_exception extends \Exception } /** - * Get localised message (with $user->lang()) + * Get localised message (\with $user->lang()) * - * @param phpbb_user $user + * @param \phpbb\user $user * @return string */ - public function getLocalisedMessage(phpbb_user $user) + public function getLocalisedMessage(\phpbb\user $user) { $parameters = $this->getParameters(); array_unshift($parameters, $this->getMessage()); diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php index 0ffa96fd14..aff3837279 100644 --- a/phpBB/phpbb/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db\migration; + /** * @ignore */ @@ -24,15 +26,15 @@ if (!defined('IN_PHPBB')) * * @package db */ -abstract class phpbb_db_migration +abstract class migration { - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $config; - /** @var phpbb_db_driver */ + /** @var \phpbb\db\driver\driver */ protected $db; - /** @var phpbb_db_tools */ + /** @var \phpbb\db\tools */ protected $db_tools; /** @var string */ @@ -53,14 +55,14 @@ abstract class phpbb_db_migration /** * Constructor * - * @param phpbb_config $config - * @param phpbb_db_driver $db - * @param phpbb_db_tools $db_tools + * @param \phpbb\config\config $config + * @param \phpbb\db\driver\driver $db + * @param \phpbb\db\tools $db_tools * @param string $phpbb_root_path * @param string $php_ext * @param string $table_prefix */ - public function __construct(phpbb_config $config, phpbb_db_driver $db, phpbb_db_tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix) + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix) { $this->config = $config; $this->db = $db; diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 5dd47cfa60..6ff69bbd2b 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -7,22 +7,24 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration config tool * * @package db */ -class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_tool_interface +class config implements \phpbb\db\migration\tool\tool_interface { - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $config; /** * Constructor * - * @param phpbb_config $config + * @param \phpbb\config\config $config */ - public function __construct(phpbb_config $config) + public function __construct(\phpbb\config\config $config) { $this->config = $config; } @@ -67,7 +69,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_tool_int { if (!isset($this->config[$config_name])) { - throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); + throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name); } $this->config->set($config_name, $config_value); @@ -78,7 +80,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_tool_int * current config value * * @param string $compare If equal to the current config value, will be - * updated to the new config value, otherwise not + * updated to the new \config value, otherwise not * @param string $config_name The name of the config setting you would * like to update * @param mixed $config_value The value of the config setting @@ -88,7 +90,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_tool_int { if (!isset($this->config[$config_name])) { - throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); + throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name); } $this->config->set_atomic($config_name, $compare, $config_value); diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 8ed2a933ff..ecb1176bd4 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -7,20 +7,22 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration module management tool * * @package db */ -class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_interface +class module implements \phpbb\db\migration\tool\tool_interface { - /** @var phpbb_cache_service */ + /** @var \phpbb\cache\service */ protected $cache; /** @var dbal */ protected $db; - /** @var phpbb_user */ + /** @var \phpbb\user */ protected $user; /** @var string */ @@ -35,14 +37,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int /** * Constructor * - * @param phpbb_db_driver $db + * @param \phpbb\db\driver\driver $db * @param mixed $cache - * @param phpbb_user $user + * @param \phpbb\user $user * @param string $phpbb_root_path * @param string $php_ext * @param string $modules_table */ - public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_user $user, $phpbb_root_path, $php_ext, $modules_table) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\user $user, $phpbb_root_path, $php_ext, $modules_table) { $this->db = $db; $this->cache = $cache; @@ -129,11 +131,11 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int /** * Module Add * - * Add a new module + * Add a new \module * * @param string $class The module class(acp|mcp|ucp) * @param int|string $parent The parent module_id|module_langname (0 for no parent) - * @param array $data an array of the data on the new module. + * @param array $data an array of the data on the new \module. * This can be setup in two different ways. * 1. The "manual" way. For inserting a category or one at a time. * It will be merged with the base array shown a bit below, @@ -221,14 +223,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int if (!$module_id) { - throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent); + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); } $parent = $data['parent_id'] = $module_id; } else if (!$this->exists($class, false, $parent)) { - throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent); + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); } if ($this->exists($class, $parent, $data['module_langname'])) @@ -241,7 +243,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); $this->user->add_lang('acp/modules'); } - $acp_modules = new acp_modules(); + $acp_modules = new \acp_modules(); $module_data = array( 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, @@ -259,7 +261,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int if (is_string($result)) { // Error - throw new phpbb_db_migration_exception('MODULE_ERROR', $result); + throw new \phpbb\db\migration\exception('MODULE_ERROR', $result); } else { @@ -347,7 +349,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int // Failed. if (!isset($module['module_basename'])) { - throw new phpbb_db_migration_exception('MODULE_NOT_EXIST'); + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST'); } // Automatic method @@ -433,7 +435,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); $this->user->add_lang('acp/modules'); } - $acp_modules = new acp_modules(); + $acp_modules = new \acp_modules(); $acp_modules->module_class = $class; foreach ($module_ids as $module_id) @@ -476,7 +478,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int } /** - * Wrapper for acp_modules::get_module_infos() + * Wrapper for \acp_modules::get_module_infos() * * @param string $class Module Class * @param string $basename Module Basename @@ -488,12 +490,12 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_tool_int { include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); } - $acp_modules = new acp_modules(); + $acp_modules = new \acp_modules(); $module = $acp_modules->get_module_infos($basename, $class, true); if (empty($module)) { - throw new phpbb_db_migration_exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename); + throw new \phpbb\db\migration\exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename); } return array_pop($module); diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index f1140d0759..51b0996c30 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -7,17 +7,19 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration permission management tool * * @package db */ -class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool_interface +class permission implements \phpbb\db\migration\tool\tool_interface { - /** @var phpbb_auth */ + /** @var \phpbb\auth\auth */ protected $auth; - /** @var phpbb_cache_service */ + /** @var \phpbb\cache\service */ protected $cache; /** @var dbal */ @@ -32,13 +34,13 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool /** * Constructor * - * @param phpbb_db_driver $db + * @param \phpbb\db\driver\driver $db * @param mixed $cache - * @param phpbb_auth $auth + * @param \phpbb\auth\auth $auth * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_auth $auth, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext) { $this->db = $db; $this->cache = $cache; @@ -117,7 +119,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool { include($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); } - $auth_admin = new auth_admin(); + $auth_admin = new \auth_admin(); // We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here. if ($this->exists($auth_option, !$global)) @@ -236,9 +238,9 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool } /** - * Add a new permission role + * Add a new \permission role * - * @param string $role_name The new role name + * @param string $role_name The new \role name * @param sting $role_type The type (u_, m_, a_) * @return null */ @@ -277,7 +279,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool * Update the name on a permission role * * @param string $old_role_name The old role name - * @param string $new_role_name The new role name + * @param string $new_role_name The new \role name * @return null */ public function role_update($old_role_name, $new_role_name) @@ -290,7 +292,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool if (!$role_id) { - throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $old_role_name); + throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $old_role_name); } $sql = 'UPDATE ' . ACL_ROLES_TABLE . " @@ -380,7 +382,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool if (!$role_id) { - throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name); } $sql = 'SELECT auth_option_id, auth_setting @@ -403,7 +405,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool if (!$group_id) { - throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name); } // If the group has a role set for them we will add the requested permissions to that role. @@ -523,7 +525,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool if (!$role_id) { - throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name); } $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' @@ -540,7 +542,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_tool if (!$group_id) { - throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name); + throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name); } // If the group has a role set for them we will remove the requested permissions from that role. diff --git a/phpBB/phpbb/db/migration/tool/tool_interface.php b/phpBB/phpbb/db/migration/tool/tool_interface.php index 72344d50d2..e7b89d8858 100644 --- a/phpBB/phpbb/db/migration/tool/tool_interface.php +++ b/phpBB/phpbb/db/migration/tool/tool_interface.php @@ -7,12 +7,14 @@ * */ +namespace phpbb\db\migration\tool; + /** * Migration tool interface * * @package db */ -interface phpbb_db_migration_tool_tool_interface +interface tool_interface { /** * Retrieve a short name used for commands in migrations. diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index ca3ffc8043..0b9463a622 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db; + /** * @ignore */ @@ -16,19 +18,19 @@ if (!defined('IN_PHPBB')) } /** -* The migrator is responsible for applying new migrations in the correct order. +* The migrator is responsible for applying new \migrations in the correct order. * * @package db */ -class phpbb_db_migrator +class migrator { - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $config; - /** @var phpbb_db_driver */ + /** @var \phpbb\db\driver\driver */ protected $db; - /** @var phpbb_db_tools */ + /** @var \phpbb\db\tools */ protected $db_tools; /** @var string */ @@ -71,7 +73,7 @@ class phpbb_db_migrator /** * Constructor of the database migrator */ - public function __construct(phpbb_config $config, phpbb_db_driver $db, phpbb_db_tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools) + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools) { $this->config = $config; $this->db = $db; @@ -240,7 +242,7 @@ class phpbb_db_migrator $state['migration_data_done'] = ($result === true); $state['migration_end_time'] = ($result === true) ? time() : 0; } - catch (phpbb_db_migration_exception $e) + catch (\phpbb\db\migration\exception $e) { // Revert the schema changes $this->revert($name); @@ -398,7 +400,7 @@ class phpbb_db_migrator )); } } - catch (phpbb_db_migration_exception $e) + catch (\phpbb\db\migration\exception $e) { // We should try rolling back here foreach ($steps as $reverse_step_identifier => $reverse_step) @@ -474,12 +476,12 @@ class phpbb_db_migrator case 'if': if (!isset($parameters[0])) { - throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step); + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step); } if (!isset($parameters[1])) { - throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step); + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step); } $condition = $parameters[0]; @@ -496,7 +498,7 @@ class phpbb_db_migrator case 'custom': if (!is_callable($parameters[0])) { - throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step); + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step); } return array( @@ -508,17 +510,17 @@ class phpbb_db_migrator default: if (!$method) { - throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step); + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step); } if (!isset($this->tools[$class])) { - throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step); + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step); } if (!method_exists(get_class($this->tools[$class]), $method)) { - throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step); + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step); } // Attempt to reverse operations @@ -656,7 +658,7 @@ class phpbb_db_migrator * Helper to get a migration * * @param string $name Name of the migration - * @return phpbb_db_migration + * @return \phpbb\db\migration\migration */ protected function get_migration($name) { @@ -694,7 +696,7 @@ class phpbb_db_migrator /** * Load migration data files from a directory * - * @param phpbb_extension_finder $finder + * @param \phpbb\extension\finder $finder * @param string $path Path to migration data files * @param bool $check_fulfillable If TRUE (default), we will check * if all of the migrations are fulfillable after loading them. @@ -703,11 +705,11 @@ class phpbb_db_migrator * with the last call to prevent throwing errors unnecessarily). * @return array Array of migration names */ - public function load_migrations(phpbb_extension_finder $finder, $path, $check_fulfillable = true) + public function load_migrations(\phpbb\extension\finder $finder, $path, $check_fulfillable = true) { if (!is_dir($path)) { - throw new phpbb_db_migration_exception('DIRECTORY INVALID', $path); + throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path); } $migrations = array(); @@ -736,7 +738,7 @@ class phpbb_db_migrator $unfulfillable = $this->unfulfillable($name); if ($unfulfillable !== false) { - throw new phpbb_db_migration_exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable); + throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable); } } } diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php index c18f908429..7bbd213bdc 100644 --- a/phpBB/phpbb/db/sql_insert_buffer.php +++ b/phpBB/phpbb/db/sql_insert_buffer.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db; + /** * @ignore */ @@ -38,7 +40,7 @@ if (!defined('IN_PHPBB')) * * Usage: * -* $buffer = new phpbb_db_sql_insert_buffer($db, 'test_table', 1234); +* $buffer = new \phpbb\db\sql_insert_buffer($db, 'test_table', 1234); * * while (do_stuff()) * { @@ -53,9 +55,9 @@ if (!defined('IN_PHPBB')) * * @package dbal */ -class phpbb_db_sql_insert_buffer +class sql_insert_buffer { - /** @var phpbb_db_driver */ + /** @var \phpbb\db\driver\driver */ protected $db; /** @var string */ @@ -68,11 +70,11 @@ class phpbb_db_sql_insert_buffer protected $buffer = array(); /** - * @param phpbb_db_driver $db + * @param \phpbb\db\driver\driver $db * @param string $table_name * @param int $max_buffered_rows */ - public function __construct(phpbb_db_driver $db, $table_name, $max_buffered_rows = 500) + public function __construct(\phpbb\db\driver\driver $db, $table_name, $max_buffered_rows = 500) { $this->db = $db; $this->table_name = $table_name; diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index 492284ffcd..35b89e8166 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\db; + /** * @ignore */ @@ -21,7 +23,7 @@ if (!defined('IN_PHPBB')) * * @package dbal */ -class phpbb_db_tools +class tools { /** * Current sql layer @@ -300,10 +302,10 @@ class phpbb_db_tools /** * Constructor. Set DB Object and set {@link $return_statements return_statements}. * - * @param phpbb_db_driver $db Database connection + * @param \phpbb\db\driver\driver $db Database connection * @param bool $return_statements True if only statements should be returned and no SQL being executed */ - public function __construct(phpbb_db_driver $db, $return_statements = false) + public function __construct(\phpbb\db\driver\driver $db, $return_statements = false) { $this->db = $db; $this->return_statements = $return_statements; @@ -491,7 +493,7 @@ class phpbb_db_tools trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); } - // here we add the definition of the new column to the list of columns + // here we add the definition of the new \column to the list of columns switch ($this->sql_layer) { case 'mssql': @@ -978,7 +980,7 @@ class phpbb_db_tools $column_list[] = $entities[0]; } - // note down the primary key notation because sqlite only supports adding it to the end for the new table + // note down the primary key notation because sqlite only supports adding it to the end for the new \table $primary_key = false; $_new_cols = array(); @@ -1058,7 +1060,7 @@ class phpbb_db_tools { $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; } - // Add a new one or the old primary key + // Add a new \one or the old primary key else if ($primary_key !== false) { $new_table_cols[] = $primary_key; @@ -1066,7 +1068,7 @@ class phpbb_db_tools $columns = implode(',', $column_list); - // create a new table and fill it up. destroy the temp one + // create a new \table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -1689,7 +1691,7 @@ class phpbb_db_tools } /** - * Add new column + * Add new \column */ function sql_column_add($table_name, $column_name, $column_data, $inline = false) { @@ -1798,7 +1800,7 @@ class phpbb_db_tools $new_table_cols = $column_name . ' ' . $column_data['column_type_sql'] . ',' . $new_table_cols; - // create a new table and fill it up. destroy the temp one + // create a new \table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -1913,7 +1915,7 @@ class phpbb_db_tools $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); - // create a new table and fill it up. destroy the temp one + // create a new \table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -2105,7 +2107,7 @@ class phpbb_db_tools $columns = implode(',', $column_list); - // create a new table and fill it up. destroy the temp one + // create a new \table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -2471,7 +2473,7 @@ class phpbb_db_tools $columns = implode(',', $column_list); - // create a new table and fill it up. destroy the temp one + // create a new \table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index 6c272a6588..62757c5b7d 100644 --- a/phpBB/phpbb/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\di\extension; + /** * @ignore */ @@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator; /** * Container config extension */ -class phpbb_di_extension_config extends Extension +class config extends Extension { public function __construct($config_file) { diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 9c36ba2fc4..901addc694 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\di\extension; + /** * @ignore */ @@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator; /** * Container core extension */ -class phpbb_di_extension_core extends Extension +class core extends Extension { /** * phpBB Root path diff --git a/phpBB/phpbb/di/extension/ext.php b/phpBB/phpbb/di/extension/ext.php index 7d9b433751..cf623a7c87 100644 --- a/phpBB/phpbb/di/extension/ext.php +++ b/phpBB/phpbb/di/extension/ext.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\di\extension; + /** * @ignore */ @@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator; /** * Container ext extension */ -class phpbb_di_extension_ext extends Extension +class ext extends Extension { protected $paths = array(); diff --git a/phpBB/phpbb/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php index 63a5c7dfc4..ffc5a41f6d 100644 --- a/phpBB/phpbb/di/pass/collection_pass.php +++ b/phpBB/phpbb/di/pass/collection_pass.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\di\pass; + /** * @ignore */ @@ -23,7 +25,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; * the services tagged with the appropriate name defined in the collection's * service_collection tag. */ -class phpbb_di_pass_collection_pass implements CompilerPassInterface +class collection_pass implements CompilerPassInterface { /** * Modify the container before it is passed to the rest of the code diff --git a/phpBB/phpbb/di/pass/kernel_pass.php b/phpBB/phpbb/di/pass/kernel_pass.php index a701ebcfa6..6a9124ad78 100644 --- a/phpBB/phpbb/di/pass/kernel_pass.php +++ b/phpBB/phpbb/di/pass/kernel_pass.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\di\pass; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -class phpbb_di_pass_kernel_pass implements CompilerPassInterface +class kernel_pass implements CompilerPassInterface { /** * Modify the container before it is passed to the rest of the code @@ -38,12 +40,12 @@ class phpbb_di_pass_kernel_pass implements CompilerPassInterface if (!isset($event['event'])) { - throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); + throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); } if (!isset($event['method'])) { - throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id)); + throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id)); } $definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority)); @@ -55,11 +57,11 @@ class phpbb_di_pass_kernel_pass implements CompilerPassInterface // We must assume that the class value has been correctly filled, even if the service is created by a factory $class = $container->getDefinition($id)->getClass(); - $refClass = new ReflectionClass($class); + $refClass = new \ReflectionClass($class); $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; if (!$refClass->implementsInterface($interface)) { - throw new InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface)); + throw new \InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface)); } $definition->addMethodCall('addSubscriberService', array($id, $class)); diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 880cb46d4d..fccdd77071 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\di; + /** * @ignore */ @@ -22,7 +24,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * * @package phpBB3 */ -class phpbb_di_service_collection extends ArrayObject +class service_collection extends \ArrayObject { /** * Constructor diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php index 0a6462d046..9b3216e32f 100644 --- a/phpBB/phpbb/error_collector.php +++ b/phpBB/phpbb/error_collector.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_error_collector +class error_collector { var $errors; diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php index 70718ff0ae..3481023b74 100644 --- a/phpBB/phpbb/event/data.php +++ b/phpBB/phpbb/event/data.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\event; + /** * @ignore */ @@ -17,7 +19,7 @@ if (!defined('IN_PHPBB')) use Symfony\Component\EventDispatcher\Event; -class phpbb_event_data extends Event implements ArrayAccess +class data extends Event implements \ArrayAccess { private $data; diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 4f637ce3bb..cc3733692e 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\event; + /** * @ignore */ @@ -31,11 +33,11 @@ use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; * extract($phpbb_dispatcher->trigger_event('core.index', compact($vars))); * */ -class phpbb_event_dispatcher extends ContainerAwareEventDispatcher +class dispatcher extends ContainerAwareEventDispatcher { public function trigger_event($eventName, $data = array()) { - $event = new phpbb_event_data($data); + $event = new \phpbb\event\data($data); $this->dispatch($eventName, $event); return $event->get_data_filtered(array_keys($data)); } diff --git a/phpBB/phpbb/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php index d933b943d7..6bc23be176 100644 --- a/phpBB/phpbb/event/extension_subscriber_loader.php +++ b/phpBB/phpbb/event/extension_subscriber_loader.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\event; + /** * @ignore */ @@ -17,12 +19,12 @@ if (!defined('IN_PHPBB')) use Symfony\Component\EventDispatcher\EventDispatcherInterface; -class phpbb_event_extension_subscriber_loader +class extension_subscriber_loader { private $dispatcher; private $extension_manager; - public function __construct(EventDispatcherInterface $dispatcher, phpbb_extension_manager $extension_manager) + public function __construct(EventDispatcherInterface $dispatcher, \phpbb\extension\manager $extension_manager) { $this->dispatcher = $dispatcher; $this->extension_manager = $extension_manager; diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php index f90989a74c..7199f47ae8 100644 --- a/phpBB/phpbb/event/kernel_exception_subscriber.php +++ b/phpBB/phpbb/event/kernel_exception_subscriber.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\event; + /** * @ignore */ @@ -21,27 +23,27 @@ use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpFoundation\Response; -class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterface +class kernel_exception_subscriber implements EventSubscriberInterface { /** * Template object - * @var phpbb_template + * @var \phpbb\template\template */ protected $template; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; /** * Construct method * - * @param phpbb_template $template Template object - * @param phpbb_user $user User object + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object */ - public function __construct(phpbb_template $template, phpbb_user $user) + public function __construct(\phpbb\template\template $template, \phpbb\user $user) { $this->template = $template; $this->user = $user; @@ -53,7 +55,7 @@ class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterfac * @param GetResponseForExceptionEvent $event * @return null */ - public function on_kernel_exception(GetResponseForExceptionEvent $event) + public function on_kernel_exception(\GetResponseForExceptionEvent $event) { page_header($this->user->lang('INFORMATION')); @@ -72,7 +74,7 @@ class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterfac $status_code = $exception instanceof HttpException ? $exception->getStatusCode() : 500; - $response = new Response($this->template->assign_display('body'), $status_code); + $response = new \Response($this->template->assign_display('body'), $status_code); $event->setResponse($response); } diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php index afb8464f80..9691be7ca5 100644 --- a/phpBB/phpbb/event/kernel_request_subscriber.php +++ b/phpBB/phpbb/event/kernel_request_subscriber.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\event; + /** * @ignore */ @@ -21,11 +23,11 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\EventListener\RouterListener; use Symfony\Component\Routing\RequestContext; -class phpbb_event_kernel_request_subscriber implements EventSubscriberInterface +class kernel_request_subscriber implements EventSubscriberInterface { /** * Extension finder object - * @var phpbb_extension_finder + * @var \phpbb\extension\finder */ protected $finder; @@ -44,11 +46,11 @@ class phpbb_event_kernel_request_subscriber implements EventSubscriberInterface /** * Construct method * - * @param phpbb_extension_finder $finder Extension finder object + * @param \phpbb\extension\finder $finder Extension finder object * @param string $root_path Root path * @param string $php_ext PHP extension */ - public function __construct(phpbb_extension_finder $finder, $root_path, $php_ext) + public function __construct(\phpbb\extension\finder $finder, $root_path, $php_ext) { $this->finder = $finder; $this->root_path = $root_path; @@ -63,14 +65,14 @@ class phpbb_event_kernel_request_subscriber implements EventSubscriberInterface * @param GetResponseEvent $event * @return null */ - public function on_kernel_request(GetResponseEvent $event) + public function on_kernel_request(\GetResponseEvent $event) { $request = $event->getRequest(); - $context = new RequestContext(); + $context = new \RequestContext(); $context->fromRequest($request); $matcher = phpbb_get_url_matcher($this->finder, $context, $this->root_path, $this->php_ext); - $router_listener = new RouterListener($matcher, $context); + $router_listener = new \RouterListener($matcher, $context); $router_listener->onKernelRequest($event); } diff --git a/phpBB/phpbb/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php index 1eaf890e42..aea9d7cc44 100644 --- a/phpBB/phpbb/event/kernel_terminate_subscriber.php +++ b/phpBB/phpbb/event/kernel_terminate_subscriber.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\event; + /** * @ignore */ @@ -19,7 +21,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\PostResponseEvent; -class phpbb_event_kernel_terminate_subscriber implements EventSubscriberInterface +class kernel_terminate_subscriber implements EventSubscriberInterface { /** * This listener is run when the KernelEvents::TERMINATE event is triggered @@ -29,7 +31,7 @@ class phpbb_event_kernel_terminate_subscriber implements EventSubscriberInterfac * @param PostResponseEvent $event * @return null */ - public function on_kernel_terminate(PostResponseEvent $event) + public function on_kernel_terminate(\PostResponseEvent $event) { exit_handler(); } diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php index de18998106..a529cc7961 100644 --- a/phpBB/phpbb/extension/base.php +++ b/phpBB/phpbb/extension/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\extension; + /** * @ignore */ @@ -22,15 +24,15 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * * @package extension */ -class phpbb_extension_base implements phpbb_extension_extension_interface +class base implements \phpbb\extension\extension_interface { /** @var ContainerInterface */ protected $container; - /** @var phpbb_extension_finder */ + /** @var \phpbb\extension\finder */ protected $finder; - /** @var phpbb_db_migrator */ + /** @var \phpbb\db\migrator */ protected $migrator; /** @var string */ @@ -43,11 +45,11 @@ class phpbb_extension_base implements phpbb_extension_extension_interface * Constructor * * @param ContainerInterface $container Container object - * @param phpbb_extension_finder $extension_finder + * @param \phpbb\extension\finder $extension_finder * @param string $extension_name Name of this extension (from ext.manager) * @param string $extension_path Relative path to this extension */ - public function __construct(ContainerInterface $container, phpbb_extension_finder $extension_finder, phpbb_db_migrator $migrator, $extension_name, $extension_path) + public function __construct(ContainerInterface $container, \phpbb\extension\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path) { $this->container = $container; $this->extension_finder = $extension_finder; diff --git a/phpBB/phpbb/extension/exception.php b/phpBB/phpbb/extension/exception.php index e08a8912ea..e2ba647878 100644 --- a/phpBB/phpbb/extension/exception.php +++ b/phpBB/phpbb/extension/exception.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\extension; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) /** * Exception class for metadata */ -class phpbb_extension_exception extends UnexpectedValueException +class exception extends \UnexpectedValueException { public function __toString() { diff --git a/phpBB/phpbb/extension/extension_interface.php b/phpBB/phpbb/extension/extension_interface.php index b922499738..1e5f546dc5 100644 --- a/phpBB/phpbb/extension/extension_interface.php +++ b/phpBB/phpbb/extension/extension_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\extension; + /** * @ignore */ @@ -21,7 +23,7 @@ if (!defined('IN_PHPBB')) * * @package extension */ -interface phpbb_extension_extension_interface +interface extension_interface { /** * enable_step is executed on enabling an extension until it returns false. diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index 1569c90eb8..0ecae7a13f 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\extension; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package extension */ -class phpbb_extension_finder +class finder { protected $extension_manager; protected $filesystem; @@ -50,19 +52,19 @@ class phpbb_extension_finder protected $cached_queries; /** - * Creates a new finder instance with its dependencies + * Creates a new \finder instance with its dependencies * - * @param phpbb_extension_manager $extension_manager An extension manager + * @param \phpbb\extension\manager $extension_manager An extension manager * instance that provides the finder with a list of active * extensions and their locations - * @param phpbb_filesystem $filesystem Filesystem instance + * @param \phpbb\filesystem $filesystem Filesystem instance * @param string $phpbb_root_path Path to the phpbb root directory - * @param phpbb_cache_driver_driver_interface $cache A cache instance or null + * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null * @param string $php_ext php file extension * @param string $cache_name The name of the cache variable, defaults to * _ext_finder */ - public function __construct(phpbb_extension_manager $extension_manager, phpbb_filesystem $filesystem, $phpbb_root_path = '', phpbb_cache_driver_driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') + public function __construct(\phpbb\extension\manager $extension_manager, \phpbb\filesystem $filesystem, $phpbb_root_path = '', \phpbb\cache\driver\driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') { $this->extension_manager = $extension_manager; $this->filesystem = $filesystem; @@ -88,7 +90,7 @@ class phpbb_extension_finder * Sets a core path to be searched in addition to extensions * * @param string $core_path The path relative to phpbb_root_path - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function core_path($core_path) { @@ -104,7 +106,7 @@ class phpbb_extension_finder * file extension is automatically added to suffixes. * * @param string $suffix A filename suffix - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function suffix($suffix) { @@ -121,7 +123,7 @@ class phpbb_extension_finder * file extension is automatically added to suffixes. * * @param string $extension_suffix A filename suffix - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function extension_suffix($extension_suffix) { @@ -137,7 +139,7 @@ class phpbb_extension_finder * file extension is automatically added to suffixes. * * @param string $core_suffix A filename suffix - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function core_suffix($core_suffix) { @@ -149,7 +151,7 @@ class phpbb_extension_finder * Sets the prefix all files found in extensions and core must match * * @param string $prefix A filename prefix - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function prefix($prefix) { @@ -162,7 +164,7 @@ class phpbb_extension_finder * Sets a prefix all files found in extensions must match * * @param string $extension_prefix A filename prefix - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function extension_prefix($extension_prefix) { @@ -174,7 +176,7 @@ class phpbb_extension_finder * Sets a prefix all files found in the core path must match * * @param string $core_prefix A filename prefix - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function core_prefix($core_prefix) { @@ -189,7 +191,7 @@ class phpbb_extension_finder * the current directory. * * @param string $directory - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function directory($directory) { @@ -202,7 +204,7 @@ class phpbb_extension_finder * Sets a directory all files found in extensions must be contained in * * @param string $extension_directory - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function extension_directory($extension_directory) { @@ -214,7 +216,7 @@ class phpbb_extension_finder * Sets a directory all files found in the core path must be contained in * * @param string $core_directory - * @return phpbb_extension_finder This object for chaining calls + * @return \phpbb\extension\finder This object for chaining calls */ public function core_directory($core_directory) { @@ -473,7 +475,7 @@ class phpbb_extension_finder } $directory_pattern = '#' . $directory_pattern . '#'; - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file_info) { $filename = $file_info->getFilename(); diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index f9f722f773..d174146f52 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\extension; + /** * @ignore */ @@ -22,7 +24,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * * @package extension */ -class phpbb_extension_manager +class manager { /** @var ContainerInterface */ protected $container; @@ -40,16 +42,16 @@ class phpbb_extension_manager * Creates a manager and loads information from database * * @param ContainerInterface $container A container - * @param phpbb_db_driver $db A database connection - * @param phpbb_config $config phpbb_config - * @param phpbb_filesystem $filesystem + * @param \phpbb\db\driver\driver $db A database connection + * @param \phpbb\config\config $config \phpbb\config\config + * @param \phpbb\filesystem $filesystem * @param string $extension_table The name of the table holding extensions * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $php_ext php file extension - * @param phpbb_cache_driver_driver_interface $cache A cache instance or null + * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null * @param string $cache_name The name of the cache variable, defaults to _ext */ - public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', phpbb_cache_driver_driver_interface $cache = null, $cache_name = '_ext') + public function __construct(ContainerInterface $container, \phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext') { $this->container = $container; $this->phpbb_root_path = $phpbb_root_path; @@ -126,8 +128,8 @@ class phpbb_extension_manager * Instantiates the extension meta class for the extension with the given name * * @param string $name The extension name - * @return phpbb_extension_extension_interface Instance of the extension meta class or - * phpbb_extension_base if the class does not exist + * @return \phpbb\extension\extension_interface Instance of the extension meta class or + * \phpbb\extension\base if the class does not exist */ public function get_extension($name) { @@ -141,7 +143,7 @@ class phpbb_extension_manager } else { - return new phpbb_extension_base($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true)); + return new \phpbb\extension\base($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true)); } } @@ -150,11 +152,11 @@ class phpbb_extension_manager * * @param string $name The extension name * @param string $template The template manager - * @return phpbb_extension_metadata_manager Instance of the metadata manager + * @return \phpbb\extension\metadata_manager Instance of the metadata manager */ - public function create_extension_metadata_manager($name, phpbb_template $template) + public function create_extension_metadata_manager($name, \phpbb\template\template $template) { - return new phpbb_extension_metadata_manager($name, $this->config, $this, $template, $this->phpbb_root_path); + return new \phpbb\extension\metadata_manager($name, $this->config, $this, $template, $this->phpbb_root_path); } /** @@ -403,9 +405,9 @@ class phpbb_extension_manager return $available; } - $iterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', FilesystemIterator::NEW_CURRENT_AND_KEY | FilesystemIterator::FOLLOW_SYMLINKS), - RecursiveIteratorIterator::SELF_FIRST); + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', \FilesystemIterator::NEW_CURRENT_AND_KEY | \FilesystemIterator::FOLLOW_SYMLINKS), + \RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file_info) { if ($file_info->isFile() && $file_info->getFilename() == 'ext.' . $this->php_ext) @@ -502,12 +504,12 @@ class phpbb_extension_manager } /** - * Instantiates a phpbb_extension_finder. + * Instantiates a \phpbb\extension\finder. * - * @return phpbb_extension_finder An extension finder instance + * @return \phpbb\extension\finder An extension finder instance */ public function get_finder() { - return new phpbb_extension_finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); + return new \phpbb\extension\finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); } } diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 14b77c085b..a77f3a2c6e 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\extension; + /** * @ignore */ @@ -20,23 +22,23 @@ if (!defined('IN_PHPBB')) * * @package extension */ -class phpbb_extension_metadata_manager +class metadata_manager { /** * phpBB Config instance - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * phpBB Extension Manager - * @var phpbb_extension_manager + * @var \phpbb\extension\manager */ protected $extension_manager; /** * phpBB Template instance - * @var phpbb_template + * @var \phpbb\template\template */ protected $template; @@ -68,12 +70,12 @@ class phpbb_extension_metadata_manager * Creates the metadata manager * * @param string $ext_name Name (including vendor) of the extension - * @param phpbb_config $config phpBB Config instance - * @param phpbb_extension_manager $extension_manager An instance of the phpBBb extension manager - * @param phpbb_template $template phpBB Template instance + * @param \phpbb\config\config $config phpBB Config instance + * @param \phpbb\extension\manager $extension_manager An instance of the phpBBb extension manager + * @param \phpbb\template\template $template phpBB Template instance * @param string $phpbb_root_path Path to the phpbb includes directory. */ - public function __construct($ext_name, phpbb_config $config, phpbb_extension_manager $extension_manager, phpbb_template $template, $phpbb_root_path) + public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template, $phpbb_root_path) { $this->config = $config; $this->extension_manager = $extension_manager; @@ -145,7 +147,7 @@ class phpbb_extension_metadata_manager if (!file_exists($this->metadata_file)) { - throw new phpbb_extension_exception('The required file does not exist: ' . $this->metadata_file); + throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file); } } @@ -158,18 +160,18 @@ class phpbb_extension_metadata_manager { if (!file_exists($this->metadata_file)) { - throw new phpbb_extension_exception('The required file does not exist: ' . $this->metadata_file); + throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file); } else { if (!($file_contents = file_get_contents($this->metadata_file))) { - throw new phpbb_extension_exception('file_get_contents failed on ' . $this->metadata_file); + throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file); } if (($metadata = json_decode($file_contents, true)) === NULL) { - throw new phpbb_extension_exception('json_decode failed on ' . $this->metadata_file); + throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file); } $this->metadata = $metadata; @@ -228,12 +230,12 @@ class phpbb_extension_metadata_manager { if (!isset($this->metadata[$name])) { - throw new phpbb_extension_exception("Required meta field '$name' has not been set."); + throw new \phpbb\extension\exception("Required meta field '$name' has not been set."); } if (!preg_match($fields[$name], $this->metadata[$name])) { - throw new phpbb_extension_exception("Meta field '$name' is invalid."); + throw new \phpbb\extension\exception("Meta field '$name' is invalid."); } } break; @@ -251,14 +253,14 @@ class phpbb_extension_metadata_manager { if (empty($this->metadata['authors'])) { - throw new phpbb_extension_exception("Required meta field 'authors' has not been set."); + throw new \phpbb\extension\exception("Required meta field 'authors' has not been set."); } foreach ($this->metadata['authors'] as $author) { if (!isset($author['name'])) { - throw new phpbb_extension_exception("Required meta field 'author name' has not been set."); + throw new \phpbb\extension\exception("Required meta field 'author name' has not been set."); } } diff --git a/phpBB/phpbb/extension/provider.php b/phpBB/phpbb/extension/provider.php index 45b55e5cab..c2a264d311 100644 --- a/phpBB/phpbb/extension/provider.php +++ b/phpBB/phpbb/extension/provider.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\extension; + /** * @ignore */ @@ -28,7 +30,7 @@ if (!defined('IN_PHPBB')) * * @package extension */ -abstract class phpbb_extension_provider implements IteratorAggregate +abstract class provider implements \IteratorAggregate { /** * Array holding all found items @@ -38,16 +40,16 @@ abstract class phpbb_extension_provider implements IteratorAggregate /** * An extension manager to search for items in extensions - * @var phpbb_extension_manager + * @var \phpbb\extension\manager */ protected $extension_manager; /** * Constructor. Loads all available items. * - * @param phpbb_extension_manager $extension_manager phpBB extension manager + * @param \phpbb\extension\manager $extension_manager phpBB extension manager */ - public function __construct(phpbb_extension_manager $extension_manager) + public function __construct(\phpbb\extension\manager $extension_manager) { $this->extension_manager = $extension_manager; } @@ -71,6 +73,6 @@ abstract class phpbb_extension_provider implements IteratorAggregate $this->items = $this->find(); } - return new ArrayIterator($this->items); + return new \ArrayIterator($this->items); } } diff --git a/phpBB/phpbb/feed/base.php b/phpBB/phpbb/feed/base.php index 9a38e604a3..de7dd41df4 100644 --- a/phpBB/phpbb/feed/base.php +++ b/phpBB/phpbb/feed/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -20,27 +22,27 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -abstract class phpbb_feed_base +abstract class base { /** * Feed helper object - * @var phpbb_feed_helper + * @var \phpbb\feed\helper */ protected $helper; - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $config; - /** @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_user */ + /** @var \phpbb\user */ protected $user; - /** @var phpbb_auth */ + /** @var \phpbb\auth\auth */ protected $auth; /** @var string */ @@ -74,17 +76,17 @@ abstract class phpbb_feed_base /** * Constructor * - * @param phpbb_feed_helper $helper Feed helper - * @param phpbb_config $config Config object - * @param phpbb_db_driver $db Database connection - * @param phpbb_cache_driver_driver_interface $cache Cache object - * @param phpbb_user $user User object - * @param phpbb_auth $auth Auth object - * @param phpbb_content_visibility $content_visibility Auth object + * @param \phpbb\feed\helper $helper Feed helper + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\cache\driver\driver_interface $cache Cache object + * @param \phpbb\user $user User object + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\content_visibility $content_visibility Auth object * @param string $phpEx php file extension * @return null */ - function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, phpbb_content_visibility $content_visibility, $phpEx) + function __construct(\phpbb\feed\helper $helper, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, $phpEx) { $this->config = $config; $this->helper = $helper; diff --git a/phpBB/phpbb/feed/factory.php b/phpBB/phpbb/feed/factory.php index 63a1eb8ef0..e011b0e3a9 100644 --- a/phpBB/phpbb/feed/factory.php +++ b/phpBB/phpbb/feed/factory.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Factory class to return correct object * @package phpBB3 */ -class phpbb_feed_factory +class factory { /** * Service container object @@ -27,21 +29,21 @@ class phpbb_feed_factory */ protected $container; - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $config; - /** @var phpbb_db_driver */ + /** @var \phpbb\db\driver\driver */ protected $db; /** * Constructor * * @param objec $container Container object - * @param phpbb_config $config Config object - * @param phpbb_db_driver $db Database connection + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver $db Database connection * @return null */ - public function __construct($container, phpbb_config $config, phpbb_db_driver $db) + public function __construct($container, \phpbb\config\config $config, \phpbb\db\driver\driver $db) { $this->container = $container; $this->config = $config; diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index b5f0dd0f8f..5f64d85625 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -23,7 +25,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_feed_forum extends phpbb_feed_post_base +class forum extends \phpbb\feed\post_base { var $forum_id = 0; var $forum_data = array(); @@ -32,7 +34,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base * Set the Forum ID * * @param int $forum_id Forum ID - * @return phpbb_feed_forum + * @return \phpbb\feed\forum */ public function set_forum_id($topic_id) { diff --git a/phpBB/phpbb/feed/forums.php b/phpBB/phpbb/feed/forums.php index 409097a9f3..6be1c68da8 100644 --- a/phpBB/phpbb/feed/forums.php +++ b/phpBB/phpbb/feed/forums.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -23,7 +25,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_feed_forums extends phpbb_feed_base +class forums extends \phpbb\feed\base { var $num_items = 0; diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php index 93330aa2ad..cf8328bd5e 100644 --- a/phpBB/phpbb/feed/helper.php +++ b/phpBB/phpbb/feed/helper.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -19,12 +21,12 @@ if (!defined('IN_PHPBB')) * Class with some helpful functions used in feeds * @package phpBB3 */ -class phpbb_feed_helper +class helper { - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $config; - /** @var phpbb_user */ + /** @var \phpbb\user */ protected $user; /** @var string */ @@ -33,12 +35,12 @@ class phpbb_feed_helper /** * Constructor * - * @param phpbb_config $config Config object - * @param phpbb_user $user User object + * @param \phpbb\config\config $config Config object + * @param \phpbb\user $user User object * @param string $phpbb_root_path Root path * @return null */ - public function __construct(phpbb_config $config, phpbb_user $user, $phpbb_root_path) + public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path) { $this->config = $config; $this->user = $user; diff --git a/phpBB/phpbb/feed/news.php b/phpBB/phpbb/feed/news.php index f2d45b5165..20017a3248 100644 --- a/phpBB/phpbb/feed/news.php +++ b/phpBB/phpbb/feed/news.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -23,7 +25,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_feed_news extends phpbb_feed_topic_base +class news extends \phpbb\feed\topic_base { function get_news_forums() { diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php index 869df7cde0..7a0973a027 100644 --- a/phpBB/phpbb/feed/overall.php +++ b/phpBB/phpbb/feed/overall.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -23,7 +25,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_feed_overall extends phpbb_feed_post_base +class overall extends \phpbb\feed\post_base { function get_sql() { diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php index 1f4cb4b5ef..5588ecadb0 100644 --- a/phpBB/phpbb/feed/post_base.php +++ b/phpBB/phpbb/feed/post_base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -abstract class phpbb_feed_post_base extends phpbb_feed_base +abstract class post_base extends \phpbb\feed\base { var $num_items = 'feed_limit_post'; diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 36f958ac60..b5714e434b 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_feed_topic extends phpbb_feed_post_base +class topic extends \phpbb\feed\post_base { var $topic_id = 0; var $forum_id = 0; @@ -32,7 +34,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base * Set the Topic ID * * @param int $topic_id Topic ID - * @return phpbb_feed_topic + * @return \phpbb\feed\topic */ public function set_topic_id($topic_id) { diff --git a/phpBB/phpbb/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php index b104a46631..f05be9223e 100644 --- a/phpBB/phpbb/feed/topic_base.php +++ b/phpBB/phpbb/feed/topic_base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -abstract class phpbb_feed_topic_base extends phpbb_feed_base +abstract class topic_base extends \phpbb\feed\base { var $num_items = 'feed_limit_topic'; diff --git a/phpBB/phpbb/feed/topics.php b/phpBB/phpbb/feed/topics.php index 31f5177773..d70195c87b 100644 --- a/phpBB/phpbb/feed/topics.php +++ b/phpBB/phpbb/feed/topics.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -23,7 +25,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_feed_topics extends phpbb_feed_topic_base +class topics extends \phpbb\feed\topic_base { function get_sql() { diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php index 249dd1d66a..c6f46d67e6 100644 --- a/phpBB/phpbb/feed/topics_active.php +++ b/phpBB/phpbb/feed/topics_active.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\feed; + /** * @ignore */ @@ -24,7 +26,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_feed_topics_active extends phpbb_feed_topic_base +class topics_active extends \phpbb\feed\topic_base { var $sort_days = 7; diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 27cab48fb0..827e9fb139 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -6,6 +6,8 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ + +namespace phpbb; /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) * A class with various functions that are related to paths, files and the filesystem * @package phpBB3 */ -class phpbb_filesystem +class filesystem { /** * Eliminates useless . and .. components from specified path. diff --git a/phpBB/phpbb/groupposition/exception.php b/phpBB/phpbb/groupposition/exception.php index e4ff09c703..3a8d92dbc7 100644 --- a/phpBB/phpbb/groupposition/exception.php +++ b/phpBB/phpbb/groupposition/exception.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\groupposition; + /** * @ignore */ @@ -18,6 +20,6 @@ if (!defined('IN_PHPBB')) /** * @package groupposition */ -class phpbb_groupposition_exception extends \Exception +class exception extends \Exception { } diff --git a/phpBB/phpbb/groupposition/groupposition_interface.php b/phpBB/phpbb/groupposition/groupposition_interface.php index 0f29984588..a568785185 100644 --- a/phpBB/phpbb/groupposition/groupposition_interface.php +++ b/phpBB/phpbb/groupposition/groupposition_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\groupposition; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -interface phpbb_groupposition_groupposition_interface +interface groupposition_interface { /** * Returns the value for a given group, if the group exists. diff --git a/phpBB/phpbb/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php index 5cbc26f528..9a1ef3d1d0 100644 --- a/phpBB/phpbb/groupposition/legend.php +++ b/phpBB/phpbb/groupposition/legend.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\groupposition; + /** * @ignore */ @@ -23,7 +25,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_groupposition_legend implements phpbb_groupposition_groupposition_interface +class legend implements \phpbb\groupposition\groupposition_interface { /** * Group is not displayed @@ -32,23 +34,23 @@ class phpbb_groupposition_legend implements phpbb_groupposition_groupposition_in /** * Database object - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; /** * Constructor * - * @param phpbb_db_driver $db Database object - * @param phpbb_user $user User object + * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\user $user User object */ - public function __construct(phpbb_db_driver $db, phpbb_user $user) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user) { $this->db = $db; $this->user = $user; @@ -71,7 +73,7 @@ class phpbb_groupposition_legend implements phpbb_groupposition_groupposition_in if ($current_value === false) { // Group not found. - throw new phpbb_groupposition_exception('NO_GROUP'); + throw new \phpbb\groupposition\exception('NO_GROUP'); } return (int) $current_value; diff --git a/phpBB/phpbb/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php index 6a0601da63..4cd2ae7fa8 100644 --- a/phpBB/phpbb/groupposition/teampage.php +++ b/phpBB/phpbb/groupposition/teampage.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\groupposition; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_interface +class teampage implements \phpbb\groupposition\groupposition_interface { /** * Group is not displayed @@ -36,30 +38,30 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ /** * Database object - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; /** * Cache object - * @var phpbb_cache_driver_driver_interface + * @var \phpbb\cache\driver\driver_interface */ protected $cache; /** * Constructor * - * @param phpbb_db_driver $db Database object - * @param phpbb_user $user User object - * @param phpbb_cache_driver_driver_interface $cache Cache object + * @param \phpbb\db\driver\driver $db Database object + * @param \phpbb\user $user User object + * @param \phpbb\cache\driver\driver_interface $cache Cache object */ - public function __construct(phpbb_db_driver $db, phpbb_user $user, phpbb_cache_driver_driver_interface $cache) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache) { $this->db = $db; $this->user = $user; @@ -86,7 +88,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ if ($row === false) { // Group not found. - throw new phpbb_groupposition_exception('NO_GROUP'); + throw new \phpbb\groupposition\exception('NO_GROUP'); } return (int) $row['teampage_position']; @@ -113,7 +115,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ if ($row === false) { // Group not found. - throw new phpbb_groupposition_exception('NO_GROUP'); + throw new \phpbb\groupposition\exception('NO_GROUP'); } return $row; @@ -137,7 +139,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ if ($current_value === false) { // Group not found. - throw new phpbb_groupposition_exception('NO_GROUP'); + throw new \phpbb\groupposition\exception('NO_GROUP'); } return (int) $current_value; @@ -161,7 +163,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ if ($row === false) { // Group not found. - throw new phpbb_groupposition_exception('NO_GROUP'); + throw new \phpbb\groupposition\exception('NO_GROUP'); } return $row; @@ -261,7 +263,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ } /** - * Adds a new category + * Adds a new \category * * @param string $category_name Name of the category to be added * @return bool True if the category was added successfully @@ -431,7 +433,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ $sibling_count = 0; $sibling_limit = $delta; - // Reset the delta, as we recalculate the new real delta + // Reset the delta, as we recalculate the new \real delta $delta = 0; while ($row = $this->db->sql_fetchrow($result)) { @@ -519,7 +521,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_groupposition_ $sibling_count = 0; $sibling_limit = $delta; - // Reset the delta, as we recalculate the new real delta + // Reset the delta, as we recalculate the new \real delta $delta = 0; while ($row = $this->db->sql_fetchrow($result)) { diff --git a/phpBB/phpbb/hook/finder.php b/phpBB/phpbb/hook/finder.php index 3f9758211d..7783efd0c7 100644 --- a/phpBB/phpbb/hook/finder.php +++ b/phpBB/phpbb/hook/finder.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\hook; + /** * @ignore */ @@ -20,20 +22,20 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_hook_finder +class finder { protected $phpbb_root_path; protected $cache; protected $php_ext; /** - * Creates a new finder instance. + * Creates a new \finder instance. * * @param string $phpbb_root_path Path to the phpbb root directory * @param string $php_ext php file extension - * @param phpbb_cache_driver_driver_interface $cache A cache instance or null + * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null */ - public function __construct($phpbb_root_path, $php_ext, phpbb_cache_driver_driver_interface $cache = null) + public function __construct($phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null) { $this->phpbb_root_path = $phpbb_root_path; $this->cache = $cache; diff --git a/phpBB/phpbb/json_response.php b/phpBB/phpbb/json_response.php index 5dd904da09..fe532fc9d4 100644 --- a/phpBB/phpbb/json_response.php +++ b/phpBB/phpbb/json_response.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * JSON class * @package phpBB3 */ -class phpbb_json_response +class json_response { /** * Send the data to the client and exit the script. diff --git a/phpBB/phpbb/lock/db.php b/phpBB/phpbb/lock/db.php index 5cc0821aa0..3e15727c12 100644 --- a/phpBB/phpbb/lock/db.php +++ b/phpBB/phpbb/lock/db.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\lock; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Database locking class * @package phpBB3 */ -class phpbb_lock_db +class db { /** * Name of the config variable this lock uses @@ -42,13 +44,13 @@ class phpbb_lock_db /** * The phpBB configuration - * @var phpbb_config + * @var \phpbb\config\config */ private $config; /** * A database connection - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ private $db; @@ -59,9 +61,9 @@ class phpbb_lock_db * * @param string $config_name A config variable to be used for locking * @param array $config The phpBB configuration - * @param phpbb_db_driver $db A database connection + * @param \phpbb\db\driver\driver $db A database connection */ - public function __construct($config_name, phpbb_config $config, phpbb_db_driver $db) + public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver $db) { $this->config_name = $config_name; $this->config = $config; diff --git a/phpBB/phpbb/lock/flock.php b/phpBB/phpbb/lock/flock.php index 17de0847c0..2a36a853ee 100644 --- a/phpBB/phpbb/lock/flock.php +++ b/phpBB/phpbb/lock/flock.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\lock; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * File locking class * @package phpBB3 */ -class phpbb_lock_flock +class flock { /** * Path to the file to which access is controlled diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 0a755b5c78..7f4e52ed39 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -1,12 +1,14 @@ set_is_admin((defined('ADMIN_START') && ADMIN_START) || (defined('IN_ADMIN') && IN_ADMIN)); $this->enable(); diff --git a/phpBB/phpbb/log/log_interface.php b/phpBB/phpbb/log/log_interface.php index 2d41c9994f..427d30015d 100644 --- a/phpBB/phpbb/log/log_interface.php +++ b/phpBB/phpbb/log/log_interface.php @@ -1,12 +1,14 @@ 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( diff --git a/phpBB/phpbb/notification/method/base.php b/phpBB/phpbb/notification/method/base.php index fbff75b59f..327f964424 100644 --- a/phpBB/phpbb/notification/method/base.php +++ b/phpBB/phpbb/notification/method/base.php @@ -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; } diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index 571b0ec656..b761eb5a28 100644 --- a/phpBB/phpbb/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php @@ -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 diff --git a/phpBB/phpbb/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php index d3b756d020..6ec21bb735 100644 --- a/phpBB/phpbb/notification/method/jabber.php +++ b/phpBB/phpbb/notification/method/jabber.php @@ -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 diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 4966aa94bc..b1b30f29b7 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -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 diff --git a/phpBB/phpbb/notification/method/method_interface.php b/phpBB/phpbb/notification/method/method_interface.php index bd21d924e4..0131a8bde0 100644 --- a/phpBB/phpbb/notification/method/method_interface.php +++ b/phpBB/phpbb/notification/method/method_interface.php @@ -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 diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index 1a30781c35..cf4ec57989 100644 --- a/phpBB/phpbb/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php @@ -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 diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index e728e9ac30..ca5bb67754 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -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 diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index a7434fc9a7..1605f59c55 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -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, diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index ae2e75d3eb..5b021eb71a 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -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); diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index 951c7e0254..0c9162ec5c 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -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 diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index 038e528797..dde6f83ec4 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -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 diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index b3db7ad5ad..bed0807b0f 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -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 diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 9207fd866e..24ce0cc145 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -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); diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php index bc4b15cdc3..f05ed1ce9a 100644 --- a/phpBB/phpbb/notification/type/post_in_queue.php +++ b/phpBB/phpbb/notification/type/post_in_queue.php @@ -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 diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 0ed13f36fb..d59f7caf8e 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -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 diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 3fa73bab41..fd3f754f8a 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -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 diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index 63dfa92064..2e4a1ceb30 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -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 diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index de5c54a291..c2dad6f1bb 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -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 diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index 3916cd8db7..270ccf0a1a 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -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 diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 22436d3fb1..9042a21017 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -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 diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php index f735e10c00..056651bc53 100644 --- a/phpBB/phpbb/notification/type/topic_in_queue.php +++ b/phpBB/phpbb/notification/type/topic_in_queue.php @@ -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 diff --git a/phpBB/phpbb/notification/type/type_interface.php b/phpBB/phpbb/notification/type/type_interface.php index f9c65f7286..cfc6cd461e 100644 --- a/phpBB/phpbb/notification/type/type_interface.php +++ b/phpBB/phpbb/notification/type/type_interface.php @@ -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 diff --git a/phpBB/phpbb/php/ini.php b/phpBB/phpbb/php/ini.php index 17e8c54a57..8767091aba 100644 --- a/phpBB/phpbb/php/ini.php +++ b/phpBB/phpbb/php/ini.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\php; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB */ -class phpbb_php_ini +class ini { /** * Simple wrapper for ini_get() diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php index 9ca0f462b4..4d4417229e 100644 --- a/phpBB/phpbb/request/deactivated_super_global.php +++ b/phpBB/phpbb/request/deactivated_super_global.php @@ -1,12 +1,14 @@ request = $request; $this->name = $name; @@ -84,7 +86,7 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable, } /**#@+ - * Part of the ArrayAccess implementation, will always result in a FATAL error. + * Part of the \ArrayAccess implementation, will always result in a FATAL error. */ public function offsetGet($offset) { @@ -103,7 +105,7 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable, /**#@-*/ /** - * Part of the Countable implementation, will always result in a FATAL error + * Part of the \Countable implementation, will always result in a FATAL error */ public function count() { diff --git a/phpBB/phpbb/request/request.php b/phpBB/phpbb/request/request.php index 8c5bc12d96..b36ac3711a 100644 --- a/phpBB/phpbb/request/request.php +++ b/phpBB/phpbb/request/request.php @@ -1,12 +1,14 @@ '_POST', - phpbb_request_request_interface::GET => '_GET', - phpbb_request_request_interface::REQUEST => '_REQUEST', - phpbb_request_request_interface::COOKIE => '_COOKIE', - phpbb_request_request_interface::SERVER => '_SERVER', - phpbb_request_request_interface::FILES => '_FILES', + \phpbb\request\request_interface::POST => '_POST', + \phpbb\request\request_interface::GET => '_GET', + \phpbb\request\request_interface::REQUEST => '_REQUEST', + \phpbb\request\request_interface::COOKIE => '_COOKIE', + \phpbb\request\request_interface::SERVER => '_SERVER', + \phpbb\request\request_interface::FILES => '_FILES', ); /** @@ -53,15 +55,15 @@ class phpbb_request implements phpbb_request_request_interface protected $input; /** - * @var phpbb_request_type_cast_helper_interface An instance of a type cast helper providing convenience methods for type conversions. + * @var \phpbb\request\type_cast_helper_interface An instance of a type cast helper providing convenience methods for type conversions. */ protected $type_cast_helper; /** * Initialises the request class, that means it stores all input data in {@link $input input} - * and then calls {@link phpbb_request_deactivated_super_global phpbb_request_deactivated_super_global} + * and then calls {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global} */ - public function __construct(phpbb_request_type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true) + public function __construct(\phpbb\request\type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true) { if ($type_cast_helper) { @@ -69,7 +71,7 @@ class phpbb_request implements phpbb_request_request_interface } else { - $this->type_cast_helper = new phpbb_request_type_cast_helper(); + $this->type_cast_helper = new \phpbb\request\type_cast_helper(); } foreach ($this->super_globals as $const => $super_global) @@ -78,8 +80,8 @@ class phpbb_request implements phpbb_request_request_interface } // simulate request_order = GP - $this->original_request = $this->input[phpbb_request_request_interface::REQUEST]; - $this->input[phpbb_request_request_interface::REQUEST] = $this->input[phpbb_request_request_interface::POST] + $this->input[phpbb_request_request_interface::GET]; + $this->original_request = $this->input[\phpbb\request\request_interface::REQUEST]; + $this->input[\phpbb\request\request_interface::REQUEST] = $this->input[\phpbb\request\request_interface::POST] + $this->input[\phpbb\request\request_interface::GET]; if ($disable_super_globals) { @@ -99,7 +101,7 @@ class phpbb_request implements phpbb_request_request_interface /** * Disables access of super globals specified in $super_globals. - * This is achieved by overwriting the super globals with instances of {@link phpbb_request_deactivated_super_global phpbb_request_deactivated_super_global} + * This is achieved by overwriting the super globals with instances of {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global} */ public function disable_super_globals() { @@ -108,7 +110,7 @@ class phpbb_request implements phpbb_request_request_interface foreach ($this->super_globals as $const => $super_global) { unset($GLOBALS[$super_global]); - $GLOBALS[$super_global] = new phpbb_request_deactivated_super_global($this, $super_global, $const); + $GLOBALS[$super_global] = new \phpbb\request\deactivated_super_global($this, $super_global, $const); } $this->super_globals_disabled = true; @@ -144,10 +146,10 @@ class phpbb_request implements phpbb_request_request_interface * @param string $var_name The name of the variable that shall be overwritten * @param mixed $value The value which the variable shall contain. * If this is null the variable will be unset. - * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global shall be changed */ - public function overwrite($var_name, $value, $super_global = phpbb_request_request_interface::REQUEST) + public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST) { if (!isset($this->super_globals[$super_global])) { @@ -193,13 +195,13 @@ class phpbb_request implements phpbb_request_request_interface * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global should be used * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST) + public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST) { return $this->_variable($var_name, $default, $multibyte, $super_global, true); } @@ -217,13 +219,13 @@ class phpbb_request implements phpbb_request_request_interface * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global should be used * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - public function untrimmed_variable($var_name, $default, $multibyte, $super_global = phpbb_request_request_interface::REQUEST) + public function untrimmed_variable($var_name, $default, $multibyte, $super_global = \phpbb\request\request_interface::REQUEST) { return $this->_variable($var_name, $default, $multibyte, $super_global, false); } @@ -234,8 +236,8 @@ class phpbb_request implements phpbb_request_request_interface * Also fall back to getenv(), some CGI setups may need it (probably not, but * whatever). * - * @param string|array $var_name See phpbb_request_request_interface::variable - * @param mixed $Default See phpbb_request_request_interface::variable + * @param string|array $var_name See \phpbb\request\request_interface::variable + * @param mixed $Default See \phpbb\request\request_interface::variable * * @return mixed The server variable value. */ @@ -243,9 +245,9 @@ class phpbb_request implements phpbb_request_request_interface { $multibyte = true; - if ($this->is_set($var_name, phpbb_request_request_interface::SERVER)) + if ($this->is_set($var_name, \phpbb\request\request_interface::SERVER)) { - return $this->variable($var_name, $default, $multibyte, phpbb_request_request_interface::SERVER); + return $this->variable($var_name, $default, $multibyte, \phpbb\request\request_interface::SERVER); } else { @@ -259,7 +261,7 @@ class phpbb_request implements phpbb_request_request_interface * Shortcut method to retrieve the value of client HTTP headers. * * @param string|array $header_name The name of the header to retrieve. - * @param mixed $default See phpbb_request_request_interface::variable + * @param mixed $default See \phpbb\request\request_interface::variable * * @return mixed The header value. */ @@ -279,7 +281,7 @@ class phpbb_request implements phpbb_request_request_interface */ public function file($form_name) { - return $this->variable($form_name, array('name' => 'none'), false, phpbb_request_request_interface::FILES); + return $this->variable($form_name, array('name' => 'none'), false, \phpbb\request\request_interface::FILES); } /** @@ -294,7 +296,7 @@ class phpbb_request implements phpbb_request_request_interface */ public function is_set_post($name) { - return $this->is_set($name, phpbb_request_request_interface::POST); + return $this->is_set($name, \phpbb\request\request_interface::POST); } /** @@ -302,12 +304,12 @@ class phpbb_request implements phpbb_request_request_interface * arrays. * * @param string $var Name of the variable - * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies the super global which shall be checked * * @return bool True if the variable was sent as input */ - public function is_set($var, $super_global = phpbb_request_request_interface::REQUEST) + public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST) { return isset($this->input[$super_global][$var]); } @@ -335,13 +337,13 @@ class phpbb_request implements phpbb_request_request_interface /** * Returns all variable names for a given super global * - * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global * The super global from which names shall be taken * * @return array All variable names that are set for the super global. * Pay attention when using these, they are unsanitised! */ - public function variable_names($super_global = phpbb_request_request_interface::REQUEST) + public function variable_names($super_global = \phpbb\request\request_interface::REQUEST) { if (!isset($this->input[$super_global])) { @@ -362,14 +364,14 @@ class phpbb_request implements phpbb_request_request_interface * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks - * @param phpbb_request_request_interface::POST|GET|REQUEST|COOKIE $super_global + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global * Specifies which super global should be used * @param bool $trim Indicates whether trim() should be applied to string values. * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ - protected function _variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_request_interface::REQUEST, $trim = true) + protected function _variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST, $trim = true) { $path = false; diff --git a/phpBB/phpbb/request/request_interface.php b/phpBB/phpbb/request/request_interface.php index 2c804cd7fd..3281e1ca03 100644 --- a/phpBB/phpbb/request/request_interface.php +++ b/phpBB/phpbb/request/request_interface.php @@ -1,12 +1,14 @@ get('_search_results_' . $search_key))) { diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 7dc4da8ffe..8663af5969 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * Fulltext search for MySQL * @package search */ -class phpbb_search_fulltext_mysql extends phpbb_search_base +class fulltext_mysql extends \phpbb\search\base { /** * Associative array holding index stats @@ -36,19 +38,19 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base /** * Config object - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * Database connection - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -74,7 +76,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base /** * Constructor - * Creates a new phpbb_search_fulltext_mysql, which is used as a search backend + * Creates a new \phpbb\search\fulltext_mysql, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false */ @@ -701,7 +703,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base } /** - * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated + * Destroys cached search results, that contained one of the new \words in a post so the results won't be outdated * * @param string $mode contains the post mode: edit, post, reply, quote ... * @param int $post_id contains the post id of the post to index @@ -712,7 +714,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base */ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) { - // Split old and new post/subject to obtain array of words + // Split old and new \post/subject to obtain array of words $split_text = $this->split_message($message); $split_title = ($subject) ? $this->split_message($subject) : array(); diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 730c3a6c2d..006b88e07a 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * phpBB's own db driven fulltext search, version 2 * @package search */ -class phpbb_search_fulltext_native extends phpbb_search_base +class fulltext_native extends \phpbb\search\base { /** * Associative array holding index stats @@ -80,19 +82,19 @@ class phpbb_search_fulltext_native extends phpbb_search_base /** * Config object - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * Database connection - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -1222,7 +1224,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base return; } - // Split old and new post/subject to obtain array of 'words' + // Split old and new \post/subject to obtain array of 'words' $split_text = $this->split_message($message); $split_title = $this->split_message($subject); @@ -1269,7 +1271,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base // We now have unique arrays of all words to be added and removed and // individual arrays of added and removed words for text and title. What - // we need to do now is add the new words (if they don't already exist) + // we need to do now is add the new \words (if they don't already exist) // and then add (or remove) matches between the words and this post if (sizeof($unique_add_words)) { @@ -1306,7 +1308,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $this->db->sql_transaction('begin'); } - // now update the search match table, remove links to removed words and add links to new words + // now update the search match table, remove links to removed words and add links to new \words foreach ($words['del'] as $word_in => $word_ary) { $title_match = ($word_in == 'title') ? 1 : 0; @@ -1466,7 +1468,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base WHERE ' . $this->db->sql_in_set('word_id', $sql_in); $this->db->sql_query($sql); - // by setting search_last_gc to the new time here we make sure that if a user reloads because the + // by setting search_last_gc to the new \time here we make sure that if a user reloads because the // following query takes too long, he won't run into it again set_config('search_last_gc', time(), true); @@ -1556,7 +1558,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * @param string $encoding Text encoding * @return string Cleaned up text, only alphanumeric chars are left * - * @todo normalizer::cleanup being able to be used? + * @todo \normalizer::cleanup being able to be used? */ protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') { @@ -1588,7 +1590,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * If we use it more widely, an instance of that class should be held in a * a global variable instead */ - utf_normalizer::nfc($text); + \utf_normalizer::nfc($text); /** * The first thing we do is: diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 6b4b310f2e..ba9215fcfd 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * Fulltext search for PostgreSQL * @package search */ -class phpbb_search_fulltext_postgres extends phpbb_search_base +class fulltext_postgres extends \phpbb\search\base { /** * Associative array holding index stats @@ -61,19 +63,19 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base /** * Config object - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * Database connection - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -99,7 +101,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base /** * Constructor - * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend + * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false */ @@ -731,7 +733,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base } /** - * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated + * Destroys cached search results, that contained one of the new \words in a post so the results won't be outdated * * @param string $mode contains the post mode: edit, post, reply, quote ... * @param int $post_id contains the post id of the post to index @@ -742,7 +744,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base */ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) { - // Split old and new post/subject to obtain array of words + // Split old and new \post/subject to obtain array of words $split_text = $this->split_message($message); $split_title = ($subject) ? $this->split_message($subject) : array(); diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 4f3f852664..81cb31e6e2 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search; + /** */ if (!defined('IN_PHPBB')) @@ -26,7 +28,7 @@ define('SPHINX_CONNECT_WAIT_TIME', 300); * Fulltext search based on the sphinx search deamon * @package search */ -class phpbb_search_fulltext_sphinx +class fulltext_sphinx { /** * Associative array holding index stats @@ -73,25 +75,25 @@ class phpbb_search_fulltext_sphinx /** * Auth object - * @var phpbb_auth + * @var \phpbb\auth\auth */ protected $auth; /** * Config object - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * Database connection - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * Database Tools object - * @var phpbb_db_tools + * @var \phpbb\db\tools */ protected $db_tools; @@ -103,7 +105,7 @@ class phpbb_search_fulltext_sphinx /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -122,7 +124,7 @@ class phpbb_search_fulltext_sphinx /** * Constructor - * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend + * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend * * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false */ @@ -135,8 +137,8 @@ class phpbb_search_fulltext_sphinx $this->db = $db; $this->auth = $auth; - // Initialize phpbb_db_tools object - $this->db_tools = new phpbb_db_tools($this->db); + // Initialize \phpbb\db\tools object + $this->db_tools = new \phpbb\db\tools($this->db); if(!$this->config['fulltext_sphinx_id']) { @@ -151,7 +153,7 @@ class phpbb_search_fulltext_sphinx } // Initialize sphinx client - $this->sphinx = new SphinxClient(); + $this->sphinx = new \SphinxClient(); $this->sphinx->SetServer(($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost'), ($this->config['fulltext_sphinx_port'] ? (int) $this->config['fulltext_sphinx_port'] : 9312)); @@ -250,7 +252,7 @@ class phpbb_search_fulltext_sphinx /* Now that we're sure everything was entered correctly, generate a config for the index. We use a config value fulltext_sphinx_id for this, as it should be unique. */ - $config_object = new phpbb_search_sphinx_config($this->config_file_data); + $config_object = new \phpbb\search\sphinx\config($this->config_file_data); $config_data = array( 'source source_phpbb_' . $this->id . '_main' => array( array('type', $this->dbtype . ' # mysql or pgsql'), @@ -420,7 +422,7 @@ class phpbb_search_fulltext_sphinx $this->sphinx->SetMatchMode(SPH_MATCH_ANY); } - // Keep quotes and new lines + // Keep quotes and new \lines $keywords = str_replace(array('"', "\n"), array('"', ' '), trim($keywords)); if (strlen($keywords) > 0) diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index f1864f0c8c..2468022428 100644 --- a/phpBB/phpbb/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search\sphinx; + /** * @ignore */ @@ -16,12 +18,12 @@ if (!defined('IN_PHPBB')) } /** -* phpbb_search_sphinx_config +* \phpbb\search\sphinx\config * An object representing the sphinx configuration * Can read it from file and write it back out after modification * @package search */ -class phpbb_search_sphinx_config +class config { private $sections = array(); @@ -44,7 +46,7 @@ class phpbb_search_sphinx_config * Get a section object by its name * * @param string $name The name of the section that shall be returned - * @return phpbb_search_sphinx_config_section The section object or null if none was found + * @return \phpbb\search\sphinx\config_section The section object or null if none was found * * @access public */ @@ -53,7 +55,7 @@ class phpbb_search_sphinx_config for ($i = 0, $size = sizeof($this->sections); $i < $size; $i++) { // Make sure this is really a section object and not a comment - if (($this->sections[$i] instanceof phpbb_search_sphinx_config_section) && $this->sections[$i]->get_name() == $name) + if (($this->sections[$i] instanceof \phpbb\search\sphinx\config_section) && $this->sections[$i]->get_name() == $name) { return $this->sections[$i]; } @@ -61,16 +63,16 @@ class phpbb_search_sphinx_config } /** - * Appends a new empty section to the end of the config + * Appends a new \empty section to the end of the config * - * @param string $name The name for the new section - * @return phpbb_search_sphinx_config_section The newly created section object + * @param string $name The name for the new \section + * @return \phpbb\search\sphinx\config_section The newly created section object * * @access public */ function add_section($name) { - $this->sections[] = new phpbb_search_sphinx_config_section($name, ''); + $this->sections[] = new \phpbb\search\sphinx\config_section($name, ''); return $this->sections[sizeof($this->sections) - 1]; } @@ -109,7 +111,7 @@ class phpbb_search_sphinx_config // that way they're not deleted when reassembling the file from the sections if (!$line || $line[0] == '#') { - $this->sections[] = new phpbb_search_sphinx_config_comment($config_file[$i]); + $this->sections[] = new \phpbb\search\sphinx\config_comment($config_file[$i]); continue; } else @@ -141,9 +143,9 @@ class phpbb_search_sphinx_config $section_name .= $line[$j]; } - // And then we create the new section object + // And then we create the new \section object $section_name = trim($section_name); - $section = new phpbb_search_sphinx_config_section($section_name, $section_name_comment); + $section = new \phpbb\search\sphinx\config_section($section_name, $section_name_comment); } } else @@ -158,7 +160,7 @@ class phpbb_search_sphinx_config // of this section so they're not deleted on reassembly if (!$line || $line[0] == '#') { - $section->add_variable(new phpbb_search_sphinx_config_comment($config_file[$i])); + $section->add_variable(new \phpbb\search\sphinx\config_comment($config_file[$i])); continue; } @@ -174,7 +176,7 @@ class phpbb_search_sphinx_config } else { - $section->add_variable(new phpbb_search_sphinx_config_comment($config_file[$i])); + $section->add_variable(new \phpbb\search\sphinx\config_comment($config_file[$i])); continue; } } @@ -240,10 +242,10 @@ class phpbb_search_sphinx_config } // If a name and an equal sign were found then we have append a - // new variable object to the section + // new \variable object to the section if ($name && $found_assignment) { - $section->add_variable(new phpbb_search_sphinx_config_variable(trim($name), trim($value), ($end_section) ? '' : $comment)); + $section->add_variable(new \phpbb\search\sphinx\config_variable(trim($name), trim($value), ($end_section) ? '' : $comment)); continue; } @@ -262,7 +264,7 @@ class phpbb_search_sphinx_config // If we did not find anything meaningful up to here, then just treat it // as a comment $comment = ($skip_first) ? "\t" . substr(ltrim($config_file[$i]), 1) : $config_file[$i]; - $section->add_variable(new phpbb_search_sphinx_config_comment($comment)); + $section->add_variable(new \phpbb\search\sphinx\config_comment($comment)); } } diff --git a/phpBB/phpbb/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php index 7f695dbf0c..66000e4031 100644 --- a/phpBB/phpbb/search/sphinx/config_comment.php +++ b/phpBB/phpbb/search/sphinx/config_comment.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search\sphinx; + /** * @ignore */ @@ -16,15 +18,15 @@ if (!defined('IN_PHPBB')) } /** -* phpbb_search_sphinx_config_comment +* \phpbb\search\sphinx\config_comment * Represents a comment inside the sphinx configuration */ -class phpbb_search_sphinx_config_comment +class config_comment { private $exact_string; /** - * Create a new comment + * Create a new \comment * * @param string $exact_string The content of the comment including newlines, leading whitespace, etc. * diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 79c9c8563d..3a5631ca21 100644 --- a/phpBB/phpbb/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search\sphinx; + /** * @ignore */ @@ -16,10 +18,10 @@ if (!defined('IN_PHPBB')) } /** -* phpbb_search_sphinx_config_section +* \phpbb\search\sphinx\config_section * Represents a single section inside the sphinx configuration */ -class phpbb_search_sphinx_config_section +class config_section { private $name; private $comment; @@ -27,7 +29,7 @@ class phpbb_search_sphinx_config_section private $variables = array(); /** - * Construct a new section + * Construct a new \section * * @param string $name Name of the section * @param string $comment Comment that should be appended after the name in the @@ -45,7 +47,7 @@ class phpbb_search_sphinx_config_section /** * Add a variable object to the list of variables in this section * - * @param phpbb_search_sphinx_config_variable $variable The variable object + * @param \phpbb\search\sphinx\config_variable $variable The variable object * * @access public */ @@ -82,7 +84,7 @@ class phpbb_search_sphinx_config_section * Get a variable object by its name * * @param string $name The name of the variable that shall be returned - * @return phpbb_search_sphinx_config_section The first variable object from this section with the + * @return \phpbb\search\sphinx\config_section The first variable object from this section with the * given name or null if none was found * * @access public @@ -92,7 +94,7 @@ class phpbb_search_sphinx_config_section for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++) { // Make sure this is a variable object and not a comment - if (($this->variables[$i] instanceof phpbb_search_sphinx_config_variable) && $this->variables[$i]->get_name() == $name) + if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name) { return $this->variables[$i]; } @@ -111,7 +113,7 @@ class phpbb_search_sphinx_config_section for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++) { // Make sure this is a variable object and not a comment - if (($this->variables[$i] instanceof phpbb_search_sphinx_config_variable) && $this->variables[$i]->get_name() == $name) + if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name) { array_splice($this->variables, $i, 1); $i--; @@ -120,17 +122,17 @@ class phpbb_search_sphinx_config_section } /** - * Create a new variable object and append it to the variable list of this section + * Create a new \variable object and append it to the variable list of this section * - * @param string $name The name for the new variable - * @param string $value The value for the new variable - * @return phpbb_search_sphinx_config_variable Variable object that was created + * @param string $name The name for the new \variable + * @param string $value The value for the new \variable + * @return \phpbb\search\sphinx\config_variable Variable object that was created * * @access public */ function create_variable($name, $value) { - $this->variables[] = new phpbb_search_sphinx_config_variable($name, $value, ''); + $this->variables[] = new \phpbb\search\sphinx\config_variable($name, $value, ''); return $this->variables[sizeof($this->variables) - 1]; } diff --git a/phpBB/phpbb/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php index 2c1d35a49c..afe4190068 100644 --- a/phpBB/phpbb/search/sphinx/config_variable.php +++ b/phpBB/phpbb/search/sphinx/config_variable.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\search\sphinx; + /** * @ignore */ @@ -16,17 +18,17 @@ if (!defined('IN_PHPBB')) } /** -* phpbb_search_sphinx_config_variable +* \phpbb\search\sphinx\config_variable * Represents a single variable inside the sphinx configuration */ -class phpbb_search_sphinx_config_variable +class config_variable { private $name; private $value; private $comment; /** - * Constructs a new variable object + * Constructs a new \variable object * * @param string $name Name of the variable * @param string $value Value of the variable diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 3bff91e275..782ef60c52 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Session class * @package phpBB3 */ -class phpbb_session +class session { var $cookie_data = array(); var $page = array(); @@ -197,7 +199,7 @@ class phpbb_session * This is where all session activity begins. We gather various pieces of * information from the client and server. We test to see if a session already * exists. If it does, fine and dandy. If it doesn't we'll go on to create a - * new one ... pretty logical heh? We also examine the system load (if we're + * new \one ... pretty logical heh? We also examine the system load (if we're * running on a system which makes such information readily available) and * halt if it's above an admin definable limit. * @@ -243,7 +245,7 @@ class phpbb_session $this->forwarded_for = ''; } - if ($request->is_set($config['cookie_name'] . '_sid', phpbb_request_request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', phpbb_request_request_interface::COOKIE)) + if ($request->is_set($config['cookie_name'] . '_sid', \phpbb\request\request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', \phpbb\request\request_interface::COOKIE)) { $this->cookie_data['u'] = request_var($config['cookie_name'] . '_u', 0, false, true); $this->cookie_data['k'] = request_var($config['cookie_name'] . '_k', '', false, true); @@ -401,13 +403,13 @@ class phpbb_session $session_expired = false; // Check whether the session is still valid if we have one - $method = basename(trim($config['auth_method'])); + $method = basename(trim($config['auth_method'])); $provider = $phpbb_container->get('auth.provider.' . $method); - if (!($provider instanceof phpbb_auth_provider_provider_interface)) + if (!($provider instanceof \phpbb\auth\provider\provider_interface)) { - throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_provider_interface'); + throw new \RuntimeException($provider . ' must implement \phpbb\auth\provider\provider_interface'); } $ret = $provider->validate_session($this->data); @@ -492,18 +494,18 @@ class phpbb_session } } - // If we reach here then no (valid) session exists. So we'll create a new one + // If we reach here then no (valid) session exists. So we'll create a new \one return $this->session_create(); } /** - * Create a new session + * Create a new \session * * If upon trying to start a session we discover there is nothing existing we * jump here. Additionally this method is called directly during login to regenerate * the session for the specific user. In this method we carry out a number of tasks; * garbage collection, (search)bot checking, banned user comparison. Basically - * though this method will result in a new session for a specific user. + * though this method will result in a new \session for a specific user. */ function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) { @@ -773,7 +775,7 @@ class phpbb_session if (!defined('IN_ERROR_HANDLER') && (!$this->session_id || !$db->sql_query($sql) || !$db->sql_affectedrows())) { - // Limit new sessions in 1 minute period (if required) + // Limit new \sessions in 1 minute period (if required) if (empty($this->data['session_time']) && $config['active_sessions']) { // $db->sql_return_on_error(false); @@ -799,7 +801,7 @@ class phpbb_session // Something quite important: session_page always holds the *last* page visited, except for the *first* visit. // We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case. - // If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later. + // If the session id is empty, we have a completely new \one and will set an "identifier" here. This identifier is able to be checked later. if (empty($this->data['session_id'])) { // This is a temporary variable, only set for the very first visit @@ -1022,7 +1024,7 @@ class phpbb_session { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } - phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); + \phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' WHERE attempt_time < ' . (time() - (int) $config['ip_login_limit_time']); diff --git a/phpBB/phpbb/style/extension_path_provider.php b/phpBB/phpbb/style/extension_path_provider.php index ec1d85f821..104cda757b 100644 --- a/phpBB/phpbb/style/extension_path_provider.php +++ b/phpBB/phpbb/style/extension_path_provider.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\style; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_style_extension_path_provider extends phpbb_extension_provider implements phpbb_style_path_provider_interface +class extension_path_provider extends \phpbb\extension\provider implements \phpbb\style\path_provider_interface { /** * Optional prefix for style paths searched within extensions. @@ -36,7 +38,7 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple /** * A provider of paths to be searched for styles - * @var phpbb_style_path_provider + * @var \phpbb\style\path_provider */ protected $base_path_provider; @@ -46,12 +48,12 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple /** * Constructor stores extension manager * - * @param phpbb_extension_manager $extension_manager phpBB extension manager - * @param phpbb_style_path_provider $base_path_provider A simple path provider + * @param \phpbb\extension\manager $extension_manager phpBB extension manager + * @param \phpbb\style\path_provider $base_path_provider A simple path provider * to provide paths to be located in extensions * @param string $phpbb_root_path phpBB root path */ - public function __construct(phpbb_extension_manager $extension_manager, phpbb_style_path_provider $base_path_provider, $phpbb_root_path) + public function __construct(\phpbb\extension\manager $extension_manager, \phpbb\style\path_provider $base_path_provider, $phpbb_root_path) { parent::__construct($extension_manager); $this->base_path_provider = $base_path_provider; diff --git a/phpBB/phpbb/style/path_provider.php b/phpBB/phpbb/style/path_provider.php index 731d682e88..0a5906d0a8 100644 --- a/phpBB/phpbb/style/path_provider.php +++ b/phpBB/phpbb/style/path_provider.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\style; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface +class path_provider implements \IteratorAggregate, \phpbb\style\path_provider_interface { protected $paths = array(); @@ -57,6 +59,6 @@ class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_p */ public function getIterator() { - return new ArrayIterator($this->paths); + return new \ArrayIterator($this->paths); } } diff --git a/phpBB/phpbb/style/path_provider_interface.php b/phpBB/phpbb/style/path_provider_interface.php index 1a6153a4d3..beb0da29df 100644 --- a/phpBB/phpbb/style/path_provider_interface.php +++ b/phpBB/phpbb/style/path_provider_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\style; + /** * @ignore */ @@ -22,7 +24,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -interface phpbb_style_path_provider_interface extends Traversable +interface path_provider_interface extends \Traversable { /** * Defines a prefix to use for style paths in extensions diff --git a/phpBB/phpbb/style/resource_locator.php b/phpBB/phpbb/style/resource_locator.php index 4cf767c062..848624ee69 100644 --- a/phpBB/phpbb/style/resource_locator.php +++ b/phpBB/phpbb/style/resource_locator.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\style; + /** * @ignore */ @@ -30,7 +32,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_style_resource_locator implements phpbb_template_locator +class resource_locator implements \phpbb\template\locator { /** * Paths to style directories. diff --git a/phpBB/phpbb/style/style.php b/phpBB/phpbb/style/style.php index 034f518091..d3bacdb1ec 100644 --- a/phpBB/phpbb/style/style.php +++ b/phpBB/phpbb/style/style.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\style; + /** * @ignore */ @@ -19,12 +21,12 @@ if (!defined('IN_PHPBB')) * Base Style class. * @package phpBB3 */ -class phpbb_style +class style { /** * Template class. * Handles everything related to templates. - * @var phpbb_template + * @var \phpbb\template\template */ private $template; @@ -42,25 +44,25 @@ class phpbb_style /** * phpBB config instance - * @var phpbb_config + * @var \phpbb\config\config */ private $config; /** * Current user - * @var phpbb_user + * @var \phpbb\user */ private $user; /** * Style resource locator - * @var phpbb_style_resource_locator + * @var \phpbb\style\resource_locator */ private $locator; /** * Style path provider - * @var phpbb_style_path_provider + * @var \phpbb\style\path_provider */ private $provider; @@ -69,11 +71,11 @@ class phpbb_style * * @param string $phpbb_root_path phpBB root path * @param user $user current user - * @param phpbb_style_resource_locator $locator style resource locator - * @param phpbb_style_path_provider $provider style path provider - * @param phpbb_template $template template + * @param \phpbb\style\resource_locator $locator style resource locator + * @param \phpbb\style\path_provider $provider style path provider + * @param \phpbb\template\template $template template */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_template $template) + public function __construct($phpbb_root_path, $php_ext, $config, $user, \phpbb\style\resource_locator $locator, \phpbb\style\path_provider_interface $provider, \phpbb\template\template $template) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index 7c322cd971..aa4b25aa7f 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_template_asset +class asset { protected $components = array(); diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index c5ce7422b9..263f77a1b8 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_template_context +class context { /** * variable that holds all the data we'll be substituting into @@ -86,7 +88,7 @@ class phpbb_template_context * Returns a reference to template data array. * * This function is public so that template renderer may invoke it. - * Users should alter template variables via functions in phpbb_template. + * Users should alter template variables via functions in \phpbb\template\template. * * Note: modifying returned array will affect data stored in the context. * @@ -158,7 +160,7 @@ class phpbb_template_context } // Now we add the block that we're actually assigning to. - // We're adding a new iteration to this block with the given + // We're adding a new \iteration to this block with the given // variable assignments. $str[$blocks[$blockcount]][] = $vararray; @@ -190,7 +192,7 @@ class phpbb_template_context unset($this->tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']); } - // Add a new iteration to this block with the variable assignments we were given. + // Add a new \iteration to this block with the variable assignments we were given. $this->tpldata[$blockname][] = $vararray; // Set S_NUM_ROWS @@ -223,7 +225,7 @@ class phpbb_template_context * @param string $mode Mode to execute (valid modes are 'insert' and 'change') * * If insert, the vararray is inserted at the given position (position counting from zero). - * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). + * If change, the current block gets merged with the vararray (resulting in new \key/value pairs be added and existing keys be replaced by the new \value). * * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) diff --git a/phpBB/phpbb/template/locator.php b/phpBB/phpbb/template/locator.php index f6fd20bcc2..c930609b80 100644 --- a/phpBB/phpbb/template/locator.php +++ b/phpBB/phpbb/template/locator.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template; + /** * @ignore */ @@ -33,7 +35,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -interface phpbb_template_locator +interface locator { /** * Sets the template filenames for handles. $filename_array diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 89a01e924d..4b337f9980 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template; + /** * @ignore */ @@ -15,13 +17,13 @@ if (!defined('IN_PHPBB')) exit; } -interface phpbb_template +interface template { /** * Clear the cache * - * @return phpbb_template + * @return \phpbb\template\template */ public function clear_cache(); @@ -29,7 +31,7 @@ interface phpbb_template * Sets the template filenames for handles. * * @param array $filename_array Should be a hash of handle => filename pairs. - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function set_filenames(array $filename_array); @@ -39,14 +41,14 @@ interface phpbb_template * * @param array $style_names List of style names in inheritance tree order * @param array $style_paths List of style paths in inheritance tree order - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function set_style_names(array $style_names, array $style_paths); /** * Clears all variables and blocks assigned to this template. * - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function destroy(); @@ -54,7 +56,7 @@ interface phpbb_template * Reset/empty complete block * * @param string $blockname Name of block to destroy - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function destroy_block_vars($blockname); @@ -66,7 +68,7 @@ interface phpbb_template * This function calls hooks. * * @param string $handle Handle to display - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function display($handle); @@ -77,7 +79,7 @@ interface phpbb_template * @param string $handle Handle to operate on * @param string $template_var Template variable to assign compiled handle to * @param bool $return_content If true return compiled handle, otherwise assign to $template_var - * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this + * @return \phpbb\template\template|string if $return_content is true return string of the compiled handle, otherwise return $this */ public function assign_display($handle, $template_var = '', $return_content = true); @@ -85,7 +87,7 @@ interface phpbb_template * Assign key variable pairs from an array * * @param array $vararray A hash of variable name => value pairs - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function assign_vars(array $vararray); @@ -96,7 +98,7 @@ interface phpbb_template * * @param string $varname Variable name * @param string $varval Value to assign to variable - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function assign_var($varname, $varval); @@ -107,7 +109,7 @@ interface phpbb_template * * @param string $varname Variable name * @param string $varval Value to append to variable - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function append_var($varname, $varval); @@ -115,7 +117,7 @@ interface phpbb_template * Assign key variable pairs from an array to a specified block * @param string $blockname Name of block to assign $vararray to * @param array $vararray A hash of variable name => value pairs - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function assign_block_vars($blockname, array $vararray); @@ -139,7 +141,7 @@ interface phpbb_template * @param string $mode Mode to execute (valid modes are 'insert' and 'change') * * If insert, the vararray is inserted at the given position (position counting from zero). - * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). + * If change, the current block gets merged with the vararray (resulting in new \key/value pairs be added and existing keys be replaced by the new \value). * * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) diff --git a/phpBB/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php index 6557b209eb..2490a43f81 100644 --- a/phpBB/phpbb/template/twig/definition.php +++ b/phpBB/phpbb/template/twig/definition.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) /** * This class holds all DEFINE variables from the current page load */ -class phpbb_template_twig_definition +class definition { /** @var array **/ protected $definitions = array(); @@ -39,7 +41,7 @@ class phpbb_template_twig_definition * * @param string $name * @param mixed $value - * @return phpbb_template_twig_definition + * @return \phpbb\template\twig\definition */ public function set($name, $value) { @@ -53,7 +55,7 @@ class phpbb_template_twig_definition * * @param string $name * @param string $value - * @return phpbb_template_twig_definition + * @return \phpbb\template\twig\definition */ public function append($name, $value) { diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index b60cd72325..64f3ace52d 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig; + /** * @ignore */ @@ -15,12 +17,12 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_template_twig_environment extends Twig_Environment +class environment extends \Twig_Environment { /** @var array */ protected $phpbb_extensions; - /** @var phpbb_config */ + /** @var \phpbb\config\config */ protected $phpbb_config; /** @var string */ @@ -32,13 +34,13 @@ class phpbb_template_twig_environment extends Twig_Environment /** * Constructor * - * @param phpbb_config $phpbb_config + * @param \phpbb\config\config $phpbb_config * @param array $phpbb_extensions Array of enabled extensions (name => path) * @param string $phpbb_root_path * @param Twig_LoaderInterface $loader * @param array $options Array of options to pass to Twig */ - public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array()) + public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, \Twig_LoaderInterface $loader = null, $options = array()) { $this->phpbb_config = $phpbb_config; $this->phpbb_extensions = $phpbb_extensions; @@ -62,7 +64,7 @@ class phpbb_template_twig_environment extends Twig_Environment /** * Get phpBB config * - * @return phpbb_config + * @return \phpbb\config\config */ public function get_phpbb_config() { @@ -124,7 +126,7 @@ class phpbb_template_twig_environment extends Twig_Environment return parent::loadTemplate('@' . $namespace . '/' . $name, $index); } - catch (Twig_Error_Loader $e) + catch (\Twig_Error_Loader $e) { } } diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 2adee07c8c..1ddb97369e 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig; + /** * @ignore */ @@ -15,22 +17,22 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_template_twig_extension extends Twig_Extension +class extension extends \Twig_Extension { - /** @var phpbb_template_context */ + /** @var \phpbb\template\context */ protected $context; - /** @var phpbb_user */ + /** @var \phpbb\user */ protected $user; /** * Constructor * - * @param phpbb_template_context $context - * @param phpbb_user $user - * @return phpbb_template_twig_extension + * @param \phpbb\template\context $context + * @param \phpbb\user $user + * @return \phpbb\template\twig\extension */ - public function __construct(phpbb_template_context $context, $user) + public function __construct(\phpbb\template\context $context, $user) { $this->context = $context; $this->user = $user; @@ -54,13 +56,13 @@ class phpbb_template_twig_extension extends Twig_Extension public function getTokenParsers() { return array( - new phpbb_template_twig_tokenparser_defineparser, - new phpbb_template_twig_tokenparser_includeparser, - new phpbb_template_twig_tokenparser_includejs, - new phpbb_template_twig_tokenparser_includecss, - new phpbb_template_twig_tokenparser_event, - new phpbb_template_twig_tokenparser_includephp, - new phpbb_template_twig_tokenparser_php, + new \phpbb\template\twig\tokenparser\defineparser, + new \phpbb\template\twig\tokenparser\includeparser, + new \phpbb\template\twig\tokenparser\includejs, + new \phpbb\template\twig\tokenparser\includecss, + new \phpbb\template\twig\tokenparser\event, + new \phpbb\template\twig\tokenparser\includephp, + new \phpbb\template\twig\tokenparser\php, ); } @@ -72,8 +74,8 @@ class phpbb_template_twig_extension extends Twig_Extension public function getFilters() { return array( - new Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), - new Twig_SimpleFilter('addslashes', 'addslashes'), + new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + new \Twig_SimpleFilter('addslashes', 'addslashes'), ); } @@ -85,7 +87,7 @@ class phpbb_template_twig_extension extends Twig_Extension public function getFunctions() { return array( - new Twig_SimpleFunction('lang', array($this, 'lang')), + new \Twig_SimpleFunction('lang', array($this, 'lang')), ); } @@ -102,26 +104,26 @@ class phpbb_template_twig_extension extends Twig_Extension ), array( // precedence settings are copied from similar operators in Twig core extension - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - '===' => array('precedence' => 20, 'class' => 'phpbb_template_twig_node_expression_binary_equalequal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '!==' => array('precedence' => 20, 'class' => 'phpbb_template_twig_node_expression_binary_notequalequal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), - 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), ), ); } @@ -137,7 +139,7 @@ class phpbb_template_twig_extension extends Twig_Extension * * @return mixed The sliced variable */ - function loop_subset(Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false) + function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false) { // We do almost the same thing as Twig's slice (array_slice), except when $end is positive if ($end >= 1) diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 46412ad048..4f10e9594f 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_template_twig_lexer extends Twig_Lexer +class lexer extends \Twig_Lexer { public function tokenize($code, $filename = null) { diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php index 247b908337..ec084d0f7d 100644 --- a/phpBB/phpbb/template/twig/node/definenode.php +++ b/phpBB/phpbb/template/twig/node/definenode.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\node; + /** * @ignore */ @@ -16,9 +18,9 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_node_definenode extends Twig_Node +class definenode extends \Twig_Node { - public function __construct($capture, Twig_NodeInterface $name, Twig_NodeInterface $value, $lineno, $tag = null) + public function __construct($capture, \Twig_NodeInterface $name, \Twig_NodeInterface $value, $lineno, $tag = null) { parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); } @@ -28,7 +30,7 @@ class phpbb_template_twig_node_definenode extends Twig_Node * * @param Twig_Compiler A Twig_Compiler instance */ - public function compile(Twig_Compiler $compiler) + public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); @@ -38,7 +40,7 @@ class phpbb_template_twig_node_definenode extends Twig_Node ->subcompile($this->getNode('value')) ; - $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new Twig_Markup(\$value, \$this->env->getCharset());\n"); + $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig_Markup(\$value, \$this->env->getCharset());\n"); } else { diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 971dea14fa..a55e68fb04 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\node; + /** * @ignore */ @@ -16,12 +18,12 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_node_event extends Twig_Node +class event extends \Twig_Node { /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null) + public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) { $this->environment = $environment; @@ -33,7 +35,7 @@ class phpbb_template_twig_node_event extends Twig_Node * * @param Twig_Compiler A Twig_Compiler instance */ - public function compile(Twig_Compiler $compiler) + public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); @@ -48,7 +50,7 @@ class phpbb_template_twig_node_event extends Twig_Node // If debug mode is enabled, lets check for new/removed EVENT // templates on page load rather than at compile. This is // slower, but makes developing extensions easier (no need to - // purge the cache when a new event template file is added) + // purge the cache when a new \event template file is added) $compiler ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n") ->indent() diff --git a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php index 8ec2069114..48d8b814b8 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\node\expression\binary; + /** * @ignore */ @@ -16,9 +18,9 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_node_expression_binary_equalequal extends Twig_Node_Expression_Binary +class equalequal extends \Twig_Node_Expression_Binary { - public function operator(Twig_Compiler $compiler) + public function operator(\Twig_Compiler $compiler) { return $compiler->raw('==='); } diff --git a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php index 96f32c502e..87585dfb4c 100644 --- a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php +++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\node\expression\binary; + /** * @ignore */ @@ -16,9 +18,9 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_node_expression_binary_notequalequal extends Twig_Node_Expression_Binary +class notequalequal extends \Twig_Node_Expression_Binary { - public function operator(Twig_Compiler $compiler) + public function operator(\Twig_Compiler $compiler) { return $compiler->raw('!=='); } diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index 990b1c984f..f5c6413617 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -7,12 +7,14 @@ * */ -class phpbb_template_twig_node_includeasset extends Twig_Node +namespace phpbb\template\twig\node; + +class includeasset extends \Twig_Node { /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null) + public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) { $this->environment = $environment; @@ -23,7 +25,7 @@ class phpbb_template_twig_node_includeasset extends Twig_Node * * @param Twig_Compiler A Twig_Compiler instance */ - public function compile(Twig_Compiler $compiler) + public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); @@ -33,7 +35,7 @@ class phpbb_template_twig_node_includeasset extends Twig_Node ->write("\$asset_file = ") ->subcompile($this->getNode('expr')) ->raw(";\n") - ->write("\$asset = new phpbb_template_asset(\$asset_file);\n") + ->write("\$asset = new \phpbb\template\asset(\$asset_file);\n") ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php index 01fda44aad..45ff9107a0 100644 --- a/phpBB/phpbb/template/twig/node/includecss.php +++ b/phpBB/phpbb/template/twig/node/includecss.php @@ -7,7 +7,9 @@ * */ -class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_includeasset +namespace phpbb\template\twig\node; + +class includecss extends \phpbb\template\twig\node\includeasset { public function get_definition_name() { @@ -19,7 +21,7 @@ class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_inclu * * @param Twig_Compiler A Twig_Compiler instance */ - public function append_asset(Twig_Compiler $compiler) + public function append_asset(\Twig_Compiler $compiler) { $compiler ->raw("environment->get_phpbb_config(); diff --git a/phpBB/phpbb/template/twig/node/includenode.php b/phpBB/phpbb/template/twig/node/includenode.php index c5d1c6be51..77fe7f3acb 100644 --- a/phpBB/phpbb/template/twig/node/includenode.php +++ b/phpBB/phpbb/template/twig/node/includenode.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\node; + /** * @ignore */ @@ -16,14 +18,14 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_node_includenode extends Twig_Node_Include +class includenode extends \Twig_Node_Include { /** * Compiles the node to PHP. * * @param Twig_Compiler A Twig_Compiler instance */ - public function compile(Twig_Compiler $compiler) + public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index dbe54f0e1a..4024cf0cc8 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\node; + /** * @ignore */ @@ -16,12 +18,12 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_node_includephp extends Twig_Node +class includephp extends \Twig_Node { /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $ignoreMissing = false, $lineno, $tag = null) + public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $ignoreMissing = false, $lineno, $tag = null) { $this->environment = $environment; @@ -33,7 +35,7 @@ class phpbb_template_twig_node_includephp extends Twig_Node * * @param Twig_Compiler A Twig_Compiler instance */ - public function compile(Twig_Compiler $compiler) + public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); @@ -80,7 +82,7 @@ class phpbb_template_twig_node_includephp extends Twig_Node if ($this->getAttribute('ignore_missing')) { $compiler ->outdent() - ->write("} catch (Twig_Error_Loader \$e) {\n") + ->write("} catch (\Twig_Error_Loader \$e) {\n") ->indent() ->write("// ignore missing template\n") ->outdent() diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php index c11539ea7f..b37759303d 100644 --- a/phpBB/phpbb/template/twig/node/php.php +++ b/phpBB/phpbb/template/twig/node/php.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\node; + /** * @ignore */ @@ -16,12 +18,12 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_node_php extends Twig_Node +class php extends \Twig_Node { /** @var Twig_Environment */ protected $environment; - public function __construct(Twig_Node_Text $text, phpbb_template_twig_environment $environment, $lineno, $tag = null) + public function __construct(\Twig_Node_Text $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null) { $this->environment = $environment; @@ -33,7 +35,7 @@ class phpbb_template_twig_node_php extends Twig_Node * * @param Twig_Compiler A Twig_Compiler instance */ - public function compile(Twig_Compiler $compiler) + public function compile(\Twig_Compiler $compiler) { $compiler->addDebugInfo($this); diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index db023c67bf..688afec191 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\tokenparser; + /** * @ignore */ @@ -16,7 +18,7 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_tokenparser_defineparser extends Twig_TokenParser +class defineparser extends \Twig_TokenParser { /** * Parses a token and returns a node. @@ -25,31 +27,31 @@ class phpbb_template_twig_tokenparser_defineparser extends Twig_TokenParser * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - public function parse(Twig_Token $token) + public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $name = $this->parser->getExpressionParser()->parseExpression(); $capture = false; - if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) { + if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) { $stream->next(); $value = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); } else { $capture = true; - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); } - return new phpbb_template_twig_node_definenode($capture, $name, $value, $lineno, $this->getTag()); + return new \phpbb\template\twig\node\definenode($capture, $name, $value, $lineno, $this->getTag()); } - public function decideBlockEnd(Twig_Token $token) + public function decideBlockEnd(\Twig_Token $token) { return $token->test('ENDDEFINE'); } diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php index e4dddd6dcc..7cf4000909 100644 --- a/phpBB/phpbb/template/twig/tokenparser/event.php +++ b/phpBB/phpbb/template/twig/tokenparser/event.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\tokenparser; + /** * @ignore */ @@ -16,7 +18,7 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_tokenparser_event extends Twig_TokenParser +class event extends \Twig_TokenParser { /** * Parses a token and returns a node. @@ -25,14 +27,14 @@ class phpbb_template_twig_tokenparser_event extends Twig_TokenParser * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - public function parse(Twig_Token $token) + public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + return new \phpbb\template\twig\node\event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); } /** diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php index 6c24dda647..7bf4c610b1 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includecss.php +++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php @@ -7,7 +7,9 @@ * */ -class phpbb_template_twig_tokenparser_includecss extends Twig_TokenParser +namespace phpbb\template\twig\tokenparser; + +class includecss extends \Twig_TokenParser { /** * Parses a token and returns a node. @@ -16,14 +18,14 @@ class phpbb_template_twig_tokenparser_includecss extends Twig_TokenParser * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - public function parse(Twig_Token $token) + public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_includecss($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + return new \phpbb\template\twig\node\includecss($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); } /** diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php index b02b2f89ba..30a99f3279 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includejs.php +++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\tokenparser; + /** * @ignore */ @@ -16,7 +18,7 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_tokenparser_includejs extends Twig_TokenParser +class includejs extends \Twig_TokenParser { /** * Parses a token and returns a node. @@ -25,14 +27,14 @@ class phpbb_template_twig_tokenparser_includejs extends Twig_TokenParser * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - public function parse(Twig_Token $token) + public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + return new \phpbb\template\twig\node\includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); } /** diff --git a/phpBB/phpbb/template/twig/tokenparser/includeparser.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php index 79c53630d0..715c0ec84d 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includeparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\tokenparser; + /** * @ignore */ @@ -16,7 +18,7 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_tokenparser_includeparser extends Twig_TokenParser_Include +class includeparser extends \Twig_TokenParser_Include { /** * Parses a token and returns a node. @@ -25,13 +27,13 @@ class phpbb_template_twig_tokenparser_includeparser extends Twig_TokenParser_Inc * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - public function parse(Twig_Token $token) + public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); list($variables, $only, $ignoreMissing) = $this->parseArguments(); - return new phpbb_template_twig_node_includenode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + return new \phpbb\template\twig\node\includenode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); } /** diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index 13fe6de8a6..d906837590 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\tokenparser; + /** * @ignore */ @@ -16,7 +18,7 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_tokenparser_includephp extends Twig_TokenParser +class includephp extends \Twig_TokenParser { /** * Parses a token and returns a node. @@ -25,23 +27,23 @@ class phpbb_template_twig_tokenparser_includephp extends Twig_TokenParser * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - public function parse(Twig_Token $token) + public function parse(\Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); $stream = $this->parser->getStream(); $ignoreMissing = false; - if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) { + if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) { $stream->next(); - $stream->expect(Twig_Token::NAME_TYPE, 'missing'); + $stream->expect(\Twig_Token::NAME_TYPE, 'missing'); $ignoreMissing = true; } - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag()); + return new \phpbb\template\twig\node\includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag()); } /** diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php index 197980a59a..e4f70fb9b1 100644 --- a/phpBB/phpbb/template/twig/tokenparser/php.php +++ b/phpBB/phpbb/template/twig/tokenparser/php.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig\tokenparser; + /** * @ignore */ @@ -16,7 +18,7 @@ if (!defined('IN_PHPBB')) } -class phpbb_template_twig_tokenparser_php extends Twig_TokenParser +class php extends \Twig_TokenParser { /** * Parses a token and returns a node. @@ -25,20 +27,20 @@ class phpbb_template_twig_tokenparser_php extends Twig_TokenParser * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - public function parse(Twig_Token $token) + public function parse(\Twig_Token $token) { $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); - return new phpbb_template_twig_node_php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + return new \phpbb\template\twig\node\php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); } - public function decideEnd(Twig_Token $token) + public function decideEnd(\Twig_Token $token) { return $token->test('ENDPHP'); } diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 92a37d1634..2ba6f66a35 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig; + /** * @ignore */ @@ -19,12 +21,12 @@ if (!defined('IN_PHPBB')) * Twig Template class. * @package phpBB3 */ -class phpbb_template_twig implements phpbb_template +class twig implements \phpbb\template\template { /** * Template context. * Stores template data used during template rendering. - * @var phpbb_template_context + * @var \phpbb\template\context */ protected $context; @@ -57,20 +59,20 @@ class phpbb_template_twig implements phpbb_template /** * phpBB config instance - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * Current user - * @var phpbb_user + * @var \phpbb\user */ protected $user; /** * Extension manager. * - * @var phpbb_extension_manager + * @var \phpbb\extension\manager */ protected $extension_manager; @@ -103,13 +105,13 @@ class phpbb_template_twig implements phpbb_template * * @param string $phpbb_root_path phpBB root path * @param string $php_ext php extension (typically 'php') - * @param phpbb_config $config - * @param phpbb_user $user - * @param phpbb_template_context $context template context - * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked + * @param \phpbb\config\config $config + * @param \phpbb\user $user + * @param \phpbb\template\context $context template context + * @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked * @param string $adm_relative_path relative path to adm directory */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null, $adm_relative_path = null) + public function __construct($phpbb_root_path, $php_ext, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null, $adm_relative_path = null) { $this->phpbb_root_path = $phpbb_root_path; $this->adm_relative_path = $adm_relative_path; @@ -122,9 +124,9 @@ class phpbb_template_twig implements phpbb_template $this->cachepath = $phpbb_root_path . 'cache/twig/'; // Initiate the loader, __main__ namespace paths will be setup later in set_style_names() - $loader = new Twig_Loader_Filesystem(''); + $loader = new \Twig_Loader_Filesystem(''); - $this->twig = new phpbb_template_twig_environment( + $this->twig = new \phpbb\template\twig\environment( $this->config, ($this->extension_manager) ? $this->extension_manager->all_enabled() : array(), $this->phpbb_root_path, @@ -138,13 +140,13 @@ class phpbb_template_twig implements phpbb_template ); $this->twig->addExtension( - new phpbb_template_twig_extension( + new \phpbb\template\twig\extension( $this->context, $this->user ) ); - $lexer = new phpbb_template_twig_lexer($this->twig); + $lexer = new \phpbb\template\twig\lexer($this->twig); $this->twig->setLexer($lexer); } @@ -152,7 +154,7 @@ class phpbb_template_twig implements phpbb_template /** * Clear the cache * - * @return phpbb_template + * @return \phpbb\template\template */ public function clear_cache() { @@ -168,7 +170,7 @@ class phpbb_template_twig implements phpbb_template * Sets the template filenames for handles. * * @param array $filename_array Should be a hash of handle => filename pairs. - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function set_filenames(array $filename_array) { @@ -185,7 +187,7 @@ class phpbb_template_twig implements phpbb_template * @param array $style_paths List of style paths in inheritance tree order * @param bool $is_core True if the style names are the "core" styles for this page load * Core means the main phpBB template files - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function set_style_names(array $style_names, array $style_paths, $is_core = false) { @@ -194,7 +196,7 @@ class phpbb_template_twig implements phpbb_template // Set as __main__ namespace $this->twig->getLoader()->setPaths($style_paths); - // Core style namespace from phpbb_style::set_style() + // Core style namespace from \phpbb\style\style::set_style() if ($is_core) { $this->twig->getLoader()->setPaths($style_paths, 'core'); @@ -207,7 +209,7 @@ class phpbb_template_twig implements phpbb_template } // Add all namespaces for all extensions - if ($this->extension_manager instanceof phpbb_extension_manager) + if ($this->extension_manager instanceof \phpbb\extension\manager) { $style_names[] = 'all'; @@ -237,7 +239,7 @@ class phpbb_template_twig implements phpbb_template /** * Clears all variables and blocks assigned to this template. * - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function destroy() { @@ -250,7 +252,7 @@ class phpbb_template_twig implements phpbb_template * Reset/empty complete block * * @param string $blockname Name of block to destroy - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function destroy_block_vars($blockname) { @@ -267,7 +269,7 @@ class phpbb_template_twig implements phpbb_template * This function calls hooks. * * @param string $handle Handle to display - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function display($handle) { @@ -311,7 +313,7 @@ class phpbb_template_twig implements phpbb_template * @param string $handle Handle to operate on * @param string $template_var Template variable to assign compiled handle to * @param bool $return_content If true return compiled handle, otherwise assign to $template_var - * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this + * @return \phpbb\template\template|string if $return_content is true return string of the compiled handle, otherwise return $this */ public function assign_display($handle, $template_var = '', $return_content = true) { @@ -329,7 +331,7 @@ class phpbb_template_twig implements phpbb_template * Assign key variable pairs from an array * * @param array $vararray A hash of variable name => value pairs - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function assign_vars(array $vararray) { @@ -348,7 +350,7 @@ class phpbb_template_twig implements phpbb_template * * @param string $varname Variable name * @param string $varval Value to assign to variable - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function assign_var($varname, $varval) { @@ -364,7 +366,7 @@ class phpbb_template_twig implements phpbb_template * * @param string $varname Variable name * @param string $varval Value to append to variable - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function append_var($varname, $varval) { @@ -377,7 +379,7 @@ class phpbb_template_twig implements phpbb_template * Assign key variable pairs from an array to a specified block * @param string $blockname Name of block to assign $vararray to * @param array $vararray A hash of variable name => value pairs - * @return phpbb_template $this + * @return \phpbb\template\template $this */ public function assign_block_vars($blockname, array $vararray) { @@ -406,7 +408,7 @@ class phpbb_template_twig implements phpbb_template * @param string $mode Mode to execute (valid modes are 'insert' and 'change') * * If insert, the vararray is inserted at the given position (position counting from zero). - * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). + * If change, the current block gets merged with the vararray (resulting in new \key/value pairs be added and existing keys be replaced by the new \value). * * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) @@ -431,7 +433,7 @@ class phpbb_template_twig implements phpbb_template $context_vars['.'][0], // To get normal vars $context_vars, // To get loops array( - 'definition' => new phpbb_template_twig_definition(), + 'definition' => new \phpbb\template\twig\definition(), 'user' => $this->user, ) ); diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php index 79853eeaa1..171dae4d14 100644 --- a/phpBB/phpbb/tree/nestedset.php +++ b/phpBB/phpbb/tree/nestedset.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\tree; + /** * @ignore */ @@ -15,12 +17,12 @@ if (!defined('IN_PHPBB')) exit; } -abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface +abstract class nestedset implements \phpbb\tree\tree_interface { - /** @var phpbb_db_driver */ + /** @var \phpbb\db\driver\driver */ protected $db; - /** @var phpbb_lock_db */ + /** @var \phpbb\lock\db */ protected $lock; /** @var string */ @@ -58,15 +60,15 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface /** * Construct * - * @param phpbb_db_driver $db Database connection - * @param phpbb_lock_db $lock Lock class used to lock the table when moving forums around + * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around * @param string $table_name Table name * @param string $message_prefix Prefix for the messages thrown by exceptions * @param string $sql_where Additional SQL restrictions for the queries * @param array $item_basic_data Array with basic item data that is stored in item_parents * @param array $columns Array with column names to overwrite */ - public function __construct(phpbb_db_driver $db, phpbb_lock_db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array()) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array()) { $this->db = $db; $this->lock = $lock; @@ -116,7 +118,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (!$this->lock->acquire()) { - throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); + throw new \RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE'); } return true; @@ -184,7 +186,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface $item_id = (int) $item_id; if (!$item_id) { - throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $items = $this->get_subtree_data($item_id); @@ -192,7 +194,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (empty($items) || !isset($items[$item_id])) { - throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $this->remove_subset($item_ids, $items[$item_id]); @@ -242,7 +244,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (!$item) { $this->lock->release(); - throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } /** @@ -364,7 +366,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (!$current_parent_id) { - throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $this->acquire_lock(); @@ -373,7 +375,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (!isset($item_data[$current_parent_id])) { $this->lock->release(); - throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $current_parent = $item_data[$current_parent_id]; @@ -389,7 +391,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (in_array($new_parent_id, $move_items)) { $this->lock->release(); - throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $diff = sizeof($move_items) * 2; @@ -413,7 +415,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface { $this->db->sql_transaction('rollback'); $this->lock->release(); - throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true); @@ -470,7 +472,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (!$item_id) { - throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $this->acquire_lock(); @@ -479,7 +481,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (!isset($item_data[$item_id])) { $this->lock->release(); - throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM'); } $item = $item_data[$item_id]; @@ -488,7 +490,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface if (in_array($new_parent_id, $move_items)) { $this->lock->release(); - throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $diff = sizeof($move_items) * 2; @@ -512,7 +514,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_tree_interface { $this->db->sql_transaction('rollback'); $this->lock->release(); - throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); + throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT'); } $new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true); diff --git a/phpBB/phpbb/tree/nestedset_forum.php b/phpBB/phpbb/tree/nestedset_forum.php index ff09ef55d0..2fee5b097e 100644 --- a/phpBB/phpbb/tree/nestedset_forum.php +++ b/phpBB/phpbb/tree/nestedset_forum.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\tree; + /** * @ignore */ @@ -15,16 +17,16 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_tree_nestedset_forum extends phpbb_tree_nestedset +class nestedset_forum extends \phpbb\tree\nestedset { /** * Construct * - * @param phpbb_db_driver $db Database connection - * @param phpbb_lock_db $lock Lock class used to lock the table when moving forums around + * @param \phpbb\db\driver\driver $db Database connection + * @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around * @param string $table_name Table name */ - public function __construct(phpbb_db_driver $db, phpbb_lock_db $lock, $table_name) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name) { parent::__construct( $db, diff --git a/phpBB/phpbb/tree/tree_interface.php b/phpBB/phpbb/tree/tree_interface.php index 80d3c4377c..b0a1e08ec6 100644 --- a/phpBB/phpbb/tree/tree_interface.php +++ b/phpBB/phpbb/tree/tree_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\tree; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -interface phpbb_tree_tree_interface +interface tree_interface { /** * Inserts an item into the database table and into the tree. @@ -67,7 +69,7 @@ interface phpbb_tree_tree_interface /** * Moves all children of one item to another item * - * If the new parent already has children, the new children are appended + * If the new parent already has children, the new \children are appended * to the list. * * @param int $current_parent_id The current parent item @@ -79,7 +81,7 @@ interface phpbb_tree_tree_interface /** * Change parent item * - * Moves the item to the bottom of the new parent's list of children + * Moves the item to the bottom of the new \parent's list of children * * @param int $item_id The item to be moved * @param int $new_parent_id The new parent item diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index 5530fe3f03..5a9aa21e8a 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -23,7 +25,7 @@ if (!defined('IN_PHPBB')) * * @package phpBB3 */ -class phpbb_user extends phpbb_session +class user extends \phpbb\session { var $lang = array(); var $help = array(); @@ -41,7 +43,7 @@ class phpbb_user extends phpbb_session var $img_lang; var $img_array = array(); - // Able to add new options (up to id 31) + // Able to add new \options (up to id 31) var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17); /** @@ -151,12 +153,12 @@ class phpbb_user extends phpbb_session try { - $this->timezone = new DateTimeZone($user_timezone); + $this->timezone = new \DateTimeZone($user_timezone); } - catch (Exception $e) + catch (\Exception $e) { // If the timezone the user has selected is invalid, we fall back to UTC. - $this->timezone = new DateTimeZone('UTC'); + $this->timezone = new \DateTimeZone('UTC'); } // We include common language file here to not load it every time a custom language file is included @@ -649,27 +651,27 @@ class phpbb_user extends phpbb_session if (!isset($utc)) { - $utc = new DateTimeZone('UTC'); + $utc = new \DateTimeZone('UTC'); } - $time = new phpbb_datetime($this, "@$gmepoch", $utc); + $time = new \phpbb\datetime($this, "@$gmepoch", $utc); $time->setTimezone($this->timezone); return $time->format($format, $forcedate); } /** - * Create a phpbb_datetime object in the context of the current user + * Create a \phpbb\datetime object in the context of the current user * * @since 3.1 * @param string $time String in a format accepted by strtotime(). * @param DateTimeZone $timezone Time zone of the time. - * @return phpbb_datetime Date time object linked to the current users locale + * @return \phpbb\datetime Date time object linked to the current users locale */ - public function create_datetime($time = 'now', DateTimeZone $timezone = null) + public function create_datetime($time = 'now', \DateTimeZone $timezone = null) { $timezone = $timezone ?: $this->timezone; - return new phpbb_datetime($this, $time, $timezone); + return new \phpbb\datetime($this, $time, $timezone); } /** @@ -680,10 +682,10 @@ class phpbb_user extends phpbb_session * @param DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user * @return int Returns the unix timestamp */ - public function get_timestamp_from_format($format, $time, DateTimeZone $timezone = null) + public function get_timestamp_from_format($format, $time, \DateTimeZone $timezone = null) { $timezone = $timezone ?: $this->timezone; - $date = DateTime::createFromFormat($format, $time, $timezone); + $date = \DateTime::createFromFormat($format, $time, $timezone); return ($date !== false) ? $date->format('U') : false; } diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php index 37bf9648c1..78620ab1b9 100644 --- a/phpBB/phpbb/user_loader.php +++ b/phpBB/phpbb/user_loader.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** */ if (!defined('IN_PHPBB')) @@ -22,9 +24,9 @@ if (!defined('IN_PHPBB')) * have to query the same user multiple times in * different services. */ -class phpbb_user_loader +class user_loader { - /** @var phpbb_db_driver */ + /** @var \phpbb\db\driver\driver */ protected $db = null; /** @var string */ @@ -46,12 +48,12 @@ class phpbb_user_loader /** * User loader constructor * - * @param phpbb_db_driver $db A database connection + * @param \phpbb\db\driver\driver $db A database connection * @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $php_ext php file extension * @param string $users_table The name of the database table (phpbb_users) */ - public function __construct(phpbb_db_driver $db, $phpbb_root_path, $php_ext, $users_table) + public function __construct(\phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext, $users_table) { $this->db = $db; -- cgit v1.2.1 From e1239b455fb4e8c5fcc80e9890c501e70ff8f1e4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:17:47 +0200 Subject: [ticket/11700] Namespaces and class names should not start with digits PHPBB3-11700 --- phpBB/phpbb/db/migration/data/30x/3_0_1.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_10.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php | 32 -- phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_11.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php | 97 ----- phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php | 52 --- phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php | 125 ------- phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php | 110 ------ phpBB/phpbb/db/migration/data/30x/3_0_2.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php | 34 -- phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php | 82 ----- phpBB/phpbb/db/migration/data/30x/3_0_3.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php | 85 ----- phpBB/phpbb/db/migration/data/30x/3_0_4.php | 51 --- phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php | 125 ------- phpBB/phpbb/db/migration/data/30x/3_0_5.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php | 126 ------- .../phpbb/db/migration/data/30x/3_0_5_rc1part2.php | 44 --- phpBB/phpbb/db/migration/data/30x/3_0_6.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php | 326 ---------------- phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php | 42 --- phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_7.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php | 78 ---- phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php | 75 ---- phpBB/phpbb/db/migration/data/30x/3_0_8.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php | 223 ----------- phpBB/phpbb/db/migration/data/30x/3_0_9.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php | 126 ------- phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php | 30 -- phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php | 30 -- .../db/migration/data/30x/local_url_bbcode.php | 59 --- phpBB/phpbb/db/migration/data/310/avatars.php | 69 ---- phpBB/phpbb/db/migration/data/310/boardindex.php | 25 -- .../phpbb/db/migration/data/310/config_db_text.php | 47 --- phpBB/phpbb/db/migration/data/310/dev.php | 410 --------------------- phpBB/phpbb/db/migration/data/310/extensions.php | 71 ---- .../db/migration/data/310/forgot_password.php | 30 -- .../phpbb/db/migration/data/310/jquery_update.php | 33 -- .../data/310/notification_options_reconvert.php | 120 ------ .../phpbb/db/migration/data/310/notifications.php | 98 ----- .../data/310/notifications_schema_fix.php | 94 ----- .../migration/data/310/reported_posts_display.php | 49 --- .../migration/data/310/signature_module_auth.php | 53 --- .../phpbb/db/migration/data/310/softdelete_p1.php | 173 --------- .../phpbb/db/migration/data/310/softdelete_p2.php | 70 ---- .../db/migration/data/310/style_update_p1.php | 187 ---------- .../db/migration/data/310/style_update_p2.php | 131 ------- phpBB/phpbb/db/migration/data/310/teampage.php | 106 ------ phpBB/phpbb/db/migration/data/310/timezone.php | 165 --------- phpBB/phpbb/db/migration/data/310/timezone_p2.php | 45 --- .../db/migration/data/v30x/local_url_bbcode.php | 59 +++ .../phpbb/db/migration/data/v30x/release_3_0_1.php | 30 ++ .../db/migration/data/v30x/release_3_0_10.php | 30 ++ .../db/migration/data/v30x/release_3_0_10_rc1.php | 32 ++ .../db/migration/data/v30x/release_3_0_10_rc2.php | 30 ++ .../db/migration/data/v30x/release_3_0_10_rc3.php | 30 ++ .../db/migration/data/v30x/release_3_0_11.php | 30 ++ .../db/migration/data/v30x/release_3_0_11_rc1.php | 97 +++++ .../db/migration/data/v30x/release_3_0_11_rc2.php | 52 +++ .../db/migration/data/v30x/release_3_0_12_rc1.php | 125 +++++++ .../db/migration/data/v30x/release_3_0_1_rc1.php | 110 ++++++ .../phpbb/db/migration/data/v30x/release_3_0_2.php | 30 ++ .../db/migration/data/v30x/release_3_0_2_rc1.php | 34 ++ .../db/migration/data/v30x/release_3_0_2_rc2.php | 82 +++++ .../phpbb/db/migration/data/v30x/release_3_0_3.php | 30 ++ .../db/migration/data/v30x/release_3_0_3_rc1.php | 85 +++++ .../phpbb/db/migration/data/v30x/release_3_0_4.php | 51 +++ .../db/migration/data/v30x/release_3_0_4_rc1.php | 125 +++++++ .../phpbb/db/migration/data/v30x/release_3_0_5.php | 30 ++ .../db/migration/data/v30x/release_3_0_5_rc1.php | 126 +++++++ .../migration/data/v30x/release_3_0_5_rc1part2.php | 44 +++ .../phpbb/db/migration/data/v30x/release_3_0_6.php | 30 ++ .../db/migration/data/v30x/release_3_0_6_rc1.php | 326 ++++++++++++++++ .../db/migration/data/v30x/release_3_0_6_rc2.php | 30 ++ .../db/migration/data/v30x/release_3_0_6_rc3.php | 42 +++ .../db/migration/data/v30x/release_3_0_6_rc4.php | 30 ++ .../phpbb/db/migration/data/v30x/release_3_0_7.php | 30 ++ .../db/migration/data/v30x/release_3_0_7_pl1.php | 30 ++ .../db/migration/data/v30x/release_3_0_7_rc1.php | 78 ++++ .../db/migration/data/v30x/release_3_0_7_rc2.php | 75 ++++ .../phpbb/db/migration/data/v30x/release_3_0_8.php | 30 ++ .../db/migration/data/v30x/release_3_0_8_rc1.php | 223 +++++++++++ .../phpbb/db/migration/data/v30x/release_3_0_9.php | 30 ++ .../db/migration/data/v30x/release_3_0_9_rc1.php | 126 +++++++ .../db/migration/data/v30x/release_3_0_9_rc2.php | 30 ++ .../db/migration/data/v30x/release_3_0_9_rc3.php | 30 ++ .../db/migration/data/v30x/release_3_0_9_rc4.php | 30 ++ phpBB/phpbb/db/migration/data/v310/avatars.php | 69 ++++ phpBB/phpbb/db/migration/data/v310/boardindex.php | 25 ++ .../db/migration/data/v310/config_db_text.php | 47 +++ phpBB/phpbb/db/migration/data/v310/dev.php | 410 +++++++++++++++++++++ phpBB/phpbb/db/migration/data/v310/extensions.php | 71 ++++ .../db/migration/data/v310/forgot_password.php | 30 ++ .../phpbb/db/migration/data/v310/jquery_update.php | 33 ++ .../data/v310/notification_options_reconvert.php | 120 ++++++ .../phpbb/db/migration/data/v310/notifications.php | 98 +++++ .../data/v310/notifications_schema_fix.php | 94 +++++ .../migration/data/v310/reported_posts_display.php | 49 +++ .../migration/data/v310/signature_module_auth.php | 53 +++ .../phpbb/db/migration/data/v310/softdelete_p1.php | 173 +++++++++ .../phpbb/db/migration/data/v310/softdelete_p2.php | 70 ++++ .../db/migration/data/v310/style_update_p1.php | 187 ++++++++++ .../db/migration/data/v310/style_update_p2.php | 131 +++++++ phpBB/phpbb/db/migration/data/v310/teampage.php | 106 ++++++ phpBB/phpbb/db/migration/data/v310/timezone.php | 165 +++++++++ phpBB/phpbb/db/migration/data/v310/timezone_p2.php | 45 +++ 112 files changed, 4408 insertions(+), 4408 deletions(-) delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_10.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_11.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_3.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_4.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_5.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_6.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_7.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_8.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_9.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php delete mode 100644 phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php delete mode 100644 phpBB/phpbb/db/migration/data/310/avatars.php delete mode 100644 phpBB/phpbb/db/migration/data/310/boardindex.php delete mode 100644 phpBB/phpbb/db/migration/data/310/config_db_text.php delete mode 100644 phpBB/phpbb/db/migration/data/310/dev.php delete mode 100644 phpBB/phpbb/db/migration/data/310/extensions.php delete mode 100644 phpBB/phpbb/db/migration/data/310/forgot_password.php delete mode 100644 phpBB/phpbb/db/migration/data/310/jquery_update.php delete mode 100644 phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php delete mode 100644 phpBB/phpbb/db/migration/data/310/notifications.php delete mode 100644 phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php delete mode 100644 phpBB/phpbb/db/migration/data/310/reported_posts_display.php delete mode 100644 phpBB/phpbb/db/migration/data/310/signature_module_auth.php delete mode 100644 phpBB/phpbb/db/migration/data/310/softdelete_p1.php delete mode 100644 phpBB/phpbb/db/migration/data/310/softdelete_p2.php delete mode 100644 phpBB/phpbb/db/migration/data/310/style_update_p1.php delete mode 100644 phpBB/phpbb/db/migration/data/310/style_update_p2.php delete mode 100644 phpBB/phpbb/db/migration/data/310/teampage.php delete mode 100644 phpBB/phpbb/db/migration/data/310/timezone.php delete mode 100644 phpBB/phpbb/db/migration/data/310/timezone_p2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php create mode 100644 phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php create mode 100644 phpBB/phpbb/db/migration/data/v310/avatars.php create mode 100644 phpBB/phpbb/db/migration/data/v310/boardindex.php create mode 100644 phpBB/phpbb/db/migration/data/v310/config_db_text.php create mode 100644 phpBB/phpbb/db/migration/data/v310/dev.php create mode 100644 phpBB/phpbb/db/migration/data/v310/extensions.php create mode 100644 phpBB/phpbb/db/migration/data/v310/forgot_password.php create mode 100644 phpBB/phpbb/db/migration/data/v310/jquery_update.php create mode 100644 phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php create mode 100644 phpBB/phpbb/db/migration/data/v310/notifications.php create mode 100644 phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php create mode 100644 phpBB/phpbb/db/migration/data/v310/reported_posts_display.php create mode 100644 phpBB/phpbb/db/migration/data/v310/signature_module_auth.php create mode 100644 phpBB/phpbb/db/migration/data/v310/softdelete_p1.php create mode 100644 phpBB/phpbb/db/migration/data/v310/softdelete_p2.php create mode 100644 phpBB/phpbb/db/migration/data/v310/style_update_p1.php create mode 100644 phpBB/phpbb/db/migration/data/v310/style_update_p2.php create mode 100644 phpBB/phpbb/db/migration/data/v310/teampage.php create mode 100644 phpBB/phpbb/db/migration/data/v310/timezone.php create mode 100644 phpBB/phpbb/db/migration/data/v310/timezone_p2.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1.php deleted file mode 100644 index 2fe0addc06..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_1.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_1_rc1'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.1')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/30x/3_0_10.php deleted file mode 100644 index cdf824a9ff..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.10', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_10_rc3'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.10')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php deleted file mode 100644 index ee05fcabaa..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php +++ /dev/null @@ -1,32 +0,0 @@ -config['version'], '3.0.10-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_9'); - } - - public function update_data() - { - return array( - array('config.add', array('email_max_chunk_size', 50)), - - array('config.update', array('version', '3.0.10-rc1')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php deleted file mode 100644 index f53a4b0d97..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.10-rc2', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_10_rc1'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.10-rc2')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php deleted file mode 100644 index 20456e0458..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.10-rc3', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_10_rc2'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.10-rc3')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/30x/3_0_11.php deleted file mode 100644 index 5b842cba4b..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.11', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11_rc2'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.11')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php deleted file mode 100644 index 1d484a97ca..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php +++ /dev/null @@ -1,97 +0,0 @@ -config['version'], '3.0.11-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_10'); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'cleanup_deactivated_styles'))), - array('custom', array(array(&$this, 'delete_orphan_private_messages'))), - - array('config.update', array('version', '3.0.11-rc1')), - ); - } - - public function cleanup_deactivated_styles() - { - // Updates users having current style a deactivated one - $sql = 'SELECT style_id - FROM ' . STYLES_TABLE . ' - WHERE style_active = 0'; - $result = $this->sql_query($sql); - - $deactivated_style_ids = array(); - while ($style_id = $this->db->sql_fetchfield('style_id', false, $result)) - { - $deactivated_style_ids[] = (int) $style_id; - } - $this->db->sql_freeresult($result); - - if (!empty($deactivated_style_ids)) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . (int) $this->config['default_style'] .' - WHERE ' . $this->db->sql_in_set('user_style', $deactivated_style_ids); - $this->sql_query($sql); - } - } - - public function delete_orphan_private_messages() - { - // Delete orphan private messages - $batch_size = 500; - - $sql_array = array( - 'SELECT' => 'p.msg_id', - 'FROM' => array( - PRIVMSGS_TABLE => 'p', - ), - 'LEFT_JOIN' => array( - array( - 'FROM' => array(PRIVMSGS_TO_TABLE => 't'), - 'ON' => 'p.msg_id = t.msg_id', - ), - ), - 'WHERE' => 't.user_id IS NULL', - ); - $sql = $this->db->sql_build_query('SELECT', $sql_array); - - $result = $this->db->sql_query_limit($sql, $batch_size); - - $delete_pms = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $delete_pms[] = (int) $row['msg_id']; - } - $this->db->sql_freeresult($result); - - if (!empty($delete_pms)) - { - $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' - WHERE ' . $this->db->sql_in_set('msg_id', $delete_pms); - $this->sql_query($sql); - - // Return false to have the Migrator call this function again - return false; - } - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php deleted file mode 100644 index b7e475a87b..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php +++ /dev/null @@ -1,52 +0,0 @@ -config['version'], '3.0.11-rc2', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11_rc1'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'profile_fields' => array( - 'field_show_novalue' => array('BOOL', 0), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'profile_fields' => array( - 'field_show_novalue', - ), - ), - ); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.11-rc2')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php deleted file mode 100644 index f1692f8ef7..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php +++ /dev/null @@ -1,125 +0,0 @@ -config['version'], '3.0.12-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'update_module_auth'))), - array('custom', array(array(&$this, 'update_bots'))), - array('custom', array(array(&$this, 'disable_bots_from_receiving_pms'))), - - array('config.update', array('version', '3.0.12-rc1')), - ); - } - - public function disable_bots_from_receiving_pms() - { - // Disable receiving pms for bots - $sql = 'SELECT user_id - FROM ' . BOTS_TABLE; - $result = $this->db->sql_query($sql); - - $bot_user_ids = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $bot_user_ids[] = (int) $row['user_id']; - } - $this->db->sql_freeresult($result); - - if (!empty($bot_user_ids)) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_allow_pm = 0 - WHERE ' . $this->db->sql_in_set('user_id', $bot_user_ids); - $this->sql_query($sql); - } - } - - public function update_module_auth() - { - $sql = 'UPDATE ' . MODULES_TABLE . ' - SET module_auth = \'acl_u_sig\' - WHERE module_class = \'ucp\' - AND module_basename = \'profile\' - AND module_mode = \'signature\''; - $this->sql_query($sql); - } - - public function update_bots() - { - // Update bots - if (!function_exists('user_delete')) - { - include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); - } - - $bots_updates = array( - // Bot Deletions - 'NG-Search [Bot]' => false, - 'Nutch/CVS [Bot]' => false, - 'OmniExplorer [Bot]' => false, - 'Seekport [Bot]' => false, - 'Synoo [Bot]' => false, - 'WiseNut [Bot]' => false, - - // Bot Updates - // Bot name to bot user agent map - 'Baidu [Spider]' => 'Baiduspider', - 'Exabot [Bot]' => 'Exabot', - 'Voyager [Bot]' => 'voyager/', - 'W3C [Validator]' => 'W3C_Validator', - ); - - foreach ($bots_updates as $bot_name => $bot_agent) - { - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . ' - WHERE user_type = ' . USER_IGNORE . " - AND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'"; - $result = $this->db->sql_query($sql); - $bot_user_id = (int) $this->db->sql_fetchfield('user_id'); - $this->db->sql_freeresult($result); - - if ($bot_user_id) - { - if ($bot_agent === false) - { - $sql = 'DELETE FROM ' . BOTS_TABLE . " - WHERE user_id = $bot_user_id"; - $this->sql_query($sql); - - user_delete('remove', $bot_user_id); - } - else - { - $sql = 'UPDATE ' . BOTS_TABLE . " - SET bot_agent = '" . $this->db->sql_escape($bot_agent) . "' - WHERE user_id = $bot_user_id"; - $this->sql_query($sql); - } - } - } - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php deleted file mode 100644 index 0444de4ac2..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php +++ /dev/null @@ -1,110 +0,0 @@ -config['version'], '3.0.1-rc1', '>='); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'forums' => array( - 'display_subforum_list' => array('BOOL', 1), - ), - $this->table_prefix . 'sessions' => array( - 'session_forum_id' => array('UINT', 0), - ), - ), - 'drop_keys' => array( - $this->table_prefix . 'groups' => array( - 'group_legend', - ), - ), - 'add_index' => array( - $this->table_prefix . 'sessions' => array( - 'session_forum_id' => array('session_forum_id'), - ), - $this->table_prefix . 'groups' => array( - 'group_legend_name' => array('group_legend', 'group_name'), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'forums' => array( - 'display_subforum_list', - ), - $this->table_prefix . 'sessions' => array( - 'session_forum_id', - ), - ), - 'add_index' => array( - $this->table_prefix . 'groups' => array( - 'group_legend' => array('group_legend'), - ), - ), - 'drop_keys' => array( - $this->table_prefix . 'sessions' => array( - 'session_forum_id', - ), - $this->table_prefix . 'groups' => array( - 'group_legend_name', - ), - ), - ); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'fix_unset_last_view_time'))), - array('custom', array(array(&$this, 'reset_smiley_size'))), - - array('config.update', array('version', '3.0.1-rc1')), - ); - } - - public function fix_unset_last_view_time() - { - $sql = 'UPDATE ' . $this->table_prefix . "topics - SET topic_last_view_time = topic_last_post_time - WHERE topic_last_view_time = 0"; - $this->sql_query($sql); - } - - public function reset_smiley_size() - { - // Update smiley sizes - $smileys = array('icon_e_surprised.gif', 'icon_eek.gif', 'icon_cool.gif', 'icon_lol.gif', 'icon_mad.gif', 'icon_razz.gif', 'icon_redface.gif', 'icon_cry.gif', 'icon_evil.gif', 'icon_twisted.gif', 'icon_rolleyes.gif', 'icon_exclaim.gif', 'icon_question.gif', 'icon_idea.gif', 'icon_arrow.gif', 'icon_neutral.gif', 'icon_mrgreen.gif', 'icon_e_ugeek.gif'); - - foreach ($smileys as $smiley) - { - if (file_exists($this->phpbb_root_path . 'images/smilies/' . $smiley)) - { - list($width, $height) = getimagesize($this->phpbb_root_path . 'images/smilies/' . $smiley); - - $sql = 'UPDATE ' . SMILIES_TABLE . ' - SET smiley_width = ' . $width . ', smiley_height = ' . $height . " - WHERE smiley_url = '" . $this->db->sql_escape($smiley) . "'"; - - $this->sql_query($sql); - } - } - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2.php deleted file mode 100644 index 4f9278e2fa..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.2', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_2_rc2'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.2')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php deleted file mode 100644 index 8f709fb769..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php +++ /dev/null @@ -1,34 +0,0 @@ -config['version'], '3.0.2-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_1'); - } - - public function update_data() - { - return array( - array('config.add', array('referer_validation', '1')), - array('config.add', array('check_attachment_content', '1')), - array('config.add', array('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title')), - - array('config.update', array('version', '3.0.2-rc1')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php deleted file mode 100644 index ecbe8bf808..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php +++ /dev/null @@ -1,82 +0,0 @@ -config['version'], '3.0.2-rc2', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_2_rc1'); - } - - public function update_schema() - { - return array( - 'change_columns' => array( - $this->table_prefix . 'drafts' => array( - 'draft_subject' => array('STEXT_UNI', ''), - ), - $this->table_prefix . 'forums' => array( - 'forum_last_post_subject' => array('STEXT_UNI', ''), - ), - $this->table_prefix . 'posts' => array( - 'post_subject' => array('STEXT_UNI', '', 'true_sort'), - ), - $this->table_prefix . 'privmsgs' => array( - 'message_subject' => array('STEXT_UNI', ''), - ), - $this->table_prefix . 'topics' => array( - 'topic_title' => array('STEXT_UNI', '', 'true_sort'), - 'topic_last_post_subject' => array('STEXT_UNI', ''), - ), - ), - 'drop_keys' => array( - $this->table_prefix . 'sessions' => array( - 'session_forum_id', - ), - ), - 'add_index' => array( - $this->table_prefix . 'sessions' => array( - 'session_fid' => array('session_forum_id'), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'add_index' => array( - $this->table_prefix . 'sessions' => array( - 'session_forum_id' => array( - 'session_forum_id', - ), - ), - ), - 'drop_keys' => array( - $this->table_prefix . 'sessions' => array( - 'session_fid', - ), - ), - ); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.2-rc2')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/30x/3_0_3.php deleted file mode 100644 index 5f94bd9018..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_3.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.3', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_3_rc1'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.3')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php deleted file mode 100644 index 631d382135..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php +++ /dev/null @@ -1,85 +0,0 @@ -config['version'], '3.0.3-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_2'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'styles_template' => array( - 'template_inherits_id' => array('UINT:4', 0), - 'template_inherit_path' => array('VCHAR', ''), - ), - $this->table_prefix . 'groups' => array( - 'group_max_recipients' => array('UINT', 0), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'styles_template' => array( - 'template_inherits_id', - 'template_inherit_path', - ), - $this->table_prefix . 'groups' => array( - 'group_max_recipients', - ), - ), - ); - } - - public function update_data() - { - return array( - array('config.add', array('enable_queue_trigger', '0')), - array('config.add', array('queue_trigger_posts', '3')), - array('config.add', array('pm_max_recipients', '0')), - array('custom', array(array(&$this, 'set_group_default_max_recipients'))), - array('config.add', array('dbms_version', $this->db->sql_server_info(true))), - array('permission.add', array('u_masspm_group', true, 'u_masspm')), - array('custom', array(array(&$this, 'correct_acp_email_permissions'))), - - array('config.update', array('version', '3.0.3-rc1')), - ); - } - - public function correct_acp_email_permissions() - { - $sql = 'UPDATE ' . $this->table_prefix . 'modules - SET module_auth = \'acl_a_email && cfg_email_enable\' - WHERE module_class = \'acp\' - AND module_basename = \'email\''; - $this->sql_query($sql); - } - - public function set_group_default_max_recipients() - { - // Set maximum number of recipients for the registered users, bots, guests group - $sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_max_recipients = 5 - WHERE ' . $this->db->sql_in_set('group_name', array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA', 'BOTS')); - $this->sql_query($sql); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/30x/3_0_4.php deleted file mode 100644 index 369f23f7e7..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_4.php +++ /dev/null @@ -1,51 +0,0 @@ -config['version'], '3.0.4', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_4_rc1'); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'rename_log_delete_topic'))), - - array('config.update', array('version', '3.0.4')), - ); - } - - public function rename_log_delete_topic() - { - if ($this->db->sql_layer == 'oracle') - { - // log_operation is CLOB - but we can change this later - $sql = 'UPDATE ' . $this->table_prefix . "log - SET log_operation = 'LOG_DELETE_TOPIC' - WHERE log_operation LIKE 'LOG_TOPIC_DELETED'"; - $this->sql_query($sql); - } - else - { - $sql = 'UPDATE ' . $this->table_prefix . "log - SET log_operation = 'LOG_DELETE_TOPIC' - WHERE log_operation = 'LOG_TOPIC_DELETED'"; - $this->sql_query($sql); - } - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php deleted file mode 100644 index f98d7a59d0..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php +++ /dev/null @@ -1,125 +0,0 @@ -config['version'], '3.0.4-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_3'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'profile_fields' => array( - 'field_show_profile' => array('BOOL', 0), - ), - ), - 'change_columns' => array( - $this->table_prefix . 'styles' => array( - 'style_id' => array('UINT', NULL, 'auto_increment'), - 'template_id' => array('UINT', 0), - 'theme_id' => array('UINT', 0), - 'imageset_id' => array('UINT', 0), - ), - $this->table_prefix . 'styles_imageset' => array( - 'imageset_id' => array('UINT', NULL, 'auto_increment'), - ), - $this->table_prefix . 'styles_imageset_data' => array( - 'image_id' => array('UINT', NULL, 'auto_increment'), - 'imageset_id' => array('UINT', 0), - ), - $this->table_prefix . 'styles_theme' => array( - 'theme_id' => array('UINT', NULL, 'auto_increment'), - ), - $this->table_prefix . 'styles_template' => array( - 'template_id' => array('UINT', NULL, 'auto_increment'), - ), - $this->table_prefix . 'styles_template_data' => array( - 'template_id' => array('UINT', 0), - ), - $this->table_prefix . 'forums' => array( - 'forum_style' => array('UINT', 0), - ), - $this->table_prefix . 'users' => array( - 'user_style' => array('UINT', 0), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'profile_fields' => array( - 'field_show_profile', - ), - ), - ); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'update_custom_profile_fields'))), - - array('config.update', array('version', '3.0.4-rc1')), - ); - } - - public function update_custom_profile_fields() - { - // Update the Custom Profile Fields based on previous settings to the new \format - $sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide - FROM ' . PROFILE_FIELDS_TABLE; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $sql_ary = array( - 'field_required' => 0, - 'field_show_on_reg' => 0, - 'field_hide' => 0, - 'field_show_profile'=> 0, - ); - - if ($row['field_required']) - { - $sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; - } - else if ($row['field_show_on_reg']) - { - $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; - } - else if ($row['field_hide']) - { - // Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module - $sql_ary['field_hide'] = 1; - } - else - { - // equivelant to "none", which is the "Display in user control panel" option - $sql_ary['field_show_profile'] = 1; - } - - $this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary); - } - - $this->db->sql_freeresult($result); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/30x/3_0_5.php deleted file mode 100644 index 9265f09b39..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.5', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_5_rc1part2'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.5')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php deleted file mode 100644 index b99313de5d..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php +++ /dev/null @@ -1,126 +0,0 @@ -config['version'], '3.0.5-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_4'); - } - - public function update_schema() - { - return array( - 'change_columns' => array( - $this->table_prefix . 'forums' => array( - 'forum_style' => array('UINT', 0), - ), - ), - ); - } - - public function update_data() - { - $search_indexing_state = $this->config['search_indexing_state']; - - return array( - array('config.add', array('captcha_gd_wave', 0)), - array('config.add', array('captcha_gd_3d_noise', 1)), - array('config.add', array('captcha_gd_fonts', 1)), - array('config.add', array('confirm_refresh', 1)), - array('config.add', array('max_num_search_keywords', 10)), - array('config.remove', array('search_indexing_state')), - array('config.add', array('search_indexing_state', $search_indexing_state, true)), - array('custom', array(array(&$this, 'hash_old_passwords'))), - array('custom', array(array(&$this, 'update_ichiro_bot'))), - ); - } - - public function hash_old_passwords() - { - $sql = 'SELECT user_id, user_password - FROM ' . $this->table_prefix . 'users - WHERE user_pass_convert = 1'; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - if (strlen($row['user_password']) == 32) - { - $sql_ary = array( - 'user_password' => phpbb_hash($row['user_password']), - ); - - $this->sql_query('UPDATE ' . $this->table_prefix . 'users SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id']); - } - } - $this->db->sql_freeresult($result); - } - - public function update_ichiro_bot() - { - // Adjust bot entry - $sql = 'UPDATE ' . $this->table_prefix . "bots - SET bot_agent = 'ichiro/' - WHERE bot_agent = 'ichiro/2'"; - $this->sql_query($sql); - } - - public function remove_duplicate_auth_options() - { - // Before we are able to add a unique key to auth_option, we need to remove duplicate entries - $sql = 'SELECT auth_option - FROM ' . $this->table_prefix . 'acl_options - GROUP BY auth_option - HAVING COUNT(*) >= 2'; - $result = $this->db->sql_query($sql); - - $auth_options = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $auth_options[] = $row['auth_option']; - } - $this->db->sql_freeresult($result); - - // Remove specific auth options - if (!empty($auth_options)) - { - foreach ($auth_options as $option) - { - // Select auth_option_ids... the largest id will be preserved - $sql = 'SELECT auth_option_id - FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option = '" . $db->sql_escape($option) . "' - ORDER BY auth_option_id DESC"; - // sql_query_limit not possible here, due to bug in postgresql layer - $result = $this->db->sql_query($sql); - - // Skip first row, this is our original auth option we want to preserve - $row = $this->db->sql_fetchrow($result); - - while ($row = $this->db->sql_fetchrow($result)) - { - // Ok, remove this auth option... - $this->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); - $this->sql_query('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); - $this->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); - $this->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); - } - $this->db->sql_freeresult($result); - } - } - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php deleted file mode 100644 index 65787f9310..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php +++ /dev/null @@ -1,44 +0,0 @@ -config['version'], '3.0.5-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_5_rc1'); - } - - public function update_schema() - { - return array( - 'drop_keys' => array( - $this->table_prefix . 'acl_options' => array('auth_option'), - ), - 'add_unique_index' => array( - $this->table_prefix . 'acl_options' => array( - 'auth_option' => array('auth_option'), - ), - ), - ); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.5-rc1')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/30x/3_0_6.php deleted file mode 100644 index 382fb6cde2..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.6', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_6_rc4'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.6')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php deleted file mode 100644 index 0b54c3b195..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php +++ /dev/null @@ -1,326 +0,0 @@ -config['version'], '3.0.6-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_5'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'confirm' => array( - 'attempts' => array('UINT', 0), - ), - $this->table_prefix . 'users' => array( - 'user_new' => array('BOOL', 1), - 'user_reminded' => array('TINT:4', 0), - 'user_reminded_time' => array('TIMESTAMP', 0), - ), - $this->table_prefix . 'groups' => array( - 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), - ), - $this->table_prefix . 'privmsgs' => array( - 'message_reported' => array('BOOL', 0), - ), - $this->table_prefix . 'reports' => array( - 'pm_id' => array('UINT', 0), - ), - $this->table_prefix . 'profile_fields' => array( - 'field_show_on_vt' => array('BOOL', 0), - ), - $this->table_prefix . 'forums' => array( - 'forum_options' => array('UINT:20', 0), - ), - ), - 'change_columns' => array( - $this->table_prefix . 'users' => array( - 'user_options' => array('UINT:11', 230271), - ), - ), - 'add_index' => array( - $this->table_prefix . 'reports' => array( - 'post_id' => array('post_id'), - 'pm_id' => array('pm_id'), - ), - $this->table_prefix . 'posts' => array( - 'post_username' => array('post_username:255'), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'confirm' => array( - 'attempts', - ), - $this->table_prefix . 'users' => array( - 'user_new', - 'user_reminded', - 'user_reminded_time', - ), - $this->table_prefix . 'groups' => array( - 'group_skip_auth', - ), - $this->table_prefix . 'privmsgs' => array( - 'message_reported', - ), - $this->table_prefix . 'reports' => array( - 'pm_id', - ), - $this->table_prefix . 'profile_fields' => array( - 'field_show_on_vt', - ), - $this->table_prefix . 'forums' => array( - 'forum_options', - ), - ), - 'drop_keys' => array( - $this->table_prefix . 'reports' => array( - 'post_id', - 'pm_id', - ), - $this->table_prefix . 'posts' => array( - 'post_username', - ), - ), - ); - } - - public function update_data() - { - return array( - array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')), - array('if', array( - ($this->config['captcha_gd']), - array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')), - )), - - array('config.add', array('feed_enable', 0)), - array('config.add', array('feed_limit', 10)), - array('config.add', array('feed_overall_forums', 1)), - array('config.add', array('feed_overall_forums_limit', 15)), - array('config.add', array('feed_overall_topics', 0)), - array('config.add', array('feed_overall_topics_limit', 15)), - array('config.add', array('feed_forum', 1)), - array('config.add', array('feed_topic', 1)), - array('config.add', array('feed_item_statistics', 1)), - - array('config.add', array('smilies_per_page', 50)), - array('config.add', array('allow_pm_report', 1)), - array('config.add', array('min_post_chars', 1)), - array('config.add', array('allow_quick_reply', 1)), - array('config.add', array('new_member_post_limit', 0)), - array('config.add', array('new_member_group_default', 0)), - array('config.add', array('delete_time', $this->config['edit_time'])), - - array('config.add', array('allow_avatar', 0)), - array('if', array( - ($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']), - array('config.update', array('allow_avatar', 1)), - )), - array('config.add', array('allow_avatar_remote_upload', 0)), - array('if', array( - ($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']), - array('config.update', array('allow_avatar_remote_upload', 1)), - )), - - array('module.add', array( - 'acp', - 'ACP_BOARD_CONFIGURATION', - array( - 'module_basename' => 'acp_board', - 'modes' => array('feed'), - ), - )), - array('module.add', array( - 'acp', - 'ACP_CAT_USERS', - array( - 'module_basename' => 'acp_users', - 'modes' => array('warnings'), - ), - )), - array('module.add', array( - 'acp', - 'ACP_SERVER_CONFIGURATION', - array( - 'module_basename' => 'acp_send_statistics', - 'modes' => array('send_statistics'), - ), - )), - array('module.add', array( - 'acp', - 'ACP_FORUM_BASED_PERMISSIONS', - array( - 'module_basename' => 'acp_permissions', - 'modes' => array('setting_forum_copy'), - ), - )), - array('module.add', array( - 'mcp', - 'MCP_REPORTS', - array( - 'module_basename' => 'mcp_pm_reports', - 'modes' => array('pm_reports','pm_reports_closed','pm_report_details'), - ), - )), - array('custom', array(array(&$this, 'add_newly_registered_group'))), - array('custom', array(array(&$this, 'set_user_options_default'))), - - array('config.update', array('version', '3.0.6-rc1')), - ); - } - - public function set_user_options_default() - { - // 229376 is the added value to enable all three signature options - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376'; - $this->sql_query($sql); - } - - public function add_newly_registered_group() - { - // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) - $sql = 'SELECT group_id - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'NEWLY_REGISTERED'"; - $result = $this->db->sql_query($sql); - $group_id = (int) $this->db->sql_fetchfield('group_id'); - $this->db->sql_freeresult($result); - - if (!$group_id) - { - $sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)"; - $this->sql_query($sql); - - $group_id = $this->db->sql_nextid(); - } - - // Insert new \user role... at the end of the chain - $sql = 'SELECT role_id - FROM ' . ACL_ROLES_TABLE . " - WHERE role_name = 'ROLE_USER_NEW_MEMBER' - AND role_type = 'u_'"; - $result = $this->db->sql_query($sql); - $u_role = (int) $this->db->sql_fetchfield('role_id'); - $this->db->sql_freeresult($result); - - if (!$u_role) - { - $sql = 'SELECT MAX(role_order) as max_order_id - FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = 'u_'"; - $result = $this->db->sql_query($sql); - $next_order_id = (int) $this->db->sql_fetchfield('max_order_id'); - $this->db->sql_freeresult($result); - - $next_order_id++; - - $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)"; - $this->sql_query($sql); - $u_role = $this->db->sql_nextid(); - - // Now add the correct data to the roles... - // The standard role says that new \users are not able to send a PM, Mass PM, are not able to PM groups - $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')"; - $this->sql_query($sql); - - // Add user role to group - $sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)"; - $this->sql_query($sql); - } - - // Insert new \forum role - $sql = 'SELECT role_id - FROM ' . ACL_ROLES_TABLE . " - WHERE role_name = 'ROLE_FORUM_NEW_MEMBER' - AND role_type = 'f_'"; - $result = $this->db->sql_query($sql); - $f_role = (int) $this->db->sql_fetchfield('role_id'); - $this->db->sql_freeresult($result); - - if (!$f_role) - { - $sql = 'SELECT MAX(role_order) as max_order_id - FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = 'f_'"; - $result = $this->db->sql_query($sql); - $next_order_id = (int) $this->db->sql_fetchfield('max_order_id'); - $this->db->sql_freeresult($result); - - $next_order_id++; - - $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)"; - $this->sql_query($sql); - $f_role = $this->db->sql_nextid(); - - $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')"; - $this->sql_query($sql); - } - - // Set every members user_new \column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) - $sql = 'SELECT 1 - FROM ' . USERS_TABLE . ' - WHERE user_new = 0'; - $result = $this->db->sql_query_limit($sql, 1); - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - if (!$row) - { - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0'; - $this->sql_query($sql); - } - - // To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts... - // Check if the role is already assigned... - $sql = 'SELECT forum_id - FROM ' . ACL_GROUPS_TABLE . ' - WHERE group_id = ' . $group_id . ' - AND auth_role_id = ' . $f_role; - $result = $this->db->sql_query($sql); - $is_options = (int) $this->db->sql_fetchfield('forum_id'); - $this->db->sql_freeresult($result); - - // Not assigned at all... :/ - if (!$is_options) - { - // Get postable forums - $sql = 'SELECT forum_id - FROM ' . FORUMS_TABLE . ' - WHERE forum_type != ' . FORUM_LINK; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $this->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)'); - } - $this->db->sql_freeresult($result); - } - - // Clear permissions... - include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); - $auth_admin = new \auth_admin(); - $auth_admin->acl_clear_prefetch(); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php deleted file mode 100644 index 041224d19a..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.6-rc2', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_6_rc1'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.6-rc2')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php deleted file mode 100644 index 3183c16efd..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php +++ /dev/null @@ -1,42 +0,0 @@ -config['version'], '3.0.6-rc3', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_6_rc2'); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'update_cp_fields'))), - - array('config.update', array('version', '3.0.6-rc3')), - ); - } - - public function update_cp_fields() - { - // Update the Custom Profile Fields based on previous settings to the new \format - $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . ' - SET field_show_on_vt = 1 - WHERE field_hide = 0 - AND (field_required = 1 OR field_show_on_reg = 1 OR field_show_profile = 1)'; - $this->sql_query($sql); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php deleted file mode 100644 index 7d75b12130..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.6-rc4', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_6_rc3'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.6-rc4')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/30x/3_0_7.php deleted file mode 100644 index 1b1e5d0373..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.7', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_7_rc2'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.7')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php deleted file mode 100644 index a45c9c3c14..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.7-pl1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_7'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.7-pl1')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php deleted file mode 100644 index dab90512ab..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php +++ /dev/null @@ -1,78 +0,0 @@ -config['version'], '3.0.7-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_6'); - } - - public function update_schema() - { - return array( - 'drop_keys' => array( - $this->table_prefix . 'log' => array( - 'log_time', - ), - ), - 'add_index' => array( - $this->table_prefix . 'topics_track' => array( - 'topic_id' => array('topic_id'), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'add_index' => array( - $this->table_prefix . 'log' => array( - 'log_time' => array('log_time'), - ), - ), - 'drop_keys' => array( - $this->table_prefix . 'topics_track' => array( - 'topic_id', - ), - ), - ); - } - - public function update_data() - { - return array( - array('config.add', array('feed_overall', 1)), - array('config.add', array('feed_http_auth', 0)), - array('config.add', array('feed_limit_post', $this->config['feed_limit'])), - array('config.add', array('feed_limit_topic', $this->config['feed_overall_topics_limit'])), - array('config.add', array('feed_topics_new', $this->config['feed_overall_topics'])), - array('config.add', array('feed_topics_active', $this->config['feed_overall_topics'])), - array('custom', array(array(&$this, 'delete_text_templates'))), - - array('config.update', array('version', '3.0.7-rc1')), - ); - } - - public function delete_text_templates() - { - // Delete all text-templates from the template_data - $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . ' - WHERE template_filename ' . $this->db->sql_like_expression($this->db->any_char . '.txt'); - $this->sql_query($sql); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php deleted file mode 100644 index ea430740c6..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php +++ /dev/null @@ -1,75 +0,0 @@ -config['version'], '3.0.7-rc2', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_7_rc1'); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'update_email_hash'))), - - array('config.update', array('version', '3.0.7-rc2')), - ); - } - - public function update_email_hash($start = 0) - { - $limit = 1000; - - $sql = 'SELECT user_id, user_email, user_email_hash - FROM ' . USERS_TABLE . ' - WHERE user_type <> ' . USER_IGNORE . " - AND user_email <> ''"; - $result = $this->db->sql_query_limit($sql, $limit, $start); - - $i = 0; - while ($row = $this->db->sql_fetchrow($result)) - { - $i++; - - // Snapshot of the phpbb_email_hash() function - // We cannot call it directly because the auto updater updates the DB first. :/ - $user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']); - - if ($user_email_hash != $row['user_email_hash']) - { - $sql_ary = array( - 'user_email_hash' => $user_email_hash, - ); - - $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE user_id = ' . (int) $row['user_id']; - $this->sql_query($sql); - } - } - $this->db->sql_freeresult($result); - - if ($i < $limit) - { - // Completed - return; - } - - // Return the next start, will be sent to $start when this function is called again - return $start + $limit; - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/30x/3_0_8.php deleted file mode 100644 index c08a74e5ee..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_8.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.8', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_8_rc1'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.8')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php deleted file mode 100644 index dce88e249e..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php +++ /dev/null @@ -1,223 +0,0 @@ -config['version'], '3.0.8-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_7_pl1'); - } - - public function update_data() - { - return array( - array('custom', array(array(&$this, 'update_file_extension_group_names'))), - array('custom', array(array(&$this, 'update_module_auth'))), - array('custom', array(array(&$this, 'update_bots'))), - array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))), - array('module.add', array( - 'acp', - 'ACP_MESSAGES', - array( - 'module_basename' => 'acp_board', - 'modes' => array('post'), - ), - )), - array('config.add', array('load_unreads_search', 1)), - array('config.update_if_equals', array(600, 'queue_interval', 60)), - array('config.update_if_equals', array(50, 'email_package_size', 20)), - - array('config.update', array('version', '3.0.8-rc1')), - ); - } - - public function update_file_extension_group_names() - { - // Update file extension group names to use language strings. - $sql = 'SELECT lang_dir - FROM ' . LANG_TABLE; - $result = $this->db->sql_query($sql); - - $extension_groups_updated = array(); - while ($lang_dir = $this->db->sql_fetchfield('lang_dir')) - { - $lang_dir = basename($lang_dir); - - // The language strings we need are either in language/.../acp/attachments.php - // in the update package if we're updating to 3.0.8-RC1 or later, - // or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier. - // On an already updated board, they can also already be in language/.../acp/attachments.php - // in the board root. - $lang_files = array( - "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}", - "{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}", - "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}", - ); - - foreach ($lang_files as $lang_file) - { - if (!file_exists($lang_file)) - { - continue; - } - - $lang = array(); - include($lang_file); - - foreach($lang as $lang_key => $lang_val) - { - if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0) - { - continue; - } - - $sql_ary = array( - 'group_name' => substr($lang_key, 10), // Strip off 'EXT_GROUP_' - ); - - $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . " - WHERE group_name = '" . $this->db->sql_escape($lang_val) . "'"; - $this->sql_query($sql); - - $extension_groups_updated[$lang_key] = true; - } - } - } - $this->db->sql_freeresult($result); - } - - public function update_module_auth() - { - $sql = 'UPDATE ' . MODULES_TABLE . ' - SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\' - WHERE module_class = \'ucp\' - AND module_basename = \'profile\' - AND module_mode = \'avatar\''; - $this->sql_query($sql); - } - - public function update_bots() - { - $bot_name = 'Bing [Bot]'; - $bot_name_clean = utf8_clean_string($bot_name); - - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $this->db->sql_escape($bot_name_clean) . "'"; - $result = $this->db->sql_query($sql); - $bing_already_added = (bool) $this->db->sql_fetchfield('user_id'); - $this->db->sql_freeresult($result); - - if (!$bing_already_added) - { - $bot_agent = 'bingbot/'; - $bot_ip = ''; - $sql = 'SELECT group_id, group_colour - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'BOTS'"; - $result = $this->db->sql_query($sql); - $group_row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - if (!$group_row) - { - // default fallback, should never get here - $group_row['group_id'] = 6; - $group_row['group_colour'] = '9E8DA7'; - } - - if (!function_exists('user_add')) - { - include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); - } - - $user_row = array( - 'user_type' => USER_IGNORE, - 'group_id' => $group_row['group_id'], - 'username' => $bot_name, - 'user_regdate' => time(), - 'user_password' => '', - 'user_colour' => $group_row['group_colour'], - 'user_email' => '', - 'user_lang' => $this->config['default_lang'], - 'user_style' => $this->config['default_style'], - 'user_timezone' => 0, - 'user_dateformat' => $this->config['default_dateformat'], - 'user_allow_massemail' => 0, - ); - - $user_id = user_add($user_row); - - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( - 'bot_active' => 1, - 'bot_name' => (string) $bot_name, - 'user_id' => (int) $user_id, - 'bot_agent' => (string) $bot_agent, - 'bot_ip' => (string) $bot_ip, - )); - - $this->sql_query($sql); - } - } - - public function delete_orphan_shadow_topics() - { - // Delete shadow topics pointing to not existing topics - $batch_size = 500; - - // Set of affected forums we have to resync - $sync_forum_ids = array(); - - $sql_array = array( - 'SELECT' => 't1.topic_id, t1.forum_id', - 'FROM' => array( - TOPICS_TABLE => 't1', - ), - 'LEFT_JOIN' => array( - array( - 'FROM' => array(TOPICS_TABLE => 't2'), - 'ON' => 't1.topic_moved_id = t2.topic_id', - ), - ), - 'WHERE' => 't1.topic_moved_id <> 0 - AND t2.topic_id IS NULL', - ); - $sql = $this->db->sql_build_query('SELECT', $sql_array); - $result = $this->db->sql_query_limit($sql, $batch_size); - - $topic_ids = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $topic_ids[] = (int) $row['topic_id']; - - $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; - } - $this->db->sql_freeresult($result); - - if (!empty($topic_ids)) - { - $sql = 'DELETE FROM ' . TOPICS_TABLE . ' - WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids); - $this->db->sql_query($sql); - - // Sync the forums we have deleted shadow topics from. - sync('forum', 'forum_id', $sync_forum_ids, true, true); - - return false; - } - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/30x/3_0_9.php deleted file mode 100644 index 8254ac8561..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.9', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_9_rc4'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.9')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php deleted file mode 100644 index 14e0fe6013..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php +++ /dev/null @@ -1,126 +0,0 @@ -config['version'], '3.0.9-rc1', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_8'); - } - - public function update_schema() - { - return array( - 'add_tables' => array( - $this->table_prefix . 'login_attempts' => array( - 'COLUMNS' => array( - // this column was removed from the database updater - // after 3.0.9-RC3 was released. It might still exist - // in 3.0.9-RCX installations and has to be dropped as - // soon as the db_tools class is capable of properly - // removing a primary key. - // 'attempt_id' => array('UINT', NULL, 'auto_increment'), - 'attempt_ip' => array('VCHAR:40', ''), - 'attempt_browser' => array('VCHAR:150', ''), - 'attempt_forwarded_for' => array('VCHAR:255', ''), - 'attempt_time' => array('TIMESTAMP', 0), - 'user_id' => array('UINT', 0), - 'username' => array('VCHAR_UNI:255', 0), - 'username_clean' => array('VCHAR_CI', 0), - ), - //'PRIMARY_KEY' => 'attempt_id', - 'KEYS' => array( - 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), - 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), - 'att_time' => array('INDEX', array('attempt_time')), - 'user_id' => array('INDEX', 'user_id'), - ), - ), - ), - 'change_columns' => array( - $this->table_prefix . 'bbcodes' => array( - 'bbcode_id' => array('USINT', 0), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_tables' => array( - $this->table_prefix . 'login_attempts', - ), - ); - } - - public function update_data() - { - return array( - array('config.add', array('ip_login_limit_max', 50)), - array('config.add', array('ip_login_limit_time', 21600)), - array('config.add', array('ip_login_limit_use_forwarded', 0)), - array('custom', array(array(&$this, 'update_file_extension_group_names'))), - array('custom', array(array(&$this, 'fix_firebird_qa_captcha'))), - - array('config.update', array('version', '3.0.9-rc1')), - ); - } - - public function update_file_extension_group_names() - { - // Update file extension group names to use language strings, again. - $sql = 'SELECT group_id, group_name - FROM ' . EXTENSION_GROUPS_TABLE . ' - WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->any_char); - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $sql_ary = array( - 'group_name' => substr($row['group_name'], 10), // Strip off 'EXT_GROUP_' - ); - - $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE group_id = ' . $row['group_id']; - $this->sql_query($sql); - } - $this->db->sql_freeresult($result); - } - - public function fix_firebird_qa_captcha() - { - // Recover from potentially broken Q&A CAPTCHA table on firebird - // Q&A CAPTCHA was uninstallable, so it's safe to remove these - // without data loss - if ($this->db_tools->sql_layer == 'firebird') - { - $tables = array( - $this->table_prefix . 'captcha_questions', - $this->table_prefix . 'captcha_answers', - $this->table_prefix . 'qa_confirm', - ); - foreach ($tables as $table) - { - if ($this->db_tools->sql_table_exists($table)) - { - $this->db_tools->sql_table_drop($table); - } - } - } - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php deleted file mode 100644 index 44fd789353..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.9-rc2', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_9_rc1'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.9-rc2')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php deleted file mode 100644 index e4102fb193..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.9-rc3', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_9_rc2'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.9-rc3')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php deleted file mode 100644 index 5896d11ba5..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php +++ /dev/null @@ -1,30 +0,0 @@ -config['version'], '3.0.9-rc4', '>='); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_9_rc3'); - } - - public function update_data() - { - return array( - array('config.update', array('version', '3.0.9-rc4')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php deleted file mode 100644 index 360daed437..0000000000 --- a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php +++ /dev/null @@ -1,59 +0,0 @@ -db->sql_like_expression($this->db->any_char . 'LOCAL_URL' . $this->db->any_char); - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - if (!class_exists('acp_bbcodes')) - { - global $phpEx; - phpbb_require_updated('includes/acp/acp_bbcodes.' . $phpEx); - } - $bbcode_match = $row['bbcode_match']; - $bbcode_tpl = $row['bbcode_tpl']; - - $acp_bbcodes = new \acp_bbcodes(); - $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl); - - $sql = 'UPDATE ' . BBCODES_TABLE . ' - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE bbcode_id = ' . (int) $row['bbcode_id']; - $this->sql_query($sql); - } - $this->db->sql_freeresult($result); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/310/avatars.php deleted file mode 100644 index 0d539d0c75..0000000000 --- a/phpBB/phpbb/db/migration/data/310/avatars.php +++ /dev/null @@ -1,69 +0,0 @@ -config['allow_avatar_gravatar']); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_schema() - { - return array( - 'change_columns' => array( - $this->table_prefix . 'users' => array( - 'user_avatar_type' => array('VCHAR:255', ''), - ), - $this->table_prefix . 'groups' => array( - 'group_avatar_type' => array('VCHAR:255', ''), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'change_columns' => array( - $this->table_prefix . 'users' => array( - 'user_avatar_type' => array('TINT:2', ''), - ), - $this->table_prefix . 'groups' => array( - 'group_avatar_type' => array('TINT:2', ''), - ), - ), - ); - } - - public function update_data() - { - return array( - array('config.add', array('allow_avatar_gravatar', 0)), - array('custom', array(array($this, 'update_module_auth'))), - ); - } - - public function update_module_auth() - { - $sql = 'UPDATE ' . $this->table_prefix . "modules - SET module_auth = 'cfg_allow_avatar' - WHERE module_class = 'ucp' - AND module_basename = 'ucp_profile' - AND module_mode = 'avatar'"; - $this->db->sql_query($sql); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/310/boardindex.php deleted file mode 100644 index ee403a7360..0000000000 --- a/phpBB/phpbb/db/migration/data/310/boardindex.php +++ /dev/null @@ -1,25 +0,0 @@ -config['board_index_text']); - } - - public function update_data() - { - return array( - array('config.add', array('board_index_text', '')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/310/config_db_text.php deleted file mode 100644 index 932edf39d7..0000000000 --- a/phpBB/phpbb/db/migration/data/310/config_db_text.php +++ /dev/null @@ -1,47 +0,0 @@ -db_tools->sql_table_exists($this->table_prefix . 'config_text'); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_schema() - { - return array( - 'add_tables' => array( - $this->table_prefix . 'config_text' => array( - 'COLUMNS' => array( - 'config_name' => array('VCHAR', ''), - 'config_value' => array('MTEXT', ''), - ), - 'PRIMARY_KEY' => 'config_name', - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_tables' => array( - $this->table_prefix . 'config_text', - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/310/dev.php deleted file mode 100644 index 702073bcdd..0000000000 --- a/phpBB/phpbb/db/migration/data/310/dev.php +++ /dev/null @@ -1,410 +0,0 @@ -config['version'], '3.1.0-dev', '>='); - } - - static public function depends_on() - { - return array( - '\phpbb\db\migration\data0\extensions', - '\phpbb\db\migration\data0\style_update_p2', - '\phpbb\db\migration\data0\timezone_p2', - '\phpbb\db\migration\data0\reported_posts_display', - ); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'groups' => array( - 'group_teampage' => array('UINT', 0, 'after' => 'group_legend'), - ), - $this->table_prefix . 'profile_fields' => array( - 'field_show_on_pm' => array('BOOL', 0), - ), - $this->table_prefix . 'styles' => array( - 'style_path' => array('VCHAR:100', ''), - 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), - 'style_parent_id' => array('UINT:4', 0), - 'style_parent_tree' => array('TEXT', ''), - ), - $this->table_prefix . 'reports' => array( - 'reported_post_text' => array('MTEXT_UNI', ''), - 'reported_post_uid' => array('VCHAR:8', ''), - 'reported_post_bitfield' => array('VCHAR:255', ''), - ), - ), - 'change_columns' => array( - $this->table_prefix . 'groups' => array( - 'group_legend' => array('UINT', 0), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'groups' => array( - 'group_teampage', - ), - $this->table_prefix . 'profile_fields' => array( - 'field_show_on_pm', - ), - $this->table_prefix . 'styles' => array( - 'style_path', - 'bbcode_bitfield', - 'style_parent_id', - 'style_parent_tree', - ), - $this->table_prefix . 'reports' => array( - 'reported_post_text', - 'reported_post_uid', - 'reported_post_bitfield', - ), - ), - ); - } - - public function update_data() - { - return array( - array('if', array( - (strpos('phpbb_search_', $this->config['search_type']) !== 0), - array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), - )), - - array('config.add', array('fulltext_postgres_ts_name', 'simple')), - array('config.add', array('fulltext_postgres_min_word_len', 4)), - array('config.add', array('fulltext_postgres_max_word_len', 254)), - array('config.add', array('fulltext_sphinx_stopwords', 0)), - array('config.add', array('fulltext_sphinx_indexer_mem_limit', 512)), - - array('config.add', array('load_jquery_cdn', 0)), - array('config.add', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')), - - array('config.add', array('use_system_cron', 0)), - - array('config.add', array('legend_sort_groupname', 0)), - array('config.add', array('teampage_forums', 1)), - array('config.add', array('teampage_memberships', 1)), - - array('config.add', array('load_cpf_pm', 0)), - - array('config.add', array('display_last_subject', 1)), - - array('config.add', array('assets_version', 1)), - - array('config.add', array('site_home_url', '')), - array('config.add', array('site_home_text', '')), - - array('permission.add', array('u_chgprofileinfo', true, 'u_sig')), - - array('module.add', array( - 'acp', - 'ACP_GROUPS', - array( - 'module_basename' => 'acp_groups', - 'modes' => array('position'), - ), - )), - array('module.add', array( - 'acp', - 'ACP_ATTACHMENTS', - array( - 'module_basename' => 'acp_attachments', - 'modes' => array('manage'), - ), - )), - array('module.add', array( - 'acp', - 'ACP_STYLE_MANAGEMENT', - array( - 'module_basename' => 'acp_styles', - 'modes' => array('install', 'cache'), - ), - )), - array('module.add', array( - 'ucp', - 'UCP_PROFILE', - array( - 'module_basename' => 'ucp_profile', - 'modes' => array('autologin_keys'), - ), - )), - // Module will be renamed later - array('module.add', array( - 'acp', - 'ACP_CAT_STYLES', - 'ACP_LANGUAGE' - )), - - array('module.remove', array( - 'acp', - false, - 'ACP_TEMPLATES', - )), - array('module.remove', array( - 'acp', - false, - 'ACP_THEMES', - )), - array('module.remove', array( - 'acp', - false, - 'ACP_IMAGESETS', - )), - - array('custom', array(array($this, 'rename_module_basenames'))), - array('custom', array(array($this, 'rename_styles_module'))), - array('custom', array(array($this, 'add_group_teampage'))), - array('custom', array(array($this, 'update_group_legend'))), - array('custom', array(array($this, 'localise_global_announcements'))), - array('custom', array(array($this, 'update_ucp_pm_basename'))), - array('custom', array(array($this, 'update_ucp_profile_auth'))), - array('custom', array(array($this, 'move_customise_modules'))), - - array('config.update', array('version', '3.1.0-dev')), - ); - } - - public function move_customise_modules() - { - // Move language management to new \location in the Customise tab - // First get language module id - $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " - WHERE module_basename = 'acp_language'"; - $result = $this->db->sql_query($sql); - $language_module_id = $this->db->sql_fetchfield('module_id'); - $this->db->sql_freeresult($result); - // Next get language management module id of the one just created - $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " - WHERE module_langname = 'ACP_LANGUAGE'"; - $result = $this->db->sql_query($sql); - $language_management_module_id = $this->db->sql_fetchfield('module_id'); - $this->db->sql_freeresult($result); - - if (!class_exists('acp_modules')) - { - include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); - } - // acp_modules calls adm_back_link, which is undefined at this point - if (!function_exists('adm_back_link')) - { - include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext); - } - $module_manager = new \acp_modules(); - $module_manager->module_class = 'acp'; - $module_manager->move_module($language_module_id, $language_management_module_id); - } - - public function update_ucp_pm_basename() - { - $sql = 'SELECT module_id, module_basename - FROM ' . MODULES_TABLE . " - WHERE module_basename <> 'ucp_pm' AND - module_langname='UCP_PM'"; - $result = $this->db->sql_query_limit($sql, 1); - - if ($row = $this->db->sql_fetchrow($result)) - { - // This update is still not applied. Applying it - - $sql = 'UPDATE ' . MODULES_TABLE . " - SET module_basename = 'ucp_pm' - WHERE module_id = " . (int) $row['module_id']; - - $this->sql_query($sql); - } - $this->db->sql_freeresult($result); - } - - public function update_ucp_profile_auth() - { - // Update the auth setting for the module - $sql = 'UPDATE ' . MODULES_TABLE . " - SET module_auth = 'acl_u_chgprofileinfo' - WHERE module_class = 'ucp' - AND module_basename = 'ucp_profile' - AND module_mode = 'profile_info'"; - $this->sql_query($sql); - } - - public function rename_styles_module() - { - // Rename styles module to Customise - $sql = 'UPDATE ' . MODULES_TABLE . " - SET module_langname = 'ACP_CAT_CUSTOMISE' - WHERE module_langname = 'ACP_CAT_STYLES'"; - $this->sql_query($sql); - } - - public function rename_module_basenames() - { - // rename all module basenames to full classname - $sql = 'SELECT module_id, module_basename, module_class - FROM ' . MODULES_TABLE; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $module_id = (int) $row['module_id']; - unset($row['module_id']); - - if (!empty($row['module_basename']) && !empty($row['module_class'])) - { - // all the class names start with class name or with phpbb_ for auto loading - if (strpos($row['module_basename'], $row['module_class'] . '_') !== 0 && - strpos($row['module_basename'], 'phpbb_') !== 0) - { - $row['module_basename'] = $row['module_class'] . '_' . $row['module_basename']; - - $sql_update = $this->db->sql_build_array('UPDATE', $row); - - $sql = 'UPDATE ' . MODULES_TABLE . ' - SET ' . $sql_update . ' - WHERE module_id = ' . $module_id; - $this->sql_query($sql); - } - } - } - - $this->db->sql_freeresult($result); - } - - public function add_group_teampage() - { - $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_teampage = 1 - WHERE group_type = ' . GROUP_SPECIAL . " - AND group_name = 'ADMINISTRATORS'"; - $this->sql_query($sql); - - $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_teampage = 2 - WHERE group_type = ' . GROUP_SPECIAL . " - AND group_name = 'GLOBAL_MODERATORS'"; - $this->sql_query($sql); - } - - public function update_group_legend() - { - $sql = 'SELECT group_id - FROM ' . GROUPS_TABLE . ' - WHERE group_legend = 1 - ORDER BY group_name ASC'; - $result = $this->db->sql_query($sql); - - $next_legend = 1; - while ($row = $this->db->sql_fetchrow($result)) - { - $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_legend = ' . $next_legend . ' - WHERE group_id = ' . (int) $row['group_id']; - $this->sql_query($sql); - - $next_legend++; - } - $this->db->sql_freeresult($result); - } - - public function localise_global_announcements() - { - // Localise Global Announcements - $sql = 'SELECT topic_id, topic_approved, (topic_replies + 1) AS topic_posts, topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour - FROM ' . TOPICS_TABLE . ' - WHERE forum_id = 0 - AND topic_type = ' . POST_GLOBAL; - $result = $this->db->sql_query($sql); - - $global_announcements = $update_lastpost_data = array(); - $update_lastpost_data['forum_last_post_time'] = 0; - $update_forum_data = array( - 'forum_posts' => 0, - 'forum_topics' => 0, - 'forum_topics_real' => 0, - ); - - while ($row = $this->db->sql_fetchrow($result)) - { - $global_announcements[] = (int) $row['topic_id']; - - $update_forum_data['forum_posts'] += (int) $row['topic_posts']; - $update_forum_data['forum_topics_real']++; - if ($row['topic_approved']) - { - $update_forum_data['forum_topics']++; - } - - if ($update_lastpost_data['forum_last_post_time'] < $row['topic_last_post_time']) - { - $update_lastpost_data = array( - 'forum_last_post_id' => (int) $row['topic_last_post_id'], - 'forum_last_post_subject' => $row['topic_last_post_subject'], - 'forum_last_post_time' => (int) $row['topic_last_post_time'], - 'forum_last_poster_id' => (int) $row['topic_last_poster_id'], - 'forum_last_poster_name' => $row['topic_last_poster_name'], - 'forum_last_poster_colour' => $row['topic_last_poster_colour'], - ); - } - } - $this->db->sql_freeresult($result); - - if (!empty($global_announcements)) - { - // Update the post/topic-count for the forum and the last-post if needed - $sql = 'SELECT forum_id - FROM ' . FORUMS_TABLE . ' - WHERE forum_type = ' . FORUM_POST; - $result = $this->db->sql_query_limit($sql, 1); - $ga_forum_id = $this->db->sql_fetchfield('forum_id'); - $this->db->sql_freeresult($result); - - $sql = 'SELECT forum_last_post_time - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $ga_forum_id; - $result = $this->db->sql_query($sql); - $lastpost = (int) $this->db->sql_fetchfield('forum_last_post_time'); - $this->db->sql_freeresult($result); - - $sql_update = 'forum_posts = forum_posts + ' . $update_forum_data['forum_posts'] . ', '; - $sql_update .= 'forum_topics_real = forum_topics_real + ' . $update_forum_data['forum_topics_real'] . ', '; - $sql_update .= 'forum_topics = forum_topics + ' . $update_forum_data['forum_topics']; - if ($lastpost < $update_lastpost_data['forum_last_post_time']) - { - $sql_update .= ', ' . $this->db->sql_build_array('UPDATE', $update_lastpost_data); - } - - $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET ' . $sql_update . ' - WHERE forum_id = ' . $ga_forum_id; - $this->sql_query($sql); - - // Update some forum_ids - $table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); - foreach ($table_ary as $table) - { - $sql = "UPDATE $table - SET forum_id = $ga_forum_id - WHERE " . $this->db->sql_in_set('topic_id', $global_announcements); - $this->sql_query($sql); - } - unset($table_ary); - } - } -} diff --git a/phpBB/phpbb/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/310/extensions.php deleted file mode 100644 index fde2038cca..0000000000 --- a/phpBB/phpbb/db/migration/data/310/extensions.php +++ /dev/null @@ -1,71 +0,0 @@ -db_tools->sql_table_exists($this->table_prefix . 'ext'); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_schema() - { - return array( - 'add_tables' => array( - $this->table_prefix . 'ext' => array( - 'COLUMNS' => array( - 'ext_name' => array('VCHAR', ''), - 'ext_active' => array('BOOL', 0), - 'ext_state' => array('TEXT', ''), - ), - 'KEYS' => array( - 'ext_name' => array('UNIQUE', 'ext_name'), - ), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_tables' => array( - $this->table_prefix . 'ext', - ), - ); - } - - public function update_data() - { - return array( - // Module will be renamed later - array('module.add', array( - 'acp', - 'ACP_CAT_STYLES', - 'ACP_EXTENSION_MANAGEMENT' - )), - array('module.add', array( - 'acp', - 'ACP_EXTENSION_MANAGEMENT', - array( - 'module_basename' => 'acp_extensions', - 'modes' => array('main'), - ), - )), - array('permission.add', array('a_extensions', true, 'a_styles')), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/310/forgot_password.php deleted file mode 100644 index 9a42565223..0000000000 --- a/phpBB/phpbb/db/migration/data/310/forgot_password.php +++ /dev/null @@ -1,30 +0,0 @@ -config['allow_password_reset']); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_data() - { - return array( - array('config.add', array('allow_password_reset', 1)), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/310/jquery_update.php deleted file mode 100644 index 2b30e2dd3b..0000000000 --- a/phpBB/phpbb/db/migration/data/310/jquery_update.php +++ /dev/null @@ -1,33 +0,0 @@ -config['load_jquery_url'] !== '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'; - } - - static public function depends_on() - { - return array( - '\phpbb\db\migration\data0\dev', - ); - } - - public function update_data() - { - return array( - array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js')), - ); - } - -} diff --git a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php deleted file mode 100644 index 482051c287..0000000000 --- a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php +++ /dev/null @@ -1,120 +0,0 @@ -table_prefix . 'user_notifications'; - $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $insert_table); - - $this->perform_conversion($insert_buffer, $insert_table); - } - - /** - * Perform the conversion (separate for testability) - * - * @param \phpbb\db\sql_insert_buffer $insert_buffer - * @param string $insert_table - */ - public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $insert_table) - { - $sql = 'DELETE FROM ' . $insert_table; - $this->db->sql_query($sql); - - $sql = 'SELECT user_id, user_notify_type, user_notify_pm - FROM ' . USERS_TABLE; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $notification_methods = array(); - - // In-board notification - $notification_methods[] = ''; - - if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH) - { - $notification_methods[] = 'email'; - } - - if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH) - { - $notification_methods[] = 'jabber'; - } - - // Notifications for posts - foreach (array('post', 'topic') as $item_type) - { - $this->add_method_rows( - $insert_buffer, - $item_type, - 0, - $row['user_id'], - $notification_methods - ); - } - - if ($row['user_notify_pm']) - { - // Notifications for private messages - // User either gets all methods or no method - $this->add_method_rows( - $insert_buffer, - 'pm', - 0, - $row['user_id'], - $notification_methods - ); - } - } - $this->db->sql_freeresult($result); - - $insert_buffer->flush(); - } - - /** - * Insert method rows to DB - * - * @param \phpbb\db\sql_insert_buffer $insert_buffer - * @param string $item_type - * @param int $item_id - * @param int $user_id - * @param string $methods - */ - protected function add_method_rows(\phpbb\db\sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods) - { - $row_base = array( - 'item_type' => $item_type, - 'item_id' => (int) $item_id, - 'user_id' => (int) $user_id, - 'notify' => 1 - ); - - foreach ($methods as $method) - { - $row_base['method'] = $method; - $insert_buffer->insert($row_base); - } - } -} diff --git a/phpBB/phpbb/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/310/notifications.php deleted file mode 100644 index f5bd9ebf07..0000000000 --- a/phpBB/phpbb/db/migration/data/310/notifications.php +++ /dev/null @@ -1,98 +0,0 @@ -db_tools->sql_table_exists($this->table_prefix . 'notifications'); - } - - static public function depends_on() - { - return array('\phpbb\db\migration\data0\dev'); - } - - public function update_schema() - { - return array( - 'add_tables' => array( - $this->table_prefix . 'notification_types' => array( - 'COLUMNS' => array( - 'notification_type' => array('VCHAR:255', ''), - 'notification_type_enabled' => array('BOOL', 1), - ), - 'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'), - ), - $this->table_prefix . 'notifications' => array( - 'COLUMNS' => array( - 'notification_id' => array('UINT', NULL, 'auto_increment'), - 'item_type' => array('VCHAR:255', ''), - 'item_id' => array('UINT', 0), - 'item_parent_id' => array('UINT', 0), - 'user_id' => array('UINT', 0), - 'notification_read' => array('BOOL', 0), - 'notification_time' => array('TIMESTAMP', 1), - 'notification_data' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'notification_id', - 'KEYS' => array( - 'item_ident' => array('INDEX', array('item_type', 'item_id')), - 'user' => array('INDEX', array('user_id', 'notification_read')), - ), - ), - $this->table_prefix . 'user_notifications' => array( - 'COLUMNS' => array( - 'item_type' => array('VCHAR:255', ''), - 'item_id' => array('UINT', 0), - 'user_id' => array('UINT', 0), - 'method' => array('VCHAR:255', ''), - 'notify' => array('BOOL', 1), - ), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_tables' => array( - $this->table_prefix . 'notification_types', - $this->table_prefix . 'notifications', - $this->table_prefix . 'user_notifications', - ), - ); - } - - public function update_data() - { - return array( - array('module.add', array( - 'ucp', - 'UCP_MAIN', - array( - 'module_basename' => 'ucp_notifications', - 'modes' => array('notification_list'), - ), - )), - array('module.add', array( - 'ucp', - 'UCP_PREFS', - array( - 'module_basename' => 'ucp_notifications', - 'modes' => array('notification_options'), - ), - )), - array('config.add', array('load_notifications', 1)), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php deleted file mode 100644 index fa2da6fe92..0000000000 --- a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php +++ /dev/null @@ -1,94 +0,0 @@ - array( - $this->table_prefix . 'notification_types', - $this->table_prefix . 'notifications', - ), - 'add_tables' => array( - $this->table_prefix . 'notification_types' => array( - 'COLUMNS' => array( - 'notification_type_id' => array('USINT', NULL, 'auto_increment'), - 'notification_type_name' => array('VCHAR:255', ''), - 'notification_type_enabled' => array('BOOL', 1), - ), - 'PRIMARY_KEY' => array('notification_type_id'), - 'KEYS' => array( - 'type' => array('UNIQUE', array('notification_type_name')), - ), - ), - $this->table_prefix . 'notifications' => array( - 'COLUMNS' => array( - 'notification_id' => array('UINT:10', NULL, 'auto_increment'), - 'notification_type_id' => array('USINT', 0), - 'item_id' => array('UINT', 0), - 'item_parent_id' => array('UINT', 0), - 'user_id' => array('UINT', 0), - 'notification_read' => array('BOOL', 0), - 'notification_time' => array('TIMESTAMP', 1), - 'notification_data' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'notification_id', - 'KEYS' => array( - 'item_ident' => array('INDEX', array('notification_type_id', 'item_id')), - 'user' => array('INDEX', array('user_id', 'notification_read')), - ), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_tables' => array( - $this->table_prefix . 'notification_types', - $this->table_prefix . 'notifications', - ), - 'add_tables' => array( - $this->table_prefix . 'notification_types' => array( - 'COLUMNS' => array( - 'notification_type' => array('VCHAR:255', ''), - 'notification_type_enabled' => array('BOOL', 1), - ), - 'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'), - ), - $this->table_prefix . 'notifications' => array( - 'COLUMNS' => array( - 'notification_id' => array('UINT', NULL, 'auto_increment'), - 'item_type' => array('VCHAR:255', ''), - 'item_id' => array('UINT', 0), - 'item_parent_id' => array('UINT', 0), - 'user_id' => array('UINT', 0), - 'notification_read' => array('BOOL', 0), - 'notification_time' => array('TIMESTAMP', 1), - 'notification_data' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'notification_id', - 'KEYS' => array( - 'item_ident' => array('INDEX', array('item_type', 'item_id')), - 'user' => array('INDEX', array('user_id', 'notification_read')), - ), - ), - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/310/reported_posts_display.php deleted file mode 100644 index ef35f48970..0000000000 --- a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php +++ /dev/null @@ -1,49 +0,0 @@ -db_tools->sql_column_exists($this->table_prefix . 'reports', 'reported_post_enable_bbcode'); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'reports' => array( - 'reported_post_enable_bbcode' => array('BOOL', 1), - 'reported_post_enable_smilies' => array('BOOL', 1), - 'reported_post_enable_magic_url' => array('BOOL', 1), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'reports' => array( - 'reported_post_enable_bbcode', - 'reported_post_enable_smilies', - 'reported_post_enable_magic_url', - ), - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/310/signature_module_auth.php deleted file mode 100644 index 27585fec10..0000000000 --- a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php +++ /dev/null @@ -1,53 +0,0 @@ -db->sql_query($sql); - $module_auth = $this->db_sql_fetchfield('module_auth'); - $this->db->sql_freeresult($result); - - return $module_auth === 'acl_u_sig' || $module_auth === false; - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_31x_dev'); - } - - public function update_data() - { - return array( - array('custom', array( - array($this, 'update_signature_module_auth'), - ), - ), - ); - } - - public function update_signature_module_auth() - { - $sql = 'UPDATE ' . MODULES_TABLE . " - SET module_auth = 'acl_u_sig' - WHERE module_class = 'ucp' - AND module_basename = 'ucp_profile' - AND module_mode = 'signature' - AND module_auth = ''"; - $this->db->sql_query($sql); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/310/softdelete_p1.php deleted file mode 100644 index 22ee78bb22..0000000000 --- a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php +++ /dev/null @@ -1,173 +0,0 @@ -db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_visibility'); - } - - static public function depends_on() - { - return array('\phpbb\db\migration\data0\dev'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'forums' => array( - 'forum_posts_approved' => array('UINT', 0), - 'forum_posts_unapproved' => array('UINT', 0), - 'forum_posts_softdeleted' => array('UINT', 0), - 'forum_topics_approved' => array('UINT', 0), - 'forum_topics_unapproved' => array('UINT', 0), - 'forum_topics_softdeleted' => array('UINT', 0), - ), - $this->table_prefix . 'posts' => array( - 'post_visibility' => array('TINT:3', 0), - 'post_delete_time' => array('TIMESTAMP', 0), - 'post_delete_reason' => array('STEXT_UNI', ''), - 'post_delete_user' => array('UINT', 0), - ), - $this->table_prefix . 'topics' => array( - 'topic_visibility' => array('TINT:3', 0), - 'topic_delete_time' => array('TIMESTAMP', 0), - 'topic_delete_reason' => array('STEXT_UNI', ''), - 'topic_delete_user' => array('UINT', 0), - 'topic_posts_approved' => array('UINT', 0), - 'topic_posts_unapproved' => array('UINT', 0), - 'topic_posts_softdeleted' => array('UINT', 0), - ), - ), - 'add_index' => array( - $this->table_prefix . 'posts' => array( - 'post_visibility' => array('post_visibility'), - ), - $this->table_prefix . 'topics' => array( - 'topic_visibility' => array('topic_visibility'), - 'forum_vis_last' => array('forum_id', 'topic_visibility', 'topic_last_post_id'), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'forums' => array( - 'forum_posts_approved', - 'forum_posts_unapproved', - 'forum_posts_softdeleted', - 'forum_topics_approved', - 'forum_topics_unapproved', - 'forum_topics_softdeleted', - ), - $this->table_prefix . 'posts' => array( - 'post_visibility', - 'post_delete_time', - 'post_delete_reason', - 'post_delete_user', - ), - $this->table_prefix . 'topics' => array( - 'topic_visibility', - 'topic_delete_time', - 'topic_delete_reason', - 'topic_delete_user', - 'topic_posts_approved', - 'topic_posts_unapproved', - 'topic_posts_softdeleted', - ), - ), - 'drop_keys' => array( - $this->table_prefix . 'posts' => array('post_visibility'), - $this->table_prefix . 'topics' => array('topic_visibility', 'forum_vis_last'), - ), - ); - } - - public function update_data() - { - return array( - array('custom', array(array($this, 'update_post_visibility'))), - array('custom', array(array($this, 'update_topic_visibility'))), - array('custom', array(array($this, 'update_topic_forum_counts'))), - - array('permission.add', array('f_softdelete', false)), - array('permission.add', array('m_softdelete', false)), - ); - } - - public function update_post_visibility() - { - $sql = 'UPDATE ' . $this->table_prefix . 'posts - SET post_visibility = post_approved'; - $this->sql_query($sql); - } - - public function update_topic_visibility() - { - $sql = 'UPDATE ' . $this->table_prefix . 'topics - SET topic_visibility = topic_approved'; - $this->sql_query($sql); - } - - public function update_topic_forum_counts() - { - $sql = 'UPDATE ' . $this->table_prefix . 'topics - SET topic_posts_approved = topic_replies + 1, - topic_posts_unapproved = topic_replies_real - topic_replies - WHERE topic_visibility = ' . ITEM_APPROVED; - $this->sql_query($sql); - - $sql = 'UPDATE ' . $this->table_prefix . 'topics - SET topic_posts_approved = 0, - topic_posts_unapproved = (topic_replies_real - topic_replies) + 1 - WHERE topic_visibility = ' . ITEM_UNAPPROVED; - $this->sql_query($sql); - - $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved - FROM ' . $this->table_prefix . 'topics - GROUP BY forum_id, topic_visibility'; - $result = $this->db->sql_query($sql); - - $update_forums = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $forum_id = (int) $row['forum_id']; - if (!isset($update_forums[$forum_id])) - { - $update_forums[$forum_id] = array( - 'forum_posts_approved' => 0, - 'forum_posts_unapproved' => 0, - 'forum_topics_approved' => 0, - 'forum_topics_unapproved' => 0, - ); - } - - $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts_approved']; - $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved']; - - $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics']; - } - $this->db->sql_freeresult($result); - - foreach ($update_forums as $forum_id => $forum_data) - { - $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET ' . $this->db->sql_build_array('UPDATE', $forum_data) . ' - WHERE forum_id = ' . $forum_id; - $this->sql_query($sql); - } - } -} diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/310/softdelete_p2.php deleted file mode 100644 index 698e44fab7..0000000000 --- a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php +++ /dev/null @@ -1,70 +0,0 @@ -db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_approved'); - } - - static public function depends_on() - { - return array( - '\phpbb\db\migration\data0\dev', - '\phpbb\db\migration\data0\softdelete_p1', - ); - } - - public function update_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'forums' => array('forum_posts', 'forum_topics', 'forum_topics_real'), - $this->table_prefix . 'posts' => array('post_approved'), - $this->table_prefix . 'topics' => array('topic_approved', 'topic_replies', 'topic_replies_real'), - ), - 'drop_keys' => array( - $this->table_prefix . 'posts' => array('post_approved'), - $this->table_prefix . 'topics' => array('forum_appr_last'), - ), - ); - } - - public function revert_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'forums' => array( - 'forum_posts' => array('UINT', 0), - 'forum_topics' => array('UINT', 0), - 'forum_topics_real' => array('UINT', 0), - ), - $this->table_prefix . 'posts' => array( - 'post_approved' => array('BOOL', 1), - ), - $this->table_prefix . 'topics' => array( - 'topic_approved' => array('BOOL', 1), - 'topic_replies' => array('UINT', 0), - 'topic_replies_real' => array('UINT', 0), - ), - ), - 'add_index' => array( - $this->table_prefix . 'posts' => array( - 'post_approved' => array('post_approved'), - ), - $this->table_prefix . 'topics' => array( - 'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'), - ), - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/310/style_update_p1.php deleted file mode 100644 index fe60993f20..0000000000 --- a/phpBB/phpbb/db/migration/data/310/style_update_p1.php +++ /dev/null @@ -1,187 +0,0 @@ -db_tools->sql_table_exists($this->table_prefix . 'styles_imageset'); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'styles' => array( - 'style_path' => array('VCHAR:100', ''), - 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), - 'style_parent_id' => array('UINT', 0), - 'style_parent_tree' => array('TEXT', ''), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'styles' => array( - 'style_path', - 'bbcode_bitfield', - 'style_parent_id', - 'style_parent_tree', - ), - ), - ); - } - - public function update_data() - { - return array( - array('custom', array(array($this, 'styles_update'))), - ); - } - - public function styles_update() - { - // Get list of valid 3.1 styles - $available_styles = array('prosilver'); - - $iterator = new \DirectoryIterator($this->phpbb_root_path . 'styles'); - $skip_dirs = array('.', '..', 'prosilver'); - foreach ($iterator as $fileinfo) - { - if ($fileinfo->isDir() && !in_array($fileinfo->getFilename(), $skip_dirs) && file_exists($fileinfo->getPathname() . '/style.cfg')) - { - $style_cfg = parse_cfg_file($fileinfo->getPathname() . '/style.cfg'); - if (isset($style_cfg['phpbb_version']) && version_compare($style_cfg['phpbb_version'], '3.1.0-dev', '>=')) - { - // 3.1 style - $available_styles[] = $fileinfo->getFilename(); - } - } - } - - // Get all installed styles - if ($this->db_tools->sql_table_exists($this->table_prefix . 'styles_imageset')) - { - $sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id, i.imageset_path - FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . 'styles_theme c, ' . $this->table_prefix . "styles_imageset i - WHERE t.template_id = s.template_id - AND c.theme_id = s.theme_id - AND i.imageset_id = s.imageset_id"; - } - else - { - $sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id - FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . "stles_theme c - WHERE t.template_id = s.template_id - AND c.theme_id = s.theme_id"; - } - $result = $this->db->sql_query($sql); - - $styles = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $styles[] = $row; - } - $this->db->sql_freeresult($result); - - // Decide which styles to keep, all others will be deleted - $valid_styles = array(); - foreach ($styles as $style_row) - { - if ( - // Delete styles with parent style (not supported yet) - $style_row['template_inherits_id'] == 0 && - // Check if components match - $style_row['template_path'] == $style_row['theme_path'] && (!isset($style_row['imageset_path']) || $style_row['template_path'] == $style_row['imageset_path']) && - // Check if components are valid - in_array($style_row['template_path'], $available_styles) - ) - { - // Valid style. Keep it - $sql_ary = array( - 'style_path' => $style_row['template_path'], - 'bbcode_bitfield' => $style_row['bbcode_bitfield'], - 'style_parent_id' => 0, - 'style_parent_tree' => '', - ); - $this->sql_query('UPDATE ' . STYLES_TABLE . ' - SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE style_id = ' . $style_row['style_id']); - $valid_styles[] = (int) $style_row['style_id']; - } - } - - // Remove old entries from styles table - if (!sizeof($valid_styles)) - { - // No valid styles: remove everything and add prosilver - $this->sql_query('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary); - - $sql_ary = array( - 'style_name' => 'prosilver', - 'style_copyright' => '© phpBB Group', - 'style_active' => 1, - 'style_path' => 'prosilver', - 'bbcode_bitfield' => 'lNg=', - 'style_parent_id' => 0, - 'style_parent_tree' => '', - - // Will be removed in the next step - 'imageset_id' => 0, - 'template_id' => 0, - 'theme_id' => 0, - ); - - $sql = 'INSERT INTO ' . STYLES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); - $this->sql_query($sql); - - $sql = 'SELECT style_id - FROM ' . $table . " - WHERE style_name = 'prosilver'"; - $result = $this->sql_query($sql); - $default_style = $this->db->sql_fetchfield($result); - $this->db->sql_freeresult($result); - - set_config('default_style', $default_style); - - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0'; - $this->sql_query($sql); - } - else - { - // There are valid styles in styles table. Remove styles that are outdated - $this->sql_query('DELETE FROM ' . STYLES_TABLE . ' - WHERE ' . $this->db->sql_in_set('style_id', $valid_styles, true)); - - // Change default style - if (!in_array($this->config['default_style'], $valid_styles)) - { - $this->sql_query('UPDATE ' . CONFIG_TABLE . " - SET config_value = '" . $valid_styles[0] . "' - WHERE config_name = 'default_style'"); - } - - // Reset styles for users - $this->sql_query('UPDATE ' . USERS_TABLE . ' - SET user_style = 0 - WHERE ' . $this->db->sql_in_set('user_style', $valid_styles, true)); - } - } -} diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/310/style_update_p2.php deleted file mode 100644 index 3f6477b7cb..0000000000 --- a/phpBB/phpbb/db/migration/data/310/style_update_p2.php +++ /dev/null @@ -1,131 +0,0 @@ -db_tools->sql_table_exists($this->table_prefix . 'styles_imageset'); - } - - static public function depends_on() - { - return array('\phpbb\db\migration\data0\style_update_p1'); - } - - public function update_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'styles' => array( - 'imageset_id', - 'template_id', - 'theme_id', - ), - ), - - 'drop_tables' => array( - $this->table_prefix . 'styles_imageset', - $this->table_prefix . 'styles_imageset_data', - $this->table_prefix . 'styles_template', - $this->table_prefix . 'styles_template_data', - $this->table_prefix . 'styles_theme', - ), - ); - } - - public function revert_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'styles' => array( - 'imageset_id' => array('UINT', 0), - 'template_id' => array('UINT', 0), - 'theme_id' => array('UINT', 0), - ), - ), - - 'add_tables' => array( - $this->table_prefix . 'styles_imageset' => array( - 'COLUMNS' => array( - 'imageset_id' => array('UINT', NULL, 'auto_increment'), - 'imageset_name' => array('VCHAR_UNI:255', ''), - 'imageset_copyright' => array('VCHAR_UNI', ''), - 'imageset_path' => array('VCHAR:100', ''), - ), - 'PRIMARY_KEY' => 'imageset_id', - 'KEYS' => array( - 'imgset_nm' => array('UNIQUE', 'imageset_name'), - ), - ), - $this->table_prefix . 'styles_imageset_data' => array( - 'COLUMNS' => array( - 'image_id' => array('UINT', NULL, 'auto_increment'), - 'image_name' => array('VCHAR:200', ''), - 'image_filename' => array('VCHAR:200', ''), - 'image_lang' => array('VCHAR:30', ''), - 'image_height' => array('USINT', 0), - 'image_width' => array('USINT', 0), - 'imageset_id' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'image_id', - 'KEYS' => array( - 'i_d' => array('INDEX', 'imageset_id'), - ), - ), - $this->table_prefix . 'styles_template' => array( - 'COLUMNS' => array( - 'template_id' => array('UINT', NULL, 'auto_increment'), - 'template_name' => array('VCHAR_UNI:255', ''), - 'template_copyright' => array('VCHAR_UNI', ''), - 'template_path' => array('VCHAR:100', ''), - 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), - 'template_storedb' => array('BOOL', 0), - 'template_inherits_id' => array('UINT:4', 0), - 'template_inherit_path' => array('VCHAR', ''), - ), - 'PRIMARY_KEY' => 'template_id', - 'KEYS' => array( - 'tmplte_nm' => array('UNIQUE', 'template_name'), - ), - ), - $this->table_prefix . 'styles_template_data' => array( - 'COLUMNS' => array( - 'template_id' => array('UINT', 0), - 'template_filename' => array('VCHAR:100', ''), - 'template_included' => array('TEXT', ''), - 'template_mtime' => array('TIMESTAMP', 0), - 'template_data' => array('MTEXT_UNI', ''), - ), - 'KEYS' => array( - 'tid' => array('INDEX', 'template_id'), - 'tfn' => array('INDEX', 'template_filename'), - ), - ), - $this->table_prefix . 'styles_theme' => array( - 'COLUMNS' => array( - 'theme_id' => array('UINT', NULL, 'auto_increment'), - 'theme_name' => array('VCHAR_UNI:255', ''), - 'theme_copyright' => array('VCHAR_UNI', ''), - 'theme_path' => array('VCHAR:100', ''), - 'theme_storedb' => array('BOOL', 0), - 'theme_mtime' => array('TIMESTAMP', 0), - 'theme_data' => array('MTEXT_UNI', ''), - ), - 'PRIMARY_KEY' => 'theme_id', - 'KEYS' => array( - 'theme_name' => array('UNIQUE', 'theme_name'), - ), - ), - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/310/teampage.php deleted file mode 100644 index 605156dc41..0000000000 --- a/phpBB/phpbb/db/migration/data/310/teampage.php +++ /dev/null @@ -1,106 +0,0 @@ -db_tools->sql_table_exists($this->table_prefix . 'teampage'); - } - - static public function depends_on() - { - return array('\phpbb\db\migration\data0\dev'); - } - - public function update_schema() - { - return array( - 'add_tables' => array( - $this->table_prefix . 'teampage' => array( - 'COLUMNS' => array( - 'teampage_id' => array('UINT', NULL, 'auto_increment'), - 'group_id' => array('UINT', 0), - 'teampage_name' => array('VCHAR_UNI:255', ''), - 'teampage_position' => array('UINT', 0), - 'teampage_parent' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'teampage_id', - ), - ), - 'drop_columns' => array( - $this->table_prefix . 'groups' => array( - 'group_teampage', - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_tables' => array( - $this->table_prefix . 'teampage', - ), - 'add_columns' => array( - $this->table_prefix . 'groups' => array( - 'group_teampage' => array('UINT', 0, 'after' => 'group_legend'), - ), - ), - ); - } - - public function update_data() - { - return array( - array('custom', array(array($this, 'add_groups_teampage'))), - ); - } - - public function add_groups_teampage() - { - $sql = 'SELECT teampage_id - FROM ' . TEAMPAGE_TABLE; - $result = $this->db->sql_query_limit($sql, 1); - $added_groups_teampage = (bool) $this->db->sql_fetchfield('teampage_id'); - $this->db->sql_freeresult($result); - - if (!$added_groups_teampage) - { - $sql = 'SELECT * - FROM ' . GROUPS_TABLE . ' - WHERE group_type = ' . GROUP_SPECIAL . " - AND (group_name = 'ADMINISTRATORS' - OR group_name = 'GLOBAL_MODERATORS') - ORDER BY group_name ASC"; - $result = $this->db->sql_query($sql); - - $teampage_entries = array(); - while ($row = $this->db->sql_fetchrow($result)) - { - $teampage_entries[] = array( - 'group_id' => (int) $row['group_id'], - 'teampage_name' => '', - 'teampage_position' => sizeof($teampage_entries) + 1, - 'teampage_parent' => 0, - ); - } - $this->db->sql_freeresult($result); - - if (sizeof($teampage_entries)) - { - $this->db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries); - } - unset($teampage_entries); - } - - } -} diff --git a/phpBB/phpbb/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/310/timezone.php deleted file mode 100644 index 97fea19a64..0000000000 --- a/phpBB/phpbb/db/migration/data/310/timezone.php +++ /dev/null @@ -1,165 +0,0 @@ -db_tools->sql_column_exists($this->table_prefix . 'users', 'user_dst'); - } - - static public function depends_on() - { - return array('phpbb_db_migration_data_30x_3_0_11'); - } - - public function update_schema() - { - return array( - 'change_columns' => array( - $this->table_prefix . 'users' => array( - 'user_timezone' => array('VCHAR:100', ''), - ), - ), - ); - } - - public function update_data() - { - return array( - array('custom', array(array($this, 'update_timezones'))), - ); - } - - public function update_timezones() - { - // Update user timezones - $sql = 'SELECT user_dst, user_timezone - FROM ' . $this->table_prefix . 'users - GROUP BY user_timezone, user_dst'; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $sql = 'UPDATE ' . $this->table_prefix . "users - SET user_timezone = '" . $this->db->sql_escape($this->convert_phpbb30_timezone($row['user_timezone'], $row['user_dst'])) . "' - WHERE user_timezone = '" . $this->db->sql_escape($row['user_timezone']) . "' - AND user_dst = " . (int) $row['user_dst']; - $this->sql_query($sql); - } - $this->db->sql_freeresult($result); - - // Update board default timezone - $sql = 'UPDATE ' . $this->table_prefix . "config - SET config_value = '" . $this->convert_phpbb30_timezone($this->config['board_timezone'], $this->config['board_dst']) . "' - WHERE config_name = 'board_timezone'"; - $this->sql_query($sql); - } - - /** - * Determine the new \timezone for a given phpBB 3.0 timezone and - * "Daylight Saving Time" option - * - * @param $timezone float Users timezone in 3.0 - * @param $dst int Users daylight saving time - * @return string Users new \php Timezone which is used since 3.1 - */ - public function convert_phpbb30_timezone($timezone, $dst) - { - $offset = $timezone + $dst; - - switch ($timezone) - { - case '-12': - return 'Etc/GMT+' . abs($offset); //'[UTC - 12] Baker Island Time' - case '-11': - return 'Etc/GMT+' . abs($offset); //'[UTC - 11] Niue Time, Samoa Standard Time' - case '-10': - return 'Etc/GMT+' . abs($offset); //'[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time' - case '-9.5': - return 'Pacific/Marquesas'; //'[UTC - 9:30] Marquesas Islands Time' - case '-9': - return 'Etc/GMT+' . abs($offset); //'[UTC - 9] Alaska Standard Time, Gambier Island Time' - case '-8': - return 'Etc/GMT+' . abs($offset); //'[UTC - 8] Pacific Standard Time' - case '-7': - return 'Etc/GMT+' . abs($offset); //'[UTC - 7] Mountain Standard Time' - case '-6': - return 'Etc/GMT+' . abs($offset); //'[UTC - 6] Central Standard Time' - case '-5': - return 'Etc/GMT+' . abs($offset); //'[UTC - 5] Eastern Standard Time' - case '-4.5': - return 'America/Caracas'; //'[UTC - 4:30] Venezuelan Standard Time' - case '-4': - return 'Etc/GMT+' . abs($offset); //'[UTC - 4] Atlantic Standard Time' - case '-3.5': - return 'America/St_Johns'; //'[UTC - 3:30] Newfoundland Standard Time' - case '-3': - return 'Etc/GMT+' . abs($offset); //'[UTC - 3] Amazon Standard Time, Central Greenland Time' - case '-2': - return 'Etc/GMT+' . abs($offset); //'[UTC - 2] Fernando de Noronha Time, South Georgia & the South Sandwich Islands Time' - case '-1': - return 'Etc/GMT+' . abs($offset); //'[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time' - case '0': - return (!$dst) ? 'UTC' : 'Etc/GMT-1'; //'[UTC] Western European Time, Greenwich Mean Time' - case '1': - return 'Etc/GMT-' . $offset; //'[UTC + 1] Central European Time, West African Time' - case '2': - return 'Etc/GMT-' . $offset; //'[UTC + 2] Eastern European Time, Central African Time' - case '3': - return 'Etc/GMT-' . $offset; //'[UTC + 3] Moscow Standard Time, Eastern African Time' - case '3.5': - return 'Asia/Tehran'; //'[UTC + 3:30] Iran Standard Time' - case '4': - return 'Etc/GMT-' . $offset; //'[UTC + 4] Gulf Standard Time, Samara Standard Time' - case '4.5': - return 'Asia/Kabul'; //'[UTC + 4:30] Afghanistan Time' - case '5': - return 'Etc/GMT-' . $offset; //'[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time' - case '5.5': - return 'Asia/Kolkata'; //'[UTC + 5:30] Indian Standard Time, Sri Lanka Time' - case '5.75': - return 'Asia/Kathmandu'; //'[UTC + 5:45] Nepal Time' - case '6': - return 'Etc/GMT-' . $offset; //'[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time' - case '6.5': - return 'Indian/Cocos'; //'[UTC + 6:30] Cocos Islands Time, Myanmar Time' - case '7': - return 'Etc/GMT-' . $offset; //'[UTC + 7] Indochina Time, Krasnoyarsk Standard Time' - case '8': - return 'Etc/GMT-' . $offset; //'[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time' - case '8.75': - return 'Australia/Eucla'; //'[UTC + 8:45] Southeastern Western Australia Standard Time' - case '9': - return 'Etc/GMT-' . $offset; //'[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time' - case '9.5': - return 'Australia/ACT'; //'[UTC + 9:30] Australian Central Standard Time' - case '10': - return 'Etc/GMT-' . $offset; //'[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time' - case '10.5': - return 'Australia/Lord_Howe'; //'[UTC + 10:30] Lord Howe Standard Time' - case '11': - return 'Etc/GMT-' . $offset; //'[UTC + 11] Solomon Island Time, Magadan Standard Time' - case '11.5': - return 'Pacific/Norfolk'; //'[UTC + 11:30] Norfolk Island Time' - case '12': - return 'Etc/GMT-12'; //'[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time' - case '12.75': - return 'Pacific/Chatham'; //'[UTC + 12:45] Chatham Islands Time' - case '13': - return 'Pacific/Tongatapu'; //'[UTC + 13] Tonga Time, Phoenix Islands Time' - case '14': - return 'Pacific/Kiritimati'; //'[UTC + 14] Line Island Time' - default: - return 'UTC'; - } - } -} diff --git a/phpBB/phpbb/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/310/timezone_p2.php deleted file mode 100644 index 0c174b0d56..0000000000 --- a/phpBB/phpbb/db/migration/data/310/timezone_p2.php +++ /dev/null @@ -1,45 +0,0 @@ -db_tools->sql_column_exists($this->table_prefix . 'users', 'user_dst'); - } - - static public function depends_on() - { - return array('\phpbb\db\migration\data0\timezone'); - } - - public function update_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'users' => array( - 'user_dst', - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'users' => array( - 'user_dst' => array('BOOL', 0), - ), - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php new file mode 100644 index 0000000000..360daed437 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php @@ -0,0 +1,59 @@ +db->sql_like_expression($this->db->any_char . 'LOCAL_URL' . $this->db->any_char); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if (!class_exists('acp_bbcodes')) + { + global $phpEx; + phpbb_require_updated('includes/acp/acp_bbcodes.' . $phpEx); + } + $bbcode_match = $row['bbcode_match']; + $bbcode_tpl = $row['bbcode_tpl']; + + $acp_bbcodes = new \acp_bbcodes(); + $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl); + + $sql = 'UPDATE ' . BBCODES_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE bbcode_id = ' . (int) $row['bbcode_id']; + $this->sql_query($sql); + } + $this->db->sql_freeresult($result); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php new file mode 100644 index 0000000000..2fe0addc06 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php @@ -0,0 +1,30 @@ +config['version'], '3.0.1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_1_rc1'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php new file mode 100644 index 0000000000..cdf824a9ff --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php @@ -0,0 +1,30 @@ +config['version'], '3.0.10', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_10_rc3'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.10')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php new file mode 100644 index 0000000000..ee05fcabaa --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php @@ -0,0 +1,32 @@ +config['version'], '3.0.10-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_9'); + } + + public function update_data() + { + return array( + array('config.add', array('email_max_chunk_size', 50)), + + array('config.update', array('version', '3.0.10-rc1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php new file mode 100644 index 0000000000..f53a4b0d97 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php @@ -0,0 +1,30 @@ +config['version'], '3.0.10-rc2', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_10_rc1'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.10-rc2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php new file mode 100644 index 0000000000..20456e0458 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php @@ -0,0 +1,30 @@ +config['version'], '3.0.10-rc3', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_10_rc2'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.10-rc3')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php new file mode 100644 index 0000000000..5b842cba4b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php @@ -0,0 +1,30 @@ +config['version'], '3.0.11', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_11_rc2'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.11')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php new file mode 100644 index 0000000000..1d484a97ca --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php @@ -0,0 +1,97 @@ +config['version'], '3.0.11-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_10'); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'cleanup_deactivated_styles'))), + array('custom', array(array(&$this, 'delete_orphan_private_messages'))), + + array('config.update', array('version', '3.0.11-rc1')), + ); + } + + public function cleanup_deactivated_styles() + { + // Updates users having current style a deactivated one + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_active = 0'; + $result = $this->sql_query($sql); + + $deactivated_style_ids = array(); + while ($style_id = $this->db->sql_fetchfield('style_id', false, $result)) + { + $deactivated_style_ids[] = (int) $style_id; + } + $this->db->sql_freeresult($result); + + if (!empty($deactivated_style_ids)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $this->config['default_style'] .' + WHERE ' . $this->db->sql_in_set('user_style', $deactivated_style_ids); + $this->sql_query($sql); + } + } + + public function delete_orphan_private_messages() + { + // Delete orphan private messages + $batch_size = 500; + + $sql_array = array( + 'SELECT' => 'p.msg_id', + 'FROM' => array( + PRIVMSGS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(PRIVMSGS_TO_TABLE => 't'), + 'ON' => 'p.msg_id = t.msg_id', + ), + ), + 'WHERE' => 't.user_id IS NULL', + ); + $sql = $this->db->sql_build_query('SELECT', $sql_array); + + $result = $this->db->sql_query_limit($sql, $batch_size); + + $delete_pms = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $delete_pms[] = (int) $row['msg_id']; + } + $this->db->sql_freeresult($result); + + if (!empty($delete_pms)) + { + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $this->db->sql_in_set('msg_id', $delete_pms); + $this->sql_query($sql); + + // Return false to have the Migrator call this function again + return false; + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php new file mode 100644 index 0000000000..b7e475a87b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php @@ -0,0 +1,52 @@ +config['version'], '3.0.11-rc2', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_11_rc1'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_novalue' => array('BOOL', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_novalue', + ), + ), + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.11-rc2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php new file mode 100644 index 0000000000..3f851967df --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php @@ -0,0 +1,125 @@ +config['version'], '3.0.12-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_11'); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_module_auth'))), + array('custom', array(array(&$this, 'update_bots'))), + array('custom', array(array(&$this, 'disable_bots_from_receiving_pms'))), + + array('config.update', array('version', '3.0.12-rc1')), + ); + } + + public function disable_bots_from_receiving_pms() + { + // Disable receiving pms for bots + $sql = 'SELECT user_id + FROM ' . BOTS_TABLE; + $result = $this->db->sql_query($sql); + + $bot_user_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $bot_user_ids[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + if (!empty($bot_user_ids)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_allow_pm = 0 + WHERE ' . $this->db->sql_in_set('user_id', $bot_user_ids); + $this->sql_query($sql); + } + } + + public function update_module_auth() + { + $sql = 'UPDATE ' . MODULES_TABLE . ' + SET module_auth = \'acl_u_sig\' + WHERE module_class = \'ucp\' + AND module_basename = \'profile\' + AND module_mode = \'signature\''; + $this->sql_query($sql); + } + + public function update_bots() + { + // Update bots + if (!function_exists('user_delete')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $bots_updates = array( + // Bot Deletions + 'NG-Search [Bot]' => false, + 'Nutch/CVS [Bot]' => false, + 'OmniExplorer [Bot]' => false, + 'Seekport [Bot]' => false, + 'Synoo [Bot]' => false, + 'WiseNut [Bot]' => false, + + // Bot Updates + // Bot name to bot user agent map + 'Baidu [Spider]' => 'Baiduspider', + 'Exabot [Bot]' => 'Exabot', + 'Voyager [Bot]' => 'voyager/', + 'W3C [Validator]' => 'W3C_Validator', + ); + + foreach ($bots_updates as $bot_name => $bot_agent) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_IGNORE . " + AND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'"; + $result = $this->db->sql_query($sql); + $bot_user_id = (int) $this->db->sql_fetchfield('user_id'); + $this->db->sql_freeresult($result); + + if ($bot_user_id) + { + if ($bot_agent === false) + { + $sql = 'DELETE FROM ' . BOTS_TABLE . " + WHERE user_id = $bot_user_id"; + $this->sql_query($sql); + + user_delete('remove', $bot_user_id); + } + else + { + $sql = 'UPDATE ' . BOTS_TABLE . " + SET bot_agent = '" . $this->db->sql_escape($bot_agent) . "' + WHERE user_id = $bot_user_id"; + $this->sql_query($sql); + } + } + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php new file mode 100644 index 0000000000..0444de4ac2 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php @@ -0,0 +1,110 @@ +config['version'], '3.0.1-rc1', '>='); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_list' => array('BOOL', 1), + ), + $this->table_prefix . 'sessions' => array( + 'session_forum_id' => array('UINT', 0), + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'groups' => array( + 'group_legend', + ), + ), + 'add_index' => array( + $this->table_prefix . 'sessions' => array( + 'session_forum_id' => array('session_forum_id'), + ), + $this->table_prefix . 'groups' => array( + 'group_legend_name' => array('group_legend', 'group_name'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_list', + ), + $this->table_prefix . 'sessions' => array( + 'session_forum_id', + ), + ), + 'add_index' => array( + $this->table_prefix . 'groups' => array( + 'group_legend' => array('group_legend'), + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'sessions' => array( + 'session_forum_id', + ), + $this->table_prefix . 'groups' => array( + 'group_legend_name', + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'fix_unset_last_view_time'))), + array('custom', array(array(&$this, 'reset_smiley_size'))), + + array('config.update', array('version', '3.0.1-rc1')), + ); + } + + public function fix_unset_last_view_time() + { + $sql = 'UPDATE ' . $this->table_prefix . "topics + SET topic_last_view_time = topic_last_post_time + WHERE topic_last_view_time = 0"; + $this->sql_query($sql); + } + + public function reset_smiley_size() + { + // Update smiley sizes + $smileys = array('icon_e_surprised.gif', 'icon_eek.gif', 'icon_cool.gif', 'icon_lol.gif', 'icon_mad.gif', 'icon_razz.gif', 'icon_redface.gif', 'icon_cry.gif', 'icon_evil.gif', 'icon_twisted.gif', 'icon_rolleyes.gif', 'icon_exclaim.gif', 'icon_question.gif', 'icon_idea.gif', 'icon_arrow.gif', 'icon_neutral.gif', 'icon_mrgreen.gif', 'icon_e_ugeek.gif'); + + foreach ($smileys as $smiley) + { + if (file_exists($this->phpbb_root_path . 'images/smilies/' . $smiley)) + { + list($width, $height) = getimagesize($this->phpbb_root_path . 'images/smilies/' . $smiley); + + $sql = 'UPDATE ' . SMILIES_TABLE . ' + SET smiley_width = ' . $width . ', smiley_height = ' . $height . " + WHERE smiley_url = '" . $this->db->sql_escape($smiley) . "'"; + + $this->sql_query($sql); + } + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php new file mode 100644 index 0000000000..4f9278e2fa --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php @@ -0,0 +1,30 @@ +config['version'], '3.0.2', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_2_rc2'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php new file mode 100644 index 0000000000..8f709fb769 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php @@ -0,0 +1,34 @@ +config['version'], '3.0.2-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_1'); + } + + public function update_data() + { + return array( + array('config.add', array('referer_validation', '1')), + array('config.add', array('check_attachment_content', '1')), + array('config.add', array('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title')), + + array('config.update', array('version', '3.0.2-rc1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php new file mode 100644 index 0000000000..ecbe8bf808 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php @@ -0,0 +1,82 @@ +config['version'], '3.0.2-rc2', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_2_rc1'); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'drafts' => array( + 'draft_subject' => array('STEXT_UNI', ''), + ), + $this->table_prefix . 'forums' => array( + 'forum_last_post_subject' => array('STEXT_UNI', ''), + ), + $this->table_prefix . 'posts' => array( + 'post_subject' => array('STEXT_UNI', '', 'true_sort'), + ), + $this->table_prefix . 'privmsgs' => array( + 'message_subject' => array('STEXT_UNI', ''), + ), + $this->table_prefix . 'topics' => array( + 'topic_title' => array('STEXT_UNI', '', 'true_sort'), + 'topic_last_post_subject' => array('STEXT_UNI', ''), + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'sessions' => array( + 'session_forum_id', + ), + ), + 'add_index' => array( + $this->table_prefix . 'sessions' => array( + 'session_fid' => array('session_forum_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_index' => array( + $this->table_prefix . 'sessions' => array( + 'session_forum_id' => array( + 'session_forum_id', + ), + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'sessions' => array( + 'session_fid', + ), + ), + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.2-rc2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php new file mode 100644 index 0000000000..5f94bd9018 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php @@ -0,0 +1,30 @@ +config['version'], '3.0.3', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_3_rc1'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.3')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php new file mode 100644 index 0000000000..631d382135 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php @@ -0,0 +1,85 @@ +config['version'], '3.0.3-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_2'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'styles_template' => array( + 'template_inherits_id' => array('UINT:4', 0), + 'template_inherit_path' => array('VCHAR', ''), + ), + $this->table_prefix . 'groups' => array( + 'group_max_recipients' => array('UINT', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'styles_template' => array( + 'template_inherits_id', + 'template_inherit_path', + ), + $this->table_prefix . 'groups' => array( + 'group_max_recipients', + ), + ), + ); + } + + public function update_data() + { + return array( + array('config.add', array('enable_queue_trigger', '0')), + array('config.add', array('queue_trigger_posts', '3')), + array('config.add', array('pm_max_recipients', '0')), + array('custom', array(array(&$this, 'set_group_default_max_recipients'))), + array('config.add', array('dbms_version', $this->db->sql_server_info(true))), + array('permission.add', array('u_masspm_group', true, 'u_masspm')), + array('custom', array(array(&$this, 'correct_acp_email_permissions'))), + + array('config.update', array('version', '3.0.3-rc1')), + ); + } + + public function correct_acp_email_permissions() + { + $sql = 'UPDATE ' . $this->table_prefix . 'modules + SET module_auth = \'acl_a_email && cfg_email_enable\' + WHERE module_class = \'acp\' + AND module_basename = \'email\''; + $this->sql_query($sql); + } + + public function set_group_default_max_recipients() + { + // Set maximum number of recipients for the registered users, bots, guests group + $sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_max_recipients = 5 + WHERE ' . $this->db->sql_in_set('group_name', array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA', 'BOTS')); + $this->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php new file mode 100644 index 0000000000..369f23f7e7 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php @@ -0,0 +1,51 @@ +config['version'], '3.0.4', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_4_rc1'); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'rename_log_delete_topic'))), + + array('config.update', array('version', '3.0.4')), + ); + } + + public function rename_log_delete_topic() + { + if ($this->db->sql_layer == 'oracle') + { + // log_operation is CLOB - but we can change this later + $sql = 'UPDATE ' . $this->table_prefix . "log + SET log_operation = 'LOG_DELETE_TOPIC' + WHERE log_operation LIKE 'LOG_TOPIC_DELETED'"; + $this->sql_query($sql); + } + else + { + $sql = 'UPDATE ' . $this->table_prefix . "log + SET log_operation = 'LOG_DELETE_TOPIC' + WHERE log_operation = 'LOG_TOPIC_DELETED'"; + $this->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php new file mode 100644 index 0000000000..f98d7a59d0 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php @@ -0,0 +1,125 @@ +config['version'], '3.0.4-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_3'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_profile' => array('BOOL', 0), + ), + ), + 'change_columns' => array( + $this->table_prefix . 'styles' => array( + 'style_id' => array('UINT', NULL, 'auto_increment'), + 'template_id' => array('UINT', 0), + 'theme_id' => array('UINT', 0), + 'imageset_id' => array('UINT', 0), + ), + $this->table_prefix . 'styles_imageset' => array( + 'imageset_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_imageset_data' => array( + 'image_id' => array('UINT', NULL, 'auto_increment'), + 'imageset_id' => array('UINT', 0), + ), + $this->table_prefix . 'styles_theme' => array( + 'theme_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_template' => array( + 'template_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_template_data' => array( + 'template_id' => array('UINT', 0), + ), + $this->table_prefix . 'forums' => array( + 'forum_style' => array('UINT', 0), + ), + $this->table_prefix . 'users' => array( + 'user_style' => array('UINT', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_profile', + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_custom_profile_fields'))), + + array('config.update', array('version', '3.0.4-rc1')), + ); + } + + public function update_custom_profile_fields() + { + // Update the Custom Profile Fields based on previous settings to the new \format + $sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide + FROM ' . PROFILE_FIELDS_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_ary = array( + 'field_required' => 0, + 'field_show_on_reg' => 0, + 'field_hide' => 0, + 'field_show_profile'=> 0, + ); + + if ($row['field_required']) + { + $sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; + } + else if ($row['field_show_on_reg']) + { + $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; + } + else if ($row['field_hide']) + { + // Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module + $sql_ary['field_hide'] = 1; + } + else + { + // equivelant to "none", which is the "Display in user control panel" option + $sql_ary['field_show_profile'] = 1; + } + + $this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary); + } + + $this->db->sql_freeresult($result); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php new file mode 100644 index 0000000000..9265f09b39 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php @@ -0,0 +1,30 @@ +config['version'], '3.0.5', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_5_rc1part2'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.5')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php new file mode 100644 index 0000000000..b99313de5d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php @@ -0,0 +1,126 @@ +config['version'], '3.0.5-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_4'); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_style' => array('UINT', 0), + ), + ), + ); + } + + public function update_data() + { + $search_indexing_state = $this->config['search_indexing_state']; + + return array( + array('config.add', array('captcha_gd_wave', 0)), + array('config.add', array('captcha_gd_3d_noise', 1)), + array('config.add', array('captcha_gd_fonts', 1)), + array('config.add', array('confirm_refresh', 1)), + array('config.add', array('max_num_search_keywords', 10)), + array('config.remove', array('search_indexing_state')), + array('config.add', array('search_indexing_state', $search_indexing_state, true)), + array('custom', array(array(&$this, 'hash_old_passwords'))), + array('custom', array(array(&$this, 'update_ichiro_bot'))), + ); + } + + public function hash_old_passwords() + { + $sql = 'SELECT user_id, user_password + FROM ' . $this->table_prefix . 'users + WHERE user_pass_convert = 1'; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if (strlen($row['user_password']) == 32) + { + $sql_ary = array( + 'user_password' => phpbb_hash($row['user_password']), + ); + + $this->sql_query('UPDATE ' . $this->table_prefix . 'users SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id']); + } + } + $this->db->sql_freeresult($result); + } + + public function update_ichiro_bot() + { + // Adjust bot entry + $sql = 'UPDATE ' . $this->table_prefix . "bots + SET bot_agent = 'ichiro/' + WHERE bot_agent = 'ichiro/2'"; + $this->sql_query($sql); + } + + public function remove_duplicate_auth_options() + { + // Before we are able to add a unique key to auth_option, we need to remove duplicate entries + $sql = 'SELECT auth_option + FROM ' . $this->table_prefix . 'acl_options + GROUP BY auth_option + HAVING COUNT(*) >= 2'; + $result = $this->db->sql_query($sql); + + $auth_options = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $auth_options[] = $row['auth_option']; + } + $this->db->sql_freeresult($result); + + // Remove specific auth options + if (!empty($auth_options)) + { + foreach ($auth_options as $option) + { + // Select auth_option_ids... the largest id will be preserved + $sql = 'SELECT auth_option_id + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option = '" . $db->sql_escape($option) . "' + ORDER BY auth_option_id DESC"; + // sql_query_limit not possible here, due to bug in postgresql layer + $result = $this->db->sql_query($sql); + + // Skip first row, this is our original auth option we want to preserve + $row = $this->db->sql_fetchrow($result); + + while ($row = $this->db->sql_fetchrow($result)) + { + // Ok, remove this auth option... + $this->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); + $this->sql_query('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); + $this->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); + $this->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']); + } + $this->db->sql_freeresult($result); + } + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php new file mode 100644 index 0000000000..65787f9310 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php @@ -0,0 +1,44 @@ +config['version'], '3.0.5-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_5_rc1'); + } + + public function update_schema() + { + return array( + 'drop_keys' => array( + $this->table_prefix . 'acl_options' => array('auth_option'), + ), + 'add_unique_index' => array( + $this->table_prefix . 'acl_options' => array( + 'auth_option' => array('auth_option'), + ), + ), + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.5-rc1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php new file mode 100644 index 0000000000..382fb6cde2 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php @@ -0,0 +1,30 @@ +config['version'], '3.0.6', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_6_rc4'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.6')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php new file mode 100644 index 0000000000..0b54c3b195 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php @@ -0,0 +1,326 @@ +config['version'], '3.0.6-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_5'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'confirm' => array( + 'attempts' => array('UINT', 0), + ), + $this->table_prefix . 'users' => array( + 'user_new' => array('BOOL', 1), + 'user_reminded' => array('TINT:4', 0), + 'user_reminded_time' => array('TIMESTAMP', 0), + ), + $this->table_prefix . 'groups' => array( + 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), + ), + $this->table_prefix . 'privmsgs' => array( + 'message_reported' => array('BOOL', 0), + ), + $this->table_prefix . 'reports' => array( + 'pm_id' => array('UINT', 0), + ), + $this->table_prefix . 'profile_fields' => array( + 'field_show_on_vt' => array('BOOL', 0), + ), + $this->table_prefix . 'forums' => array( + 'forum_options' => array('UINT:20', 0), + ), + ), + 'change_columns' => array( + $this->table_prefix . 'users' => array( + 'user_options' => array('UINT:11', 230271), + ), + ), + 'add_index' => array( + $this->table_prefix . 'reports' => array( + 'post_id' => array('post_id'), + 'pm_id' => array('pm_id'), + ), + $this->table_prefix . 'posts' => array( + 'post_username' => array('post_username:255'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'confirm' => array( + 'attempts', + ), + $this->table_prefix . 'users' => array( + 'user_new', + 'user_reminded', + 'user_reminded_time', + ), + $this->table_prefix . 'groups' => array( + 'group_skip_auth', + ), + $this->table_prefix . 'privmsgs' => array( + 'message_reported', + ), + $this->table_prefix . 'reports' => array( + 'pm_id', + ), + $this->table_prefix . 'profile_fields' => array( + 'field_show_on_vt', + ), + $this->table_prefix . 'forums' => array( + 'forum_options', + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'reports' => array( + 'post_id', + 'pm_id', + ), + $this->table_prefix . 'posts' => array( + 'post_username', + ), + ), + ); + } + + public function update_data() + { + return array( + array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')), + array('if', array( + ($this->config['captcha_gd']), + array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')), + )), + + array('config.add', array('feed_enable', 0)), + array('config.add', array('feed_limit', 10)), + array('config.add', array('feed_overall_forums', 1)), + array('config.add', array('feed_overall_forums_limit', 15)), + array('config.add', array('feed_overall_topics', 0)), + array('config.add', array('feed_overall_topics_limit', 15)), + array('config.add', array('feed_forum', 1)), + array('config.add', array('feed_topic', 1)), + array('config.add', array('feed_item_statistics', 1)), + + array('config.add', array('smilies_per_page', 50)), + array('config.add', array('allow_pm_report', 1)), + array('config.add', array('min_post_chars', 1)), + array('config.add', array('allow_quick_reply', 1)), + array('config.add', array('new_member_post_limit', 0)), + array('config.add', array('new_member_group_default', 0)), + array('config.add', array('delete_time', $this->config['edit_time'])), + + array('config.add', array('allow_avatar', 0)), + array('if', array( + ($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']), + array('config.update', array('allow_avatar', 1)), + )), + array('config.add', array('allow_avatar_remote_upload', 0)), + array('if', array( + ($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']), + array('config.update', array('allow_avatar_remote_upload', 1)), + )), + + array('module.add', array( + 'acp', + 'ACP_BOARD_CONFIGURATION', + array( + 'module_basename' => 'acp_board', + 'modes' => array('feed'), + ), + )), + array('module.add', array( + 'acp', + 'ACP_CAT_USERS', + array( + 'module_basename' => 'acp_users', + 'modes' => array('warnings'), + ), + )), + array('module.add', array( + 'acp', + 'ACP_SERVER_CONFIGURATION', + array( + 'module_basename' => 'acp_send_statistics', + 'modes' => array('send_statistics'), + ), + )), + array('module.add', array( + 'acp', + 'ACP_FORUM_BASED_PERMISSIONS', + array( + 'module_basename' => 'acp_permissions', + 'modes' => array('setting_forum_copy'), + ), + )), + array('module.add', array( + 'mcp', + 'MCP_REPORTS', + array( + 'module_basename' => 'mcp_pm_reports', + 'modes' => array('pm_reports','pm_reports_closed','pm_report_details'), + ), + )), + array('custom', array(array(&$this, 'add_newly_registered_group'))), + array('custom', array(array(&$this, 'set_user_options_default'))), + + array('config.update', array('version', '3.0.6-rc1')), + ); + } + + public function set_user_options_default() + { + // 229376 is the added value to enable all three signature options + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376'; + $this->sql_query($sql); + } + + public function add_newly_registered_group() + { + // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED'"; + $result = $this->db->sql_query($sql); + $group_id = (int) $this->db->sql_fetchfield('group_id'); + $this->db->sql_freeresult($result); + + if (!$group_id) + { + $sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)"; + $this->sql_query($sql); + + $group_id = $this->db->sql_nextid(); + } + + // Insert new \user role... at the end of the chain + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_name = 'ROLE_USER_NEW_MEMBER' + AND role_type = 'u_'"; + $result = $this->db->sql_query($sql); + $u_role = (int) $this->db->sql_fetchfield('role_id'); + $this->db->sql_freeresult($result); + + if (!$u_role) + { + $sql = 'SELECT MAX(role_order) as max_order_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = 'u_'"; + $result = $this->db->sql_query($sql); + $next_order_id = (int) $this->db->sql_fetchfield('max_order_id'); + $this->db->sql_freeresult($result); + + $next_order_id++; + + $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)"; + $this->sql_query($sql); + $u_role = $this->db->sql_nextid(); + + // Now add the correct data to the roles... + // The standard role says that new \users are not able to send a PM, Mass PM, are not able to PM groups + $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')"; + $this->sql_query($sql); + + // Add user role to group + $sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)"; + $this->sql_query($sql); + } + + // Insert new \forum role + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_name = 'ROLE_FORUM_NEW_MEMBER' + AND role_type = 'f_'"; + $result = $this->db->sql_query($sql); + $f_role = (int) $this->db->sql_fetchfield('role_id'); + $this->db->sql_freeresult($result); + + if (!$f_role) + { + $sql = 'SELECT MAX(role_order) as max_order_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = 'f_'"; + $result = $this->db->sql_query($sql); + $next_order_id = (int) $this->db->sql_fetchfield('max_order_id'); + $this->db->sql_freeresult($result); + + $next_order_id++; + + $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)"; + $this->sql_query($sql); + $f_role = $this->db->sql_nextid(); + + $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')"; + $this->sql_query($sql); + } + + // Set every members user_new \column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) + $sql = 'SELECT 1 + FROM ' . USERS_TABLE . ' + WHERE user_new = 0'; + $result = $this->db->sql_query_limit($sql, 1); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0'; + $this->sql_query($sql); + } + + // To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts... + // Check if the role is already assigned... + $sql = 'SELECT forum_id + FROM ' . ACL_GROUPS_TABLE . ' + WHERE group_id = ' . $group_id . ' + AND auth_role_id = ' . $f_role; + $result = $this->db->sql_query($sql); + $is_options = (int) $this->db->sql_fetchfield('forum_id'); + $this->db->sql_freeresult($result); + + // Not assigned at all... :/ + if (!$is_options) + { + // Get postable forums + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type != ' . FORUM_LINK; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $this->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)'); + } + $this->db->sql_freeresult($result); + } + + // Clear permissions... + include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); + $auth_admin = new \auth_admin(); + $auth_admin->acl_clear_prefetch(); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php new file mode 100644 index 0000000000..041224d19a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php @@ -0,0 +1,30 @@ +config['version'], '3.0.6-rc2', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_6_rc1'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.6-rc2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php new file mode 100644 index 0000000000..3183c16efd --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php @@ -0,0 +1,42 @@ +config['version'], '3.0.6-rc3', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_6_rc2'); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_cp_fields'))), + + array('config.update', array('version', '3.0.6-rc3')), + ); + } + + public function update_cp_fields() + { + // Update the Custom Profile Fields based on previous settings to the new \format + $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . ' + SET field_show_on_vt = 1 + WHERE field_hide = 0 + AND (field_required = 1 OR field_show_on_reg = 1 OR field_show_profile = 1)'; + $this->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php new file mode 100644 index 0000000000..7d75b12130 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php @@ -0,0 +1,30 @@ +config['version'], '3.0.6-rc4', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_6_rc3'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.6-rc4')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php new file mode 100644 index 0000000000..1b1e5d0373 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php @@ -0,0 +1,30 @@ +config['version'], '3.0.7', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_7_rc2'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.7')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php new file mode 100644 index 0000000000..a45c9c3c14 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php @@ -0,0 +1,30 @@ +config['version'], '3.0.7-pl1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_7'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.7-pl1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php new file mode 100644 index 0000000000..dab90512ab --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php @@ -0,0 +1,78 @@ +config['version'], '3.0.7-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_6'); + } + + public function update_schema() + { + return array( + 'drop_keys' => array( + $this->table_prefix . 'log' => array( + 'log_time', + ), + ), + 'add_index' => array( + $this->table_prefix . 'topics_track' => array( + 'topic_id' => array('topic_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_index' => array( + $this->table_prefix . 'log' => array( + 'log_time' => array('log_time'), + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'topics_track' => array( + 'topic_id', + ), + ), + ); + } + + public function update_data() + { + return array( + array('config.add', array('feed_overall', 1)), + array('config.add', array('feed_http_auth', 0)), + array('config.add', array('feed_limit_post', $this->config['feed_limit'])), + array('config.add', array('feed_limit_topic', $this->config['feed_overall_topics_limit'])), + array('config.add', array('feed_topics_new', $this->config['feed_overall_topics'])), + array('config.add', array('feed_topics_active', $this->config['feed_overall_topics'])), + array('custom', array(array(&$this, 'delete_text_templates'))), + + array('config.update', array('version', '3.0.7-rc1')), + ); + } + + public function delete_text_templates() + { + // Delete all text-templates from the template_data + $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . ' + WHERE template_filename ' . $this->db->sql_like_expression($this->db->any_char . '.txt'); + $this->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php new file mode 100644 index 0000000000..ea430740c6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php @@ -0,0 +1,75 @@ +config['version'], '3.0.7-rc2', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_7_rc1'); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_email_hash'))), + + array('config.update', array('version', '3.0.7-rc2')), + ); + } + + public function update_email_hash($start = 0) + { + $limit = 1000; + + $sql = 'SELECT user_id, user_email, user_email_hash + FROM ' . USERS_TABLE . ' + WHERE user_type <> ' . USER_IGNORE . " + AND user_email <> ''"; + $result = $this->db->sql_query_limit($sql, $limit, $start); + + $i = 0; + while ($row = $this->db->sql_fetchrow($result)) + { + $i++; + + // Snapshot of the phpbb_email_hash() function + // We cannot call it directly because the auto updater updates the DB first. :/ + $user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']); + + if ($user_email_hash != $row['user_email_hash']) + { + $sql_ary = array( + 'user_email_hash' => $user_email_hash, + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . (int) $row['user_id']; + $this->sql_query($sql); + } + } + $this->db->sql_freeresult($result); + + if ($i < $limit) + { + // Completed + return; + } + + // Return the next start, will be sent to $start when this function is called again + return $start + $limit; + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php new file mode 100644 index 0000000000..c08a74e5ee --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php @@ -0,0 +1,30 @@ +config['version'], '3.0.8', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_8_rc1'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.8')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php new file mode 100644 index 0000000000..dce88e249e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php @@ -0,0 +1,223 @@ +config['version'], '3.0.8-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_7_pl1'); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_file_extension_group_names'))), + array('custom', array(array(&$this, 'update_module_auth'))), + array('custom', array(array(&$this, 'update_bots'))), + array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))), + array('module.add', array( + 'acp', + 'ACP_MESSAGES', + array( + 'module_basename' => 'acp_board', + 'modes' => array('post'), + ), + )), + array('config.add', array('load_unreads_search', 1)), + array('config.update_if_equals', array(600, 'queue_interval', 60)), + array('config.update_if_equals', array(50, 'email_package_size', 20)), + + array('config.update', array('version', '3.0.8-rc1')), + ); + } + + public function update_file_extension_group_names() + { + // Update file extension group names to use language strings. + $sql = 'SELECT lang_dir + FROM ' . LANG_TABLE; + $result = $this->db->sql_query($sql); + + $extension_groups_updated = array(); + while ($lang_dir = $this->db->sql_fetchfield('lang_dir')) + { + $lang_dir = basename($lang_dir); + + // The language strings we need are either in language/.../acp/attachments.php + // in the update package if we're updating to 3.0.8-RC1 or later, + // or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier. + // On an already updated board, they can also already be in language/.../acp/attachments.php + // in the board root. + $lang_files = array( + "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}", + "{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}", + "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}", + ); + + foreach ($lang_files as $lang_file) + { + if (!file_exists($lang_file)) + { + continue; + } + + $lang = array(); + include($lang_file); + + foreach($lang as $lang_key => $lang_val) + { + if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0) + { + continue; + } + + $sql_ary = array( + 'group_name' => substr($lang_key, 10), // Strip off 'EXT_GROUP_' + ); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . " + WHERE group_name = '" . $this->db->sql_escape($lang_val) . "'"; + $this->sql_query($sql); + + $extension_groups_updated[$lang_key] = true; + } + } + } + $this->db->sql_freeresult($result); + } + + public function update_module_auth() + { + $sql = 'UPDATE ' . MODULES_TABLE . ' + SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\' + WHERE module_class = \'ucp\' + AND module_basename = \'profile\' + AND module_mode = \'avatar\''; + $this->sql_query($sql); + } + + public function update_bots() + { + $bot_name = 'Bing [Bot]'; + $bot_name_clean = utf8_clean_string($bot_name); + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape($bot_name_clean) . "'"; + $result = $this->db->sql_query($sql); + $bing_already_added = (bool) $this->db->sql_fetchfield('user_id'); + $this->db->sql_freeresult($result); + + if (!$bing_already_added) + { + $bot_agent = 'bingbot/'; + $bot_ip = ''; + $sql = 'SELECT group_id, group_colour + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $this->db->sql_query($sql); + $group_row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$group_row) + { + // default fallback, should never get here + $group_row['group_id'] = 6; + $group_row['group_colour'] = '9E8DA7'; + } + + if (!function_exists('user_add')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_row['group_id'], + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => $group_row['group_colour'], + 'user_email' => '', + 'user_lang' => $this->config['default_lang'], + 'user_style' => $this->config['default_style'], + 'user_timezone' => 0, + 'user_dateformat' => $this->config['default_dateformat'], + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_agent, + 'bot_ip' => (string) $bot_ip, + )); + + $this->sql_query($sql); + } + } + + public function delete_orphan_shadow_topics() + { + // Delete shadow topics pointing to not existing topics + $batch_size = 500; + + // Set of affected forums we have to resync + $sync_forum_ids = array(); + + $sql_array = array( + 'SELECT' => 't1.topic_id, t1.forum_id', + 'FROM' => array( + TOPICS_TABLE => 't1', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TABLE => 't2'), + 'ON' => 't1.topic_moved_id = t2.topic_id', + ), + ), + 'WHERE' => 't1.topic_moved_id <> 0 + AND t2.topic_id IS NULL', + ); + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query_limit($sql, $batch_size); + + $topic_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $topic_ids[] = (int) $row['topic_id']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $this->db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids); + $this->db->sql_query($sql); + + // Sync the forums we have deleted shadow topics from. + sync('forum', 'forum_id', $sync_forum_ids, true, true); + + return false; + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php new file mode 100644 index 0000000000..8254ac8561 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php @@ -0,0 +1,30 @@ +config['version'], '3.0.9', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_9_rc4'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.9')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php new file mode 100644 index 0000000000..14e0fe6013 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php @@ -0,0 +1,126 @@ +config['version'], '3.0.9-rc1', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_8'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'login_attempts' => array( + 'COLUMNS' => array( + // this column was removed from the database updater + // after 3.0.9-RC3 was released. It might still exist + // in 3.0.9-RCX installations and has to be dropped as + // soon as the db_tools class is capable of properly + // removing a primary key. + // 'attempt_id' => array('UINT', NULL, 'auto_increment'), + 'attempt_ip' => array('VCHAR:40', ''), + 'attempt_browser' => array('VCHAR:150', ''), + 'attempt_forwarded_for' => array('VCHAR:255', ''), + 'attempt_time' => array('TIMESTAMP', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR_UNI:255', 0), + 'username_clean' => array('VCHAR_CI', 0), + ), + //'PRIMARY_KEY' => 'attempt_id', + 'KEYS' => array( + 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), + 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), + 'att_time' => array('INDEX', array('attempt_time')), + 'user_id' => array('INDEX', 'user_id'), + ), + ), + ), + 'change_columns' => array( + $this->table_prefix . 'bbcodes' => array( + 'bbcode_id' => array('USINT', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'login_attempts', + ), + ); + } + + public function update_data() + { + return array( + array('config.add', array('ip_login_limit_max', 50)), + array('config.add', array('ip_login_limit_time', 21600)), + array('config.add', array('ip_login_limit_use_forwarded', 0)), + array('custom', array(array(&$this, 'update_file_extension_group_names'))), + array('custom', array(array(&$this, 'fix_firebird_qa_captcha'))), + + array('config.update', array('version', '3.0.9-rc1')), + ); + } + + public function update_file_extension_group_names() + { + // Update file extension group names to use language strings, again. + $sql = 'SELECT group_id, group_name + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->any_char); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_ary = array( + 'group_name' => substr($row['group_name'], 10), // Strip off 'EXT_GROUP_' + ); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE group_id = ' . $row['group_id']; + $this->sql_query($sql); + } + $this->db->sql_freeresult($result); + } + + public function fix_firebird_qa_captcha() + { + // Recover from potentially broken Q&A CAPTCHA table on firebird + // Q&A CAPTCHA was uninstallable, so it's safe to remove these + // without data loss + if ($this->db_tools->sql_layer == 'firebird') + { + $tables = array( + $this->table_prefix . 'captcha_questions', + $this->table_prefix . 'captcha_answers', + $this->table_prefix . 'qa_confirm', + ); + foreach ($tables as $table) + { + if ($this->db_tools->sql_table_exists($table)) + { + $this->db_tools->sql_table_drop($table); + } + } + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php new file mode 100644 index 0000000000..44fd789353 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php @@ -0,0 +1,30 @@ +config['version'], '3.0.9-rc2', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_9_rc1'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.9-rc2')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php new file mode 100644 index 0000000000..e4102fb193 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php @@ -0,0 +1,30 @@ +config['version'], '3.0.9-rc3', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_9_rc2'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.9-rc3')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php new file mode 100644 index 0000000000..5896d11ba5 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php @@ -0,0 +1,30 @@ +config['version'], '3.0.9-rc4', '>='); + } + + static public function depends_on() + { + return array('phpbb_db_migration_data_30x_3_0_9_rc3'); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.0.9-rc4')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/avatars.php b/phpBB/phpbb/db/migration/data/v310/avatars.php new file mode 100644 index 0000000000..80ce606f29 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/avatars.php @@ -0,0 +1,69 @@ +config['allow_avatar_gravatar']); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'users' => array( + 'user_avatar_type' => array('VCHAR:255', ''), + ), + $this->table_prefix . 'groups' => array( + 'group_avatar_type' => array('VCHAR:255', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'users' => array( + 'user_avatar_type' => array('TINT:2', ''), + ), + $this->table_prefix . 'groups' => array( + 'group_avatar_type' => array('TINT:2', ''), + ), + ), + ); + } + + public function update_data() + { + return array( + array('config.add', array('allow_avatar_gravatar', 0)), + array('custom', array(array($this, 'update_module_auth'))), + ); + } + + public function update_module_auth() + { + $sql = 'UPDATE ' . $this->table_prefix . "modules + SET module_auth = 'cfg_allow_avatar' + WHERE module_class = 'ucp' + AND module_basename = 'ucp_profile' + AND module_mode = 'avatar'"; + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/boardindex.php b/phpBB/phpbb/db/migration/data/v310/boardindex.php new file mode 100644 index 0000000000..27492f2d0d --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/boardindex.php @@ -0,0 +1,25 @@ +config['board_index_text']); + } + + public function update_data() + { + return array( + array('config.add', array('board_index_text', '')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/config_db_text.php b/phpBB/phpbb/db/migration/data/v310/config_db_text.php new file mode 100644 index 0000000000..1a7ee7a9a6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/config_db_text.php @@ -0,0 +1,47 @@ +db_tools->sql_table_exists($this->table_prefix . 'config_text'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'config_text' => array( + 'COLUMNS' => array( + 'config_name' => array('VCHAR', ''), + 'config_value' => array('MTEXT', ''), + ), + 'PRIMARY_KEY' => 'config_name', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'config_text', + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/dev.php b/phpBB/phpbb/db/migration/data/v310/dev.php new file mode 100644 index 0000000000..5a10e7c236 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/dev.php @@ -0,0 +1,410 @@ +config['version'], '3.1.0-dev', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\extensions', + '\phpbb\db\migration\data\v310\style_update_p2', + '\phpbb\db\migration\data\v310\timezone_p2', + '\phpbb\db\migration\data\v310\reported_posts_display', + ); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'groups' => array( + 'group_teampage' => array('UINT', 0, 'after' => 'group_legend'), + ), + $this->table_prefix . 'profile_fields' => array( + 'field_show_on_pm' => array('BOOL', 0), + ), + $this->table_prefix . 'styles' => array( + 'style_path' => array('VCHAR:100', ''), + 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), + 'style_parent_id' => array('UINT:4', 0), + 'style_parent_tree' => array('TEXT', ''), + ), + $this->table_prefix . 'reports' => array( + 'reported_post_text' => array('MTEXT_UNI', ''), + 'reported_post_uid' => array('VCHAR:8', ''), + 'reported_post_bitfield' => array('VCHAR:255', ''), + ), + ), + 'change_columns' => array( + $this->table_prefix . 'groups' => array( + 'group_legend' => array('UINT', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'groups' => array( + 'group_teampage', + ), + $this->table_prefix . 'profile_fields' => array( + 'field_show_on_pm', + ), + $this->table_prefix . 'styles' => array( + 'style_path', + 'bbcode_bitfield', + 'style_parent_id', + 'style_parent_tree', + ), + $this->table_prefix . 'reports' => array( + 'reported_post_text', + 'reported_post_uid', + 'reported_post_bitfield', + ), + ), + ); + } + + public function update_data() + { + return array( + array('if', array( + (strpos('phpbb_search_', $this->config['search_type']) !== 0), + array('config.update', array('search_type', 'phpbb_search_' . $this->config['search_type'])), + )), + + array('config.add', array('fulltext_postgres_ts_name', 'simple')), + array('config.add', array('fulltext_postgres_min_word_len', 4)), + array('config.add', array('fulltext_postgres_max_word_len', 254)), + array('config.add', array('fulltext_sphinx_stopwords', 0)), + array('config.add', array('fulltext_sphinx_indexer_mem_limit', 512)), + + array('config.add', array('load_jquery_cdn', 0)), + array('config.add', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js')), + + array('config.add', array('use_system_cron', 0)), + + array('config.add', array('legend_sort_groupname', 0)), + array('config.add', array('teampage_forums', 1)), + array('config.add', array('teampage_memberships', 1)), + + array('config.add', array('load_cpf_pm', 0)), + + array('config.add', array('display_last_subject', 1)), + + array('config.add', array('assets_version', 1)), + + array('config.add', array('site_home_url', '')), + array('config.add', array('site_home_text', '')), + + array('permission.add', array('u_chgprofileinfo', true, 'u_sig')), + + array('module.add', array( + 'acp', + 'ACP_GROUPS', + array( + 'module_basename' => 'acp_groups', + 'modes' => array('position'), + ), + )), + array('module.add', array( + 'acp', + 'ACP_ATTACHMENTS', + array( + 'module_basename' => 'acp_attachments', + 'modes' => array('manage'), + ), + )), + array('module.add', array( + 'acp', + 'ACP_STYLE_MANAGEMENT', + array( + 'module_basename' => 'acp_styles', + 'modes' => array('install', 'cache'), + ), + )), + array('module.add', array( + 'ucp', + 'UCP_PROFILE', + array( + 'module_basename' => 'ucp_profile', + 'modes' => array('autologin_keys'), + ), + )), + // Module will be renamed later + array('module.add', array( + 'acp', + 'ACP_CAT_STYLES', + 'ACP_LANGUAGE' + )), + + array('module.remove', array( + 'acp', + false, + 'ACP_TEMPLATES', + )), + array('module.remove', array( + 'acp', + false, + 'ACP_THEMES', + )), + array('module.remove', array( + 'acp', + false, + 'ACP_IMAGESETS', + )), + + array('custom', array(array($this, 'rename_module_basenames'))), + array('custom', array(array($this, 'rename_styles_module'))), + array('custom', array(array($this, 'add_group_teampage'))), + array('custom', array(array($this, 'update_group_legend'))), + array('custom', array(array($this, 'localise_global_announcements'))), + array('custom', array(array($this, 'update_ucp_pm_basename'))), + array('custom', array(array($this, 'update_ucp_profile_auth'))), + array('custom', array(array($this, 'move_customise_modules'))), + + array('config.update', array('version', '3.1.0-dev')), + ); + } + + public function move_customise_modules() + { + // Move language management to new \location in the Customise tab + // First get language module id + $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_language'"; + $result = $this->db->sql_query($sql); + $language_module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + // Next get language management module id of the one just created + $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " + WHERE module_langname = 'ACP_LANGUAGE'"; + $result = $this->db->sql_query($sql); + $language_management_module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + if (!class_exists('acp_modules')) + { + include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); + } + // acp_modules calls adm_back_link, which is undefined at this point + if (!function_exists('adm_back_link')) + { + include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext); + } + $module_manager = new \acp_modules(); + $module_manager->module_class = 'acp'; + $module_manager->move_module($language_module_id, $language_management_module_id); + } + + public function update_ucp_pm_basename() + { + $sql = 'SELECT module_id, module_basename + FROM ' . MODULES_TABLE . " + WHERE module_basename <> 'ucp_pm' AND + module_langname='UCP_PM'"; + $result = $this->db->sql_query_limit($sql, 1); + + if ($row = $this->db->sql_fetchrow($result)) + { + // This update is still not applied. Applying it + + $sql = 'UPDATE ' . MODULES_TABLE . " + SET module_basename = 'ucp_pm' + WHERE module_id = " . (int) $row['module_id']; + + $this->sql_query($sql); + } + $this->db->sql_freeresult($result); + } + + public function update_ucp_profile_auth() + { + // Update the auth setting for the module + $sql = 'UPDATE ' . MODULES_TABLE . " + SET module_auth = 'acl_u_chgprofileinfo' + WHERE module_class = 'ucp' + AND module_basename = 'ucp_profile' + AND module_mode = 'profile_info'"; + $this->sql_query($sql); + } + + public function rename_styles_module() + { + // Rename styles module to Customise + $sql = 'UPDATE ' . MODULES_TABLE . " + SET module_langname = 'ACP_CAT_CUSTOMISE' + WHERE module_langname = 'ACP_CAT_STYLES'"; + $this->sql_query($sql); + } + + public function rename_module_basenames() + { + // rename all module basenames to full classname + $sql = 'SELECT module_id, module_basename, module_class + FROM ' . MODULES_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $module_id = (int) $row['module_id']; + unset($row['module_id']); + + if (!empty($row['module_basename']) && !empty($row['module_class'])) + { + // all the class names start with class name or with phpbb_ for auto loading + if (strpos($row['module_basename'], $row['module_class'] . '_') !== 0 && + strpos($row['module_basename'], 'phpbb_') !== 0) + { + $row['module_basename'] = $row['module_class'] . '_' . $row['module_basename']; + + $sql_update = $this->db->sql_build_array('UPDATE', $row); + + $sql = 'UPDATE ' . MODULES_TABLE . ' + SET ' . $sql_update . ' + WHERE module_id = ' . $module_id; + $this->sql_query($sql); + } + } + } + + $this->db->sql_freeresult($result); + } + + public function add_group_teampage() + { + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_teampage = 1 + WHERE group_type = ' . GROUP_SPECIAL . " + AND group_name = 'ADMINISTRATORS'"; + $this->sql_query($sql); + + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_teampage = 2 + WHERE group_type = ' . GROUP_SPECIAL . " + AND group_name = 'GLOBAL_MODERATORS'"; + $this->sql_query($sql); + } + + public function update_group_legend() + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . ' + WHERE group_legend = 1 + ORDER BY group_name ASC'; + $result = $this->db->sql_query($sql); + + $next_legend = 1; + while ($row = $this->db->sql_fetchrow($result)) + { + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_legend = ' . $next_legend . ' + WHERE group_id = ' . (int) $row['group_id']; + $this->sql_query($sql); + + $next_legend++; + } + $this->db->sql_freeresult($result); + } + + public function localise_global_announcements() + { + // Localise Global Announcements + $sql = 'SELECT topic_id, topic_approved, (topic_replies + 1) AS topic_posts, topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = 0 + AND topic_type = ' . POST_GLOBAL; + $result = $this->db->sql_query($sql); + + $global_announcements = $update_lastpost_data = array(); + $update_lastpost_data['forum_last_post_time'] = 0; + $update_forum_data = array( + 'forum_posts' => 0, + 'forum_topics' => 0, + 'forum_topics_real' => 0, + ); + + while ($row = $this->db->sql_fetchrow($result)) + { + $global_announcements[] = (int) $row['topic_id']; + + $update_forum_data['forum_posts'] += (int) $row['topic_posts']; + $update_forum_data['forum_topics_real']++; + if ($row['topic_approved']) + { + $update_forum_data['forum_topics']++; + } + + if ($update_lastpost_data['forum_last_post_time'] < $row['topic_last_post_time']) + { + $update_lastpost_data = array( + 'forum_last_post_id' => (int) $row['topic_last_post_id'], + 'forum_last_post_subject' => $row['topic_last_post_subject'], + 'forum_last_post_time' => (int) $row['topic_last_post_time'], + 'forum_last_poster_id' => (int) $row['topic_last_poster_id'], + 'forum_last_poster_name' => $row['topic_last_poster_name'], + 'forum_last_poster_colour' => $row['topic_last_poster_colour'], + ); + } + } + $this->db->sql_freeresult($result); + + if (!empty($global_announcements)) + { + // Update the post/topic-count for the forum and the last-post if needed + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST; + $result = $this->db->sql_query_limit($sql, 1); + $ga_forum_id = $this->db->sql_fetchfield('forum_id'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT forum_last_post_time + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $ga_forum_id; + $result = $this->db->sql_query($sql); + $lastpost = (int) $this->db->sql_fetchfield('forum_last_post_time'); + $this->db->sql_freeresult($result); + + $sql_update = 'forum_posts = forum_posts + ' . $update_forum_data['forum_posts'] . ', '; + $sql_update .= 'forum_topics_real = forum_topics_real + ' . $update_forum_data['forum_topics_real'] . ', '; + $sql_update .= 'forum_topics = forum_topics + ' . $update_forum_data['forum_topics']; + if ($lastpost < $update_lastpost_data['forum_last_post_time']) + { + $sql_update .= ', ' . $this->db->sql_build_array('UPDATE', $update_lastpost_data); + } + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $sql_update . ' + WHERE forum_id = ' . $ga_forum_id; + $this->sql_query($sql); + + // Update some forum_ids + $table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); + foreach ($table_ary as $table) + { + $sql = "UPDATE $table + SET forum_id = $ga_forum_id + WHERE " . $this->db->sql_in_set('topic_id', $global_announcements); + $this->sql_query($sql); + } + unset($table_ary); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/extensions.php b/phpBB/phpbb/db/migration/data/v310/extensions.php new file mode 100644 index 0000000000..d8b38dbc9e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/extensions.php @@ -0,0 +1,71 @@ +db_tools->sql_table_exists($this->table_prefix . 'ext'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'ext' => array( + 'COLUMNS' => array( + 'ext_name' => array('VCHAR', ''), + 'ext_active' => array('BOOL', 0), + 'ext_state' => array('TEXT', ''), + ), + 'KEYS' => array( + 'ext_name' => array('UNIQUE', 'ext_name'), + ), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'ext', + ), + ); + } + + public function update_data() + { + return array( + // Module will be renamed later + array('module.add', array( + 'acp', + 'ACP_CAT_STYLES', + 'ACP_EXTENSION_MANAGEMENT' + )), + array('module.add', array( + 'acp', + 'ACP_EXTENSION_MANAGEMENT', + array( + 'module_basename' => 'acp_extensions', + 'modes' => array('main'), + ), + )), + array('permission.add', array('a_extensions', true, 'a_styles')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/forgot_password.php b/phpBB/phpbb/db/migration/data/v310/forgot_password.php new file mode 100644 index 0000000000..814093caa9 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/forgot_password.php @@ -0,0 +1,30 @@ +config['allow_password_reset']); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); + } + + public function update_data() + { + return array( + array('config.add', array('allow_password_reset', 1)), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/jquery_update.php b/phpBB/phpbb/db/migration/data/v310/jquery_update.php new file mode 100644 index 0000000000..bd2de2b4d4 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/jquery_update.php @@ -0,0 +1,33 @@ +config['load_jquery_url'] !== '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'; + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + ); + } + + public function update_data() + { + return array( + array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js')), + ); + } + +} diff --git a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php new file mode 100644 index 0000000000..bd7614e1c2 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php @@ -0,0 +1,120 @@ +table_prefix . 'user_notifications'; + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $insert_table); + + $this->perform_conversion($insert_buffer, $insert_table); + } + + /** + * Perform the conversion (separate for testability) + * + * @param \phpbb\db\sql_insert_buffer $insert_buffer + * @param string $insert_table + */ + public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $insert_table) + { + $sql = 'DELETE FROM ' . $insert_table; + $this->db->sql_query($sql); + + $sql = 'SELECT user_id, user_notify_type, user_notify_pm + FROM ' . USERS_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $notification_methods = array(); + + // In-board notification + $notification_methods[] = ''; + + if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH) + { + $notification_methods[] = 'email'; + } + + if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH) + { + $notification_methods[] = 'jabber'; + } + + // Notifications for posts + foreach (array('post', 'topic') as $item_type) + { + $this->add_method_rows( + $insert_buffer, + $item_type, + 0, + $row['user_id'], + $notification_methods + ); + } + + if ($row['user_notify_pm']) + { + // Notifications for private messages + // User either gets all methods or no method + $this->add_method_rows( + $insert_buffer, + 'pm', + 0, + $row['user_id'], + $notification_methods + ); + } + } + $this->db->sql_freeresult($result); + + $insert_buffer->flush(); + } + + /** + * Insert method rows to DB + * + * @param \phpbb\db\sql_insert_buffer $insert_buffer + * @param string $item_type + * @param int $item_id + * @param int $user_id + * @param string $methods + */ + protected function add_method_rows(\phpbb\db\sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods) + { + $row_base = array( + 'item_type' => $item_type, + 'item_id' => (int) $item_id, + 'user_id' => (int) $user_id, + 'notify' => 1 + ); + + foreach ($methods as $method) + { + $row_base['method'] = $method; + $insert_buffer->insert($row_base); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/notifications.php b/phpBB/phpbb/db/migration/data/v310/notifications.php new file mode 100644 index 0000000000..10f1392094 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/notifications.php @@ -0,0 +1,98 @@ +db_tools->sql_table_exists($this->table_prefix . 'notifications'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'notification_types' => array( + 'COLUMNS' => array( + 'notification_type' => array('VCHAR:255', ''), + 'notification_type_enabled' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'), + ), + $this->table_prefix . 'notifications' => array( + 'COLUMNS' => array( + 'notification_id' => array('UINT', NULL, 'auto_increment'), + 'item_type' => array('VCHAR:255', ''), + 'item_id' => array('UINT', 0), + 'item_parent_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'notification_read' => array('BOOL', 0), + 'notification_time' => array('TIMESTAMP', 1), + 'notification_data' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'notification_id', + 'KEYS' => array( + 'item_ident' => array('INDEX', array('item_type', 'item_id')), + 'user' => array('INDEX', array('user_id', 'notification_read')), + ), + ), + $this->table_prefix . 'user_notifications' => array( + 'COLUMNS' => array( + 'item_type' => array('VCHAR:255', ''), + 'item_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'method' => array('VCHAR:255', ''), + 'notify' => array('BOOL', 1), + ), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'notification_types', + $this->table_prefix . 'notifications', + $this->table_prefix . 'user_notifications', + ), + ); + } + + public function update_data() + { + return array( + array('module.add', array( + 'ucp', + 'UCP_MAIN', + array( + 'module_basename' => 'ucp_notifications', + 'modes' => array('notification_list'), + ), + )), + array('module.add', array( + 'ucp', + 'UCP_PREFS', + array( + 'module_basename' => 'ucp_notifications', + 'modes' => array('notification_options'), + ), + )), + array('config.add', array('load_notifications', 1)), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php new file mode 100644 index 0000000000..8ed626d8a6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php @@ -0,0 +1,94 @@ + array( + $this->table_prefix . 'notification_types', + $this->table_prefix . 'notifications', + ), + 'add_tables' => array( + $this->table_prefix . 'notification_types' => array( + 'COLUMNS' => array( + 'notification_type_id' => array('USINT', NULL, 'auto_increment'), + 'notification_type_name' => array('VCHAR:255', ''), + 'notification_type_enabled' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => array('notification_type_id'), + 'KEYS' => array( + 'type' => array('UNIQUE', array('notification_type_name')), + ), + ), + $this->table_prefix . 'notifications' => array( + 'COLUMNS' => array( + 'notification_id' => array('UINT:10', NULL, 'auto_increment'), + 'notification_type_id' => array('USINT', 0), + 'item_id' => array('UINT', 0), + 'item_parent_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'notification_read' => array('BOOL', 0), + 'notification_time' => array('TIMESTAMP', 1), + 'notification_data' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'notification_id', + 'KEYS' => array( + 'item_ident' => array('INDEX', array('notification_type_id', 'item_id')), + 'user' => array('INDEX', array('user_id', 'notification_read')), + ), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'notification_types', + $this->table_prefix . 'notifications', + ), + 'add_tables' => array( + $this->table_prefix . 'notification_types' => array( + 'COLUMNS' => array( + 'notification_type' => array('VCHAR:255', ''), + 'notification_type_enabled' => array('BOOL', 1), + ), + 'PRIMARY_KEY' => array('notification_type', 'notification_type_enabled'), + ), + $this->table_prefix . 'notifications' => array( + 'COLUMNS' => array( + 'notification_id' => array('UINT', NULL, 'auto_increment'), + 'item_type' => array('VCHAR:255', ''), + 'item_id' => array('UINT', 0), + 'item_parent_id' => array('UINT', 0), + 'user_id' => array('UINT', 0), + 'notification_read' => array('BOOL', 0), + 'notification_time' => array('TIMESTAMP', 1), + 'notification_data' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'notification_id', + 'KEYS' => array( + 'item_ident' => array('INDEX', array('item_type', 'item_id')), + 'user' => array('INDEX', array('user_id', 'notification_read')), + ), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php new file mode 100644 index 0000000000..56b7a0916c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php @@ -0,0 +1,49 @@ +db_tools->sql_column_exists($this->table_prefix . 'reports', 'reported_post_enable_bbcode'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'reports' => array( + 'reported_post_enable_bbcode' => array('BOOL', 1), + 'reported_post_enable_smilies' => array('BOOL', 1), + 'reported_post_enable_magic_url' => array('BOOL', 1), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'reports' => array( + 'reported_post_enable_bbcode', + 'reported_post_enable_smilies', + 'reported_post_enable_magic_url', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php new file mode 100644 index 0000000000..494125ea5c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php @@ -0,0 +1,53 @@ +db->sql_query($sql); + $module_auth = $this->db_sql_fetchfield('module_auth'); + $this->db->sql_freeresult($result); + + return $module_auth === 'acl_u_sig' || $module_auth === false; + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\dev'); + } + + public function update_data() + { + return array( + array('custom', array( + array($this, 'update_signature_module_auth'), + ), + ), + ); + } + + public function update_signature_module_auth() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET module_auth = 'acl_u_sig' + WHERE module_class = 'ucp' + AND module_basename = 'ucp_profile' + AND module_mode = 'signature' + AND module_auth = ''"; + $this->db->sql_query($sql); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php new file mode 100644 index 0000000000..0418d5cc2b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php @@ -0,0 +1,173 @@ +db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_visibility'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_posts_approved' => array('UINT', 0), + 'forum_posts_unapproved' => array('UINT', 0), + 'forum_posts_softdeleted' => array('UINT', 0), + 'forum_topics_approved' => array('UINT', 0), + 'forum_topics_unapproved' => array('UINT', 0), + 'forum_topics_softdeleted' => array('UINT', 0), + ), + $this->table_prefix . 'posts' => array( + 'post_visibility' => array('TINT:3', 0), + 'post_delete_time' => array('TIMESTAMP', 0), + 'post_delete_reason' => array('STEXT_UNI', ''), + 'post_delete_user' => array('UINT', 0), + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility' => array('TINT:3', 0), + 'topic_delete_time' => array('TIMESTAMP', 0), + 'topic_delete_reason' => array('STEXT_UNI', ''), + 'topic_delete_user' => array('UINT', 0), + 'topic_posts_approved' => array('UINT', 0), + 'topic_posts_unapproved' => array('UINT', 0), + 'topic_posts_softdeleted' => array('UINT', 0), + ), + ), + 'add_index' => array( + $this->table_prefix . 'posts' => array( + 'post_visibility' => array('post_visibility'), + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility' => array('topic_visibility'), + 'forum_vis_last' => array('forum_id', 'topic_visibility', 'topic_last_post_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_posts_approved', + 'forum_posts_unapproved', + 'forum_posts_softdeleted', + 'forum_topics_approved', + 'forum_topics_unapproved', + 'forum_topics_softdeleted', + ), + $this->table_prefix . 'posts' => array( + 'post_visibility', + 'post_delete_time', + 'post_delete_reason', + 'post_delete_user', + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility', + 'topic_delete_time', + 'topic_delete_reason', + 'topic_delete_user', + 'topic_posts_approved', + 'topic_posts_unapproved', + 'topic_posts_softdeleted', + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'posts' => array('post_visibility'), + $this->table_prefix . 'topics' => array('topic_visibility', 'forum_vis_last'), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_post_visibility'))), + array('custom', array(array($this, 'update_topic_visibility'))), + array('custom', array(array($this, 'update_topic_forum_counts'))), + + array('permission.add', array('f_softdelete', false)), + array('permission.add', array('m_softdelete', false)), + ); + } + + public function update_post_visibility() + { + $sql = 'UPDATE ' . $this->table_prefix . 'posts + SET post_visibility = post_approved'; + $this->sql_query($sql); + } + + public function update_topic_visibility() + { + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_visibility = topic_approved'; + $this->sql_query($sql); + } + + public function update_topic_forum_counts() + { + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_posts_approved = topic_replies + 1, + topic_posts_unapproved = topic_replies_real - topic_replies + WHERE topic_visibility = ' . ITEM_APPROVED; + $this->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_posts_approved = 0, + topic_posts_unapproved = (topic_replies_real - topic_replies) + 1 + WHERE topic_visibility = ' . ITEM_UNAPPROVED; + $this->sql_query($sql); + + $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved + FROM ' . $this->table_prefix . 'topics + GROUP BY forum_id, topic_visibility'; + $result = $this->db->sql_query($sql); + + $update_forums = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $forum_id = (int) $row['forum_id']; + if (!isset($update_forums[$forum_id])) + { + $update_forums[$forum_id] = array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + ); + } + + $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts_approved']; + $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved']; + + $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics']; + } + $this->db->sql_freeresult($result); + + foreach ($update_forums as $forum_id => $forum_data) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $forum_data) . ' + WHERE forum_id = ' . $forum_id; + $this->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php new file mode 100644 index 0000000000..0c32e474f4 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php @@ -0,0 +1,70 @@ +db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_approved'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + '\phpbb\db\migration\data\v310\softdelete_p1', + ); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array('forum_posts', 'forum_topics', 'forum_topics_real'), + $this->table_prefix . 'posts' => array('post_approved'), + $this->table_prefix . 'topics' => array('topic_approved', 'topic_replies', 'topic_replies_real'), + ), + 'drop_keys' => array( + $this->table_prefix . 'posts' => array('post_approved'), + $this->table_prefix . 'topics' => array('forum_appr_last'), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_posts' => array('UINT', 0), + 'forum_topics' => array('UINT', 0), + 'forum_topics_real' => array('UINT', 0), + ), + $this->table_prefix . 'posts' => array( + 'post_approved' => array('BOOL', 1), + ), + $this->table_prefix . 'topics' => array( + 'topic_approved' => array('BOOL', 1), + 'topic_replies' => array('UINT', 0), + 'topic_replies_real' => array('UINT', 0), + ), + ), + 'add_index' => array( + $this->table_prefix . 'posts' => array( + 'post_approved' => array('post_approved'), + ), + $this->table_prefix . 'topics' => array( + 'forum_appr_last' => array('forum_id', 'topic_approved', 'topic_last_post_id'), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php new file mode 100644 index 0000000000..26f1046287 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php @@ -0,0 +1,187 @@ +db_tools->sql_table_exists($this->table_prefix . 'styles_imageset'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'styles' => array( + 'style_path' => array('VCHAR:100', ''), + 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), + 'style_parent_id' => array('UINT', 0), + 'style_parent_tree' => array('TEXT', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'styles' => array( + 'style_path', + 'bbcode_bitfield', + 'style_parent_id', + 'style_parent_tree', + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'styles_update'))), + ); + } + + public function styles_update() + { + // Get list of valid 3.1 styles + $available_styles = array('prosilver'); + + $iterator = new \DirectoryIterator($this->phpbb_root_path . 'styles'); + $skip_dirs = array('.', '..', 'prosilver'); + foreach ($iterator as $fileinfo) + { + if ($fileinfo->isDir() && !in_array($fileinfo->getFilename(), $skip_dirs) && file_exists($fileinfo->getPathname() . '/style.cfg')) + { + $style_cfg = parse_cfg_file($fileinfo->getPathname() . '/style.cfg'); + if (isset($style_cfg['phpbb_version']) && version_compare($style_cfg['phpbb_version'], '3.1.0-dev', '>=')) + { + // 3.1 style + $available_styles[] = $fileinfo->getFilename(); + } + } + } + + // Get all installed styles + if ($this->db_tools->sql_table_exists($this->table_prefix . 'styles_imageset')) + { + $sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id, i.imageset_path + FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . 'styles_theme c, ' . $this->table_prefix . "styles_imageset i + WHERE t.template_id = s.template_id + AND c.theme_id = s.theme_id + AND i.imageset_id = s.imageset_id"; + } + else + { + $sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_id + FROM ' . STYLES_TABLE . ' s, ' . $this->table_prefix . 'styles_template t, ' . $this->table_prefix . "stles_theme c + WHERE t.template_id = s.template_id + AND c.theme_id = s.theme_id"; + } + $result = $this->db->sql_query($sql); + + $styles = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $styles[] = $row; + } + $this->db->sql_freeresult($result); + + // Decide which styles to keep, all others will be deleted + $valid_styles = array(); + foreach ($styles as $style_row) + { + if ( + // Delete styles with parent style (not supported yet) + $style_row['template_inherits_id'] == 0 && + // Check if components match + $style_row['template_path'] == $style_row['theme_path'] && (!isset($style_row['imageset_path']) || $style_row['template_path'] == $style_row['imageset_path']) && + // Check if components are valid + in_array($style_row['template_path'], $available_styles) + ) + { + // Valid style. Keep it + $sql_ary = array( + 'style_path' => $style_row['template_path'], + 'bbcode_bitfield' => $style_row['bbcode_bitfield'], + 'style_parent_id' => 0, + 'style_parent_tree' => '', + ); + $this->sql_query('UPDATE ' . STYLES_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE style_id = ' . $style_row['style_id']); + $valid_styles[] = (int) $style_row['style_id']; + } + } + + // Remove old entries from styles table + if (!sizeof($valid_styles)) + { + // No valid styles: remove everything and add prosilver + $this->sql_query('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary); + + $sql_ary = array( + 'style_name' => 'prosilver', + 'style_copyright' => '© phpBB Group', + 'style_active' => 1, + 'style_path' => 'prosilver', + 'bbcode_bitfield' => 'lNg=', + 'style_parent_id' => 0, + 'style_parent_tree' => '', + + // Will be removed in the next step + 'imageset_id' => 0, + 'template_id' => 0, + 'theme_id' => 0, + ); + + $sql = 'INSERT INTO ' . STYLES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->sql_query($sql); + + $sql = 'SELECT style_id + FROM ' . $table . " + WHERE style_name = 'prosilver'"; + $result = $this->sql_query($sql); + $default_style = $this->db->sql_fetchfield($result); + $this->db->sql_freeresult($result); + + set_config('default_style', $default_style); + + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0'; + $this->sql_query($sql); + } + else + { + // There are valid styles in styles table. Remove styles that are outdated + $this->sql_query('DELETE FROM ' . STYLES_TABLE . ' + WHERE ' . $this->db->sql_in_set('style_id', $valid_styles, true)); + + // Change default style + if (!in_array($this->config['default_style'], $valid_styles)) + { + $this->sql_query('UPDATE ' . CONFIG_TABLE . " + SET config_value = '" . $valid_styles[0] . "' + WHERE config_name = 'default_style'"); + } + + // Reset styles for users + $this->sql_query('UPDATE ' . USERS_TABLE . ' + SET user_style = 0 + WHERE ' . $this->db->sql_in_set('user_style', $valid_styles, true)); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php new file mode 100644 index 0000000000..3f6477b7cb --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php @@ -0,0 +1,131 @@ +db_tools->sql_table_exists($this->table_prefix . 'styles_imageset'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data0\style_update_p1'); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'styles' => array( + 'imageset_id', + 'template_id', + 'theme_id', + ), + ), + + 'drop_tables' => array( + $this->table_prefix . 'styles_imageset', + $this->table_prefix . 'styles_imageset_data', + $this->table_prefix . 'styles_template', + $this->table_prefix . 'styles_template_data', + $this->table_prefix . 'styles_theme', + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'styles' => array( + 'imageset_id' => array('UINT', 0), + 'template_id' => array('UINT', 0), + 'theme_id' => array('UINT', 0), + ), + ), + + 'add_tables' => array( + $this->table_prefix . 'styles_imageset' => array( + 'COLUMNS' => array( + 'imageset_id' => array('UINT', NULL, 'auto_increment'), + 'imageset_name' => array('VCHAR_UNI:255', ''), + 'imageset_copyright' => array('VCHAR_UNI', ''), + 'imageset_path' => array('VCHAR:100', ''), + ), + 'PRIMARY_KEY' => 'imageset_id', + 'KEYS' => array( + 'imgset_nm' => array('UNIQUE', 'imageset_name'), + ), + ), + $this->table_prefix . 'styles_imageset_data' => array( + 'COLUMNS' => array( + 'image_id' => array('UINT', NULL, 'auto_increment'), + 'image_name' => array('VCHAR:200', ''), + 'image_filename' => array('VCHAR:200', ''), + 'image_lang' => array('VCHAR:30', ''), + 'image_height' => array('USINT', 0), + 'image_width' => array('USINT', 0), + 'imageset_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'image_id', + 'KEYS' => array( + 'i_d' => array('INDEX', 'imageset_id'), + ), + ), + $this->table_prefix . 'styles_template' => array( + 'COLUMNS' => array( + 'template_id' => array('UINT', NULL, 'auto_increment'), + 'template_name' => array('VCHAR_UNI:255', ''), + 'template_copyright' => array('VCHAR_UNI', ''), + 'template_path' => array('VCHAR:100', ''), + 'bbcode_bitfield' => array('VCHAR:255', 'kNg='), + 'template_storedb' => array('BOOL', 0), + 'template_inherits_id' => array('UINT:4', 0), + 'template_inherit_path' => array('VCHAR', ''), + ), + 'PRIMARY_KEY' => 'template_id', + 'KEYS' => array( + 'tmplte_nm' => array('UNIQUE', 'template_name'), + ), + ), + $this->table_prefix . 'styles_template_data' => array( + 'COLUMNS' => array( + 'template_id' => array('UINT', 0), + 'template_filename' => array('VCHAR:100', ''), + 'template_included' => array('TEXT', ''), + 'template_mtime' => array('TIMESTAMP', 0), + 'template_data' => array('MTEXT_UNI', ''), + ), + 'KEYS' => array( + 'tid' => array('INDEX', 'template_id'), + 'tfn' => array('INDEX', 'template_filename'), + ), + ), + $this->table_prefix . 'styles_theme' => array( + 'COLUMNS' => array( + 'theme_id' => array('UINT', NULL, 'auto_increment'), + 'theme_name' => array('VCHAR_UNI:255', ''), + 'theme_copyright' => array('VCHAR_UNI', ''), + 'theme_path' => array('VCHAR:100', ''), + 'theme_storedb' => array('BOOL', 0), + 'theme_mtime' => array('TIMESTAMP', 0), + 'theme_data' => array('MTEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'theme_id', + 'KEYS' => array( + 'theme_name' => array('UNIQUE', 'theme_name'), + ), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php new file mode 100644 index 0000000000..80cc4be1c0 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/teampage.php @@ -0,0 +1,106 @@ +db_tools->sql_table_exists($this->table_prefix . 'teampage'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'teampage' => array( + 'COLUMNS' => array( + 'teampage_id' => array('UINT', NULL, 'auto_increment'), + 'group_id' => array('UINT', 0), + 'teampage_name' => array('VCHAR_UNI:255', ''), + 'teampage_position' => array('UINT', 0), + 'teampage_parent' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'teampage_id', + ), + ), + 'drop_columns' => array( + $this->table_prefix . 'groups' => array( + 'group_teampage', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'teampage', + ), + 'add_columns' => array( + $this->table_prefix . 'groups' => array( + 'group_teampage' => array('UINT', 0, 'after' => 'group_legend'), + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'add_groups_teampage'))), + ); + } + + public function add_groups_teampage() + { + $sql = 'SELECT teampage_id + FROM ' . TEAMPAGE_TABLE; + $result = $this->db->sql_query_limit($sql, 1); + $added_groups_teampage = (bool) $this->db->sql_fetchfield('teampage_id'); + $this->db->sql_freeresult($result); + + if (!$added_groups_teampage) + { + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE group_type = ' . GROUP_SPECIAL . " + AND (group_name = 'ADMINISTRATORS' + OR group_name = 'GLOBAL_MODERATORS') + ORDER BY group_name ASC"; + $result = $this->db->sql_query($sql); + + $teampage_entries = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $teampage_entries[] = array( + 'group_id' => (int) $row['group_id'], + 'teampage_name' => '', + 'teampage_position' => sizeof($teampage_entries) + 1, + 'teampage_parent' => 0, + ); + } + $this->db->sql_freeresult($result); + + if (sizeof($teampage_entries)) + { + $this->db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries); + } + unset($teampage_entries); + } + + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/timezone.php b/phpBB/phpbb/db/migration/data/v310/timezone.php new file mode 100644 index 0000000000..93c58819ce --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/timezone.php @@ -0,0 +1,165 @@ +db_tools->sql_column_exists($this->table_prefix . 'users', 'user_dst'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'users' => array( + 'user_timezone' => array('VCHAR:100', ''), + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_timezones'))), + ); + } + + public function update_timezones() + { + // Update user timezones + $sql = 'SELECT user_dst, user_timezone + FROM ' . $this->table_prefix . 'users + GROUP BY user_timezone, user_dst'; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_timezone = '" . $this->db->sql_escape($this->convert_phpbb30_timezone($row['user_timezone'], $row['user_dst'])) . "' + WHERE user_timezone = '" . $this->db->sql_escape($row['user_timezone']) . "' + AND user_dst = " . (int) $row['user_dst']; + $this->sql_query($sql); + } + $this->db->sql_freeresult($result); + + // Update board default timezone + $sql = 'UPDATE ' . $this->table_prefix . "config + SET config_value = '" . $this->convert_phpbb30_timezone($this->config['board_timezone'], $this->config['board_dst']) . "' + WHERE config_name = 'board_timezone'"; + $this->sql_query($sql); + } + + /** + * Determine the new \timezone for a given phpBB 3.0 timezone and + * "Daylight Saving Time" option + * + * @param $timezone float Users timezone in 3.0 + * @param $dst int Users daylight saving time + * @return string Users new \php Timezone which is used since 3.1 + */ + public function convert_phpbb30_timezone($timezone, $dst) + { + $offset = $timezone + $dst; + + switch ($timezone) + { + case '-12': + return 'Etc/GMT+' . abs($offset); //'[UTC - 12] Baker Island Time' + case '-11': + return 'Etc/GMT+' . abs($offset); //'[UTC - 11] Niue Time, Samoa Standard Time' + case '-10': + return 'Etc/GMT+' . abs($offset); //'[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time' + case '-9.5': + return 'Pacific/Marquesas'; //'[UTC - 9:30] Marquesas Islands Time' + case '-9': + return 'Etc/GMT+' . abs($offset); //'[UTC - 9] Alaska Standard Time, Gambier Island Time' + case '-8': + return 'Etc/GMT+' . abs($offset); //'[UTC - 8] Pacific Standard Time' + case '-7': + return 'Etc/GMT+' . abs($offset); //'[UTC - 7] Mountain Standard Time' + case '-6': + return 'Etc/GMT+' . abs($offset); //'[UTC - 6] Central Standard Time' + case '-5': + return 'Etc/GMT+' . abs($offset); //'[UTC - 5] Eastern Standard Time' + case '-4.5': + return 'America/Caracas'; //'[UTC - 4:30] Venezuelan Standard Time' + case '-4': + return 'Etc/GMT+' . abs($offset); //'[UTC - 4] Atlantic Standard Time' + case '-3.5': + return 'America/St_Johns'; //'[UTC - 3:30] Newfoundland Standard Time' + case '-3': + return 'Etc/GMT+' . abs($offset); //'[UTC - 3] Amazon Standard Time, Central Greenland Time' + case '-2': + return 'Etc/GMT+' . abs($offset); //'[UTC - 2] Fernando de Noronha Time, South Georgia & the South Sandwich Islands Time' + case '-1': + return 'Etc/GMT+' . abs($offset); //'[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time' + case '0': + return (!$dst) ? 'UTC' : 'Etc/GMT-1'; //'[UTC] Western European Time, Greenwich Mean Time' + case '1': + return 'Etc/GMT-' . $offset; //'[UTC + 1] Central European Time, West African Time' + case '2': + return 'Etc/GMT-' . $offset; //'[UTC + 2] Eastern European Time, Central African Time' + case '3': + return 'Etc/GMT-' . $offset; //'[UTC + 3] Moscow Standard Time, Eastern African Time' + case '3.5': + return 'Asia/Tehran'; //'[UTC + 3:30] Iran Standard Time' + case '4': + return 'Etc/GMT-' . $offset; //'[UTC + 4] Gulf Standard Time, Samara Standard Time' + case '4.5': + return 'Asia/Kabul'; //'[UTC + 4:30] Afghanistan Time' + case '5': + return 'Etc/GMT-' . $offset; //'[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time' + case '5.5': + return 'Asia/Kolkata'; //'[UTC + 5:30] Indian Standard Time, Sri Lanka Time' + case '5.75': + return 'Asia/Kathmandu'; //'[UTC + 5:45] Nepal Time' + case '6': + return 'Etc/GMT-' . $offset; //'[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time' + case '6.5': + return 'Indian/Cocos'; //'[UTC + 6:30] Cocos Islands Time, Myanmar Time' + case '7': + return 'Etc/GMT-' . $offset; //'[UTC + 7] Indochina Time, Krasnoyarsk Standard Time' + case '8': + return 'Etc/GMT-' . $offset; //'[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time' + case '8.75': + return 'Australia/Eucla'; //'[UTC + 8:45] Southeastern Western Australia Standard Time' + case '9': + return 'Etc/GMT-' . $offset; //'[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time' + case '9.5': + return 'Australia/ACT'; //'[UTC + 9:30] Australian Central Standard Time' + case '10': + return 'Etc/GMT-' . $offset; //'[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time' + case '10.5': + return 'Australia/Lord_Howe'; //'[UTC + 10:30] Lord Howe Standard Time' + case '11': + return 'Etc/GMT-' . $offset; //'[UTC + 11] Solomon Island Time, Magadan Standard Time' + case '11.5': + return 'Pacific/Norfolk'; //'[UTC + 11:30] Norfolk Island Time' + case '12': + return 'Etc/GMT-12'; //'[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time' + case '12.75': + return 'Pacific/Chatham'; //'[UTC + 12:45] Chatham Islands Time' + case '13': + return 'Pacific/Tongatapu'; //'[UTC + 13] Tonga Time, Phoenix Islands Time' + case '14': + return 'Pacific/Kiritimati'; //'[UTC + 14] Line Island Time' + default: + return 'UTC'; + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/timezone_p2.php b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php new file mode 100644 index 0000000000..1066ab8571 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php @@ -0,0 +1,45 @@ +db_tools->sql_column_exists($this->table_prefix . 'users', 'user_dst'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\timezone'); + } + + public function update_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'users' => array( + 'user_dst', + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'users' => array( + 'user_dst' => array('BOOL', 0), + ), + ), + ); + } +} -- cgit v1.2.1 From ee735685ac98d9b1ebb11cfcce6958a5266f3e39 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:37:32 +0200 Subject: [ticket/11700] Fix number class names in 3.0.x migrations PHPBB3-11700 --- phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php | 4 ++-- phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php | 4 ++-- phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php | 6 +++--- phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php | 6 +++--- 37 files changed, 109 insertions(+), 109 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php index 360daed437..5e6ba90336 100644 --- a/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php +++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php @@ -7,13 +7,13 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; class local_url_bbcode extends \phpbb\db\migration\migration { static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_12_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php index 2fe0addc06..26f90a18f3 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_1 extends \phpbb\db\migration\migration +class release_3_0_1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_1_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_1_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php index cdf824a9ff..5da406e115 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_10 extends \phpbb\db\migration\migration +class release_3_0_10 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_10 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_10_rc3'); + return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc3'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php index ee05fcabaa..4cde65dd72 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_10_rc1 extends \phpbb\db\migration\migration +class release_3_0_10_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_10_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_9'); + return array('\phpbb\db\migration\data\v30x\release_3_0_9'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php index f53a4b0d97..a729f45ed1 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_10_rc2 extends \phpbb\db\migration\migration +class release_3_0_10_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_10_rc2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_10_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php index 20456e0458..4c47868c19 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_10_rc3 extends \phpbb\db\migration\migration +class release_3_0_10_rc3 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_10_rc3 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_10_rc2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc2'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php index 5b842cba4b..f65fe178c0 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_11 extends \phpbb\db\migration\migration +class release_3_0_11 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_11 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_11_rc2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc2'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php index 1d484a97ca..860a65052f 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_11_rc1 extends \phpbb\db\migration\migration +class release_3_0_11_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_11_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_10'); + return array('\phpbb\db\migration\data\v30x\release_3_0_10'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php index b7e475a87b..62e267ac01 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_11_rc2 extends \phpbb\db\migration\migration +class release_3_0_11_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_11_rc2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_11_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc1'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php index 3f851967df..69db096cb0 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php @@ -7,11 +7,11 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 **/ -class 3_0_12_rc1 extends \phpbb\db\migration\migration +class release_3_0_12_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -20,7 +20,7 @@ class 3_0_12_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_11'); + return array('\phpbb\db\migration\data\v30x\release_3_0_11'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php index 0444de4ac2..990b82141e 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_1_rc1 extends \phpbb\db\migration\migration +class release_3_0_1_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php index 4f9278e2fa..abb41f38cf 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_2 extends \phpbb\db\migration\migration +class release_3_0_2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_2_rc2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc2'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php index 8f709fb769..8661531dd9 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_2_rc1 extends \phpbb\db\migration\migration +class release_3_0_2_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_2_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php index ecbe8bf808..55055ca0a2 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_2_rc2 extends \phpbb\db\migration\migration +class release_3_0_2_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_2_rc2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_2_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc1'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php index 5f94bd9018..49e37e9386 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_3 extends \phpbb\db\migration\migration +class release_3_0_3 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_3 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_3_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_3_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php index 631d382135..4b87933b11 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_3_rc1 extends \phpbb\db\migration\migration +class release_3_0_3_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_3_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_2'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php index 369f23f7e7..f15f806cee 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_4 extends \phpbb\db\migration\migration +class release_3_0_4 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_4 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_4_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_4_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php index f98d7a59d0..752dfd2576 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_4_rc1 extends \phpbb\db\migration\migration +class release_3_0_4_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_4_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_3'); + return array('\phpbb\db\migration\data\v30x\release_3_0_3'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php index 9265f09b39..f2d458e9c5 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_5 extends \phpbb\db\migration\migration +class release_3_0_5 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_5 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_5_rc1part2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1part2'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php index b99313de5d..81bd3db975 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_5_rc1 extends \phpbb\db\migration\migration +class release_3_0_5_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_5_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_4'); + return array('\phpbb\db\migration\data\v30x\release_3_0_4'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php index 65787f9310..1c04d814fd 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_5_rc1part2 extends \phpbb\db\migration\migration +class release_3_0_5_rc1part2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_5_rc1part2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_5_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php index 382fb6cde2..24b7dc51a5 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_6 extends \phpbb\db\migration\migration +class release_3_0_6 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_6 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_6_rc4'); + return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc4'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php index 0b54c3b195..d78a0b7eed 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_6_rc1 extends \phpbb\db\migration\migration +class release_3_0_6_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_6_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_5'); + return array('\phpbb\db\migration\data\v30x\release_3_0_5'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php index 041224d19a..d5dbf2e2a9 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_6_rc2 extends \phpbb\db\migration\migration +class release_3_0_6_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_6_rc2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_6_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php index 3183c16efd..40fd076ff1 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_6_rc3 extends \phpbb\db\migration\migration +class release_3_0_6_rc3 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_6_rc3 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_6_rc2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc2'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php index 7d75b12130..93b01c888f 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_6_rc4 extends \phpbb\db\migration\migration +class release_3_0_6_rc4 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_6_rc4 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_6_rc3'); + return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc3'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php index 1b1e5d0373..e19cbb04fa 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_7 extends \phpbb\db\migration\migration +class release_3_0_7 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_7 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_7_rc2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc2'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php index a45c9c3c14..0fad5f5ff5 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_7_pl1 extends \phpbb\db\migration\migration +class release_3_0_7_pl1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_7_pl1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_7'); + return array('\phpbb\db\migration\data\v30x\release_3_0_7'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php index dab90512ab..17f97c7043 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_7_rc1 extends \phpbb\db\migration\migration +class release_3_0_7_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_7_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_6'); + return array('\phpbb\db\migration\data\v30x\release_3_0_6'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php index ea430740c6..0437e7aa7c 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_7_rc2 extends \phpbb\db\migration\migration +class release_3_0_7_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_7_rc2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_7_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php index c08a74e5ee..ccd1b94bef 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_8 extends \phpbb\db\migration\migration +class release_3_0_8 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_8 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_8_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_8_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php index dce88e249e..be32ec0384 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_8_rc1 extends \phpbb\db\migration\migration +class release_3_0_8_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_8_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_7_pl1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_7_pl1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php index 8254ac8561..1783ee8a34 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_9 extends \phpbb\db\migration\migration +class release_3_0_9 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_9 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_9_rc4'); + return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc4'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php index 14e0fe6013..12a8c341d0 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_9_rc1 extends \phpbb\db\migration\migration +class release_3_0_9_rc1 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_9_rc1 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_8'); + return array('\phpbb\db\migration\data\v30x\release_3_0_8'); } public function update_schema() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php index 44fd789353..f6e05361b3 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_9_rc2 extends \phpbb\db\migration\migration +class release_3_0_9_rc2 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_9_rc2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_9_rc1'); + return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc1'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php index e4102fb193..29b53e56c9 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_9_rc3 extends \phpbb\db\migration\migration +class release_3_0_9_rc3 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_9_rc3 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_9_rc2'); + return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc2'); } public function update_data() diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php index 5896d11ba5..4921330fdd 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php @@ -7,9 +7,9 @@ * */ -namespace phpbb\db\migration\datax; +namespace phpbb\db\migration\data\v30x; -class 3_0_9_rc4 extends \phpbb\db\migration\migration +class release_3_0_9_rc4 extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -18,7 +18,7 @@ class 3_0_9_rc4 extends \phpbb\db\migration\migration static public function depends_on() { - return array('phpbb_db_migration_data_30x_3_0_9_rc3'); + return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc3'); } public function update_data() -- cgit v1.2.1 From 2a1207b14f7792b935ffd6ffff9d6c89fcce638b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 15:31:52 +0200 Subject: [ticket/11700] Correclty use namespaces in notifications PHPBB3-11700 --- phpBB/phpbb/notification/type/base.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 1605f59c55..cc0355771b 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -95,7 +95,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Notification Type Base Constructor - * + * * @param \phpbb\user_loader $user_loader * @param \phpbb\db\driver\driver $db * @param \phpbb\cache\driver\driver_interface $cache @@ -128,7 +128,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Set notification manager (required) - * + * * @param \phpbb\notification\manager $notification_manager */ public function set_notification_manager(\phpbb\notification\manager $notification_manager) @@ -152,7 +152,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Magic method to get data from this notification - * + * * @param mixed $name * @return mixed */ @@ -164,7 +164,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Magic method to set data on this notification - * + * * @param mixed $name * @return null */ @@ -176,9 +176,9 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Magic method to get a string of this notification - * + * * Primarily for testing - * + * * @param string $name * @return mixed */ @@ -222,9 +222,9 @@ abstract class base implements \phpbb\notification\type\type_interface { // 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, @@ -285,7 +285,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Prepare to output the notification to the template - * + * * @return array Template variables */ public function prepare_for_display() @@ -333,7 +333,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Get the user's avatar (fall back) - * + * * @return string */ public function get_avatar() @@ -343,7 +343,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Get the special items to load (fall back) - * + * * @return array */ public function get_load_special() @@ -361,7 +361,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Is available (fall back) - * + * * @return bool */ public function is_available() @@ -371,7 +371,7 @@ abstract class base implements \phpbb\notification\type\type_interface /** * Pre create insert array function (fall back) - * + * * @return array */ public function pre_create_insert_array($type_data, $notify_users) -- cgit v1.2.1 From dc2f4a3663ef10e6d562426764db657caeb1f435 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 15:43:33 +0200 Subject: [ticket/11700] Avoid \t in double quoted strings for template code PHPBB3-11700 --- phpBB/phpbb/template/twig/node/includeasset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index f5c6413617..3c899b96e8 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -35,7 +35,7 @@ class includeasset extends \Twig_Node ->write("\$asset_file = ") ->subcompile($this->getNode('expr')) ->raw(";\n") - ->write("\$asset = new \phpbb\template\asset(\$asset_file);\n") + ->write("\$asset = new \phpbb\\template\asset(\$asset_file);\n") ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") -- cgit v1.2.1 From d297eb4aecc6e658987c9647d76fed4210ef77f5 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 17:13:29 +0200 Subject: [ticket/11700] Get the installer to run with namespaces PHPBB3-11700 --- phpBB/phpbb/db/migration/data/v310/style_update_p2.php | 2 +- phpBB/phpbb/extension/finder.php | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php index 3f6477b7cb..6c3b0de2a1 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php @@ -7,7 +7,7 @@ * */ -namespace phpbb\db\migration\data0; +namespace phpbb\db\migration\data\v310; class style_update_p2 extends \phpbb\db\migration\migration { diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index 0ecae7a13f..bf84728f05 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -277,9 +277,16 @@ class finder $classes = array(); foreach ($files as $file => $ext_name) { - $file = preg_replace('#^(phpbb|includes)/#', '', $file); - - $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext))); + if (preg_match('#^includes/#', $file)) + { + $file = preg_replace('#^includes/#', '', $file); + $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext))); + } + else + { + $file = preg_replace('#^phpbb/#', '', $file); + $classes[] = 'phpbb\\' . str_replace('/', '\\', substr($file, 0, -strlen('.' . $this->php_ext))); + } } return $classes; } -- cgit v1.2.1 From 2472271bc0cd7c15c77783c86ccaac643ab1756a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 02:41:03 +0200 Subject: [ticket/11700] Fix tests after merging new develop code PHPBB3-11700 --- phpBB/phpbb/auth/provider/oauth/oauth.php | 54 +++++++++++----------- phpBB/phpbb/auth/provider/oauth/service/bitly.php | 18 ++++---- phpBB/phpbb/auth/provider/oauth/token_storage.php | 14 +++--- phpBB/phpbb/cache/driver/file.php | 6 +-- phpBB/phpbb/log/null.php | 4 +- phpBB/phpbb/notification/type/group_request.php | 4 +- .../notification/type/group_request_approved.php | 4 +- phpBB/phpbb/template/base.php | 6 ++- phpBB/phpbb/template/twig/loader.php | 4 +- phpBB/phpbb/template/twig/node/includeasset.php | 2 +- phpBB/phpbb/template/twig/node/includecss.php | 2 +- phpBB/phpbb/template/twig/node/includejs.php | 2 +- 12 files changed, 68 insertions(+), 52 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index be0b8bb7d6..e92462b344 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth; + /** * @ignore */ @@ -23,33 +25,33 @@ use OAuth\Common\Http\Uri\Uri; * * @package auth */ -class phpbb_auth_provider_oauth extends phpbb_auth_provider_base +class oauth extends \phpbb\auth\provider\base { /** * Database driver * - * @var phpbb_db_driver + * @var \phpbb\db\driver */ protected $db; /** * phpBB config * - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * phpBB request object * - * @var phpbb_request + * @var \phpbb\request\request_interface */ protected $request; /** * phpBB user * - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -70,7 +72,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * All OAuth service providers * - * @var phpbb_di_service_collection Contains phpbb_auth_provider_oauth_service_interface + * @var \phpbb\di\service_collection Contains \phpbb\auth\provider\oauth\service_interface */ protected $service_providers; @@ -105,18 +107,18 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * OAuth Authentication Constructor * - * @param phpbb_db_driver $db - * @param phpbb_config $config - * @param phpbb_request $request - * @param phpbb_user $user + * @param \phpbb\db\driver $db + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + * @param \phpbb\user $user * @param string $auth_provider_oauth_token_storage_table * @param string $auth_provider_oauth_token_account_assoc - * @param phpbb_di_service_collection $service_providers Contains phpbb_auth_provider_oauth_service_interface + * @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface * @param string $users_table * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, phpbb_di_service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver $db, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -156,7 +158,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base // Temporary workaround for only having one authentication provider available if (!$this->request->is_set('oauth_service')) { - $provider = new phpbb_auth_provider_db($this->db, $this->config, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext); + $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext); return $provider->login($username, $password); } @@ -175,11 +177,11 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base // Get the service credentials for the given service $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $query = 'mode=login&login=external&oauth_service=' . $service_name_original; $service = $this->get_service($service_name_original, $storage, $service_credentials, $this->service_providers[$service_name]->get_auth_scope(), $query); - if ($this->request->is_set('code', phpbb_request_interface::GET)) + if ($this->request->is_set('code', \phpbb\request\request_interface::GET)) { $this->service_providers[$service_name]->set_external_service_provider($service); $unique_id = $this->service_providers[$service_name]->perform_auth_login(); @@ -258,7 +260,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base } $uri_factory = new \OAuth\Common\Http\Uri\UriFactory(); - $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(phpbb_request_interface::SERVER)); + $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(\phpbb\request\request_interface::SERVER)); $current_uri->setQuery($query); $this->current_uri = $current_uri; @@ -269,15 +271,15 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base * Returns a new service object * * @param string $service_name The name of the service - * @param phpbb_auth_oauth_token_storage $storage - * @param array $service_credentials {@see phpbb_auth_provider_oauth::get_service_credentials} + * @param \phpbb\auth\provider\oauth\token_storage $storage + * @param array $service_credentials {@see \phpbb\auth\provider\oauth\oauth::get_service_credentials} * @param array $scope The scope of the request against * the api. * @param string $query The query string of the * current_uri used in redirection * @return \OAuth\Common\Service\ServiceInterface */ - protected function get_service($service_name, phpbb_auth_provider_oauth_token_storage $storage, array $service_credentials, array $scopes = array(), $query) + protected function get_service($service_name, \phpbb\auth\provider\oauth\token_storage $storage, array $service_credentials, array $scopes = array(), $query) { $current_uri = $this->get_current_uri($service_name, $query); @@ -434,7 +436,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * Performs the account linking for login_link * - * @param array $link_data The same variable given to {@see phpbb_auth_provider_interface::link_account} + * @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account} * @param string $service_name The name of the service being used in * linking. * @return string|null Returns a language constant (string) if an error is @@ -442,7 +444,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base */ protected function link_account_login_link(array $link_data, $service_name) { - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); // Check for an access token, they should have one if (!$storage->has_access_token_by_session($service_name)) @@ -477,7 +479,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * Performs the account linking for auth_link * - * @param array $link_data The same variable given to {@see phpbb_auth_provider_interface::link_account} + * @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account} * @param string $service_name The name of the service being used in * linking. * @return string|null Returns a language constant (string) if an error is @@ -485,13 +487,13 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base */ protected function link_account_auth_link(array $link_data, $service_name) { - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']); $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); $scopes = $this->service_providers[$service_name]->get_auth_scope(); $service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query); - if ($this->request->is_set('code', phpbb_request_interface::GET)) + if ($this->request->is_set('code', \phpbb\request\request_interface::GET)) { $this->service_providers[$service_name]->set_external_service_provider($service); $unique_id = $this->service_providers[$service_name]->perform_auth_login(); @@ -530,7 +532,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base public function logout($data, $new_session) { // Clear all tokens belonging to the user - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $storage->clearAllTokens(); return; @@ -610,7 +612,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base // Clear all tokens belonging to the user on this servce $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']); - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $storage->clearToken($service_name); return; diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php index 3bafdd59ce..47cf7ee380 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/bitly.php +++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,29 +22,29 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_service_base +class bitly extends \phpbb\auth\provider\oauth\service\base { /** * phpBB config * - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb_request + * @var \phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb_config $config - * @param phpbb_request $request + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request */ - public function __construct(phpbb_config $config, phpbb_request $request) + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { $this->config = $config; $this->request = $request; @@ -66,7 +68,7 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // This was a callback request from bitly, get the token @@ -86,7 +88,7 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // Send a request with it diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php index d21deb8999..2ce0e32da3 100644 --- a/phpBB/phpbb/auth/provider/oauth/token_storage.php +++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth; + /** * @ignore */ @@ -27,19 +29,19 @@ use OAuth\Common\Storage\Exception\TokenNotFoundException; * * @package auth */ -class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface +class token_storage implements TokenStorageInterface { /** * Cache driver. * - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * phpBB user * - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -58,11 +60,11 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface /** * Creates token storage for phpBB. * - * @param phpbb_db_driver $db - * @param phpbb_user $user + * @param \phpbb\db\driver\driver $db + * @param \phpbb\user $user * @param string $auth_provider_oauth_table */ - public function __construct(phpbb_db_driver $db, phpbb_user $user, $auth_provider_oauth_table) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, $auth_provider_oauth_table) { $this->db = $db; $this->user = $user; diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 36525e7f55..6e63b6a716 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -207,9 +207,9 @@ class file extends \phpbb\cache\driver\base function purge() { // Purge all phpbb cache files - try + try { - $iterator = new DirectoryIterator($this->cache_dir); + $iterator = new \DirectoryIterator($this->cache_dir); } catch (Exception $e) { @@ -258,7 +258,7 @@ class file extends \phpbb\cache\driver\base */ protected function remove_dir($dir) { - try + try { $iterator = new DirectoryIterator($dir); } diff --git a/phpBB/phpbb/log/null.php b/phpBB/phpbb/log/null.php index 14b5f65eec..2ef69926ee 100644 --- a/phpBB/phpbb/log/null.php +++ b/phpBB/phpbb/log/null.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\log; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpbb_log */ -class phpbb_log_null implements phpbb_log_interface +class null implements log_interface { /** * {@inheritdoc} diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php index 1a3b5b6992..1768a8fffa 100644 --- a/phpBB/phpbb/notification/type/group_request.php +++ b/phpBB/phpbb/notification/type/group_request.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\notification\type; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_notification_type_group_request extends phpbb_notification_type_base +class group_request extends \phpbb\notification\type\base { /** * {@inheritdoc} diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php index ce83329ff3..be4a902acd 100644 --- a/phpBB/phpbb/notification/type/group_request_approved.php +++ b/phpBB/phpbb/notification/type/group_request_approved.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\notification\type; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_notification_type_group_request_approved extends phpbb_notification_type_base +class group_request_approved extends \phpbb\notification\type\base { /** * {@inheritdoc} diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index 3778424a96..86868707f0 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template; + /** * @ignore */ @@ -15,13 +17,13 @@ if (!defined('IN_PHPBB')) exit; } -abstract class phpbb_template_base implements phpbb_template +abstract class base implements template { /** * Template context. * Stores template data used during template rendering. * - * @var phpbb_template_context + * @var \phpbb\template\context */ protected $context; diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 0829e519f7..910061dc0f 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Twig Template loader * @package phpBB3 */ -class phpbb_template_twig_loader extends Twig_Loader_Filesystem +class loader extends \Twig_Loader_Filesystem { protected $safe_directories = array(); diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index d632469c9e..eeedeb31f0 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -73,5 +73,5 @@ abstract class includeasset extends \Twig_Node * @param Twig_Compiler A Twig_Compiler instance * @return null */ - abstract protected function append_asset(Twig_Compiler $compiler); + abstract protected function append_asset(\Twig_Compiler $compiler); } diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php index 9601cc5155..deb279fa4a 100644 --- a/phpBB/phpbb/template/twig/node/includecss.php +++ b/phpBB/phpbb/template/twig/node/includecss.php @@ -22,7 +22,7 @@ class includecss extends \phpbb\template\twig\node\includeasset /** * {@inheritdoc} */ - public function append_asset(Twig_Compiler $compiler) + public function append_asset(\Twig_Compiler $compiler) { $compiler ->raw("environment->get_phpbb_config(); -- cgit v1.2.1 From 09cfa01d589ead86cf811e27b52167539e0478ec Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 03:14:39 +0200 Subject: [ticket/11700] Fix installation after develop merge PHPBB3-11700 --- phpBB/phpbb/cache/driver/file.php | 2 +- .../db/migration/data/310/auth_provider_oauth.php | 71 --------------------- phpBB/phpbb/db/migration/data/310/mod_rewrite.php | 25 -------- .../db/migration/data/310/notifications_cron.php | 25 -------- .../migration/data/310/softdelete_mcp_modules.php | 55 ---------------- .../db/migration/data/v310/auth_provider_oauth.php | 73 ++++++++++++++++++++++ phpBB/phpbb/db/migration/data/v310/mod_rewrite.php | 27 ++++++++ .../db/migration/data/v310/notifications_cron.php | 27 ++++++++ .../migration/data/v310/softdelete_mcp_modules.php | 57 +++++++++++++++++ 9 files changed, 185 insertions(+), 177 deletions(-) delete mode 100644 phpBB/phpbb/db/migration/data/310/auth_provider_oauth.php delete mode 100644 phpBB/phpbb/db/migration/data/310/mod_rewrite.php delete mode 100644 phpBB/phpbb/db/migration/data/310/notifications_cron.php delete mode 100644 phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php create mode 100644 phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php create mode 100644 phpBB/phpbb/db/migration/data/v310/mod_rewrite.php create mode 100644 phpBB/phpbb/db/migration/data/v310/notifications_cron.php create mode 100644 phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 6e63b6a716..a64232400b 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -260,7 +260,7 @@ class file extends \phpbb\cache\driver\base { try { - $iterator = new DirectoryIterator($dir); + $iterator = new \DirectoryIterator($dir); } catch (Exception $e) { diff --git a/phpBB/phpbb/db/migration/data/310/auth_provider_oauth.php b/phpBB/phpbb/db/migration/data/310/auth_provider_oauth.php deleted file mode 100644 index cad1c16bb2..0000000000 --- a/phpBB/phpbb/db/migration/data/310/auth_provider_oauth.php +++ /dev/null @@ -1,71 +0,0 @@ -db_tools->sql_table_exists($this->table_prefix . 'auth_provider_oauth'); - } - - public function update_schema() - { - return array( - 'add_tables' => array( - $this->table_prefix . 'oauth_tokens' => array( - 'COLUMNS' => array( - 'user_id' => array('UINT', 0), // phpbb_users.user_id - 'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set - 'provider' => array('VCHAR', ''), // Name of the OAuth provider - 'oauth_token' => array('MTEXT', ''), // Serialized token - ), - 'KEYS' => array( - 'user_id' => array('INDEX', 'user_id'), - 'provider' => array('INDEX', 'provider'), - ), - ), - $this->table_prefix . 'oauth_accounts' => array( - 'COLUMNS' => array( - 'user_id' => array('UINT', 0), - 'provider' => array('VCHAR', ''), - 'oauth_provider_id' => array('TEXT_UNI', ''), - ), - 'PRIMARY_KEY' => array( - 'user_id', - 'provider', - ), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_tables' => array( - $this->table_prefix . 'oauth_tokens', - $this->table_prefix . 'oauth_accounts', - ), - ); - } - - public function update_data() - { - return array( - array('module.add', array( - 'ucp', - 'UCP_PROFILE', - array( - 'module_basename' => 'ucp_auth_link', - 'modes' => array('auth_link'), - ), - )), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/310/mod_rewrite.php b/phpBB/phpbb/db/migration/data/310/mod_rewrite.php deleted file mode 100644 index 85ce25abf3..0000000000 --- a/phpBB/phpbb/db/migration/data/310/mod_rewrite.php +++ /dev/null @@ -1,25 +0,0 @@ -db->sql_query($sql); - $module_id = $this->db->sql_fetchfield('module_id'); - $this->db->sql_freeresult($result); - - return $module_id !== false; - } - - static public function depends_on() - { - return array( - 'phpbb_db_migration_data_310_dev', - 'phpbb_db_migration_data_310_softdelete_p2', - ); - } - - public function update_data() - { - return array( - array('module.add', array( - 'mcp', - 'MCP_QUEUE', - array( - 'module_basename' => 'mcp_queue', - 'modes' => array('deleted_topics'), - ), - )), - array('module.add', array( - 'mcp', - 'MCP_QUEUE', - array( - 'module_basename' => 'mcp_queue', - 'modes' => array('deleted_posts'), - ), - )), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php new file mode 100644 index 0000000000..971a7e8504 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php @@ -0,0 +1,73 @@ +db_tools->sql_table_exists($this->table_prefix . 'auth_provider_oauth'); + } + + public function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'oauth_tokens' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), // phpbb_users.user_id + 'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set + 'provider' => array('VCHAR', ''), // Name of the OAuth provider + 'oauth_token' => array('MTEXT', ''), // Serialized token + ), + 'KEYS' => array( + 'user_id' => array('INDEX', 'user_id'), + 'provider' => array('INDEX', 'provider'), + ), + ), + $this->table_prefix . 'oauth_accounts' => array( + 'COLUMNS' => array( + 'user_id' => array('UINT', 0), + 'provider' => array('VCHAR', ''), + 'oauth_provider_id' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => array( + 'user_id', + 'provider', + ), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_tables' => array( + $this->table_prefix . 'oauth_tokens', + $this->table_prefix . 'oauth_accounts', + ), + ); + } + + public function update_data() + { + return array( + array('module.add', array( + 'ucp', + 'UCP_PROFILE', + array( + 'module_basename' => 'ucp_auth_link', + 'modes' => array('auth_link'), + ), + )), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php new file mode 100644 index 0000000000..ffb790b135 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php @@ -0,0 +1,27 @@ +db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + return $module_id !== false; + } + + static public function depends_on() + { + return array( + 'phpbb\db\migration\data\v310\dev', + 'phpbb\db\migration\data\v310\softdelete_p2', + ); + } + + public function update_data() + { + return array( + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_topics'), + ), + )), + array('module.add', array( + 'mcp', + 'MCP_QUEUE', + array( + 'module_basename' => 'mcp_queue', + 'modes' => array('deleted_posts'), + ), + )), + ); + } +} -- cgit v1.2.1 From 1fa673bdedcc46fda69f62b6cb967bd33812f50a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 03:22:13 +0200 Subject: [ticket/11700] Fix authentication acp after develop merge PHPBB3-11700 --- phpBB/phpbb/auth/provider/oauth/oauth.php | 6 +- phpBB/phpbb/auth/provider/oauth/service/base.php | 4 +- .../phpbb/auth/provider/oauth/service/facebook.php | 18 ++--- phpBB/phpbb/auth/provider/oauth/service/google.php | 18 ++--- .../auth/provider/oauth/service/interface.php | 77 --------------------- .../provider/oauth/service/service_interface.php | 79 ++++++++++++++++++++++ 6 files changed, 105 insertions(+), 97 deletions(-) delete mode 100644 phpBB/phpbb/auth/provider/oauth/service/interface.php create mode 100644 phpBB/phpbb/auth/provider/oauth/service/service_interface.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index e92462b344..de81ac0d04 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -30,7 +30,7 @@ class oauth extends \phpbb\auth\provider\base /** * Database driver * - * @var \phpbb\db\driver + * @var \phpbb\db\driver\driver */ protected $db; @@ -107,7 +107,7 @@ class oauth extends \phpbb\auth\provider\base /** * OAuth Authentication Constructor * - * @param \phpbb\db\driver $db + * @param \phpbb\db\driver\driver $db * @param \phpbb\config\config $config * @param \phpbb\request\request_interface $request * @param \phpbb\user $user @@ -118,7 +118,7 @@ class oauth extends \phpbb\auth\provider\base * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(\phpbb\db\driver $db, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; diff --git a/phpBB/phpbb/auth/provider/oauth/service/base.php b/phpBB/phpbb/auth/provider/oauth/service/base.php index 1eb49b4265..61deb48695 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/base.php +++ b/phpBB/phpbb/auth/provider/oauth/service/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package auth */ -abstract class phpbb_auth_provider_oauth_service_base implements phpbb_auth_provider_oauth_service_interface +abstract class base implements \phpbb\auth\provider\oauth\service\service_interface { /** * External OAuth service provider diff --git a/phpBB/phpbb/auth/provider/oauth/service/facebook.php b/phpBB/phpbb/auth/provider/oauth/service/facebook.php index 49206b7654..4a4eeba6d5 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/facebook.php +++ b/phpBB/phpbb/auth/provider/oauth/service/facebook.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,29 +22,29 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oauth_service_base +class facebook extends base { /** * phpBB config * - * @var phpbb_config + * @var phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb_request + * @var phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb_config $config - * @param phpbb_request $request + * @param phpbb\config\config $config + * @param phpbb\request\request_interface $request */ - public function __construct(phpbb_config $config, phpbb_request $request) + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { $this->config = $config; $this->request = $request; @@ -66,7 +68,7 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // This was a callback request, get the token @@ -86,7 +88,7 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // Send a request with it diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php index d4ef6e1d42..2449bbf523 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/google.php +++ b/phpBB/phpbb/auth/provider/oauth/service/google.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,29 +22,29 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth_service_base +class google extends base { /** * phpBB config * - * @var phpbb_config + * @var phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb_request + * @var phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb_config $config - * @param phpbb_request $request + * @param phpbb\config\config $config + * @param phpbb\request\request_interface $request */ - public function __construct(phpbb_config $config, phpbb_request $request) + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { $this->config = $config; $this->request = $request; @@ -77,7 +79,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // This was a callback request, get the token @@ -97,7 +99,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // Send a request with it diff --git a/phpBB/phpbb/auth/provider/oauth/service/interface.php b/phpBB/phpbb/auth/provider/oauth/service/interface.php deleted file mode 100644 index 3bba7c0e2c..0000000000 --- a/phpBB/phpbb/auth/provider/oauth/service/interface.php +++ /dev/null @@ -1,77 +0,0 @@ - string - * 'secret' => string - * ) - */ - public function get_service_credentials(); - - /** - * Returns the results of the authentication in json format - * - * @throws phpbb_auth_provider_oauth_service_exception - * @return string The unique identifier returned by the service provider - * that is used to authenticate the user with phpBB. - */ - public function perform_auth_login(); - - /** - * Returns the results of the authentication in json format - * Use this function when the user already has an access token - * - * @throws phpbb_auth_provider_oauth_service_exception - * @return string The unique identifier returned by the service provider - * that is used to authenticate the user with phpBB. - */ - public function perform_token_auth(); - - /** - * Sets the external library service provider - * - * @param \OAuth\Common\Service\ServiceInterface $service - */ - public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider); -} diff --git a/phpBB/phpbb/auth/provider/oauth/service/service_interface.php b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php new file mode 100644 index 0000000000..ab69fe6ef3 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php @@ -0,0 +1,79 @@ + string + * 'secret' => string + * ) + */ + public function get_service_credentials(); + + /** + * Returns the results of the authentication in json format + * + * @throws \phpbb\auth\provider\oauth\service\exception + * @return string The unique identifier returned by the service provider + * that is used to authenticate the user with phpBB. + */ + public function perform_auth_login(); + + /** + * Returns the results of the authentication in json format + * Use this function when the user already has an access token + * + * @throws \phpbb\auth\provider\oauth\service\exception + * @return string The unique identifier returned by the service provider + * that is used to authenticate the user with phpBB. + */ + public function perform_token_auth(); + + /** + * Sets the external library service provider + * + * @param \OAuth\Common\Service\ServiceInterface $service + */ + public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider); +} -- cgit v1.2.1 From 3860b37741c21576dae2f02e3754aa322c24567f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 03:50:47 +0200 Subject: [ticket/11700] Actually "one" in comments is not a class PHPBB3-11700 --- phpBB/phpbb/auth/auth.php | 2 +- phpBB/phpbb/db/tools.php | 2 +- phpBB/phpbb/session.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index 5c76b64281..05d7d5e97b 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -1007,7 +1007,7 @@ class auth // Successful session creation if ($result === true) { - // If admin re-authentication we remove the old session entry because a new \one has been created... + // If admin re-authentication we remove the old session entry because a new one has been created... if ($admin) { // the login array is used because the user ids do not differ for re-authentication diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index f594fbe63f..8ae58e2d4b 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -1072,7 +1072,7 @@ class tools { $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; } - // Add a new \one or the old primary key + // Add a new one or the old primary key else if ($primary_key !== false) { $new_table_cols[] = $primary_key; diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 6925ebbc6a..2bfa55334d 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -199,7 +199,7 @@ class session * This is where all session activity begins. We gather various pieces of * information from the client and server. We test to see if a session already * exists. If it does, fine and dandy. If it doesn't we'll go on to create a - * new \one ... pretty logical heh? We also examine the system load (if we're + * new one ... pretty logical heh? We also examine the system load (if we're * running on a system which makes such information readily available) and * halt if it's above an admin definable limit. * @@ -494,7 +494,7 @@ class session } } - // If we reach here then no (valid) session exists. So we'll create a new \one + // If we reach here then no (valid) session exists. So we'll create a new one return $this->session_create(); } @@ -801,7 +801,7 @@ class session // Something quite important: session_page always holds the *last* page visited, except for the *first* visit. // We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case. - // If the session id is empty, we have a completely new \one and will set an "identifier" here. This identifier is able to be checked later. + // If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later. if (empty($this->data['session_id'])) { // This is a temporary variable, only set for the very first visit -- cgit v1.2.1 From acea8f5c0a5d0901b25e4055dd6dfc4b8bebe707 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 03:51:25 +0200 Subject: [ticket/11700] The word "them" in a comment is not a class PHPBB3-11700 --- phpBB/phpbb/auth/auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index 05d7d5e97b..b5cc675838 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -94,7 +94,7 @@ class auth } } - // If a bitstring within the list does not match the options, we have a user with incorrect permissions set and need to renew \them + // If a bitstring within the list does not match the options, we have a user with incorrect permissions set and need to renew them if ($renew) { $this->acl_cache($userdata); -- cgit v1.2.1 From d626ebaf1e3d993ba3474c8dd403b18d5faf8863 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 04:45:58 +0200 Subject: [ticket/11700] Fix a few more comments PHPBB3-11700 --- phpBB/phpbb/auth/provider/db.php | 2 +- phpBB/phpbb/datetime.php | 2 +- phpBB/phpbb/db/driver/driver.php | 4 ++-- phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php | 8 ++++---- phpBB/phpbb/db/migration/data/v310/dev.php | 2 +- phpBB/phpbb/db/migration/data/v310/timezone.php | 2 +- phpBB/phpbb/db/migration/exception.php | 6 +++--- phpBB/phpbb/db/migration/tool/config.php | 2 +- phpBB/phpbb/db/migration/tool/module.php | 2 +- phpBB/phpbb/db/migration/tool/permission.php | 2 +- phpBB/phpbb/db/migrator.php | 2 +- phpBB/phpbb/db/tools.php | 2 +- phpBB/phpbb/notification/manager.php | 2 +- phpBB/phpbb/notification/type/quote.php | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index f613bafc6a..a18fc258a4 100644 --- a/phpBB/phpbb/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php @@ -204,7 +204,7 @@ class db extends \phpbb\auth\provider\base { $hash = phpbb_hash($password_new_format); - // Update the password in the users table to the new \format and remove user_pass_convert flag + // Update the password in the users table to the new format and remove user_pass_convert flag $sql = 'UPDATE ' . USERS_TABLE . ' SET user_password = \'' . $this->db->sql_escape($hash) . '\', user_pass_convert = 0 diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index 2d48c8311e..84b13202af 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -30,7 +30,7 @@ class datetime extends \DateTime static protected $format_cache = array(); /** - * Constructs a new \instance of \phpbb\datetime, expanded to include an argument to inject + * Constructs a new instance of \phpbb\datetime, expanded to include an argument to inject * the user context and modify the timezone to the users selected timezone if one is not set. * * @param string $time String in a format accepted by strtotime(). diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index a266b2aa48..cd960bc65a 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -274,7 +274,7 @@ class driver * Correctly adjust LIKE expression for special characters * Some DBMS are handling them in a different way * - * @param string $expression The expression to use. Every wildcard is escaped, \except $this->any_char and $this->one_char + * @param string $expression The expression to use. Every wildcard is escaped, except $this->any_char and $this->one_char * @return string LIKE expression including the keyword! */ function sql_like_expression($expression) @@ -452,7 +452,7 @@ class driver * @param string $field name of the sql column that shall be compared * @param array $array array of values that are allowed (IN) or not allowed (NOT IN) * @param bool $negate true for NOT IN (), false for IN () (default) - * @param bool $allow_empty_set If true, \allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false. + * @param bool $allow_empty_set If true, allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false. */ function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) { diff --git a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php index 712d54a723..87d5e490f8 100644 --- a/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php +++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php @@ -216,7 +216,7 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration $group_id = $this->db->sql_nextid(); } - // Insert new \user role... at the end of the chain + // Insert new user role... at the end of the chain $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . " WHERE role_name = 'ROLE_USER_NEW_MEMBER' @@ -241,7 +241,7 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration $u_role = $this->db->sql_nextid(); // Now add the correct data to the roles... - // The standard role says that new \users are not able to send a PM, Mass PM, are not able to PM groups + // The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')"; $this->sql_query($sql); @@ -250,7 +250,7 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration $this->sql_query($sql); } - // Insert new \forum role + // Insert new forum role $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . " WHERE role_name = 'ROLE_FORUM_NEW_MEMBER' @@ -278,7 +278,7 @@ class release_3_0_6_rc1 extends \phpbb\db\migration\migration $this->sql_query($sql); } - // Set every members user_new \column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) + // Set every members user_new column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) $sql = 'SELECT 1 FROM ' . USERS_TABLE . ' WHERE user_new = 0'; diff --git a/phpBB/phpbb/db/migration/data/v310/dev.php b/phpBB/phpbb/db/migration/data/v310/dev.php index 5a10e7c236..c1db883616 100644 --- a/phpBB/phpbb/db/migration/data/v310/dev.php +++ b/phpBB/phpbb/db/migration/data/v310/dev.php @@ -185,7 +185,7 @@ class dev extends \phpbb\db\migration\migration public function move_customise_modules() { - // Move language management to new \location in the Customise tab + // Move language management to new location in the Customise tab // First get language module id $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " WHERE module_basename = 'acp_language'"; diff --git a/phpBB/phpbb/db/migration/data/v310/timezone.php b/phpBB/phpbb/db/migration/data/v310/timezone.php index 93c58819ce..e3b1912049 100644 --- a/phpBB/phpbb/db/migration/data/v310/timezone.php +++ b/phpBB/phpbb/db/migration/data/v310/timezone.php @@ -65,7 +65,7 @@ class timezone extends \phpbb\db\migration\migration } /** - * Determine the new \timezone for a given phpBB 3.0 timezone and + * Determine the new timezone for a given phpBB 3.0 timezone and * "Daylight Saving Time" option * * @param $timezone float Users timezone in 3.0 diff --git a/phpBB/phpbb/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php index 8bf18dec68..58e29b5218 100644 --- a/phpBB/phpbb/db/migration/exception.php +++ b/phpBB/phpbb/db/migration/exception.php @@ -18,7 +18,7 @@ if (!defined('IN_PHPBB')) } /** -* The migrator is responsible for applying new \migrations in the correct order. +* The migrator is responsible for applying new migrations in the correct order. * * @package db */ @@ -66,8 +66,8 @@ class exception extends \Exception } /** - * Get localised message (\with $user->lang()) - * + * Get localised message (with $user->lang()) + * * @param \phpbb\user $user * @return string */ diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 6ff69bbd2b..f2149dc59a 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -80,7 +80,7 @@ class config implements \phpbb\db\migration\tool\tool_interface * current config value * * @param string $compare If equal to the current config value, will be - * updated to the new \config value, otherwise not + * updated to the new config value, otherwise not * @param string $config_name The name of the config setting you would * like to update * @param mixed $config_value The value of the config setting diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index ecb1176bd4..9869dd4230 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -131,7 +131,7 @@ class module implements \phpbb\db\migration\tool\tool_interface /** * Module Add * - * Add a new \module + * Add a new module * * @param string $class The module class(acp|mcp|ucp) * @param int|string $parent The parent module_id|module_langname (0 for no parent) diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index 51b0996c30..dfb32f79f4 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -238,7 +238,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface } /** - * Add a new \permission role + * Add a new permission role * * @param string $role_name The new \role name * @param sting $role_type The type (u_, m_, a_) diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 0b9463a622..d7d2b3df59 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -18,7 +18,7 @@ if (!defined('IN_PHPBB')) } /** -* The migrator is responsible for applying new \migrations in the correct order. +* The migrator is responsible for applying new migrations in the correct order. * * @package db */ diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index 8ae58e2d4b..d6ea7cc97b 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -1703,7 +1703,7 @@ class tools } /** - * Add new \column + * Add new column */ function sql_column_add($table_name, $column_name, $column_data, $inline = false) { diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index a865f7d6b9..1c95b928cf 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -380,7 +380,7 @@ class manager 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 + // 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 . ' diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index d59f7caf8e..b33766023e 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -168,7 +168,7 @@ class 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 -- cgit v1.2.1 From 390dc86344c23b658085bae4a719399e5eb579f0 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 05:00:18 +0200 Subject: [ticket/11700] And some last comments with backslashes PHPBB3-11700 --- phpBB/phpbb/db/tools.php | 14 +++++++------- phpBB/phpbb/groupposition/teampage.php | 4 ++-- phpBB/phpbb/notification/manager.php | 2 +- phpBB/phpbb/notification/type/base.php | 2 +- phpBB/phpbb/search/base.php | 2 +- phpBB/phpbb/search/fulltext_native.php | 6 +++--- phpBB/phpbb/search/sphinx/config.php | 14 +++++++------- phpBB/phpbb/session.php | 6 +++--- phpBB/phpbb/template/context.php | 4 ++-- phpBB/phpbb/template/twig/node/event.php | 4 ++-- phpBB/phpbb/user.php | 2 +- 11 files changed, 30 insertions(+), 30 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index d6ea7cc97b..1f156fbb04 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -505,7 +505,7 @@ class tools trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); } - // here we add the definition of the new \column to the list of columns + // here we add the definition of the new column to the list of columns switch ($this->sql_layer) { case 'mssql': @@ -992,7 +992,7 @@ class tools $column_list[] = $entities[0]; } - // note down the primary key notation because sqlite only supports adding it to the end for the new \table + // note down the primary key notation because sqlite only supports adding it to the end for the new table $primary_key = false; $_new_cols = array(); @@ -1080,7 +1080,7 @@ class tools $columns = implode(',', $column_list); - // create a new \table and fill it up. destroy the temp one + // create a new table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -1812,7 +1812,7 @@ class tools $new_table_cols = $column_name . ' ' . $column_data['column_type_sql'] . ',' . $new_table_cols; - // create a new \table and fill it up. destroy the temp one + // create a new table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -1927,7 +1927,7 @@ class tools $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); - // create a new \table and fill it up. destroy the temp one + // create a new table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -2119,7 +2119,7 @@ class tools $columns = implode(',', $column_list); - // create a new \table and fill it up. destroy the temp one + // create a new table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; @@ -2485,7 +2485,7 @@ class tools $columns = implode(',', $column_list); - // create a new \table and fill it up. destroy the temp one + // create a new table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; diff --git a/phpBB/phpbb/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php index 4cd2ae7fa8..dc12768ddb 100644 --- a/phpBB/phpbb/groupposition/teampage.php +++ b/phpBB/phpbb/groupposition/teampage.php @@ -433,7 +433,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface $sibling_count = 0; $sibling_limit = $delta; - // Reset the delta, as we recalculate the new \real delta + // Reset the delta, as we recalculate the new real delta $delta = 0; while ($row = $this->db->sql_fetchrow($result)) { @@ -521,7 +521,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface $sibling_count = 0; $sibling_limit = $delta; - // Reset the delta, as we recalculate the new \real delta + // Reset the delta, as we recalculate the new real delta $delta = 0; while ($row = $this->db->sql_fetchrow($result)) { diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 1c95b928cf..c42c84fb1f 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -379,7 +379,7 @@ class 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 + // 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 diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index cc0355771b..3c44468bb8 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -145,7 +145,7 @@ abstract class base implements \phpbb\notification\type\type_interface */ 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(); } diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php index 2f6b225b99..f2f982c31b 100644 --- a/phpBB/phpbb/search/base.php +++ b/phpBB/phpbb/search/base.php @@ -183,7 +183,7 @@ class base $store_ids = array_slice($id_ary, 0, $length); - // create a new \resultset if there is none for this search_key yet + // create a new resultset if there is none for this search_key yet // or add the ids to the existing resultset if (!($store = $cache->get('_search_results_' . $search_key))) { diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 006b88e07a..50cf588a46 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -1271,7 +1271,7 @@ class fulltext_native extends \phpbb\search\base // We now have unique arrays of all words to be added and removed and // individual arrays of added and removed words for text and title. What - // we need to do now is add the new \words (if they don't already exist) + // we need to do now is add the new words (if they don't already exist) // and then add (or remove) matches between the words and this post if (sizeof($unique_add_words)) { @@ -1308,7 +1308,7 @@ class fulltext_native extends \phpbb\search\base $this->db->sql_transaction('begin'); } - // now update the search match table, remove links to removed words and add links to new \words + // now update the search match table, remove links to removed words and add links to new words foreach ($words['del'] as $word_in => $word_ary) { $title_match = ($word_in == 'title') ? 1 : 0; @@ -1468,7 +1468,7 @@ class fulltext_native extends \phpbb\search\base WHERE ' . $this->db->sql_in_set('word_id', $sql_in); $this->db->sql_query($sql); - // by setting search_last_gc to the new \time here we make sure that if a user reloads because the + // by setting search_last_gc to the new time here we make sure that if a user reloads because the // following query takes too long, he won't run into it again set_config('search_last_gc', time(), true); diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index 2468022428..8462298e01 100644 --- a/phpBB/phpbb/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php @@ -65,7 +65,7 @@ class config /** * Appends a new \empty section to the end of the config * - * @param string $name The name for the new \section + * @param string $name The name for the new section * @return \phpbb\search\sphinx\config_section The newly created section object * * @access public @@ -143,7 +143,7 @@ class config $section_name .= $line[$j]; } - // And then we create the new \section object + // And then we create the new section object $section_name = trim($section_name); $section = new \phpbb\search\sphinx\config_section($section_name, $section_name_comment); } @@ -163,7 +163,7 @@ class config $section->add_variable(new \phpbb\search\sphinx\config_comment($config_file[$i])); continue; } - + // As long as we haven't yet actually found an opening bracket for this section // we treat everything as comments so it's not deleted either if (!$found_opening_bracket) @@ -182,7 +182,7 @@ class config } } - // If we did not find a comment in this line or still add to the previous + // If we did not find a comment in this line or still add to the previous // line's value ... if ($line || $in_value) { @@ -241,8 +241,8 @@ class config } } - // If a name and an equal sign were found then we have append a - // new \variable object to the section + // If a name and an equal sign were found then we have append a + // new variable object to the section if ($name && $found_assignment) { $section->add_variable(new \phpbb\search\sphinx\config_variable(trim($name), trim($value), ($end_section) ? '' : $comment)); @@ -250,7 +250,7 @@ class config } /* If we found a closing curly bracket this section has been completed - and we can append it to the section list and continue with looking for + and we can append it to the section list and continue with looking for the next section */ if ($end_section) { diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 2bfa55334d..543369a3ab 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -499,13 +499,13 @@ class session } /** - * Create a new \session + * Create a new session * * If upon trying to start a session we discover there is nothing existing we * jump here. Additionally this method is called directly during login to regenerate * the session for the specific user. In this method we carry out a number of tasks; * garbage collection, (search)bot checking, banned user comparison. Basically - * though this method will result in a new \session for a specific user. + * though this method will result in a new session for a specific user. */ function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) { @@ -775,7 +775,7 @@ class session if (!defined('IN_ERROR_HANDLER') && (!$this->session_id || !$db->sql_query($sql) || !$db->sql_affectedrows())) { - // Limit new \sessions in 1 minute period (if required) + // Limit new sessions in 1 minute period (if required) if (empty($this->data['session_time']) && $config['active_sessions']) { // $db->sql_return_on_error(false); diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 263f77a1b8..f978f82d33 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -160,7 +160,7 @@ class context } // Now we add the block that we're actually assigning to. - // We're adding a new \iteration to this block with the given + // We're adding a new iteration to this block with the given // variable assignments. $str[$blocks[$blockcount]][] = $vararray; @@ -192,7 +192,7 @@ class context unset($this->tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']); } - // Add a new \iteration to this block with the variable assignments we were given. + // Add a new iteration to this block with the variable assignments we were given. $this->tpldata[$blockname][] = $vararray; // Set S_NUM_ROWS diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index 1fc85ab4a2..202db775ee 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -20,7 +20,7 @@ if (!defined('IN_PHPBB')) class event extends \Twig_Node { - /** + /** * The subdirectory in which all template listener files must be placed * @var string */ @@ -56,7 +56,7 @@ class event extends \Twig_Node // If debug mode is enabled, lets check for new/removed EVENT // templates on page load rather than at compile. This is // slower, but makes developing extensions easier (no need to - // purge the cache when a new \event template file is added) + // purge the cache when a new event template file is added) $compiler ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n") ->indent() diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index a5b3308288..f97cc94d40 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -43,7 +43,7 @@ class user extends \phpbb\session var $img_lang; var $img_array = array(); - // Able to add new \options (up to id 31) + // Able to add new options (up to id 31) var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17); /** -- cgit v1.2.1 From d905358e2be11cc3fe040036b1138e54be7f30dc Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 05:20:27 +0200 Subject: [ticket/11700] Fix leftover backslashes in comments PHPBB3-11700 --- phpBB/phpbb/auth/provider/provider_interface.php | 2 +- phpBB/phpbb/config/db.php | 2 +- phpBB/phpbb/db/migration/data/v310/timezone.php | 2 +- phpBB/phpbb/db/migration/tool/permission.php | 4 ++-- phpBB/phpbb/extension/finder.php | 2 +- phpBB/phpbb/hook/finder.php | 2 +- phpBB/phpbb/request/deactivated_super_global.php | 2 +- phpBB/phpbb/search/fulltext_mysql.php | 6 +++--- phpBB/phpbb/search/fulltext_postgres.php | 2 +- phpBB/phpbb/search/sphinx/config.php | 2 +- phpBB/phpbb/search/sphinx/config_section.php | 6 +++--- phpBB/phpbb/search/sphinx/config_variable.php | 2 +- phpBB/phpbb/tree/tree_interface.php | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php index 46245d34ca..31368a0286 100644 --- a/phpBB/phpbb/auth/provider/provider_interface.php +++ b/phpBB/phpbb/auth/provider/provider_interface.php @@ -77,7 +77,7 @@ interface provider_interface * options with whatever configuraton values are passed to it as an array. * It then returns the name of the acp file related to this authentication * provider. - * @param array $new_config Contains the new \configuration values that + * @param array $new_config Contains the new configuration values that * have been set in acp_board. * @return array|null Returns null if not implemented or an array with * the template file name and an array of the vars diff --git a/phpBB/phpbb/config/db.php b/phpBB/phpbb/config/db.php index 7174327ef3..0a490af14f 100644 --- a/phpBB/phpbb/config/db.php +++ b/phpBB/phpbb/config/db.php @@ -178,7 +178,7 @@ class db extends \phpbb\config\config /** * Increments an integer config value directly in the database. * - * Using this method instead of setting the new \value directly avoids race + * Using this method instead of setting the new value directly avoids race * conditions and unlike set_atomic it cannot fail. * * @param string $key The configuration option's name diff --git a/phpBB/phpbb/db/migration/data/v310/timezone.php b/phpBB/phpbb/db/migration/data/v310/timezone.php index e3b1912049..dd0c6a2093 100644 --- a/phpBB/phpbb/db/migration/data/v310/timezone.php +++ b/phpBB/phpbb/db/migration/data/v310/timezone.php @@ -70,7 +70,7 @@ class timezone extends \phpbb\db\migration\migration * * @param $timezone float Users timezone in 3.0 * @param $dst int Users daylight saving time - * @return string Users new \php Timezone which is used since 3.1 + * @return string Users new php Timezone which is used since 3.1 */ public function convert_phpbb30_timezone($timezone, $dst) { diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index dfb32f79f4..fd2de9c8fb 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -240,7 +240,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface /** * Add a new permission role * - * @param string $role_name The new \role name + * @param string $role_name The new role name * @param sting $role_type The type (u_, m_, a_) * @return null */ @@ -279,7 +279,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface * Update the name on a permission role * * @param string $old_role_name The old role name - * @param string $new_role_name The new \role name + * @param string $new_role_name The new role name * @return null */ public function role_update($old_role_name, $new_role_name) diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index bf84728f05..338f1cdeb9 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -52,7 +52,7 @@ class finder protected $cached_queries; /** - * Creates a new \finder instance with its dependencies + * Creates a new finder instance with its dependencies * * @param \phpbb\extension\manager $extension_manager An extension manager * instance that provides the finder with a list of active diff --git a/phpBB/phpbb/hook/finder.php b/phpBB/phpbb/hook/finder.php index 7783efd0c7..d5eb1f8186 100644 --- a/phpBB/phpbb/hook/finder.php +++ b/phpBB/phpbb/hook/finder.php @@ -29,7 +29,7 @@ class finder protected $php_ext; /** - * Creates a new \finder instance. + * Creates a new finder instance. * * @param string $phpbb_root_path Path to the phpbb root directory * @param string $php_ext php file extension diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php index 4d4417229e..8f39960477 100644 --- a/phpBB/phpbb/request/deactivated_super_global.php +++ b/phpBB/phpbb/request/deactivated_super_global.php @@ -18,7 +18,7 @@ if (!defined('IN_PHPBB')) } /** -* Replacement for a superglobal (\like $_GET or $_POST) which calls +* Replacement for a superglobal (like $_GET or $_POST) which calls * trigger_error on all operations but isset, overloads the [] operator with SPL. * * @package \phpbb\request\request diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index a4812c139a..2508ab6d9a 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -41,13 +41,13 @@ class fulltext_mysql extends \phpbb\search\base * @var \phpbb\config\config */ protected $config; - + /** * Database connection * @var \phpbb\db\driver\driver */ protected $db; - + /** * User object * @var \phpbb\user @@ -703,7 +703,7 @@ class fulltext_mysql extends \phpbb\search\base } /** - * Destroys cached search results, that contained one of the new \words in a post so the results won't be outdated + * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated * * @param string $mode contains the post mode: edit, post, reply, quote ... * @param int $post_id contains the post id of the post to index diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index ba9215fcfd..383645920a 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -733,7 +733,7 @@ class fulltext_postgres extends \phpbb\search\base } /** - * Destroys cached search results, that contained one of the new \words in a post so the results won't be outdated + * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated * * @param string $mode contains the post mode: edit, post, reply, quote ... * @param int $post_id contains the post id of the post to index diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index 8462298e01..262d6008cc 100644 --- a/phpBB/phpbb/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php @@ -63,7 +63,7 @@ class config } /** - * Appends a new \empty section to the end of the config + * Appends a new empty section to the end of the config * * @param string $name The name for the new section * @return \phpbb\search\sphinx\config_section The newly created section object diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 3a5631ca21..7e6939576b 100644 --- a/phpBB/phpbb/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php @@ -122,10 +122,10 @@ class config_section } /** - * Create a new \variable object and append it to the variable list of this section + * Create a new variable object and append it to the variable list of this section * - * @param string $name The name for the new \variable - * @param string $value The value for the new \variable + * @param string $name The name for the new variable + * @param string $value The value for the new variable * @return \phpbb\search\sphinx\config_variable Variable object that was created * * @access public diff --git a/phpBB/phpbb/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php index afe4190068..c8f40bfb5f 100644 --- a/phpBB/phpbb/search/sphinx/config_variable.php +++ b/phpBB/phpbb/search/sphinx/config_variable.php @@ -28,7 +28,7 @@ class config_variable private $comment; /** - * Constructs a new \variable object + * Constructs a new variable object * * @param string $name Name of the variable * @param string $value Value of the variable diff --git a/phpBB/phpbb/tree/tree_interface.php b/phpBB/phpbb/tree/tree_interface.php index b0a1e08ec6..162c1e5e29 100644 --- a/phpBB/phpbb/tree/tree_interface.php +++ b/phpBB/phpbb/tree/tree_interface.php @@ -69,7 +69,7 @@ interface tree_interface /** * Moves all children of one item to another item * - * If the new parent already has children, the new \children are appended + * If the new parent already has children, the new children are appended * to the list. * * @param int $current_parent_id The current parent item -- cgit v1.2.1 From fcd36ddd1f7c8a8b224423dca7599addbdaf1f57 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 05:36:21 +0200 Subject: [ticket/11700] Correctly generate lang key from avatar driver class PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 717ba00ed7..5d7f8f1b8f 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -264,7 +264,7 @@ class manager $config_name = $this->get_driver_config_name($driver); return array( - 'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper($config_name), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper(str_replace('\\', '_', $config_name)), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), ); } -- cgit v1.2.1 From 6e6681fa59a55393c52350d0086806662ba820fd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 05:58:40 +0200 Subject: [ticket/11700] Load avatar explanations correctly from namespaces PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 5d7f8f1b8f..894ed080e6 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -277,7 +277,7 @@ class manager */ public function get_driver_config_name($driver) { - return preg_replace('#^phpbb_avatar_driver_#', '', get_class($driver)); + return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver)); } /** -- cgit v1.2.1 From 570b83b046d47c7de3c4f85a1e4f6bee7b4593f7 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 06:30:50 +0200 Subject: [ticket/11700] namespacify phpbb_permissions class PHPBB3-11700 --- phpBB/phpbb/permissions.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index 0fbacdad8a..d0405471bc 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * DO NOT CHANGE */ @@ -15,28 +17,28 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_permissions +class permissions { /** * Event dispatcher object - * @var phpbb_event_dispatcher + * @var \phpbb\event\dispatcher */ protected $dispatcher; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; /** * Constructor * - * @param phpbb_event_dispatcher $phpbb_dispatcher Event dispatcher - * @param phpbb_user $user User Object + * @param \phpbb\event\dispatcher $phpbb_dispatcher Event dispatcher + * @param \phpbb\user $user User Object * @return null */ - public function __construct(phpbb_event_dispatcher $phpbb_dispatcher, phpbb_user $user) + public function __construct(\phpbb\event\dispatcher $phpbb_dispatcher, \phpbb\user $user) { $this->dispatcher = $phpbb_dispatcher; $this->user = $user; @@ -241,14 +243,14 @@ class phpbb_permissions // Forum Permissions 'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'), - 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), + 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'), 'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'), 'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'), - 'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'), - 'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'), + 'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'), + 'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'), 'f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'), 'f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'), - 'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'), + 'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'), 'f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'), 'f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'), @@ -259,11 +261,11 @@ class phpbb_permissions 'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'), 'f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'), 'f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'), - 'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'), + 'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'), - 'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'), + 'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'), 'f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'), - 'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'), + 'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'), 'f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'), 'f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'), 'f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'), -- cgit v1.2.1 From 77ffd5c6ba02e5dabebc34c479aa964e05f4038d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 06:44:16 +0200 Subject: [ticket/11700] Use underscores in avatar driver template file names PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 894ed080e6..0408467064 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -235,7 +235,7 @@ class manager */ static public function prepare_driver_name($name) { - return str_replace('.', '_', $name); + return str_replace(array('\\', '.'), '_', $name); } /** -- cgit v1.2.1 From d12f35885539c8bd7d2d795d9fc5638d022698bb Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 17:33:56 +0200 Subject: [ticket/11700] Correctly convert old acm type to namespaced class name PHPBB3-11700 --- phpBB/phpbb/di/extension/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index 62757c5b7d..85b374a3ca 100644 --- a/phpBB/phpbb/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php @@ -78,7 +78,7 @@ class config extends Extension { if (preg_match('#^[a-z]+$#', $acm_type)) { - return 'phpbb_cache_driver_'.$acm_type; + return '\\phpbb\cache\driver\\'.$acm_type; } return $acm_type; -- cgit v1.2.1 From c4b53490ad93566914cbc280910c67b75346a665 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 17 Sep 2013 16:15:44 +0200 Subject: [ticket/11700] Correctly load extensions with nonprefixed namespaces PHPBB3-11700 --- phpBB/phpbb/extension/finder.php | 13 +++++++------ phpBB/phpbb/extension/manager.php | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index 338f1cdeb9..d3e73bc387 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -277,15 +277,16 @@ class finder $classes = array(); foreach ($files as $file => $ext_name) { - if (preg_match('#^includes/#', $file)) + $class = substr($file, 0, -strlen('.' . $this->php_ext)); + if ($ext_name === '/' && preg_match('#^includes/#', $file)) { - $file = preg_replace('#^includes/#', '', $file); - $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext))); + $class = preg_replace('#^includes/#', '', $class); + $classes[] = 'phpbb_' . str_replace('/', '_', $class); } else - { - $file = preg_replace('#^phpbb/#', '', $file); - $classes[] = 'phpbb\\' . str_replace('/', '\\', substr($file, 0, -strlen('.' . $this->php_ext))); + { + $class = preg_replace('#^ext/#', '', $class); + $classes[] = str_replace('/', '\\', $class); } } return $classes; diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index d174146f52..ce6d7e05c8 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -133,7 +133,7 @@ class manager */ public function get_extension($name) { - $extension_class_name = 'phpbb_ext_' . str_replace('/', '_', $name) . '_ext'; + $extension_class_name = str_replace('/', '\\', $name) . '\\ext'; $migrator = $this->container->get('migrator'); -- cgit v1.2.1 From 9d8ac2b0ceb24dd14df61d083505941afb1b52c4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 17 Sep 2013 17:12:41 +0200 Subject: [ticket/11700] Fix unit tests after develop merge PHPBB3-11700 --- phpBB/phpbb/filesystem.php | 6 +++--- phpBB/phpbb/symfony_request.php | 20 +++++++++++--------- phpBB/phpbb/template/asset.php | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index ae656ad6e6..662b6b866e 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -23,7 +23,7 @@ if (!defined('IN_PHPBB')) */ class filesystem { - /** @var phpbb_symfony_request */ + /** @var \phpbb\symfony_request */ protected $symfony_request; /** @var string */ @@ -41,11 +41,11 @@ class filesystem /** * Constructor * - * @param phpbb_symfony_request $symfony_request + * @param \phpbb\symfony_request $symfony_request * @param string $phpbb_root_path Relative path to phpBB root * @param string $php_ext PHP extension (php) */ - public function __construct(phpbb_symfony_request $symfony_request, $phpbb_root_path, $php_ext, $adm_relative_path = null) + public function __construct(\phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext, $adm_relative_path = null) { $this->symfony_request = $symfony_request; $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/phpbb/symfony_request.php b/phpBB/phpbb/symfony_request.php index 29ab8c000e..92784c213b 100644 --- a/phpBB/phpbb/symfony_request.php +++ b/phpBB/phpbb/symfony_request.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + use Symfony\Component\HttpFoundation\Request; /** @@ -17,26 +19,26 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_symfony_request extends Request +class symfony_request extends Request { /** * Constructor * - * @param phpbb_request_interface $phpbb_request + * @param phpbb\request\request_interface $phpbb_request */ - public function __construct(phpbb_request_interface $phpbb_request) + public function __construct(\phpbb\request\request_interface $phpbb_request) { // This function is meant to sanitize the global input arrays $sanitizer = function(&$value, $key) { - $type_cast_helper = new phpbb_request_type_cast_helper(); + $type_cast_helper = new \phpbb\request\type_cast_helper(); $type_cast_helper->set_var($value, $value, gettype($value), true); }; - $get_parameters = $phpbb_request->get_super_global(phpbb_request_interface::GET); - $post_parameters = $phpbb_request->get_super_global(phpbb_request_interface::POST); - $server_parameters = $phpbb_request->get_super_global(phpbb_request_interface::SERVER); - $files_parameters = $phpbb_request->get_super_global(phpbb_request_interface::FILES); - $cookie_parameters = $phpbb_request->get_super_global(phpbb_request_interface::COOKIE); + $get_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::GET); + $post_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::POST); + $server_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::SERVER); + $files_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::FILES); + $cookie_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::COOKIE); array_walk_recursive($get_parameters, $sanitizer); array_walk_recursive($post_parameters, $sanitizer); diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index fa0661ec82..0e0b6b4782 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -21,7 +21,7 @@ class asset { protected $components = array(); - /** @var phpbb_filesystem **/ + /** @var \phpbb\filesystem **/ protected $phpbb_filesystem; /** @@ -29,7 +29,7 @@ class asset * * @param string $url URL */ - public function __construct($url, phpbb_filesystem $phpbb_filesystem) + public function __construct($url, \phpbb\filesystem $phpbb_filesystem) { $this->phpbb_filesystem = $phpbb_filesystem; -- cgit v1.2.1 From 1d7f8f81935157867539d4c3991c5922afec8b55 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 17 Sep 2013 18:10:58 +0200 Subject: [ticket/11700] Get functional tests running after develop merge PHPBB3-11700 --- phpBB/phpbb/auth/provider/provider_interface.php | 2 +- phpBB/phpbb/session.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php index 31368a0286..1bb209c821 100644 --- a/phpBB/phpbb/auth/provider/provider_interface.php +++ b/phpBB/phpbb/auth/provider/provider_interface.php @@ -134,7 +134,7 @@ interface provider_interface * * @param array $data An array corresponding to * \phpbb\session::data - * @param boolean $new_session True for a new \session, false for no new + * @param boolean $new_session True for a new session, false for no new * session. */ public function logout($data, $new_session); diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 543369a3ab..2baf61043d 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -403,7 +403,7 @@ class session $session_expired = false; // Check whether the session is still valid if we have one - $method = basename(trim($config['auth_method'])); + $method = basename(trim($config['auth_method'])); $provider = $phpbb_container->get('auth.provider.' . $method); -- cgit v1.2.1 From 1adcbccc09dfb890a39939202b4e520a2458407a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 17 Sep 2013 18:56:47 +0200 Subject: [ticket/11700] Replace some leftover phpbb_filesystem uses PHPBB3-11700 --- phpBB/phpbb/template/twig/environment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index 132dae4762..e0ee23dcd9 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -25,7 +25,7 @@ class environment extends \Twig_Environment /** @var \phpbb\config\config */ protected $phpbb_config; - /** @var phpbb_filesystem */ + /** @var \phpbb\filesystem */ protected $phpbb_filesystem; /** @var string */ @@ -104,7 +104,7 @@ class environment extends \Twig_Environment /** * Get the phpbb_filesystem object * - * @return phpbb_filesystem + * @return \phpbb\filesystem */ public function get_filesystem() { -- cgit v1.2.1 From 06e7c842357fd26104efba6b7a0465d7c05c4493 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 15:27:03 +0200 Subject: [ticket/11700] Fix some more incorrectly changed comments PHPBB3-11700 --- phpBB/phpbb/auth/provider/apache.php | 4 ++-- phpBB/phpbb/auth/provider/db.php | 2 +- phpBB/phpbb/groupposition/teampage.php | 2 +- phpBB/phpbb/notification/type/bookmark.php | 2 +- phpBB/phpbb/notification/type/post.php | 2 +- phpBB/phpbb/notification/type/quote.php | 2 +- phpBB/phpbb/notification/type/topic.php | 2 +- phpBB/phpbb/search/fulltext_mysql.php | 2 +- phpBB/phpbb/search/fulltext_native.php | 2 +- phpBB/phpbb/search/fulltext_postgres.php | 2 +- phpBB/phpbb/search/fulltext_sphinx.php | 2 +- phpBB/phpbb/search/sphinx/config_comment.php | 2 +- phpBB/phpbb/search/sphinx/config_section.php | 2 +- phpBB/phpbb/template/context.php | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php index cd1330e7b0..5cbb63c4fc 100644 --- a/phpBB/phpbb/auth/provider/apache.php +++ b/phpBB/phpbb/auth/provider/apache.php @@ -204,8 +204,8 @@ class apache extends \phpbb\auth\provider\base * This function generates an array which can be passed to the user_add * function in order to create a user * - * @param string $username The username of the new \user. - * @param string $password The password of the new \user. + * @param string $username The username of the new user. + * @param string $password The password of the new user. * @return array Contains data that can be passed directly to * the user_add function. */ diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index a18fc258a4..4654e49fb5 100644 --- a/phpBB/phpbb/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php @@ -241,7 +241,7 @@ class db extends \phpbb\auth\provider\base { $hash = phpbb_hash($password); - // Update the password in the users table to the new \format + // Update the password in the users table to the new format $sql = 'UPDATE ' . USERS_TABLE . " SET user_password = '" . $this->db->sql_escape($hash) . "', user_pass_convert = 0 diff --git a/phpBB/phpbb/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php index dc12768ddb..4e8228eb58 100644 --- a/phpBB/phpbb/groupposition/teampage.php +++ b/phpBB/phpbb/groupposition/teampage.php @@ -263,7 +263,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface } /** - * Adds a new \category + * Adds a new category * * @param string $category_name Name of the category to be added * @return bool True if the category was added successfully diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index 5b021eb71a..50ea7380af 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -114,7 +114,7 @@ class 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); diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 24ce0cc145..fe50e7f172 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -149,7 +149,7 @@ class 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); diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index b33766023e..56cfbc9364 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -133,7 +133,7 @@ class 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); diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 9042a21017..8db02f610b 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) /** * Topic notifications class -* This class handles notifications for new \topics +* This class handles notifications for new topics * * @package notifications */ diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 2508ab6d9a..50d2d2577f 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -714,7 +714,7 @@ class fulltext_mysql extends \phpbb\search\base */ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) { - // Split old and new \post/subject to obtain array of words + // Split old and new post/subject to obtain array of words $split_text = $this->split_message($message); $split_title = ($subject) ? $this->split_message($subject) : array(); diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 50cf588a46..33326f2882 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -1224,7 +1224,7 @@ class fulltext_native extends \phpbb\search\base return; } - // Split old and new \post/subject to obtain array of 'words' + // Split old and new post/subject to obtain array of 'words' $split_text = $this->split_message($message); $split_title = $this->split_message($subject); diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 383645920a..756034103e 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -744,7 +744,7 @@ class fulltext_postgres extends \phpbb\search\base */ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) { - // Split old and new \post/subject to obtain array of words + // Split old and new post/subject to obtain array of words $split_text = $this->split_message($message); $split_title = ($subject) ? $this->split_message($subject) : array(); diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 81cb31e6e2..cb76d58f49 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -422,7 +422,7 @@ class fulltext_sphinx $this->sphinx->SetMatchMode(SPH_MATCH_ANY); } - // Keep quotes and new \lines + // Keep quotes and new lines $keywords = str_replace(array('"', "\n"), array('"', ' '), trim($keywords)); if (strlen($keywords) > 0) diff --git a/phpBB/phpbb/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php index 66000e4031..77a943377d 100644 --- a/phpBB/phpbb/search/sphinx/config_comment.php +++ b/phpBB/phpbb/search/sphinx/config_comment.php @@ -26,7 +26,7 @@ class config_comment private $exact_string; /** - * Create a new \comment + * Create a new comment * * @param string $exact_string The content of the comment including newlines, leading whitespace, etc. * diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 7e6939576b..730abf011e 100644 --- a/phpBB/phpbb/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php @@ -29,7 +29,7 @@ class config_section private $variables = array(); /** - * Construct a new \section + * Construct a new section * * @param string $name Name of the section * @param string $comment Comment that should be appended after the name in the diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index f978f82d33..24234c1e4a 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -225,7 +225,7 @@ class context * @param string $mode Mode to execute (valid modes are 'insert' and 'change') * * If insert, the vararray is inserted at the given position (position counting from zero). - * If change, the current block gets merged with the vararray (resulting in new \key/value pairs be added and existing keys be replaced by the new \value). + * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new \value). * * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) -- cgit v1.2.1 From 15413f43e48b317fda276d0f9bb42d122caacf3c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 15:45:35 +0200 Subject: [ticket/11700] Correctly handle avatar drivers with namespaces PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 0408467064..11f401d9ed 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -222,7 +222,7 @@ class manager */ static public function clean_driver_name($name) { - return str_replace('_', '.', $name); + return str_replace(array('\\', '_'), '.', $name); } /** @@ -235,7 +235,7 @@ class manager */ static public function prepare_driver_name($name) { - return str_replace(array('\\', '.'), '_', $name); + return str_replace('.', '_', $name); } /** @@ -277,7 +277,7 @@ class manager */ public function get_driver_config_name($driver) { - return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver)); + return preg_replace('#^phpbb\\avatar\\driver\\\\#', '', get_class($driver)); } /** -- cgit v1.2.1 From 40ea7422b12b618cf7eecc01868b462eaed462a9 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 16:21:38 +0200 Subject: [ticket/11700] Correctly load avatar templates for namespaced drivers PHPBB3-11700 --- phpBB/phpbb/avatar/driver/driver.php | 2 +- phpBB/phpbb/avatar/manager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index d688e7d70c..0c54951cbd 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -114,7 +114,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface */ public function get_template_name() { - $driver = preg_replace('#^phpbb_avatar_driver_#', '', get_class($this)); + $driver = preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this)); $template = "ucp_avatar_options_$driver.html"; return $template; diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 11f401d9ed..c28380a401 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -277,7 +277,7 @@ class manager */ public function get_driver_config_name($driver) { - return preg_replace('#^phpbb\\avatar\\driver\\\\#', '', get_class($driver)); + return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver)); } /** -- cgit v1.2.1 From f205c4fad4c3a82cc4a47beb7f9a8025669a3acb Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 17:03:05 +0200 Subject: [ticket/11700] Change search backend db entry to namespaces PHPBB3-11700 --- phpBB/phpbb/db/migration/data/v310/namespaces.php | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/namespaces.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php new file mode 100644 index 0000000000..6da015d0da --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php @@ -0,0 +1,30 @@ +config['search_type'])), + array('config.update', array('search_type', str_replace('phpbb_search_', 'phpbb\\search\\', $this->config['search_type']))), + )), + ); + } +} -- cgit v1.2.1 From fe36375a36ec4f816eb07b41630b6c9fa7ff12c8 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 18:29:08 +0200 Subject: [ticket/11700] Fix extension loading with namespaces class loader now expects all classes to be prefixed with a backslash when resolving paths PHPBB3-11700 --- phpBB/phpbb/class_loader.php | 11 +++++++++-- phpBB/phpbb/controller/helper.php | 2 +- phpBB/phpbb/controller/resolver.php | 8 ++++---- phpBB/phpbb/event/kernel_exception_subscriber.php | 4 ++-- phpBB/phpbb/event/kernel_request_subscriber.php | 6 +++--- phpBB/phpbb/event/kernel_terminate_subscriber.php | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php index bcd05e5853..769f28b4f1 100644 --- a/phpBB/phpbb/class_loader.php +++ b/phpBB/phpbb/class_loader.php @@ -55,7 +55,12 @@ class class_loader * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface. */ public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null) - { + { + if ($namespace[0] !== '\\') + { + $namespace = '\\' . $namespace; + } + $this->namespace = $namespace; $this->path = $path; $this->php_ext = $php_ext; @@ -105,7 +110,8 @@ class class_loader * Resolves a phpBB class name to a relative path which can be included. * * @param string $class The class name to resolve, must be in the - * namespace the loader was constructed with + * namespace the loader was constructed with. + * Has to begin with \ * @return string|bool A relative path to the file containing the * class or false if looking it up failed. */ @@ -144,6 +150,7 @@ class class_loader */ public function load_class($class) { + $class = '\\' . $class; if (substr($class, 0, strlen($this->namespace)) === $this->namespace) { $path = $this->resolve_path($class); diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 6e45374643..07483a91eb 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -91,7 +91,7 @@ class helper page_footer(true, false, false); - return new \Response($this->template->assign_display('body'), $status_code); + return new Response($this->template->assign_display('body'), $status_code); } /** diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index dad2ebd06b..1cc8981105 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -95,12 +95,12 @@ class resolver implements ControllerResolverInterface * the style paths for the extension (the ext author can change them * if necessary). */ - $controller_dir = explode('_', get_class($controller_object)); + $controller_dir = explode('\\', get_class($controller_object)); - // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (!is_null($this->template) && isset($controller_dir[3]) && $controller_dir[1] === 'ext') + // 0 vendor, 1 extension name, ... + if (!is_null($this->template) && isset($controller_dir[1])) { - $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles'; + $controller_style_dir = 'ext/' . $controller_dir[0] . '/' . $controller_dir[1] . '/styles'; if (is_dir($controller_style_dir)) { diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php index 7199f47ae8..09103680e8 100644 --- a/phpBB/phpbb/event/kernel_exception_subscriber.php +++ b/phpBB/phpbb/event/kernel_exception_subscriber.php @@ -55,7 +55,7 @@ class kernel_exception_subscriber implements EventSubscriberInterface * @param GetResponseForExceptionEvent $event * @return null */ - public function on_kernel_exception(\GetResponseForExceptionEvent $event) + public function on_kernel_exception(GetResponseForExceptionEvent $event) { page_header($this->user->lang('INFORMATION')); @@ -74,7 +74,7 @@ class kernel_exception_subscriber implements EventSubscriberInterface $status_code = $exception instanceof HttpException ? $exception->getStatusCode() : 500; - $response = new \Response($this->template->assign_display('body'), $status_code); + $response = new Response($this->template->assign_display('body'), $status_code); $event->setResponse($response); } diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php index 9691be7ca5..a629dd8440 100644 --- a/phpBB/phpbb/event/kernel_request_subscriber.php +++ b/phpBB/phpbb/event/kernel_request_subscriber.php @@ -65,14 +65,14 @@ class kernel_request_subscriber implements EventSubscriberInterface * @param GetResponseEvent $event * @return null */ - public function on_kernel_request(\GetResponseEvent $event) + public function on_kernel_request(GetResponseEvent $event) { $request = $event->getRequest(); - $context = new \RequestContext(); + $context = new RequestContext(); $context->fromRequest($request); $matcher = phpbb_get_url_matcher($this->finder, $context, $this->root_path, $this->php_ext); - $router_listener = new \RouterListener($matcher, $context); + $router_listener = new RouterListener($matcher, $context); $router_listener->onKernelRequest($event); } diff --git a/phpBB/phpbb/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php index aea9d7cc44..de441da102 100644 --- a/phpBB/phpbb/event/kernel_terminate_subscriber.php +++ b/phpBB/phpbb/event/kernel_terminate_subscriber.php @@ -31,7 +31,7 @@ class kernel_terminate_subscriber implements EventSubscriberInterface * @param PostResponseEvent $event * @return null */ - public function on_kernel_terminate(\PostResponseEvent $event) + public function on_kernel_terminate(PostResponseEvent $event) { exit_handler(); } -- cgit v1.2.1 From ed55626165ad402507864ab21bb2ee64a0d70cbd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 25 Sep 2013 10:01:44 +0200 Subject: [ticket/11700] Fix unresolvable condition in migration PHPBB3-11700 --- phpBB/phpbb/db/migration/data/v310/style_update_p2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php index 6c3b0de2a1..202a8409fb 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p2.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php @@ -18,7 +18,7 @@ class style_update_p2 extends \phpbb\db\migration\migration static public function depends_on() { - return array('\phpbb\db\migration\data0\style_update_p1'); + return array('\phpbb\db\migration\data\v310\style_update_p1'); } public function update_schema() -- cgit v1.2.1 From 86147b46a4bd2aca54300ff4a14b8d524dcb5534 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 25 Sep 2013 13:15:34 +0200 Subject: [ticket/11700] Return class names with leading backslash in finder PHPBB3-11700 --- phpBB/phpbb/extension/finder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index d3e73bc387..ffcb2c830e 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -286,7 +286,7 @@ class finder else { $class = preg_replace('#^ext/#', '', $class); - $classes[] = str_replace('/', '\\', $class); + $classes[] = '\\' . str_replace('/', '\\', $class); } } return $classes; -- cgit v1.2.1 From 3a478cb3e211d8663e6071377ce7d8397619be2f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 25 Sep 2013 14:36:50 +0200 Subject: [ticket/11700] Use spaces, not tabs PHPBB3-11700 --- phpBB/phpbb/extension/finder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index ffcb2c830e..e787919588 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -284,8 +284,8 @@ class finder $classes[] = 'phpbb_' . str_replace('/', '_', $class); } else - { - $class = preg_replace('#^ext/#', '', $class); + { + $class = preg_replace('#^ext/#', '', $class); $classes[] = '\\' . str_replace('/', '\\', $class); } } -- cgit v1.2.1 From 9373c0db9683dc0659545a28f904cc34c13d6be8 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 25 Sep 2013 14:40:12 +0200 Subject: [ticket/11700] Only replace phpbb_search in strings that match PHPBB3-11700 --- phpBB/phpbb/db/migration/data/v310/namespaces.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php index 6da015d0da..9b182f88b8 100644 --- a/phpBB/phpbb/db/migration/data/v310/namespaces.php +++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php @@ -22,7 +22,7 @@ class namespaces extends \phpbb\db\migration\migration { return array( array('if', array( - (preg_match('#^phpbb_#', $this->config['search_type'])), + (preg_match('#^phpbb_search_#', $this->config['search_type'])), array('config.update', array('search_type', str_replace('phpbb_search_', 'phpbb\\search\\', $this->config['search_type']))), )), ); -- cgit v1.2.1 From cbc458e4768107e30688224e173c26493b971a41 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 25 Sep 2013 16:09:14 +0200 Subject: [ticket/11700] Update migrations table for namespaces PHPBB3-11700 --- phpBB/phpbb/db/migration/data/v310/namespaces.php | 55 +++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php index 9b182f88b8..3dd65e09e4 100644 --- a/phpBB/phpbb/db/migration/data/v310/namespaces.php +++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php @@ -25,6 +25,61 @@ class namespaces extends \phpbb\db\migration\migration (preg_match('#^phpbb_search_#', $this->config['search_type'])), array('config.update', array('search_type', str_replace('phpbb_search_', 'phpbb\\search\\', $this->config['search_type']))), )), + array('custom', array(array($this, 'update_migrations'))), ); } + + public function update_migrations() + { + $table = $this->table_prefix . 'migrations'; + + $sql = 'SELECT * + FROM migrations'; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $migration_name = $row['migration_name']; + + $row['migration_name'] = $this->namespacify($row['migration_name']); + + $depends_on = ($row['migration_depends_on']) ? unserialize($row['migration_depends_on']) : false; + + if ($depends_on) + { + $depends_on_new = array(); + + foreach ($depends_on as $migration) + { + $depends_on_new[] = $this->namespacify($migration); + } + + $depends_on = serialize($depends_on_new); + $row['migration_depends_on'] = $depends_on; + } + + $sql_update = $this->db->sql_build_array('UPDATE', $row); + + $sql = 'UPDATE ' . MODULES_TABLE . ' + SET ' . $sql_update . ' + WHERE module_id = ' . $migration_name; + $this->sql_query($sql); + } + } + + public function namespacify($migration_name) + { + $parts = explode('_', $migration_name); + + $namespace = ''; + $class = ''; + + while (count($parts) > 1 && (!$class || !class_exists($class))) + { + $namespace = $namespace . '\\' . array_shift($parts); + $class = $namespace . '\\' . implode('_', $parts); + } + + return $class; + } } -- cgit v1.2.1 From 645bd127dd53300b7877b779226ac53a4891620c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 25 Sep 2013 16:20:26 +0200 Subject: [ticket/11700] Undo migrations migration, as not an issue for new installs PHPBB3-11700 --- phpBB/phpbb/db/migration/data/v310/namespaces.php | 55 ----------------------- 1 file changed, 55 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php index 3dd65e09e4..9b182f88b8 100644 --- a/phpBB/phpbb/db/migration/data/v310/namespaces.php +++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php @@ -25,61 +25,6 @@ class namespaces extends \phpbb\db\migration\migration (preg_match('#^phpbb_search_#', $this->config['search_type'])), array('config.update', array('search_type', str_replace('phpbb_search_', 'phpbb\\search\\', $this->config['search_type']))), )), - array('custom', array(array($this, 'update_migrations'))), ); } - - public function update_migrations() - { - $table = $this->table_prefix . 'migrations'; - - $sql = 'SELECT * - FROM migrations'; - $result = $this->db->sql_query($sql); - - while ($row = $this->db->sql_fetchrow($result)) - { - $migration_name = $row['migration_name']; - - $row['migration_name'] = $this->namespacify($row['migration_name']); - - $depends_on = ($row['migration_depends_on']) ? unserialize($row['migration_depends_on']) : false; - - if ($depends_on) - { - $depends_on_new = array(); - - foreach ($depends_on as $migration) - { - $depends_on_new[] = $this->namespacify($migration); - } - - $depends_on = serialize($depends_on_new); - $row['migration_depends_on'] = $depends_on; - } - - $sql_update = $this->db->sql_build_array('UPDATE', $row); - - $sql = 'UPDATE ' . MODULES_TABLE . ' - SET ' . $sql_update . ' - WHERE module_id = ' . $migration_name; - $this->sql_query($sql); - } - } - - public function namespacify($migration_name) - { - $parts = explode('_', $migration_name); - - $namespace = ''; - $class = ''; - - while (count($parts) > 1 && (!$class || !class_exists($class))) - { - $namespace = $namespace . '\\' . array_shift($parts); - $class = $namespace . '\\' . implode('_', $parts); - } - - return $class; - } } -- cgit v1.2.1