⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read.php

📁 make project on java
💻 PHP
字号:
<?php
function content($content)
{
    global $annex, $db_prefix, $myconn, $html;
    if (!$html[0]) {
        $content = htmlspecialchars($content);		 
        if (!$html[3]) {
            $content = preg_replace("/\[code\](.+?)\[\/code\]/eis", "wkcode('\\1')", $content);
            $content = preg_replace("/\[quote\](.+?)\[\/quote\]/eis", "wkqoute('\\1')", $content);
            $content = str_replace('[u]', '<u>', $content);
            $content = str_replace('[/u]', '</u>', $content);
            $content = str_replace('[b]', '<b>', $content);
            $content = str_replace('[/b]', '</b>', $content);
            $content = str_replace('[i]', '<i>', $content);
            $content = str_replace('[/i]', '</i>', $content);
            $content = str_replace('[list]', '<ul>', $content);
            $content = str_replace('[list=1]', '<ol type=1>', $content);
            $content = str_replace('[list=a]', '<ol type=a>', $content);
            $content = str_replace('[list=A]', '<ol type=A>', $content);
            $content = str_replace('[*]', '<li>', $content);
            $content = str_replace('[/list]', '</ul>', $content);
            $content = preg_replace("/\[img\](.+?)\[\/img\]/eis", "wkpic('\\1')", $content);
            $content = preg_replace("/\[vid\](\S+?)\[\/vid\]/eis", "wkurl('\\1')", $content);
			
			
            $content = preg_replace("/\s*\[table(=(\d{1,3}%?))?\][\n\r]*(.+?)[\n\r]*\[\/table\]\s*/eis", "wktable('\\2', '\\3')", $content);
            $content = preg_replace("/\s*\[table(=(\d{1,3}%?))?\][\n\r]*(.+?)[\n\r]*\[\/table\]\s*/eis", "wktable('\\2', '\\3')", $content);
			$content = preg_replace("/\s*\[table(=(\d{1,3}%?))?\][\n\r]*(.+?)[\n\r]*\[\/table\]\s*/eis", "wktable('\\2', '\\3')", $content);
			
            $content = preg_replace("/\[color=([^\[\<]{0,12})\]/i", "<font color='\\1'>", $content);
            $content = str_replace("[/color]", "</font>", $content);

		 if (!$html[2]) {
                $content = preg_replace("/\[em([0-9]+)\]/eis", "wkemote('\\1')", $content);
            } 
            if (!$html[1]) {
			
			$content = preg_replace("/\[url=([^\[]*)\](.+?)\[\/url\]/eis", "wkurl('\\1','\\2')", $content);
			$content = preg_replace("/\[url\]([^\[]*)\[\/url\]/eis", "wkurl('\\1')", $content);
			
           } 
			
            
        } 
    }
	if (SERVER_GHO) $content = str_replace('WEBURL', SERVER_NAME, $content);

    $content = str_replace('[page]', '<div class="read-page"></div>', $content);

    $content = str_replace("\r\n", "<br />", $content);
    if ($annex) {
        $content = preg_replace("/\[ax([0-9]+)\]/eis", "annexx('\\1')", $content);
    } 
    if (!$html[1] && !$html[3]) {
        $content = str_replace(chr(0) . chr(0), "[", $content);
        $content = str_replace(chr(255) . chr(255), "]", $content);
    } 

    return $content;
} 

function wkemote($code)
{
    global $imagedir, $emotenum;
    if ($code > $emotenum) {
        return '[em' . $code . ']';
    } else {
        return '<img src="' . $imagedir . '/emote/em'
         . $code . '.gif" alt="" />';
    } 
} 

function wkcode($code)
{
    $code = str_replace("[", chr(0) . chr(0), $code);
    $code = str_replace("]", chr(255) . chr(255), $code);
    return '<div class="read-code">' . $code . '</div>';
} 

function signa($content)
{
    $content = preg_replace("/\[color=([^\[\<]+?)\]/i", "<font color='\\1'>", $content);
    $content = str_replace("[/color]", "</font>",$content);
    $content = preg_replace("/\[img\](.+?)\[\/img\]/eis", "wkpic('\\1')", $content);
    $searcharray = array("/\[url=([^\[]*)\](.+?)\[\/url\]/eis", "/\[url\]([^\[]*)\[\/url\]/eis");
    $replacearray = array("wkurl('\\1','\\2')", "wkurl('\\1')");
    $content = preg_replace($searcharray, $replacearray, $content);
    $content = str_replace("[u]", "<u>", $content);
    $content = str_replace("[/u]", "</u>", $content);
    $content = str_replace("[b]", "<b>" , $content);
    $content = str_replace("[/b]", "</b>", $content);
    $content = str_replace("[i]", "<i>", $content);
    $content = str_replace("[/i]", "</i>", $content);
    return $content;
} 

function wkqoute($code)
{
    $code = str_replace('[b]', '<b>', $code);
    $code = str_replace('[/b]', '</b>', $code);
    $code = str_replace('[', chr(0) . chr(0), $code);
    $code = str_replace(']', chr(255) . chr(255), $code);
    return '<div class="read-qoute">' . $code . '</div>';
} 

function wkpic($url)
{ 
    return '<img src="' . $url . '" onload="javascript:MyImage(this);"/>';
} 

function annexx($aid)
{
    global $annexs, $imagedir, $time, $upfiletype, $username, $softdir;
    global $_default, $abc, $img_ubb, $softdir, $templatedir,$style_id;
    if (isset($annexs[$aid])) {
        $html = explode('|', $annexs[$aid]['type']);
        $a_title = htmlspecialchars($annexs[$aid]['title']);
        $filetype = $annexs[$aid]['filetype'];
        $content = $annexs[$aid]['content'];
        $type = $annexs[$aid]['code'];
        $size = $annexs[$aid]['size'];
        $downnum = $annexs[$aid]['downnum'];
        $downuser = $annexs[$aid]['downuser'];

        if ($type == 'txt') {
            switch ($html[0]) {
                case 'a':
                    $anndi = $abc[0];
                    break;
                case 'b':
                    $anndi = $abc[1];
                    break;
                case 'c':
                    $anndi = $abc[2];
                    break;
                default:
                    $anndi = 'bad';
                    break;
            } 
            unset($annexs[$aid]);

            return tpl_fun_jjx10(array('title' => $a_title, 'aid' => $aid, 'templatedir' => $templatedir, 'downnum' => $downnum, 'money' => $html[1], 'anndi' => $anndi, 'size' => $size, 'anndiecho' => $html[1] > 0?'':'display: none;'));

        } else if ($type == 'url') {
            switch ($html[0]) {
                case 'a':
                    $anndi = $abc[0];
                    break;
                case 'b':
                    $anndi = $abc[1];
                    break;
                case 'c':
                    $anndi = $abc[2];
                    break;
                default:
                    $anndi = 'bad';
                    break;
            } 
            unset($annexs[$aid]);

            return tpl_fun_jjx11(array('title' => $a_title, 'aid' => $aid, 'templatedir' => $templatedir, 'downnum' => $downnum, 'money' => $html[1], 'anndi' => $anndi, 'size' => $size, 'anndiecho' => $html[1] > 0?'':'display: none;'));

        } elseif ($type == 'file') {
            switch ($html[0]) {
                case 'a':
                    $anndi = $abc[0];
                    break;
                case 'b':
                    $anndi = $abc[1];
                    break;
                case 'c':
                    $anndi = $abc[2];
                    break;
                default:
                    $anndi = 'bad';
                    break;
            } 
            if (in_array($filetype, $img_ubb) && (!$html[0] || ($username && !$html[1])))
                return '<img class="read-img" src="' . $softdir . '/uploads/' . $content . '" alt="" onload="javascript:MyImage(this);"/>';
            unset($annexs[$aid]);

            return tpl_fun_jjx12(array('title' => $a_title, 'aid' => $aid, 'templatedir' => $templatedir, 'downnum' => $downnum, 'money' => $html[1], 'anndi' => $anndi, 'size' => $size, 'anndiecho' => $html[1] > 0?'':'display: none;'));
        } else if ($type == 'poll') {
            $content = explode('|', htmlspecialchars($content));
            while (list($key, $val) = each($content)) {
                $poll = explode("\t", $val);
                $pollscontent[$key] = $poll[0];
                $polls[$key] = $poll[1];
            } 
            $pollnum = array_sum($polls);
            $polltype = $html[0]?'checkbox' : 'radio';
            $pollname = $html[0]?'poll[]' : 'poll';

            $downuser = explode(',', $downuser);
            if ($html[1]) {
                $qwer = ($username && @in_array($username, $downuser))?1 : 0;
            } else {
                $qwer = (in_array($_SERVER['REMOTE_ADDR'], $downuser))?1 : 0;
            } 
            if ($qwer) {
                while (list($key, $val) = each($polls)) {
                    $pollslist .= tpl_fun_jjx15(array('pcontent' => trim($pollscontent[$key]), 'polls' => $polls[$key], 'bkey' => @number_format($polls[$key] / $pollnum * 100, 1)));
                } 

                $html[1]?$downuser = implode(' ', $downuser):$usecho = 'display: none;';
                unset($annexs[$aid]);
                return tpl_fun_jjx13(array('downuser' => $downuser, 'usecho' => $usecho, 'r_echo' => $html[0]?'display: none;':'', 'c_echo' => $html[0]?'':'display: none;', 'pollnum' => $pollnum, 'title' => $a_title, 'jjx15' => $pollslist));
            } else {
                while (list($key, $val) = each($polls)) {
                    $pollslist .= tpl_fun_jjx16(array('pcontent' => trim($pollscontent[$key]), 'polltype' => $polltype, 'pollname' => $pollname, 'pkey' => $key));
                } 
                unset($annexs[$aid]);
                return tpl_fun_jjx14(array('aid' => $aid, 'usecho' => $usecho, 'r_echo' => $html[0]?'display: none;':'', 'c_echo' => $html[0]?'':'display: none;', 'pollnum' => $pollnum, 'title' => $a_title, 'jjx16' => $pollslist,'style_id'=>$style_id));
            } 
        } else {
            return '[ax' . $aid . ']';
        } 
    } 
    return '[ax' . $aid . ']';
} 

function wkurl($url, $name = false)
{
$url = str_replace('\"', '"', $url);
   if ($name!=false) {
       $url = '<a href="' . $url . '" target="_blank">' . $name . '</a>';
	   
   } else {
       $url = '<a href="' . $url . '" target="_blank">' . $url . '</a>'; 
   }    
    return $url;
} 

function wktable($width, $message)
{

$message = str_replace('\"', '"', $message);
    $width = substr($width, -1) == '%'?(substr($width, 0, -1) <= 98?$width : '98%'): ($width <= 600?$width : '98%');
	
	$message=preg_replace("/\[td=(\d{1,2}),(\d{1,2})(,(\d{1,3}%?))?\]/is", "<td colspan='\\1' rowspan='\\2' width='\\4'>", $message);	
$message = str_replace('\"', '"', $message);

return '<table ' . ($width == ''?null : 'width="' . $width . '" ') . 'align="center" cellspacing="0" class="read-table">' . str_replace(array('[tr]', '[td]', '[/td]', '[/tr]'), array('<tr>', '<td>', '</td>', '</tr>'), $message) . '</table>';
} 

function thpage()
{
    global $tid, $hid, $headnum, $numpage, $pagenum;
    $pagenum = ceil($numpage / $headnum);
    $_GET['page'] > $pagenum?$_GET['page'] = $pagenum: null;
    $_GET['page'] < 1?$_GET['page'] = 1: null;
    if (($pagenum - $_GET['page']) >= 5) {
        $b = $_GET['page']-5;
        $c = $_GET['page'] + 5;
        if (abs($b) != $b || $b == 0) {
            $b = 1;
            $c = 10;
        } 
        $pagenum <= 10?$c = $pagenum: null;
    } else {
        $c = $pagenum;
        $b = $pagenum-9;
        if (abs($b) != $b || $b == 0) {
            $b = 1;
        } 
    } 
    for(;$b <= $c;$b++) {
            $pagelist .= '<div class="page-'.($b == $_GET['page']?2:1).'"><a href="'.(REWRIT_E?'read-' . $tid . '-' . $_GET['type'] . '-' . $hid . '-' . $_GET['tpage'] . '-' . $b . '.html':'read.php?tid='.$tid.'&type='.$_GET['type'].'&hid='.$hid.'&tpage='.$_GET['tpage'].'&page='.$b).'">' . $b . '</a></div>';
       
    } 
    if ($pagenum > 10 && $pagenum - $_GET['page'] > 5) {
        $pagelist .= '<div class="page-1"><a>鈥

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -