162 lines
6.2 KiB
PHP
162 lines
6.2 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
|
|
* 未经应用程序开发者/所有者的书面许可,不得进行反向工程、反向汇编、反向编译等,不得擅自复制、修改、链接、转载、汇编、发表、出版、发展与之有关的衍生产品、作品等
|
|
*/
|
|
|
|
|
|
if(!defined('IN_DISCUZ')) {
|
|
exit('Access Denied');
|
|
}
|
|
|
|
function replyfloor_discuzcode($message = '') {
|
|
global $_G;
|
|
require_once libfile('function/discuzcode');
|
|
$message = dhtmlspecialchars($message);
|
|
$msglower = strtolower($message);
|
|
//$message = preg_replace("/(?<=[^\]a-z0-9-=\"'\\/])?((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i", "<a href=\"\\1\\3\" target=\"_blank\">\\1\\3</a>", $message);
|
|
$message = preg_replace_callback("/(?<=[^\]a-z0-9-=\"'\\/])?((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i", 'replyfloor_parseurl', $message);
|
|
if(strpos($msglower, '[/color]')){
|
|
$message = str_replace(array('[/color]'), array('</font>'), preg_replace("/\[color=([#\w]+?)\]/i", "<font color=\"\\1\">", $message));
|
|
}
|
|
if(strpos($msglower, '[/b]')){
|
|
$message = str_replace(array('[b]', '[/b]'), array('<b>', '</b>'), $message);
|
|
}
|
|
//if(strpos($msglower, '[/img]') !== FALSE) {
|
|
//$message = preg_replace_callback("/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is", 'replyfloor_parseimg_1', $message);
|
|
//$message = preg_replace_callback("/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/is", 'replyfloor_parseimg_123', $message);
|
|
//}
|
|
$message = parsesmiles($message);
|
|
$message = preg_replace_callback("/\<img.*?src=[\'|\"]?(.*?)[\'|\"]?\s.*?>/i", 'replyfloor_imageurl', $message);
|
|
return str_replace(array("\t", ' ', ' '), array(' ', ' ', ' '), $message);
|
|
}
|
|
|
|
function replyfloor_parseurl($matches) {
|
|
global $_G;
|
|
$url = $matches[0];
|
|
$hash = authcode("$url\t$_G[timestamp]", 'ENCODE', md5(substr(md5($_G['config']['security']['authkey']), 0, 16)));
|
|
$hash = urlencode($hash);
|
|
$jumpurl = "plugin.php?id=replyfloor:jump&hash=".$hash;
|
|
return "<a href=\"".$jumpurl."\" target=\"_blank\">".$url."</a>";
|
|
}
|
|
|
|
function replyfloor_parseimg_1($matches) {
|
|
return replyfloor_parseimg(0, 0, $matches[1]);
|
|
}
|
|
|
|
function replyfloor_parseimg_123($matches) {
|
|
return replyfloor_parseimg($matches[1], $matches[2], $matches[3]);
|
|
}
|
|
|
|
function replyfloor_parseimg($width, $height, $src) {
|
|
global $_G;
|
|
if(strstr($src, 'file:') || substr($src, 1, 1) == ':') {
|
|
return $src;
|
|
}
|
|
$src = !in_array(strtolower(substr($src, 0, 6)), array('http:/', 'https:', 'ftp://')) ? $_G['siteurl'].$src : $src;
|
|
$rimg_id = random(5);
|
|
if(defined('IN_MOBILE')) {
|
|
return '<a href="'.$src.'"><img src="'.$src.'" border="0" alt="" /></a>';
|
|
} else {
|
|
return '<img id="aimg_'.$rimg_id.'" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" src="'.$src.'" border="0" alt="" />';
|
|
}
|
|
}
|
|
|
|
function replyfloor_imageurl($matches) {
|
|
global $_G;
|
|
$url = !in_array(strtolower(substr($matches[1], 0, 6)), array('http:/', 'https:', 'ftp://')) ? $_G['siteurl'] : '';
|
|
return str_replace($matches[1], $url.$matches[1], $matches[0]);
|
|
}
|
|
|
|
function replyfloor_location($ip = '') {
|
|
require_once libfile('function/misc');
|
|
$location = trim(ltrim(convertip($ip), '-'));
|
|
if(in_array($location, array('Invalid', 'LAN', 'Reserved', 'Unknown', 'System Error'))){
|
|
$location = lang('plugin/replyfloor', 'replyfloor_location_unknow');
|
|
}else{
|
|
$locarray = explode(' ', $location);
|
|
if(count($locarray) > 1){
|
|
$location = $locarray[0];
|
|
}
|
|
}
|
|
return $location;
|
|
}
|
|
|
|
function replyfloor_deletemessage($ids, $idtype = 'id', $recycle = 0) {
|
|
global $_G;
|
|
if($idtype == 'id'){
|
|
C::t('#replyfloor#replyfloor_message')->delete_by_id($ids, $recycle);
|
|
if(!$recycle){
|
|
$attachlist = C::t('#replyfloor#replyfloor_attachment')->fetch_all_by_msgid($ids);
|
|
foreach($attachlist as $attach){
|
|
if($attach['remote']) {
|
|
ftpcmd('delete', 'replyfloor/'.$attach['attachment']);
|
|
} else {
|
|
@unlink($_G['setting']['attachdir'].'/replyfloor/'.$attach['attachment']);
|
|
}
|
|
}
|
|
C::t('#replyfloor#replyfloor_attachment')->delete_by_msgid($ids);
|
|
}
|
|
}elseif($idtype == 'tid'){
|
|
C::t('#replyfloor#replyfloor_message')->delete_by_tid($ids, $recycle);
|
|
if(!$recycle){
|
|
$attachlist = C::t('#replyfloor#replyfloor_attachment')->fetch_all_by_tid($ids);
|
|
foreach($attachlist as $attach){
|
|
if($attach['remote']) {
|
|
ftpcmd('delete', 'replyfloor/'.$attach['attachment']);
|
|
} else {
|
|
@unlink($_G['setting']['attachdir'].'/replyfloor/'.$attach['attachment']);
|
|
}
|
|
}
|
|
C::t('#replyfloor#replyfloor_attachment')->delete_by_tid($ids);
|
|
}
|
|
}elseif($idtype == 'pid'){
|
|
C::t('#replyfloor#replyfloor_message')->delete_by_pid($ids, $recycle);
|
|
if(!$recycle){
|
|
$attachlist = C::t('#replyfloor#replyfloor_attachment')->fetch_all_by_pid($ids);
|
|
foreach($attachlist as $attach){
|
|
if($attach['remote']) {
|
|
ftpcmd('delete', 'replyfloor/'.$attach['attachment']);
|
|
} else {
|
|
@unlink($_G['setting']['attachdir'].'/replyfloor/'.$attach['attachment']);
|
|
}
|
|
}
|
|
C::t('#replyfloor#replyfloor_attachment')->delete_by_pid($ids);
|
|
}
|
|
}elseif($idtype == 'authorid'){
|
|
C::t('#replyfloor#replyfloor_message')->delete_by_authorid($ids, $recycle);
|
|
if(!$recycle){
|
|
$attachlist = C::t('#replyfloor#replyfloor_attachment')->fetch_all_by_authorid($ids);
|
|
foreach($attachlist as $attach){
|
|
if($attach['remote']) {
|
|
ftpcmd('delete', 'replyfloor/'.$attach['attachment']);
|
|
} else {
|
|
@unlink($_G['setting']['attachdir'].'/replyfloor/'.$attach['attachment']);
|
|
}
|
|
}
|
|
C::t('#replyfloor#replyfloor_attachment')->delete_by_authorid($ids);
|
|
}
|
|
}
|
|
}
|
|
|
|
function replyfloor_deletereport($ids) {
|
|
global $_G;
|
|
$reportlist = C::t('#replyfloor#replyfloor_report')->fetch_all_by_id($ids);
|
|
foreach($reportlist as $value){
|
|
$value['images'] = $value['images'] ? unserialize($value['images']) : array();
|
|
foreach ($value['images'] as $val) {
|
|
@unlink($_G['setting']['attachdir'].'/replyfloor/'.$val['image']);
|
|
}
|
|
}
|
|
C::t('#replyfloor#replyfloor_report')->delete_by_id($ids);
|
|
}
|
|
|
|
?>
|