diff --git a/dedebiz b/dedebiz
index 66ecd831..7b5661eb 100755
--- a/dedebiz
+++ b/dedebiz
@@ -1,9 +1,9 @@
#!/usr/bin/env php
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;
}
diff --git a/src/data/admin/source.txt b/src/data/admin/source.txt
index f54ff330..2230f85a 100755
--- a/src/data/admin/source.txt
+++ b/src/data/admin/source.txt
@@ -1,5 +1,4 @@
-Admin5
-ChinaZ
-织梦技术论坛
-落伍者论坛
-DedeBIZ
\ No newline at end of file
+DedeBIZ
+今日头条
+微信公众号
+百家号
\ No newline at end of file
diff --git a/src/dede/mail_send.php b/src/dede/mail_send.php
index 877ce4e9..4da64708 100755
--- a/src/dede/mail_send.php
+++ b/src/dede/mail_send.php
@@ -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();
}
-?>
\ No newline at end of file
diff --git a/src/dede/mail_title_send.php b/src/dede/mail_title_send.php
index 3e86ade4..ad8644d6 100755
--- a/src/dede/mail_title_send.php
+++ b/src/dede/mail_title_send.php
@@ -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();
}
-
-?>
\ No newline at end of file
diff --git a/src/dede/makehtml_list_action.php b/src/dede/makehtml_list_action.php
index 37b46ada..1661d50d 100755
--- a/src/dede/makehtml_list_action.php
+++ b/src/dede/makehtml_list_action.php
@@ -62,7 +62,7 @@ if (isset($idArray[$pageno])) {
if ($pageno == 0 && $mkpage == 1) //清空缓存
{
- $dsql->ExecuteNoneQuery("Delete From `#@__arccache` ");
+ $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache` ");
}
$reurl = '';
diff --git a/src/dede/templets/makehtml_homepage.htm b/src/dede/templets/makehtml_homepage.htm
index 08c09e58..f86719da 100755
--- a/src/dede/templets/makehtml_homepage.htm
+++ b/src/dede/templets/makehtml_homepage.htm
@@ -86,48 +86,58 @@
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") {?>
+
|