mirror of
https://github.com/tateck-develop/AvocadoEdition_Light.git
synced 2026-01-02 13:32:04 +09:00
로드비 이모티콘 기능 추가
로드비 이모티콘 기능 추가
This commit is contained in:
parent
7a3d4c8575
commit
5fe90d61de
6 changed files with 220 additions and 0 deletions
4
AvocadoEdition_Light/skin/board/mmb/emoticon/_common.php
Normal file
4
AvocadoEdition_Light/skin/board/mmb/emoticon/_common.php
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
include_once('../../../../common.php');
|
||||||
|
include_once('./_setting.emoticon.php');
|
||||||
|
?>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
$g5['emoticon_table'] = G5_TABLE_PREFIX.'emoticon';
|
||||||
|
|
||||||
|
@mkdir(G5_DATA_PATH.'/emoticon', G5_DIR_PERMISSION);
|
||||||
|
@chmod(G5_DATA_PATH.'/emoticon', G5_DIR_PERMISSION);
|
||||||
|
|
||||||
|
// 이모티콘 테이블이 없을 경우 생성
|
||||||
|
if(!sql_query(" DESC {$g5['emoticon_table']} ")) {
|
||||||
|
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['emoticon_table']}` (
|
||||||
|
`me_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`me_text` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`me_img` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (`me_id`)
|
||||||
|
) ", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
123
AvocadoEdition_Light/skin/board/mmb/emoticon/index.php
Normal file
123
AvocadoEdition_Light/skin/board/mmb/emoticon/index.php
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
<?
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
// 이모티콘 목록 불러오기
|
||||||
|
$sql = "select * from {$g5['emoticon_table']} order by me_text asc";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
$emotions = array();
|
||||||
|
|
||||||
|
for($i=0; $row = sql_fetch_array($result); $i++) {
|
||||||
|
$emotions[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="ko" class='single'>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
|
||||||
|
<meta name="HandheldFriendly" content="true">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta http-equiv="imagetoolbar" content="no">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
||||||
|
|
||||||
|
<title>이모티콘 관리</title>
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link href="<?=G5_CSS_URL?>/default.css" rel="stylesheet">
|
||||||
|
<link href="<?=G5_CSS_URL?>/style.css" rel="stylesheet">
|
||||||
|
<link href="<?=G5_DATA_URL?>/css/_design.config.css?v=<?=$config['cf_css_version']?>" rel="stylesheet" />
|
||||||
|
<link href="./style.css" rel="stylesheet" />
|
||||||
|
|
||||||
|
<script src="<?php echo G5_JS_URL ?>/jquery-1.12.3.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<? if($is_admin) { ?><form name="frmEmoticon" method="post" id="frmEmoticon" action="./update.php" onsubmit="return femoticonlist_submit(this);" enctype="multipart/form-data"><? } ?>
|
||||||
|
|
||||||
|
<div id="emoticon_page">
|
||||||
|
<div id="emoticon_content">
|
||||||
|
<? if(count($emotions) <= 0) {
|
||||||
|
echo "<div class='no-data theme-box'><span>등록된 이모티콘이 없습니다.</span></div>";
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<ul class="theme-box">
|
||||||
|
<? for($i=0; $i < count($emotions); $i++) {
|
||||||
|
$row = $emotions[$i];
|
||||||
|
echo "<li>";
|
||||||
|
?>
|
||||||
|
<div class="thumb">
|
||||||
|
<img src="<?=G5_URL?><?=$row['me_img']?>" alt="" />
|
||||||
|
</div>
|
||||||
|
<div class="txt">
|
||||||
|
<? if($is_admin) { ?>
|
||||||
|
<input type="hidden" name="me_id[<?php echo $i ?>]" value="<?php echo $row['me_id'] ?>" id="me_id_<?php echo $i ?>">
|
||||||
|
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
|
||||||
|
<? } ?>
|
||||||
|
<span><?=$row['me_text']?></span>
|
||||||
|
</div>
|
||||||
|
<? echo "</li>"; } ?>
|
||||||
|
</ul>
|
||||||
|
<? } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<? if($is_admin) { ?>
|
||||||
|
<div id="emoticon_control" class="theme-box">
|
||||||
|
<div class="inner">
|
||||||
|
<div class="emoticon-add-form">
|
||||||
|
<div class="img form-input"><input type="file" name="me_img" accept="image/gif, image/jpeg, image/png"/><img src="" alt="" id="img" /><span><i>+</i></span></div>
|
||||||
|
<div class="txt"><input type="text" name="me_text" class="form-input" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="is-btn-box">
|
||||||
|
<input type="submit" class="ui-btn point" name="act_button" value="등록" onclick="document.pressed=this.value" />
|
||||||
|
<input type="submit" class="ui-btn etc" name="act_button" value="삭제" onclick="document.pressed=this.value" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<? } ?>
|
||||||
|
<? if($is_admin) { ?></form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function femoticonlist_submit(f) {
|
||||||
|
if(document.pressed == "삭제") {
|
||||||
|
if (!is_checked("chk[]")) {
|
||||||
|
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleImgFileSelect(e) {
|
||||||
|
var files = e.target.files;
|
||||||
|
var filesArr = Array.prototype.slice.call(files);
|
||||||
|
filesArr.forEach(function(f) {
|
||||||
|
if(!f.type.match("image.*")) {
|
||||||
|
alert("이미지가 아닙니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sel_file = f;
|
||||||
|
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.onload = function(e) {
|
||||||
|
$("#img").attr("src", e.target.result);
|
||||||
|
}
|
||||||
|
reader.readAsDataURL(f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$('*[name="me_img"]').on('change', handleImgFileSelect);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<? } ?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
31
AvocadoEdition_Light/skin/board/mmb/emoticon/style.css
Normal file
31
AvocadoEdition_Light/skin/board/mmb/emoticon/style.css
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
@charset "utf-8";
|
||||||
|
/* -----------------------------------------------
|
||||||
|
* 이모티콘 관리 관련 스타일
|
||||||
|
--------------------------------------------------
|
||||||
|
- 최초 작성일 :2022.12.17
|
||||||
|
- 최초 작성자 :아보카도
|
||||||
|
- 최종 수정일 :
|
||||||
|
- 최종 수정자 :
|
||||||
|
--------------------------------------------------*/
|
||||||
|
|
||||||
|
#emoticon_page {display:block; position:relative; padding:20px 20px 80px; max-width:640px; margin:0 auto;}
|
||||||
|
|
||||||
|
#emoticon_content {display:block; position:relative;}
|
||||||
|
#emoticon_content .no-data {text-align:center; padding:100px 10px;}
|
||||||
|
#emoticon_content ul:after {content:""; display:block; clear:both;}
|
||||||
|
#emoticon_content ul li {display:inline-block; position:relative; width:25%; vertical-align:top; text-align:center; padding:5px; box-sizing:border-box;}
|
||||||
|
#emoticon_content .thumb {display:block; position:relative; height:70px; overflow:hidden;}
|
||||||
|
#emoticon_content .thumb img {display:block; position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); -webkit-transform:translate(-50%, -50%); max-width:100%; max-height:100%;}
|
||||||
|
#emoticon_content .txt span {display:block;}
|
||||||
|
|
||||||
|
#emoticon_control {position:fixed; left:0; right:0; bottom:0; padding:10px; border-bottom-left-radius:0 !important; border-bottom-right-radius:0 !important;}
|
||||||
|
#emoticon_control .inner {display:block; position:relative; padding-right:110px; box-sizing:border-box; max-width:640px; margin:0 auto;}
|
||||||
|
#emoticon_control .is-btn-box {display:block; position:absolute; top:0; right:0; bottom:0;}
|
||||||
|
#emoticon_control .emoticon-add-form {display:block; position:relative; padding-left:60px; min-height:50px;}
|
||||||
|
#emoticon_control .emoticon-add-form .img {display:block; position:absolute; left:0; top:0; width:50px; height:50px; padding:0 !important; overflow:hidden; z-index:0;}
|
||||||
|
#emoticon_control .emoticon-add-form .img span {display:table; position:absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%; padding:0; z-index:-1;}
|
||||||
|
#emoticon_control .emoticon-add-form .img span > * {display:table-cell; vertical-align:middle; text-align:center; font-size:2em;}
|
||||||
|
#emoticon_control .emoticon-add-form .img input[type="file"] {display:block; position:absolute; top:0; left:0; width:100%; height:100% !important; z-index:1; opacity:0; cursor:pointer;}
|
||||||
|
#emoticon_control .emoticon-add-form .img img {display:block; position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); -webkit-transform:translate(-50%, -50%); max-width:90%; max-height:90%; z-index:0;}
|
||||||
|
#emoticon_control .emoticon-add-form .txt input {height:50px !important;}
|
||||||
|
#emoticon_control .is-btn-box .ui-btn {width:50px !important; height:50px !important; word-break:keep-all;}
|
||||||
41
AvocadoEdition_Light/skin/board/mmb/emoticon/update.php
Normal file
41
AvocadoEdition_Light/skin/board/mmb/emoticon/update.php
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
if(!$is_admin) alert("권한이 없습니다.");
|
||||||
|
|
||||||
|
if ($_POST['act_button'] == "등록") {
|
||||||
|
if ($img = $_FILES['me_img']['name']) {
|
||||||
|
if (!preg_match("/\.(gif|jpg|png)$/i", $img)) {
|
||||||
|
alert("이모티콘 이미지가 gif, jpg, png 파일이 아닙니다.");
|
||||||
|
} else {
|
||||||
|
$emoticon_path = G5_DATA_PATH.'/emoticon';
|
||||||
|
$emoticon_image_code = time();
|
||||||
|
$emoticon_image_path = "{$emoticon_path}/{$emoticon_image_code}";
|
||||||
|
$emoticon_image_url = "/data/emoticon/{$emoticon_image_code}";
|
||||||
|
|
||||||
|
move_uploaded_file($_FILES['me_img']['tmp_name'], $emoticon_image_path);
|
||||||
|
chmod($emoticon_image_path, 0606);
|
||||||
|
$sql_common = " , me_img = '{$emoticon_image_url}' ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($me_text != "") {
|
||||||
|
sql_query(" insert into {$g5['emoticon_table']} set me_text = '{$me_text}'".$sql_common);
|
||||||
|
}
|
||||||
|
} else if ($_POST['act_button'] == "삭제") {
|
||||||
|
|
||||||
|
for ($i=0; $i<count($_POST['chk']); $i++) {
|
||||||
|
$k = $_POST['chk'][$i];
|
||||||
|
$sql = " select * from {$g5['emoticon_table']} where me_id = '{$_POST['me_id'][$k]}' ";
|
||||||
|
$row = sql_fetch($sql);
|
||||||
|
if(!$row['me_id']) continue;
|
||||||
|
|
||||||
|
// 이모티콘 내역삭제
|
||||||
|
$sql = " delete from {$g5['emoticon_table']} where me_id = '{$_POST['me_id'][$k]}' ";
|
||||||
|
sql_query($sql);
|
||||||
|
// 이모티콘 이미지 삭제
|
||||||
|
@unlink(G5_PATH.$row['me_img']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
goto_url('./index.php');
|
||||||
|
?>
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
|
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
|
||||||
|
include_once($board_skin_path.'/emoticon/_setting.emoticon.php');
|
||||||
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
|
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
|
||||||
|
|
||||||
set_session('ss_bo_table', $_REQUEST['bo_table']);
|
set_session('ss_bo_table', $_REQUEST['bo_table']);
|
||||||
|
|
@ -39,6 +40,7 @@ $owner_behind = $owner_behind['cs_etc_4'];
|
||||||
<a href="<?php echo $write_href ?>" class="ui-btn point">등록하기</a>
|
<a href="<?php echo $write_href ?>" class="ui-btn point">등록하기</a>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<a href="<?php echo $list_href ?>" class="ui-btn">새로고침</a>
|
<a href="<?php echo $list_href ?>" class="ui-btn">새로고침</a>
|
||||||
|
<a href="<?php echo $board_skin_url ?>/emoticon/" class="ui-btn etc new_win">이모티콘</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<? if($write_pages) { ?><?php echo $write_pages; ?><? } ?>
|
<? if($write_pages) { ?><?php echo $write_pages; ?><? } ?>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue