fix previously introduced unix bug

This commit is contained in:
Jean-Christian Paul Denis 2023-01-07 15:58:28 +01:00
parent cc3bca98c4
commit b2f4adce3f
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 18 additions and 11 deletions

View File

@ -21,11 +21,13 @@ use dcPage;
class Admin class Admin
{ {
private static $pid = '';
protected static $init = false; protected static $init = false;
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { if (defined('DC_CONTEXT_ADMIN')) {
self::$pid = basename(dirname(__DIR__));
self::$init = true; self::$init = true;
} }
@ -39,10 +41,10 @@ class Admin
} }
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name'), dcCore::app()->plugins->moduleInfo(self::$pid, 'name'),
dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__)), dcCore::app()->adminurl->get('admin.plugin.' . self::$pid),
dcPage::getPF(basename(__NAMESPACE__) . '/icon.svg'), dcPage::getPF(self::$pid . '/icon.svg'),
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__NAMESPACE__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']), preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . self::$pid)) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
dcCore::app()->auth->isSuperAdmin() dcCore::app()->auth->isSuperAdmin()
); );

View File

@ -26,12 +26,16 @@ use http;
use mail; use mail;
use text; use text;
/* php */
use Exception;
class Manage class Manage
{ {
private static $active_headers = false; private static $active_headers = false;
private static $mail_to = ''; private static $mail_to = '';
private static $mail_subject = ''; private static $mail_subject = '';
private static $mail_content = ''; private static $mail_content = '';
private static $pid = '';
protected static $init = false; protected static $init = false;
public static function init(): bool public static function init(): bool
@ -39,6 +43,7 @@ class Manage
if (defined('DC_CONTEXT_ADMIN')) { if (defined('DC_CONTEXT_ADMIN')) {
dcPage::checkSuper(); dcPage::checkSuper();
self::$pid = basename(dirname(__DIR__));
self::$init = true; self::$init = true;
} }
@ -78,13 +83,13 @@ class Manage
$mail_subject = mail::B64Header(self::$mail_subject); $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); mail::sendMail(self::$mail_to, $mail_subject, self::$mail_content, $headers);
} else { } else {
mail::sendMail(self::$mail_to, $mail_subject, self::$mail_content); mail::sendMail(self::$mail_to, $mail_subject, self::$mail_content);
} }
dcAdminNotices::addSuccessNotice(__('Mail successuffly sent.')); dcAdminNotices::addSuccessNotice(__('Mail successuffly sent.'));
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__NAMESPACE__)); dcCore::app()->adminurl->redirect('admin.plugin.' . self::$pid);
return true; return true;
} catch (Exception $e) { } catch (Exception $e) {
@ -99,12 +104,12 @@ class Manage
{ {
echo echo
'<html><head><title>' . '<html><head><title>' .
dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') . dcCore::app()->plugins->moduleInfo(self::$pid, 'name') .
'</title></head><body>' . '</title></head><body>' .
dcPage::breadcrumb([ dcPage::breadcrumb([
__('System') => '', __('System') => '',
dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') => '', dcCore::app()->plugins->moduleInfo(self::$pid, 'name') => '',
]) . ]) .
dcPage::notices() . ' dcPage::notices() . '
@ -121,7 +126,7 @@ class Manage
<p>' . __('Content:') . '</p> <p>' . __('Content:') . '</p>
<p class="area">' . <p class="area">' .
form::textarea('mail_content', 50, 7, html::escapeHTML($mail_content)) . ' form::textarea('mail_content', 50, 7, html::escapeHTML(self::$mail_content)) . '
</p> </p>
<p><label class="classic" for="active_headers">' . <p><label class="classic" for="active_headers">' .

View File

@ -40,7 +40,7 @@ class Prepend
foreach (self::LIBS as $lib) { foreach (self::LIBS as $lib) {
Clearbricks::lib()->autoload([ Clearbricks::lib()->autoload([
implode('\\', ['Dotclear','Plugin', basename(__NAMESPACE__), $lib]) => __DIR__ . DIRECTORY_SEPARATOR . $lib . '.php', __NAMESPACE__ . '\\' . $lib => __DIR__ . DIRECTORY_SEPARATOR . $lib . '.php',
]); ]);
} }