X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fgrouplogo.php;h=46ce27427496493be82aaa3598df6663356749b6;hb=0503bcb0e2dd75de10a74ee5fc12d1523a44b028;hp=7b7c01b23b9fc7425d63585971669e713e86207d;hpb=6455461c196fcb8e7c0047870d480e4a97986709;p=quix0rs-gnu-social.git diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 7b7c01b23b..46ce274274 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -23,7 +23,7 @@ * @package StatusNet * @author Evan Prodromou * @author Zach Copley - * @copyright 2008-2009 StatusNet, Inc. + * @copyright 2008-2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/accountsettingsaction.php'; + define('MAX_ORIGINAL', 480); @@ -49,7 +49,7 @@ define('MAX_ORIGINAL', 480); * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -class GrouplogoAction extends GroupDesignAction +class GrouplogoAction extends GroupAction { var $mode = null; var $imagefile = null; @@ -60,7 +60,6 @@ class GrouplogoAction extends GroupDesignAction /** * Prepare to run */ - function prepare($args) { parent::prepare($args); @@ -83,7 +82,7 @@ class GrouplogoAction extends GroupDesignAction } if (!$nickname) { - // TRANS: Client error displayed when trying to change group logo settings without having a nickname. + // TRANS: Client error displayed when trying to change group logo settings without providing a nickname. $this->clientError(_('No nickname.'), 404); return false; } @@ -181,8 +180,8 @@ class GrouplogoAction extends GroupDesignAction if (!$profile) { common_log_db_error($user, 'SELECT', __FILE__); - // TRANS: Server error displayed coming across a request from a user without a profile. - $this->serverError(_('User without matching profile.')); + // TRANS: Error message displayed when referring to a user without a profile. + $this->serverError(_('User has no profile.')); return; } @@ -205,7 +204,7 @@ class GrouplogoAction extends GroupDesignAction $this->elementStart('li', array('id' => 'avatar_original', 'class' => 'avatar_view')); // TRANS: Uploaded original file in group logo form. - $this->element('h2', null, _("Original")); + $this->element('h2', null, _('Original')); $this->elementStart('div', array('id'=>'avatar_original_view')); $this->element('img', array('src' => $this->group->original_logo, 'alt' => $this->group->nickname)); @@ -217,7 +216,7 @@ class GrouplogoAction extends GroupDesignAction $this->elementStart('li', array('id' => 'avatar_preview', 'class' => 'avatar_view')); // TRANS: Header for preview of to be displayed group logo. - $this->element('h2', null, _("Preview")); + $this->element('h2', null, _('Preview')); $this->elementStart('div', array('id'=>'avatar_preview_view')); $this->element('img', array('src' => $this->group->homepage_logo, 'width' => AVATAR_PROFILE_SIZE, @@ -228,13 +227,13 @@ class GrouplogoAction extends GroupDesignAction } $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->element('input', array('name' => 'avatarfile', + 'type' => 'file', + 'id' => 'avatarfile')); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -247,7 +246,6 @@ class GrouplogoAction extends GroupDesignAction $this->elementEnd('fieldset'); $this->elementEnd('form'); - } function showCropForm() @@ -269,7 +267,7 @@ class GrouplogoAction extends GroupDesignAction array('id' => 'avatar_original', 'class' => 'avatar_view')); // TRANS: Header for originally uploaded file before a crop on the group logo page. - $this->element('h2', null, _("Original")); + $this->element('h2', null, _('Original')); $this->elementStart('div', array('id'=>'avatar_original_view')); $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => $this->filedata['width'], @@ -282,7 +280,7 @@ class GrouplogoAction extends GroupDesignAction array('id' => 'avatar_preview', 'class' => 'avatar_view')); // TRANS: Header for the cropped group logo on the group logo page. - $this->element('h2', null, _("Preview")); + $this->element('h2', null, _('Preview')); $this->elementStart('div', array('id'=>'avatar_preview_view')); $this->element('img', array('src' => Avatar::url($this->filedata['filename']), 'width' => AVATAR_PROFILE_SIZE, @@ -304,7 +302,6 @@ class GrouplogoAction extends GroupDesignAction $this->elementEnd('ul'); $this->elementEnd('fieldset'); $this->elementEnd('form'); - } /** @@ -353,20 +350,21 @@ class GrouplogoAction extends GroupDesignAction return; } + $type = $imagefile->preferredType(); $filename = Avatar::filename($this->group->id, - image_type_to_extension($imagefile->type), + image_type_to_extension($type), null, 'group-temp-'.common_timestamp()); $filepath = Avatar::path($filename); - move_uploaded_file($imagefile->filepath, $filepath); + $imagefile->copyTo($filepath); $filedata = array('filename' => $filename, 'filepath' => $filepath, 'width' => $imagefile->width, 'height' => $imagefile->height, - 'type' => $imagefile->type); + 'type' => $type); $_SESSION['FILEDATA'] = $filedata; @@ -437,7 +435,6 @@ class GrouplogoAction extends GroupDesignAction * * @return void */ - function showStylesheets() { parent::showStylesheets(); @@ -449,7 +446,6 @@ class GrouplogoAction extends GroupDesignAction * * @return void */ - function showScripts() { parent::showScripts(); @@ -461,10 +457,4 @@ class GrouplogoAction extends GroupDesignAction $this->autofocus('avatarfile'); } - - function showLocalNav() - { - $nav = new GroupNav($this, $this->group); - $nav->show(); - } }