AvocadoAmber/AvocadoEdition_Light/adm/addon_config.php
2024-10-05 06:00:46 +09:00

107 lines
3.2 KiB
PHP

<?php
include_once __DIR__ . '/_common.php';
include_once G5_EDITOR_LIB;
if ($is_admin != 'super') {
alert_close('최고관리자만 접근 가능합니다.');
}
if (!sql_fetch_array(sql_query("DESC {$g5['addons_config_table']}"))) {
sql_query("CREATE TABLE {$g5['addons_config_table']} (
addon_name VARCHAR(255) PRIMARY KEY,
addon_version VARCHAR(255),
addon_config TEXT
);");
}
$g5['title'] = "애드온 설정";
include_once __DIR__ . '/admin.head.php';
add_stylesheet(get_embed_file("css", G5_PATH . "/adm/css/addon_config.css"), 1);
?>
<section class="addon_config">
<nav><span>설치된 애드온 목록</span><?php
if (!empty(AddonLoader::$addons)) {
foreach (AddonLoader::$addons as $menu) {
$selected = isset($_GET["addon"]) && $_GET["addon"] == $menu->className ? " selected" : "";
echo "<a href=\"./addon_config.php?addon={$menu->className}\" class=\"addon_menu{$selected}\">{$menu->name}</a>";
}
} else {
echo "<a href=\"#\">설치된 애드온이 없습니다.</a>";
}
?></nav>
<section>
<?php
if (isset($_GET["addon"])) {
if (array_key_exists($_GET["addon"], AddonLoader::$addons)) {
$addon = AddonLoader::$addons[$addon];
?>
<header>
<div class="tbl_frm01 tbl_wrap">
<table>
<colgroup>
<col style="width: 140px;">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">
애드온 이름
</th>
<td>
<?= $addon->name ?>
</td>
</tr>
<tr>
<th scope="row">
애드온 제작자
</th>
<td>
<?= $addon->link ? "<a href=\"" . $addon->link . "\" target=\"_blank\">" . $addon->author . "</a>" : $addon->author ?>
</td>
</tr>
<tr>
<th scope="row">
애드온 설명
</th>
<td>
<?= $addon->description ?>
</td>
</tr>
<tr>
<th scope="row">
애드온 버전
</th>
<td>
<?= $addon->version ?>
</td>
</tr>
</tbody>
</table>
</div>
</header>
<content>
<form method="POST" action="./addon_config_update.php">
<input type="hidden" name="addon" value="<?= $addon->className ?>" />
<?php
if (method_exists($addon, "printConfigForm")) {
$addon->printConfigForm();
}
?>
<div class="btn_confirm">
<div class="btn">
<span class="material-icons">save</span>
<input type="submit" value="저장" class="btn_submit" accesskey="s">
</div>
</div>
</form>
</content><?php
}
} else {
echo "애드온을 선택하세요";
}
?>
</section>
</section>
<?php
include_once __DIR__ . '/admin.tail.php';