update addon
This commit is contained in:
parent
db14446cb2
commit
100483d838
20 changed files with 457 additions and 26 deletions
3
AvocadoEdition_Light/addons/sample/config.php
Normal file
3
AvocadoEdition_Light/addons/sample/config.php
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
if (!defined("_GNUBOARD_") && !defined("G5_IS_ADMIN"))
|
||||||
|
exit();
|
||||||
|
|
@ -1,3 +1,86 @@
|
||||||
<?php
|
<?php
|
||||||
if (!defined("_GNUBOARD_"))
|
class SampleAddon extends Addon
|
||||||
exit();
|
{
|
||||||
|
public $name = "sample addon";
|
||||||
|
public $description = "샘플 애드온입니다.";
|
||||||
|
public $author = "Amber";
|
||||||
|
public $link = "https://info.drk.st/about";
|
||||||
|
public $version = "1.0.0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Addon Loader 에서 자동으로 설정되는 값입니다.
|
||||||
|
* @var string $className
|
||||||
|
*/
|
||||||
|
public $className;
|
||||||
|
/**
|
||||||
|
* Addon Loader 에서 자동으로 설정되는 값입니다.
|
||||||
|
* @var string $addonPath
|
||||||
|
*/
|
||||||
|
public $addonPath;
|
||||||
|
/**
|
||||||
|
* Addon Loader 에서 자동으로 설정되는 값입니다.
|
||||||
|
* @var string $addonFile
|
||||||
|
*/
|
||||||
|
public $addonFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 애드온 생성자입니다.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __contstruct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 애드온 동작을 이곳에 구현합니다. 현재는 $data 에 아무 값도 할당되지 않습니다.
|
||||||
|
* 필요한 경우 global $g5; 등을 통해 글로벌 변수를 가져와야 합니다.
|
||||||
|
* @param mixed $data
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function init($data = [])
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 설정 페이지를 출력하는 함수입니다.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function printConfigForm()
|
||||||
|
{
|
||||||
|
$config = $this->getConfig();
|
||||||
|
echo '<div class="tbl_frm01 tbl_wrap">
|
||||||
|
<table>
|
||||||
|
<colgroup>
|
||||||
|
<col style="width: 140px;">
|
||||||
|
<col>
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
애드온 기능 활성화
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="sample_addon_use" value="use" ' . (isset($config["sample_addon_use"]) ? "checked " : "" ) . '/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
global $g5;
|
||||||
|
|
||||||
|
$sql = "SELECT addon_config FROM {$g5['addons_config_table']} WHERE addon_name = '{$this->className}'";
|
||||||
|
$result = sql_fetch($sql);
|
||||||
|
|
||||||
|
if ($result && isset($result['addon_config'])) {
|
||||||
|
return json_decode($result['addon_config'], true) ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
if (!defined("_GNUBOARD_"))
|
|
||||||
exit();
|
|
||||||
|
|
@ -7,22 +7,24 @@ $menu["config"] = new MenuCategory("config", "config", "사이트 설정", "/sit
|
||||||
$menu["config"]->addChildMenu("config", "환경설정", G5_ADMIN_URL . "/site_config_form.php", true, 1, "\F3E5", 0);
|
$menu["config"]->addChildMenu("config", "환경설정", G5_ADMIN_URL . "/site_config_form.php", true, 1, "\F3E5", 0);
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/site_config_form_update.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/site_config_form_update.php");
|
||||||
|
|
||||||
$menu["config"]->addChildMenu("config", "테마 설정", G5_ADMIN_URL . "/theme.php", true, 2, "\F4B2", 0);
|
$menu["config"]->addChildMenu("config", "애드온 설정", G5_ADMIN_URL . "/addon_config.php", true, 2, "\F4CA", 0);
|
||||||
|
|
||||||
|
$menu["config"]->addChildMenu("config", "홈페이지 폰트 설정", G5_ADMIN_URL . "/editor_font.php", true, 3, "\F5CB", 0);
|
||||||
|
$menu["config"]->getLastAddedMenu()->addSubURL("/editor_font_update.php");
|
||||||
|
|
||||||
|
$menu["config"]->addChildMenu("config", "테마 설정", G5_ADMIN_URL . "/theme.php", true, 4, "\F4B2", 0);
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_config_load.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_config_load.php");
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_detail.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_detail.php");
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_update.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_update.php");
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_preview.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/theme_preview.php");
|
||||||
|
|
||||||
$menu["config"]->addChildMenu("config", "메인 편집", G5_ADMIN_URL . "/viewer_form.php", true, 3, "\F3F4", 0);
|
$menu["config"]->addChildMenu("config", "디자인 설정", G5_ADMIN_URL . "/design_form.php", true, 5, "\F1D8", 0);
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/viewer_form_update.php");
|
|
||||||
|
|
||||||
$menu["config"]->addChildMenu("config", "디자인 설정", G5_ADMIN_URL . "/design_form.php", true, 4, "\F1D8", 0);
|
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/design_form_update.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/design_form_update.php");
|
||||||
|
|
||||||
$menu["config"]->addChildMenu("config", "HTML에디터 폰트 설정", G5_ADMIN_URL . "/editor_font.php", true, 5, "\F3DA", 0);
|
$menu["config"]->addChildMenu("config", "메인 편집", G5_ADMIN_URL . "/viewer_form.php", true, 6, "\F891", 0);
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/editor_font_update.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/viewer_form_update.php");
|
||||||
|
|
||||||
$menu["config"]->addChildMenu("config", "메뉴 설정", G5_ADMIN_URL . "/menu_list.php", true, 6, "\F478", 0);
|
$menu["config"]->addChildMenu("config", "메뉴 설정", G5_ADMIN_URL . "/menu_list.php", true, 7, "\F478", 0);
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/menu_list_update.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/menu_list_update.php");
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/menu_form.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/menu_form.php");
|
||||||
$menu["config"]->getLastAddedMenu()->addSubURL("/menu_form_search.php");
|
$menu["config"]->getLastAddedMenu()->addSubURL("/menu_form_search.php");
|
||||||
|
|
|
||||||
107
AvocadoEdition_Light/adm/addon_config.php
Normal file
107
AvocadoEdition_Light/adm/addon_config.php
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?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';
|
||||||
54
AvocadoEdition_Light/adm/addon_config_update.php
Normal file
54
AvocadoEdition_Light/adm/addon_config_update.php
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
include_once __DIR__ . '/_common.php';
|
||||||
|
|
||||||
|
if ($is_admin != 'super') {
|
||||||
|
alert_close('최고관리자만 접근 가능합니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!isset($_POST['addon']) || empty($_POST['addon'])) {
|
||||||
|
alert('애드온 이름이 지정되지 않았습니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$addon_name = $_POST['addon'];
|
||||||
|
$filter = [
|
||||||
|
"addon",
|
||||||
|
"token"
|
||||||
|
];
|
||||||
|
|
||||||
|
if (array_key_exists($addon_name, AddonLoader::$addons)) {
|
||||||
|
$addon = AddonLoader::$addons[$addon_name];
|
||||||
|
|
||||||
|
$config_data = [];
|
||||||
|
foreach ($_POST as $key => $value) {
|
||||||
|
if (!in_array($key, $filter)) {
|
||||||
|
$config_data[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$config_data["saved_date"] = (new DateTime())->getTimestamp();
|
||||||
|
|
||||||
|
$config_json = addslashes(json_encode($config_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||||
|
|
||||||
|
$sql = " SELECT COUNT(*) as cnt FROM {$g5['addons_config_table']} WHERE addon_name = '{$addon_name}' ";
|
||||||
|
$row = sql_fetch($sql);
|
||||||
|
|
||||||
|
if ($row['cnt'] > 0) {
|
||||||
|
$sql = " UPDATE {$g5['addons_config_table']}
|
||||||
|
SET addon_config = '{$config_json}',
|
||||||
|
addon_version = '{$addon->version}'
|
||||||
|
WHERE addon_name = '{$addon_name}' ";
|
||||||
|
} else {
|
||||||
|
$sql = " INSERT INTO {$g5['addons_config_table']}
|
||||||
|
SET addon_name = '{$addon_name}',
|
||||||
|
addon_config = '{$config_json}',
|
||||||
|
addon_version = '{$addon->version}' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
sql_query($sql);
|
||||||
|
} else {
|
||||||
|
alert("애드온이 설정되지 않았습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
goto_url('./addon_config.php?addon=' . $addon_name);
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
if (!defined('_GNUBOARD_'))
|
if (!defined('_GNUBOARD_'))
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
$begin_time = get_microtime();
|
$begin_time = microtime(true);
|
||||||
|
|
||||||
include_once G5_PATH . '/head.sub.php';
|
include_once G5_PATH . '/head.sub.php';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
70
AvocadoEdition_Light/adm/css/addon_config.css
Normal file
70
AvocadoEdition_Light/adm/css/addon_config.css
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
|
||||||
|
th a {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 3px 10px;
|
||||||
|
background: #ecc6c6;
|
||||||
|
color: #fff;
|
||||||
|
margin: 5px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
th a+a {
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrap {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
padding: 0 !important;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrapper {
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container section.addon_config {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
padding: 8px;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon_config>nav {
|
||||||
|
min-width: 200px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border: 1px solid #d18686;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon_config>nav>* {
|
||||||
|
padding: 0 12px;
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon_config>nav>a.selected {
|
||||||
|
background: #ecc6c6;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon_config>nav>span {
|
||||||
|
background: #d18686;
|
||||||
|
color: #FFF;
|
||||||
|
line-height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addon_config>section {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td a {
|
||||||
|
color: #d18686;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @suppress php0410
|
* @var string[][] $cs_etc_1
|
||||||
|
* @var string[][] $cs_etc_2
|
||||||
|
* @var string[][] $cs_etc_3
|
||||||
|
* @var string[][] $cs_etc_4
|
||||||
|
* @var string[][] $cs_etc_5
|
||||||
|
* @var string[][] $cs_etc_6
|
||||||
|
* @var string[][] $cs_etc_7
|
||||||
|
* @var string[][] $cs_etc_8
|
||||||
|
* @var string[][] $cs_etc_9
|
||||||
|
* @var string[][] $cs_etc_10
|
||||||
|
* @var string[][] $cs_etc_11
|
||||||
|
* @var string[][] $cs_etc_12
|
||||||
|
* @var string[][] $cs_etc_13
|
||||||
|
* @var string[][] $cs_etc_14
|
||||||
|
* @var string[][] $cs_etc_15
|
||||||
|
* @var string[][] $cs_etc_16
|
||||||
|
* @var string[][] $cs_etc_17
|
||||||
|
* @var string[][] $cs_etc_18
|
||||||
|
* @var string[][] $cs_etc_19
|
||||||
|
* @var string[][] $cs_etc_20
|
||||||
*/
|
*/
|
||||||
$sub_menu = "100300";
|
$sub_menu = "100300";
|
||||||
include_once "./_common.php";
|
include_once "./_common.php";
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ $result = sql_query($sql);
|
||||||
$g5['title'] = "에디터 폰트 관리";
|
$g5['title'] = "에디터 폰트 관리";
|
||||||
|
|
||||||
include_once __DIR__ . '/admin.head.php';
|
include_once __DIR__ . '/admin.head.php';
|
||||||
|
|
||||||
|
EventHandler::triggerEvent("amber.admin.editor_font_form_before");
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
th a {
|
th a {
|
||||||
|
|
@ -167,4 +169,5 @@ include_once __DIR__ . '/admin.head.php';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
EventHandler::triggerEvent("amber.admin.editor_font_form_after");
|
||||||
include_once __DIR__ . '/admin.tail.php';
|
include_once __DIR__ . '/admin.tail.php';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
include_once "./_common.php";
|
include_once "./_common.php";
|
||||||
|
|
||||||
|
|
||||||
if ($is_admin != 'super') {
|
if ($is_admin != 'super') {
|
||||||
alert('최고관리자만 접근 가능합니다.');
|
alert('최고관리자만 접근 가능합니다.');
|
||||||
}
|
}
|
||||||
|
|
@ -18,6 +19,8 @@ if ($w == '') {
|
||||||
$font_css = isset($_POST['font_css']) ? stripslashes(trim($_POST['font_css'])) : '';
|
$font_css = isset($_POST['font_css']) ? stripslashes(trim($_POST['font_css'])) : '';
|
||||||
$font_name = isset($_POST['font_name']) ? clean_xss_tags(trim($_POST['font_name'])) : '';
|
$font_name = isset($_POST['font_name']) ? clean_xss_tags(trim($_POST['font_name'])) : '';
|
||||||
|
|
||||||
|
EventHandler::triggerEvent("amber.admin.editor_font_update_before", $font_css, $font_name);
|
||||||
|
|
||||||
if (empty($font_css) || empty($font_name)) {
|
if (empty($font_css) || empty($font_name)) {
|
||||||
alert('@font-face CSS 또는 @import URL과 폰트 이름은 필수 입력 항목입니다.');
|
alert('@font-face CSS 또는 @import URL과 폰트 이름은 필수 입력 항목입니다.');
|
||||||
}
|
}
|
||||||
|
|
@ -70,11 +73,13 @@ if ($w == '') {
|
||||||
|
|
||||||
$msg = '폰트가 추가되었습니다.';
|
$msg = '폰트가 추가되었습니다.';
|
||||||
|
|
||||||
|
EventHandler::triggerEvent("amber.admin.editor_font_update_after", $font_css, $font_name);
|
||||||
} else if ($w == 'd') {
|
} else if ($w == 'd') {
|
||||||
$sql = " DELETE FROM {$g5['font_table']} WHERE font_id = '{$font_id}' ";
|
$sql = " DELETE FROM {$g5['font_table']} WHERE font_id = '{$font_id}' ";
|
||||||
sql_query($sql);
|
sql_query($sql);
|
||||||
|
|
||||||
$msg = '폰트가 삭제되었습니다.';
|
$msg = '폰트가 삭제되었습니다.';
|
||||||
|
EventHandler::triggerEvent("amber.admin.editor_font_update_deleted", $font_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($msg) {
|
if ($msg) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ auth_check($auth[$sub_menu], "d");
|
||||||
|
|
||||||
$mb = get_member($_POST['mb_id']);
|
$mb = get_member($_POST['mb_id']);
|
||||||
|
|
||||||
|
EventHandler::triggerEvent("amber.admin.member_delete_before", $mb, $qstr);
|
||||||
|
|
||||||
if (!$mb['mb_id'])
|
if (!$mb['mb_id'])
|
||||||
alert("회원자료가 존재하지 않습니다.");
|
alert("회원자료가 존재하지 않습니다.");
|
||||||
else if ($member['mb_id'] == $mb['mb_id'])
|
else if ($member['mb_id'] == $mb['mb_id'])
|
||||||
|
|
@ -22,6 +24,8 @@ check_admin_token();
|
||||||
// 회원자료 삭제
|
// 회원자료 삭제
|
||||||
member_delete($mb['mb_id']);
|
member_delete($mb['mb_id']);
|
||||||
|
|
||||||
|
EventHandler::triggerEvent("amber.admin.member_delete_after", $mb, $qstr);
|
||||||
|
|
||||||
if ($url)
|
if ($url)
|
||||||
goto_url("{$url}?$qstr&w=u&mb_id=$mb_id");
|
goto_url("{$url}?$qstr&w=u&mb_id=$mb_id");
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ for ($i = 0; $i < count($chk); $i++) {
|
||||||
|
|
||||||
$mb = get_member($_POST['mb_id'][$k]);
|
$mb = get_member($_POST['mb_id'][$k]);
|
||||||
|
|
||||||
|
EventHandler::triggerEvent("amber.admin.member_delete_list_before", $mb);
|
||||||
|
|
||||||
if (!$mb['mb_id']) {
|
if (!$mb['mb_id']) {
|
||||||
$msg .= "{$mb['mb_id']} : 회원자료가 존재하지 않습니다.\\n";
|
$msg .= "{$mb['mb_id']} : 회원자료가 존재하지 않습니다.\\n";
|
||||||
} else if ($member['mb_id'] == $mb['mb_id']) {
|
} else if ($member['mb_id'] == $mb['mb_id']) {
|
||||||
|
|
@ -27,9 +29,12 @@ for ($i = 0; $i < count($chk); $i++) {
|
||||||
// 회원자료 삭제
|
// 회원자료 삭제
|
||||||
member_delete($mb['mb_id']);
|
member_delete($mb['mb_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EventHandler::triggerEvent("amber.admin.member_delete_list_after", $mb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($msg)
|
if ($msg) {
|
||||||
echo "<script type='text/javascript'> alert('$msg'); </script>";
|
echo "<script type='text/javascript'> alert('$msg'); </script>";
|
||||||
|
}
|
||||||
|
|
||||||
goto_url("./member_list.php?$qstr");
|
goto_url("./member_list.php?$qstr");
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ if (!count($_POST['chk'])) {
|
||||||
auth_check($auth[$sub_menu], 'w');
|
auth_check($auth[$sub_menu], 'w');
|
||||||
|
|
||||||
if ($_POST['act_button'] == "선택수정") {
|
if ($_POST['act_button'] == "선택수정") {
|
||||||
|
|
||||||
for ($i = 0; $i < count($_POST['chk']); $i++) {
|
for ($i = 0; $i < count($_POST['chk']); $i++) {
|
||||||
// 실제 번호를 넘김
|
// 실제 번호를 넘김
|
||||||
$k = $_POST['chk'][$i];
|
$k = $_POST['chk'][$i];
|
||||||
|
|
|
||||||
17
AvocadoEdition_Light/classes/addon/addon.class.php
Normal file
17
AvocadoEdition_Light/classes/addon/addon.class.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
class Addon
|
||||||
|
{
|
||||||
|
public $name = "";
|
||||||
|
public $description = "";
|
||||||
|
public $author = "";
|
||||||
|
public $link = "https://info.drk.st/about";
|
||||||
|
public $version = "";
|
||||||
|
public $className;
|
||||||
|
public $addonFile;
|
||||||
|
public $addonPath;
|
||||||
|
|
||||||
|
public function __contstruct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
class AddonLoader
|
||||||
|
{
|
||||||
|
private $addonPath;
|
||||||
|
/**
|
||||||
|
* @var Addon[] $addons
|
||||||
|
*/
|
||||||
|
public static $addons;
|
||||||
|
|
||||||
|
public function __construct($addonPath)
|
||||||
|
{
|
||||||
|
$this->addonPath = $addonPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadAddons()
|
||||||
|
{
|
||||||
|
if (!is_dir($this->addonPath)) {
|
||||||
|
throw new Exception("지정한 폴더가 디렉토리가 아닙니다.: " . $this->addonPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
$addonDirs = glob("{$this->addonPath}/*", GLOB_ONLYDIR);
|
||||||
|
|
||||||
|
foreach ($addonDirs as $addonDir) {
|
||||||
|
$addonName = basename($addonDir);
|
||||||
|
$addonFile = $addonDir . '/' . $addonName . '.addon.php';
|
||||||
|
|
||||||
|
if (file_exists($addonFile)) {
|
||||||
|
require_once $addonFile;
|
||||||
|
|
||||||
|
$className = $this->getAddonClassName($addonName);
|
||||||
|
if (class_exists($className)) {
|
||||||
|
$addon = new $className();
|
||||||
|
$addon->className = $className;
|
||||||
|
$addon->addonFile = $addonFile;
|
||||||
|
$addon->addonPath = $addonDir;
|
||||||
|
$addon->init();
|
||||||
|
|
||||||
|
self::$addons[$className] = $addon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getAddonClassName($addonName)
|
||||||
|
{
|
||||||
|
return str_replace(' ', '', ucwords(str_replace('_', ' ', $addonName))) . 'Addon';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,12 @@ class EventHandler
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $gnuboardCompatibleList = [
|
protected static $gnuboardCompatibleList = [
|
||||||
|
// adm/editor_font.php
|
||||||
|
"amber.admin.editor_font_form_before" => "", // amber only
|
||||||
|
"amber.admin.editor_font_form_after" => "", // amber only
|
||||||
|
// adm/editor_font_update.php
|
||||||
|
"amber.admin.editor_font_update_before" => "", // amber only
|
||||||
|
"amber.admin.editor_font_update_after" => "", // amber only
|
||||||
// common.php
|
// common.php
|
||||||
"gnuboard.loadlibs.after" => "", // amber only
|
"gnuboard.loadlibs.after" => "", // amber only
|
||||||
"gnuboard.htmlprocess.before" => "common_header",
|
"gnuboard.htmlprocess.before" => "common_header",
|
||||||
|
|
@ -197,7 +203,7 @@ class EventHandler
|
||||||
else if ($key === 1)
|
else if ($key === 1)
|
||||||
$key = "end";
|
$key = "end";
|
||||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
||||||
$cf = $backtrace[1]['function'] ?? 'global scope';
|
$cf = $backtrace[1]['function'] ? $backtrace[1]['function'] : 'global scope';
|
||||||
self::addStopwatch("{$cf} {$key}");
|
self::addStopwatch("{$cf} {$key}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,14 @@ include_once $g5_path['path'] . '/config.php';
|
||||||
$_system = new stdClass;
|
$_system = new stdClass;
|
||||||
$_system->g5_path = $g5_path;
|
$_system->g5_path = $g5_path;
|
||||||
$_system->classes = load_libs(__DIR__ . "/classes", "class");
|
$_system->classes = load_libs(__DIR__ . "/classes", "class");
|
||||||
$_system->addons = load_libs(__DIR__ . "/addons", "addon");
|
// $_system->addons = load_libs(__DIR__ . "/addons", "addon");
|
||||||
|
|
||||||
|
define("G5_ADDON_PATH", __DIR__ . "/addons");
|
||||||
|
|
||||||
|
// addon loader
|
||||||
|
$_addon_loader = new AddonLoader(G5_ADDON_PATH);
|
||||||
|
$_addon_loader->loadAddons();
|
||||||
|
|
||||||
// future update... maybe
|
// future update... maybe
|
||||||
// $_system->modules = load_libs(__DIR__ . "/modules", "model");
|
// $_system->modules = load_libs(__DIR__ . "/modules", "model");
|
||||||
// $_system->modules = load_libs(__DIR__ . "/modules");
|
// $_system->modules = load_libs(__DIR__ . "/modules");
|
||||||
|
|
@ -352,7 +359,9 @@ $dbconfig_file = G5_DATA_PATH . '/' . G5_DBCONFIG_FILE;
|
||||||
if (file_exists($dbconfig_file)) {
|
if (file_exists($dbconfig_file)) {
|
||||||
include_once $dbconfig_file;
|
include_once $dbconfig_file;
|
||||||
include_once G5_LIB_PATH . '/common.lib.php'; // 공통 라이브러리
|
include_once G5_LIB_PATH . '/common.lib.php'; // 공통 라이브러리
|
||||||
|
|
||||||
$g5["font_table"] = G5_TABLE_PREFIX . "editor_fonts";
|
$g5["font_table"] = G5_TABLE_PREFIX . "editor_fonts";
|
||||||
|
$g5["addons_config_table"] = G5_TABLE_PREFIX . "addons_config";
|
||||||
|
|
||||||
$connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD) or die('MySQL Connect Error!!!');
|
$connect_db = sql_connect(G5_MYSQL_HOST, G5_MYSQL_USER, G5_MYSQL_PASSWORD) or die('MySQL Connect Error!!!');
|
||||||
$select_db = sql_select_db(G5_MYSQL_DB, $connect_db) or die('MySQL DB Error!!!');
|
$select_db = sql_select_db(G5_MYSQL_DB, $connect_db) or die('MySQL DB Error!!!');
|
||||||
|
|
@ -588,7 +597,7 @@ if (isset($_REQUEST['url'])) {
|
||||||
$url = '';
|
$url = '';
|
||||||
$urlencode = urlencode($_SERVER['REQUEST_URI']);
|
$urlencode = urlencode($_SERVER['REQUEST_URI']);
|
||||||
if (defined("G5_DOMAIN")) {
|
if (defined("G5_DOMAIN")) {
|
||||||
$p = @parse_url(G5_DOMAIN ?? "");
|
$p = @parse_url(G5_DOMAIN ? G5_DOMAIN : "");
|
||||||
$p['path'] = isset($p['path']) ? $p['path'] : '/';
|
$p['path'] = isset($p['path']) ? $p['path'] : '/';
|
||||||
$urlencode = G5_DOMAIN . urldecode(preg_replace("/^" . urlencode($p['path']) . "/", "", $urlencode));
|
$urlencode = G5_DOMAIN . urldecode(preg_replace("/^" . urlencode($p['path']) . "/", "", $urlencode));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ class Hook
|
||||||
* @param mixed $args → optional arguments
|
* @param mixed $args → optional arguments
|
||||||
* @param bool $remove → delete hook after executing actions
|
* @param bool $remove → delete hook after executing actions
|
||||||
*
|
*
|
||||||
* @return returns the output of the last action or false
|
* @return mixed returns the output of the last action or false
|
||||||
*/
|
*/
|
||||||
public static function doAction($tag, $args = array(), $remove = true)
|
public static function doAction($tag, $args = array(), $remove = true)
|
||||||
{
|
{
|
||||||
|
|
@ -245,15 +245,15 @@ class Hook
|
||||||
* @param string $action → action hook
|
* @param string $action → action hook
|
||||||
* @param int $args → arguments
|
* @param int $args → arguments
|
||||||
*
|
*
|
||||||
* @return callable|false → returns the calling function
|
* @return callable|false|null → returns the calling function
|
||||||
*/
|
*/
|
||||||
protected function runAction($action, $args)
|
protected function runAction($action, $args)
|
||||||
{
|
{
|
||||||
$function = $action['function'];
|
$function = $action['function'];
|
||||||
$argsNumber = $action['arguments'];
|
$argsNumber = $action['arguments'];
|
||||||
|
|
||||||
$class = (isset($function[0])) ? $function[0] : false;
|
$class = isset($function[0]) ? $function[0] : false;
|
||||||
$method = (isset($function[1])) ? $function[1] : false;
|
$method = isset($function[1]) ? $function[1] : false;
|
||||||
|
|
||||||
$args = $this->getArguments($argsNumber, $args);
|
$args = $this->getArguments($argsNumber, $args);
|
||||||
|
|
||||||
|
|
@ -291,7 +291,7 @@ class Hook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isset($actions)) ? $actions : array();
|
return isset($actions) ? $actions : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue