Files

26 lines
916 B
PHP
Executable File

<?php
/**
* @file plug.php
* @brief Подключает плагин SvgEditorM для администраторов, перемещает sidebar и подгружает JS-модуль
*/
global $path, $_SESSION, $configAdmins;
if (in_array($_SESSION['username'], $configAdmins, true)) {
include $path . 'main_plugin/SvgEditorM/index.php';
echo '<link rel="stylesheet" type="text/css" href="/main_plugin/SvgEditorM/SvgEditorM.css">';
echo "<script type='module'>
document.addEventListener('DOMContentLoaded', () => {
const c = document.querySelector('.center-float');
const d = document.getElementById('sidebar');
if (c && d) {
c.appendChild(document.createElement('br'));
c.appendChild(d);
import('/main_plugin/SvgEditorM/SvgEditorM.js');
} else if (d) {
d.remove();
}
});
</script>";
}
?>