@@ -1,9 +1,9 @@ | |||
#!/usr/bin/env php | |||
<?php | |||
/** | |||
* 一个开发工具 | |||
* 命令行工具 | |||
* | |||
* @version 2019年6月5日 tianya $ | |||
* @version 2020年12月11日 tianya $ | |||
* @package DedeBIZ.Command | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
@@ -16,8 +16,48 @@ chdir($workDir); | |||
if (substr(php_sapi_name(), 0, 3) === 'cgi') { | |||
die("DedeCMSV6:needs php-cli to run\n\n"); | |||
} | |||
$helpStr = " | |||
NAME: | |||
DedeBIZ Cli Tools | |||
USAGE: | |||
php ./dedebiz command [arguments...] | |||
COMMANDS: | |||
serv,s Run cli web server for DedeCMSV6 | |||
make,m Make DedeCMSV6 HTML | |||
update,u Update to latest system | |||
help,h Shows a list of commands or help | |||
WEBSITE: | |||
https://www.dedebiz.com/help/ | |||
"; | |||
if (count($argv) > 1 && $argv[1] == "serv") { | |||
// 将选项转化为SQL IN参数 | |||
function Option2SQLin($str = "") | |||
{ | |||
$str = preg_replace("#[^0-9-,]#", "", $str); | |||
$strs = explode(",", $str); | |||
foreach ($strs as $key => $si) { | |||
if (preg_match("#-#", $si)) { | |||
$tstart = 0; | |||
$tend = 0; | |||
$tss = explode("-", $si); | |||
if (intval($tss[0]) > intval($tss[1])) { | |||
$tstart = intval($tss[1]); | |||
$tend = intval($tss[0]); | |||
} else { | |||
$tstart = intval($tss[0]); | |||
$tend = intval($tss[1]); | |||
} | |||
$tmpArr = array(); | |||
for ($i = $tstart; $i <= $tend; $i++) { | |||
$tmpArr[] = $i; | |||
} | |||
$strs[$key] = implode(",", $tmpArr); | |||
} | |||
} | |||
return implode(",", $strs); | |||
} | |||
if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { | |||
// PHP5.4以下不支持内建服务器 | |||
// 用于开发调试 | |||
if (phpversion() < "5.4") { | |||
@@ -26,4 +66,223 @@ if (count($argv) > 1 && $argv[1] == "serv") { | |||
echo "Start Dev Server For DedeCMSV6\n\r"; | |||
echo "Open http://localhost:8088\n\r"; | |||
passthru(PHP_BINARY . ' -S localhost:8088 -t' . escapeshellarg('./')); | |||
} else if (count($argv) > 1 && $argv[1] == "make") { | |||
if (!file_exists($workDir . "/include/common.inc.php")) { | |||
DedeCli::error("Check your root path is right"); | |||
exit; | |||
} | |||
require_once($workDir . "/include/common.inc.php"); | |||
require_once(DEDEINC . "/cli.class.php"); | |||
// 一个命令行的生成工具 | |||
if (count($argv) > 2 && ($argv[2] == "arc" || $argv[2] == "a")) { | |||
// 生成文档 | |||
// make arc typeid=1 | |||
$t1 = ExecTime(); | |||
$addsql = "1=1"; | |||
$typeid = Option2SQLin(DedeCli::getOption("typeid")); | |||
if (!empty($typeid)) { | |||
$addsql .= " AND typeid IN(" . $typeid . ")"; | |||
} | |||
$aid = Option2SQLin(DedeCli::getOption("aid")); | |||
if (!empty($aid)) { | |||
$addsql .= " AND id IN(" . $typeid . ")"; | |||
} | |||
$tt = $dsql->GetOne("SELECT COUNT(id) as dd FROM `#@__arctiny` WHERE " . $addsql); | |||
$total = intval($tt['dd']); | |||
$dsql->Execute('out', "SELECT id FROM `#@__arctiny` WHERE " . $addsql . " ORDER BY typeid ASC"); | |||
$i = 0; | |||
while ($row = $dsql->GetObject('out')) { | |||
$id = $row->id; | |||
$ac = new Archives($id); | |||
$rurl = $ac->MakeHtml(0); | |||
DedeCli::showProgress(ceil(($i / $total) * 100), 100); | |||
$i++; | |||
} | |||
DedeCli::write("Make archive html successfull"); | |||
$queryTime = ExecTime() - $t1; | |||
DedeCli::write($queryTime); | |||
exit; | |||
} else if (count($argv) > 2 && ($argv[2] == "list" || $argv[2] == "l")) { | |||
// 生成栏目 | |||
$addsql = "1=1"; | |||
$typeid = Option2SQLin(DedeCli::getOption("typeid")); | |||
if (!empty($typeid)) { | |||
$addsql .= " AND id IN(" . $typeid . ")"; | |||
} | |||
$dsql->Execute('out', "SELECT id,channeltype FROM `#@__arctype` WHERE " . $addsql); | |||
$i = 0; | |||
while ($row = $dsql->GetObject('out')) { | |||
if ($row->channeltype > 0) { | |||
$lv = new ListView($row->id); | |||
} else { | |||
$lv = new SgListView($row->id); | |||
} | |||
$lv->CountRecord(); | |||
DedeCli::write("Start make list html[id:{$row->id}]"); | |||
$lv->MakeHtml('', '', 0); | |||
} | |||
exit; | |||
} else if (count($argv) > 2 && ($argv[2] == "index" || $argv[2] == "i")) { | |||
// 生成首页 | |||
$position = DedeCli::getOption("position"); | |||
if (empty($position)) { | |||
$position = "../index.html"; | |||
} | |||
if (!preg_match("#\.html$#", $position)) { | |||
DedeCli::error("position must end with .html"); | |||
exit; | |||
} | |||
$homeFile = DEDEINC . "/" . $position; | |||
$homeFile = str_replace("\\", "/", $homeFile); | |||
$homeFile = str_replace("//", "/", $homeFile); | |||
$row = $dsql->GetOne("SELECT * FROM `#@__homepageset`"); | |||
$templet = $row['templet']; | |||
$templet = str_replace("{style}", $cfg_df_style, $templet); | |||
$pv = new PartView(); | |||
$GLOBALS['_arclistEnv'] = 'index'; | |||
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $templet); | |||
$pv->SaveToHtml($homeFile); | |||
DedeCli::write("Make index html successfull"); | |||
} else if (count($argv) > 2 && ($argv[2] == "auto" || $argv[2] == "o")) { | |||
// 自动生成 | |||
function OptimizeData($dsql) | |||
{ | |||
global $cfg_dbprefix; | |||
$tptables = array("{$cfg_dbprefix}archives", "{$cfg_dbprefix}arctiny"); | |||
$dsql->SetQuery("SELECT maintable,addtable FROM `#@__channeltype` "); | |||
$dsql->Execute(); | |||
while ($row = $dsql->GetObject()) { | |||
$addtable = str_replace('#@__', $cfg_dbprefix, $row->addtable); | |||
if ($addtable != '' && !in_array($addtable, $tptables)) $tptables[] = $addtable; | |||
} | |||
$tptable = ''; | |||
foreach ($tptables as $t) $tptable .= ($tptable == '' ? "`{$t}`" : ",`{$t}`"); | |||
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE $tptable; "); | |||
} | |||
$start = empty(DedeCli::getOption("start"))? "-1 day" : DedeCli::getOption("start"); | |||
$start = strtotime($start); | |||
if (!$start) { | |||
DedeCli::error("start is empty"); | |||
exit; | |||
} | |||
// 1.生成首页 | |||
$pv = new PartView(); | |||
$row = $pv->dsql->GetOne("SELECT * FROM `#@__homepageset` "); | |||
$templet = str_replace("{style}", $cfg_df_style, $row['templet']); | |||
$homeFile = DEDEINC . '/' . $row['position']; | |||
$homeFile = str_replace("\\", '/', $homeFile); | |||
$homeFile = preg_replace("#\/{1,}#", '/', $homeFile); | |||
if ($row['showmod'] == 1) { | |||
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . '/' . $templet); | |||
$pv->SaveToHtml($homeFile); | |||
$pv->Close(); | |||
} else { | |||
if (file_exists($homeFile)) @unlink($homeFile); | |||
} | |||
DedeCli::write("Make index html successfull"); | |||
// 2.生成栏目 | |||
$query = "SELECT DISTINCT typeid From `#@__arctiny` WHERE senddate >=" . $start . " AND arcrank>-1"; | |||
$dsql->SetQuery($query); | |||
$dsql->Execute(); | |||
$typeids = array(); | |||
while ($row = $dsql->GetArray()) { | |||
$typeids[$row['typeid']] = 1; | |||
} | |||
if (count($typeids) > 0) { | |||
foreach ($typeids as $k => $v) { | |||
$vs = array(); | |||
$vs = GetParentIds($k); | |||
if (!isset($typeidsok[$k])) { | |||
$typeidsok[$k] = 1; | |||
} | |||
foreach ($vs as $k => $v) { | |||
if (!isset($typeidsok[$v])) { | |||
$typeidsok[$v] = 1; | |||
} | |||
} | |||
} | |||
foreach ($typeidsok as $tt=> $k) { | |||
$row = $dsql->GetOne("SELECT id,channeltype FROM `#@__arctype` WHERE id=".$tt); | |||
if ($row['channeltype'] > 0) { | |||
$lv = new ListView($tt); | |||
} else { | |||
$lv = new SgListView($tt); | |||
} | |||
$lv->CountRecord(); | |||
DedeCli::write("Start make list html[id:{$tt}]"); | |||
$lv->MakeHtml('', '', 0); | |||
} | |||
DedeCli::write("Make list html successfull"); | |||
} | |||
// 生成文档 | |||
$tt = $dsql->GetOne("SELECT COUNT(id) as dd FROM `#@__arctiny` WHERE senddate >=" . $start . " AND arcrank>-1"); | |||
$total = intval($tt['dd']); | |||
$dsql->Execute('out', "SELECT id FROM `#@__arctiny` WHERE senddate >=" . $start . " AND arcrank>-1 ORDER BY typeid ASC"); | |||
$i = 0; | |||
while ($row = $dsql->GetObject('out')) { | |||
$id = $row->id; | |||
$ac = new Archives($id); | |||
$rurl = $ac->MakeHtml(0); | |||
DedeCli::showProgress(ceil(($i / $total) * 100), 100); | |||
$i++; | |||
} | |||
DedeCli::write("Make archives html successfull"); | |||
// 优化数据 | |||
OptimizeData($dsql); | |||
DedeCli::write("Optimize data successfull"); | |||
} else { | |||
$helpStr = " | |||
USAGE: | |||
php ./dedebiz make action [arguments...] | |||
ACTIONS: | |||
index,i Make Index html | |||
--position index html position,default: ../index.html(relative include dir) | |||
arc,a Make Archive htmls | |||
--typeid type id | |||
--aid archive id | |||
list,l Make List htmls | |||
--typeid type id | |||
auto,o Auto Make htmls | |||
--start start time(format:2012-03-12) | |||
WEBSITE: | |||
https://www.dedebiz.com/help/"; | |||
DedeCli::write($helpStr); | |||
exit; | |||
} | |||
} else if (count($argv) > 1 && ($argv[1] == "update" || $argv[1] == "u")) { | |||
define("DEDEINC", $workDir."/include"); | |||
require_once(DEDEINC."/dedehttpdown.class.php"); | |||
require_once(DEDEINC . "/cli.class.php"); | |||
// 更新系统 | |||
$latestURL = "https://cdn.dedebiz.com/release/latest.txt"; | |||
$del = new DedeHttpDown(); | |||
$del->OpenUrl($latestURL); | |||
$remoteVerStr = $del->GetHtml(); | |||
$commStr = file_get_contents(DEDEINC."/common.inc.php"); | |||
preg_match("#_version_detail = '([\d\.]+)'#", $commStr, $matchs); | |||
$cfg_version_detail = $localVerStr = $matchs[1]; | |||
if (version_compare($localVerStr, $remoteVerStr, '>=')) { | |||
DedeCli::error("latest version,don't need to update"); | |||
exit; | |||
} | |||
$fileHashURL = "https://cdn.dedebiz.com/release/{$cfg_version_detail}.json"; | |||
$del = new DedeHttpDown(); | |||
$del->OpenUrl($fileHashURL); | |||
$filelist = $del->GetJSON(); | |||
$offFiles = array(); | |||
// foreach ($filelist as $key => $ff) { | |||
// $offFiles[$ff->filename] = $ff->hash; | |||
// } | |||
var_dump($filelist); | |||
} else { | |||
echo $helpStr; | |||
} |
@@ -1,5 +1,4 @@ | |||
Admin5 | |||
ChinaZ | |||
织梦技术论坛 | |||
落伍者论坛 | |||
DedeBIZ | |||
DedeBIZ | |||
今日头条 | |||
微信公众号 | |||
百家号 |
@@ -5,20 +5,29 @@ CheckPurview('plus_Mail'); | |||
//邮件发送函数 | |||
function sendmail($email, $mailtitle, $mailbody) | |||
{ | |||
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_user, $cfg_smtp_password, $cfg_adminemail,$cfg_webname; | |||
if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) | |||
{ | |||
$mailtype = 'HTML'; | |||
require_once(DEDEINC.'/mail.class.php'); | |||
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password); | |||
$smtp->debug = false; | |||
if(!$smtp->smtp_sockopen($cfg_smtp_server)){ | |||
ShowMsg('邮件发送失败,请联系管理员','-1'); | |||
exit(); | |||
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_password, $cfg_webname; | |||
global $cfg_bizcore_appid,$cfg_bizcore_key,$cfg_bizcore_hostname,$cfg_bizcore_port; | |||
if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { | |||
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); | |||
$client->appid = $cfg_bizcore_appid; | |||
$client->key = $cfg_bizcore_key; | |||
$client->MailSend($email,$mailtitle,$mailtitle,$mailbody); | |||
$client->Close(); | |||
} else { | |||
if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) | |||
{ | |||
$mailtype = 'HTML'; | |||
require_once(DEDEINC.'/mail.class.php'); | |||
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password); | |||
$smtp->debug = false; | |||
if(!$smtp->smtp_sockopen($cfg_smtp_server)){ | |||
ShowMsg('邮件发送失败,请联系管理员','-1'); | |||
exit(); | |||
} | |||
$smtp->sendmail($email,$cfg_webname,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype); | |||
}else{ | |||
@mail($email, $mailtitle, $mailbody, $headers); | |||
} | |||
$smtp->sendmail($email,$cfg_webname,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype); | |||
}else{ | |||
@mail($email, $mailtitle, $mailbody, $headers); | |||
} | |||
} | |||
@@ -83,4 +92,3 @@ if($action=="post"){ | |||
exit(); | |||
} | |||
?> |
@@ -7,20 +7,29 @@ if($dopost=="send"){ | |||
//邮件发送函数 | |||
function sendmail($email, $mailtitle, $mailbody) | |||
{ | |||
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_user, $cfg_smtp_password, $cfg_adminemail,$cfg_webname; | |||
if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) | |||
{ | |||
$mailtype = 'HTML'; | |||
require_once(DEDEINC.'/mail.class.php'); | |||
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password); | |||
$smtp->debug = false; | |||
if(!$smtp->smtp_sockopen($cfg_smtp_server)){ | |||
ShowMsg('邮件发送失败,请联系管理员','-1'); | |||
exit(); | |||
} | |||
$smtp->sendmail($email,$cfg_webname,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype); | |||
}else{ | |||
@mail($email, $mailtitle, $mailbody, $headers); | |||
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_password, $cfg_webname; | |||
global $cfg_bizcore_appid,$cfg_bizcore_key,$cfg_bizcore_hostname,$cfg_bizcore_port; | |||
if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { | |||
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); | |||
$client->appid = $cfg_bizcore_appid; | |||
$client->key = $cfg_bizcore_key; | |||
$client->MailSend($email,$mailtitle,$mailtitle,$mailbody); | |||
$client->Close(); | |||
} else { | |||
if($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) | |||
{ | |||
$mailtype = 'HTML'; | |||
require_once(DEDEINC.'/mail.class.php'); | |||
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password); | |||
$smtp->debug = false; | |||
if(!$smtp->smtp_sockopen($cfg_smtp_server)){ | |||
ShowMsg('邮件发送失败,请联系管理员','-1'); | |||
exit(); | |||
} | |||
$smtp->sendmail($email,$cfg_webname,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype); | |||
}else{ | |||
@mail($email, $mailtitle, $mailbody, $headers); | |||
} | |||
} | |||
} | |||
@@ -44,7 +53,7 @@ if($dopost=="send"){ | |||
$sendtime = time(); | |||
$inquery = "UPDATE `#@__mail_title` SET count=count+1,sendtime='$sendtime',state='1' WHERE id=$id"; | |||
if($dsql->ExecuteNoneQuery($inquery)){ | |||
if($dsql->ExecuteNoneQuery($inquery)){ | |||
ShowMsg('邮件已成功发送','mail_title_send.php'); | |||
exit(); | |||
} | |||
@@ -72,5 +81,3 @@ if($dopost=="send"){ | |||
$dlist->SetSource($sql); | |||
$dlist->display(); | |||
} | |||
?> |
@@ -62,7 +62,7 @@ if (isset($idArray[$pageno])) { | |||
if ($pageno == 0 && $mkpage == 1) //清空缓存 | |||
{ | |||
$dsql->ExecuteNoneQuery("Delete From `#@__arccache` "); | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache` "); | |||
} | |||
$reurl = ''; | |||
@@ -86,48 +86,58 @@ | |||
</tr> | |||
<?php | |||
if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { | |||
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); | |||
$client->appid = $cfg_bizcore_appid; | |||
$client->key = $cfg_bizcore_key; | |||
$data = $client->AdminPWDExists(); | |||
$data = json_decode($data->data); | |||
$rs = (array)($data->result); | |||
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); | |||
$client->appid = $cfg_bizcore_appid; | |||
$client->key = $cfg_bizcore_key; | |||
$data = $client->AdminPWDExists(); | |||
$data = json_decode($data->data); | |||
$rs = (array)($data->result); | |||
if($rs["admin_pwd_exists"] == "false") {?> | |||
if($rs["admin_pwd_exists"] == "false") {?> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">设置DedeBIZ操作密码:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<input name="dedebiz_admin" type="password" id="dedebiz_admin" value="" size="30"> | |||
设定后所有的DedeBIZ涉及安全操作输入当前操作密码 | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">重复DedeBIZ操作密码:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<input name="re_dedebiz_admin" type="password" id="re_dedebiz_admin" value="" size="30"> | |||
</td> | |||
</tr> | |||
<?php }else{ ?> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">DedeBIZ操作密码:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<input name="dedebiz_admin" type="password" id="dedebiz_admin" value="" size="30"> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">首页状态:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<label><input name="lockindex" type="radio" class="np" value="unlock" | |||
<?php echo ($rs['index_lock_state']==true)? "checked='checked'" : "";?> /> | |||
解锁</label> | |||
<label><input name="lockindex" type="radio" value="lock" class="np" | |||
<?php echo ($row['index_lock_state']==false)? "checked='checked'" : "";?> /> | |||
锁定</label> | |||
</td> | |||
</tr> | |||
<?php | |||
} | |||
} else { | |||
?> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">设置DedeBIZ操作密码:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<input name="dedebiz_admin" type="password" id="dedebiz_admin" value="" size="30"> | |||
设定后所有的DedeBIZ涉及安全操作输入当前操作密码 | |||
</td> | |||
</tr> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">重复DedeBIZ操作密码:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<input name="re_dedebiz_admin" type="password" id="re_dedebiz_admin" value="" size="30"> | |||
</td> | |||
</tr> | |||
<?php }else{ ?> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">DedeBIZ操作密码:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<input name="dedebiz_admin" type="password" id="dedebiz_admin" value="" size="30"> | |||
<td height="20" colspan="2" valign="top" bgcolor="#FFFFFF"> | |||
尚未开启DedeBIZ商业组件 <a class="btn btn-danger btn-sm" target="_blank" href="https://www.dedebiz.com/start?code=-1008">如何启动组件</a> | |||
</td> | |||
</tr> | |||
<?php | |||
} | |||
}?> | |||
<tr> | |||
<td height="20" valign="top" bgcolor="#FFFFFF">首页状态:</td> | |||
<td height="20" valign="top" bgcolor="#FFFFFF"> | |||
<label><input name="lockindex" type="radio" class="np" value="unlock" | |||
<?php echo ($rs['index_lock_state']==true)? "checked='checked'" : "";?> /> | |||
解锁</label> | |||
<label><input name="lockindex" type="radio" value="lock" class="np" | |||
<?php echo ($row['index_lock_state']==false)? "checked='checked'" : "";?> /> | |||
锁定</label> | |||
</td> | |||
</tr> | |||
?> | |||
<tr> | |||
<td height="31" colspan="2" bgcolor="#ffffff" align="center"> | |||
<button name="view" class='btn btn-secondary' type="button" id="view" | |||
@@ -298,7 +298,7 @@ class Archives | |||
*/ | |||
function MakeHtml($isremote = 0) | |||
{ | |||
global $fileFirst, $baidu_seo, $cfg_basehost; | |||
global $fileFirst, $cfg_basehost; | |||
if ($this->IsError) { | |||
return ''; | |||
@@ -384,25 +384,6 @@ class Archives | |||
$this->ParseDMFields($i, 1); | |||
$this->dtp->SaveTo($TRUEfilename); | |||
} | |||
if ($baidu_seo == true) { | |||
$api = 'http://data.zz.baidu.com/urls?site=https://www.zixue.cn&token=vXkBb4Ot0yhOFcmP'; | |||
$ch = curl_init(); | |||
$options = array( | |||
CURLOPT_URL => $api, | |||
CURLOPT_POST => true, | |||
CURLOPT_RETURNTRANSFER => true, | |||
CURLOPT_POSTFIELDS => implode("\n", $seoUrls), | |||
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), | |||
); | |||
curl_setopt_array($ch, $options); | |||
$result = curl_exec($ch); | |||
$rs = json_decode($result, true); | |||
if ($rs["success"] == 1) { | |||
echo "百度搜索引擎提交成功,剩余次数:" . $rs["remain"] . "<br/>\r\n"; | |||
} | |||
} | |||
} | |||
$this->dsql->ExecuteNoneQuery("Update `#@__archives` SET ismake=1 WHERE id='" . $this->ArcID . "'"); | |||
return $this->GetTrueUrl($filename); | |||
@@ -451,7 +432,7 @@ class Archives | |||
* | |||
* @access public | |||
* @param string $fname 键名称 | |||
* @param string $ctag 标记 | |||
* @param object $ctag 标记 | |||
* @return string | |||
*/ | |||
function GetField($fname, $ctag) | |||
@@ -677,8 +658,10 @@ class Archives | |||
} else if ($ctag2->GetName() == 'tagname') { | |||
$dtp2->Assign($tid, $k); | |||
} else if ($ctag2->GetName() == 'value') { | |||
$this->Fields[$k] = $this->ChannelUnit->MakeField($k, $this->Fields[$k], $ctag2); | |||
@$dtp2->Assign($tid, $this->Fields[$k]); | |||
if (isset($this->Fields[$k])) { | |||
$this->Fields[$k] = $this->ChannelUnit->MakeField($k, $this->Fields[$k], $ctag2); | |||
@$dtp2->Assign($tid, $this->Fields[$k]); | |||
} | |||
} | |||
} | |||
$res .= $dtp2->GetResult(); | |||
@@ -1,262 +0,0 @@ | |||
<?php if (!defined('DEDEINC')) exit("Request Error!"); | |||
/** | |||
* 踩踩文档类 | |||
* | |||
* @version $Id: arc.caicai.class.php 1 8:59 2010年7月7日Z tianya $ | |||
* @package DedeBIZ.Libraries | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(DEDEINC . "/datalistcp.class.php"); | |||
require_once(DEDEINC . "/channelunit.func.php"); | |||
/** | |||
* 踩踩文档类 | |||
* | |||
* @package Caicai | |||
* @subpackage DedeBIZ.Libraries | |||
* @link https://www.dedebiz.com | |||
*/ | |||
class Caicai extends DataListCP | |||
{ | |||
var $maxPageSize = 100; | |||
var $arcCacheTime = 3600; | |||
/** | |||
* 对config参数及get参数等进行预处理 | |||
* | |||
* @access public | |||
* @return void | |||
*/ | |||
function PreLoad() | |||
{ | |||
global $totalresult, $pageno; | |||
if (empty($pageno) || preg_match("#[^0-9]#", $pageno)) $pageno = 1; | |||
if (empty($totalresult) || preg_match("#[^0-9]#", $totalresult)) $totalresult = 0; | |||
$this->pageNO = $pageno; | |||
$this->totalResult = $totalresult; | |||
if (isset($this->tpl->tpCfgs['pagesize'])) { | |||
$this->pageSize = $this->tpl->tpCfgs['pagesize']; | |||
} | |||
$this->totalPage = ceil($this->totalResult / $this->pageSize); | |||
if ($this->totalPage > $this->maxPageSize) { | |||
$this->totalPage = $this->maxPageSize; | |||
} | |||
//限制最大页数 | |||
if ($this->pageNO > $this->totalPage) { | |||
$this->pageNO = $this->totalPage; | |||
$this->totalResult = $this->totalPage * $this->pageSize; | |||
} | |||
$this->sourceSql = preg_replace("#LIMIT [0-9,]{1,}#i", '', $this->sourceSql); | |||
if ($this->totalResult == 0) { | |||
//$this->isQuery = true; | |||
//$this->dsql->Execute('dlist',$this->sourceSql); | |||
//$this->totalResult = $this->dsql->GetTotalRow('dlist'); | |||
$countQuery = preg_replace("#SELECT[ \r\n\t](.*)[ \r\n\t]FROM#is", "SELECT COUNT(*) as dd FROM", $this->sourceSql); | |||
$row = $this->dsql->GetOne($countQuery); | |||
$this->totalResult = $row['dd']; | |||
$this->sourceSql .= " LIMIT 0," . $this->pageSize; | |||
} else { | |||
$this->sourceSql .= " LIMIT " . (($this->pageNO - 1) * $this->pageSize) . "," . $this->pageSize; | |||
} | |||
} | |||
/** | |||
* 获取当前页数据列表 | |||
* | |||
* @param array $atts | |||
* @param object $refObj | |||
* @param array $fields | |||
* @return array | |||
*/ | |||
function GetArcList($atts, $refObj = '', $fields = array()) | |||
{ | |||
$rsArray = array(); | |||
$t1 = Exectime(); | |||
if (!$this->isQuery) { | |||
$this->dsql->Execute('dlist', $this->sourceSql); | |||
} | |||
$i = 0; | |||
while ($arr = $this->dsql->GetArray('dlist')) { | |||
$i++; | |||
$arr['filename'] = $arr['arcurl'] = GetFileUrl( | |||
$arr['id'], | |||
$arr['typeid'], | |||
$arr['senddate'], | |||
$arr['title'], | |||
$arr['ismake'], | |||
$arr['arcrank'], | |||
$arr['namerule'], | |||
$arr['typedir'], | |||
$arr['money'], | |||
$arr['filename'], | |||
$arr['moresite'], | |||
$arr['siteurl'], | |||
$arr['sitepath'] | |||
); | |||
$arr['typeurl'] = GetTypeUrl( | |||
$arr['typeid'], | |||
MfTypedir($arr['typedir']), | |||
$arr['isdefault'], | |||
$arr['defaultname'], | |||
$arr['ispart'], | |||
$arr['namerule2'], | |||
$arr['moresite'], | |||
$arr['siteurl'], | |||
$arr['sitepath'] | |||
); | |||
if ($arr['litpic'] == '-' || $arr['litpic'] == '') { | |||
$arr['litpic'] = 'templets/images/dfpic.gif'; | |||
} | |||
if (!preg_match("#^http:\/\/#i", $arr['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { | |||
$arr['litpic'] = $GLOBALS['cfg_mainsite'] . $arr['litpic']; | |||
} | |||
$arr['picname'] = $arr['litpic']; | |||
$arr['alttitle'] = $arr['userid'] . " 的空间"; | |||
$arr['face'] = ($arr['face'] != '' ? $arr['face'] : 'images/nopic.gif'); | |||
if ($arr['userid'] != '') { | |||
$arr['spaceurl'] = $GLOBALS['cfg_basehost'] . '/member/index.php?uid=' . $arr['userid']; | |||
} else { | |||
$arr['alttitle'] = $arr['title']; | |||
$arr['spaceurl'] = $arr['arcurl']; | |||
$arr['face'] = $arr['litpic']; | |||
$arr['face'] = str_replace('defaultpic', 'dfcaicai', $arr['face']); | |||
} | |||
if (!empty($arr['lastpost'])) { | |||
$arr['lastpost'] = MyDate('m-d h:i', $arr['lastpost']); | |||
} else { | |||
$arr['lastpost'] = "<a href='../plus/feedback.php?aid={$arr['id']}'>说几句>></a>"; | |||
} | |||
$rsArray[$i] = $arr; | |||
if ($i >= $this->pageSize) { | |||
break; | |||
} | |||
} | |||
$this->dsql->FreeResult('dlist'); | |||
$this->queryTime = (Exectime() - $t1); | |||
return $rsArray; | |||
} | |||
/** | |||
* 获得最差或最好的踩踩文章 | |||
* | |||
* @param array $atts | |||
* @param object $refObj | |||
* @param array $fields | |||
* @return array | |||
*/ | |||
function GetSortArc($atts, $refObj = '', $fields = array()) | |||
{ | |||
$arcrow = (empty($atts['row']) ? 12 : $atts['row']); | |||
$order = (empty($atts['order']) ? 'scores' : $atts['order']); | |||
$orderway = (empty($atts['orderway']) ? 'desc' : $atts['orderway']); | |||
if (empty($arcrow)) $arcrow = 12; | |||
$query = "SELECT arc.*,tp.typedir,tp.typename, | |||
tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath | |||
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON tp.id = arc.typeid | |||
WHERE arc.arcrank>-1 ORDER BY arc.{$order} $orderway LIMIT 0,$arcrow "; | |||
$rsArray = array(); | |||
$cacheFile = DEDEDATA . '/cache/caicai_' . md5($query) . '.inc'; | |||
$needCache = false; | |||
if (file_exists($cacheFile) && filemtime($cacheFile) - time() < $this->arcCacheTime) { | |||
$fp = fopen($cacheFile, 'r'); | |||
$ids = fread($fp, filesize($cacheFile)); | |||
fclose($fp); | |||
$ids = trim($ids); | |||
if (!empty($ids)) { | |||
$query = "SELECT arc.*,tp.typedir,tp.typename, | |||
tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath | |||
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid | |||
WHERE arc.id in($ids) ORDER BY arc.{$order} $orderway "; | |||
} | |||
} else { | |||
$needCache = true; | |||
} | |||
$ids = array(); | |||
$i = 0; | |||
$this->dsql->Execute('cai', $query); | |||
while ($arr = $this->dsql->GetArray('cai')) { | |||
$i++; | |||
$ids[] = $arr['id']; | |||
$arr['filename'] = $arr['arcurl'] = GetFileUrl( | |||
$arr['id'], | |||
$arr['typeid'], | |||
$arr['senddate'], | |||
$arr['title'], | |||
$arr['ismake'], | |||
$arr['arcrank'], | |||
$arr['namerule'], | |||
$arr['typedir'], | |||
$arr['money'], | |||
$arr['filename'], | |||
$arr['moresite'], | |||
$arr['siteurl'], | |||
$arr['sitepath'] | |||
); | |||
$arr['typeurl'] = GetTypeUrl( | |||
$arr['typeid'], | |||
MfTypedir($arr['typedir']), | |||
$arr['isdefault'], | |||
$arr['defaultname'], | |||
$arr['ispart'], | |||
$arr['namerule2'], | |||
$arr['moresite'], | |||
$arr['siteurl'], | |||
$arr['sitepath'] | |||
); | |||
if ($arr['litpic'] == '') $arr['litpic'] = '/static/defaultpic.gif'; | |||
if (!preg_match("#^http:\/\/#", $arr['litpic'])) { | |||
$arr['picname'] = $arr['litpic'] = $GLOBALS['cfg_cmsurl'] . $arr['litpic']; | |||
} else { | |||
$arr['picname'] = $arr['litpic'] = $arr['litpic']; | |||
} | |||
$rsArray[$i] = $arr; | |||
} | |||
$this->dsql->FreeResult('cai'); | |||
//写入缓存 | |||
if ($needCache && count($ids) > 0) { | |||
$idsstr = join(',', $ids); | |||
file_put_contents($cacheFile, $idsstr); | |||
// $fp = fopen($cacheFile, 'w'); | |||
// fwrite($fp, $idsstr); | |||
// fclose($fp); | |||
} | |||
return $rsArray; | |||
} | |||
/** | |||
* 获取顶级栏目列表 | |||
* | |||
* @param array $atts | |||
* @param object $refObj | |||
* @param array $fields | |||
* @return array | |||
*/ | |||
function GetCatalog($atts, $refObj = '', $fields = array()) | |||
{ | |||
$maxrow = (empty($atts['row']) ? 12 : $atts['row']); | |||
$query = "SELECT id,typename FROM `#@__arctype` WHERE reid=0 AND ispart<2 AND channeltype>0 ORDER BY sortrank ASC LIMIT 0,$maxrow "; | |||
$rsArray = array(); | |||
$this->dsql->Execute('co', $query); | |||
$i = 0; | |||
while ($arr = $this->dsql->GetArray('co')) { | |||
$i++; | |||
$rsArray[$i] = $arr; | |||
} | |||
$this->dsql->FreeResult('co'); | |||
return $rsArray; | |||
} | |||
}//End Class |
@@ -287,6 +287,9 @@ class ListView | |||
$makeFile = preg_replace("/\/{1,}/", "/", $makeFile); | |||
$murl = $this->GetTrueUrl($murl); | |||
$this->dtp->SaveTo($makeFile); | |||
if (PHP_SAPI === 'cli') { | |||
DedeCli::showProgress(ceil(($this->PageNo / ($endpage-1)) * 100), 100); | |||
} | |||
} | |||
if ($startpage == 1) { | |||
//如果列表启用封面文件,复制这个文件第一页 | |||
@@ -1,442 +0,0 @@ | |||
<?php if (!defined('DEDEINC')) exit("Request Error!"); | |||
/** | |||
* 会员列表视图类 | |||
* | |||
* @version $Id: arc.memberlistview.class.php 1 14:49 2010年7月7日Z tianya $ | |||
* @package DedeBIZ.Libraries | |||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(DEDEINC . "/dedetemplate.class.php"); | |||
$lang_pre_page = '上页'; | |||
$lang_next_page = '下页'; | |||
$lang_index_page = '首页'; | |||
$lang_end_page = '末页'; | |||
$lang_record_number = '条记录'; | |||
$lang_page = '页'; | |||
$lang_total = '共'; | |||
/** | |||
* 档案展示类 | |||
* | |||
* @package FreeList | |||
* @subpackage DedeBIZ.Libraries | |||
* @link https://www.dedebiz.com | |||
*/ | |||
class MemberListview | |||
{ | |||
var $dsql = ''; | |||
var $tpl = ''; | |||
var $pageNO = 1; | |||
var $totalPage = 0; | |||
var $totalResult = 0; | |||
var $pageSize = 25; | |||
var $getValues = array(); | |||
var $sourceSql = ''; | |||
var $isQuery = false; | |||
var $randts = 0; | |||
/** | |||
* 用指定的文档ID进行初始化 | |||
* | |||
* @access public | |||
* @param string $tplfile 模板文件 | |||
* @return void | |||
*/ | |||
function __construct($tplfile = '') | |||
{ | |||
$this->sourceSql = ''; | |||
$this->pageSize = 25; | |||
$this->queryTime = 0; | |||
$this->getValues = array(); | |||
$this->randts = time(); | |||
$this->dsql = $GLOBALS['dsql']; | |||
$this->SetVar('ParseEnv', 'datalist'); | |||
$this->tpl = new DedeTemplate(); | |||
if ($GLOBALS['cfg_tplcache'] == 'N') { | |||
$this->tpl->isCache = false; | |||
} | |||
if ($tplfile != '') { | |||
$this->tpl->LoadTemplate($tplfile); | |||
} | |||
} | |||
//兼容PHP4 | |||
function MemberListview($tplfile = '') | |||
{ | |||
$this->__construct($tplfile); | |||
} | |||
/** | |||
* 设置SQL语句 | |||
* | |||
* @access public | |||
* @param string $sql SQL语句 | |||
* @return void | |||
*/ | |||
function SetSource($sql) | |||
{ | |||
$this->sourceSql = $sql; | |||
} | |||
/** | |||
* 设置模板 | |||
* 如果想要使用模板中指定的pagesize,必须在调用模板后才调用 SetSource($sql) | |||
* | |||
* @access public | |||
* @param string $tplfile 模板文件 | |||
* @return void | |||
*/ | |||
function SetTemplate($tplfile) | |||
{ | |||
$this->tpl->LoadTemplate($tplfile); | |||
} | |||
/** | |||
* 设置模板 | |||
* | |||
* @access public | |||
* @param string $tplfile 模板文件 | |||
* @return void | |||
*/ | |||
function SetTemplet($tplfile) | |||
{ | |||
$this->tpl->LoadTemplate($tplfile); | |||
} | |||
/** | |||
* 对config参数及get参数等进行预处理 | |||
* | |||
* @access private | |||
* @return void | |||
*/ | |||
function PreLoad() | |||
{ | |||
global $totalresult, $pageno; | |||
if (empty($pageno) || preg_match("/[^0-9]/", $pageno)) { | |||
$pageno = 1; | |||
} | |||
if (empty($totalresult) || preg_match("/[^0-9]/", $totalresult)) { | |||
$totalresult = 0; | |||
} | |||
$this->pageNO = $pageno; | |||
$this->totalResult = $totalresult; | |||
if (isset($this->tpl->tpCfgs['pagesize'])) { | |||
$this->pageSize = $this->tpl->tpCfgs['pagesize']; | |||
} | |||
$this->totalPage = ceil($this->totalResult / $this->pageSize); | |||
if ($this->totalResult == 0) { | |||
//$this->isQuery = true; | |||
//$this->dsql->Execute('mbdl',$this->sourceSql); | |||
//$this->totalResult = $this->dsql->GetTotalRow('mbdl'); | |||
$countQuery = preg_replace("/select[ \r\n\t](.*)[ \r\n\t]from/i", "Select count(*) as dd From", $this->sourceSql); | |||
$row = $this->dsql->GetOne($countQuery); | |||
$row['dd'] = empty($row['dd']) ? 0 : $row['dd']; | |||
$this->totalResult = $row['dd']; | |||
$this->sourceSql .= " limit 0," . $this->pageSize; | |||
} else { | |||
$this->sourceSql .= " limit " . (($this->pageNO - 1) * $this->pageSize) . "," . $this->pageSize; | |||
} | |||
} | |||
/** | |||
* 设置网址的Get参数键值 | |||
* | |||
* @access public | |||
* @param string $key 键 | |||
* @param string $value 值 | |||
* @return void | |||
*/ | |||
function SetParameter($key, $value) | |||
{ | |||
$this->getValues[$key] = $value; | |||
} | |||
/** | |||
* 设置/获取文档相关的各种变量 | |||
* | |||
* @access public | |||
* @param string $k 键 | |||
* @param string $v 值 | |||
* @return void | |||
*/ | |||
function SetVar($k, $v) | |||
{ | |||
global $_vars; | |||
if (!isset($_vars[$k])) $_vars[$k] = $v; | |||
} | |||
/** | |||
* 获取值 | |||
* | |||
* @param string $k | |||
* @return string | |||
*/ | |||
function GetVar($k) | |||
{ | |||
global $_vars; | |||
if (isset($_vars[$k])) return $_vars[$k]; | |||
else return ''; | |||
} | |||
/** | |||
* 获取当前页数据列表 | |||
* | |||
* @access public | |||
* @param string $atts 属性 | |||
* @param string $refObj 实例化对象 | |||
* @param string $fields 字段 | |||
* @return array | |||
*/ | |||
function GetArcList($atts, $refObj = '', $fields = array()) | |||
{ | |||
$attlist = "titlelen=30,infolen=200,imgwidth=120,imgheight=90"; | |||
FillAtts($atts, $attlist); | |||
FillFields($atts, $fields, $refObj); | |||
extract($atts, EXTR_OVERWRITE); | |||
$rsArray = array(); | |||
//global $_vars; | |||
//$t1 = Exectime(); | |||
if (!$this->isQuery) { | |||
$this->dsql->Execute('mbdl', $this->sourceSql); | |||
} | |||
$i = 0; | |||
while ($row = $this->dsql->GetArray('mbdl')) { | |||
$i++; | |||
if (!isset($row['description'])) $row['description'] = ''; | |||
if (!isset($row['color'])) $row['color'] = ''; | |||
if (!isset($row['pubdate'])) $row['pubdate'] = $row['senddate']; | |||
//处理一些特殊字段 | |||
$row['infos'] = cn_substr($row['description'], $infolen); | |||
$row['id'] = $row['id']; | |||
$row['filename'] = $row['arcurl'] = GetFileUrl( | |||
$row['id'], | |||
$row['typeid'], | |||
$row['senddate'], | |||
$row['title'], | |||
$row['ismake'], | |||
$row['arcrank'], | |||
$row['namerule'], | |||
$row['typedir'], | |||
$row['money'], | |||
$row['filename'], | |||
$row['moresite'], | |||
$row['siteurl'], | |||
$row['sitepath'] | |||
); | |||
$row['typeurl'] = GetTypeUrl( | |||
$row['typeid'], | |||
$row['typedir'], | |||
$row['isdefault'], | |||
$row['defaultname'], | |||
$row['ispart'], | |||
$row['namerule2'], | |||
$row['moresite'], | |||
$row['siteurl'], | |||
$row['sitepath'] | |||
); | |||
if ($row['litpic'] == '-' || $row['litpic'] == '') { | |||
$row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; | |||
} | |||
if (!preg_match("/^http:\/\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { | |||
$row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; | |||
} | |||
$row['picname'] = $row['litpic']; | |||
$row['stime'] = GetDateMK($row['pubdate']); | |||
$row['typelink'] = "<a href='" . $row['typeurl'] . "'>" . $row['typename'] . "</a>"; | |||
$row['image'] = "<img src='" . $row['picname'] . "' border='0' width='$imgwidth' height='$imgheight' alt='" . preg_replace("/['><]/", "", $row['title']) . "'>"; | |||
$row['imglink'] = "<a href='" . $row['filename'] . "'>" . $row['image'] . "</a>"; | |||
$row['fulltitle'] = $row['title']; | |||
$row['title'] = cn_substr($row['title'], $titlelen); | |||
if ($row['color'] != '') { | |||
$row['title'] = "<font color='" . $row['color'] . "'>" . $row['title'] . "</font>"; | |||
} | |||
if (preg_match('/b/', $row['flag'])) { | |||
$row['title'] = "<strong>" . $row['title'] . "</strong>"; | |||
} | |||
//$row['title'] = "<b>".$row['title']."</b>"; | |||
$row['textlink'] = "<a href='" . $row['filename'] . "'>" . $row['title'] . "</a>"; | |||
$row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; | |||
$row['memberurl'] = $GLOBALS['cfg_memberurl']; | |||
$row['templeturl'] = $GLOBALS['cfg_templeturl']; | |||
$rsArray[$i] = $row; | |||
if ($i >= $this->pageSize) { | |||
break; | |||
} | |||
} | |||
$this->dsql->FreeResult(); | |||
//echo "执行时间:".(Exectime() - $t1); | |||
return $rsArray; | |||
} | |||
/** | |||
* 获取分页导航列表 | |||
* | |||
* @access public | |||
* @param string $atts 属性 | |||
* @param string $refObj 实例化对象 | |||
* @param string $fields 字段 | |||
* @return string | |||
*/ | |||
function GetPageList($atts, $refObj = '', $fields = array()) | |||
{ | |||
global $lang_pre_page, $lang_next_page, $lang_index_page, $lang_end_page, $lang_record_number, $lang_page, $lang_total; | |||
$prepage = $nextpage = $geturl = $hidenform = ''; | |||
$purl = $this->GetCurUrl(); | |||
$prepagenum = $this->pageNO - 1; | |||
$nextpagenum = $this->pageNO + 1; | |||
if (!isset($atts['listsize']) || preg_match("/[^0-9]/", $atts['listsize'])) { | |||
$atts['listsize'] = 5; | |||
} | |||
if (!isset($atts['listitem'])) { | |||
$atts['listitem'] = "info,index,end,pre,next,pageno"; | |||
} | |||
$totalpage = ceil($this->totalResult / $this->pageSize); | |||
//echo " {$totalpage}=={$this->totalResult}=={$this->pageSize}"; | |||
//无结果或只有一页的情况 | |||
if ($totalpage <= 1 && $this->totalResult > 0) { | |||
return "{$lang_total} 1 {$lang_page}/" . $this->totalResult . $lang_record_number; | |||
} | |||
if ($this->totalResult == 0) { | |||
return "{$lang_total} 0 {$lang_page}/" . $this->totalResult . $lang_record_number; | |||
} | |||
$infos = "<span>{$lang_total} {$totalpage} {$lang_page}/{$this->totalResult}{$lang_record_number}</span> "; | |||
if ($this->totalResult != 0) { | |||
$this->getValues['totalresult'] = $this->totalResult; | |||
} | |||
if (count($this->getValues) > 0) { | |||
foreach ($this->getValues as $key => $value) { | |||
$value = urlencode($value); | |||
$geturl .= "$key=$value" . "&"; | |||
$hidenform .= "<input type='hidden' name='$key' value='$value'>\r\n"; | |||
} | |||
} | |||
$purl .= "?" . $geturl; | |||
//获得上一页和下一页的链接 | |||
if ($this->pageNO != 1) { | |||
$prepage .= "<a href='" . $purl . "pageno=$prepagenum'>$lang_pre_page</a> \r\n"; | |||
$indexpage = "<a href='" . $purl . "pageno=1'>$lang_index_page</a> \r\n"; | |||
} else { | |||
$indexpage = "$lang_index_page \r\n"; | |||
} | |||
if ($this->pageNO != $totalpage && $totalpage > 1) { | |||
$nextpage .= "<a href='" . $purl . "pageno=$nextpagenum'>$lang_next_page</a> \r\n"; | |||
$endpage = "<a href='" . $purl . "pageno=$totalpage'>$lang_end_page</a> \r\n"; | |||
} else { | |||
$endpage = " $lang_end_page \r\n"; | |||
} | |||
//获得数字链接 | |||
$listdd = ""; | |||
$total_list = $atts['listsize'] * 2 + 1; | |||
if ($this->pageNO >= $total_list) { | |||
$j = $this->pageNO - $atts['listsize']; | |||
$total_list = $this->pageNO + $atts['listsize']; | |||
if ($total_list > $totalpage) { | |||
$total_list = $totalpage; | |||
} | |||
} else { | |||
$j = 1; | |||
if ($total_list > $totalpage) $total_list = $totalpage; | |||
} | |||
for ($j; $j <= $total_list; $j++) { | |||
if ($j == $this->pageNO) { | |||
$listdd .= "<strong>$j</strong> \r\n"; | |||
} else { | |||
$listdd .= "<a href='" . $purl . "pageno=$j'>" . $j . "</a> \r\n"; | |||
} | |||
} | |||
$plist = "<div class=\"pagelistbox\">\r\n"; | |||
//info,index,end,pre,next,pageno,form | |||
if (preg_match("/info/i", $atts['listitem'])) { | |||
$plist .= $infos; | |||
} | |||
if (preg_match("/index/i", $atts['listitem'])) { | |||
$plist .= $indexpage; | |||
} | |||
if (preg_match("/pre/i", $atts['listitem'])) { | |||
$plist .= $prepage; | |||
} | |||
if (preg_match("/pageno/i", $atts['listitem'])) { | |||
$plist .= $listdd; | |||
} | |||
if (preg_match("/next/i", $atts['listitem'])) { | |||
$plist .= $nextpage; | |||
} | |||
if (preg_match("/end/i", $atts['listitem'])) { | |||
$plist .= $endpage; | |||
} | |||
if (preg_match("/form/i", $atts['listitem'])) { | |||
$plist .= " <form name='pagelist' action='" . $this->GetCurUrl() . "'>$hidenform"; | |||
if ($totalpage > $total_list) { | |||
$plist .= "<input type='text' name='pageno' style='padding:0px;width:30px;height:18px'>\r\n"; | |||
$plist .= "<input type='submit' name='plistgo' value='GO' style='padding:0px;width:30px;height:18px;font-size:11px'>\r\n"; | |||
} | |||
$plist .= "</form>\r\n"; | |||
} | |||
$plist .= "</div>\r\n"; | |||
return $plist; | |||
} | |||
/** | |||
* 获得当前网址 | |||
* | |||
* @access public | |||
* @return string | |||
*/ | |||
function GetCurUrl() | |||
{ | |||
if (!empty($_SERVER["REQUEST_URI"])) { | |||
$nowurl = $_SERVER["REQUEST_URI"]; | |||
$nowurls = explode("?", $nowurl); | |||
$nowurl = $nowurls[0]; | |||
} else { | |||
$nowurl = $_SERVER["PHP_SELF"]; | |||
} | |||
return $nowurl; | |||
} | |||
//关闭 | |||
function Close() | |||
{ | |||
} | |||
/** | |||
* 显示数据 | |||
* | |||
* @access public | |||
* @return void | |||
*/ | |||
function Display() | |||
{ | |||
if ($this->sourceSql != '') $this->PreLoad(); | |||
//在PHP4中,对象引用必须放在display之前,放在其它位置中无效 | |||
$this->tpl->SetObject($this); | |||
$this->tpl->Display(); | |||
} | |||
/** | |||
* 保存为HTML | |||
* | |||
* @access public | |||
* @param string $filename 文件名称 | |||
* @return string | |||
*/ | |||
function SaveTo($filename) | |||
{ | |||
$this->tpl->SaveTo($filename); | |||
} | |||
}//End Class |
@@ -99,7 +99,7 @@ class PartView | |||
* 指定typelink对象给当前类实例 | |||
* | |||
* @access public | |||
* @param string $typelink 栏目链接 | |||
* @param object $typelink 栏目链接 | |||
* @return string | |||
*/ | |||
function SetTypeLink(&$typelink) | |||
@@ -284,6 +284,9 @@ class SgListView | |||
$makeFile = preg_replace("/\/{1,}/", "/", $makeFile); | |||
$murl = $this->GetTrueUrl($murl); | |||
$this->dtp->SaveTo($makeFile); | |||
if (PHP_SAPI === 'cli') { | |||
DedeCli::showProgress(ceil(($this->PageNo / $endpage) * 100), 100); | |||
} | |||
} | |||
if ($startpage == 1) { | |||
//如果列表启用封面文件,复制这个文件第一页 | |||
@@ -15,16 +15,11 @@ function __autoload($classname) | |||
{ | |||
return TRUE; | |||
} | |||
$classfile = $classname.'.php'; | |||
$libclassfile = $classname.'.class.php'; | |||
if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | |||
{ | |||
require DEDEINC.'/'.$libclassfile; | |||
} | |||
else if( is_file ( DEDEMODEL.'/'.$classfile ) ) | |||
{ | |||
require DEDEMODEL.'/'.$classfile; | |||
} | |||
else | |||
{ | |||
if (DEBUG_LEVEL === TRUE) | |||
@@ -11,20 +11,21 @@ if(!defined('DEDEINC')) exit("Request Error!"); | |||
function dede_autoloader($classname) | |||
{ | |||
$classname = preg_replace("/[^0-9a-z_]/i", '', $classname); | |||
$classname = strtolower($classname); | |||
if( class_exists ( $classname ) ) | |||
{ | |||
return TRUE; | |||
} | |||
$classfile = $classname.'.php'; | |||
if (in_array($classname, array("archives","freelist","listview","partview","rssview", | |||
"searchview","sglistview","sgpage","specview","taglist"))) { | |||
$classname = "arc.".$classname; | |||
} | |||
$libclassfile = $classname.'.class.php'; | |||
if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | |||
{ | |||
require DEDEINC.'/'.$libclassfile; | |||
} | |||
else if( is_file ( DEDEMODEL.'/'.$classfile ) ) | |||
{ | |||
require DEDEMODEL.'/'.$classfile; | |||
} | |||
else | |||
{ | |||
if (DEBUG_LEVEL === TRUE) | |||
@@ -0,0 +1,398 @@ | |||
<?php if (!defined('DEDEINC')) exit('Request Error!'); | |||
// Copyright 2020 The DedeBiz Authors. All rights reserved. | |||
// license that can be found in the LICENSE file. | |||
// @copyright Copyright (c) 2020, DedeBIZ.COM | |||
// @license https://www.dedebiz.com/license | |||
// @link https://www.dedebiz.com | |||
/* | |||
The MIT License (MIT) | |||
Copyright (c) 2014-2019 British Columbia Institute of Technology | |||
Copyright (c) 2019-2020 CodeIgniter Foundation | |||
*/ | |||
function is_cli() | |||
{ | |||
return (PHP_SAPI === 'cli' || defined('STDIN')); | |||
} | |||
class DedeCli | |||
{ | |||
public static $readline_support = false; | |||
protected static $initialized = false; | |||
protected static $wait_msg = "Press any key to continue..."; | |||
protected static $segments = []; | |||
protected static $options = []; | |||
protected static $foreground_colors = [ | |||
'black' => '0;30', | |||
'dark_gray' => '1;30', | |||
'blue' => '0;34', | |||
'dark_blue' => '1;34', | |||
'light_blue' => '1;34', | |||
'green' => '0;32', | |||
'light_green' => '1;32', | |||
'cyan' => '0;36', | |||
'light_cyan' => '1;36', | |||
'red' => '0;31', | |||
'light_red' => '1;31', | |||
'purple' => '0;35', | |||
'light_purple' => '1;35', | |||
'light_yellow' => '0;33', | |||
'yellow' => '1;33', | |||
'light_gray' => '0;37', | |||
'white' => '1;37', | |||
]; | |||
protected static $background_colors = [ | |||
'black' => '40', | |||
'red' => '41', | |||
'green' => '42', | |||
'yellow' => '43', | |||
'blue' => '44', | |||
'magenta' => '45', | |||
'cyan' => '46', | |||
'light_gray' => '47', | |||
]; | |||
public static function init() | |||
{ | |||
if (is_cli()) | |||
{ | |||
static::$readline_support = extension_loaded('readline'); | |||
static::parseCommandLine(); | |||
static::$initialized = true; | |||
} else | |||
{ | |||
define('STDOUT', 'php://output'); | |||
} | |||
} | |||
private static function parseCommandLine() | |||
{ | |||
$optionsFound = false; | |||
for ($i=1; $i < $_SERVER['argc']; $i++) | |||
{ | |||
if (! $optionsFound && strpos($_SERVER['argv'][$i], '-') === false) | |||
{ | |||
static::$segments[] = $_SERVER['argv'][$i]; | |||
continue; | |||
} | |||
$optionsFound = true; | |||
if (substr($_SERVER['argv'][$i], 0, 1) != '-') | |||
{ | |||
continue; | |||
} | |||
$arg = str_replace('-', '', $_SERVER['argv'][$i]); | |||
$value = null; | |||
if (isset($_SERVER['argv'][$i+1]) && substr($_SERVER['argv'][$i+1], 0, 1) != '-') | |||
{ | |||
$value = $_SERVER['argv'][$i+1]; | |||
$i++; | |||
} | |||
static::$options[$arg] = $value; | |||
$optionsFound = false; | |||
} | |||
} | |||
public static function getOption(string $name) | |||
{ | |||
if (! array_key_exists($name, static::$options)) | |||
{ | |||
return null; | |||
} | |||
$val = static::$options[$name] === null | |||
? true | |||
: static::$options[$name]; | |||
return $val; | |||
} | |||
public static function getOptions() | |||
{ | |||
return static::$options; | |||
} | |||
public static function getOptionString(): string | |||
{ | |||
if (! count(static::$options)) | |||
{ | |||
return ''; | |||
} | |||
$out = ''; | |||
foreach (static::$options as $name => $value) | |||
{ | |||
if (mb_strpos($value, ' ') !== false) | |||
{ | |||
$value = '"'.$value.'"'; | |||
} | |||
$out .= "-{$name} $value "; | |||
} | |||
return $out; | |||
} | |||
public static function newLine(int $num = 1) | |||
{ | |||
for ($i = 0; $i < $num; $i++) | |||
{ | |||
static::write(''); | |||
} | |||
} | |||
public static function isWindows() | |||
{ | |||
return 'win' === strtolower(substr(php_uname("s"), 0, 3)); | |||
} | |||
public static function color(string $text, string $foreground, string $background = null, string $format = null) | |||
{ | |||
if (static::isWindows() && ! isset($_SERVER['ANSICON'])) | |||
{ | |||
return $text; | |||
} | |||
if ( ! array_key_exists($foreground, static::$foreground_colors)) | |||
{ | |||
throw new \RuntimeException('Invalid CLI foreground color: '.$foreground); | |||
} | |||
if ($background !== null && ! array_key_exists($background, static::$background_colors)) | |||
{ | |||
throw new \RuntimeException('Invalid CLI background color: '.$background); | |||
} | |||
$string = "\033[".static::$foreground_colors[$foreground]."m"; | |||
if ($background !== null) | |||
{ | |||
$string .= "\033[".static::$background_colors[$background]."m"; | |||
} | |||
if ($format === 'underline') | |||
{ | |||
$string .= "\033[4m"; | |||
} | |||
$string .= $text."\033[0m"; | |||
return $string; | |||
} | |||
public static function getWidth(int $default = 80): int | |||
{ | |||
if (static::isWindows()) | |||
{ | |||
return $default; | |||
} | |||
return (int)shell_exec('tput cols'); | |||
} | |||
public static function getHeight(int $default = 32): int | |||
{ | |||
if (static::isWindows()) | |||
{ | |||
return $default; | |||
} | |||
return (int)shell_exec('tput lines'); | |||
} | |||
public static function showProgress($thisStep = 1, int $totalSteps = 10) | |||
{ | |||
static $inProgress = false; | |||
if ($inProgress !== false && $inProgress <= $thisStep) | |||
{ | |||
fwrite(STDOUT, "\033[1A"); | |||
} | |||
$inProgress = $thisStep; | |||
if ($thisStep !== false) | |||
{ | |||
$thisStep = abs($thisStep); | |||
$totalSteps = $totalSteps < 1 ? 1 : $totalSteps; | |||
$percent = intval(($thisStep / $totalSteps) * 100); | |||
$step = (int)round($percent / 10); | |||
fwrite(STDOUT, "[\033[32m".str_repeat('#', $step).str_repeat('.', 10 - $step)."\033[0m]"); | |||
fwrite(STDOUT, sprintf(" %3d%% Complete", $percent).PHP_EOL); | |||
} | |||
else | |||
{ | |||
fwrite(STDOUT, "\007"); | |||
} | |||
} | |||
public static function wrap(string $string = null, int $max = 0, int $pad_left = 0): string | |||
{ | |||
if (empty($string)) | |||
{ | |||
return ''; | |||
} | |||
if ($max == 0) | |||
{ | |||
$max = DedeCli::getWidth(); | |||
} | |||
if (DedeCli::getWidth() < $max) | |||
{ | |||
$max = DedeCli::getWidth(); | |||
} | |||
$max = $max - $pad_left; | |||
$lines = wordwrap($string, $max); | |||
if ($pad_left > 0) | |||
{ | |||
$lines = explode(PHP_EOL, $lines); | |||
$first = true; | |||
array_walk($lines, function (&$line, $index) use ($max, $pad_left, &$first) | |||
{ | |||
if ( ! $first) | |||
{ | |||
$line = str_repeat(" ", $pad_left).$line; | |||
} | |||
else | |||
{ | |||
$first = false; | |||
} | |||
}); | |||
$lines = implode(PHP_EOL, $lines); | |||
} | |||
return $lines; | |||
} | |||
public static function clearScreen() | |||
{ | |||
static::isWindows() | |||
? static::newLine(40) | |||
: fwrite(STDOUT, chr(27)."[H".chr(27)."[2J"); | |||
} | |||
public static function input(string $prefix = null): string | |||
{ | |||
if (static::$readline_support) | |||
{ | |||
return readline($prefix); | |||
} | |||
echo $prefix; | |||
return fgets(STDIN); | |||
} | |||
/** | |||
* 询问用户输入.这个可以1个或2个参数. | |||
* | |||
* 使用: | |||
* | |||
* // 等待任何输入 | |||
* DedeCli::prompt(); | |||
* | |||
* $color = DedeCli::prompt('What is your favorite color?'); | |||
* | |||
* $color = DedeCli::prompt('What is your favourite color?', 'white'); | |||
* | |||
* $ready = DedeCli::prompt('Are you ready?', array('y','n')); | |||
* | |||
* @return string the user input | |||
*/ | |||
public static function prompt(): string | |||
{ | |||
$args = func_get_args(); | |||
$options = []; | |||
$output = ''; | |||
$default = null; | |||
$arg_count = count($args); | |||
$required = end($args) === true; | |||
$required === true && --$arg_count; | |||
switch ($arg_count) | |||
{ | |||
case 2: | |||
// E.g: $ready = DedeCli::prompt('Are you ready?', array('y','n')); | |||
if (is_array($args[1])) | |||
{ | |||
list($output, $options) = $args; | |||
} | |||
// E.g: $color = DedeCli::prompt('What is your favourite color?', 'white'); | |||
elseif (is_string($args[1])) | |||
{ | |||
list($output, $default) = $args; | |||
} | |||
break; | |||
case 1: | |||
// E.g: $ready = DedeCli::prompt(array('y','n')); | |||
if (is_array($args[0])) | |||
{ | |||
$options = $args[0]; | |||
} | |||
// E.g: $ready = DedeCli::prompt('What did you do today?'); | |||
elseif (is_string($args[0])) | |||
{ | |||
$output = $args[0]; | |||
} | |||
break; | |||
} | |||
if ($output !== '') | |||
{ | |||
$extra_output = ''; | |||
if ($default !== null) | |||
{ | |||
$extra_output = ' [ Default: "'.$default.'" ]'; | |||
} | |||
elseif ($options !== []) | |||
{ | |||
$extra_output = ' [ '.implode(', ', $options).' ]'; | |||
} | |||
fwrite(STDOUT, $output.$extra_output.': '); | |||
} | |||
$input = trim(static::input()) ? : $default; | |||
if (empty($input) && $required === true) | |||
{ | |||
static::write('This is required.'); | |||
static::newLine(); | |||
$input = forward_static_call_array([__CLASS__, 'prompt'], $args); | |||
} | |||
if ( ! empty($options) && ! in_array($input, $options)) | |||
{ | |||
static::write('This is not a valid option. Please try again.'); | |||
static::newLine(); | |||
$input = forward_static_call_array([__CLASS__, 'prompt'], $args); | |||
} | |||
return empty($input) ? '' : $input; | |||
} | |||
public static function wait(int $seconds, bool $countdown = false) | |||
{ | |||
if ($countdown === true) | |||
{ | |||
$time = $seconds; | |||
while ($time > 0) | |||
{ | |||
fwrite(STDOUT, $time.'... '); | |||
sleep(1); | |||
$time--; | |||
} | |||
static::write(); | |||
} | |||
else | |||
{ | |||
if ($seconds > 0) | |||
{ | |||
sleep($seconds); | |||
} | |||
else | |||
{ | |||
static::write(static::$wait_msg); | |||
static::input(); | |||
} | |||
} | |||
} | |||
public static function error(string $text, string $foreground = 'light_red', string $background = null) | |||
{ | |||
if ($foreground || $background) | |||
{ | |||
$text = static::color($text, $foreground, $background); | |||
} | |||
fwrite(STDERR, $text.PHP_EOL); | |||
} | |||
public static function write(string $text = '', string $foreground = null, string $background = null) | |||
{ | |||
if ($foreground || $background) | |||
{ | |||
$text = static::color($text, $foreground, $background); | |||
} | |||
fwrite(STDOUT, $text.PHP_EOL); | |||
} | |||
} | |||
DedeCli::init(); |
@@ -283,7 +283,7 @@ function ResetVdValue() | |||
function IndexSub($idx, $num) | |||
{ | |||
return intval($idx - $num) == 0 ? '0 ' : intval($idx - $num); | |||
return intval($idx) - intval($num) == 0 ? '0 ' : intval($idx) - intval($num); | |||
} | |||
// 用来返回index的active | |||
@@ -25,11 +25,6 @@ define('DEDEDATA', DEDEROOT . '/data'); | |||
define('DEDEMEMBER', DEDEROOT . '/member'); | |||
define('DEDETEMPLATE', DEDEROOT . '/templets'); | |||
// ------------------------------------------------------------------------ | |||
define('DEDEMODEL', './model'); | |||
define('DEDECONTROL', './control'); | |||
define('DEDEAPPTPL', './templates'); | |||
// ------------------------------------------------------------------------ | |||
define('DEDEBIZURL', "https://www.dedebiz.com"); // Dede商业支持 | |||
define('DEDEVER', 6); // 当前系统大版本 | |||
@@ -177,7 +172,12 @@ if (PHP_VERSION > '5.1') { | |||
$cfg_isUrlOpen = @ini_get("allow_url_fopen"); | |||
//用户访问的网站host | |||
$cfg_clihost = 'http://' . $_SERVER['HTTP_HOST']; | |||
if (PHP_SAPI === 'cli') { | |||
$cfg_clihost = 'https://www.dedebiz.com'; | |||
} else { | |||
$cfg_clihost = 'http://' . $_SERVER['HTTP_HOST']; | |||
} | |||
//站点根目录 | |||
$cfg_basedir = preg_replace('#' . $cfg_cmspath . '\/include$#i', '', DEDEINC); | |||
@@ -237,7 +237,7 @@ $cfg_other_medias = $cfg_medias_dir . '/media'; | |||
//软件摘要信息,****请不要删除本项**** 否则系统无法正确接收系统漏洞或升级信息 | |||
$cfg_version = 'V6'; | |||
$cfg_version_detail = '6.0.2'; // 详细版本号 | |||
$cfg_version_detail = '6.0.1'; // 详细版本号 | |||
$cfg_soft_lang = 'utf-8'; | |||
$cfg_soft_public = 'base'; | |||
@@ -296,7 +296,10 @@ if ($cfg_memcache_enable == 'Y') { | |||
} | |||
if (!isset($cfg_NotPrintHead)) { | |||
header("Content-Type: text/html; charset={$cfg_soft_lang}"); | |||
if (PHP_SAPI != 'cli') { | |||
header("Content-Type: text/html; charset={$cfg_soft_lang}"); | |||
} | |||
} | |||
//自动加载类库处理 | |||
@@ -93,6 +93,24 @@ class DedeBizClient | |||
return $this->request($req); | |||
} | |||
// 发送邮件 | |||
function MailSend($to, $subject, $title, $content="", $quote="", $link_url="", $link_title="") | |||
{ | |||
$req = array( | |||
"method" => "main_send", | |||
"parms" => array( | |||
"to" => $to, | |||
"subject" => $subject, | |||
"title" => $title, | |||
"content" => $content, | |||
"quote" => $quote, | |||
"link_url" => $link_url, | |||
"link_title" => $link_title, | |||
) | |||
); | |||
return $this->request($req); | |||
} | |||
// 获取一个管理员信息 | |||
function AdminGetOne() | |||
{ | |||
@@ -250,6 +268,14 @@ class DedeBizClient | |||
// !!!一次页面操作后一定记得要关闭连接,否则会占用系统资源 | |||
function Close() | |||
{ | |||
socket_close($this->socket); | |||
// 这里避免重复释放 | |||
if (strtolower(get_resource_type($this->socket)) === "socket") { | |||
socket_close($this->socket); | |||
} | |||
} | |||
function __destruct() | |||
{ | |||
$this->Close(); | |||
} | |||
} |
@@ -229,7 +229,11 @@ class DedeSqli | |||
} | |||
if (DEBUG_LEVEL === TRUE) { | |||
$queryTime = ExecTime() - $t1; | |||
echo "<div style='width:98%;margin:1rem auto;color: #155724;background-color: #d4edda;border-color: #c3e6cb;position: relative;padding: .75rem 1.25rem;border: 1px solid transparent;border-radius: .25rem;'>执行SQL:" . $this->queryString . ",执行时间:<b>{$queryTime}</b></div>\r\n"; | |||
if (PHP_SAPI === 'cli') { | |||
echo "执行SQL:" . $this->queryString . ",执行时间:{$queryTime}\r\n"; | |||
} else { | |||
echo "<div style='width:98%;margin:1rem auto;color: #155724;background-color: #d4edda;border-color: #c3e6cb;position: relative;padding: .75rem 1.25rem;border: 1px solid transparent;border-radius: .25rem;'>执行SQL:" . $this->queryString . ",执行时间:<b>{$queryTime}</b></div>\r\n"; | |||
} | |||
} | |||
return $rs; | |||
@@ -267,7 +271,11 @@ class DedeSqli | |||
} | |||
if (DEBUG_LEVEL === TRUE) { | |||
$queryTime = ExecTime() - $t1; | |||
echo "<div style='width:98%;margin:1rem auto;color: #155724;background-color: #d4edda;border-color: #c3e6cb;position: relative;padding: .75rem 1.25rem;border: 1px solid transparent;border-radius: .25rem;'>执行SQL:" . $this->queryString . ",执行时间:<b>{$queryTime}</b></div>\r\n"; | |||
if (PHP_SAPI === 'cli') { | |||
echo "执行SQL:" . $this->queryString . ",执行时间:{$queryTime}\r\n"; | |||
} else { | |||
echo "<div style='width:98%;margin:1rem auto;color: #155724;background-color: #d4edda;border-color: #c3e6cb;position: relative;padding: .75rem 1.25rem;border: 1px solid transparent;border-radius: .25rem;'>执行SQL:" . $this->queryString . ",执行时间:<b>{$queryTime}</b></div>\r\n"; | |||
} | |||
} | |||
return mysqli_affected_rows($this->linkID); | |||
@@ -320,7 +328,11 @@ class DedeSqli | |||
} | |||
if (DEBUG_LEVEL === TRUE) { | |||
$queryTime = ExecTime() - $t1; | |||
echo "<div style='width:98%;margin:1rem auto;color: #155724;background-color: #d4edda;border-color: #c3e6cb;position: relative;padding: .75rem 1.25rem;border: 1px solid transparent;border-radius: .25rem;'>执行SQL:" . $this->queryString . ",执行时间:<b>{$queryTime}</b></div>\r\n"; | |||
if (PHP_SAPI === 'cli') { | |||
echo "执行SQL:" . $this->queryString . ",执行时间:{$queryTime}\r\n"; | |||
} else { | |||
echo "<div style='width:98%;margin:1rem auto;color: #155724;background-color: #d4edda;border-color: #c3e6cb;position: relative;padding: .75rem 1.25rem;border: 1px solid transparent;border-radius: .25rem;'>执行SQL:" . $this->queryString . ",执行时间:<b>{$queryTime}</b></div>\r\n"; | |||
} | |||
} | |||
if ($this->result[$id] === FALSE) { | |||
@@ -500,7 +500,12 @@ function MakeOneTag(&$dtp, &$refObj, $parfield = 'Y') | |||
$dtp->Assign($tagid, $funcname($ctag, $refObj)); | |||
if (DEBUG_LEVEL == TRUE) { | |||
$queryTime = ExecTime() - $ttt1; | |||
echo '<div style="color: #856404;background-color: #fff3cd;border-color: #ffeeba;position: relative;padding: .75rem 1.25rem;margin-bottom: 1rem;border: 1px solid transparent;border-radius: .25rem;" class="alert alert-warning" role="alert">标签:' . $tagname . '载入花费时间:' . $queryTime . "</div>\r\n"; | |||
if (PHP_SAPI === 'cli') { | |||
echo '标签:' . $tagname . '载入花费时间:' . $queryTime . "\r\n"; | |||
} else { | |||
echo '<div style="color: #856404;background-color: #fff3cd;border-color: #ffeeba;position: relative;padding: .75rem 1.25rem;margin-bottom: 1rem;border: 1px solid transparent;border-radius: .25rem;" class="alert alert-warning" role="alert">标签:' . $tagname . '载入花费时间:' . $queryTime . "</div>\r\n"; | |||
} | |||
} | |||
} | |||
} | |||
@@ -90,7 +90,7 @@ class TypeUnitSelector | |||
$this->LogicListAllSunType($id, $channel, $soncat); | |||
if ($chackRadio == '' && $soncat == '') continue; | |||
echo "<div class='quickselItem'>\r\n"; | |||
echo " <div class='topcat'>{$chackRadio}{$typeName}</div>\r\n"; | |||
echo " <div class='topcat'><label>{$chackRadio} {$typeName}</label></div>\r\n"; | |||
if ($soncat != '') echo " <div class='soncat'>{$soncat}</div>\r\n"; | |||
echo "</div>\r\n"; | |||
} | |||
@@ -105,7 +105,7 @@ class TypeUnitSelector | |||
* @param int $soncat 子级分类 | |||
* @return string | |||
*/ | |||
function LogicListAllSunType($id, $channel = 0, &$soncat) | |||
function LogicListAllSunType($id, $channel = 0, &$soncat=0) | |||
{ | |||
global $cfg_admin_channel, $admin_catalogs, $targetid, $oldvalue; | |||
$fid = $id; | |||
@@ -133,7 +133,7 @@ class TypeUnitSelector | |||
continue; | |||
} | |||
if ($chackRadio != '') { | |||
$soncat .= " <div class='item'>" . $chackRadio . $typeName . "</div>\r\n"; | |||
$soncat .= " <div class='item'><label>" . $chackRadio .' '. $typeName . "</label></div>\r\n"; | |||
$this->LogicListAllSunType($id, $channel, $soncat); | |||
} else { | |||
$soncat .= " <br style='clear:both' /><div class='item'><b>" . $typeName . ":</b></div>\r\n"; | |||