fix previously introduced unix bug
This commit is contained in:
parent
3d1f4694d5
commit
f6e93f6589
3 changed files with 19 additions and 15 deletions
|
@ -27,6 +27,7 @@ use Exception;
|
||||||
|
|
||||||
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
|
||||||
|
@ -36,6 +37,7 @@ class Admin
|
||||||
&& dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('active')
|
&& dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('active')
|
||||||
) {
|
) {
|
||||||
dcCore::app()->auth->user_prefs->addWorkspace('interface');
|
dcCore::app()->auth->user_prefs->addWorkspace('interface');
|
||||||
|
self::$pid = basename(dirname(__DIR__));
|
||||||
self::$init = true;
|
self::$init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,10 +50,10 @@ class Admin
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('packman')) {
|
if (dcCore::app()->blog->settings->get(self::$pid)->get('packman')) {
|
||||||
// create dcstore.xml file on the fly when plugin packman pack a module
|
// create dcstore.xml file on the fly when plugin packman pack a module
|
||||||
dcCore::app()->addBehavior('packmanBeforeCreatePackage', function (array $module): void {
|
dcCore::app()->addBehavior('packmanBeforeCreatePackage', function (array $module): void {
|
||||||
Core::writeXML($module['id'], $module, dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('file_pattern'));
|
Core::writeXML($module['id'], $module, dcCore::app()->blog->settings->get(self::$pid)->get('file_pattern'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,21 +78,21 @@ class Admin
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
dcPage::jsJson('ts_copied', ['alert' => __('Copied to clipboard')]) .
|
dcPage::jsJson('ts_copied', ['alert' => __('Copied to clipboard')]) .
|
||||||
dcPage::jsModuleLoad(basename(__NAMESPACE__) . '/js/admin.js') .
|
dcPage::jsModuleLoad(self::$pid . '/js/admin.js') .
|
||||||
(
|
(
|
||||||
!dcCore::app()->auth->user_prefs->interface->colorsyntax ? '' :
|
!dcCore::app()->auth->user_prefs->interface->colorsyntax ? '' :
|
||||||
dcPage::jsLoadCodeMirror(dcCore::app()->auth->user_prefs->interface->colorsyntax_theme) .
|
dcPage::jsLoadCodeMirror(dcCore::app()->auth->user_prefs->interface->colorsyntax_theme) .
|
||||||
dcPage::jsModuleLoad(basename(__NAMESPACE__) . '/js/cms.js')
|
dcPage::jsModuleLoad(self::$pid . '/js/cms.js')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function modulesToolsTabs(array $modules, array $excludes, string $page_url): void
|
protected static function modulesToolsTabs(array $modules, array $excludes, string $page_url): void
|
||||||
{
|
{
|
||||||
$page_url .= '#' . basename(__NAMESPACE__);
|
$page_url .= '#' . self::$pid;
|
||||||
$user_ui_colorsyntax = dcCore::app()->auth->user_prefs->interface->colorsyntax;
|
$user_ui_colorsyntax = dcCore::app()->auth->user_prefs->interface->colorsyntax;
|
||||||
$user_ui_colorsyntax_theme = dcCore::app()->auth->user_prefs->interface->colorsyntax_theme;
|
$user_ui_colorsyntax_theme = dcCore::app()->auth->user_prefs->interface->colorsyntax_theme;
|
||||||
$combo = self::comboModules($modules, $excludes);
|
$combo = self::comboModules($modules, $excludes);
|
||||||
$file_pattern = dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('file_pattern');
|
$file_pattern = dcCore::app()->blog->settings->get(self::$pid)->get('file_pattern');
|
||||||
|
|
||||||
# check dcstore repo
|
# check dcstore repo
|
||||||
$url = '';
|
$url = '';
|
||||||
|
@ -139,7 +141,7 @@ class Admin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'<div class="multi-part" id="' . basename(__NAMESPACE__) . '" title="' . dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') . '">' .
|
'<div class="multi-part" id="' . self::$pid . '" title="' . dcCore::app()->plugins->moduleInfo(self::$pid, 'name') . '">' .
|
||||||
'<h3>' . __('Tweak third-party repositories') . '</h3>';
|
'<h3>' . __('Tweak third-party repositories') . '</h3>';
|
||||||
|
|
||||||
if (!empty($_POST['write_xml'])) {
|
if (!empty($_POST['write_xml'])) {
|
||||||
|
@ -191,7 +193,7 @@ class Admin
|
||||||
if (empty($file_pattern)) {
|
if (empty($file_pattern)) {
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
'<div class="fieldset"><h4>' . __('Generate xml code') . '</h4><p class="info"><a href="%s">%s</a></p></div>',
|
'<div class="fieldset"><h4>' . __('Generate xml code') . '</h4><p class="info"><a href="%s">%s</a></p></div>',
|
||||||
dcCore::app()->adminurl->get('admin.plugins', ['module' => basename(__NAMESPACE__), 'conf' => 1, 'redir' => $page_url]),
|
dcCore::app()->adminurl->get('admin.plugins', ['module' => self::$pid, 'conf' => 1, 'redir' => $page_url]),
|
||||||
__('You must configure zip file pattern to complete xml code automatically.')
|
__('You must configure zip file pattern to complete xml code automatically.')
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -248,13 +250,13 @@ class Admin
|
||||||
]
|
]
|
||||||
) . '</p>' .
|
) . '</p>' .
|
||||||
'<p><input type="submit" name="write_xml" value="' . __('Save to module directory') . '" /> ' .
|
'<p><input type="submit" name="write_xml" value="' . __('Save to module directory') . '" /> ' .
|
||||||
'<a class="hidden-if-no-js button" href="#' . basename(__NAMESPACE__) . '" id="ts_copy_button">' . __('Copy to clipboard') . '</a>' .
|
'<a class="hidden-if-no-js button" href="#' . self::$pid . '" id="ts_copy_button">' . __('Copy to clipboard') . '</a>' .
|
||||||
form::hidden('buildxml_id', $_POST['buildxml_id']) .
|
form::hidden('buildxml_id', $_POST['buildxml_id']) .
|
||||||
dcCore::app()->formNonce() . '</p>';
|
dcCore::app()->formNonce() . '</p>';
|
||||||
}
|
}
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
'<p class="info"><a href="%s">%s</a></p>',
|
'<p class="info"><a href="%s">%s</a></p>',
|
||||||
dcCore::app()->adminurl->get('admin.plugins', ['module' => basename(__NAMESPACE__), 'conf' => 1, 'redir' => $page_url]),
|
dcCore::app()->adminurl->get('admin.plugins', ['module' => self::$pid, 'conf' => 1, 'redir' => $page_url]),
|
||||||
__('You can edit zip file pattern from configuration page.')
|
__('You can edit zip file pattern from configuration page.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,14 @@ use Exception;
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
|
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') && defined('DC_CONTEXT_MODULE')) {
|
if (defined('DC_CONTEXT_ADMIN') && defined('DC_CONTEXT_MODULE')) {
|
||||||
dcPage::checkSuper();
|
dcPage::checkSuper();
|
||||||
|
self::$pid = basename(dirname(__DIR__));
|
||||||
self::$init = true;
|
self::$init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@ class Config
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$s = dcCore::app()->blog->settings->get(basename(__NAMESPACE__));
|
$s = dcCore::app()->blog->settings->get(self::$pid);
|
||||||
$s->put('active', !empty($_POST['s_active']));
|
$s->put('active', !empty($_POST['s_active']));
|
||||||
$s->put('packman', !empty($_POST['s_packman']));
|
$s->put('packman', !empty($_POST['s_packman']));
|
||||||
$s->put('file_pattern', $_POST['s_file_pattern']);
|
$s->put('file_pattern', $_POST['s_file_pattern']);
|
||||||
|
@ -59,7 +61,7 @@ class Config
|
||||||
__('Configuration successfully updated')
|
__('Configuration successfully updated')
|
||||||
);
|
);
|
||||||
http::redirect(
|
http::redirect(
|
||||||
dcCore::app()->admin->__get('list')->getURL('module=' . basename(__NAMESPACE__) . '&conf=1&redir=' . dcCore::app()->admin->__get('list')->getRedir())
|
dcCore::app()->admin->__get('list')->getURL('module=' . self::$pid . '&conf=1&redir=' . dcCore::app()->admin->__get('list')->getRedir())
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -72,11 +74,11 @@ class Config
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
$s = dcCore::app()->blog->settings->get(basename(__NAMESPACE__));
|
$s = dcCore::app()->blog->settings->get(self::$pid);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="fieldset">
|
<div class="fieldset">
|
||||||
<h4>' . dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') . '</h4>
|
<h4>' . dcCore::app()->plugins->moduleInfo(self::$pid, 'name') . '</h4>
|
||||||
|
|
||||||
<p><label class="classic" for="s_active">' .
|
<p><label class="classic" for="s_active">' .
|
||||||
form::checkbox('s_active', 1, (bool) $s->get('active')) . ' ' .
|
form::checkbox('s_active', 1, (bool) $s->get('active')) . ' ' .
|
||||||
|
|
|
@ -41,7 +41,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',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue