aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/avatar/driver
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2012-11-14 23:14:41 +0100
committerMarc Alexander <admin@m-a-styles.de>2012-11-15 18:10:54 +0100
commit60b4c907b292a46b40cad1c0330e76b897a2309b (patch)
treeb052a9b4af0a9b71a83bb3ec730f19dc46cd4bfb /phpBB/includes/avatar/driver
parent076785d76a1412394636095f0b296964419e2a4f (diff)
downloadforums-60b4c907b292a46b40cad1c0330e76b897a2309b.tar
forums-60b4c907b292a46b40cad1c0330e76b897a2309b.tar.gz
forums-60b4c907b292a46b40cad1c0330e76b897a2309b.tar.bz2
forums-60b4c907b292a46b40cad1c0330e76b897a2309b.tar.xz
forums-60b4c907b292a46b40cad1c0330e76b897a2309b.zip
[feature/avatars] Add service containers for avatars
PHPBB3-10018
Diffstat (limited to 'phpBB/includes/avatar/driver')
-rw-r--r--phpBB/includes/avatar/driver/core/gravatar.php16
-rw-r--r--phpBB/includes/avatar/driver/core/remote.php10
-rw-r--r--phpBB/includes/avatar/driver/core/upload.php2
-rw-r--r--phpBB/includes/avatar/driver/driver.php22
-rw-r--r--phpBB/includes/avatar/driver/interface.php7
5 files changed, 39 insertions, 18 deletions
diff --git a/phpBB/includes/avatar/driver/core/gravatar.php b/phpBB/includes/avatar/driver/core/gravatar.php
index a9e4d6c491..34aa0fa27f 100644
--- a/phpBB/includes/avatar/driver/core/gravatar.php
+++ b/phpBB/includes/avatar/driver/core/gravatar.php
@@ -70,9 +70,9 @@ class phpbb_avatar_driver_core_gravatar extends phpbb_avatar_driver
public function prepare_form($template, $row, &$error)
{
$template->assign_vars(array(
- 'AV_GRAVATAR_WIDTH' => (($row['avatar_type'] == __CLASS__ || $row['avatar_type'] == 'gravatar') && $row['avatar_width']) ? $row['avatar_width'] : $this->request->variable('av_local_width', 0),
- 'AV_GRAVATAR_HEIGHT' => (($row['avatar_type'] == __CLASS__ || $row['avatar_type'] == 'gravatar') && $row['avatar_height']) ? $row['avatar_height'] : $this->request->variable('av_local_width', 0),
- 'AV_GRAVATAR_EMAIL' => (($row['avatar_type'] == __CLASS__ || $row['avatar_type'] == 'gravatar') && $row['avatar']) ? $row['avatar'] : '',
+ 'AV_GRAVATAR_WIDTH' => (($row['avatar_type'] == $this->get_name() || $row['avatar_type'] == 'gravatar') && $row['avatar_width']) ? $row['avatar_width'] : $this->request->variable('av_local_width', 0),
+ 'AV_GRAVATAR_HEIGHT' => (($row['avatar_type'] == $this->get_name() || $row['avatar_type'] == 'gravatar') && $row['avatar_height']) ? $row['avatar_height'] : $this->request->variable('av_local_width', 0),
+ 'AV_GRAVATAR_EMAIL' => (($row['avatar_type'] == $this->get_name() || $row['avatar_type'] == 'gravatar') && $row['avatar']) ? $row['avatar'] : '',
));
return true;
@@ -86,16 +86,8 @@ class phpbb_avatar_driver_core_gravatar extends phpbb_avatar_driver
$email = $this->request->variable('av_gravatar_email', '');
$width = $this->request->variable('av_gravatar_width', 0);
$height = $this->request->variable('av_gravatar_height', 0);
- var_dump($width, $height);
- /*
- if (!preg_match('#^(http|https|ftp)://#i', $email))
- {
- $url = 'http://' . $url;
- }*/
- // @todo: check if we need to check emails
-
- require_once($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
+ require_once($this->phpbb_root_path . 'includes/functions_user' . $this->phpEx);
$error = array_merge($error, validate_data(array(
'email' => $email,
diff --git a/phpBB/includes/avatar/driver/core/remote.php b/phpBB/includes/avatar/driver/core/remote.php
index 9f5a58e75a..8b315b80a8 100644
--- a/phpBB/includes/avatar/driver/core/remote.php
+++ b/phpBB/includes/avatar/driver/core/remote.php
@@ -50,9 +50,9 @@ class phpbb_avatar_driver_core_remote extends phpbb_avatar_driver
public function prepare_form($template, $row, &$error)
{
$template->assign_vars(array(
- 'AV_REMOTE_WIDTH' => (($row['avatar_type'] == AVATAR_REMOTE || $row['avatar_type'] == 'remote') && $row['avatar_width']) ? $row['avatar_width'] : $this->request->variable('av_local_width', 0),
- 'AV_REMOTE_HEIGHT' => (($row['avatar_type'] == AVATAR_REMOTE || $row['avatar_type'] == 'remote') && $row['avatar_height']) ? $row['avatar_height'] : $this->request->variable('av_local_width', 0),
- 'AV_REMOTE_URL' => (($row['avatar_type'] == AVATAR_REMOTE || $row['avatar_type'] == 'remote') && $row['avatar']) ? $row['avatar'] : '',
+ 'AV_REMOTE_WIDTH' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_width']) ? $row['avatar_width'] : $this->request->variable('av_local_width', 0),
+ 'AV_REMOTE_HEIGHT' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_height']) ? $row['avatar_height'] : $this->request->variable('av_local_width', 0),
+ 'AV_REMOTE_URL' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar']) ? $row['avatar'] : '',
));
return true;
@@ -72,7 +72,7 @@ class phpbb_avatar_driver_core_remote extends phpbb_avatar_driver
$url = 'http://' . $url;
}
- require_once($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
+ require_once($this->phpbb_root_path . 'includes/functions_user' . $this->phpEx);
$error = array_merge($error, validate_data(array(
'url' => $url,
@@ -118,7 +118,7 @@ class phpbb_avatar_driver_core_remote extends phpbb_avatar_driver
return false;
}
- include_once($this->phpbb_root_path . 'includes/functions_upload.' . $this->phpEx);
+ include_once($this->phpbb_root_path . 'includes/functions_upload' . $this->phpEx);
$types = fileupload::image_types();
$extension = strtolower(filespec::get_extension($url));
diff --git a/phpBB/includes/avatar/driver/core/upload.php b/phpBB/includes/avatar/driver/core/upload.php
index d0ce856dbe..1ad1133bff 100644
--- a/phpBB/includes/avatar/driver/core/upload.php
+++ b/phpBB/includes/avatar/driver/core/upload.php
@@ -72,7 +72,7 @@ class phpbb_avatar_driver_core_upload extends phpbb_avatar_driver
return false;
}
- include_once($this->phpbb_root_path . 'includes/functions_upload.' . $this->phpEx);
+ include_once($this->phpbb_root_path . 'includes/functions_upload' . $this->phpEx);
$upload = new fileupload('AVATAR_', array('jpg', 'jpeg', 'gif', 'png'), $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));
diff --git a/phpBB/includes/avatar/driver/driver.php b/phpBB/includes/avatar/driver/driver.php
index d0f77d2094..cce0a8db0f 100644
--- a/phpBB/includes/avatar/driver/driver.php
+++ b/phpBB/includes/avatar/driver/driver.php
@@ -21,6 +21,28 @@ if (!defined('IN_PHPBB'))
*/
abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
{
+ private $name;
+
+ /**
+ * Returns the name of the driver.
+ *
+ * @return string Name of wrapped driver.
+ */
+ public function get_name()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Sets the name of the driver.
+ *
+ * @param string $name The driver name
+ */
+ public function set_name($name)
+ {
+ $this->name = $name;
+ }
+
/**
* Current board configuration
* @type phpbb_config
diff --git a/phpBB/includes/avatar/driver/interface.php b/phpBB/includes/avatar/driver/interface.php
index 16fef58e7a..f066470174 100644
--- a/phpBB/includes/avatar/driver/interface.php
+++ b/phpBB/includes/avatar/driver/interface.php
@@ -22,6 +22,13 @@ if (!defined('IN_PHPBB'))
interface phpbb_avatar_driver_interface
{
/**
+ * Returns the name of the driver.
+ *
+ * @return string Name of wrapped driver.
+ */
+ public function get_name();
+
+ /**
* Get the avatar url and dimensions
*
* @param $ignore_config Whether this function should respect the users prefs