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
{
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()
);

View File

@ -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
'<html><head><title>' .
dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') .
dcCore::app()->plugins->moduleInfo(self::$pid, 'name') .
'</title></head><body>' .
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
<p>' . __('Content:') . '</p>
<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><label class="classic" for="active_headers">' .

View File

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