summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/all.php1
-rw-r--r--actions/avatarsettings.php110
-rw-r--r--actions/login.php3
3 files changed, 60 insertions, 54 deletions
diff --git a/actions/all.php b/actions/all.php
index 5a9d97dd7..452803d8a 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -167,5 +167,4 @@ class AllAction extends ProfileAction
$this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));
}
}
-
}
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
index 879e44842..cf4525552 100644
--- a/actions/avatarsettings.php
+++ b/actions/avatarsettings.php
@@ -118,53 +118,56 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->elementStart('fieldset');
$this->element('legend', null, _('Avatar settings'));
$this->hidden('token', common_session_token());
-
- $this->elementStart('ul', 'form_data');
- if ($original) {
- $this->elementStart('li', array('id' => 'avatar_original',
- 'class' => 'avatar_view'));
- $this->element('h2', null, _("Original"));
- $this->elementStart('div', array('id'=>'avatar_original_view'));
- $this->element('img', array('src' => $original->url,
- 'width' => $original->width,
- 'height' => $original->height,
- 'alt' => $user->nickname));
- $this->elementEnd('div');
+
+ if (Event::handle('StartAvatarFormData', array($this))) {
+ $this->elementStart('ul', 'form_data');
+ if ($original) {
+ $this->elementStart('li', array('id' => 'avatar_original',
+ 'class' => 'avatar_view'));
+ $this->element('h2', null, _("Original"));
+ $this->elementStart('div', array('id'=>'avatar_original_view'));
+ $this->element('img', array('src' => $original->url,
+ 'width' => $original->width,
+ 'height' => $original->height,
+ 'alt' => $user->nickname));
+ $this->elementEnd('div');
+ $this->elementEnd('li');
+ }
+
+ $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
+
+ if ($avatar) {
+ $this->elementStart('li', array('id' => 'avatar_preview',
+ 'class' => 'avatar_view'));
+ $this->element('h2', null, _("Preview"));
+ $this->elementStart('div', array('id'=>'avatar_preview_view'));
+ $this->element('img', array('src' => $original->url,
+ 'width' => AVATAR_PROFILE_SIZE,
+ 'height' => AVATAR_PROFILE_SIZE,
+ 'alt' => $user->nickname));
+ $this->elementEnd('div');
+ $this->submit('delete', _('Delete'));
+ $this->elementEnd('li');
+ }
+
+ $this->elementStart('li', array ('id' => 'settings_attach'));
+ $this->element('input', array('name' => 'avatarfile',
+ 'type' => 'file',
+ 'id' => 'avatarfile'));
+ $this->element('input', array('name' => 'MAX_FILE_SIZE',
+ 'type' => 'hidden',
+ 'id' => 'MAX_FILE_SIZE',
+ 'value' => ImageFile::maxFileSizeInt()));
$this->elementEnd('li');
- }
-
- $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
+ $this->elementEnd('ul');
- if ($avatar) {
- $this->elementStart('li', array('id' => 'avatar_preview',
- 'class' => 'avatar_view'));
- $this->element('h2', null, _("Preview"));
- $this->elementStart('div', array('id'=>'avatar_preview_view'));
- $this->element('img', array('src' => $original->url,
- 'width' => AVATAR_PROFILE_SIZE,
- 'height' => AVATAR_PROFILE_SIZE,
- 'alt' => $user->nickname));
- $this->elementEnd('div');
- $this->submit('delete', _('Delete'));
+ $this->elementStart('ul', 'form_actions');
+ $this->elementStart('li');
+ $this->submit('upload', _('Upload'));
$this->elementEnd('li');
+ $this->elementEnd('ul');
}
-
- $this->elementStart('li', array ('id' => 'settings_attach'));
- $this->element('input', array('name' => 'avatarfile',
- 'type' => 'file',
- 'id' => 'avatarfile'));
- $this->element('input', array('name' => 'MAX_FILE_SIZE',
- 'type' => 'hidden',
- 'id' => 'MAX_FILE_SIZE',
- 'value' => ImageFile::maxFileSizeInt()));
- $this->elementEnd('li');
- $this->elementEnd('ul');
-
- $this->elementStart('ul', 'form_actions');
- $this->elementStart('li');
- $this->submit('upload', _('Upload'));
- $this->elementEnd('li');
- $this->elementEnd('ul');
+ Event::handle('EndAvatarFormData', array($this));
$this->elementEnd('fieldset');
$this->elementEnd('form');
@@ -266,15 +269,18 @@ class AvatarsettingsAction extends AccountSettingsAction
'Try again, please.'));
return;
}
-
- if ($this->arg('upload')) {
- $this->uploadAvatar();
- } else if ($this->arg('crop')) {
- $this->cropAvatar();
- } else if ($this->arg('delete')) {
- $this->deleteAvatar();
- } else {
- $this->showForm(_('Unexpected form submission.'));
+
+ if (Event::handle('StartAvatarSaveForm', array($this))) {
+ if ($this->arg('upload')) {
+ $this->uploadAvatar();
+ } else if ($this->arg('crop')) {
+ $this->cropAvatar();
+ } else if ($this->arg('delete')) {
+ $this->deleteAvatar();
+ } else {
+ $this->showForm(_('Unexpected form submission.'));
+ }
+ Event::handle('EndAvatarSaveForm', array($this));
}
}
diff --git a/actions/login.php b/actions/login.php
index a6f86c0ca..c775fa692 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -77,12 +77,13 @@ class LoginAction extends Action
parent::handle($args);
$disabled = common_config('logincommand','disabled');
+ $disabled = isset($disabled) && $disabled;
if (common_is_real_login()) {
$this->clientError(_('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->checkLogin();
- } else if (!isset($disabled) && isset($args['user_id']) && isset($args['token'])){
+ } else if (!$disabled && isset($args['user_id']) && isset($args['token'])){
$this->checkLogin($args['user_id'],$args['token']);
} else {
common_ensure_session();