@@ -10,7 +10,7 @@ if (!file_exists(dirname(__FILE__).'/data/common.inc.php')) { | |||
header('Location:install/index.php'); | |||
exit(); | |||
} | |||
//自动生成网页版 | |||
//自动生成网页 | |||
if (isset($_GET['upcache']) || !file_exists('index.html')) { | |||
require_once(dirname(__FILE__)."/system/common.inc.php"); | |||
require_once DEDEINC."/archive/partview.class.php"; | |||
@@ -1,10 +1,10 @@ | |||
<?php | |||
if (!defined('DEDEINC')) exit('dedebiz'); | |||
// 允许的函数 | |||
//允许的函数 | |||
$GLOBALS['allowedCalls'] = array( | |||
// 系统 | |||
//系统 | |||
'var_dump', | |||
// 数学 | |||
//数学 | |||
'ceil', | |||
'floor', | |||
'fmod', | |||
@@ -15,7 +15,7 @@ $GLOBALS['allowedCalls'] = array( | |||
'rand', | |||
'sqrt', | |||
'srand', | |||
// 变量 | |||
//变量 | |||
'empty', | |||
'floatval', | |||
'intval', | |||
@@ -36,7 +36,7 @@ $GLOBALS['allowedCalls'] = array( | |||
'isset', | |||
'strval', | |||
'unset', | |||
// 数组 | |||
//数组 | |||
'array_change_key_case', | |||
'array_chunk', | |||
'array_combine', | |||
@@ -92,7 +92,7 @@ $GLOBALS['allowedCalls'] = array( | |||
'shuffle', | |||
'sizeof', | |||
'sort', | |||
// 字符串 | |||
//字符串 | |||
'json_encode', | |||
'json_decode', | |||
'json_last_error', | |||
@@ -156,7 +156,7 @@ $GLOBALS['allowedCalls'] = array( | |||
'ucfirst', | |||
'ucwords', | |||
'wordwrap', | |||
// dede内置 | |||
//dede内置 | |||
'html2text', | |||
'removexss', | |||
'htmlreplace', | |||
@@ -179,7 +179,7 @@ $GLOBALS['allowedCalls'] = array( | |||
'gb2big5', | |||
'litimgurls', | |||
'split', | |||
// 时间 | |||
//时间 | |||
'strtotime', | |||
'date', | |||
'idate', | |||
@@ -228,7 +228,7 @@ $GLOBALS['allowedCalls'] = array( | |||
'date_sunrise', | |||
'date_sunset', | |||
'date_sun_info', | |||
// mb字符串处理 | |||
//mb字符串处理 | |||
'mb_convert_case', | |||
'mb_strtoupper', | |||
'mb_strtolower', | |||
@@ -288,7 +288,7 @@ $GLOBALS['allowedCalls'] = array( | |||
'mb_ereg_search_getpos', | |||
'mb_ereg_search_setpos', | |||
); | |||
// 允许的语法 | |||
//允许的语法 | |||
$GLOBALS['allowedTokens'] = array( | |||
'T_AND_EQUAL', | |||
'T_ARRAY', | |||
@@ -300,7 +300,6 @@ $GLOBALS['allowedTokens'] = array( | |||
'T_BREAK', | |||
'T_CASE', | |||
'T_CHARACTER', | |||
'T_CONCAT_EQUAL', | |||
'T_CONSTANT_ENCAPSED_STRING', | |||
'T_CONTINUE', | |||
@@ -313,7 +312,6 @@ $GLOBALS['allowedTokens'] = array( | |||
'T_DO', | |||
'T_DOUBLE_ARROW', | |||
'T_DOUBLE_CAST', | |||
'T_ELSE', | |||
'T_ELSEIF', | |||
'T_EMPTY', | |||
@@ -340,7 +338,6 @@ $GLOBALS['allowedTokens'] = array( | |||
'T_LOGICAL_OR', | |||
'T_LOGICAL_XOR', | |||
'T_MINUS_EQUAL', | |||
'T_MOD_EQUAL', | |||
'T_MUL_EQUAL', | |||
'T_NUM_STRING', | |||
@@ -362,29 +359,28 @@ $GLOBALS['allowedTokens'] = array( | |||
'T_WHITESPACE', | |||
'T_XOR_EQUAL', | |||
); | |||
// 禁止的表达式 | |||
//禁止的表达式 | |||
$GLOBALS['disallowedExpressions'] = array( | |||
'/`/', | |||
'/\$\W/', | |||
'/(\]|\})\s*\(/', | |||
'/\$\w\w*\s*\(/', | |||
); | |||
// 执行脚本 | |||
//执行脚本 | |||
function evalCode($code) | |||
{ | |||
ob_start(); | |||
$code = eval('if(0){' . "\n" . $code . "\n" . '}'); | |||
$code = eval('if(0){'."\n".$code."\n".'}'); | |||
ob_end_clean(); | |||
return $code !== false; | |||
} | |||
// 校验脚本 | |||
//校验脚本 | |||
function checkCode($code) | |||
{ | |||
global $allowedCalls; | |||
global $allowedTokens; | |||
global $disallowedExpressions; | |||
$tokens = token_get_all('<?php ' . $code . ' ?>'); | |||
$tokens = token_get_all('<?php '.$code.' ?>'); | |||
$errors = array(); | |||
$braces = 0; | |||
foreach ($tokens as $token) { | |||
@@ -421,13 +417,13 @@ function checkCode($code) | |||
switch ($id) { | |||
case ('T_STRING'): | |||
if (in_array(strtolower($token[1]), $allowedCalls) === false) { | |||
$errors[$i]['name'] = 'Illegal function: ' . $token[1]; | |||
$errors[$i]['name'] = 'Illegal function: '.$token[1]; | |||
$errors[$i]['line'] = $token[2]; | |||
} | |||
break; | |||
default: | |||
if (in_array($id, $allowedTokens) === false) { | |||
$errors[$i]['name'] = 'Illegal token: ' . $token[1]; | |||
$errors[$i]['name'] = 'Illegal token: '.$token[1]; | |||
$errors[$i]['line'] = $token[2]; | |||
} | |||
break; | |||
@@ -439,21 +435,21 @@ function checkCode($code) | |||
return $errors; | |||
} | |||
} | |||
// 错误提示 | |||
//错误提示 | |||
function htmlErrors($errors = null) | |||
{ | |||
if ($errors) { | |||
$errorsHTML = "<div style='width:98%;margin:1rem auto;color:#842029;background:#f8d7da;border-color:#842029;position:relative;padding:.75rem 1.25rem;border:1px solid transparent;border-radius:.2rem'>"; | |||
$errorsHTML .= 'PHP内嵌脚本错误:'; | |||
$errorsHTML .= '内嵌脚本缺失,请添加该函数:'; | |||
$errorsHTML .= '<dl>'; | |||
foreach ($errors as $error) { | |||
if ($error['line']) { | |||
$errorsHTML .= '<dt>Line ' . $error['line'] . '</dt>'; | |||
$errorsHTML .= '<dt>Line '.$error['line'].'</dt>'; | |||
} | |||
$errorsHTML .= '<dd>' . $error['name'] . '</dd>'; | |||
$errorsHTML .= '<dd>'.$error['name'].'</dd>'; | |||
} | |||
$errorsHTML .= '</dl>'; | |||
$errorsHTML .= "</div>\r\n"; | |||
echo $errorsHTML; | |||
} | |||
} | |||
} |
@@ -50,16 +50,16 @@ class smtp | |||
} | |||
if ($cc != "") | |||
{ | |||
$header .= "Cc: " . $cc . "\r\n"; | |||
$header .= "Cc: ".$cc."\r\n"; | |||
} | |||
$header .= "From: $webname<" . $from . ">\r\n"; | |||
$subject = "=?" . $GLOBALS['cfg_soft_lang'] . "?B?" . base64_encode($subject) . "?="; | |||
$header .= "Subject: " . $subject . "\r\n"; | |||
$header .= "From: $webname<".$from.">\r\n"; | |||
$subject = "=?".$GLOBALS['cfg_soft_lang']."?B?".base64_encode($subject)."?="; | |||
$header .= "Subject: ".$subject."\r\n"; | |||
$header .= $additional_headers; | |||
$header .= "Date: " . date("r") . "\r\n"; | |||
$header .= "X-Mailer:By Redhat (PHP/" . phpversion() . ")\r\n"; | |||
$header .= "Date: ".date("r")."\r\n"; | |||
$header .= "X-Mailer:By Redhat (PHP/".phpversion().")\r\n"; | |||
list($msec, $sec) = explode(" ", microtime()); | |||
$header .= "Message-ID: <" . date("YmdHis", $sec) . "." . ($msec * 1000000) . "." . $mail_from . ">\r\n"; | |||
$header .= "Message-ID: <".date("YmdHis", $sec).".".($msec * 1000000).".".$mail_from.">\r\n"; | |||
$TO = explode(",", $this->strip_comment($to)); | |||
if ($cc != "") | |||
{ | |||
@@ -72,20 +72,20 @@ class smtp | |||
$sent = TRUE; | |||
foreach ($TO as $rcpt_to) | |||
{ | |||
$headerto = "To: " . $rcpt_to . "\r\n"; | |||
$headerall = $header . $headerto; | |||
$headerto = "To: ".$rcpt_to."\r\n"; | |||
$headerall = $header.$headerto; | |||
$rcpt_to = $this->get_address($rcpt_to); | |||
if (!$this->smtp_sockopen($rcpt_to)) | |||
{ | |||
$this->log_write("Error: Cannot send email to " . $rcpt_to . "\n"); | |||
$this->log_write("Error: Cannot send email to ".$rcpt_to."\n"); | |||
$sent = FALSE; | |||
continue; | |||
} | |||
if ($this->smtp_send($this->host_name, $mail_from, $rcpt_to, $headerall, $body)) | |||
{ | |||
$this->log_write("E-mail has been sent to <" . $rcpt_to . ">\n"); | |||
$this->log_write("E-mail has been sent to <".$rcpt_to.">\n"); | |||
} else { | |||
$this->log_write("Error: Cannot send email to <" . $rcpt_to . ">\n"); | |||
$this->log_write("Error: Cannot send email to <".$rcpt_to.">\n"); | |||
$sent = FALSE; | |||
} | |||
fclose($this->sock); | |||
@@ -125,11 +125,11 @@ class smtp | |||
return $this->smtp_error("sending HELO command"); | |||
} | |||
} | |||
if (!$this->smtp_putcmd("MAIL", "FROM:<" . $from . ">")) | |||
if (!$this->smtp_putcmd("MAIL", "FROM:<".$from.">")) | |||
{ | |||
return $this->smtp_error("sending MAIL FROM command"); | |||
} | |||
if (!$this->smtp_putcmd("RCPT", "TO:<" . $to . ">")) | |||
if (!$this->smtp_putcmd("RCPT", "TO:<".$to.">")) | |||
{ | |||
return $this->smtp_error("sending RCPT TO command"); | |||
} | |||
@@ -162,15 +162,15 @@ class smtp | |||
} | |||
function smtp_sockopen_relay() | |||
{ | |||
$this->log_write("Trying to " . $this->relay_host . ":" . $this->smtp_port . "\n"); | |||
$this->log_write("Trying to ".$this->relay_host.":".$this->smtp_port."\n"); | |||
$this->sock = @fsockopen($this->relay_host, $this->smtp_port, $errno, $errstr, $this->time_out); | |||
if (!($this->sock && $this->smtp_ok())) | |||
{ | |||
$this->log_write("Error: Cannot connenct to relay host " . $this->relay_host . "\n"); | |||
$this->log_write("Error: " . $errstr . " (" . $errno . ")\n"); | |||
$this->log_write("Error: Cannot connenct to relay host ".$this->relay_host."\n"); | |||
$this->log_write("Error: ".$errstr." (".$errno.")\n"); | |||
return FALSE; | |||
} | |||
$this->log_write("Connected to relay host " . $this->relay_host . "\n"); | |||
$this->log_write("Connected to relay host ".$this->relay_host."\n"); | |||
return TRUE;; | |||
} | |||
function smtp_sockopen_mx($address) | |||
@@ -178,29 +178,29 @@ class smtp | |||
$domain = preg_replace("/^.+@([^@]+)$/i", "\1", $address); | |||
if (!@getmxrr($domain, $MXHOSTS)) | |||
{ | |||
$this->log_write("Error: Cannot resolve MX \"" . $domain . "\"\n"); | |||
$this->log_write("Error: Cannot resolve MX \"".$domain."\"\n"); | |||
return FALSE; | |||
} | |||
foreach ($MXHOSTS as $host) | |||
{ | |||
$this->log_write("Trying to " . $host . ":" . $this->smtp_port . "\n"); | |||
$this->log_write("Trying to ".$host.":".$this->smtp_port."\n"); | |||
$this->sock = @fsockopen($host, $this->smtp_port, $errno, $errstr, $this->time_out); | |||
if (!($this->sock && $this->smtp_ok())) | |||
{ | |||
$this->log_write("Warning: Cannot connect to mx host " . $host . "\n"); | |||
$this->log_write("Error: " . $errstr . " (" . $errno . ")\n"); | |||
$this->log_write("Warning: Cannot connect to mx host ".$host."\n"); | |||
$this->log_write("Error: ".$errstr." (".$errno.")\n"); | |||
continue; | |||
} | |||
$this->log_write("Connected to mx host " . $host . "\n"); | |||
$this->log_write("Connected to mx host ".$host."\n"); | |||
return TRUE; | |||
} | |||
$this->log_write("Error: Cannot connect to any mx hosts (" . implode(", ", $MXHOSTS) . ")\n"); | |||
$this->log_write("Error: Cannot connect to any mx hosts (".implode(", ", $MXHOSTS).")\n"); | |||
return FALSE; | |||
} | |||
function smtp_message($header, $body) | |||
{ | |||
fputs($this->sock, $header . "\r\n" . $body); | |||
$this->smtp_debug("> " . str_replace("\r\n", "\n" . "> ", $header . "\n> " . $body . "\n> ")); | |||
fputs($this->sock, $header."\r\n".$body); | |||
$this->smtp_debug("> ".str_replace("\r\n", "\n"."> ", $header."\n> ".$body."\n> ")); | |||
return TRUE; | |||
} | |||
function smtp_eom() | |||
@@ -212,12 +212,12 @@ class smtp | |||
function smtp_ok() | |||
{ | |||
$response = str_replace("\r\n", "", fgets($this->sock, 512)); | |||
$this->smtp_debug($response . "\n"); | |||
$this->smtp_debug($response."\n"); | |||
if (!preg_match("#^[23]#", $response)) | |||
{ | |||
fputs($this->sock, "QUIT\r\n"); | |||
fgets($this->sock, 512); | |||
$this->log_write("Error: Remote host returned \"" . $response . "\"\n"); | |||
$this->log_write("Error: Remote host returned \"".$response."\"\n"); | |||
return FALSE; | |||
} | |||
return TRUE; | |||
@@ -230,16 +230,16 @@ class smtp | |||
{ | |||
$cmd = $arg; | |||
} else { | |||
$cmd = $cmd . " " . $arg; | |||
$cmd = $cmd." ".$arg; | |||
} | |||
} | |||
fputs($this->sock, $cmd . "\r\n"); | |||
$this->smtp_debug("> " . $cmd . "\n"); | |||
fputs($this->sock, $cmd."\r\n"); | |||
$this->smtp_debug("> ".$cmd."\n"); | |||
return $this->smtp_ok(); | |||
} | |||
function smtp_error($string) | |||
{ | |||
$this->log_write("Error: Error occurred while " . $string . ".\n"); | |||
$this->log_write("Error: Error occurred while ".$string.".\n"); | |||
return FALSE; | |||
} | |||
function log_write($message) | |||
@@ -249,10 +249,10 @@ class smtp | |||
{ | |||
return TRUE; | |||
} | |||
$message = date("M d H:i:s ") . get_current_user() . "[" . getmypid() . "]: " . $message; | |||
$message = date("M d H:i:s ").get_current_user()."[".getmypid()."]: ".$message; | |||
if (!@file_exists($this->log_file) || !($fp = @fopen($this->log_file, "a"))) | |||
{ | |||
$this->smtp_debug("Warning: Cannot open log file \"" . $this->log_file . "\"\n"); | |||
$this->smtp_debug("Warning: Cannot open log file \"".$this->log_file."\"\n"); | |||
return FALSE;; | |||
} | |||
flock($fp, LOCK_EX); | |||
@@ -15,7 +15,7 @@ | |||
</style> | |||
</head> | |||
<body> | |||
<?php include("plus_header.htm") ; ?> | |||
<?php include("plus_header.htm"); ?> | |||
<div class="container"> | |||
<div class="sp-title"> | |||
<h2>文件:<a href="<?php echo $arcurl; ?>"><?php echo $title; ?></a></h2> | |||
@@ -32,6 +32,6 @@ | |||
</div> | |||
</div> | |||
<div class="advancedsearch"></div> | |||
<?php include("plus_footer.htm") ; ?> | |||
<?php include("plus_footer.htm"); ?> | |||
</body> | |||
</html> |
@@ -10,7 +10,7 @@ | |||
<script src="<?php echo $cfg_cmsurl; ?>/static/web/js/jquery.min.js"></script> | |||
</head> | |||
<body class="flinkpage"> | |||
<?php include("plus_header.htm") ; ?> | |||
<?php include("plus_header.htm"); ?> | |||
<div class="container"> | |||
<div class="sp-title"> | |||
<nav class="navbar navbar-expand-lg"> | |||
@@ -81,6 +81,6 @@ | |||
</form> | |||
</div> | |||
</div> | |||
<?php include("plus_footer.htm") ; ?> | |||
<?php include("plus_footer.htm"); ?> | |||
</body> | |||
</html> |
@@ -10,7 +10,7 @@ | |||
<script src="<?php echo $cfg_cmsurl; ?>/static/web/js/jquery.min.js"></script> | |||
</head> | |||
<body class="flinkpage"> | |||
<?php include("plus_header.htm") ; ?> | |||
<?php include("plus_header.htm"); ?> | |||
<div class="container"> | |||
<div class="sp-title"> | |||
<nav class="navbar navbar-expand-lg"> | |||
@@ -49,6 +49,6 @@ | |||
</ul> | |||
</div> | |||
</div> | |||
<?php include("plus_footer.htm") ; ?> | |||
<?php include("plus_footer.htm"); ?> | |||
</body> | |||
</html> |
@@ -9,7 +9,7 @@ | |||
<link rel="stylesheet" href="<?php echo $cfg_cmsurl; ?>/static/web/css/style.css"> | |||
</head> | |||
<body class="flinkpage"> | |||
<?php include("plus_header.htm") ; ?> | |||
<?php include("plus_header.htm"); ?> | |||
<div class="container"> | |||
<div class="formbox mt-3"> | |||
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#cccccc" class='table'> | |||
@@ -101,6 +101,6 @@ | |||
<br> | |||
</div> | |||
</div> | |||
<?php include("plus_footer.htm") ; ?> | |||
<?php include("plus_footer.htm"); ?> | |||
</body> | |||
</html> |
@@ -9,7 +9,7 @@ | |||
<link rel="stylesheet" href="<?php echo $cfg_cmsurl; ?>/static/web/css/style.css"> | |||
</head> | |||
<body class="flinkpage"> | |||
<?php include("plus_header.htm") ; ?> | |||
<?php include("plus_header.htm"); ?> | |||
<div class="container"> | |||
<div class="sp-title mt-3">推荐:<?php echo $title; ?></div> | |||
<div class="formbox"> | |||
@@ -42,6 +42,6 @@ | |||
</form> | |||
</div> | |||
</div> | |||
<?php include("plus_footer.htm") ; ?> | |||
<?php include("plus_footer.htm"); ?> | |||
</body> | |||
</html> |
@@ -10,7 +10,7 @@ | |||
<script src="<?php echo $cfg_cmsurl; ?>/static/web/js/jquery.min.js"></script> | |||
</head> | |||
<body class="flinkpage"> | |||
<?php include("plus_header.htm") ; ?> | |||
<?php include("plus_header.htm"); ?> | |||
<div class="container"> | |||
<div class="sp-title"> | |||
<span class="more"> | |||
@@ -43,6 +43,6 @@ | |||
<br> | |||
</div> | |||
</div> | |||
<?php include("plus_footer.htm") ; ?> | |||
<?php include("plus_footer.htm"); ?> | |||
</body> | |||
</html> |