aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/captcha/captcha_gd.php32
-rw-r--r--phpBB/includes/functions.php75
-rw-r--r--phpBB/includes/functions_admin.php67
-rw-r--r--phpBB/includes/functions_compatibility.php75
-rw-r--r--phpBB/includes/functions_display.php1
-rw-r--r--phpBB/includes/functions_messenger.php12
-rw-r--r--phpBB/includes/functions_module.php6
-rw-r--r--phpBB/includes/functions_transfer.php4
-rw-r--r--phpBB/includes/functions_url_matcher.php8
9 files changed, 168 insertions, 112 deletions
diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php
index ab45aa9db6..3a82457c4a 100644
--- a/phpBB/includes/captcha/captcha_gd.php
+++ b/phpBB/includes/captcha/captcha_gd.php
@@ -2226,8 +2226,8 @@ class colour_manager
return $this->random_colour($colour, $mode);
}
- $rgb = colour_manager::model_convert($colour, $mode, 'rgb');
- $store = ($this->mode == 'rgb') ? $rgb : colour_manager::model_convert($colour, $mode, $this->mode);
+ $rgb = $this->model_convert($colour, $mode, 'rgb');
+ $store = ($this->mode == 'rgb') ? $rgb : $this->model_convert($colour, $mode, $this->mode);
$resource = imagecolorallocate($this->img, $rgb[0], $rgb[1], $rgb[2]);
$this->colours[$resource] = $store;
@@ -2345,7 +2345,7 @@ class colour_manager
$resource = $pre;
}
- $colour = colour_manager::model_convert($this->colours[$resource], $this->mode, $mode);
+ $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
$results = ($include_original) ? array($resource) : array();
$colour2 = $colour3 = $colour4 = $colour;
$colour2[0] += 150;
@@ -2380,7 +2380,7 @@ class colour_manager
$resource = $pre;
}
- $colour = colour_manager::model_convert($this->colours[$resource], $this->mode, $mode);
+ $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
$results = array();
if ($include_original)
@@ -2418,11 +2418,11 @@ class colour_manager
switch ($from_model)
{
case 'ahsv':
- return colour_manager::ah2h($colour);
+ return $this->ah2h($colour);
break;
case 'rgb':
- return colour_manager::rgb2hsv($colour);
+ return $this->rgb2hsv($colour);
break;
}
break;
@@ -2432,11 +2432,11 @@ class colour_manager
switch ($from_model)
{
case 'hsv':
- return colour_manager::h2ah($colour);
+ return $this->h2ah($colour);
break;
case 'rgb':
- return colour_manager::h2ah(colour_manager::rgb2hsv($colour));
+ return $this->h2ah($this->rgb2hsv($colour));
break;
}
break;
@@ -2445,11 +2445,11 @@ class colour_manager
switch ($from_model)
{
case 'hsv':
- return colour_manager::hsv2rgb($colour);
+ return $this->hsv2rgb($colour);
break;
case 'ahsv':
- return colour_manager::hsv2rgb(colour_manager::ah2h($colour));
+ return $this->hsv2rgb($this->ah2h($colour));
break;
}
break;
@@ -2462,7 +2462,7 @@ class colour_manager
*/
function hsv2rgb($hsv)
{
- colour_manager::normalize_hue($hsv[0]);
+ $this->normalize_hue($hsv[0]);
$h = $hsv[0];
$s = min(1, max(0, $hsv[1] / 100));
@@ -2554,7 +2554,7 @@ class colour_manager
break;
}
}
- colour_manager::normalize_hue($h);
+ $this->normalize_hue($h);
return array($h, $s * 100, $v * 100);
}
@@ -2578,10 +2578,10 @@ class colour_manager
{
if (is_array($ahue))
{
- $ahue[0] = colour_manager::ah2h($ahue[0]);
+ $ahue[0] = $this->ah2h($ahue[0]);
return $ahue;
}
- colour_manager::normalize_hue($ahue);
+ $this->normalize_hue($ahue);
// blue through red is already ok
if ($ahue >= 240)
@@ -2612,10 +2612,10 @@ class colour_manager
{
if (is_array($hue))
{
- $hue[0] = colour_manager::h2ah($hue[0]);
+ $hue[0] = $this->h2ah($hue[0]);
return $hue;
}
- colour_manager::normalize_hue($hue);
+ $this->normalize_hue($hue);
// blue through red is already ok
if ($hue >= 240)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 11d7ea4c72..5e5f508b6b 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -368,41 +368,6 @@ function still_on_time($extra_time = 15)
}
/**
-* Hash the password
-*
-* @deprecated 3.1.0-a2 (To be removed: 3.3.0)
-*
-* @param string $password Password to be hashed
-*
-* @return string|bool Password hash or false if something went wrong during hashing
-*/
-function phpbb_hash($password)
-{
- global $phpbb_container;
-
- $passwords_manager = $phpbb_container->get('passwords.manager');
- return $passwords_manager->hash($password);
-}
-
-/**
-* Check for correct password
-*
-* @deprecated 3.1.0-a2 (To be removed: 3.3.0)
-*
-* @param string $password The password in plain text
-* @param string $hash The stored password hash
-*
-* @return bool Returns true if the password is correct, false if not.
-*/
-function phpbb_check_hash($password, $hash)
-{
- global $phpbb_container;
-
- $passwords_manager = $phpbb_container->get('passwords.manager');
- return $passwords_manager->check($password, $hash);
-}
-
-/**
* Hashes an email address to a big integer
*
* @param string $email Email address
@@ -885,46 +850,6 @@ else
}
}
-/**
-* Eliminates useless . and .. components from specified path.
-*
-* Deprecated, use filesystem class instead
-*
-* @param string $path Path to clean
-* @return string Cleaned path
-*
-* @deprecated
-*/
-function phpbb_clean_path($path)
-{
- global $phpbb_path_helper, $phpbb_container;
-
- if (!$phpbb_path_helper && $phpbb_container)
- {
- $phpbb_path_helper = $phpbb_container->get('path_helper');
- }
- else if (!$phpbb_path_helper)
- {
- // The container is not yet loaded, use a new instance
- if (!class_exists('\phpbb\path_helper'))
- {
- global $phpbb_root_path, $phpEx;
- require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx);
- }
-
- $phpbb_path_helper = new phpbb\path_helper(
- new phpbb\symfony_request(
- new phpbb\request\request()
- ),
- new phpbb\filesystem(),
- $phpbb_root_path,
- $phpEx
- );
- }
-
- return $phpbb_path_helper->clean_path($path);
-}
-
// functions used for building option fields
/**
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 722d3c9c67..0e28b48d8a 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -731,7 +731,32 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
*/
function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true)
{
- global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container;
+ global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container, $phpbb_dispatcher;
+
+ // Notifications types to delete
+ $delete_notifications_types = array(
+ 'quote',
+ 'bookmark',
+ 'post',
+ 'approve_post',
+ 'post_in_queue',
+ );
+
+ /**
+ * Perform additional actions before post(s) deletion
+ *
+ * @event core.delete_posts_before
+ * @var string where_type Variable containing posts deletion mode
+ * @var mixed where_ids Array or comma separated list of posts ids to delete
+ * @var bool auto_sync Flag indicating if topics/forums should be synchronized
+ * @var bool posted_sync Flag indicating if topics_posted table should be resynchronized
+ * @var bool post_count_sync Flag indicating if posts count should be resynchronized
+ * @var bool call_delete_topics Flag indicating if topics having no posts should be deleted
+ * @var array delete_notifications_types Array with notifications types to delete
+ * @since 3.1.0-a4
+ */
+ $vars = array('where_type', 'where_ids', 'auto_sync', 'posted_sync', 'post_count_sync', 'call_delete_topics', 'delete_notifications_types');
+ extract($phpbb_dispatcher->trigger_event('core.delete_posts_before', compact($vars)));
if ($where_type === 'range')
{
@@ -874,8 +899,40 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
delete_attachments('post', $post_ids, false);
+ /**
+ * Perform additional actions during post(s) deletion
+ *
+ * @event core.delete_posts_in_transaction
+ * @var array post_ids Array with deleted posts' ids
+ * @var array poster_ids Array with deleted posts' author ids
+ * @var array topic_ids Array with deleted posts' topic ids
+ * @var array forum_ids Array with deleted posts' forum ids
+ * @var string where_type Variable containing posts deletion mode
+ * @var mixed where_ids Array or comma separated list of posts ids to delete
+ * @var array delete_notifications_types Array with notifications types to delete
+ * @since 3.1.0-a4
+ */
+ $vars = array('post_ids', 'poster_ids', 'topic_ids', 'forum_ids', 'where_type', 'where_ids', 'delete_notifications_types');
+ extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction', compact($vars)));
+
$db->sql_transaction('commit');
+ /**
+ * Perform additional actions after post(s) deletion
+ *
+ * @event core.delete_posts_after
+ * @var array post_ids Array with deleted posts' ids
+ * @var array poster_ids Array with deleted posts' author ids
+ * @var array topic_ids Array with deleted posts' topic ids
+ * @var array forum_ids Array with deleted posts' forum ids
+ * @var string where_type Variable containing posts deletion mode
+ * @var mixed where_ids Array or comma separated list of posts ids to delete
+ * @var array delete_notifications_types Array with notifications types to delete
+ * @since 3.1.0-a4
+ */
+ $vars = array('post_ids', 'poster_ids', 'topic_ids', 'forum_ids', 'where_type', 'where_ids', 'delete_notifications_types');
+ extract($phpbb_dispatcher->trigger_event('core.delete_posts_after', compact($vars)));
+
// Resync topics_posted table
if ($posted_sync)
{
@@ -902,13 +959,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications(array(
- 'quote',
- 'bookmark',
- 'post',
- 'approve_post',
- 'post_in_queue',
- ), $post_ids);
+ $phpbb_notifications->delete_notifications($delete_notifications_types, $post_ids);
return sizeof($post_ids);
}
diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php
index 2197815087..024c656267 100644
--- a/phpBB/includes/functions_compatibility.php
+++ b/phpBB/includes/functions_compatibility.php
@@ -48,3 +48,78 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $
return phpbb_get_avatar($row, $alt, $ignore_config);
}
+
+/**
+* Hash the password
+*
+* @deprecated 3.1.0-a2 (To be removed: 3.3.0)
+*
+* @param string $password Password to be hashed
+*
+* @return string|bool Password hash or false if something went wrong during hashing
+*/
+function phpbb_hash($password)
+{
+ global $phpbb_container;
+
+ $passwords_manager = $phpbb_container->get('passwords.manager');
+ return $passwords_manager->hash($password);
+}
+
+/**
+* Check for correct password
+*
+* @deprecated 3.1.0-a2 (To be removed: 3.3.0)
+*
+* @param string $password The password in plain text
+* @param string $hash The stored password hash
+*
+* @return bool Returns true if the password is correct, false if not.
+*/
+function phpbb_check_hash($password, $hash)
+{
+ global $phpbb_container;
+
+ $passwords_manager = $phpbb_container->get('passwords.manager');
+ return $passwords_manager->check($password, $hash);
+}
+
+/**
+* Eliminates useless . and .. components from specified path.
+*
+* Deprecated, use filesystem class instead
+*
+* @param string $path Path to clean
+* @return string Cleaned path
+*
+* @deprecated
+*/
+function phpbb_clean_path($path)
+{
+ global $phpbb_path_helper, $phpbb_container;
+
+ if (!$phpbb_path_helper && $phpbb_container)
+ {
+ $phpbb_path_helper = $phpbb_container->get('path_helper');
+ }
+ else if (!$phpbb_path_helper)
+ {
+ // The container is not yet loaded, use a new instance
+ if (!class_exists('\phpbb\path_helper'))
+ {
+ global $phpbb_root_path, $phpEx;
+ require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx);
+ }
+
+ $phpbb_path_helper = new phpbb\path_helper(
+ new phpbb\symfony_request(
+ new phpbb\request\request()
+ ),
+ new phpbb\filesystem(),
+ $phpbb_root_path,
+ $phpEx
+ );
+ }
+
+ return $phpbb_path_helper->clean_path($path);
+}
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index e663ac90c5..05313e849d 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -962,6 +962,7 @@ function display_custom_bbcodes()
'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'",
'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2),
'BBCODE_TAG' => $row['bbcode_tag'],
+ 'BBCODE_TAG_CLEAN' => str_replace('=', '-', $row['bbcode_tag']),
'BBCODE_HELPLINE' => $row['bbcode_helpline'],
'A_BBCODE_HELPLINE' => str_replace(array('&amp;', '&quot;', "'", '&lt;', '&gt;'), array('&', '"', "\'", '<', '>'), $row['bbcode_helpline']),
);
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 6ceeb50330..907252f6d8 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -768,13 +768,15 @@ class queue
if (!$this->jabber->connect())
{
- messenger::error('JABBER', $user->lang['ERR_JAB_CONNECT']);
+ $messenger = new messenger();
+ $messenger->error('JABBER', $user->lang['ERR_JAB_CONNECT']);
continue 2;
}
if (!$this->jabber->login())
{
- messenger::error('JABBER', $user->lang['ERR_JAB_AUTH']);
+ $messenger = new messenger();
+ $messenger->error('JABBER', $user->lang['ERR_JAB_AUTH']);
continue 2;
}
@@ -807,7 +809,8 @@ class queue
if (!$result)
{
- messenger::error('EMAIL', $err_msg);
+ $messenger = new messenger();
+ $messenger->error('EMAIL', $err_msg);
continue 2;
}
break;
@@ -817,7 +820,8 @@ class queue
{
if ($this->jabber->send_message($address, $msg, $subject) === false)
{
- messenger::error('JABBER', $this->jabber->get_log());
+ $messenger = new messenger();
+ $messenger->error('JABBER', $this->jabber->get_log());
continue 3;
}
}
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 53055752f6..dca010518b 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -495,7 +495,7 @@ class p_master
if ($this->active_module === false)
{
- trigger_error('Module not accessible', E_USER_ERROR);
+ trigger_error('MODULE_NOT_ACCESS', E_USER_ERROR);
}
// new modules use the full class names, old ones are always called <type>_<name>, e.g. acp_board
@@ -503,14 +503,14 @@ class p_master
{
if (!file_exists("$module_path/{$this->p_name}.$phpEx"))
{
- trigger_error("Cannot find module $module_path/{$this->p_name}.$phpEx", E_USER_ERROR);
+ trigger_error($user->lang('MODULE_NOT_FIND', "$module_path/{$this->p_name}.$phpEx"), E_USER_ERROR);
}
include("$module_path/{$this->p_name}.$phpEx");
if (!class_exists($this->p_name))
{
- trigger_error("Module file $module_path/{$this->p_name}.$phpEx does not contain correct class [{$this->p_name}]", E_USER_ERROR);
+ trigger_error($user->lang('MODULE_FILE_INCORRECT_CLASS', "$module_path/{$this->p_name}.$phpEx", $this->p_name), E_USER_ERROR);
}
}
diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php
index 9bec17ca8f..17b458d2cb 100644
--- a/phpBB/includes/functions_transfer.php
+++ b/phpBB/includes/functions_transfer.php
@@ -279,7 +279,7 @@ class ftp extends transfer
}
// Init some needed values
- transfer::transfer();
+ $this->transfer();
return;
}
@@ -533,7 +533,7 @@ class ftp_fsock extends transfer
}
// Init some needed values
- transfer::transfer();
+ $this->transfer();
return;
}
diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php
index c5d6815119..8e5ae20f93 100644
--- a/phpBB/includes/functions_url_matcher.php
+++ b/phpBB/includes/functions_url_matcher.php
@@ -53,8 +53,8 @@ function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $
*/
function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_path, $php_ext)
{
- $provider = new \phpbb\controller\provider();
- $routes = $provider->import_paths_from_finder($finder)->find($root_path);
+ $provider = new \phpbb\controller\provider($finder);
+ $routes = $provider->find($root_path)->get_routes();
$dumper = new PhpMatcherDumper($routes);
$cached_url_matcher_dump = $dumper->dump(array(
'class' => 'phpbb_url_matcher',
@@ -72,8 +72,8 @@ function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_
*/
function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path)
{
- $provider = new \phpbb\controller\provider();
- $routes = $provider->import_paths_from_finder($finder)->find($root_path);
+ $provider = new \phpbb\controller\provider($finder);
+ $routes = $provider->find($root_path)->get_routes();
return new UrlMatcher($routes, $context);
}