📄 savepost.php
字号:
<?php
function formatpost()
{
global $html, $content, $addannex,$web_array;
global $thumb_type, $thumb_dir, $annexdir, $filetype, $thumb,$taddannex;
if (!$html[0]) {
if (!$html[1] && !$html[3]) {
$content = preg_replace("/(?<=[^\]a-z0-9-=\"'\\/]|^)(https?|ftp|gopher|news|telnet|mms|rtsp)([a-z0-9_\/\-\\+=.?#&:@%]+)/i", "[url]\\1\\2[/url]", $content);
$content = preg_replace("/(?<=[^\]a-z0-9-=\"'\\/]|^)(www\.[a-z0-9_\/\-\\+=.?#&:@%]+)/i", "[url]http://\\1[/url]", $content);
}
$content = preg_replace("/\[img\](.+?)\[\/img\]/eis", "wkpic('\\1')", $content);
$content2 = preg_replace("/\[code\](.+?)\[\/code\]/eis", '', $content);
$content2 = preg_replace("/\[quote\](.+?)\[\/quote\]/eis", '', $content2);
preg_replace("/\[ax([0-9]+)\]/eis", "annexcode('\\1')", $content2);
} else {
preg_replace("/\[ax([0-9]+)\]/eis", "annexcode('\\1')", $content);
}
if (SERVER_GHO) $content=gho_server($content);
reset($addannex);
while (list (, $val) = each($addannex)) {
$content .= "\r\n".'[ax' . $val . ']';
}
reset($taddannex);
while (list (, $aid) = each($taddannex)) {
if ($thumb == 0 && ($filetype[$aid] == 'gif' || $filetype[$aid] == 'jpg' || $filetype[$aid] == 'jpeg' || $filetype[$aid] == 'png')) {
$thumb = 1;
$thumb_type = $filetype[$aid];
$thumb_dir = $annexdir[$aid];
break;
}
}
}
function wkpic($content)
{
global $annextypepost,$img_ubb,$autoimg,$time,$updirdate,$softdir,$sign,$db_prefix,$myconn,$taddannex,$filetype,$annexdir;
$_filetype = strtolower(str_replace('.', '', strrchr($content, '.')));
if (eregi("\"|'|>|<|\?", $content)) echoerror(89);
if (!@in_array($_filetype, $img_ubb) || $_filetype=='php') return '[url]' . $content . '[/url]';
if ($autoimg===true){
if (@fopen($content, 'rb')) {
$content=file_get_contents($content);
$upcd = date('y', $time) . number_format(date('z', $time) / $updirdate);
$updir = $softdir . '/uploads/' . $upcd;
if (!is_dir($updir)) {
if (@mkdir($updir, 0777) == false) {
jsechoerror(9);
}
}
$filename = date('ymdHis', $time).rand(0,99);
while (file_exists($updir . '/' . $filename . '.' . $_filetype)) {
$filename++;
};
$fp = fopen($updir . '/' . $filename . '.' . $_filetype, 'w');
fwrite($fp, $content);
fclose($fp);
$content = $upcd . '/' . $filename . '.' . $_filetype;
mysql_query("insert into {$db_prefix}annex (sign,type, uptime,code,content,title,filetype,size,downuser,fix) values('$sign','0|0','$time','file','$content','','$_filetype','-','','1')" , $myconn);
$insert_id = mysql_insert_id();
$taddannex[]=$insert_id;
$filetype[$insert_id]=$_filetype;
$filedir[$insert_id]=$content;
$annextypepost = 1;
return '[ax'.$insert_id.']';
}else{
return '[img]' . $content . '[/img]';
}
}else{
return '[img]' . $content . '[/img]';
}
}
function annexcode($aid)
{
global $addannex;
if (isset($addannex[$aid])) {
unset($addannex[$aid]);
}
return '[ax' . $aid . ']';
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -