279 lines
14 KiB
PHP
279 lines
14 KiB
PHP
<?php
|
|
|
|
/**
|
|
* This is NOT a freeware, use is subject to license terms
|
|
* 应用名称: 贴吧楼中楼回复 9.0
|
|
* 下载地址: https://addon.dismall.com/plugins/replyfloor.html
|
|
* 应用开发者: 乘凉
|
|
* 开发者QQ: 594433766
|
|
* 更新日期: 202505310549
|
|
* 授权域名: www.shitangsweet.com
|
|
* 授权码: 2025053105b89RrI3R9n
|
|
* 未经应用程序开发者/所有者的书面许可,不得进行反向工程、反向汇编、反向编译等,不得擅自复制、修改、链接、转载、汇编、发表、出版、发展与之有关的衍生产品、作品等
|
|
*/
|
|
|
|
|
|
/**
|
|
* $author: 乘凉 $
|
|
*/
|
|
|
|
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
|
|
exit('Access Denied');
|
|
}
|
|
|
|
$op = in_array($_GET['op'], array('index','edit','clean')) ? $_GET['op'] : 'index';
|
|
|
|
if($op == 'index') {
|
|
if(!submitcheck('savesubmit')) {
|
|
$perpage = empty($_GET['perpage']) ? 30 : $_GET['perpage'];
|
|
$start = ($page-1)*$perpage;
|
|
$checkperpage = array();
|
|
$checkperpage[$perpage] = 'selected="selected"';
|
|
$intkeys = array('id', 'tid', 'pid');
|
|
$strkeys = array();
|
|
$randkeys = array();
|
|
$likekeys = array('username', 'message');
|
|
$results = getwheres($intkeys, $strkeys, $randkeys, $likekeys);
|
|
foreach($likekeys as $k) {
|
|
$_GET[$k] = dhtmlspecialchars($_GET[$k]);
|
|
}
|
|
$wherearr = $results['wherearr'];
|
|
$wherearr[] = "status = '1'";
|
|
$mpurl = ADMINSCRIPT."?action=$pluginurl&perpage=$perpage&".implode('&', $results['urls']);
|
|
$adminscript = ADMINSCRIPT;
|
|
$searchlang = array();
|
|
$keys = array('message_message', 'message_tid', 'message_pid', 'perpage_30', 'perpage_50', 'perpage_100', 'perpage_200');
|
|
foreach ($keys as $key) {
|
|
$searchlang[$key] = lang('plugin/'.$plugin['identifier'], $key);
|
|
}
|
|
echo <<<SEARCH
|
|
<form method="get" autocomplete="off" action="$adminscript" id="tb_search">
|
|
<div style="margin-top:8px;">
|
|
<table cellspacing="3" cellpadding="3">
|
|
<tr>
|
|
<th>$lang[username]</th><td><input type="text" class="txt" name="username" value="$_GET[username]"></td>
|
|
<th>$searchlang[message_message]</th><td><input type="text" class="txt" name="message" value="$_GET[message]"></td>
|
|
<th>$searchlang[message_tid]</th><td><input type="text" class="txt" name="tid" value="$_GET[tid]" size="4"></td>
|
|
<th>$searchlang[message_pid]</th><td><input type="text" class="txt" name="pid" value="$_GET[pid]" size="4"></td>
|
|
<td><select name="perpage" class="ps vm"><option value="30"$checkperpage[30]>$searchlang[perpage_30]</option><option value="50"$checkperpage[50]>$searchlang[perpage_50]</option><option value="100"$checkperpage[100]>$searchlang[perpage_100]</option><option value="200"$checkperpage[200]>$searchlang[perpage_200]</option></select></td>
|
|
<td>
|
|
<input type="hidden" name="action" value="plugins">
|
|
<input type="hidden" name="operation" value="config">
|
|
<input type="hidden" name="do" value="$pluginid">
|
|
<input type="hidden" name="identifier" value="$plugin[identifier]">
|
|
<input type="hidden" name="pmod" value="$_GET[pmod]">
|
|
<input type="hidden" name="act" value="$act">
|
|
<input type="hidden" name="op" value="$op">
|
|
<input type="submit" name="searchsubmit" value="$lang[search]" class="btn" id="submit_searchsubmit">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</form>
|
|
<script type="text/JavaScript">_attachEvent(document.documentElement, 'keydown', function (e) { entersubmit(e, 'searchsubmit'); });</script>
|
|
<style>
|
|
.replyfloor_content_text {word-break:break-all;}
|
|
.replyfloor_content_text img {height: 20px;}
|
|
.replyfloor_content_image {overflow: hidden;}
|
|
.replyfloor_content_image_li {float:left;width: 80px;height: 80px;margin:5px 5px 0 0;}
|
|
.replyfloor_content_image_li img {width: 80px;height: 80px;object-fit:cover;}
|
|
</style>
|
|
SEARCH;
|
|
showformheader($pluginurl);
|
|
showtableheader(lang('plugin/'.$plugin['identifier'], 'message_list'). '<a href="'.ADMINSCRIPT.'?action='.$pluginurl.'&op=clean" style="margin-left:10px">['.lang('plugin/'.$plugin['identifier'], 'recycle_clean').']</a>');
|
|
showsubtitle(array('', 'username', lang('plugin/'.$plugin['identifier'], 'message_message'), lang('plugin/'.$plugin['identifier'], 'message_createtime'), 'ip', ''));
|
|
$count = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_message')->count_by_search_where($wherearr);
|
|
$list = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_message')->fetch_all_by_search_where($wherearr,'order by createtime desc', $start, $perpage);
|
|
foreach ($list as $value) {
|
|
$value['message'] = replyfloor_discuzcode($value['message']);
|
|
if($setconfig['show_br']) {
|
|
$value['message'] = nl2br($value['message']);
|
|
}
|
|
$attachhtml = '';
|
|
if($value['attachment']) {
|
|
$attachhtml = '<div class="replyfloor_content_image">';
|
|
$attachlist = explode("\t", $value['attachment']);
|
|
foreach ($attachlist as $attach) {
|
|
$attachhtml .= '<div class="replyfloor_content_image_li"><a href="'.$attach.'" target="_blank"><img src="'.$attach.'" border="0" alt="" /></a></div>';
|
|
}
|
|
$attachhtml .= '</div>';
|
|
}
|
|
$value['createtime'] = dgmdate($value['createtime'], 'Y-n-j H:i');
|
|
showtablerow('', array('class="td25"', 'class="td24"', '', 'class="td24"', 'class="td24"', 'class="td32"'), array(
|
|
"<input class=\"checkbox\" type=\"checkbox\" name=\"ids[]\" value=\"$value[id]\">",
|
|
$value['username'],
|
|
'<div class="replyfloor_content_text">'.$value['message'].'</div>'.($attachhtml ? $attachhtml : ''),
|
|
$value['createtime'],
|
|
$value['postip'],
|
|
"<a href=\"".ADMINSCRIPT."?action=$pluginurl&op=edit&id=$value[id]\">".$lang['edit']."</a> ".
|
|
"<a href=\"forum.php?mod=redirect&goto=findpost&ptid=$value[tid]&pid=$value[pid]\" target=\"_blank\">".lang('plugin/'.$plugin['identifier'], 'message_viewpost')."</a>",
|
|
));
|
|
}
|
|
$multipage = multi($count, $perpage, $page, $mpurl);
|
|
|
|
showsubmit('savesubmit', 'submit', '<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(\'prefix\', this.form, \'ids\')" /><label for="chkall">'.cplang('select_all').'</label> <select name="optype"><option value="restore">'.lang('plugin/'.$plugin['identifier'], 'optype_restore').'</option><option value="delete">'.lang('plugin/'.$plugin['identifier'], 'optype_delete').'</option></select>', '', $multipage, false);
|
|
showtablefooter();
|
|
showformfooter();
|
|
} else {
|
|
if(is_array($_GET['ids'])) {
|
|
if($_GET['optype'] == 'restore') {
|
|
if($setconfig['get_credit']) {
|
|
require_once libfile('function/post');
|
|
require_once libfile('function_forum', 'function');
|
|
$list = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_message')->fetch_all_by_id($_GET['ids']);
|
|
foreach ($list as $value) {
|
|
$thread = get_thread_by_tid($value['tid']);
|
|
updatepostcredits('+', $value['uid'], 'reply', $thread['fid']);
|
|
}
|
|
}
|
|
C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_message')->restore_by_id($_GET['ids']);
|
|
}else{
|
|
replyfloor_deletemessage($_GET['ids'], 'id', 0);
|
|
}
|
|
}else{
|
|
cpmsg(lang('plugin/'.$plugin['identifier'], 'operate_not_check'), '', 'error');
|
|
}
|
|
cpmsg(lang('plugin/'.$plugin['identifier'], 'message_updatesucceed'), "action=$pluginurl", 'succeed');
|
|
}
|
|
} elseif($op == 'edit' && $_GET['id']) {
|
|
|
|
$item = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_message')->fetch_by_id($_GET['id']);
|
|
if(!$item) {
|
|
cpmsg(lang('plugin/'.$plugin['identifier'], 'message_nonexistence'), '', 'error');
|
|
}
|
|
if(!submitcheck('savesubmit')) {
|
|
showformheader("$pluginurl&op=edit&id=".$_GET['id'],'enctype');
|
|
showtableheader(lang('plugin/'.$plugin['identifier'], 'message_edit'));
|
|
showsetting(lang('plugin/'.$plugin['identifier'], 'message_message'), 'message', $item['message'], 'textarea', '', 0, lang('plugin/'.$plugin['identifier'], 'message_message_comment'));
|
|
|
|
showtablerow('', array('class="" colspan="2"'), array('<span class="replyfloor_content_upload" id="replyfloor_content_upload">'.lang('plugin/'.$plugin['identifier'], 'message_upload_image').'</span>'));
|
|
|
|
$attachhtml = '<div class="replyfloor_upimage" id="replyfloor_upimage">';
|
|
$attachlist = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_attachment')->fetch_all_by_msgid(array($item['id']), 'order by displayorder asc,dateline asc');
|
|
foreach ($attachlist as $attach) {
|
|
$attach['attachment'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'replyfloor/'. $attach['attachment'];
|
|
$attachhtml .= '<div class="replyfloor_upimage_li" id="replyfloor_upimage_li_'.$attach['id'].'"><div class="replyfloor_upimage_del"><a href="javascript:;" onclick="replyfloor_delimage('.$attach['id'].')" title="'.lang('plugin/'.$plugin['identifier'], 'attach_delete').'"></a></div><div class="replyfloor_upimage_img"><img src="'.$attach['attachment'].'" border="0" alt="'.$attach['filename'].'"/></div><input type="hidden" name="attach[]" value="'.$attach['id'].'" /></div>';
|
|
}
|
|
$attachhtml .= '</div>';
|
|
showtablerow('', array('class="" colspan="2"'), array($attachhtml));
|
|
|
|
showsubmit('savesubmit', 'submit');
|
|
showtablefooter();
|
|
showformfooter();
|
|
|
|
require_once libfile('function/upload');
|
|
$swfconfig = getuploadconfig($_G['uid']);
|
|
$verhash = random(5);
|
|
echo <<<EOT
|
|
<style>
|
|
.replyfloor_content_upload {background-color:#fff;border:1px solid #dbdbdb;color: #222;height: 32px;line-height: 32px;text-align: center;font-size: 14px;display: inline-block;width:120px;cursor:pointer;}
|
|
.replyfloor_upimage {overflow: hidden;}
|
|
.replyfloor_upimage_li {float:left;position:relative;margin:5px 5px 0 0;width:50px;height:50px;}
|
|
.replyfloor_upimage_img {width:50px;height:50px;}
|
|
.replyfloor_upimage_img img {display:block;width:50px;height:50px;object-fit:cover;}
|
|
.replyfloor_upimage_del {position:absolute;top:-3px;right:-3px;}
|
|
.replyfloor_upimage_del a {display:block;width:13px;height:11px;background: url("source/plugin/replyfloor/static/image/icon_close.png");}
|
|
</style>
|
|
<script type="text/javascript" src="source/plugin/replyfloor/static/js/plupload.js?$verhash"></script>
|
|
<script type="text/javascript" src="source/plugin/replyfloor/static/js/common.js?$verhash" charset="utf-8"></script>
|
|
<script type="text/JavaScript">
|
|
replyfloor_plupload({
|
|
auto: true,
|
|
upload_url: "plugin.php?id=replyfloor:attachment&operation=upload",
|
|
post_params : {"uid" : "$_G[uid]", "hash":"$swfconfig[hash]"},
|
|
pick: 'replyfloor_content_upload',
|
|
accept: {
|
|
mime_types : [
|
|
{ title : "Images", extensions : "gif,jpg,jpeg,bmp,png" }
|
|
]
|
|
},
|
|
fileVal: 'Filedata',
|
|
});
|
|
</script>
|
|
EOT;
|
|
} else {
|
|
$attach = isset($_GET['attach']) ? $_GET['attach'] : array();
|
|
|
|
$attachment = $usedattach = $queryattach = array();
|
|
if($attach){
|
|
$queryattach = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_attachment_unused')->fetch_all_by_id($attach);
|
|
}
|
|
foreach($queryattach as $value){
|
|
$attachdata = array(
|
|
'id' => $value['id'],
|
|
'tid' => $item['tid'],
|
|
'pid' => $item['pid'],
|
|
'msgid' => $item['id'],
|
|
'uid' => $value['uid'],
|
|
'username' => $value['username'],
|
|
'filename' => $value['filename'],
|
|
'filesize' => $value['filesize'],
|
|
'fileext' => $value['fileext'],
|
|
'attachment' => $value['attachment'],
|
|
'remote' => $value['remote'],
|
|
'width' => $value['width'],
|
|
'height' => $value['height'],
|
|
'dateline' => $value['dateline'],
|
|
);
|
|
C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_attachment')->insert($attachdata, true);
|
|
C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_attachment_unused')->delete_by_id($value['id']);
|
|
}
|
|
|
|
$i = 1;
|
|
if($attach){
|
|
$queryattach = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_attachment')->fetch_all_by_id($attach);
|
|
foreach($attach as $aid){
|
|
if($queryattach[$aid] && in_array($queryattach[$aid]['fileext'], array('jpg', 'jpeg', 'gif', 'png', 'bmp', 'webp'))){
|
|
C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_attachment')->update_by_id($aid, array('displayorder' => $i));
|
|
$i++;
|
|
$attachment[] = ($queryattach[$aid]['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'replyfloor/'. $queryattach[$aid]['attachment'];
|
|
}
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'message' => $_GET['message'],
|
|
'attachment' => implode("\t", $attachment),
|
|
);
|
|
if(!$data['message'] && !$data['attachment']) {
|
|
cpmsg(lang('plugin/'.$plugin['identifier'], 'message_message_empty'), '', 'error');
|
|
}
|
|
C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_message')->update_by_id($_GET['id'], $data);
|
|
cpmsg(lang('plugin/'.$plugin['identifier'], 'message_updatesucceed'), "action=$pluginurl", 'succeed');
|
|
}
|
|
|
|
} elseif($op == 'clean') {
|
|
if(!submitcheck('rbsubmit', 1)) {
|
|
showformheader("$pluginurl&op=clean",'enctype');
|
|
showtableheader(lang('plugin/'.$plugin['identifier'], 'recycle_clean_title'));
|
|
showsetting(lang('plugin/'.$plugin['identifier'], 'recycle_clean_days'), 'days', '30', 'text', '', 0, lang('plugin/'.$plugin['identifier'], 'recycle_clean_days_comment'));
|
|
showsubmit('rbsubmit', 'submit');
|
|
showtablefooter();
|
|
showformfooter();
|
|
|
|
} else {
|
|
$deleteids = array();
|
|
$pernum = 500;
|
|
$linksdel = intval($_GET['linksdel']);
|
|
$days = intval($_GET['days']);
|
|
$wherearr = array();
|
|
$wherearr[] = "status = '1'";
|
|
if($days){
|
|
$wherearr[] = "createtime < '".(TIMESTAMP - ($days * 86400))."'";
|
|
}
|
|
$list = C::t('#'.$plugin['identifier'].'#'.$plugin['identifier'].'_message')->fetch_all_by_search_where($wherearr,'order by createtime asc', 0, $pernum);
|
|
foreach($list as $value) {
|
|
$deleteids[] = $value['id'];
|
|
}
|
|
if($deleteids) {
|
|
replyfloor_deletemessage($deleteids, 'id', 0);
|
|
$linksdel += count($deleteids);
|
|
//$startlimit += $pernum;
|
|
cpmsg(lang('plugin/'.$plugin['identifier'], 'recycle_clean_next'), 'action='.$pluginurl.'&op=clean&rbsubmit=1&linksdel='.$linksdel.'&days='.$days, 'succeed', array('linksdel' => $linksdel));
|
|
} else {
|
|
cpmsg(lang('plugin/'.$plugin['identifier'], 'recycle_clean_succeed'), 'action='.$pluginurl.'&op=clean', 'succeed', array('linksdel' => $linksdel));
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|