Skip to content

Commit

Permalink
Исправления совместимости
Browse files Browse the repository at this point in the history
  • Loading branch information
Gokujo committed Sep 7, 2022
1 parent 1ea1326 commit 55ae5e1
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 266 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.7.2",
"version": "2.0.8",
"status": "dev",
"dle": [
"15.x"
Expand Down
2 changes: 1 addition & 1 deletion upload/engine/ajax/maharder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

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

$mh_admin = new Ajax();
$mh_admin = new MhAjax();

if (file_exists(DLEPlugins::Check(ENGINE_DIR . '/ajax/maharder/' . $module . '/' . $mod_file . '.php'))) {

Expand Down
2 changes: 1 addition & 1 deletion upload/engine/inc/maharder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

$modInfo = [
'module_name' => 'MaHarder Assets',
'module_version' => '2.0.7.2',
'module_version' => '2.0.7',
'module_description' => 'Административная панель для моих разработок',
'module_code' => 'maharder',
'module_id' => 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

require_once DLEPlugins::Check(ENGINE_DIR . '/inc/maharder/_includes/extras/paths.php');

class Ajax {
class MhAjax {
use DataLoader;
use AssetsChecker;
use UpdatesChecker;
Expand Down
124 changes: 0 additions & 124 deletions upload/engine/inc/maharder/_includes/extras/autoloader.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
@ini_set('pcre.backtrack_limit', 10000000 );
@ini_set('pcre.jit', false);



if (!function_exists('dirToArray')) {
function dirToArray($dir) {
function dirToArray($dir, ...$except) {
$result = [];

$xcpt = [
'.',
'..',
'.htaccess',
];
if ($except) {
foreach ($except as $ex) $xcpt = array_merge_recursive($xcpt, $ex);
}

foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value) {
if ( ! in_array($value, $xcpt, true)) {
Expand All @@ -31,11 +32,11 @@ function dirToArray($dir) {
}

spl_autoload_register(function ($class_name) {
global $loader_paths;
global $mh_loader_paths;

$found = false;

foreach ($loader_paths as $path) {
foreach ($mh_loader_paths as $path) {
$dir_data = dirToArray($path);
foreach ($dir_data as $data) {
if ($class_name === str_replace('.php', '', $data)) {
Expand All @@ -47,4 +48,4 @@ function dirToArray($dir) {
if ($found) break;
}

});
});
40 changes: 25 additions & 15 deletions upload/engine/inc/maharder/_includes/extras/paths.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
<?php

if (!defined('DATALIFEENGINE')) {
header('HTTP/1.1 403 Forbidden');
header('Location: ../../../../../');
if ( ! defined('DATALIFEENGINE')) {
header('HTTP/1.1 403 Forbidden');
header('Location: ../../../../../');

exit('Hacking attempt!');
}
exit('Hacking attempt!');
}

if(!defined('MH_ROOT')) define("MH_ROOT", ENGINE_DIR . '/inc/maharder');
if(!defined('MH_ADMIN')) define("MH_ADMIN", MH_ROOT . '/admin');
if(!defined('ROOT')) define("ROOT", ROOT_DIR);
$current_dir = __DIR__;
if (preg_grep('/(cache)/', explode("\n", $current_dir))) $current_dir = dirname(__FILE__, 5);
else $current_dir = dirname(__FILE__, 6);

$loader_paths = [
MH_ROOT.'/_includes/classes',
MH_ROOT.'/_includes/traits',
// Custom paths //
];
if ( ! defined('ROOT')) {
define("ROOT", $current_dir);
}
if ( ! defined('MH_ROOT')) {
define("MH_ROOT", ROOT.'/engine/inc/maharder');
}
if ( ! defined('MH_ADMIN')) {
define("MH_ADMIN", MH_ROOT.'/admin');
}

include_once ENGINE_DIR . '/inc/maharder/_includes/vendor/autoload.php';
require_once DLEPlugins::Check(MH_ROOT.'/_includes/extras/loader.php');
$mh_loader_paths = [
MH_ROOT.'/_includes/classes',
MH_ROOT.'/_includes/traits',
// Custom paths //
];

include_once MH_ROOT.'/_includes/extras/mhLoader.php';
include_once ENGINE_DIR.'/inc/maharder/_includes/vendor/autoload.php';
16 changes: 10 additions & 6 deletions upload/engine/inc/maharder/_includes/traits/DataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,16 @@ public static function dirToArray($dir, ...$except) {
$xcpt = array_merge_recursive($xcpt, self::nameArgs($except));
}

foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value) {
if ( ! in_array($value, $xcpt, true)) {
if (is_dir($dir.DIRECTORY_SEPARATOR.$value)) {
$result[$value] = self::dirToArray($dir.DIRECTORY_SEPARATOR.$value);
} else {
$result[] = $value;
$dir = str_replace(ENGINE_DIR, ROOT . DIRECTORY_SEPARATOR . 'engine', $dir);

if (is_dir($dir)) {
foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value) {
if ( ! in_array($value, $xcpt, true)) {
if (is_dir($dir.DIRECTORY_SEPARATOR.$value)) {
$result[$value] = self::dirToArray($dir.DIRECTORY_SEPARATOR.$value);
} else {
$result[] = $value;
}
}
}
}
Expand Down
89 changes: 0 additions & 89 deletions upload/engine/inc/maharder/admin/assets/css/fa_fix.css

This file was deleted.

6 changes: 0 additions & 6 deletions upload/engine/inc/maharder/admin/assets/css/fa_old.css

This file was deleted.

6 changes: 0 additions & 6 deletions upload/engine/inc/maharder/admin/modules/admin/changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

$logs = [

'2.0.7.2' => [
'[FIX] Исправлен установщик v2',
],
'2.0.7.1' => [
'[FIX] Исправлен установщик',
],
'2.0.7' => [
'[NEW] Добавлен функционал проверки обновления плагина',
'[UPDATE] Изменён подход к некоторым классам',
Expand Down
Loading

0 comments on commit 55ae5e1

Please sign in to comment.