Skip to content

Commit

Permalink
Обновление и исправления функционала
Browse files Browse the repository at this point in the history
- [NEW] Добавлен функционал проверки обновления плагина
- [UPDATE] Изменён подход к некоторым классам
- [FIX] Вернул поддержку PHP 7.2
- [FIX] Вернул поддержку PHP >= 8
  • Loading branch information
Gokujo committed Sep 4, 2022
1 parent d9e0306 commit 6b781f0
Show file tree
Hide file tree
Showing 164 changed files with 1,589 additions and 17,219 deletions.
8 changes: 5 additions & 3 deletions upload/engine/ajax/maharder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@
die("Hacking attempt!");
}

global $is_logged, $dle_login_hash;

if (!$is_logged) die("error");

if ($_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash) {
die("error");
}

$data = $_POST;
$data = filter_var_array($_POST);
if (!$data) die();

$module = $data['module'];
$mod_file = $data['file'];
$action = $data['action'];
$method = $data['method'];

include_once(DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/_includes/classes/Ajax.php'));
include_once(DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/_includes/classes/LogGenerator.php'));
include_once(DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/_includes/extras/paths.php'));

$mh_admin = new Ajax();

Expand Down
23 changes: 17 additions & 6 deletions upload/engine/ajax/maharder/maharder/master.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
exit('Hacking attempt!');
}

global $is_logged, $dle_login_hash, $mh_admin, $method, $data;

if (!$is_logged) {
exit('error');
}
Expand All @@ -26,20 +28,17 @@

require_once DLEPlugins::Check(__DIR__ . '/_functions.php');

$method = $_POST['method'];
if (!$method) {
exit();
}
$save_con = filter_var_array($_POST['data']);
$data = [];

foreach ($save_con as $id => $d) {
$name = $d['name'];
$value = $d['value'];
$value = htmlspecialchars($value);
$data[$name] = $value;
$save_con[$name] = $value;
}
$data = filter_var_array($data);

switch ($method) {
case 'settings':
Expand All @@ -56,7 +55,7 @@
try {
echo json_encode($mh_admin->checkAssets(), JSON_UNESCAPED_UNICODE);
} catch (\Exception $e) {
LogGenerator::generate_log('maharder', 'check_assets', serialize($e->getMessage()));
LogGenerator::generate_log('maharder', 'check_assets', $e->getMessage());
echo json_encode([]);
}

Expand All @@ -68,9 +67,21 @@
try {
echo json_encode($mh_admin->save_asset($_POST['data']['data'], $_POST['data']['file']), JSON_UNESCAPED_UNICODE);
} catch (\Exception $e) {
LogGenerator::generate_log('maharder', 'save_asset', serialize($e->getMessage()));
LogGenerator::generate_log('maharder', 'save_asset', $e->getMessage());
echo json_encode([]);
}
sleep(0.5);
break;

case 'check_update':

try {
$mh_admin->setRecourceId($data['resource_id']);
echo json_encode($mh_admin->checkUpdate(), JSON_UNESCAPED_UNICODE);
} catch (Exception $e) {
LogGenerator::generate_log('maharder', 'check_update', $e->getMessage());
echo json_encode([]);
}

break;
}
68 changes: 0 additions & 68 deletions upload/engine/ajax/maharder/master.php

This file was deleted.

9 changes: 5 additions & 4 deletions upload/engine/inc/maharder.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?php

// заполняем важную и нужную инофрмацию о модуле
// заполняем важную и нужную информацию о модуле


$modInfo = [
'module_name' => 'MaHarder Assets',
'module_version' => '2.0.6',
'module_version' => '2.0.7',
'module_description' => 'Административная панель для моих разработок',
'module_code' => 'maharder',
'module_id' => 4,
'module_icon' => 'fad fa-robot',
'site_link' => 'https://devcraft.club/downloads/maharder-assets.4/',
'docs_link' => 'https://devcraft.club/articles/maharder-assets.10/',
'docs_link' => 'https://readme.devcraft.club/latest/dev/mhadmin/install/',
'dle_config' => $config,
];

Expand All @@ -22,7 +23,7 @@
// Подключаем переменные модуля и его функционал
// Используем переменную sites для навигации в модуле
switch ($_GET['sites']) {
// Страница с с генератором модуля
// Страница с генератором модуля
case 'new_module':
require_once DLEPlugins::Check(MH_ADMIN.'/modules/admin/new_module.php');
break;
Expand Down
2 changes: 2 additions & 0 deletions upload/engine/inc/maharder/_includes/classes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Admin {
URL . '/maharder/admin/assets/js/autosize.min.js',
URL . '/maharder/admin/assets/js/mask.js',
URL . '/maharder/admin/assets/js/tokens.js',
URL . '/maharder/admin/assets/js/jquery.timeago.js',
URL . '/maharder/admin/assets/js/timeago/jquery.timeago.ru.js',
URL . '/maharder/admin/assets/js/jquery-confirm.min.js',
URL . '/maharder/admin/assets/editor/sceditor.min.js',
URL . '/maharder/admin/assets/editor/formats/bbcode.js',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace MaHarder\classes;
//namespace MaHarder\classes;

use Twig\TwigFunction;
use Twig\Extension\AbstractExtension;
Expand Down
1 change: 1 addition & 0 deletions upload/engine/inc/maharder/_includes/classes/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class Ajax {
use DataLoader;
use AssetsChecker;
use UpdatesChecker;

public function __construct() {
$mh_settings = self::getConfig('maharder');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace MaHarder\classes;
//namespace MaHarder\classes;

use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace MaHarder\classes;
//namespace MaHarder\classes;

use Mobile_Detect;
use Twig\Extension\AbstractExtension;
Expand All @@ -18,7 +18,11 @@
* @link https://github.com/bes89/mobiledetect-twig-extension
*/
class MobileDetectExtension extends AbstractExtension {
protected ?Mobile_Detect $detector = null;

/**
* @var \Mobile_Detect|null
*/
protected $detector = null;

/**
* Constructor
Expand Down
Loading

0 comments on commit 6b781f0

Please sign in to comment.