2022-11-27 22:30:13 +00:00
|
|
|
<?php
|
2023-01-05 23:48:09 +00:00
|
|
|
/**
|
|
|
|
* @brief testMail, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Osku and contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2023-01-05 23:33:13 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\testMail;
|
|
|
|
|
|
|
|
/* dotclear ns */
|
|
|
|
use dcAdmin;
|
|
|
|
use dcCore;
|
|
|
|
use dcPage;
|
|
|
|
|
|
|
|
class Admin
|
|
|
|
{
|
2023-01-07 14:58:28 +00:00
|
|
|
private static $pid = '';
|
2023-01-05 23:33:13 +00:00
|
|
|
protected static $init = false;
|
|
|
|
|
|
|
|
public static function init(): bool
|
|
|
|
{
|
|
|
|
if (defined('DC_CONTEXT_ADMIN')) {
|
2023-01-07 14:58:28 +00:00
|
|
|
self::$pid = basename(dirname(__DIR__));
|
2023-01-05 23:33:13 +00:00
|
|
|
self::$init = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return self::$init;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function process(): ?bool
|
|
|
|
{
|
|
|
|
if (!self::$init) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-01-05 23:48:09 +00:00
|
|
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
2023-01-07 14:58:28 +00:00
|
|
|
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']),
|
2023-01-05 23:33:13 +00:00
|
|
|
dcCore::app()->auth->isSuperAdmin()
|
|
|
|
);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2022-11-27 22:30:13 +00:00
|
|
|
}
|