diff --git a/CHANGELOG.md b/CHANGELOG.md index 851edef..9974120 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ Changelog ========= -## 1.2.* +## 1.3.0 (2023-06-24) + * Some fixies, update copyrights * Show modal call fixed * Shorten hash for filesystem scan diff --git a/Module.php b/Module.php index 2ec23ac..ff45b3c 100644 --- a/Module.php +++ b/Module.php @@ -6,10 +6,10 @@ * Yii2 Guard * * @category Module - * @version 1.2.0 + * @version 1.3.0 * @author Alexsander Vyshnyvetskyy * @link https://github.com/wdmg/yii2-guard - * @copyright Copyright (c) 2019 - 2021 W.D.M.Group, Ukraine + * @copyright Copyright (c) 2019 - 2023 W.D.M.Group, Ukraine * @license https://opensource.org/licenses/MIT Massachusetts Institute of Technology (MIT) License * */ @@ -50,7 +50,7 @@ class Module extends BaseModule /** * @var string the module version */ - private $version = "1.2.0"; + private $version = "1.3.0"; /** * @var integer, priority of initialization @@ -274,28 +274,42 @@ public function init() /** * {@inheritdoc} */ - public function dashboardNavItems($options = false) - { - return [ - 'label' => $this->name, - 'url' => [$this->routePrefix . '/'. $this->id], - 'icon' => 'fa fa-fw fa-shield-alt', - 'active' => in_array(\Yii::$app->controller->module->id, [$this->id]), - 'items' => [ - [ - 'label' => Yii::t('app/modules/guard', 'Banned List'), - 'url' => [$this->routePrefix . '/guard/banned/'], - 'icon' => 'fa fa-fw fa-traffic-light', - 'active' => (in_array(\Yii::$app->controller->module->id, ['guard']) && Yii::$app->controller->id == 'banned'), - ], [ - 'label' => Yii::t('app/modules/guard', 'Scan Reports'), - 'url' => [$this->routePrefix . '/guard/scan/'], - 'icon' => 'fa fa-fw fa-history', - 'active' => (in_array(\Yii::$app->controller->module->id, ['guard']) && Yii::$app->controller->id == 'scan'), - ] - ] - ]; - } + public function dashboardNavItems($options = null) + { + $items = [ + 'label' => $this->name, + 'url' => [$this->routePrefix . '/'. $this->id], + 'icon' => 'fa fa-fw fa-shield-alt', + 'active' => in_array(\Yii::$app->controller->module->id, [$this->id]), + 'items' => [ + [ + 'label' => Yii::t('app/modules/guard', 'Banned List'), + 'url' => [$this->routePrefix . '/guard/banned/'], + 'icon' => 'fa fa-fw fa-traffic-light', + 'active' => (in_array(\Yii::$app->controller->module->id, ['guard']) && Yii::$app->controller->id == 'banned'), + ], [ + 'label' => Yii::t('app/modules/guard', 'Scan Reports'), + 'url' => [$this->routePrefix . '/guard/scan/'], + 'icon' => 'fa fa-fw fa-history', + 'active' => (in_array(\Yii::$app->controller->module->id, ['guard']) && Yii::$app->controller->id == 'scan'), + ] + ] + ]; + + if (!is_null($options)) { + + if (isset($options['count'])) { + $items['label'] .= '' . $options['count'] . ''; + unset($options['count']); + } + + if (is_array($options)) + $items = ArrayHelper::merge($items, $options); + + } + + return $items; + } /** * {@inheritdoc} diff --git a/README.md b/README.md index 8923c49..2f900ed 100644 --- a/README.md +++ b/README.md @@ -117,8 +117,6 @@ Use the `Module::dashboardNavItems()` method of the module to generate a navigat ?> # Status and version [ready to use] +* v.1.3.0 - Some fixies, update copyrights * v.1.2.0 - Filesystem scan reports -* v.1.1.0 - Added blocking by IP functionality -* v.1.0.2 - Up to date dependencies -* v.1.0.1 - Fixed deprecated class declaration -* v.1.0.0 - Added base module and model, behaviors and filters \ No newline at end of file +* v.1.1.0 - Added blocking by IP functionality \ No newline at end of file diff --git a/commands/InitController.php b/commands/InitController.php index c0f8d7e..97a8967 100644 --- a/commands/InitController.php +++ b/commands/InitController.php @@ -35,7 +35,7 @@ public function actionIndex($params = null) '║ ║'. "\n" . '║ GUARD MODULE, v.'.$version.' ║'. "\n" . '║ by Alexsander Vyshnyvetskyy ║'. "\n" . - '║ (c) 2019-2021 W.D.M.Group, Ukraine ║'. "\n" . + '║ (c) 2019-2023 W.D.M.Group, Ukraine ║'. "\n" . '║ ║'. "\n" . '╚════════════════════════════════════════════════╝'; echo $name = $this->ansiFormat($welcome . "\n\n", Console::FG_GREEN); diff --git a/composer.json b/composer.json index 38015b5..8af4353 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "keywords": ["yii2", "yii2-guard", "guard", "security", "wdmg"], "type": "yii2-extension", "license": "MIT", - "version": "1.2.0", + "version": "1.3.0", "homepage": "https://github.com/wdmg/yii2-guard", "support": { "source": "https://github.com/wdmg/yii2-guard", diff --git a/models/Scanning.php b/models/Scanning.php index fe3acda..1522f69 100644 --- a/models/Scanning.php +++ b/models/Scanning.php @@ -399,7 +399,7 @@ public function buildReport($data, $safe = true) { if (!$root = Yii::getAlias('@app')) $root = dir(__DIR__); - if (is_countable($data)) { + if (is_array($data)) { foreach ($data as $paths) { foreach ($paths as $file => $details) { $report[] = [ @@ -424,7 +424,7 @@ public function buildReport($data, $safe = true) { */ private function countDifferences($data) { $count = 0; - if (is_countable($data)) { + if (is_array($data)) { foreach ($data as $paths) { foreach ($paths as $file) { $count++;