Skip to content

Commit c7cd2cc

Browse files
committed
Update OutdatedExtrasCheck
1 parent cfbe776 commit c7cd2cc

13 files changed

Lines changed: 743 additions & 510 deletions

File tree

assets/plugins/extrascheck/CheckOutdated.class.php

Lines changed: 476 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
if (!defined('MODX_BASE_PATH')) {
3+
die('What are you doing? Get out of here!');
4+
}
5+
/** @var DocumentParser $modx */
6+
7+
// get manager role check
8+
$internalKey = $modx->getLoginUserID();
9+
$sid = $modx->sid;
10+
$role = (int)$_SESSION['mgrRole'];
11+
$user = $_SESSION['mgrShortname'];
12+
13+
switch (true)
14+
{
15+
case ($role !== 1 && $wdgVisibility === 'AdminOnly'):
16+
// show widget only to Admin role 1
17+
break;
18+
case ($role === 1 && $wdgVisibility === 'AdminExcluded'):
19+
// show widget to all manager users excluded Admin role 1
20+
break;
21+
case ($role != $ThisRole && $wdgVisibility === 'ThisRoleOnly'):
22+
// show widget only to "this" role id
23+
break;
24+
case ($user != $ThisUser && $wdgVisibility === 'ThisUserOnly'):
25+
// show widget only to "this" username
26+
break;
27+
default: // get plugin id and setting button
28+
global $_lang;
29+
$plugin_path = __DIR__;
30+
if (!class_exists('CheckOutdated')) {
31+
include_once __DIR__ . '/CheckOutdated.class.php';
32+
}
33+
$checkOutdated = new CheckOutdated($modx, $modx->event->activePlugin, $_lang);
34+
$outdated = $checkOutdated->load(
35+
MODX_BASE_PATH . 'assets/plugins/extrascheck/outdated.json'
36+
);
37+
38+
$out = '';
39+
foreach ($outdated as $type => $elements) {
40+
foreach ($elements as $item => $options) {
41+
$out .= $checkOutdated->process($type, $item, $options);
42+
}
43+
}
44+
45+
if ($out !== '' && $modx->event->name === 'OnManagerWelcomeHome') {
46+
$button = $checkOutdated->makeConfigButton($_lang['settings_config']);
47+
$modx->setPlaceholder('button_pl_config', $button);
48+
49+
$wdgTitle = $checkOutdated->parseTemplate('@CODE:EVO [+evo_cms_version+] - [%title%]');
50+
$widgets['xtraCheck'] = array(
51+
'menuindex' => '0',
52+
'id' => 'xtraCheck' . $checkOutdated->getPluginId() . '',
53+
'cols' => 'col-12',
54+
'headAttr' => 'style="color:#E84B39;"',
55+
'bodyAttr' => '',
56+
'icon' => 'fa-warning',
57+
'title' => '' . $wdgTitle . ' ' . $button . '',
58+
'body' => '<div class="card-body">' . $out . '</div>',
59+
'hide' => '0'
60+
);
61+
$modx->event->setOutput(serialize($widgets));
62+
}
63+
break;
64+
}

assets/plugins/extrascheck/lang/english.php

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
// ---------------------------------------------------------------
3+
// :: OutdatedExtrasCheck
4+
// ----------------------------------------------------------------
5+
//
6+
//
7+
//
8+
// ----------------------------------------------------------------
9+
// :: Copyright & Licencing
10+
// ----------------------------------------------------------------
11+
//
12+
// GNU General Public License (GPL - http://www.gnu.org/copyleft/gpl.html)
13+
//
14+
$_lang = array();
15+
16+
$_lang['title'] = 'Extras compatibility check';
17+
$_lang['outdated'] = 'is <b>outdated</b>';
18+
$_lang['isoutdated'] = 'is <b>outdated</b> and no longer compatible with';
19+
$_lang['no'] = 'is <b>outdated</b> and no longer compatible with';
20+
$_lang['please_update'] = 'Please update';
21+
$_lang['please_delete'] = 'Please delete';
22+
$_lang['please_download_and_install'] = 'Please download and install';
23+
$_lang["to_latest"] = 'to the latest version';
24+
$_lang['min_required'] = 'min required';
25+
$_lang['from'] = 'from';
26+
$_lang['extras_module'] = 'Extras Module';
27+
$_lang['or_move_to'] = 'or move to';
28+
$_lang['not_used'] = 'is no longer used by';
29+
$_lang['from_folder'] = 'from folder';
30+
$_lang['if_dont_use'] = 'If you don\'t use for other purpose';
31+
$_lang['security_reason'] = 'is vulnerable';
32+
33+
return $_lang;

assets/plugins/extrascheck/lang/italian.php

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
// ---------------------------------------------------------------
3+
// :: OutdatedExtrasCheck
4+
// ----------------------------------------------------------------
5+
//
6+
//
7+
//
8+
// ----------------------------------------------------------------
9+
// :: Copyright & Licencing
10+
// ----------------------------------------------------------------
11+
//
12+
// GNU General Public License (GPL - http://www.gnu.org/copyleft/gpl.html)
13+
//
14+
$_lang = array();
15+
16+
$_lang['title'] = 'Controllo Compatibilità Extras';
17+
$_lang['outdated'] = 'è <b>obsoleto</b>';
18+
$_lang['isoutdated'] = 'è <b>obsoleto</b> e non compatibile con';
19+
$_lang['please_update'] = 'Aggiorna';
20+
$_lang['please_delete'] = 'Per favore cancellalo';
21+
$_lang['please_download_and_install'] = 'Per favore scarica e installa';
22+
$_lang["to_latest"] = 'all\'ultima versione';
23+
$_lang['min_required'] = 'minima richiesta ';
24+
$_lang['from'] = 'dal';
25+
$_lang['extras_module'] = 'Modulo Extras';
26+
$_lang['or_move_to'] = 'o passa a';
27+
$_lang['not_used'] = 'non è più utilizzato da';
28+
$_lang['from_folder'] = 'dalla cartella';
29+
$_lang['if_dont_use'] = 'Se non lo usi per altri scopi';
30+
$_lang['security_reason'] = 'vulnerabile';
31+
32+
return $_lang;

assets/plugins/extrascheck/lang/russian-UTF8.php

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
// ---------------------------------------------------------------
3+
// :: OutdatedExtrasCheck
4+
// ----------------------------------------------------------------
5+
//
6+
//
7+
//
8+
// ----------------------------------------------------------------
9+
// :: Copyright & Licencing
10+
// ----------------------------------------------------------------
11+
//
12+
// GNU General Public License (GPL - http://www.gnu.org/copyleft/gpl.html)
13+
//
14+
$_lang = array();
15+
16+
$_lang['title'] = 'Проверка совместимости дополнений';
17+
$_lang['outdated'] = '<b>устаревший</b>';
18+
$_lang['isoutdated'] = 'больше не совместим с';
19+
$_lang['please_update'] = 'Пожалуйста, обновите';
20+
$_lang['please_delete'] = 'Пожалуйста, удалите';
21+
$_lang['please_download_and_install'] = 'скачать и установить';
22+
$_lang['to_latest'] = 'до последней версии';
23+
$_lang['min_required'] = 'минимально необходимый';
24+
$_lang['from'] = 'через';
25+
$_lang['extras_module'] = 'Extras Модуль';
26+
$_lang['or_move_to'] = 'или замените на';
27+
$_lang['not_used'] = 'больше не используется';
28+
$_lang['from_folder'] = 'его из папки';
29+
$_lang['if_dont_use'] = 'Если вы не используете';
30+
$_lang['security_reason'] = 'уязвим';
31+
32+
return $_lang;

assets/plugins/extrascheck/lang/spanish.php

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
// ---------------------------------------------------------------
3+
// :: OutdatedExtrasCheck
4+
// ----------------------------------------------------------------
5+
//
6+
//
7+
//
8+
// ----------------------------------------------------------------
9+
// :: Copyright & Licencing
10+
// ----------------------------------------------------------------
11+
//
12+
// GNU General Public License (GPL - http://www.gnu.org/copyleft/gpl.html)
13+
//
14+
$_lang = array();
15+
$_lang['title'] = 'Comprobación de compatibilidad de extras';
16+
$_lang['outdated'] = 'está <b> obsoleto</b>';
17+
$_lang['isoutdated'] = 'está <b> obsoleto</b> y ya no es compatible con';
18+
$_lang['please_update'] = 'Por favor actualice';
19+
$_lang['please_delete'] = 'Por favor elimínelo';
20+
$_lang['please_download_and_install'] = 'Por favor descargue e instale';
21+
$_lang["to_latest"] = 'a la última versión';
22+
$_lang['min_required'] = 'mínimo requerido';
23+
$_lang['from'] = 'de';
24+
$_lang['extras_module'] = 'Módulo de Extras';
25+
$_lang['or_move_to'] = 'o muévase a';
26+
$_lang['not_used'] = 'ya no es utilizado por';
27+
$_lang['from_folder'] = 'de la carpeta';
28+
$_lang['if_dont_use'] = 'Si no lo usa para otro propósito';
29+
$_lang['security_reason'] = 'vulnerable';
30+
31+
return $_lang;

0 commit comments

Comments
 (0)