Skip to content

Commit

Permalink
Some fixies, update copyrights
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-wdmg committed Jun 24, 2023
1 parent 610f881 commit 389e9de
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 34 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
64 changes: 39 additions & 25 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* Yii2 Guard
*
* @category Module
* @version 1.2.0
* @version 1.3.0
* @author Alexsander Vyshnyvetskyy <[email protected]>
* @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
*
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'] .= '<span class="badge badge-default float-right">' . $options['count'] . '</span>';
unset($options['count']);
}

if (is_array($options))
$items = ArrayHelper::merge($items, $options);

}

return $items;
}

/**
* {@inheritdoc}
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
* v.1.1.0 - Added blocking by IP functionality
2 changes: 1 addition & 1 deletion commands/InitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions models/Scanning.php
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand All @@ -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++;
Expand Down

0 comments on commit 389e9de

Please sign in to comment.