summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/avatar/controller.php4
-rw-r--r--core/js/jquery.avatar.js13
-rw-r--r--core/routes.php7
3 files changed, 16 insertions, 8 deletions
diff --git a/core/avatar/controller.php b/core/avatar/controller.php
index 66ee7edafbe..85ac251d094 100644
--- a/core/avatar/controller.php
+++ b/core/avatar/controller.php
@@ -25,8 +25,8 @@ class OC_Core_Avatar_Controller {
$size = 64;
}
- $ava = new \OC_Avatar();
- $image = $ava->get($user, $size);
+ $avatar = new \OC_Avatar();
+ $image = $avatar->get($user, $size);
if ($image instanceof \OC_Image) {
$image->show();
diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js
index bd57a542fa7..b4fa524f47a 100644
--- a/core/js/jquery.avatar.js
+++ b/core/js/jquery.avatar.js
@@ -10,6 +10,8 @@
if (typeof(size) === 'undefined') {
if (this.height() > 0) {
size = this.height();
+ } else if (this.data('size') > 0) {
+ size = this.data('size');
} else {
size = 64;
}
@@ -19,10 +21,17 @@
this.width(size);
if (typeof(user) === 'undefined') {
- this.placeholder('x');
- return;
+ if (typeof(this.data('user')) !== 'undefined') {
+ user = this.data('user');
+ } else {
+ this.placeholder('x');
+ return;
+ }
}
+ // sanitize
+ user = user.replace(/\//g,'');
+
var $div = this;
//$.get(OC.Router.generate('core_avatar_get', {user: user, size: size}), function(result) { // TODO does not work "Uncaught TypeError: Cannot use 'in' operator to search for 'core_avatar_get' in undefined" router.js L22
diff --git a/core/routes.php b/core/routes.php
index d2ad699bd08..a0d06bf807e 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -59,8 +59,10 @@ $this->create('core_lostpassword_reset_password', '/lostpassword/reset/{token}/{
->action('OC_Core_LostPassword_Controller', 'resetPassword');
// Avatar routes
+$this->create('core_avatar_get_tmp', '/avatar/tmp')
+ ->get()
+ ->action('OC_Core_Avatar_Controller', 'getTmpAvatar');
$this->create('core_avatar_get', '/avatar/{user}/{size}')
- ->defaults(array('user' => '', 'size' => 64))
->get()
->action('OC_Core_Avatar_Controller', 'getAvatar');
$this->create('core_avatar_post', '/avatar/')
@@ -69,9 +71,6 @@ $this->create('core_avatar_post', '/avatar/')
$this->create('core_avatar_delete', '/avatar/')
->delete()
->action('OC_Core_Avatar_Controller', 'deleteAvatar');
-$this->create('core_avatar_get_tmp', '/avatartmp/') //TODO better naming, so it doesn't conflict with core_avatar_get
- ->get()
- ->action('OC_Core_Avatar_Controller', 'getTmpAvatar');
$this->create('core_avatar_post_cropped', '/avatar/cropped')
->post()
->action('OC_Core_Avatar_Controller', 'postCroppedAvatar');