diff --git a/protected/humhub/components/Controller.php b/protected/humhub/components/Controller.php
index 57b2e1df10..5de7b7e557 100644
--- a/protected/humhub/components/Controller.php
+++ b/protected/humhub/components/Controller.php
@@ -21,6 +21,11 @@ use yii\helpers\Html;
class Controller extends \yii\web\Controller
{
+ /**
+ * @event \yii\base\Event an event raised on init a controller.
+ */
+ const EVENT_INIT = 'init';
+
/**
* @var null|string the name of the sub layout to be applied to this controller's views.
* This property mainly affects the behavior of [[render()]].
@@ -42,6 +47,15 @@ class Controller extends \yii\web\Controller
*/
public $prependActionTitles = true;
+ /**
+ * @inheritdoc
+ */
+ public function init()
+ {
+ parent::init();
+ $this->trigger(self::EVENT_INIT);
+ }
+
/**
* @inheritdoc
*/
@@ -92,7 +106,7 @@ class Controller extends \yii\web\Controller
if (\Yii::$app->request->method != 'POST') {
throw new \yii\web\HttpException(405, Yii::t('ContentModule.controllers_ContentController', 'Invalid request method!'));
}
-
+
return true;
}
@@ -143,7 +157,7 @@ class Controller extends \yii\web\Controller
$this->getView()->pageTitle = $this->pageTitle;
}
- if(!Yii::$app->request->isAjax || Yii::$app->request->isPjax) {
+ if (!Yii::$app->request->isAjax || Yii::$app->request->isPjax) {
$this->setJsViewStatus();
}
@@ -223,7 +237,7 @@ class Controller extends \yii\web\Controller
$modluleId = (Yii::$app->controller->module) ? Yii::$app->controller->module->id : '';
$this->view->registerJs('humhub.modules.ui.view.setState("' . $modluleId . '", "' . Yii::$app->controller->id . '", "' . Yii::$app->controller->action->id . '");', \yii\web\View::POS_BEGIN);
- if(Yii::$app->request->isPjax) {
+ if (Yii::$app->request->isPjax) {
\humhub\widgets\TopMenu::setViewState();
}
}
diff --git a/protected/humhub/components/Module.php b/protected/humhub/components/Module.php
index 0d11e3aece..2d188cd27b 100644
--- a/protected/humhub/components/Module.php
+++ b/protected/humhub/components/Module.php
@@ -14,6 +14,7 @@ use yii\helpers\Json;
/**
* Base Class for Modules / Extensions
*
+ * @property SettingsManager $settings
* @author luke
*/
class Module extends \yii\base\Module
diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md
index 32f8c1f97d..4b65366ee9 100644
--- a/protected/humhub/docs/CHANGELOG.md
+++ b/protected/humhub/docs/CHANGELOG.md
@@ -76,6 +76,10 @@ HumHub Change Log
- Enh: Directory view templates cleanups
- Fix: All LDAP Users have been disabled and not reenabled by hourly cronjob if ldap server not reachable.
- Enh: Cleanup authentication layout file
+- Fix: Console image converter memory limit allocation
+- Enh: Added new controller init event
+- Enh: Made admin base controller method "getAccessRules()" non static
+- Enh: Created new ImageController for user image and banner handling
1.2.0-beta.2 (February 24, 2017)
--------------------------------
diff --git a/protected/humhub/models/forms/CropProfileImage.php b/protected/humhub/models/forms/CropProfileImage.php
index 3dbeae08c0..3286c6b1e7 100644
--- a/protected/humhub/models/forms/CropProfileImage.php
+++ b/protected/humhub/models/forms/CropProfileImage.php
@@ -1,26 +1,13 @@
\humhub\modules\admin\permissions\ManageSettings::className()]
diff --git a/protected/humhub/modules/admin/components/Controller.php b/protected/humhub/modules/admin/components/Controller.php
index 7a609b1d57..83a0206c25 100644
--- a/protected/humhub/modules/admin/components/Controller.php
+++ b/protected/humhub/modules/admin/components/Controller.php
@@ -23,7 +23,7 @@ class Controller extends \humhub\components\Controller
* @inheritdoc
*/
public $subLayout = "@humhub/modules/admin/views/layouts/main";
-
+
/**
* @var boolean if true only allows access for system admins else the access is restricted by getAccessRules()
*/
@@ -35,7 +35,7 @@ class Controller extends \humhub\components\Controller
public function init()
{
$this->appendPageTitle(\Yii::t('AdminModule.base', 'Administration'));
- return parent::init();
+ parent::init();
}
/**
@@ -44,7 +44,7 @@ class Controller extends \humhub\components\Controller
public function behaviors()
{
// Workaround for module configuration actions @see getAccessRules()
- if (Yii::$app->controller->module->id != 'admin') {
+ if ($this->module->id != 'admin') {
$this->adminOnly = false;
}
@@ -52,15 +52,21 @@ class Controller extends \humhub\components\Controller
'acl' => [
'class' => AccessControl::className(),
'adminOnly' => $this->adminOnly,
- 'rules' => static::getAccessRules()
+ 'rules' => $this->getAccessRules()
]
];
}
- public static function getAccessRules()
+ /**
+ * Returns access rules for the standard access control behavior
+ *
+ * @see AccessControl
+ * @return array the access permissions
+ */
+ public function getAccessRules()
{
- // Workaround for module configuration actions
- if (Yii::$app->controller->module->id != 'admin') {
+ // Use by default ManageModule permission, if method is not overwritten by custom module
+ if ($this->module->id != 'admin') {
return [
['permissions' => \humhub\modules\admin\permissions\ManageModules::className()]
];
diff --git a/protected/humhub/modules/admin/controllers/ApprovalController.php b/protected/humhub/modules/admin/controllers/ApprovalController.php
index efa1f5df82..644651125e 100644
--- a/protected/humhub/modules/admin/controllers/ApprovalController.php
+++ b/protected/humhub/modules/admin/controllers/ApprovalController.php
@@ -35,8 +35,11 @@ class ApprovalController extends Controller
$this->appendPageTitle(Yii::t('AdminModule.base', 'Approval'));
return parent::init();
}
-
- public static function getAccessRules()
+
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => [
diff --git a/protected/humhub/modules/admin/controllers/AuthenticationController.php b/protected/humhub/modules/admin/controllers/AuthenticationController.php
index 687ca5453b..0deaed722c 100644
--- a/protected/humhub/modules/admin/controllers/AuthenticationController.php
+++ b/protected/humhub/modules/admin/controllers/AuthenticationController.php
@@ -21,7 +21,7 @@ class AuthenticationController extends Controller
* @inheritdoc
*/
public $adminOnly = false;
-
+
/**
* @inheritdoc
*/
@@ -37,7 +37,10 @@ class AuthenticationController extends Controller
return parent::init();
}
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\ManageSettings::className()]
diff --git a/protected/humhub/modules/admin/controllers/GroupController.php b/protected/humhub/modules/admin/controllers/GroupController.php
index e0d3ae297c..e451d4ed1a 100644
--- a/protected/humhub/modules/admin/controllers/GroupController.php
+++ b/protected/humhub/modules/admin/controllers/GroupController.php
@@ -37,7 +37,10 @@ class GroupController extends Controller
return parent::init();
}
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\ManageGroups::className()]
@@ -128,12 +131,12 @@ class GroupController extends Controller
$this->forcePostRequest();
$group = Group::findOne(['id' => Yii::$app->request->get('id')]);
$group->removeUser(Yii::$app->request->get('userId'));
-
+
if(Yii::$app->request->isAjax) {
Yii::$app->response->format = 'json';
return ['success' => true];
}
-
+
return $this->redirect(['/admin/group/manage-group-users', 'id' => $group->id]);
}
@@ -204,9 +207,9 @@ class GroupController extends Controller
$subQuery = (new \yii\db\Query())->select('*')->from(GroupUser::tableName(). ' g')->where([
'and', 'g.user_id=user.id', ['g.group_id' => $group->id]]);
-
+
$query = User::find()->where(['not exists', $subQuery]);
-
+
$result = UserPicker::filter([
'keyword' => $keyword,
'query' => $query,
diff --git a/protected/humhub/modules/admin/controllers/IndexController.php b/protected/humhub/modules/admin/controllers/IndexController.php
index c7f78bf6c7..3230af0609 100644
--- a/protected/humhub/modules/admin/controllers/IndexController.php
+++ b/protected/humhub/modules/admin/controllers/IndexController.php
@@ -13,7 +13,7 @@ use humhub\modules\admin\components\Controller;
/**
* IndexController is the admin section start point.
- *
+ *
* @since 0.5
*/
class IndexController extends Controller
@@ -24,7 +24,10 @@ class IndexController extends Controller
*/
public $adminOnly = false;
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => Yii::$app->getModule('admin')->getPermissions()]
diff --git a/protected/humhub/modules/admin/controllers/InformationController.php b/protected/humhub/modules/admin/controllers/InformationController.php
index d08e97038d..8d5e885eff 100644
--- a/protected/humhub/modules/admin/controllers/InformationController.php
+++ b/protected/humhub/modules/admin/controllers/InformationController.php
@@ -14,12 +14,12 @@ use humhub\modules\admin\libs\HumHubAPI;
/**
* Informations
- *
+ *
* @since 0.5
*/
class InformationController extends Controller
{
-
+
/**
* @inheritdoc
*/
@@ -35,8 +35,11 @@ class InformationController extends Controller
$this->subLayout = '@admin/views/layouts/information';
return parent::init();
}
-
- public static function getAccessRules()
+
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\SeeAdminInformation::className()]
diff --git a/protected/humhub/modules/admin/controllers/LoggingController.php b/protected/humhub/modules/admin/controllers/LoggingController.php
index cc6bcccbcd..f5aa162b1b 100644
--- a/protected/humhub/modules/admin/controllers/LoggingController.php
+++ b/protected/humhub/modules/admin/controllers/LoggingController.php
@@ -32,7 +32,10 @@ class LoggingController extends Controller
return parent::init();
}
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\SeeAdminInformation::className()]
diff --git a/protected/humhub/modules/admin/controllers/ModuleController.php b/protected/humhub/modules/admin/controllers/ModuleController.php
index b207b63cac..beb12585ec 100644
--- a/protected/humhub/modules/admin/controllers/ModuleController.php
+++ b/protected/humhub/modules/admin/controllers/ModuleController.php
@@ -39,7 +39,10 @@ class ModuleController extends Controller
return parent::init();
}
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\ManageModules::className()]
@@ -333,7 +336,7 @@ class ModuleController extends Controller
$userDefaultModule->state = $model->userDefaultState;
if (!$userDefaultModule->save()) {
throw new HttpException('Could not save: ' . print_r($userDefaultModule->getErrors(), 1));
- }
+ }
}
return $this->renderModalClose();
diff --git a/protected/humhub/modules/admin/controllers/SettingController.php b/protected/humhub/modules/admin/controllers/SettingController.php
index 9903d6cec5..7da50ce3d4 100644
--- a/protected/humhub/modules/admin/controllers/SettingController.php
+++ b/protected/humhub/modules/admin/controllers/SettingController.php
@@ -55,7 +55,7 @@ class SettingController extends Controller
/**
* @inheritdoc
*/
- public static function getAccessRules()
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\ManageSettings::className()]
diff --git a/protected/humhub/modules/admin/controllers/SpaceController.php b/protected/humhub/modules/admin/controllers/SpaceController.php
index 2b9cc57c54..ac733caf24 100644
--- a/protected/humhub/modules/admin/controllers/SpaceController.php
+++ b/protected/humhub/modules/admin/controllers/SpaceController.php
@@ -36,7 +36,10 @@ class SpaceController extends Controller
return parent::init();
}
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => [
diff --git a/protected/humhub/modules/admin/controllers/UserController.php b/protected/humhub/modules/admin/controllers/UserController.php
index 92ef13e61b..1eaaa8121c 100644
--- a/protected/humhub/modules/admin/controllers/UserController.php
+++ b/protected/humhub/modules/admin/controllers/UserController.php
@@ -23,7 +23,7 @@ use humhub\modules\admin\permissions\ManageSettings;
/**
* User management
- *
+ *
* @since 0.5
*/
class UserController extends Controller
@@ -41,7 +41,10 @@ class UserController extends Controller
return parent::init();
}
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => [
@@ -176,9 +179,9 @@ class UserController extends Controller
return $this->render('edit', array('hForm' => $form, 'user' => $user));
}
-
+
public function canBecomeUser($user) {
- return Yii::$app->user->isAdmin()
+ return Yii::$app->user->isAdmin()
&& $user->id != Yii::$app->user->getIdentity()->id
&& !$user->isSystemAdmin();
}
diff --git a/protected/humhub/modules/admin/controllers/UserProfileController.php b/protected/humhub/modules/admin/controllers/UserProfileController.php
index bd37bdbb15..f0295b29f6 100644
--- a/protected/humhub/modules/admin/controllers/UserProfileController.php
+++ b/protected/humhub/modules/admin/controllers/UserProfileController.php
@@ -19,7 +19,7 @@ use humhub\modules\user\models\fieldtype\BaseType;
/**
* UserprofileController provides manipulation of the user's profile fields & categories.
- *
+ *
* @since 0.5
*/
class UserProfileController extends Controller
@@ -40,7 +40,10 @@ class UserProfileController extends Controller
return parent::init();
}
- public static function getAccessRules()
+ /**
+ * @inheritdoc
+ */
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\ManageUsers::className()]
diff --git a/protected/humhub/modules/admin/messages/ru/views_setting_authentication_ldap.php b/protected/humhub/modules/admin/messages/ru/views_setting_authentication_ldap.php
index 3c5a349d7f..e6c278a8a2 100644
--- a/protected/humhub/modules/admin/messages/ru/views_setting_authentication_ldap.php
+++ b/protected/humhub/modules/admin/messages/ru/views_setting_authentication_ldap.php
@@ -2,7 +2,7 @@
/**
* Message translations.
*
- * This file is automatically generated by 'yii message/extract' command.
+ * This file is automatically generated by 'yii message/extract-module' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
@@ -17,11 +17,12 @@
* NOTE: this file must be saved in UTF-8 encoding.
*/
return [
+ 'Specify your LDAP-backend used to fetch user accounts.' => 'Задайте настройки LDAP-сервера, который будет использоваться для извлечения учетных записей пользователей.',
'A TLS/SSL is strongly favored in production environments to prevent passwords from be transmitted in clear text.' => 'Рекомендуется использовать TLS/SSL шифрование на реальных проектах, чтобы защититься от передачи паролей в открытом виде.',
'Defines the filter to apply, when login is attempted. %s replaces the username in the login action. Example: "(sAMAccountName=%s)" or "(uid=%s)"' => 'Задает фильтр, который должен применяться при попытке входа. %s заменяет имя пользователя во время логина. Например: "(sAMAccountName=%s)" или "(uid=%s)"',
'LDAP Attribute for E-Mail Address. Default: "mail"' => 'LDAP Атрибут для E-Mail адреса. По умолчанию: "mail"',
- 'LDAP Attribute for Username. Example: "uid" or "sAMAccountName"' => 'LDAP Атрибут для Логина. Пример: & quotuid & Quot; или & Quot; sAMAccountName"',
- 'Limit access to users meeting this criteria. Example: "(objectClass=posixAccount)" or "(&(objectClass=person)(memberOf=CN=Workers,CN=Users,DC=myDomain,DC=com))"' => 'Ограничить доступ к пользователям с указанными критериями. Example: "(objectClass=posixAccount)" or "(&(objectClass=person)(memberOf=CN=Workers,CN=Users,DC=myDomain,DC=com))"',
+ 'LDAP Attribute for Username. Example: "uid" or "sAMAccountName"' => 'LDAP Атрибут для Логина. Например: "uid" или "sAMAccountName"',
+ 'Limit access to users meeting this criteria. Example: "(objectClass=posixAccount)" or "(&(objectClass=person)(memberOf=CN=Workers,CN=Users,DC=myDomain,DC=com))"' => 'Ограничить доступ к пользователям с указанными критериями. Например: "(objectClass=posixAccount)" or "(&(objectClass=person)(memberOf=CN=Workers,CN=Users,DC=myDomain,DC=com))"',
'Save' => 'Сохранить',
'Status: Error! (Message: {message})' => 'Статус: Ошибка! (Текст ошибки: {message})',
'Status: OK! ({userCount} Users)' => 'Статус: OK! ({userCount} Пользователей)',
diff --git a/protected/humhub/modules/admin/views/authentication/authentication_ldap.php b/protected/humhub/modules/admin/views/authentication/authentication_ldap.php
index ae15c1dc8a..f86079112e 100644
--- a/protected/humhub/modules/admin/views/authentication/authentication_ldap.php
+++ b/protected/humhub/modules/admin/views/authentication/authentication_ldap.php
@@ -1,67 +1,77 @@
beginContent('@admin/views/authentication/_authenticationLayout.php') ?>
-
Specify your LDAP-backend used to fetch user accounts.
+
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'Specify your LDAP-backend used to fetch user accounts.') ?>
+
$errorMessage)); ?>
+ class="alert alert-danger">= Yii::t('AdminModule.views_setting_authentication_ldap', 'Status: Error! (Message: {message})', array('{message}' => $errorMessage)); ?>
$userCount)); ?>
+ class="alert alert-success">= Yii::t('AdminModule.views_setting_authentication_ldap', 'Status: OK! ({userCount} Users)', array('{userCount}' => $userCount)); ?>
'authentication-settings-form']); ?>
- field($model, 'enabled')->checkbox(['readonly' => Setting::IsFixed('auth.ldap.enabled', 'user')]); ?>
+ = $form->field($model, 'enabled')->checkbox(['readonly' => Setting::IsFixed('auth.ldap.enabled', 'user')]); ?>
- field($model, 'hostname')->textInput(['readonly' => Setting::IsFixed('auth.ldap.hostname', 'user')]); ?>
+ = $form->field($model, 'hostname')->textInput(['readonly' => Setting::IsFixed('auth.ldap.hostname', 'user')]); ?>
- field($model, 'port')->textInput(['readonly' => Setting::IsFixed('auth.ldap.port', 'user')]); ?>
+ = $form->field($model, 'port')->textInput(['readonly' => Setting::IsFixed('auth.ldap.port', 'user')]); ?>
- field($model, 'encryption')->dropDownList($model->encryptionTypes, ['readonly' => Setting::IsFixed('auth.ldap.encryption', 'user')]); ?>
-
+ = $form->field($model, 'encryption')->dropDownList($model->encryptionTypes, ['readonly' => Setting::IsFixed('auth.ldap.encryption', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'A TLS/SSL is strongly favored in production environments to prevent passwords from be transmitted in clear text.'); ?>
- field($model, 'username')->textInput(['readonly' => Setting::IsFixed('auth.ldap.username', 'user')]); ?>
-
+ = $form->field($model, 'username')->textInput(['readonly' => Setting::IsFixed('auth.ldap.username', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'The default credentials username. Some servers require that this be in DN form. This must be given in DN form if the LDAP server requires a DN to bind and binding should be possible with simple usernames.'); ?>
- field($model, 'password')->passwordInput(['readonly' => Setting::IsFixed('auth.ldap.password', 'user')]); ?>
-
+ = $form->field($model, 'password')->passwordInput(['readonly' => Setting::IsFixed('auth.ldap.password', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'The default credentials password (used only with username above).'); ?>
- field($model, 'baseDn')->textInput(['readonly' => Setting::IsFixed('auth.ldap.baseDn', 'user')]); ?>
-
+ = $form->field($model, 'baseDn')->textInput(['readonly' => Setting::IsFixed('auth.ldap.baseDn', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'The default base DN used for searching for accounts.'); ?>
- field($model, 'loginFilter')->textInput(['readonly' => Setting::IsFixed('auth.ldap.loginFilter', 'user')]); ?>
-
+ = $form->field($model, 'loginFilter')->textInput(['readonly' => Setting::IsFixed('auth.ldap.loginFilter', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'Defines the filter to apply, when login is attempted. %s replaces the username in the login action. Example: "(sAMAccountName=%s)" or "(uid=%s)"'); ?>
- field($model, 'userFilter')->textInput(['readonly' => Setting::IsFixed('auth.ldap.userFilter', 'user')]); ?>
-
+ = $form->field($model, 'userFilter')->textInput(['readonly' => Setting::IsFixed('auth.ldap.userFilter', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'Limit access to users meeting this criteria. Example: "(objectClass=posixAccount)" or "(&(objectClass=person)(memberOf=CN=Workers,CN=Users,DC=myDomain,DC=com))"'); ?>
- field($model, 'usernameAttribute')->textInput(['readonly' => Setting::IsFixed('auth.ldap.usernameAttribute', 'user')]); ?>
-
+ = $form->field($model, 'usernameAttribute')->textInput(['readonly' => Setting::IsFixed('auth.ldap.usernameAttribute', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'LDAP Attribute for Username. Example: "uid" or "sAMAccountName"'); ?>
- field($model, 'emailAttribute')->textInput(['readonly' => Setting::IsFixed('auth.ldap.emailAttribute', 'user')]); ?>
-
+ = $form->field($model, 'emailAttribute')->textInput(['readonly' => Setting::IsFixed('auth.ldap.emailAttribute', 'user')]); ?>
+ = Yii::t('AdminModule.views_setting_authentication_ldap', 'LDAP Attribute for E-Mail Address. Default: "mail"'); ?>
- field($model, 'refreshUsers')->checkbox(['readonly' => Setting::IsFixed('auth.ldap.refreshUsers', 'user')]); ?>
+ = $form->field($model, 'refreshUsers')->checkbox(['readonly' => Setting::IsFixed('auth.ldap.refreshUsers', 'user')]); ?>
- 'btn btn-primary', 'data-ui-loader' => "")); ?>
+ = Html::submitButton(Yii::t('AdminModule.views_setting_authentication_ldap', 'Save'),
+ ['class' => 'btn btn-primary', 'data-ui-loader' => ""]); ?>
-
+ = \humhub\widgets\DataSaved::widget(); ?>
-endContent(); ?>
\ No newline at end of file
+endContent(); ?>
diff --git a/protected/humhub/modules/file/libs/ImageConverter.php b/protected/humhub/modules/file/libs/ImageConverter.php
index 2d2305ffc5..1e085e7b8c 100644
--- a/protected/humhub/modules/file/libs/ImageConverter.php
+++ b/protected/humhub/modules/file/libs/ImageConverter.php
@@ -114,6 +114,12 @@ class ImageConverter
list ($width, $height) = getimagesize($sourceFile);
// get defined memory limit from php_ini
$memoryLimit = ini_get('memory_limit');
+
+ // No memory limit set
+ if ($memoryLimit == -1) {
+ return;
+ }
+
// calc needed size for processing image dimensions in Bytes.
$neededMemory = floor(($width * $height * $bytesPerPixel * $tweakFactor + 1048576) / 1048576);
$maxMemoryAllocation = Yii::$app->getModule('file')->settings->get(self::SETTINGS_NAME_MAX_MEMORY_ALLOCATION);
diff --git a/protected/humhub/modules/notification/controllers/AdminController.php b/protected/humhub/modules/notification/controllers/AdminController.php
index 327f642132..9d0f3b48ae 100644
--- a/protected/humhub/modules/notification/controllers/AdminController.php
+++ b/protected/humhub/modules/notification/controllers/AdminController.php
@@ -19,11 +19,11 @@ use humhub\modules\notification\models\forms\NotificationSettings;
* @author Luke
*/
class AdminController extends Controller
-{
+{
/**
* @inheritdoc
*/
- public static function getAccessRules()
+ public function getAccessRules()
{
return [
['permissions' => \humhub\modules\admin\permissions\ManageSettings::className()]
@@ -33,7 +33,7 @@ class AdminController extends Controller
public function actionDefaults()
{
$this->subLayout = '@admin/views/layouts/setting';
-
+
$form = new NotificationSettings();
if ($form->load(Yii::$app->request->post()) && $form->save()) {
$this->view->saved();
diff --git a/protected/humhub/modules/notification/models/Notification.php b/protected/humhub/modules/notification/models/Notification.php
index 88c6ab0491..22cc7a81e6 100644
--- a/protected/humhub/modules/notification/models/Notification.php
+++ b/protected/humhub/modules/notification/models/Notification.php
@@ -27,7 +27,7 @@ class Notification extends \humhub\components\ActiveRecord
* @var int number of found grouped notifications
*/
public $group_count;
-
+
/*
* @var int number of involved users of grouped notifications
*/
@@ -95,7 +95,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Returns the business model of this notification
- *
+ *
* @return \humhub\modules\notification\components\BaseNotification
*/
public function getBaseModel($params = [])
@@ -111,7 +111,7 @@ class Notification extends \humhub\components\ActiveRecord
->andWhere(['class' => $this->class, 'user_id' => $this->user_id, 'group_key' => $this->group_key])
->one();
$params['originator'] = $params['record']->originator;
-
+
} else {
$params['record'] = $this;
}
@@ -141,7 +141,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Returns space of this notification
- *
+ *
* @deprecated since version 1.1
* @return type
*/
@@ -152,7 +152,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Returns polymorphic relation linked with this notification
- *
+ *
* @return \humhub\components\ActiveRecord
*/
public function getSourceObject()
@@ -166,7 +166,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Returns all available notifications of a module identified by its modulename.
- *
+ *
* @return array with format [moduleId => notifications[]]
*/
public static function getModuleNotifications()
@@ -196,7 +196,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Loads a certain amount ($limit) of grouped notifications from a given id set by $from.
- *
+ *
* @param integer $from notificatoin id which was the last loaded entry.
* @param limit $limit limit count of results.
* @since 1.2
@@ -217,7 +217,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Finds grouped notifications if $sendWebNotifications is set to 1 we filter only notifications
* with send_web_notifications setting to 1.
- *
+ *
* @return \yii\db\ActiveQuery
*/
public static function findGrouped(User $user = null, $sendWebNotifications = 1)
@@ -235,7 +235,24 @@ class Notification extends \humhub\components\ActiveRecord
$query->andWhere(['user_id' => $user->id]);
$query->andWhere(['send_web_notifications' => $sendWebNotifications]);
- $query->addGroupBy(['COALESCE(group_key, id)', 'class']);
+ $query->addGroupBy([
+ 'COALESCE(group_key, id)',
+ 'id',
+ 'class',
+ 'user_id',
+ 'notification.user_id',
+ 'notification.seen',
+ 'notification.source_class',
+ 'notification.source_pk',
+ 'notification.space_id',
+ 'notification.emailed',
+ 'notification.created_at',
+ 'notification.desktop_notified',
+ 'notification.originator_user_id',
+ 'notification.module',
+ 'notification.group_key',
+ 'notification.send_web_notifications',
+ ]);
$query->orderBy(['group_seen' => SORT_ASC, 'group_created_at' => SORT_DESC]);
return $query;
@@ -244,7 +261,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Finds all grouped unseen notifications for the given user or the current loggedIn user
* if no User instance is provided.
- *
+ *
* @param \humhub\modules\notification\models\User $user
* @since 1.2
*/
@@ -257,7 +274,7 @@ class Notification extends \humhub\components\ActiveRecord
/**
* Finds all grouped unseen notifications which were not already sent to the frontend.
- *
+ *
* @param \humhub\modules\notification\models\User $user
* @since 1.2
*/
diff --git a/protected/humhub/modules/user/components/BaseAccountController.php b/protected/humhub/modules/user/components/BaseAccountController.php
index 478ee1cb7a..8215a1d8af 100644
--- a/protected/humhub/modules/user/components/BaseAccountController.php
+++ b/protected/humhub/modules/user/components/BaseAccountController.php
@@ -20,13 +20,25 @@ use humhub\components\behaviors\AccessControl;
class BaseAccountController extends \humhub\components\Controller
{
+ /**
+ * @inheritdoc
+ */
public $subLayout = "@humhub/modules/user/views/account/_layout";
- public function init() {
+ /**
+ * @var \humhub\modules\user\models\User the user
+ */
+ public $user;
+
+ /**
+ * @inheritdoc
+ */
+ public function init()
+ {
$this->appendPageTitle(\Yii::t('UserModule.base', 'My Account'));
return parent::init();
}
-
+
/**
* @inheritdoc
*/
@@ -46,7 +58,11 @@ class BaseAccountController extends \humhub\components\Controller
*/
public function getUser()
{
- return Yii::$app->user->getIdentity();
+ if ($this->user === null) {
+ $this->user = Yii::$app->user->getIdentity();
+ }
+
+ return $this->user;
}
}
diff --git a/protected/humhub/modules/user/controllers/AccountController.php b/protected/humhub/modules/user/controllers/AccountController.php
index d3b08db204..1577a30e44 100644
--- a/protected/humhub/modules/user/controllers/AccountController.php
+++ b/protected/humhub/modules/user/controllers/AccountController.php
@@ -13,6 +13,8 @@ use yii\web\HttpException;
use humhub\modules\user\components\BaseAccountController;
use humhub\modules\user\models\User;
use humhub\modules\notification\models\forms\NotificationSettings;
+use humhub\modules\user\controllers\ImageController;
+
/**
* AccountController provides all standard actions for the current logged in
* user account.
@@ -23,6 +25,9 @@ use humhub\modules\notification\models\forms\NotificationSettings;
class AccountController extends BaseAccountController
{
+ /**
+ * @inheritdoc
+ */
public function init()
{
$this->setActionTitles([
@@ -213,7 +218,7 @@ class AccountController extends BaseAccountController
if (!$user->isModuleEnabled($moduleId)) {
$user->enableModule($moduleId);
}
-
+
if (!Yii::$app->request->isAjax) {
return $this->redirect(['/user/account/edit-modules']);
} else {
@@ -233,7 +238,7 @@ class AccountController extends BaseAccountController
$user->disableModule($moduleId);
}
- if (!Yii::$app->request->isAjax) {
+ if (!Yii::$app->request->isAjax) {
return $this->redirect(['/user/account/edit-modules']);
} else {
Yii::$app->response->format = 'json';
@@ -366,129 +371,57 @@ class AccountController extends BaseAccountController
/**
* Crops the banner image of the user
+ * @deprecated since version 1.2
*/
public function actionCropBannerImage()
{
- $model = new \humhub\models\forms\CropProfileImage();
- $profileImage = new \humhub\libs\ProfileBannerImage($this->getUser()->guid);
-
- if ($model->load(Yii::$app->request->post()) && $model->validate()) {
- $profileImage->cropOriginal($model->cropX, $model->cropY, $model->cropH, $model->cropW);
- return $this->htmlRedirect($this->getUser()->getUrl());
- }
-
- return $this->renderAjax('cropBannerImage', ['model' => $model, 'profileImage' => $profileImage, 'user' => $this->getUser()]);
+ return Yii::$app->runAction('/user/image/crop', ['type' => ImageController::TYPE_PROFILE_BANNER_IMAGE]);
}
/**
* Handle the banner image upload
+ *
+ * @deprecated since version 1.2
*/
public function actionBannerImageUpload()
{
- \Yii::$app->response->format = 'json';
-
- $model = new \humhub\models\forms\UploadProfileImage();
- $json = array();
-
- $files = \yii\web\UploadedFile::getInstancesByName('bannerfiles');
- $file = $files[0];
- $model->image = $file;
-
- if ($model->validate()) {
- $profileImage = new \humhub\libs\ProfileBannerImage($this->getUser()->guid);
- $profileImage->setNew($model->image);
-
- $json['error'] = false;
- $json['name'] = "";
- $json['url'] = $profileImage->getUrl();
- $json['size'] = $model->image->size;
- $json['deleteUrl'] = "";
- $json['deleteType'] = "";
- } else {
- $json['error'] = true;
- $json['errors'] = $model->getErrors();
+ // Ensure view file backward compatibility prior 1.2
+ if (isset($_FILES['bannerfiles'])) {
+ $_FILES['images'] = $_FILES['bannerfiles'];
}
-
- return ['files' => $json];
+ return Yii::$app->runAction('/user/image/upload', ['type' => ImageController::TYPE_PROFILE_BANNER_IMAGE]);
}
/**
* Handle the profile image upload
+ *
+ * @deprecated since version 1.2
*/
public function actionProfileImageUpload()
{
- \Yii::$app->response->format = 'json';
-
- $model = new \humhub\models\forms\UploadProfileImage();
-
- $json = array();
-
- $files = \yii\web\UploadedFile::getInstancesByName('profilefiles');
- $file = $files[0];
- $model->image = $file;
-
- if ($model->validate()) {
-
- $json['error'] = false;
-
- $profileImage = new \humhub\libs\ProfileImage($this->getUser()->guid);
- $profileImage->setNew($model->image);
-
- $json['name'] = "";
- $json['url'] = $profileImage->getUrl();
- $json['size'] = $model->image->size;
- $json['deleteUrl'] = "";
- $json['deleteType'] = "";
- } else {
- $json['error'] = true;
- $json['errors'] = $model->getErrors();
+ // Ensure view file backward compatibility prior 1.2
+ if (isset($_FILES['profilefiles'])) {
+ $_FILES['images'] = $_FILES['profilefiles'];
}
-
- return array('files' => $json);
+ return Yii::$app->runAction('/user/image/upload', ['type' => ImageController::TYPE_PROFILE_IMAGE]);
}
/**
* Crops the profile image of the user
+ * @deprecated since version 1.2
*/
public function actionCropProfileImage()
{
- $model = new \humhub\models\forms\CropProfileImage();
- $profileImage = new \humhub\libs\ProfileImage($this->getUser()->guid);
-
- if ($model->load(Yii::$app->request->post()) && $model->validate()) {
- $profileImage->cropOriginal($model->cropX, $model->cropY, $model->cropH, $model->cropW);
- return $this->htmlRedirect($this->getUser()->getUrl());
- }
-
- return $this->renderAjax('cropProfileImage', array('model' => $model, 'profileImage' => $profileImage, 'user' => $this->getUser()));
+ return Yii::$app->runAction('/user/image/crop', ['type' => ImageController::TYPE_PROFILE_IMAGE]);
}
/**
* Deletes the profile image or profile banner
+ * @deprecated since version 1.2
*/
public function actionDeleteProfileImage()
{
- \Yii::$app->response->format = 'json';
-
- $this->forcePostRequest();
-
- $type = Yii::$app->request->get('type', 'profile');
-
- $json = array('type' => $type);
-
- $image = null;
- if ($type == 'profile') {
- $image = new \humhub\libs\ProfileImage($this->getUser()->guid);
- } elseif ($type == 'banner') {
- $image = new \humhub\libs\ProfileBannerImage($this->getUser()->guid);
- }
-
- if ($image) {
- $image->delete();
- $json['defaultUrl'] = $image->getUrl();
- }
-
- return $json;
+ return Yii::$app->runAction('/user/image/delete', ['type' => (Yii::$app->request->get('type', 'profile') == 'profile') ? ImageController::TYPE_PROFILE_IMAGE : ImageController::TYPE_PROFILE_BANNER_IMAGE]);
}
/**
diff --git a/protected/humhub/modules/user/controllers/ImageController.php b/protected/humhub/modules/user/controllers/ImageController.php
new file mode 100644
index 0000000000..36e30d9917
--- /dev/null
+++ b/protected/humhub/modules/user/controllers/ImageController.php
@@ -0,0 +1,198 @@
+user->isGuest) {
+ if (Yii::$app->user->getIdentity()->isSystemAdmin() && Yii::$app->getModule('user')->adminCanChangeUserProfileImages) {
+ $this->allowModifyProfileBanner = true;
+ $this->allowModifyProfileImage = true;
+ } elseif (Yii::$app->user->getIdentity()->id == $this->getUser()->id) {
+ $this->allowModifyProfileBanner = true;
+ $this->allowModifyProfileImage = true;
+ }
+ }
+
+ // Make sure to execute this on the end of initialization, to allow events
+ // to modify the attributes (e.g. allowModifyProfileImage)
+ parent::init();
+ }
+
+ /**
+ * Uploads a new image
+ *
+ * @param string $type
+ * @return \yii\web\Response the response
+ */
+ public function actionUpload($type)
+ {
+ $model = new UploadProfileImage();
+
+ $files = UploadedFile::getInstancesByName('images');
+ if (isset($files[0])) {
+ $model->image = $files[0];
+ }
+
+ if (!$model->validate()) {
+ return $this->asJson(['files' => [
+ 'error' => true,
+ 'errors' => $model->getErrors()
+ ]]);
+ }
+
+ $image = $this->getProfileImage($type);
+ $image->setNew($model->image);
+
+ return $this->asJson(['files' => [
+ 'name' => '',
+ 'deleteUrl' => '',
+ 'deleteType' => '',
+ 'size' => $model->image->size,
+ 'url' => $image->getUrl(),
+ ]]);
+ }
+
+ /**
+ * Crops a image
+ *
+ * @param string $type
+ * @return \yii\web\Response the response
+ */
+ public function actionCrop($type)
+ {
+ $model = new CropProfileImage();
+
+ if ($type == static::TYPE_PROFILE_IMAGE) {
+ $title = Yii::t('UserModule.account', 'Modify your profile image');
+ } elseif ($type == static::TYPE_PROFILE_BANNER_IMAGE) {
+ $title = Yii::t('UserModule.account', 'Modify your title image');
+ $model->aspectRatio = '6.3';
+ $model->cropSetSelect = [0, 0, 267, 48];
+ }
+
+ $image = $this->getProfileImage($type);
+ if ($model->load(Yii::$app->request->post()) && $model->validate()) {
+ $image->cropOriginal($model->cropX, $model->cropY, $model->cropH, $model->cropW);
+ return $this->htmlRedirect($this->getUser()->getUrl());
+ }
+
+ return $this->renderAjax('crop', [
+ 'model' => $model,
+ 'profileImage' => $image,
+ 'user' => $this->getUser(),
+ 'type' => $type,
+ 'title' => $title,
+ ]);
+ }
+
+ /**
+ * Delete an image
+ *
+ * @param string $type
+ * @return \yii\web\Response the response
+ */
+ public function actionDelete($type)
+ {
+ Yii::$app->response->format = 'json';
+
+ $this->forcePostRequest();
+
+ $image = $this->getProfileImage($type);
+ $image->delete();
+
+ return $this->asJson([
+ 'type' => $type,
+ 'defaultUrl' => $image->getUrl()
+ ]);
+ }
+
+ /**
+ * Returns the Profile Image
+ *
+ * @param string $type
+ * @return ProfileImage|ProfileBannerImage
+ * @throws HttpException
+ */
+ protected function getProfileImage($type)
+ {
+ if ($type == static::TYPE_PROFILE_IMAGE) {
+ if (!$this->allowModifyProfileImage) {
+ throw new HttpException(403, 'Access denied!');
+ }
+ return new ProfileImage($this->getUser()->guid);
+ } elseif ($type == static::TYPE_PROFILE_BANNER_IMAGE) {
+ if (!$this->allowModifyProfileBanner) {
+ throw new HttpException(403, 'Access denied!');
+ }
+ return new ProfileBannerImage($this->getUser()->guid);
+ } else {
+ throw new HttpException(400, 'Invalid image type given!');
+ }
+ }
+
+ /**
+ * Returns the current user of this account
+ *
+ * An administration can also pass a user id via GET parameter to change users
+ * accounts settings.
+ *
+ * @return User the user
+ */
+ public function getUser()
+ {
+ if ($this->user === null && Yii::$app->request->get('userGuid') != '' && Yii::$app->user->getIdentity()->isSystemAdmin()) {
+ $user = User::findOne(['guid' => Yii::$app->request->get('userGuid')]);
+ if ($user === null) {
+ throw new HttpException(404, 'Could not find user!');
+ }
+ $this->user = $user;
+ }
+
+ return parent::getUser();
+ }
+
+}
diff --git a/protected/humhub/modules/user/views/account/cropProfileImage.php b/protected/humhub/modules/user/views/account/cropProfileImage.php
deleted file mode 100644
index 5c3f62e7fb..0000000000
--- a/protected/humhub/modules/user/views/account/cropProfileImage.php
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
- 'profile-crop-image-form']); ?>
- errorSummary($model); ?>
- hiddenField($model, 'cropX', ['id' => 'cropX']); ?>
- hiddenField($model, 'cropY', ['id' => 'cropY']); ?>
- hiddenField($model, 'cropW', ['id' => 'cropW']); ?>
- hiddenField($model, 'cropH', ['id' => 'cropH']); ?>
-
-
-
-
-
-
-
- getUrl('_org'), ['id' => 'foobar']);
-
- echo raoul2000\jcrop\JCropWidget::widget([
- 'selector' => '#foobar',
- 'pluginOptions' => [
- 'aspectRatio' => 1,
- 'minSize' => [50, 50],
- //'maxSize' => [200, 200],
- 'setSelect' => [0, 0, 100, 100],
- 'bgColor' => 'black',
- 'bgOpacity' => '0.5',
- 'boxWidth' => '440',
- 'onChange' => new yii\web\JsExpression('function(c){ $("#cropX").val(c.x);$("#cropY").val(c.y);$("#cropW").val(c.w);$("#cropH").val(c.h); }')
- ]
- ]);
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/protected/humhub/modules/user/views/account/cropBannerImage.php b/protected/humhub/modules/user/views/image/crop.php
similarity index 86%
rename from protected/humhub/modules/user/views/account/cropBannerImage.php
rename to protected/humhub/modules/user/views/image/crop.php
index 8b9512698b..813c1b0afc 100644
--- a/protected/humhub/modules/user/views/account/cropBannerImage.php
+++ b/protected/humhub/modules/user/views/image/crop.php
@@ -14,19 +14,14 @@ use yii\helpers\Url;
-
@@ -36,10 +31,9 @@ use yii\helpers\Url;
echo raoul2000\jcrop\JCropWidget::widget([
'selector' => '#foobar',
'pluginOptions' => [
- 'aspectRatio' => '6.3',
+ 'aspectRatio' => $model->aspectRatio,
'minSize' => [50, 50],
- //'maxSize' => [200, 200],
- 'setSelect' => [0, 0, 267, 48],
+ 'setSelect' => $model->cropSetSelect,
'bgColor' => 'black',
'boxWidth' => '440',
'bgOpacity' => '0.5',
@@ -59,7 +53,7 @@ use yii\helpers\Url;
'type' => 'POST',
'beforeSend' => new yii\web\JsExpression('function(){ setModalLoader(); }'),
'success' => new yii\web\JsExpression('function(html){ $("#globalModal").html(html); }'),
- 'url' => Url::to(['/user/account/crop-banner-image', 'userGuid' => $user->guid]),
+ 'url' => Url::to(['/user/image/crop', 'userGuid' => $user->guid, 'type' => $type]),
],
'htmlOptions' => [
'class' => 'btn btn-primary'
diff --git a/protected/humhub/modules/user/widgets/ProfileHeader.php b/protected/humhub/modules/user/widgets/ProfileHeader.php
index 58ce3f0bc3..25a56264f4 100644
--- a/protected/humhub/modules/user/widgets/ProfileHeader.php
+++ b/protected/humhub/modules/user/widgets/ProfileHeader.php
@@ -2,7 +2,7 @@
/**
* @link https://www.humhub.org/
- * @copyright Copyright (c) 2016 HumHub GmbH & Co. KG
+ * @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
@@ -13,6 +13,7 @@ use humhub\modules\space\models\Space;
use humhub\modules\user\models\User;
use humhub\modules\space\models\Membership;
use humhub\modules\friendship\models\Friendship;
+use humhub\modules\user\controllers\ImageController;
/**
* Displays the profile header of a user
@@ -45,13 +46,8 @@ class ProfileHeader extends \yii\base\Widget
$this->user = $this->getController()->getUser();
}
- // Check if profile header can be edited
- if (!Yii::$app->user->isGuest) {
- if (Yii::$app->user->getIdentity()->isSystemAdmin() && Yii::$app->getModule('user')->adminCanChangeUserProfileImages) {
- $this->isProfileOwner = true;
- } elseif (Yii::$app->user->id == $this->user->id) {
- $this->isProfileOwner = true;
- }
+ if (!Yii::$app->user->isGuest && Yii::$app->user->id == $this->user->id) {
+ $this->isProfileOwner = true;
}
parent::init();
@@ -71,10 +67,8 @@ class ProfileHeader extends \yii\base\Widget
$countFollowing = $this->user->getFollowingCount(User::className());
- $countUserSpaces = Membership::getUserSpaceQuery($this->user)
- ->andWhere(['!=', 'space.visibility', Space::VISIBILITY_NONE])
- ->andWhere(['space.status' => Space::STATUS_ENABLED])
- ->count();
+ /* @var $imageController ImageController */
+ $imageController = new ImageController('image-controller', null, ['user' => $this->user]);
return $this->render('profileHeader', array(
'user' => $this->user,
@@ -83,10 +77,25 @@ class ProfileHeader extends \yii\base\Widget
'countFriends' => $countFriends,
'countFollowers' => $this->user->getFollowerCount(),
'countFollowing' => $countFollowing,
- 'countSpaces' => $countUserSpaces,
+ 'countSpaces' => $this->getFollowingSpaceCount(),
+ 'allowModifyProfileImage' => $imageController->allowModifyProfileImage,
+ 'allowModifyProfileBanner' => $imageController->allowModifyProfileBanner,
));
}
+ /**
+ * Returns the number of followed public space
+ *
+ * @return int the follow count
+ */
+ protected function getFollowingSpaceCount()
+ {
+ return Membership::getUserSpaceQuery($this->user)
+ ->andWhere(['!=', 'space.visibility', Space::VISIBILITY_NONE])
+ ->andWhere(['space.status' => Space::STATUS_ENABLED])
+ ->count();
+ }
+
}
?>
diff --git a/protected/humhub/modules/user/widgets/views/profileHeader.php b/protected/humhub/modules/user/widgets/views/profileHeader.php
index 48062c1935..e1c252baea 100644
--- a/protected/humhub/modules/user/widgets/views/profileHeader.php
+++ b/protected/humhub/modules/user/widgets/views/profileHeader.php
@@ -2,13 +2,14 @@
use yii\helpers\Html;
use yii\helpers\Url;
+use humhub\modules\user\controllers\ImageController;
-if ($isProfileOwner) {
+if ($allowModifyProfileBanner || $allowModifyProfileImage) {
$this->registerJsFile('@web-static/resources/user/profileHeaderImageUpload.js');
$this->registerJs("var profileImageUploaderUserGuid='" . $user->guid . "';", \yii\web\View::POS_BEGIN);
$this->registerJs("var profileImageUploaderCurrentUserGuid='" . Yii::$app->user->getIdentity()->guid . "';", \yii\web\View::POS_BEGIN);
- $this->registerJs("var profileImageUploaderUrl='" . Url::to(['/user/account/profile-image-upload', 'userGuid' => $user->guid]) . "';", \yii\web\View::POS_BEGIN);
- $this->registerJs("var profileHeaderUploaderUrl='" . Url::to(['/user/account/banner-image-upload', 'userGuid' => $user->guid]) . "';", \yii\web\View::POS_BEGIN);
+ $this->registerJs("var profileImageUploaderUrl='" . Url::to(['/user/image/upload', 'userGuid' => $user->guid, 'type' => ImageController::TYPE_PROFILE_IMAGE]) . "';", \yii\web\View::POS_BEGIN);
+ $this->registerJs("var profileHeaderUploaderUrl='" . Url::to(['/user/image/upload', 'userGuid' => $user->guid, 'type' => ImageController::TYPE_PROFILE_BANNER_IMAGE]) . "';", \yii\web\View::POS_BEGIN);
}
?>
@@ -22,10 +23,10 @@ if ($isProfileOwner) {
width="100%" style="width: 100%; max-height: 192px;">
-
+
-
+