From b2f4adce3ff335887d48469a2fba635db405a971 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 7 Jan 2023 15:58:28 +0100 Subject: [PATCH] fix previously introduced unix bug --- inc/Admin.php | 10 ++++++---- inc/Manage.php | 17 +++++++++++------ inc/Prepend.php | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/inc/Admin.php b/inc/Admin.php index b676178..5cf7821 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -21,11 +21,13 @@ use dcPage; class Admin { + private static $pid = ''; protected static $init = false; public static function init(): bool { if (defined('DC_CONTEXT_ADMIN')) { + self::$pid = basename(dirname(__DIR__)); self::$init = true; } @@ -39,10 +41,10 @@ class Admin } dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( - dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name'), - dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__)), - dcPage::getPF(basename(__NAMESPACE__) . '/icon.svg'), - preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']), + dcCore::app()->plugins->moduleInfo(self::$pid, 'name'), + dcCore::app()->adminurl->get('admin.plugin.' . self::$pid), + dcPage::getPF(self::$pid . '/icon.svg'), + preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . self::$pid)) . '(&.*)?$/', $_SERVER['REQUEST_URI']), dcCore::app()->auth->isSuperAdmin() ); diff --git a/inc/Manage.php b/inc/Manage.php index 863b8a0..662c5c2 100644 --- a/inc/Manage.php +++ b/inc/Manage.php @@ -26,12 +26,16 @@ use http; use mail; use text; +/* php */ +use Exception; + class Manage { private static $active_headers = false; private static $mail_to = ''; private static $mail_subject = ''; private static $mail_content = ''; + private static $pid = ''; protected static $init = false; public static function init(): bool @@ -39,6 +43,7 @@ class Manage if (defined('DC_CONTEXT_ADMIN')) { dcPage::checkSuper(); + self::$pid = basename(dirname(__DIR__)); self::$init = true; } @@ -78,13 +83,13 @@ class Manage $mail_subject = mail::B64Header(self::$mail_subject); - if ($active_headers) { + if (self::$active_headers) { mail::sendMail(self::$mail_to, $mail_subject, self::$mail_content, $headers); } else { mail::sendMail(self::$mail_to, $mail_subject, self::$mail_content); } dcAdminNotices::addSuccessNotice(__('Mail successuffly sent.')); - dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__NAMESPACE__)); + dcCore::app()->adminurl->redirect('admin.plugin.' . self::$pid); return true; } catch (Exception $e) { @@ -99,12 +104,12 @@ class Manage { echo '' . - dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') . + dcCore::app()->plugins->moduleInfo(self::$pid, 'name') . '' . dcPage::breadcrumb([ - __('System') => '', - dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') => '', + __('System') => '', + dcCore::app()->plugins->moduleInfo(self::$pid, 'name') => '', ]) . dcPage::notices() . ' @@ -121,7 +126,7 @@ class Manage

' . __('Content:') . '

' . - form::textarea('mail_content', 50, 7, html::escapeHTML($mail_content)) . ' + form::textarea('mail_content', 50, 7, html::escapeHTML(self::$mail_content)) . '