diff --git a/protected/humhub/components/Controller.php b/protected/humhub/components/Controller.php
index 83eb7c0899..326a9a54ba 100644
--- a/protected/humhub/components/Controller.php
+++ b/protected/humhub/components/Controller.php
@@ -13,6 +13,7 @@ use humhub\components\behaviors\AccessControl;
use Yii;
use yii\helpers\Url;
use yii\helpers\Html;
+use yii\web\ForbiddenHttpException;
/**
* Base Controller
@@ -169,7 +170,7 @@ class Controller extends \yii\web\Controller
*/
protected function forbidden()
{
- throw new \yii\web\ForbiddenHttpException(Yii::t('error', 'You are not allowed to perform this action.'));
+ throw new ForbiddenHttpException(Yii::t('error', 'You are not allowed to perform this action.'));
}
/**
@@ -273,12 +274,11 @@ class Controller extends \yii\web\Controller
* This is required for some modules in pjax mode.
*
* @since 1.2
- * @param type $url
*/
public function setJsViewStatus()
{
- $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);
+ $moduleId = (Yii::$app->controller->module) ? Yii::$app->controller->module->id : '';
+ $this->view->registerJs('humhub.modules.ui.view.setState("' . $moduleId . '", "' . Yii::$app->controller->id . '", "' . Yii::$app->controller->action->id . '");', \yii\web\View::POS_BEGIN);
if (Yii::$app->request->isPjax) {
\humhub\widgets\TopMenu::setViewState();
diff --git a/protected/humhub/components/SocialActivity.php b/protected/humhub/components/SocialActivity.php
index a30ca19e49..6acc183edb 100644
--- a/protected/humhub/components/SocialActivity.php
+++ b/protected/humhub/components/SocialActivity.php
@@ -98,7 +98,7 @@ abstract class SocialActivity extends \yii\base\Object implements rendering\View
/**
* Builder function for the originator.
*
- * @param type $originator
+ * @param User $originator
* @return \humhub\components\SocialActivity
*/
public function from($originator)
diff --git a/protected/humhub/components/access/ActionAccessValidator.php b/protected/humhub/components/access/ActionAccessValidator.php
index d519e4b6be..df97a9608c 100644
--- a/protected/humhub/components/access/ActionAccessValidator.php
+++ b/protected/humhub/components/access/ActionAccessValidator.php
@@ -64,7 +64,7 @@ abstract class ActionAccessValidator extends AccessValidator
}
/**
- * Filters our rules not related to the current validator and action.
+ * Filters out rules not related to the current validator and action.
*
* @param array|null $rules
* @return array
diff --git a/protected/humhub/components/access/PermissionAccessValidator.php b/protected/humhub/components/access/PermissionAccessValidator.php
index 101594c74b..1db8be4a15 100644
--- a/protected/humhub/components/access/PermissionAccessValidator.php
+++ b/protected/humhub/components/access/PermissionAccessValidator.php
@@ -41,7 +41,7 @@ class PermissionAccessValidator extends ActionAccessValidator
/**
* Checks if the user has the given $permission.
*
- * @param string|string[]|BasePermission $permission
+ * @param string|string[]| \humhub\libs\BasePermission $permission
* @param array $params
* @param array $rule
* @return bool true if the given $permission is granted
diff --git a/protected/humhub/modules/admin/components/Controller.php b/protected/humhub/modules/admin/components/Controller.php
index 796d31db9d..558c214739 100644
--- a/protected/humhub/modules/admin/components/Controller.php
+++ b/protected/humhub/modules/admin/components/Controller.php
@@ -71,7 +71,7 @@ class Controller extends \humhub\components\Controller
// 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()]
+ ['permission' => \humhub\modules\admin\permissions\ManageModules::className()]
];
}
diff --git a/protected/humhub/modules/mobile/Events.php b/protected/humhub/modules/mobile/Events.php
deleted file mode 100644
index da1bdbfc12..0000000000
--- a/protected/humhub/modules/mobile/Events.php
+++ /dev/null
@@ -1,38 +0,0 @@
-sender->addItem([
- 'label' => Yii::t('MobileModule.base', 'Devices'),
- 'id' => 'directory',
- 'icon' => '',
- 'url' => Url::to(['/mobile/settings']),
- 'sortOrder' => 500,
- 'isActive' => Yii::$app->controller->module === 'mobile',
- ]);
- }
-}
\ No newline at end of file
diff --git a/protected/humhub/modules/mobile/Module.php b/protected/humhub/modules/mobile/Module.php
deleted file mode 100644
index 6365cb4074..0000000000
--- a/protected/humhub/modules/mobile/Module.php
+++ /dev/null
@@ -1,79 +0,0 @@
-user->isAdmin()) {
- return [];
- }
-
- return [];
- }
-
-}
diff --git a/protected/humhub/modules/mobile/assets/MobileAsset.php b/protected/humhub/modules/mobile/assets/MobileAsset.php
deleted file mode 100644
index b852b90b01..0000000000
--- a/protected/humhub/modules/mobile/assets/MobileAsset.php
+++ /dev/null
@@ -1,33 +0,0 @@
- true
- ];
-
- public $sourcePath = '@mobile/resources';
- public $css = [];
- public $js = [
- 'js/humhub.mobile.js'
- ];
-
-}
\ No newline at end of file
diff --git a/protected/humhub/modules/mobile/config.php b/protected/humhub/modules/mobile/config.php
deleted file mode 100644
index 770c6c0a3c..0000000000
--- a/protected/humhub/modules/mobile/config.php
+++ /dev/null
@@ -1,20 +0,0 @@
- 'mobile',
- 'class' => \humhub\modules\mobile\Module::className(),
- 'isCoreModule' => true,
- 'events' => [
- ['class' => AccountMenu::class, 'event' => AccountMenu::EVENT_INIT, 'callback' => [Events::class, 'onAccountMenuInit']],
- ],
-];
\ No newline at end of file
diff --git a/protected/humhub/modules/mobile/controllers/SettingsController.php b/protected/humhub/modules/mobile/controllers/SettingsController.php
deleted file mode 100644
index d0f926feea..0000000000
--- a/protected/humhub/modules/mobile/controllers/SettingsController.php
+++ /dev/null
@@ -1,28 +0,0 @@
-render('device', []);
- }
-
-}
\ No newline at end of file
diff --git a/protected/humhub/modules/mobile/module.json b/protected/humhub/modules/mobile/module.json
deleted file mode 100644
index 39406be7e6..0000000000
--- a/protected/humhub/modules/mobile/module.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "id": "mobile",
- "name": "Mobile",
- "description": "Mobile Core",
- "keywords": [
- "mobile"
- ],
- "version": "1.0"
-}
\ No newline at end of file
diff --git a/protected/humhub/modules/mobile/resources/js/humhub.mobile.js b/protected/humhub/modules/mobile/resources/js/humhub.mobile.js
deleted file mode 100644
index 8b15c03d30..0000000000
--- a/protected/humhub/modules/mobile/resources/js/humhub.mobile.js
+++ /dev/null
@@ -1,16 +0,0 @@
-humhub.module('mobile', function (module, require, $) {
-
- var init = function() {
-
- };
-
- var close = function(evt) {
- module.closed = true;
- };
-
- module.export({
- init: init,
- close: close,
- closed: false
- });
-});
\ No newline at end of file
diff --git a/protected/humhub/modules/mobile/views/settings/device.php b/protected/humhub/modules/mobile/views/settings/device.php
deleted file mode 100644
index 89d517f75a..0000000000
--- a/protected/humhub/modules/mobile/views/settings/device.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
- = Yii::t('MobileModule.settings', 'Device settings'); ?>
-
-
-
- = \humhub\widgets\Button::primary('Close')->action('mobile.close') ?>
-
-
-
-
- Key |
- Value |
-
- request->headers as $key => $value) : ?>
-
- = $key ?> |
- = $value[0] ?> |
-
-
-
-
-
\ No newline at end of file
diff --git a/protected/humhub/modules/notification/components/BaseNotification.php b/protected/humhub/modules/notification/components/BaseNotification.php
index 2ae4e16f9e..e3de057c36 100644
--- a/protected/humhub/modules/notification/components/BaseNotification.php
+++ b/protected/humhub/modules/notification/components/BaseNotification.php
@@ -8,6 +8,7 @@
namespace humhub\modules\notification\components;
+use humhub\components\SocialActivity;
use Yii;
use yii\helpers\Url;
use yii\bootstrap\Html;
@@ -30,7 +31,7 @@ use humhub\modules\notification\targets\WebTarget;
*
* @author luke
*/
-abstract class BaseNotification extends \humhub\components\SocialActivity
+abstract class BaseNotification extends SocialActivity
{
/**
@@ -227,7 +228,7 @@ abstract class BaseNotification extends \humhub\components\SocialActivity
public function about($source)
{
if (!$source) {
- return;
+ return $this;
}
parent::about($source);
$this->record->space_id = $this->getSpaceId();
@@ -240,7 +241,7 @@ abstract class BaseNotification extends \humhub\components\SocialActivity
public function from($originator)
{
if (!$originator) {
- return;
+ return $this;
}
$this->originator = $originator;
$this->record->originator_user_id = $originator->id;
@@ -395,7 +396,7 @@ abstract class BaseNotification extends \humhub\components\SocialActivity
/**
* Should be overwritten by subclasses for a html representation of the notification.
- * @return type
+ * @return string
*/
public function html()
{
diff --git a/protected/humhub/modules/notification/targets/BaseTarget.php b/protected/humhub/modules/notification/targets/BaseTarget.php
index aa294b0e8b..55c9ce474a 100644
--- a/protected/humhub/modules/notification/targets/BaseTarget.php
+++ b/protected/humhub/modules/notification/targets/BaseTarget.php
@@ -32,7 +32,7 @@ abstract class BaseTarget extends \yii\base\Object
/**
* Holds the title of this instance.
- * @var type
+ * @var string
*/
public $title;
diff --git a/protected/humhub/modules/notification/targets/MailTarget.php b/protected/humhub/modules/notification/targets/MailTarget.php
index 6c0335580d..8d466b1fc3 100644
--- a/protected/humhub/modules/notification/targets/MailTarget.php
+++ b/protected/humhub/modules/notification/targets/MailTarget.php
@@ -27,7 +27,7 @@ class MailTarget extends BaseTarget
/**
* Enable this target by default.
- * @var type
+ * @var boolean
*/
public $defaultSetting = true;
diff --git a/protected/humhub/modules/user/models/Follow.php b/protected/humhub/modules/user/models/Follow.php
index a73cc6fccf..9997ca8ffd 100644
--- a/protected/humhub/modules/user/models/Follow.php
+++ b/protected/humhub/modules/user/models/Follow.php
@@ -14,6 +14,7 @@ use humhub\modules\activity\models\Activity;
use humhub\modules\space\models\Space;
use humhub\modules\user\models\User;
use Yii;
+use yii\db\ActiveQuery;
/**
* This is the model class for table "user_follow".
@@ -177,8 +178,8 @@ class Follow extends \yii\db\ActiveRecord
* If $withNotifications is set only follower with the given send_notifications setting are returned.
*
* @param \yii\db\ActiveRecord $target
- * @param type $withNotifications
- * @return type
+ * @param boolean $withNotifications
+ * @return ActiveQuery
*/
public static function getFollowersQuery(\yii\db\ActiveRecord $target, $withNotifications = null)
{
diff --git a/protected/humhub/tests/codeception/_support/_generated/UnitTesterActions.php b/protected/humhub/tests/codeception/_support/_generated/UnitTesterActions.php
index 755bee2c6e..6c18708434 100644
--- a/protected/humhub/tests/codeception/_support/_generated/UnitTesterActions.php
+++ b/protected/humhub/tests/codeception/_support/_generated/UnitTesterActions.php
@@ -1,4 +1,4 @@
-
array (
- 'config_created_at' => 1504018611,
+ 'config_created_at' => 1506096506,
'horImageScrollOnMobile' => NULL,
),
); ?>
\ No newline at end of file
diff --git a/protected/humhub/tests/codeception/unit/components/access/ControllerAccessTest.php b/protected/humhub/tests/codeception/unit/components/access/ControllerAccessTest.php
index a044f62f62..352d328280 100644
--- a/protected/humhub/tests/codeception/unit/components/access/ControllerAccessTest.php
+++ b/protected/humhub/tests/codeception/unit/components/access/ControllerAccessTest.php
@@ -153,7 +153,7 @@ class ControllerAccessTest extends HumHubDbTestCase
]]);
$this->assertFalse($controllerAccess->run());
- $this->assertEquals(401, $controllerAccess->code );
+ $this->assertEquals(401, $controllerAccess->code);
$this->assertEquals('Your user account is inactive, please login with an active account or contact a network administrator.', $controllerAccess->reason);
// UnnapprovedUser
@@ -165,7 +165,7 @@ class ControllerAccessTest extends HumHubDbTestCase
]]);
$this->assertFalse($controllerAccess->run());
- $this->assertEquals(401, $controllerAccess->code );
+ $this->assertEquals(401, $controllerAccess->code);
$this->assertEquals('Your user account has not been approved yet, please try again later or contact a network administrator.', $controllerAccess->reason);
}
@@ -217,7 +217,7 @@ class ControllerAccessTest extends HumHubDbTestCase
// Guest has no permission
$accessCheck = new ControllerAccess([
'rules' => [
- ['permissions' => [AccessTestPermission1::class]]
+ ['permission' => [AccessTestPermission1::class]]
],
'action' => 'testAction'
]);
@@ -228,7 +228,7 @@ class ControllerAccessTest extends HumHubDbTestCase
$this->becomeUser('User1');
$accessCheck = new ControllerAccess([
'rules' => [
- ['permissions' => [AccessTestPermission2::class]]
+ ['permission' => [AccessTestPermission2::class]]
],
'action' => 'testAction'
]);
@@ -236,20 +236,20 @@ class ControllerAccessTest extends HumHubDbTestCase
// Permission2 included
$accessCheck->rules = [
- ['permissions' => [AccessTestPermission1::class, AccessTestPermission2::class]]
+ ['permission' => [AccessTestPermission1::class, AccessTestPermission2::class]]
];
$this->assertTrue($accessCheck->run());
// In strict mode both permission have to be granted
$accessCheck->rules = [
- ['permissions' => [AccessTestPermission1::class, AccessTestPermission2::class], 'strict' => true]
+ ['permission' => [AccessTestPermission1::class, AccessTestPermission2::class], 'strict' => true]
];
$this->assertFalse($accessCheck->run());
- // Check two permission rules one non action related and one global valid one. The non action related should be ignored
+ // Check two permission rules one action related and one global valid one. The non action related should be ignored
$accessCheck->rules = [
- ['permissions' => [AccessTestPermission2::class], 'actions' => 'otherPermission'],
- ['permissions' => [AccessTestPermission1::class, AccessTestPermission2::class]]
+ ['permission' => [AccessTestPermission2::class], 'actions' => 'otherPermission'],
+ ['permission' => [AccessTestPermission1::class, AccessTestPermission2::class]]
];
$this->assertTrue($accessCheck->run());
@@ -257,23 +257,23 @@ class ControllerAccessTest extends HumHubDbTestCase
// Check non strict behaviour of permissoin rule with one not allowed global rule which is overwritten by action related
// This check passes, since only one of them has to pass.
$accessCheck->rules = [
- ['permissions' => [AccessTestPermission2::class]],
- ['permissions' => [AccessTestPermission1::class], 'actions' => 'testAction']
+ ['permission' => [AccessTestPermission2::class]],
+ ['permission' => [AccessTestPermission1::class], 'actions' => 'testAction']
];
$this->assertTrue($accessCheck->run());
// Check string permission definition
$accessCheck->rules = [
- ['permissions' => AccessTestPermission1::class]
+ ['permission' => AccessTestPermission1::class]
];
$this->assertTrue($accessCheck->run());
// Check permission rule in combination with adminOnly
$accessCheck->rules = [
[ControllerAccess::RULE_ADMIN_ONLY],
- ['permissions' => [AccessTestPermission2::class], 'actions' => 'otherPermission'],
- ['permissions' => [AccessTestPermission1::class, AccessTestPermission2::class]]
+ ['permission' => [AccessTestPermission2::class], 'actions' => 'otherPermission'],
+ ['permission' => [AccessTestPermission1::class, AccessTestPermission2::class]]
];
$this->assertFalse($accessCheck->run());
}
@@ -331,19 +331,19 @@ class ControllerAccessTest extends HumHubDbTestCase
// Global permission rule
$accessCheck->rules = [
- ['permissions' => [AccessTestPermission1::class]]
+ ['permission' => [AccessTestPermission1::class]]
];
$this->assertFalse($accessCheck->run());
// Non action related permission rule
$accessCheck->rules = [
- ['permissions' => AccessTestPermission1::class, 'actions' => ['otherTestAction']]
+ ['permission' => AccessTestPermission1::class, 'actions' => ['otherTestAction']]
];
$this->assertTrue($accessCheck->run());
// Matching action related permission setting
$accessCheck->rules = [
- ['permissions' => [AccessTestPermission1::class], 'actions' => ['otherTestAction', 'testAction']]
+ ['permission' => [AccessTestPermission1::class], 'actions' => ['otherTestAction', 'testAction']]
];
$this->assertFalse($accessCheck->run());
@@ -361,7 +361,7 @@ class ControllerAccessTest extends HumHubDbTestCase
$controllerAccess = new ControllerAccess(['action' => 'testAction', 'rules' => []]);
$this->assertFalse($controllerAccess->run());
- $this->assertEquals(401, $controllerAccess->code );
+ $this->assertEquals(401, $controllerAccess->code);
$this->assertEquals('Your user account is inactive, please login with an active account or contact a network administrator.', $controllerAccess->reason);
// UnnapprovedUser
@@ -370,7 +370,7 @@ class ControllerAccessTest extends HumHubDbTestCase
$controllerAccess = new ControllerAccess(['action' => 'testAction', 'rules' => []]);
$this->assertFalse($controllerAccess->run());
- $this->assertEquals(401, $controllerAccess->code );
+ $this->assertEquals(401, $controllerAccess->code);
$this->assertEquals('Your user account has not been approved yet, please try again later or contact a network administrator.', $controllerAccess->reason);
}
@@ -410,7 +410,7 @@ class ControllerAccessTest extends HumHubDbTestCase
$this->assertEquals(404, $controllerAccess->code);
$this->assertEquals('Not you again!', $controllerAccess->reason);
- $controllerAccess = new ControllerAccess(['action' => 'testAction', 'owner' => $this, 'rules' => [
+ $controllerAccess = new ControllerAccess(['action' => 'testAction', 'owner' => $this, 'rules' => [
['validateTestRule', 'return' => true]
]]);
@@ -422,7 +422,7 @@ class ControllerAccessTest extends HumHubDbTestCase
public function validateTestRule($rule, $access)
{
$this->assertEquals($access->owner, $this);
- if(!$rule['return']) {
+ if (!$rule['return']) {
$access->code = 404;
$access->reason = 'Not you again!';
return false;
@@ -433,7 +433,7 @@ class ControllerAccessTest extends HumHubDbTestCase
public function testCustomClassRule()
{
- $controllerAccess = new ControllerAccess(['action' => 'testAction', 'owner' => $this, 'rules' => [
+ $controllerAccess = new ControllerAccess(['action' => 'testAction', 'owner' => $this, 'rules' => [
[TestActionValidator::class, 'return' => false]
]]);
@@ -441,7 +441,7 @@ class ControllerAccessTest extends HumHubDbTestCase
$this->assertEquals(404, $controllerAccess->code);
$this->assertEquals('Not you again!', $controllerAccess->reason);
- $controllerAccess = new ControllerAccess(['action' => 'testAction', 'owner' => $this, 'rules' => [
+ $controllerAccess = new ControllerAccess(['action' => 'testAction', 'owner' => $this, 'rules' => [
[TestActionValidator::class, 'return' => true]
]]);