Browse Source

代码格式化、确认DedeBIZ包名

tags/6.0.2
tianya 3 years ago
parent
commit
892752ef1c
100 changed files with 3938 additions and 5127 deletions
  1. +1
    -3
      src/data/admin/allowurl.txt
  2. +2
    -1
      src/data/admin/config_update.php
  3. +6
    -5
      src/dede/action_search.php
  4. +32
    -34
      src/dede/actionsearch_class.php
  5. +27
    -48
      src/dede/ad_add.php
  6. +21
    -29
      src/dede/ad_edit.php
  7. +21
    -28
      src/dede/ad_main.php
  8. +13
    -19
      src/dede/adtype_main.php
  9. +159
    -199
      src/dede/album_add.php
  10. +165
    -205
      src/dede/album_edit.php
  11. +4
    -3
      src/dede/album_testhtml.php
  12. +93
    -118
      src/dede/archives_add.php
  13. +402
    -520
      src/dede/archives_do.php
  14. +84
    -109
      src/dede/archives_edit.php
  15. +70
    -94
      src/dede/archives_sg_add.php
  16. +65
    -84
      src/dede/archives_sg_edit.php
  17. +1
    -3
      src/dede/article_add.php
  18. +17
    -18
      src/dede/article_allowurl_edit.php
  19. +86
    -96
      src/dede/article_coonepage_rule.php
  20. +57
    -92
      src/dede/article_description_main.php
  21. +98
    -124
      src/dede/article_edit.php
  22. +31
    -42
      src/dede/article_keywords_main.php
  23. +68
    -116
      src/dede/article_keywords_make.php
  24. +11
    -10
      src/dede/article_keywords_select.php
  25. +16
    -23
      src/dede/article_select_sw.php
  26. +17
    -18
      src/dede/article_source_edit.php
  27. +19
    -20
      src/dede/article_string_mix.php
  28. +24
    -31
      src/dede/article_template_rand.php
  29. +44
    -49
      src/dede/article_test_same.php
  30. +6
    -6
      src/dede/article_test_title.php
  31. +17
    -18
      src/dede/article_writer_edit.php
  32. +19
    -25
      src/dede/baidunews.php
  33. +20
    -29
      src/dede/cards_make.php
  34. +26
    -26
      src/dede/cards_manage.php
  35. +15
    -21
      src/dede/cards_type.php
  36. +94
    -130
      src/dede/catalog_add.php
  37. +17
    -17
      src/dede/catalog_del.php
  38. +1
    -1
      src/dede/catalog_do.php
  39. +141
    -158
      src/dede/catalog_edit.php
  40. +5
    -4
      src/dede/catalog_main.php
  41. +9
    -11
      src/dede/catalog_menu.php
  42. +54
    -80
      src/dede/co_add.php
  43. +79
    -124
      src/dede/co_do.php
  44. +48
    -76
      src/dede/co_edit.php
  45. +9
    -11
      src/dede/co_edit_text.php
  46. +73
    -132
      src/dede/co_export.php
  47. +1
    -3
      src/dede/co_export_corule.php
  48. +8
    -11
      src/dede/co_gather_start.php
  49. +35
    -51
      src/dede/co_gather_start_action.php
  50. +1
    -3
      src/dede/co_get_corule.php
  51. +32
    -49
      src/dede/co_getsource_url_action.php
  52. +8
    -7
      src/dede/co_main.php
  53. +5
    -4
      src/dede/co_test_rule.php
  54. +17
    -22
      src/dede/co_url.php
  55. +13
    -16
      src/dede/co_view.php
  56. +65
    -78
      src/dede/config.php
  57. +10
    -11
      src/dede/content_att.php
  58. +5
    -4
      src/dede/content_batch_up.php
  59. +67
    -96
      src/dede/content_batchup_action.php
  60. +3
    -2
      src/dede/content_i_list.php
  61. +61
    -96
      src/dede/content_list.php
  62. +4
    -3
      src/dede/content_s_list.php
  63. +3
    -2
      src/dede/content_select_list.php
  64. +31
    -45
      src/dede/content_sg_list.php
  65. +14
    -23
      src/dede/content_tj.php
  66. +22
    -25
      src/dede/dialog/config.php
  67. +105
    -105
      src/dede/dialog/select_images.php
  68. +43
    -56
      src/dede/dialog/select_images_post.php
  69. +1
    -1
      src/dede/dialog/select_media.php
  70. +1
    -1
      src/dede/dialog/select_media_post.php
  71. +1
    -1
      src/dede/dialog/select_soft.php
  72. +1
    -1
      src/dede/dialog/select_soft_post.php
  73. +114
    -114
      src/dede/dialog/select_templets.php
  74. +19
    -26
      src/dede/dialog/select_templets_post.php
  75. +23
    -36
      src/dede/diy_add.php
  76. +18
    -23
      src/dede/diy_edit.php
  77. +32
    -44
      src/dede/diy_field_add.php
  78. +39
    -57
      src/dede/diy_field_edit.php
  79. +65
    -115
      src/dede/diy_list.php
  80. +8
    -7
      src/dede/diy_main.php
  81. +26
    -35
      src/dede/erraddsave.php
  82. +7
    -9
      src/dede/exit.php
  83. +16
    -17
      src/dede/feedback_edit.php
  84. +4
    -3
      src/dede/feedback_main.php
  85. +2
    -2
      src/dede/file_class.php
  86. +38
    -59
      src/dede/file_manage_control.php
  87. +10
    -12
      src/dede/file_manage_main.php
  88. +55
    -67
      src/dede/file_manage_view.php
  89. +23
    -27
      src/dede/freelist_add.php
  90. +25
    -28
      src/dede/freelist_edit.php
  91. +1
    -3
      src/dede/freelist_main.php
  92. +23
    -32
      src/dede/friendlink_add.php
  93. +36
    -47
      src/dede/friendlink_edit.php
  94. +14
    -13
      src/dede/friendlink_main.php
  95. +13
    -19
      src/dede/friendlink_type.php
  96. +0
    -19
      src/dede/getdedesysmsg.php
  97. +49
    -64
      src/dede/imagecut.php
  98. +292
    -291
      src/dede/inc/inc_action_info.php
  99. +141
    -231
      src/dede/inc/inc_archives_all.php
  100. +1
    -1
      src/dede/inc/inc_archives_functions.php

+ 1
- 3
src/data/admin/allowurl.txt View File

@@ -1,4 +1,2 @@
www.dedebiz.com
www.zhelixie.com
www.dedecms.com
bbs.dedecms.com
www.zhelixie.com

+ 2
- 1
src/data/admin/config_update.php View File

@@ -1,7 +1,8 @@
<?php
/**
* @version $Id: config_update.php 1 11:36 2011-2-21 tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


+ 6
- 5
src/dede/action_search.php View File

@@ -1,20 +1,21 @@
<?php
/**
* 检索操作
*
* @version $Id: action_search.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/actionsearch_class.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(dirname(__FILE__) . "/actionsearch_class.php");
//增加权限检查
if(empty($dopost)) $dopost = "";
if (empty($dopost)) $dopost = "";
$keyword=empty($keyword)? "" : RemoveXss($keyword);
$keyword = empty($keyword) ? "" : RemoveXss($keyword);
$actsearch = new ActionSearch($keyword);
$asresult = $actsearch->Search();
include DedeInclude('templets/action_search.htm');

+ 32
- 34
src/dede/actionsearch_class.php View File

@@ -1,12 +1,13 @@
<?php
/**
* @version $Id: actionsearch_class.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
class ActionSearch
class ActionSearch
{
var $keyword;
var $asarray = array();
@@ -17,43 +18,41 @@ class ActionSearch
$this->asarray = $this->GetSearchstr();
$this->keyword = $keyword;
}
//初始化系统
function ActionSearch($keyword){
function ActionSearch($keyword)
{
$this->__construct($keyword);
}
function GetSearchstr()
{
require_once(dirname(__FILE__)."/inc/inc_action_info.php");
return is_array($actionSearch)? $actionSearch : array();
require_once(dirname(__FILE__) . "/inc/inc_action_info.php");
return is_array($actionSearch) ? $actionSearch : array();
}
function search(){
function search()
{
$this->searchkeyword();
return $this->result;
}
/**
* 遍历功能配置项进行关键词匹配
*
* @return void
*/
function searchkeyword(){
function searchkeyword()
{
$i = 0; //数组序列索引
foreach ($this->asarray as $key=>$value)
{
foreach ($this->asarray as $key => $value) {
//对二级项目进行匹配
if(is_array($this->asarray[$key]['soniterm']))
{
foreach ($this->asarray[$key]['soniterm'] as $k=> $val)
{
if (is_array($this->asarray[$key]['soniterm'])) {
foreach ($this->asarray[$key]['soniterm'] as $k => $val) {
//进行权限判断
if(TestPurview($val['purview']))
{
if (TestPurview($val['purview'])) {
//如果有操作权限
if($this->_strpos($val['title'], $this->keyword) !== false || $this->_strpos($val['description'], $this->keyword)!== false)
{
if ($this->_strpos($val['title'], $this->keyword) !== false || $this->_strpos($val['description'], $this->keyword) !== false) {
//一级项目匹配
$this->result[$i]['toptitle'] = $this->redColorKeyword($this->asarray[$key]['toptitle']);
$this->result[$i]['title'] = $this->redColorKeyword($this->asarray[$key]['title']);
@@ -75,25 +74,24 @@ class ActionSearch
* @param string $text 关键词
* @return string
*/
function redColorKeyword($text){
if(is_array($text))
{
function redColorKeyword($text)
{
if (is_array($text)) {
foreach ($text as $key => $value) {
if($key == 'title' || $key == 'description')
{
if ($key == 'title' || $key == 'description') {
//仅对title,description进行数组替换
$text[$key] = str_replace($this->keyword,'<font color="red">'.$this->keyword.'</font>',$text[$key]);
}
$text[$key] = str_replace($this->keyword, '<font color="red">' . $this->keyword . '</font>', $text[$key]);
}
}
} else {
$text = str_replace($this->keyword,'<font color="red">'.$this->keyword.'</font>',$text);
$text = str_replace($this->keyword, '<font color="red">' . $this->keyword . '</font>', $text);
}
return $text;
}
function _strpos($string,$find)
function _strpos($string, $find)
{
if (function_exists('stripos')) return stripos($string,$find);
return strpos($string,$find);
if (function_exists('stripos')) return stripos($string, $find);
return strpos($string, $find);
}
}
}

+ 27
- 48
src/dede/ad_add.php View File

@@ -1,78 +1,58 @@
<?php

/**
* 广告添加
*
* @version $Id: ad_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require(dirname(__FILE__)."/config.php");
require(dirname(__FILE__) . "/config.php");
CheckPurview('plus_广告管理');
require_once DEDEINC."/typelink.class.php";
if(empty($dopost)) $dopost = "";
require_once DEDEINC . "/typelink.class.php";
if (empty($dopost)) $dopost = "";

if($dopost=="save")
{
if ($dopost == "save") {
CheckCSRF();
//timeset tagname typeid normbody expbody
$tagname = trim($tagname);
$row = $dsql->GetOne("SELECT typeid FROM #@__myad WHERE typeid='$typeid' AND tagname LIKE '$tagname'");
if(is_array($row))
{
ShowMsg("在相同栏目下已经存在同名的标记!","-1");
if (is_array($row)) {
ShowMsg("在相同栏目下已经存在同名的标记!", "-1");
exit();
}
$starttime = GetMkTime($starttime);
$endtime = GetMkTime($endtime);
$link = addslashes($normbody['link']);
if($normbody['style']=='code')
{
if ($normbody['style'] == 'code') {
$normbody = addslashes($normbody['htmlcode']);
}
else if($normbody['style']=='txt')
{
} else if ($normbody['style'] == 'txt') {

$normbody = "<a href=\"{$link}\" font-size=\"{$normbody['size']}\" color=\"{$normbody['color']}\">{$normbody['title']}</a>";
}
else if($normbody['style']=='img')
{
if(empty($normbody['width']))
{
} else if ($normbody['style'] == 'img') {
if (empty($normbody['width'])) {
$width = "";
}
else
{
} else {
$width = " width=\"{$normbody['width']}\"";
}
if (empty($normbody['height']))
{
if (empty($normbody['height'])) {
$height = "";
}
else
{
} else {
$height = "height=\"{$normbody['height']}\"";
}
$normbody = "<a href=\"{$link}\"><img src=\"{$normbody['url']}\"$width $height border=\"0\" /></a>";
}
else
{
if(empty($normbody['width']))
{
} else {
if (empty($normbody['width'])) {
$width = "";
}
else
{
} else {
$width = " width=\"{$normbody['width']}\"";
}
if (empty($normbody['height']))
{
if (empty($normbody['height'])) {
$height = "";
}
else
{
} else {
$height = "height=\"{$normbody['height']}\"";
}
$normbody = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.Macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"$width $height><param name=\"movie\" value=\"{$link}\"/><param name=\"quality\" value=\"high\"/></object>";
@@ -82,17 +62,16 @@ if($dopost=="save")
VALUES('$clsid','$typeid','$tagname','$adname','$timeset','$starttime','$endtime','$normbody','$expbody');
";
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功增加一个广告!","ad_main.php");
ShowMsg("成功增加一个广告!", "ad_main.php");
exit();
}
$dsql->Execute('dd','SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$option = '';
while($arr = $dsql->GetArray('dd'))
{
while ($arr = $dsql->GetArray('dd')) {
$option .= "<option value='{$arr['id']}'>{$arr['typename']}</option>\n\r";
}
$startDay = time();
$endDay = AddDay($startDay,30);
$endDay = AddDay($startDay, 30);
$startDay = GetDateTimeMk($startDay);
$endDay = GetDateTimeMk($endDay);
include DedeInclude('templets/ad_add.htm');
include DedeInclude('templets/ad_add.htm');

+ 21
- 29
src/dede/ad_edit.php View File

@@ -1,35 +1,33 @@
<?php

/**
* 广告编辑
*
* @version $Id: ad_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require(dirname(__FILE__)."/config.php");
require(dirname(__FILE__) . "/config.php");
CheckPurview('plus_广告管理');
require_once(DEDEINC.'/typelink.class.php');
if(empty($dopost)) $dopost = '';
require_once(DEDEINC . '/typelink.class.php');
if (empty($dopost)) $dopost = '';
$aid = preg_replace("#[^0-9]#", '', $aid);
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "ad_main.php" : $_COOKIE['ENV_GOBACK_URL'];

if($dopost=='delete')
{
if ($dopost == 'delete') {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__myad` WHERE aid='$aid' ");
ShowMsg("成功删除一则广告代码!",$ENV_GOBACK_URL);
ShowMsg("成功删除一则广告代码!", $ENV_GOBACK_URL);
exit();
}
else if($dopost=="gettag")
{
require_once(DEDEINC.'/oxwindow.class.php');
} else if ($dopost == "gettag") {
require_once(DEDEINC . '/oxwindow.class.php');
$jscode = "<script src='{$cfg_phpurl}/ad_js.php?aid=$aid' language='javascript'></script>";
$showhtml = "<xmp style='color:#333333;background-color:#ffffff'>\r\n\r\n$jscode\r\n\r\n</xmp>";
$showhtml .= "预览:<iframe name='testfrm' frameborder='0' src='ad_edit.php?aid={$aid}&dopost=testjs' id='testfrm' width='100%' height='200'></iframe>";
$row = $dsql->GetOne("SELECT tagname from `#@__myad` WHERE aid='$aid' ");
$showtag = '{'."dede:myad name='{$row['tagname']}'/".'}';
$showtag = '{' . "dede:myad name='{$row['tagname']}'/" . '}';
$info = "<b>说明:</b>如果嵌入的是织梦CMS广告标签,那么将会解析成标签中的内容到页面,广告更改后需要重新生成。<br />
如果不希望重新生成所有页面,则直接调用JS代码即可。
";
@@ -37,22 +35,18 @@ else if($dopost=="gettag")
$wecome_info = "<a href='ad_main.php'><u>广告管理</u></a>::获取JS";
$win = new OxWindow();
$win->Init();
$winform = $win->GetWindow("hand",$info);
$winform = $win->GetWindow("hand", $info);
$win->AddTitle("织梦CMS标签调用代码:");
$winform = $win->GetWindow("hand",$showtag);
$winform = $win->GetWindow("hand", $showtag);
$win->myWinItem = '';
$win->AddTitle("以下为选定广告的JS调用代码:");
$winform = $win->GetWindow("hand",$showhtml);
$winform = $win->GetWindow("hand", $showhtml);
$win->Display();
exit();
}
else if($dopost=='testjs')
{
} else if ($dopost == 'testjs') {
echo "<script src='{$cfg_phpurl}/ad_js.php?aid=$aid&nocache=1' language='javascript'></script>";
exit();
}
else if($dopost=='saveedit')
{
} else if ($dopost == 'saveedit') {
CheckCSRF();
$starttime = GetMkTime($starttime);
$endtime = GetMkTime($endtime);
@@ -69,20 +63,18 @@ else if($dopost=='saveedit')
WHERE aid='$aid'
";
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功更改一则广告代码!",$ENV_GOBACK_URL);
ShowMsg("成功更改一则广告代码!", $ENV_GOBACK_URL);
exit();
}

$row = $dsql->GetOne("SELECT * FROM `#@__myad` WHERE aid='$aid'");
$dsql->Execute('dd','SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$option = '';
while($arr = $dsql->GetArray('dd'))
{
if ($arr['id'] == $row['clsid'])
{
while ($arr = $dsql->GetArray('dd')) {
if ($arr['id'] == $row['clsid']) {
$option .= "<option value='{$arr['id']}' selected='selected'>{$arr['typename']}</option>\n\r";
} else {
$option .= "<option value='{$arr['id']}'>{$arr['typename']}</option>\n\r";
}
}
include DedeInclude('templets/ad_edit.htm');
include DedeInclude('templets/ad_edit.htm');

+ 21
- 28
src/dede/ad_main.php View File

@@ -1,35 +1,34 @@
<?php
/**
* 广告管理
*
* @version $Id: ad_main.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/datalistcp.class.php');
require_once(DEDEINC.'/common.func.php');
setcookie('ENV_GOBACK_URL',$dedeNowurl,time()+3600,'/');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/datalistcp.class.php');
require_once(DEDEINC . '/common.func.php');
setcookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/');
$clsid = isset($clsid)? intval($clsid) : 0;
$keyword = isset($keyword)? addslashes($keyword) : '';
$clsid = isset($clsid) ? intval($clsid) : 0;
$keyword = isset($keyword) ? addslashes($keyword) : '';
$dsql->Execute('dd','SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$option = '';
while($arr = $dsql->GetArray('dd'))
{
if ($arr['id'] == $clsid)
{
while ($arr = $dsql->GetArray('dd')) {
if ($arr['id'] == $clsid) {
$option .= "<option value='{$arr['id']}' selected='selected'>{$arr['typename']}</option>\n\r";
} else {
$option .= "<option value='{$arr['id']}'>{$arr['typename']}</option>\n\r";
}
}
$where_sql = ' 1=1';
if($clsid!=0) $where_sql .= " AND clsid = $clsid";
if($keyword!='') $where_sql .= " AND (ad.adname like '%$keyword%') ";
if ($clsid != 0) $where_sql .= " AND clsid = $clsid";
if ($keyword != '') $where_sql .= " AND (ad.adname like '%$keyword%') ";
$sql = "SELECT ad.aid,ad.clsid,ad.tagname,tp.typename as typename,ad.adname,ad.timeset,ad.endtime,ap.typename as clsname
FROM `#@__myad` ad
@@ -38,30 +37,24 @@ LEFT JOIN `#@__myadtype` ap on ap.id=ad.clsid
WHERE $where_sql
ORDER BY ad.aid desc";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/ad_main.htm");
$dlist->SetTemplet(DEDEADMIN . "/templets/ad_main.htm");
$dlist->SetSource($sql);
$dlist->display();
function TestType($tname, $type="")
function TestType($tname, $type = "")
{
if($tname=="")
{
return ($type == 1)? "默认分类" : "所有栏目";
}
else
{
if ($tname == "") {
return ($type == 1) ? "默认分类" : "所有栏目";
} else {
return $tname;
}
}
function TimeSetValue($ts)
{
if($ts==0)
{
if ($ts == 0) {
return "不限时间";
}
else
{
} else {
return "限时标记";
}
}
}

+ 13
- 19
src/dede/adtype_main.php View File

@@ -1,43 +1,37 @@
<?php
/**
* 友情链接类型
*
* @version $Id: friendlink_type.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if(empty($dopost)) $dopost = '';
require_once(dirname(__FILE__) . "/config.php");
if (empty($dopost)) $dopost = '';
//保存更改
if($dopost=="save")
{
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for(;$startID<=$endID;$startID++)
{
for (; $startID <= $endID; $startID++) {
$query = '';
$tid = ${'ID_'.$startID};
$pname = ${'pname_'.$startID};
if(isset(${'check_'.$startID}))
{
if($pname!='')
{
$tid = ${'ID_' . $startID};
$pname = ${'pname_' . $startID};
if (isset(${'check_' . $startID})) {
if ($pname != '') {
$query = "UPDATE `#@__myadtypee` SET typename='$pname' WHERE id='$tid' ";
$dsql->ExecuteNoneQuery($query);
}
}
else
{
} else {
$query = "DELETE FROM `#@__myadtype` WHERE id='$tid' ";
$dsql->ExecuteNoneQuery($query);
}
}
//增加新记录
if(isset($check_new) && $pname_new!='')
{
if (isset($check_new) && $pname_new != '') {
$query = "INSERT INTO `#@__myadtype`(typename) VALUES('{$pname_new}');";
$dsql->ExecuteNoneQuery($query);
}
@@ -46,4 +40,4 @@ if($dopost=="save")
exit;
}
include DedeInclude('templets/adtype_main.htm');
include DedeInclude('templets/adtype_main.htm');

+ 159
- 199
src/dede/album_add.php View File

@@ -1,43 +1,40 @@
<?php
/**
* 图集发布
*
* @version $Id: album_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('a_New,a_AccNew');
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
require_once(DEDEINC . "/customfields.func.php");
require_once(DEDEADMIN . "/inc/inc_archives_functions.php");
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if($dopost != 'save')
{
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
if ($dopost != 'save') {
require_once(DEDEINC . "/dedetag.class.php");
require_once(DEDEADMIN . "/inc/inc_catalog_options.php");
ClearMyAddon();
$channelid = empty($channelid) ? 0 : intval($channelid);
$cid = empty($cid) ? 0 : intval($cid);
//获得频道模型ID
if($cid>0 && $channelid==0)
{
if ($cid > 0 && $channelid == 0) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
}
else
{
if($channelid==0) $channelid = 2;
} else {
if ($channelid == 0) $channelid = 2;
}
//获得频道模型信息
$cInfos = $dsql->GetOne(" SELECT * FROM `#@__channeltype` WHERE id='$channelid' ");
$channelid = $cInfos['id'];
//获取文章最大id以确定当前权重
$maxWright = $dsql->GetOne("SELECT COUNT(*) AS cc FROM #@__archives");
include DedeInclude("templets/album_add.htm");
@@ -45,122 +42,112 @@ if($dopost != 'save')
}
/*--------------------------------
function __save(){ }
-------------------------------*/
else if($dopost=='save')
{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
$flag = isset($flags) ? join(',',$flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1: 0;
if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click);
if(!isset($typeid2)) $typeid2 = 0;
if(!isset($autokey)) $autokey = 0;
if(!isset($remote)) $remote = 0;
if(!isset($dellink)) $dellink = 0;
if(!isset($autolitpic)) $autolitpic = 0;
if(!isset($formhtml)) $formhtml = 0;
if(!isset($formzip)) $formzip = 0;
if(!isset($ddisfirst)) $ddisfirst = 0;
if(!isset($albums)) $albums = "";
if(!isset($delzip)) $delzip = 0;
if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click);
if($typeid==0)
{
-------------------------------*/ else if ($dopost == 'save') {
require_once(DEDEINC . '/image.func.php');
require_once(DEDEINC . '/oxwindow.class.php');
$flag = isset($flags) ? join(',', $flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click);
if (!isset($typeid2)) $typeid2 = 0;
if (!isset($autokey)) $autokey = 0;
if (!isset($remote)) $remote = 0;
if (!isset($dellink)) $dellink = 0;
if (!isset($autolitpic)) $autolitpic = 0;
if (!isset($formhtml)) $formhtml = 0;
if (!isset($formzip)) $formzip = 0;
if (!isset($ddisfirst)) $ddisfirst = 0;
if (!isset($albums)) $albums = "";
if (!isset($delzip)) $delzip = 0;
if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click);
if ($typeid == 0) {
ShowMsg("请指定文档的栏目!", "-1");
exit();
}
if(empty($channelid))
{
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1");
exit();
}
if(!CheckChannel($typeid,$channelid) )
{
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1");
exit();
}
if(!TestPurview('a_New'))
{
CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的权限!");
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的权限!");
}
//对保存的内容进行处理
if(empty($writer))$writer=$cuserLogin->getUserName();
if(empty($source))$source='未知';
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$sortrank = AddDay($pubdate,$sortup);
$ismake = $ishtml==0 ? -1 : 0;
$sortrank = AddDay($pubdate, $sortup);
$ismake = $ishtml == 0 ? -1 : 0;
$title = preg_replace("#\"#", '"', $title);
$title = cn_substrR($title,$cfg_title_maxlen);
$shorttitle = cn_substrR($shorttitle,36);
$color = cn_substrR($color,7);
$writer = cn_substrR($writer,20);
$source = cn_substrR($source,30);
$description = cn_substrR($description,$cfg_auot_description);
$keywords = cn_substrR($keywords,60);
$filename = trim(cn_substrR($filename,40));
$title = cn_substrR($title, $cfg_title_maxlen);
$shorttitle = cn_substrR($shorttitle, 36);
$color = cn_substrR($color, 7);
$writer = cn_substrR($writer, 20);
$source = cn_substrR($source, 30);
$description = cn_substrR($description, $cfg_auot_description);
$keywords = cn_substrR($keywords, 60);
$filename = trim(cn_substrR($filename, 40));
$userip = GetIP();
$isremote = 0;
$serviterm=empty($serviterm)? "" : $serviterm;
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
{
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) {
$arcrank = -1;
}
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if(empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none',$picname,$ddisremote);
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
//使用第一张图作为缩略图
if($ddisfirst==1 && $litpic=='')
{
if(isset($imgurl1))
{
if ($ddisfirst == 1 && $litpic == '') {
if (isset($imgurl1)) {
$litpic = GetDDImage('ddfirst', $imgurl1, $isrm);
}
}
//生成文档ID
$arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$adminid);
if(empty($arcID))
{
ShowMsg("无法获得主键,因此无法进行后续操作!","-1");
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作!", "-1");
exit();
}
@@ -171,12 +158,10 @@ else if($dopost=='save')
/*---------------------
function _getformhtml()
------------------*/
if($formhtml==1)
{
if ($formhtml == 1) {
$imagebody = stripslashes($imagebody);
$imgurls .= GetCurContentAlbum($imagebody,$copysource,$litpicname);
if($ddisfirst==1 && $litpic=='' && !empty($litpicname))
{
$imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
if ($ddisfirst == 1 && $litpic == '' && !empty($litpicname)) {
$litpic = $litpicname;
$hasone = TRUE;
}
@@ -185,64 +170,56 @@ else if($dopost=='save')
function _getformzip()
处理从ZIP中解压的图片
---------------------*/
if($formzip==1)
{
include_once(DEDEINC."/zip.class.php");
include_once(DEDEADMIN."/file_class.php");
$zipfile = $cfg_basedir.str_replace($cfg_mainsite,'',$zipfile);
$tmpzipdir = DEDEDATA.'/ziptmp/'.cn_substr(md5(ExecTime()),16);
if ($formzip == 1) {
include_once(DEDEINC . "/zip.class.php");
include_once(DEDEADMIN . "/file_class.php");
$zipfile = $cfg_basedir . str_replace($cfg_mainsite, '', $zipfile);
$tmpzipdir = DEDEDATA . '/ziptmp/' . cn_substr(md5(ExecTime()), 16);
$ntime = time();
if(file_exists($zipfile))
{
@mkdir($tmpzipdir,$GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir,$GLOBALS['cfg_dir_purview']);
if (file_exists($zipfile)) {
@mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile,$tmpzipdir);
$z->ExtractAll($zipfile, $tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir,"jpg|png|gif",$imgs);
$fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
$i = 0;
foreach($imgs as $imgold)
{
foreach ($imgs as $imgold) {
$i++;
$savepath = $cfg_image_dir."/".MyDate("Y-m",$ntime);
$savepath = $cfg_image_dir . "/" . MyDate("Y-m", $ntime);
CreateDir($savepath);
$iurl = $savepath."/".MyDate("d",$ntime).dd2char(MyDate("His",$ntime).'-'.$adminid."-{$i}".mt_rand(1000,9999));
$iurl = $iurl.substr($imgold,-4,4);
$imgfile = $cfg_basedir.$iurl;
copy($imgold,$imgfile);
$iurl = $savepath . "/" . MyDate("d", $ntime) . dd2char(MyDate("His", $ntime) . '-' . $adminid . "-{$i}" . mt_rand(1000, 9999));
$iurl = $iurl . substr($imgold, -4, 4);
$imgfile = $cfg_basedir . $iurl;
copy($imgold, $imgfile);
unlink($imgold);
if(is_file($imgfile))
{
$litpicname = $pagestyle > 2 ? GetImageMapDD($iurl,$cfg_ddimg_width) : $iurl;
if (is_file($imgfile)) {
$litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl;
//指定了提取第一张为缩略图的情况强制使用第一张缩略图
if($i=='1')
{
if(!$hasone && $ddisfirst==1 && $litpic=='' && empty($litpicname))
{
$litpicname = GetImageMapDD($iurl,$cfg_ddimg_width);
if ($i == '1') {
if (!$hasone && $ddisfirst == 1 && $litpic == '' && empty($litpicname)) {
$litpicname = GetImageMapDD($iurl, $cfg_ddimg_width);
}
}
$info = '';
$imginfos = GetImageSize($imgfile,$info);
$imgurls .= "{dede:img ddimg='$litpicname' text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
$imginfos = GetImageSize($imgfile, $info);
$imgurls .= "{dede:img ddimg='$litpicname' text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n";
//把图片信息保存到媒体文档管理档案中
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('{$title}','{$iurl}','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".$ntime."','$adminid');
VALUES ('{$title}','{$iurl}','1','" . $imginfos[0] . "','" . $imginfos[1] . "','0','" . filesize($imgfile) . "','" . $ntime . "','$adminid');
";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $iurl);
WaterImg($imgfile, 'up');
if(!$hasone && $ddisfirst==1 && $litpic=='')
{
if(empty($litpicname))
{
if (!$hasone && $ddisfirst == 1 && $litpic == '') {
if (empty($litpicname)) {
$litpicname = $iurl;
$litpicname = GetImageMapDD($iurl, $cfg_ddimg_width);
}
@@ -251,140 +228,123 @@ else if($dopost=='save')
}
}
}
if($delzip==1) unlink($zipfile);
if ($delzip == 1) unlink($zipfile);
$fm->RmDirFiles($tmpzipdir);
}
}
if ($albums !== "") {
$albumsArr = json_decode(stripslashes( $albums), true);
$albumsArr = json_decode(stripslashes($albums), true);
for ($i=0; $i <= count($albumsArr) - 1; $i++) {
for ($i = 0; $i <= count($albumsArr) - 1; $i++) {
$album = $albumsArr[$i];
$data = explode( ',', $album['img'] );
$data = explode(',', $album['img']);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
$info = '';
$imginfos = GetImageSize($cfg_basedir.$fullUrl, $info);
$imginfos = GetImageSize($cfg_basedir . $fullUrl, $info);
$v = $fullUrl;
$imginfo = !empty($album['txt']) ? $album['txt'] : '';
$imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $v {/dede:img}\r\n";
$imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $v {/dede:img}\r\n";
}
}
$imgurls = addslashes($imgurls);
//处理body字段自动摘要、自动提取缩略图等
$body = AnalyseHtmlBody($body,$description,$litpic,$keywords,'htmltext');
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if(!empty($dede_addonfields))
{
$addonfields = explode(';',$dede_addonfields);
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if(is_array($addonfields))
{
foreach($addonfields as $v)
{
if($v=='')
{
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$vs = explode(',',$v);
if(!isset(${$vs[0]}))
{
$vs = explode(',', $v);
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
else if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
}
else
} else if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理
{
if(!isset(${$vs[0]}))
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
} else {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$arcID);
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
$inadd_f .= ',' . $vs[0];
$inadd_v .= " ,'" . ${$vs[0]} . "' ";
}
}
}
//处理图片文档的自定义属性
if($litpic!='' && !preg_match("#p#", $flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag . ',p');
}
if($redirecturl!='' && !preg_match("#j#", $flag))
{
$flag = ($flag=='' ? 'j' : $flag.',j');
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag . ',j');
}
//跳转网址的文档强制为动态
if(preg_match("#j#", $flag)) $ismake = -1;
if (preg_match("#j#", $flag)) $ismake = -1;
//加入主档案表
$query = "INSERT INTO `#@__archives`(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,
color,writer,source,litpic,pubdate,senddate,mid,notpost,description,keywords,filename,dutyadmin,weight)
VALUES ('$arcID','$typeid','$typeid2','$sortrank','$flag','$ismake','$channelid','$arcrank','$click','$money','$title','$shorttitle',
'$color','$writer','$source','$litpic','$pubdate','$senddate','$adminid','$notpost','$description','$keywords','$filename','$adminid','$weight'); ";
if(!$dsql->ExecuteNoneQuery($query))
{
if (!$dsql->ExecuteNoneQuery($query)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery(" DELETE FROM `#@__arctiny` WHERE id='$arcID' ");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;");
exit();
}
//加入附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if(empty($addtable))
{
if (empty($addtable)) {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。","javascript:;");
ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。", "javascript:;");
exit();
}
$useip = GetIP();
$query = "INSERT INTO `$addtable`(aid,typeid,redirecturl,userip,pagestyle,maxwidth,imgurls,`row`,col,isrm,ddmaxwidth,pagepicnum,body{$inadd_f})
Values('$arcID','$typeid','$redirecturl','$useip','$pagestyle','$maxwidth','$imgurls','$row','$col','$isrm','$ddmaxwidth','$pagepicnum','$body'{$inadd_v}); ";
if(!$dsql->ExecuteNoneQuery($query))
{
if (!$dsql->ExecuteNoneQuery($query)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;");
exit();
}
//生成HTML
InsertTags($tags,$arcID);
if($cfg_remote_site=='Y' && $isremote=="1")
{
if($serviterm!=""){
list($servurl,$servuser,$servpwd) = explode(',',$serviterm);
$config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE');
}else{
$config=array();
InsertTags($tags, $arcID);
if ($cfg_remote_site == 'Y' && $isremote == "1") {
if ($serviterm != "") {
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE');
} else {
$config = array();
}
if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
if (!$ftp->connect($config)) exit('Error:None FTP Connection!');
}
$artUrl = MakeArt($arcID, TRUE, TRUE, $isremote);
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
if ($artUrl == '') {
$artUrl = $cfg_phpurl . "/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
@@ -394,7 +354,7 @@ else if($dopost=='save')
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
MakeArt($id, true, true, $isremote);
}
}
}
@@ -405,7 +365,7 @@ else if($dopost=='save')
  请选择你的后续操作:
<a href='album_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>继续发布图片</a>
&nbsp;&nbsp;
<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-secondary btn-sm'>更改图集</a>
<a href='archives_do.php?aid=" . $arcID . "&dopost=editArchives' class='btn btn-secondary btn-sm'>更改图集</a>
&nbsp;&nbsp;
<a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>预览文档</a>
&nbsp;&nbsp;
@@ -413,13 +373,13 @@ else if($dopost=='save')
&nbsp;&nbsp;
$backurl
";
$msg = "<div style=\"line-height:36px;height:36px\">{$msg}</div>".GetUpdateTest();
$msg = "<div style=\"line-height:36px;height:36px\">{$msg}</div>" . GetUpdateTest();
$wintitle = "成功发布一个图集!";
$wecome_info = "文章管理::发布图集";
$win = new OxWindow();
$win->AddTitle("成功发布一个图集:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand","&nbsp;",FALSE);
$winform = $win->GetWindow("hand", "&nbsp;", FALSE);
$win->Display();
}
}

+ 165
- 205
src/dede/album_edit.php View File

@@ -1,24 +1,24 @@
<?php
/**
* 图集编辑
*
* @version $Id: album_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('a_Edit,a_AccEdit,a_MyEdit');
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
require_once(DEDEINC . "/customfields.func.php");
require_once(DEDEADMIN . "/inc/inc_archives_functions.php");
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if($dopost!='save')
{
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
if ($dopost != 'save') {
require_once(DEDEADMIN . "/inc/inc_catalog_options.php");
require_once(DEDEINC . "/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
@@ -28,16 +28,14 @@ if($dopost!='save')
LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel
LEFT JOIN `#@__arcrank` ar ON ar.rank=arc.arcrank WHERE arc.id='$aid' ";
$arcRow = $dsql->GetOne($arcQuery);
if(!is_array($arcRow))
{
ShowMsg("读取档案基本信息出错!","-1");
if (!is_array($arcRow)) {
ShowMsg("读取档案基本信息出错!", "-1");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$query = "SELECT * FROM `#@__channeltype` WHERE id='" . $arcRow['channel'] . "'";
$cInfos = $dsql->GetOne($query);
if(!is_array($cInfos))
{
ShowMsg("读取频道配置信息出错!","javascript:;");
if (!is_array($cInfos)) {
ShowMsg("读取频道配置信息出错!", "javascript:;");
exit();
}
$addtable = $cInfos['addtable'];
@@ -53,116 +51,104 @@ if($dopost!='save')
$ddmaxwidth = $addRow["ddmaxwidth"];
$pagepicnum = $addRow["pagepicnum"];
$tags = GetTags($aid);
$arcRow=XSSClean($arcRow);$addRow=XSSClean($addRow);
$arcRow = XSSClean($arcRow);
$addRow = XSSClean($addRow);
include DedeInclude("templets/album_edit.htm");
exit();
}
/*--------------------------------
function __save(){ }
-------------------------------*/
else if($dopost=='save')
{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
-------------------------------*/ else if ($dopost == 'save') {
require_once(DEDEINC . '/image.func.php');
require_once(DEDEINC . '/oxwindow.class.php');
$flag = isset($flags) ? join(',', $flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1: 0;
if(empty($typeid2)) $typeid2 = 0;
if(!isset($autokey)) $autokey = 0;
if(!isset($remote)) $remote = 0;
if(!isset($dellink)) $dellink = 0;
if(!isset($autolitpic)) $autolitpic = 0;
if(!isset($formhtml)) $formhtml = 0;
if(!isset($albums)) $albums = "";
if(!isset($formzip)) $formzip = 0;
if(!isset($ddisfirst)) $ddisfirst = 0;
if(!isset($delzip)) $delzip = 0;
$notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
if (empty($typeid2)) $typeid2 = 0;
if (!isset($autokey)) $autokey = 0;
if (!isset($remote)) $remote = 0;
if (!isset($dellink)) $dellink = 0;
if (!isset($autolitpic)) $autolitpic = 0;
if (!isset($formhtml)) $formhtml = 0;
if (!isset($albums)) $albums = "";
if (!isset($formzip)) $formzip = 0;
if (!isset($ddisfirst)) $ddisfirst = 0;
if (!isset($delzip)) $delzip = 0;
if($typeid==0)
{
ShowMsg("请指定文档的栏目!","-1");
if ($typeid == 0) {
ShowMsg("请指定文档的栏目!", "-1");
exit();
}
if(empty($channelid))
{
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1");
exit();
}
if(!CheckChannel($typeid,$channelid))
{
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1");
exit();
}
if(!TestPurview('a_Edit'))
{
if(TestPurview('a_AccEdit'))
{
CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的文档权限!");
}
else
{
CheckArcAdmin($id,$cuserLogin->getUserID());
if (!TestPurview('a_Edit')) {
if (TestPurview('a_AccEdit')) {
CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!");
} else {
CheckArcAdmin($id, $cuserLogin->getUserID());
}
}
//对保存的内容进行处理
$pubdate = GetMkTime($pubdate);
$sortrank = AddDay($pubdate,$sortup);
$ismake = $ishtml==0 ? -1 : 0;
$title = cn_substrR($title,$cfg_title_maxlen);
$shorttitle = cn_substrR($shorttitle,36);
$color = cn_substrR($color,7);
$writer = cn_substrR($writer,20);
$source = cn_substrR($source,30);
$description = cn_substrR($description,250);
$keywords = trim(cn_substrR($keywords,60));
$filename = trim(cn_substrR($filename,40));
$sortrank = AddDay($pubdate, $sortup);
$ismake = $ishtml == 0 ? -1 : 0;
$title = cn_substrR($title, $cfg_title_maxlen);
$shorttitle = cn_substrR($shorttitle, 36);
$color = cn_substrR($color, 7);
$writer = cn_substrR($writer, 20);
$source = cn_substrR($source, 30);
$description = cn_substrR($description, 250);
$keywords = trim(cn_substrR($keywords, 60));
$filename = trim(cn_substrR($filename, 40));
$isremote = 0;
$serviterm=empty($serviterm)? "" : $serviterm;
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
{
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) {
$arcrank = -1;
}
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if(empty($ddisremote))
{
if (empty($ddisremote)) {
$ddisremote = 0;
}
$litpic = GetDDImage('none', $picname, $ddisremote);
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
//分析body里的内容
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//处理图片文档的自定义属性
if($litpic!='' && !preg_match("#p#", $flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag . ',p');
}
if($redirecturl!='' && !preg_match("#j#", $flag))
{
$flag = ($flag=='' ? 'j' : $flag.',j');
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag . ',j');
}
//跳转网址的文档强制为动态
if(preg_match("#j#", $flag)) $ismake = -1;
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$query = "
UPDATE `#@__archives` SET
@@ -188,9 +174,8 @@ else if($dopost=='save')
dutyadmin='$adminid'
WHERE id='$id'; ";
if(!$dsql->ExecuteNoneQuery($query))
{
ShowMsg("更新数据库archives表时出错,请检查!".$dsql->GetError(),"javascript:;");
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg("更新数据库archives表时出错,请检查!" . $dsql->GetError(), "javascript:;");
exit();
}
@@ -200,67 +185,57 @@ else if($dopost=='save')
//----------------------------------------
//检查旧的图片是否有更新,并保存
//-----------------------------------------
for($i=1; $i<=120; $i++)
{
if( !isset(${'imgurl'.$i}) ) continue;
for ($i = 1; $i <= 120; $i++) {
if (!isset(${'imgurl' . $i})) continue;
$info = '';
$iinfo = str_replace("'", "`", stripslashes(${'imgmsg'.$i}));
$iurl = stripslashes(${'imgurl'.$i});
$ddurl = stripslashes(${'imgddurl'.$i});
if(preg_match("#swfupload#i", $ddurl)) $ddurl = '';
$imgfile = $cfg_basedir.$iurl;
$litimgfile = $cfg_basedir.$ddurl;
$iinfo = str_replace("'", "`", stripslashes(${'imgmsg' . $i}));
$iurl = stripslashes(${'imgurl' . $i});
$ddurl = stripslashes(${'imgddurl' . $i});
if (preg_match("#swfupload#i", $ddurl)) $ddurl = '';
$imgfile = $cfg_basedir . $iurl;
$litimgfile = $cfg_basedir . $ddurl;
//有上传文件的情况
if( isset(${'imgfile'.$i}) && is_uploaded_file(${'imgfile'.$i}) )
{
$tmpFile = ${'imgfile'.$i};
if (isset(${'imgfile' . $i}) && is_uploaded_file(${'imgfile' . $i})) {
$tmpFile = ${'imgfile' . $i};
//检测上传的图片, 如果类型不对,保留原来图片
$imginfos = @GetImageSize($tmpFile, $info);
if(!is_array($imginfos))
{
if (!is_array($imginfos)) {
$imginfos = @GetImageSize($imgfile, $info);
$imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
$imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n";
continue;
}
move_uploaded_file($tmpFile, $imgfile);
$imginfos = @GetImageSize($imgfile, $info);
if($ddurl==$iurl)
{
if ($ddurl == $iurl) {
$litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl;
$litimgfile = $cfg_basedir.$litpicname;
}
else
{
if($cfg_ddimg_full=='Y') ImageResizeNew($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile);
$litimgfile = $cfg_basedir . $litpicname;
} else {
if ($cfg_ddimg_full == 'Y') ImageResizeNew($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile);
else ImageResize($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile);
$litpicname = $ddurl;
}
$imgurls .= "{dede:img ddimg='$litpicname' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
$imgurls .= "{dede:img ddimg='$litpicname' text='$iinfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n";
}
//没上传图片(只修改msg信息)
else
{
$iinfo = str_replace("'", "`", stripslashes(${'imgmsg'.$i}));
$iurl = stripslashes(${'imgurl'.$i});
$ddurl = stripslashes(${'imgddurl'.$i});
if(preg_match("#swfupload#i", $ddurl))
{
else {
$iinfo = str_replace("'", "`", stripslashes(${'imgmsg' . $i}));
$iurl = stripslashes(${'imgurl' . $i});
$ddurl = stripslashes(${'imgddurl' . $i});
if (preg_match("#swfupload#i", $ddurl)) {
$ddurl = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl;
}
$imginfos = @GetImageSize($imgfile, $info);
$imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
$imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n";
}
}
//----------------------------
//从HTML中获取新图片
//----------------------------
if($formhtml==1 && !empty($imagebody))
{
if ($formhtml == 1 && !empty($imagebody)) {
$imagebody = stripslashes($imagebody);
$imgurls .= GetCurContentAlbum($imagebody,$copysource,$litpicname);
if($ddisfirst==1 && $litpic=="" && !empty($litpicname))
{
$imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
if ($ddisfirst == 1 && $litpic == "" && !empty($litpicname)) {
$litpic = $litpicname;
$hasone = true;
}
@@ -269,60 +244,55 @@ else if($dopost=='save')
function _getformzip()
从ZIP文件中获取新图片
---------------------*/
if($formzip==1)
{
include_once(DEDEINC."/zip.class.php");
include_once(DEDEADMIN."/file_class.php");
$zipfile = $cfg_basedir.str_replace($cfg_mainsite,'',$zipfile);
$tmpzipdir = DEDEDATA.'/ziptmp/'.cn_substr(md5(ExecTime()),16);
if ($formzip == 1) {
include_once(DEDEINC . "/zip.class.php");
include_once(DEDEADMIN . "/file_class.php");
$zipfile = $cfg_basedir . str_replace($cfg_mainsite, '', $zipfile);
$tmpzipdir = DEDEDATA . '/ziptmp/' . cn_substr(md5(ExecTime()), 16);
$ntime = time();
if(file_exists($zipfile))
{
if (file_exists($zipfile)) {
@mkdir($tmpzipdir,$GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir,$GLOBALS['cfg_dir_purview']);
@mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile,$tmpzipdir);
$z->ExtractAll($zipfile, $tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir,"jpg|png|gif",$imgs);
$fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
$i = 0;
foreach($imgs as $imgold)
{
foreach ($imgs as $imgold) {
$i++;
$savepath = $cfg_image_dir."/".MyDate("Y-m",$ntime);
$savepath = $cfg_image_dir . "/" . MyDate("Y-m", $ntime);
CreateDir($savepath);
$iurl = $savepath."/".MyDate("d",$ntime).dd2char(MyDate("His",$ntime).'-'.$adminid."-{$i}".mt_rand(1000,9999));
$iurl = $iurl.substr($imgold,-4,4);
$imgfile = $cfg_basedir.$iurl;
copy($imgold,$imgfile);
$iurl = $savepath . "/" . MyDate("d", $ntime) . dd2char(MyDate("His", $ntime) . '-' . $adminid . "-{$i}" . mt_rand(1000, 9999));
$iurl = $iurl . substr($imgold, -4, 4);
$imgfile = $cfg_basedir . $iurl;
copy($imgold, $imgfile);
unlink($imgold);
if(is_file($imgfile))
{
$litpicname = $pagestyle > 2 ? GetImageMapDD($iurl,$cfg_ddimg_width) : $iurl;
if (is_file($imgfile)) {
$litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl;
$info = '';
$imginfos = GetImageSize($imgfile,$info);
$imgurls .= "{dede:img ddimg='$litpicname' text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
$imginfos = GetImageSize($imgfile, $info);
$imgurls .= "{dede:img ddimg='$litpicname' text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n";
//把图片信息保存到媒体文档管理档案中
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('{$title}','{$iurl}','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".$ntime."','$adminid');
VALUES ('{$title}','{$iurl}','1','" . $imginfos[0] . "','" . $imginfos[1] . "','0','" . filesize($imgfile) . "','" . $ntime . "','$adminid');
";
$dsql->ExecuteNoneQuery($inquery);
if(!$hasone && $ddisfirst==1
&& $litpic=="" && !empty($litpicname))
{
if( file_exists($cfg_basedir.$litpicname) )
{
if (
!$hasone && $ddisfirst == 1
&& $litpic == "" && !empty($litpicname)
) {
if (file_exists($cfg_basedir . $litpicname)) {
$litpic = $litpicname;
$hasone = true;
}
}
}
}
if($delzip==1)
{
if ($delzip == 1) {
unlink($zipfile);
}
$fm->RmDirFiles($tmpzipdir);
@@ -330,59 +300,53 @@ else if($dopost=='save')
}
if ($albums !== "") {
$albumsArr = json_decode(stripslashes( $albums), true);
$albumsArr = json_decode(stripslashes($albums), true);
// var_dump($albumsArr);exit;
for ($i=0; $i <= count($albumsArr) - 1; $i++) {
for ($i = 0; $i <= count($albumsArr) - 1; $i++) {
$album = $albumsArr[$i];
$data = explode( ',', $album['img'] );
$data = explode(',', $album['img']);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
$info = '';
$imginfos = GetImageSize($cfg_basedir.$fullUrl, $info);
$imginfos = GetImageSize($cfg_basedir . $fullUrl, $info);
$v = $fullUrl;
$imginfo = !empty($album['txt']) ? $album['txt'] : '';
$imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $v {/dede:img}\r\n";
$imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $v {/dede:img}\r\n";
}
}
$imgurls = addslashes($imgurls);
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if(!empty($dede_addonfields))
{
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if(is_array($addonfields))
{
foreach($addonfields as $v)
{
if($v=='')
{
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$vs = explode(',',$v);
if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
}else{
if(!isset(${$vs[0]}))
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
} else {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id);
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
$inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'";
}
}
}
@@ -390,8 +354,7 @@ else if($dopost=='save')
//更新附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if($addtable!='')
{
if ($addtable != '') {
$useip = GetIP();
$query = "Update `$addtable`
set typeid='$typeid',
@@ -407,39 +370,36 @@ else if($dopost=='save')
redirecturl='$redirecturl',
userip = '$useip'
WHERE aid='$id'; ";
if(!$dsql->ExecuteNoneQuery($query))
{
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!".$dsql->GetError(),"javascript:;");
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!" . $dsql->GetError(), "javascript:;");
exit();
}
}
//生成HTML
UpIndexKey($id,$arcrank,$typeid,$sortrank,$tags);
if($cfg_remote_site=='Y' && $isremote=="1")
{
if($serviterm!=""){
list($servurl,$servuser,$servpwd) = explode(',',$serviterm);
$config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE');
}else{
$config=array();
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
if ($cfg_remote_site == 'Y' && $isremote == "1") {
if ($serviterm != "") {
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE');
} else {
$config = array();
}
if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
if (!$ftp->connect($config)) exit('Error:None FTP Connection!');
}
$arcUrl = MakeArt($id,true,true,$isremote);
if($arcUrl=='')
{
$arcUrl = $cfg_phpurl."/view.php?aid=$id";
$arcUrl = MakeArt($id, true, true, $isremote);
if ($arcUrl == '') {
$arcUrl = $cfg_phpurl . "/view.php?aid=$id";
}
ClearMyAddon($id, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
MakeArt($id, true, true, $isremote);
}
}
}
@@ -447,10 +407,10 @@ else if($dopost=='save')
//返回成功信息
$msg =
"   请选择你的后续操作:
"   请选择你的后续操作:
<a href='album_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>继续发布图片</a>
&nbsp;&nbsp;
<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
<a href='archives_do.php?aid=" . $id . "&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
&nbsp;&nbsp;
<a href='$arcUrl' target='_blank' class='btn btn-secondary btn-sm'>预览文档</a>
&nbsp;&nbsp;
@@ -464,6 +424,6 @@ else if($dopost=='save')
$win = new OxWindow();
$win->AddTitle("成功更改一个图集:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand","&nbsp;",false);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}
}

+ 4
- 3
src/dede/album_testhtml.php View File

@@ -1,15 +1,16 @@
<?php
/**
* 图集测试
*
* @version $Id: album_testhtml.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
AjaxHead();
$myhtml = UnicodeUrl2Gbk(stripslashes($myhtml));
echo "<div class='coolbg61'>[<a href='#' onclick='javascript:HideObj(\"_myhtml\")'>关闭</a>]</div>\r\n";
@@ -18,4 +19,4 @@ $img_array = array_unique($img_array[2]);
echo "<div class='coolbg62'><xmp>";
echo "捕获的图片:\r\n";
print_r($img_array);
echo "</xmp></div>\r\n";
echo "</xmp></div>\r\n";

+ 93
- 118
src/dede/archives_add.php View File

@@ -1,38 +1,34 @@
<?php
/**
* 文档发布
*
* @version $Id: archives_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(dirname(__FILE__) . '/config.php');
CheckPurview('a_New,a_AccNew');
require_once(DEDEINC.'/customfields.func.php');
require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
require_once(DEDEINC . '/customfields.func.php');
require_once(DEDEADMIN . '/inc/inc_archives_functions.php');
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if($dopost != 'save')
{
require_once(DEDEINC.'/dedetag.class.php');
require_once(DEDEADMIN.'/inc/inc_catalog_options.php');
if ($dopost != 'save') {
require_once(DEDEINC . '/dedetag.class.php');
require_once(DEDEADMIN . '/inc/inc_catalog_options.php');
ClearMyAddon();
$channelid = empty($channelid) ? 0 : intval($channelid);
$cid = empty($cid) ? 0 : intval($cid);
//获得频道模型ID
if($cid > 0 && $channelid == 0)
{
if ($cid > 0 && $channelid == 0) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
}
else
{
if($channelid==0)
{
} else {
if ($channelid == 0) {
ShowMsg('无法识别模型信息,因此无法操作!', '-1');
exit();
}
@@ -48,188 +44,167 @@ if($dopost != 'save')
}
/*--------------------------------
function __save(){ }
-------------------------------*/
else if($dopost=='save')
{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
$flag = isset($flags) ? join(',',$flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1: 0;
if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click);
if(empty($litpic_b64)) $litpic_b64 = '';
if(empty($typeid2)) $typeid2 = 0;
if(!isset($autokey)) $autokey = 0;
if(!isset($remote)) $remote = 0;
if(!isset($dellink)) $dellink = 0;
if(!isset($autolitpic)) $autolitpic = 0;
if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click);
if($typeid==0)
{
-------------------------------*/ else if ($dopost == 'save') {
require_once(DEDEINC . '/image.func.php');
require_once(DEDEINC . '/oxwindow.class.php');
$flag = isset($flags) ? join(',', $flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click);
if (empty($litpic_b64)) $litpic_b64 = '';
if (empty($typeid2)) $typeid2 = 0;
if (!isset($autokey)) $autokey = 0;
if (!isset($remote)) $remote = 0;
if (!isset($dellink)) $dellink = 0;
if (!isset($autolitpic)) $autolitpic = 0;
if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click);
if ($typeid == 0) {
ShowMsg('请指定文档的栏目!', '-1');
exit();
}
if(empty($channelid))
{
if (empty($channelid)) {
ShowMsg('文档为非指定的类型,请检查你发布内容的表单是否合法!', '-1');
exit();
}
if(!CheckChannel($typeid,$channelid) )
{
if (!CheckChannel($typeid, $channelid)) {
ShowMsg('你所选择的栏目与当前模型不相符,请选择白色的选项!', '-1');
exit();
}
if(!TestPurview('a_New'))
{
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的权限!");
}
//对保存的内容进行处理
if(empty($writer)) $writer = $cuserLogin->getUserName();
if(empty($source)) $source = '未知';
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$sortrank = AddDay($pubdate,$sortup);
$sortrank = AddDay($pubdate, $sortup);
$ismake = $ishtml == 0 ? -1 : 0;
$title = preg_replace("#\"#", '"', $title);
$title = cn_substrR($title,$cfg_title_maxlen);
$shorttitle = cn_substrR($shorttitle,36);
$color = cn_substrR($color,7);
$writer = cn_substrR($writer,20);
$source = cn_substrR($source,30);
$description = cn_substrR($description,$cfg_auot_description);
$keywords = cn_substrR($keywords,60);
$filename = trim(cn_substrR($filename,40));
$title = cn_substrR($title, $cfg_title_maxlen);
$shorttitle = cn_substrR($shorttitle, 36);
$color = cn_substrR($color, 7);
$writer = cn_substrR($writer, 20);
$source = cn_substrR($source, 30);
$description = cn_substrR($description, $cfg_auot_description);
$keywords = cn_substrR($keywords, 60);
$filename = trim(cn_substrR($filename, 40));
$userip = GetIP();
$isremote = 0;
$voteid = (empty($voteid)? 0 : $voteid);
$serviterm=empty($serviterm)? "" : $serviterm;
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
{
$voteid = (empty($voteid) ? 0 : $voteid);
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) {
$arcrank = -1;
}
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if(empty($ddisremote))
{
if (empty($ddisremote)) {
$ddisremote = 0;
}
$litpic = GetDDImage('none',$picname,$ddisremote);
$litpic = GetDDImage('none', $picname, $ddisremote);
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$adminid);
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if(empty($arcID))
{
ShowMsg("无法获得主键,因此无法进行后续操作!","-1");
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作!", "-1");
exit();
}
//分析处理附加表数据
$inadd_f = $inadd_v = '';
if(!empty($dede_addonfields))
{
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
if(is_array($addonfields))
{
foreach($addonfields as $v)
{
if($v=='') continue;
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') continue;
$vs = explode(',', $v);
if($vs[1]=='htmltext' || $vs[1]=='textdata')
{
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
}
else
{
if(!isset(${$vs[0]})) ${$vs[0]} = '';
} else {
if (!isset(${$vs[0]})) ${$vs[0]} = '';
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
$inadd_f .= ',' . $vs[0];
$inadd_v .= " ,'" . ${$vs[0]} . "' ";
}
}
}
//处理图片文档的自定义属性
if($litpic!='' && !preg_match("#p#", $flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag . ',p');
}
if($redirecturl!='' && !preg_match("#j#", $flag))
{
$flag = ($flag=='' ? 'j' : $flag.',j');
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag . ',j');
}
//跳转网址的文档强制为动态
if(preg_match("#j#", $flag)) $ismake = -1;
if (preg_match("#j#", $flag)) $ismake = -1;
//保存到主表
$query = "INSERT INTO `#@__archives`(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,
color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywords,filename,dutyadmin,weight)
VALUES ('$arcID','$typeid','$typeid2','$sortrank','$flag','$ismake','$channelid','$arcrank','$click','$money','$title','$shorttitle',
'$color','$writer','$source','$litpic','$pubdate','$senddate','$adminid','$voteid','$notpost','$description','$keywords','$filename','$adminid','$weight');";
if(!$dsql->ExecuteNoneQuery($query))
{
if (!$dsql->ExecuteNoneQuery($query)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;");
exit();
}
//保存到附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if(!empty($addtable))
{
if (!empty($addtable)) {
$useip = GetIP();
$query = "INSERT INTO `{$addtable}`(aid,typeid,redirecturl,userip{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$useip'{$inadd_v})";
if(!$dsql->ExecuteNoneQuery($query))
{
if (!$dsql->ExecuteNoneQuery($query)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;");
exit();
}
}
//生成HTML
InsertTags($tags, $arcID);
if($cfg_remote_site=='Y' && $isremote=="1")
{
if($serviterm!="")
{
list($servurl,$servuser,$servpwd) = explode(',',$serviterm);
$config=array( 'hostname' => $servurl, 'username' => $servuser,
'password' => $servpwd,'debug' => 'TRUE');
if ($cfg_remote_site == 'Y' && $isremote == "1") {
if ($serviterm != "") {
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config = array(
'hostname' => $servurl, 'username' => $servuser,
'password' => $servpwd, 'debug' => 'TRUE'
);
} else {
$config=array();
$config = array();
}
if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
if (!$ftp->connect($config)) exit('Error:None FTP Connection!');
}
$artUrl = MakeArt($arcID, true, true,$isremote);
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
$artUrl = MakeArt($arcID, true, true, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl . "/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
@@ -239,7 +214,7 @@ color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywo
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
MakeArt($id, true, true, $isremote);
}
}
}
@@ -251,13 +226,13 @@ color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywo
&nbsp;&nbsp;
<a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看文档</a>
&nbsp;&nbsp;
<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-secondary btn-sm'>更改文档</a>
<a href='archives_do.php?aid=" . $arcID . "&dopost=editArchives' class='btn btn-secondary btn-sm'>更改文档</a>
&nbsp;&nbsp;
<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-secondary btn-sm'>已发布文档管理</a>
&nbsp;&nbsp;
$backurl
";
$msg = "<div style=\"line-height:36px;height:36px\">{$msg}</div>".GetUpdateTest();
$msg = "<div style=\"line-height:36px;height:36px\">{$msg}</div>" . GetUpdateTest();
$wintitle = '成功发布文档!';
$wecome_info = '文档管理::发布文档';
@@ -266,4 +241,4 @@ color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywo
$win->AddMsgItem($msg);
$winform = $win->GetWindow('hand', '&nbsp;', false);
$win->Display();
}
}

+ 402
- 520
src/dede/archives_do.php
File diff suppressed because it is too large
View File


+ 84
- 109
src/dede/archives_edit.php View File

@@ -1,24 +1,24 @@
<?php
/**
* 文档编辑
*
* @version $Id: archives_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('a_Edit,a_AccEdit,a_MyEdit');
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
require_once(DEDEINC . "/customfields.func.php");
require_once(DEDEADMIN . "/inc/inc_archives_functions.php");
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if($dopost!='save')
{
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
if ($dopost != 'save') {
require_once(DEDEADMIN . "/inc/inc_catalog_options.php");
require_once(DEDEINC . "/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
@@ -30,17 +30,15 @@ if($dopost!='save')
";
$arcRow = $dsql->GetOne($arcQuery);
if(!is_array($arcRow))
{
ShowMsg("读取档案基本信息出错!","-1");
if (!is_array($arcRow)) {
ShowMsg("读取档案基本信息出错!", "-1");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$query = "SELECT * FROM `#@__channeltype` WHERE id='" . $arcRow['channel'] . "'";
$cInfos = $dsql->GetOne($query);
if(!is_array($cInfos))
{
ShowMsg("读取频道配置信息出错!","javascript:;");
if (!is_array($cInfos)) {
ShowMsg("读取频道配置信息出错!", "javascript:;");
exit();
}
$addtable = $cInfos['addtable'];
@@ -52,53 +50,44 @@ if($dopost!='save')
}
/*--------------------------------
function __save(){ }
-------------------------------*/
else if($dopost=='save')
{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
$flag = isset($flags) ? join(',',$flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1: 0;
if(empty($litpic_b64)) $litpic_b64 = '';
if(empty($typeid2)) $typeid2 = 0;
if(!isset($autokey)) $autokey = 0;
if(!isset($remote)) $remote = 0;
if(!isset($dellink)) $dellink = 0;
if(!isset($autolitpic)) $autolitpic = 0;
if(!isset($writer)) $writer = '';
if($typeid==0)
{
ShowMsg("请指定文档的栏目!","-1");
-------------------------------*/ else if ($dopost == 'save') {
require_once(DEDEINC . '/image.func.php');
require_once(DEDEINC . '/oxwindow.class.php');
$flag = isset($flags) ? join(',', $flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
if (empty($litpic_b64)) $litpic_b64 = '';
if (empty($typeid2)) $typeid2 = 0;
if (!isset($autokey)) $autokey = 0;
if (!isset($remote)) $remote = 0;
if (!isset($dellink)) $dellink = 0;
if (!isset($autolitpic)) $autolitpic = 0;
if (!isset($writer)) $writer = '';
if ($typeid == 0) {
ShowMsg("请指定文档的栏目!", "-1");
exit();
}
if(empty($channelid))
{
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1");
exit();
}
if(!CheckChannel($typeid,$channelid))
{
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1");
exit();
}
if(!TestPurview('a_Edit'))
{
if(TestPurview('a_AccEdit'))
{
CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的文档权限!");
}
else
{
CheckArcAdmin($id,$cuserLogin->getUserID());
if (!TestPurview('a_Edit')) {
if (TestPurview('a_AccEdit')) {
CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!");
} else {
CheckArcAdmin($id, $cuserLogin->getUserID());
}
}
//对保存的内容进行处理
$pubdate = GetMkTime($pubdate);
$sortrank = AddDay($pubdate, $sortup);
$ismake = $ishtml==0 ? -1 : 0;
$ismake = $ishtml == 0 ? -1 : 0;
$title = cn_substrR($title, $cfg_title_maxlen);
$shorttitle = cn_substrR($shorttitle, 36);
$color = cn_substrR($color, 7);
@@ -108,77 +97,69 @@ else if($dopost=='save')
$keywords = trim(cn_substrR($keywords, 60));
$filename = trim(cn_substrR($filename, 40));
$isremote = 0;
$serviterm=empty($serviterm)? "" : $serviterm;
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if(empty($ddisremote)) $ddisremote = 0;
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if(!empty($dede_addonfields))
{
$addonfields = explode(';',$dede_addonfields);
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if(is_array($addonfields))
{
foreach($addonfields as $v)
{
if($v=='')
{
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$vs = explode(',',$v);
if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
}else
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理
{
if(!isset(${$vs[0]}))
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
} else {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id);
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
$inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'";
}
}
}
//处理图片文档的自定义属性
if($litpic!='' && !preg_match("#p#", $flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag . ',p');
}
if($redirecturl!='' && !preg_match("#j#", $flag))
{
$flag = ($flag=='' ? 'j' : $flag.',j');
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag . ',j');
}
//跳转网址的文档强制为动态
if(preg_match("#j#", $flag)) $ismake = -1;
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$inQuery = "UPDATE `#@__archives` SET
typeid='$typeid',
@@ -203,52 +184,46 @@ else if($dopost=='save')
dutyadmin='$adminid',
weight='$weight'
WHERE id='$id'; ";
if(!$dsql->ExecuteNoneQuery($inQuery))
{
ShowMsg("更新数据库archives表时出错,请检查!","-1");
if (!$dsql->ExecuteNoneQuery($inQuery)) {
ShowMsg("更新数据库archives表时出错,请检查!", "-1");
exit();
}
$cts = $dsql->GetOne("SELECT addtable From `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if($addtable!='')
{
if ($addtable != '') {
$useip = GetIP();
$iquery = "UPDATE `$addtable` SET typeid='$typeid'{$inadd_f},redirecturl='$redirecturl',userip='$useip' WHERE aid='$id' ";
if(!$dsql->ExecuteNoneQuery($iquery))
{
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;");
if (!$dsql->ExecuteNoneQuery($iquery)) {
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!", "javascript:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
if($cfg_remote_site=='Y' && $isremote=="1")
{
if($serviterm!="")
{
if ($cfg_remote_site == 'Y' && $isremote == "1") {
if ($serviterm != "") {
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE');
$config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE');
} else {
$config=array();
$config = array();
}
if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
if (!$ftp->connect($config)) exit('Error:None FTP Connection!');
}
$artUrl = MakeArt($id, TRUE, TRUE, $isremote);
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$id";
if ($artUrl == '') {
$artUrl = $cfg_phpurl . "/view.php?aid=$id";
}
ClearMyAddon($id, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
MakeArt($id, true, true, $isremote);
}
}
}
@@ -259,7 +234,7 @@ else if($dopost=='save')
  请选择你的后续操作:
<a href='archives_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>发布新文档</a>
&nbsp;&nbsp;
<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
<a href='archives_do.php?aid=" . $id . "&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
&nbsp;&nbsp;
<a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看文档</a>
&nbsp;&nbsp;
@@ -273,6 +248,6 @@ else if($dopost=='save')
$win = new OxWindow();
$win->AddTitle("成功更改文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand","&nbsp;",false);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}
}

+ 70
- 94
src/dede/archives_sg_add.php View File

@@ -1,39 +1,35 @@
<?php
/**
* 单表模型文档发布
*
* @version $Id: archives_sg_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('a_New,a_AccNew');
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
require_once(DEDEINC . "/customfields.func.php");
require_once(DEDEADMIN . "/inc/inc_archives_functions.php");
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if($dopost!='save')
{
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
if ($dopost != 'save') {
require_once(DEDEINC . "/dedetag.class.php");
require_once(DEDEADMIN . "/inc/inc_catalog_options.php");
ClearMyAddon();
$channelid = empty($channelid) ? 0 : intval($channelid);
$cid = empty($cid) ? 0 : intval($cid);
//获得频道模型ID
if($cid > 0 && $channelid == 0)
{
if ($cid > 0 && $channelid == 0) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
}
else
{
if($channelid==0)
{
ShowMsg("无法识别模型信息,因此无法操作!","-1");
} else {
if ($channelid == 0) {
ShowMsg("无法识别模型信息,因此无法操作!", "-1");
exit();
}
}
@@ -46,146 +42,126 @@ if($dopost!='save')
}
/*--------------------------------
function __save(){ }
-------------------------------*/
else if($dopost=='save')
{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
if($typeid==0)
{
ShowMsg("请指定文档的栏目!","-1");
-------------------------------*/ else if ($dopost == 'save') {
require_once(DEDEINC . '/image.func.php');
require_once(DEDEINC . '/oxwindow.class.php');
if ($typeid == 0) {
ShowMsg("请指定文档的栏目!", "-1");
exit();
}
if(empty($channelid))
{
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1");
exit();
}
if(!CheckChannel($typeid,$channelid) )
{
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1");
exit();
}
if(!TestPurview('a_New'))
{
CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的权限!");
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的权限!");
}
//对保存的内容进行处理
if(empty($writer))$writer=$cuserLogin->getUserName();
if(empty($source))$source='未知';
if(empty($flags)) $flag = '';
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
if (empty($flags)) $flag = '';
else $flag = join(',', $flags);
$senddate = time();
if(empty($litpic_b64)) $litpic_b64 = '';
$title = cn_substrR($title,$cfg_title_maxlen);
if (empty($litpic_b64)) $litpic_b64 = '';
$title = cn_substrR($title, $cfg_title_maxlen);
$isremote = 0;
$serviterm=empty($serviterm)? "" : $serviterm;
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$adminid = $cuserLogin->getUserID();
$userip = GetIP();
if(empty($ddisremote)) $ddisremote = 0;
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $senddate, $channelid, $senddate, $adminid);
if(empty($arcID))
{
ShowMsg("无法获得主键,因此无法进行后续操作!","-1");
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作!", "-1");
exit();
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if(!empty($dede_addonfields))
{
$addonfields = explode(';',$dede_addonfields);
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if(is_array($addonfields))
{
foreach($addonfields as $v)
{
if($v=='')
{
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$vs = explode(',',$v);
if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
}
else
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理
{
if(!isset(${$vs[0]}))
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
} else {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$arcID);
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
$inadd_f .= ',' . $vs[0];
$inadd_v .= " ,'" . ${$vs[0]} . "' ";
}
}
}
//处理图片文档的自定义属性
if($litpic!='' && !preg_match("#p#", $flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag . ',p');
}
//保存到附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if(!empty($addtable))
{
if (!empty($addtable)) {
$query = "INSERT INTO `{$addtable}`(aid,typeid,channel,arcrank,mid,click,title,senddate,flag,litpic,userip{$inadd_f})
VALUES('$arcID','$typeid','$channelid','$arcrank','$adminid','0','$title','$senddate','$flag','$litpic','$userip'{$inadd_v})";
if(!$dsql->ExecuteNoneQuery($query))
{
if (!$dsql->ExecuteNoneQuery($query)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;");
exit();
}
}
//生成HTML
if($cfg_remote_site=='Y' && $isremote=="1")
{
if($serviterm!="")
{
if ($cfg_remote_site == 'Y' && $isremote == "1") {
if ($serviterm != "") {
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE');
$config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE');
} else {
$config=array();
$config = array();
}
if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
if (!$ftp->connect($config)) exit('Error:None FTP Connection!');
}
$artUrl = MakeArt($arcID, TRUE, TRUE, $isremote);
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
if ($artUrl == '') {
$artUrl = $cfg_phpurl . "/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
//返回成功信息
@@ -195,7 +171,7 @@ else if($dopost=='save')
&nbsp;&nbsp;
<a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看文档</a>
&nbsp;&nbsp;
<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-secondary btn-sm'>更改文档</a>
<a href='archives_do.php?aid=" . $arcID . "&dopost=editArchives' class='btn btn-secondary btn-sm'>更改文档</a>
&nbsp;&nbsp;
<a href='content_sg_list.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-secondary btn-sm'>已发布文档管理</a>
&nbsp;&nbsp;
@@ -207,6 +183,6 @@ else if($dopost=='save')
$win = new OxWindow();
$win->AddTitle("成功发布文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand","&nbsp;",false);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}
}

+ 65
- 84
src/dede/archives_sg_edit.php View File

@@ -1,24 +1,24 @@
<?php
/**
* 单表模型文档编辑
*
* @version $Id: archives_sg_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('a_Edit,a_AccEdit,a_MyEdit');
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
require_once(DEDEINC . "/customfields.func.php");
require_once(DEDEADMIN . "/inc/inc_archives_functions.php");
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if($dopost!='save')
{
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
if ($dopost != 'save') {
require_once(DEDEADMIN . "/inc/inc_catalog_options.php");
require_once(DEDEINC . "/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
@@ -27,9 +27,8 @@ if($dopost!='save')
LEFT JOIN `#@__channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
$cInfos = $dsql->GetOne($arcQuery);
if(!is_array($cInfos))
{
ShowMsg("读频道模型信息出错!","-1");
if (!is_array($cInfos)) {
ShowMsg("读频道模型信息出错!", "-1");
exit();
}
@@ -42,134 +41,116 @@ if($dopost!='save')
}
/*--------------------------------
function __save(){ }
-------------------------------*/
else if($dopost=='save')
{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
if($typeid==0)
{
ShowMsg("请指定文档的栏目!","-1");
-------------------------------*/ else if ($dopost == 'save') {
require_once(DEDEINC . '/image.func.php');
require_once(DEDEINC . '/oxwindow.class.php');
if ($typeid == 0) {
ShowMsg("请指定文档的栏目!", "-1");
exit();
}
if(empty($channelid))
{
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1");
exit();
}
if(!CheckChannel($typeid,$channelid))
{
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1");
exit();
}
if(!TestPurview('a_Edit'))
{
if(TestPurview('a_AccEdit'))
{
if (!TestPurview('a_Edit')) {
if (TestPurview('a_AccEdit')) {
CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!");
}
else
{
CheckArcAdmin($id,$cuserLogin->getUserID());
} else {
CheckArcAdmin($id, $cuserLogin->getUserID());
}
}
//对保存的内容进行处理
if(empty($flags)) $flag = '';
if (empty($flags)) $flag = '';
else $flag = join(',', $flags);
$title = cn_substrR($title, $cfg_title_maxlen);
$isremote = 0;
$serviterm=empty($serviterm)? "" : $serviterm;
if(empty($litpic_b64)) $litpic_b64 = '';
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$serviterm = empty($serviterm) ? "" : $serviterm;
if (empty($litpic_b64)) $litpic_b64 = '';
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if(empty($ddisremote)) $ddisremote = 0;
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if(!empty($dede_addonfields))
{
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if(is_array($addonfields))
{
foreach($addonfields as $v)
{
if($v=='')
{
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$vs = explode(',',$v);
if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
}else
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理
{
if(!isset(${$vs[0]}))
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
} else {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id);
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
$inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'";
}
}
}
//处理图片文档的自定义属性
if($litpic!='' && !preg_match("#p#", $flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag . ',p');
}
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if($addtable!='')
{
if ($addtable != '') {
$iquery = "UPDATE `$addtable` SET typeid='$typeid',arcrank='$arcrank',title='$title',flag='$flag',litpic='$litpic'{$inadd_f} WHERE aid='$id' ";
if(!$dsql->ExecuteNoneQuery($iquery))
{
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;");
if (!$dsql->ExecuteNoneQuery($iquery)) {
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!", "javascript:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, '');
if($cfg_remote_site=='Y' && $isremote=="1")
{
if($serviterm!="")
{
if ($cfg_remote_site == 'Y' && $isremote == "1") {
if ($serviterm != "") {
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config = array( 'hostname' => $servurl, 'username' => $servuser,
'password' => $servpwd,'debug' => 'TRUE');
$config = array(
'hostname' => $servurl, 'username' => $servuser,
'password' => $servpwd, 'debug' => 'TRUE'
);
} else {
$config = array();
}
if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
if (!$ftp->connect($config)) exit('Error:None FTP Connection!');
}
$artUrl = MakeArt($id, TRUE, TRUE, $isremote);
if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$id";
if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$id";
ClearMyAddon($id, $title);
//返回成功信息
@@ -177,7 +158,7 @@ else if($dopost=='save')
  请选择你的后续操作:
<a href='archives_sg_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>发布新文档</a>
&nbsp;&nbsp;
<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
<a href='archives_do.php?aid=" . $id . "&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
&nbsp;&nbsp;
<a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看文档</a>
&nbsp;&nbsp;
@@ -191,6 +172,6 @@ else if($dopost=='save')
$win = new OxWindow();
$win->AddTitle("成功更改文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand","&nbsp;",false);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}
}

+ 1
- 3
src/dede/article_add.php View File

@@ -3,7 +3,7 @@
* 文档发布
*
* @version $Id: article_add.php 2020年9月14日 tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
@@ -317,5 +317,3 @@ else if($dopost=='save')
$winform = $win->GetWindow("hand","&nbsp;",false);
$win->Display();
}
?>

+ 17
- 18
src/dede/article_allowurl_edit.php View File

@@ -1,44 +1,43 @@
<?php
/**
* 允许的站内链接
*
* @version $Id: article_allowurl_edit.php 1 11:36 2010年10月8日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/oxwindow.class.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/oxwindow.class.php");
CheckPurview('sys_Source');
if(empty($dopost)) $dopost = '';
if(empty($allurls)) $allsource = '';
if (empty($dopost)) $dopost = '';
if (empty($allurls)) $allsource = '';
else $allurls = stripslashes($allurls);
$m_file = DEDEDATA."/admin/allowurl.txt";
$m_file = DEDEDATA . "/admin/allowurl.txt";
//保存
if($dopost=='save')
{
$fp = fopen($m_file,'w');
flock($fp,3);
fwrite($fp,$allurls);
if ($dopost == 'save') {
$fp = fopen($m_file, 'w');
flock($fp, 3);
fwrite($fp, $allurls);
fclose($fp);
echo "<script>alert('Save OK!');</script>";
}
//读出
if(empty($allurls) && filesize($m_file)>0)
{
$fp = fopen($m_file,'r');
$allurls = fread($fp,filesize($m_file));
if (empty($allurls) && filesize($m_file) > 0) {
$fp = fopen($m_file, 'r');
$allurls = fread($fp, filesize($m_file));
fclose($fp);
}
$wintitle = "";
$wecome_info = "允许的超链接";
$win = new OxWindow();
$win->Init('article_allowurl_edit.php','js/blank.js','POST');
$win->AddHidden('dopost','save');
$win->Init('article_allowurl_edit.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'save');
$win->AddTitle("每行保存一个超链接:");
$win->AddMsgItem("<textarea name='allurls' id='allurls' style='width:100%;height:300px'>$allurls</textarea>");
$winform = $win->GetWindow('ok');
$win->Display();
$win->Display();

+ 86
- 96
src/dede/article_coonepage_rule.php View File

@@ -1,123 +1,113 @@
<?php
/**
* 文档规则采集
*
* @version $Id: article_coonepage_rule.php 1 14:12 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/datalistcp.class.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
if(empty($action)) $action = '';
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/datalistcp.class.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
if (empty($action)) $action = '';
/*------
function _AddNote(){ }
-------*/
if($action == 'add')
{
$row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '$url' ");
if(is_array($row))
{
echo "系统已经存在这个网址的条目!";
} else {
$query = " INSERT INTO `#@__co_onepage`(`url`,`title`,`issource`,`lang`,`rule`) Values('$url','$title','$issource','$lang','$rule'); ";
$dsql->ExecuteNonequery($query);
echo $dsql->GetError();
}
if ($action == 'add') {
$row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '$url' ");
if (is_array($row)) {
echo "系统已经存在这个网址的条目!";
} else {
$query = " INSERT INTO `#@__co_onepage`(`url`,`title`,`issource`,`lang`,`rule`) Values('$url','$title','$issource','$lang','$rule'); ";
$dsql->ExecuteNonequery($query);
echo $dsql->GetError();
}
}
/*------
function _DelNote(){ }
-------*/
else if($action == 'del')
{
if(!preg_match("#,#", $ids))
{
$query = "DELETE FROM `#@__co_onepage` WHERE id='$ids' ";
}
else
{
$query = "DELETE FROM `#@__co_onepage` WHERE id IN($ids) ";
}
$dsql->ExecuteNonequery($query);
-------*/ else if ($action == 'del') {
if (!preg_match("#,#", $ids)) {
$query = "DELETE FROM `#@__co_onepage` WHERE id='$ids' ";
} else {
$query = "DELETE FROM `#@__co_onepage` WHERE id IN($ids) ";
}
$dsql->ExecuteNonequery($query);
}
/*------
function _EditNote(){ }
-------*/
else if($action == 'editsave')
{
$query = "UPDATE `#@__co_onepage` SET `url`='$url',`title`='$title',`issource`='$issource',`lang`='$lang',`rule`='$rule' WHERE id='$id' ";
$dsql->ExecuteNonequery($query);
echo $dsql->GetError();
-------*/ else if ($action == 'editsave') {
$query = "UPDATE `#@__co_onepage` SET `url`='$url',`title`='$title',`issource`='$issource',`lang`='$lang',`rule`='$rule' WHERE id='$id' ";
$dsql->ExecuteNonequery($query);
echo $dsql->GetError();
}
/*------
function _EditNoteLoad(){ }
-------*/
else if($action == 'editload')
{
$row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE id='$id' ");
AjaxHead();
-------*/ else if ($action == 'editload') {
$row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE id='$id' ");
AjaxHead();
?>
<form name='addform' action='article_coonepage_rule.php' method='post'>
<input type='hidden' name='id' value='<?php echo $id; ?>' />
<input type='hidden' name='action' value='editsave' />
<table width="430" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="102" height="30">网站名称:</td>
<td width="302"><input name="title" type="text" id="title" style="width:200px" value="<?php echo $row['title']; ?>" /></td>
<td width="26" align="center"><a href="javascript:CloseEditNode()" class="mr-3"><img src="images/close.gif" width="12" height="12" border="0" /></a></td>
</tr>
<tr>
<td height="30">原内容编码:</td>
<td colspan="2">
<label><input type="radio" name="lang" value="utf-8" <?php echo ($row['lang']=='utf-8' ? ' checked="checked" ' : ''); ?> />
UTF-8</label>
<label><input type="radio" name="lang" value="gb2312" <?php echo ($row['lang']=='gb2312' ? ' checked="checked" ' : ''); ?> />
GB2312/GBK</label>
</td>
</tr>
<tr>
<td height="30">用作文章来源:</td>
<td colspan="2">
<label><input type="radio" name="issource" value="0" <?php echo ($row['issource']==0 ? ' checked="checked" ' : ''); ?> />
否</label>
<label><input name="issource" type="radio" value="1" <?php echo ($row['issource']==1 ? ' checked="checked" ' : ''); ?> />
是</label>
</td>
</tr>
<tr>
<td height="30">网站网址:</td>
<td colspan="2">
<input name="url" type="text" id="url" value="<?php echo $row['url']; ?>" style="width:200px" />
</td>
</tr>
<tr>
<td height="30">&nbsp;</td>
<td colspan="2">
使用不带http及任何附加目录的网址<br />
如:news.dedecms.com
</td>
</tr>
<tr>
<td height="30">采集规则:</td>
<td colspan="2">仅针对文章内容,格式:前面HTML{@body}后面HMTL</td>
</tr>
<tr>
<td height="90">&nbsp;</td>
<td colspan="2"><textarea name="rule" style="width:300px;height:80px"><?php echo $row['rule']; ?></textarea></td>
</tr>
<tr>
<td height="32">&nbsp;</td>
<td colspan="2"><button class="btn btn-secondary btn-sm" type="submit" name="Submit" value="">保存规则</button>
<button type="reset" class="btn btn-secondary btn-sm" name="Submit2">重置</button></td>
</tr>
</table>
</form>
<form name='addform' action='article_coonepage_rule.php' method='post'>
<input type='hidden' name='id' value='<?php echo $id; ?>' />
<input type='hidden' name='action' value='editsave' />
<table width="430" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="102" height="30">网站名称:</td>
<td width="302"><input name="title" type="text" id="title" style="width:200px" value="<?php echo $row['title']; ?>" /></td>
<td width="26" align="center"><a href="javascript:CloseEditNode()" class="mr-3"><img src="images/close.gif" width="12" height="12" border="0" /></a></td>
</tr>
<tr>
<td height="30">原内容编码:</td>
<td colspan="2">
<label><input type="radio" name="lang" value="utf-8" <?php echo ($row['lang'] == 'utf-8' ? ' checked="checked" ' : ''); ?> />
UTF-8</label>
<label><input type="radio" name="lang" value="gb2312" <?php echo ($row['lang'] == 'gb2312' ? ' checked="checked" ' : ''); ?> />
GB2312/GBK</label>
</td>
</tr>
<tr>
<td height="30">用作文章来源:</td>
<td colspan="2">
<label><input type="radio" name="issource" value="0" <?php echo ($row['issource'] == 0 ? ' checked="checked" ' : ''); ?> />
否</label>
<label><input name="issource" type="radio" value="1" <?php echo ($row['issource'] == 1 ? ' checked="checked" ' : ''); ?> />
是</label>
</td>
</tr>
<tr>
<td height="30">网站网址:</td>
<td colspan="2">
<input name="url" type="text" id="url" value="<?php echo $row['url']; ?>" style="width:200px" />
</td>
</tr>
<tr>
<td height="30">&nbsp;</td>
<td colspan="2">
使用不带http及任何附加目录的网址<br />
如:news.dedebiz.com
</td>
</tr>
<tr>
<td height="30">采集规则:</td>
<td colspan="2">仅针对文章内容,格式:前面HTML{@body}后面HMTL</td>
</tr>
<tr>
<td height="90">&nbsp;</td>
<td colspan="2"><textarea name="rule" style="width:300px;height:80px"><?php echo $row['rule']; ?></textarea></td>
</tr>
<tr>
<td height="32">&nbsp;</td>
<td colspan="2"><button class="btn btn-secondary btn-sm" type="submit" name="Submit" value="">保存规则</button>
<button type="reset" class="btn btn-secondary btn-sm" name="Submit2">重置</button></td>
</tr>
</table>
</form>
<?php
exit();
exit();
} //loadedit
/*---------------
function _ShowLoad(){ }
@@ -125,6 +115,6 @@ function _ShowLoad(){ }
$sql = "";
$sql = "SELECT id,url,title,lang,issource FROM `#@__co_onepage` ORDER BY id DESC";
$dlist = new DataListCP();
$dlist->SetTemplate(DEDEADMIN."/templets/article_coonepage_rule.htm");
$dlist->SetTemplate(DEDEADMIN . "/templets/article_coonepage_rule.htm");
$dlist->SetSource($sql);
$dlist->Display();

+ 57
- 92
src/dede/article_description_main.php View File

@@ -1,65 +1,56 @@
<?php
/**
* 文档描述管理
*
* @version $Id: article_description_main.php 1 14:12 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
@ob_start();
@set_time_limit(3600);
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('sys_Keyword');
if(empty($dojob)) $dojob = '';
if($dojob=='')
{
if (empty($dojob)) $dojob = '';
if ($dojob == '') {
include DedeInclude("templets/article_description_main.htm");
exit();
}
else
{
if(empty($startdd)) $startdd = 0;
if(empty($pagesize)) $pagesize = 100;
if(empty($totalnum)) $totalnum = 0;
if(empty($sid)) $sid = 0;
if(empty($eid)) $eid = 0;
if(empty($dojob)) $dojob = 'des';
} else {
if (empty($startdd)) $startdd = 0;
if (empty($pagesize)) $pagesize = 100;
if (empty($totalnum)) $totalnum = 0;
if (empty($sid)) $sid = 0;
if (empty($eid)) $eid = 0;
if (empty($dojob)) $dojob = 'des';
$table = preg_replace("#[^0-9a-zA-Z_\#@]#", "", $table);
$field = preg_replace("#[^0-9a-zA-Z_\[\]]#", "", $field);
$channel = intval($channel);
if($dsize>250) $dsize = 250;
if ($dsize > 250) $dsize = 250;
$tjnum = 0;
//获取自动摘要
if($dojob=='des')
{
if(empty($totalnum))
{
if ($dojob == 'des') {
if (empty($totalnum)) {
$addquery = "";
if($sid!=0)
{
if ($sid != 0) {
$addquery .= " AND id>='$sid' ";
}
if($eid!=0)
{
if ($eid != 0) {
$addquery .= " AND id<='$eid' ";
}
$tjQuery = "SELECT COUNT(*) AS dd FROM #@__archives WHERE channel='{$channel}' $addquery";
$row = $dsql->GetOne($tjQuery);
$totalnum = $row['dd'];
}
if($totalnum > 0)
{
if ($totalnum > 0) {
$addquery = "";
if($sid!=0)
{
if ($sid != 0) {
$addquery .= " AND #@__archives.id>='$sid' ";
}
if($eid!=0)
{
if ($eid != 0) {
$addquery .= " AND #@__archives.id<='$eid' ";
}
$fquery = "SELECT #@__archives.id,#@__archives.title,#@__archives.description,{$table}.{$field}
@@ -67,22 +58,18 @@ else
WHERE #@__archives.channel='{$channel}' $addquery LIMIT $startdd,$pagesize ; ";
$dsql->SetQuery($fquery);
$dsql->Execute();
while($row=$dsql->GetArray())
{
while ($row = $dsql->GetArray()) {
$body = $row[$field];
$description = $row['description'];
if(strlen($description)>10 || $description=='-')
{
if (strlen($description) > 10 || $description == '-') {
continue;
}
$bodytext = preg_replace("/#p#|#e#|副标题|分页标题/isU","",Html2Text($body));
if(strlen($bodytext) < $msize)
{
$bodytext = preg_replace("/#p#|#e#|副标题|分页标题/isU", "", Html2Text($body));
if (strlen($bodytext) < $msize) {
continue;
}
$des = trim(addslashes(cn_substr($bodytext,$dsize)));
if(strlen($des)<3)
{
$des = trim(addslashes(cn_substr($bodytext, $dsize)));
if (strlen($des) < 3) {
$des = "-";
}
$dsql->ExecuteNoneQuery("UPDATE #@__archives SET description='{$des}' WHERE id='{$row['id']}';");
@@ -90,11 +77,10 @@ else
//返回进度信息
$startdd = $startdd + $pagesize;
if($totalnum > $startdd)
{
$tjlen = ceil( ($startdd/$totalnum) * 100 );
if ($totalnum > $startdd) {
$tjlen = ceil(($startdd / $totalnum) * 100);
} else {
$tjlen=100;
$tjlen = 100;
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
@@ -102,84 +88,66 @@ else
$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:$dvlen;height:15;background-color:#829D83'></div></div>";
$tjsta .= "<br/>完成处理文档总数的:$tjlen %,继续执行任务...";
$nurl = "article_description_main.php?totalnum=$totalnum&startdd={$startdd}&pagesize=$pagesize&table={$table}&field={$field}&dsize={$dsize}&msize={$msize}&channel={$channel}&dojob={$dojob}";
ShowMsg($tjsta,$nurl,0,500);
ShowMsg($tjsta, $nurl, 0, 500);
exit();
}
else
{
} else {
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
}//获取自动摘要代码结束
} //获取自动摘要代码结束
//更新自动分页
if($dojob=='page')
{
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
if ($dojob == 'page') {
require_once(DEDEADMIN . "/inc/inc_archives_functions.php");
$addquery = "";
if($sid!=0)
{
if ($sid != 0) {
$addquery .= " and aid>='$sid' ";
}
if($eid!=0)
{
if ($eid != 0) {
$addquery .= " and aid<='$eid' ";
}
//统计记录总数
if($totalnum==0)
{
if ($totalnum == 0) {
$sql = "SELECT COUNT(*) AS dd FROM $table WHERE 1 $addquery";
$row = $dsql->GetOne($sql);
$totalnum = $row['dd'];
}
//获取记录,并分析
if($totalnum > $startdd+$pagesize)
{
if ($totalnum > $startdd + $pagesize) {
$limitSql = " LIMIT $startdd,$pagesize";
}
else if(($totalnum-$startdd)>0)
{
$limitSql = " LIMIT $startdd,".($totalnum - $startdd);
}
else
{
} else if (($totalnum - $startdd) > 0) {
$limitSql = " LIMIT $startdd," . ($totalnum - $startdd);
} else {
$limitSql = "";
}
$tjnum = $startdd;
if($limitSql!="")
{
if ($limitSql != "") {
$fquery = "SELECT aid,$field FROM $table WHERE 1 $addquery $limitSql ;";
$dsql->SetQuery($fquery);
$dsql->Execute();
while($row=$dsql->GetArray())
{
while ($row = $dsql->GetArray()) {
$tjnum++;
$body = $row[$field];
$aid = $row['aid'];
if(strlen($body) < $msize)
{
if (strlen($body) < $msize) {
continue;
}
if(!preg_match("/#p#/iU",$body))
{
$body = SpLongBody($body,$cfg_arcautosp_size*1024,"#p#分页标题#e#");
if (!preg_match("/#p#/iU", $body)) {
$body = SpLongBody($body, $cfg_arcautosp_size * 1024, "#p#分页标题#e#");
$body = addslashes($body);
$dsql->ExecuteNoneQuery("UPDATE $table SET $field='$body' WHERE aid='$aid' ; ");
}
}
}//end if limit
} //end if limit
//返回进度提示
if($totalnum>0)
{
$tjlen = ceil( ($tjnum/$totalnum) * 100 );
}
else
{
$tjlen=100;
if ($totalnum > 0) {
$tjlen = ceil(($tjnum / $totalnum) * 100);
} else {
$tjlen = 100;
}
$dvlen = $tjlen * 2;
@@ -187,16 +155,13 @@ else
$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:$dvlen;height:15;background-color:#829D83'></div></div>";
$tjsta .= "<br/>完成处理文档总数的:$tjlen %,继续执行任务...";
if($tjnum < $totalnum)
{
$nurl = "article_description_main.php?totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize&table={$table}&field={$field}&dsize={$dsize}&msize={$msize}&channel={$channel}&dojob={$dojob}";
ShowMsg($tjsta,$nurl,0,500);
if ($tjnum < $totalnum) {
$nurl = "article_description_main.php?totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize&table={$table}&field={$field}&dsize={$dsize}&msize={$msize}&channel={$channel}&dojob={$dojob}";
ShowMsg($tjsta, $nurl, 0, 500);
exit();
}
else
{
} else {
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
}//更新自动分页处理代码结束
}
} //更新自动分页处理代码结束
}

+ 98
- 124
src/dede/article_edit.php View File

@@ -1,29 +1,28 @@
<?php
/**
* 文档编辑
*
* @version $Id: article_edit.php 1 14:12 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('a_Edit,a_AccEdit,a_MyEdit');
require_once(DEDEINC."/customfields.func.php");
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
if(file_exists(DEDEDATA.'/template.rand.php'))
{
require_once(DEDEDATA.'/template.rand.php');
require_once(DEDEINC . "/customfields.func.php");
require_once(DEDEADMIN . "/inc/inc_archives_functions.php");
if (file_exists(DEDEDATA . '/template.rand.php')) {
require_once(DEDEDATA . '/template.rand.php');
}
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
$aid = isset($aid) && is_numeric($aid) ? $aid : 0;
if($dopost!='save')
{
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
if ($dopost != 'save') {
require_once(DEDEADMIN . "/inc/inc_catalog_options.php");
require_once(DEDEINC . "/dedetag.class.php");
ClearMyAddon();
//读取归档信息
@@ -32,23 +31,20 @@ if($dopost!='save')
LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel
LEFT JOIN `#@__arcrank` ar ON ar.rank=arc.arcrank WHERE arc.id='$aid' ";
$arcRow = $dsql->GetOne($query);
if(!is_array($arcRow))
{
ShowMsg("读取档案基本信息出错!","-1");
if (!is_array($arcRow)) {
ShowMsg("读取档案基本信息出错!", "-1");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$query = "SELECT * FROM `#@__channeltype` WHERE id='" . $arcRow['channel'] . "'";
$cInfos = $dsql->GetOne($query);
if(!is_array($cInfos))
{
ShowMsg("读取频道配置信息出错!","javascript:;");
if (!is_array($cInfos)) {
ShowMsg("读取频道配置信息出错!", "javascript:;");
exit();
}
$addtable = $cInfos['addtable'];
$addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'");
if(!is_array($addRow))
{
ShowMsg("读取附加信息出错!","javascript:;");
if (!is_array($addRow)) {
ShowMsg("读取附加信息出错!", "javascript:;");
exit();
}
$channelid = $arcRow['channel'];
@@ -58,44 +54,35 @@ if($dopost!='save')
}
/*--------------------------------
function __save(){ }
-------------------------------*/
else if($dopost=='save')
{
require_once(DEDEINC.'/image.func.php');
require_once(DEDEINC.'/oxwindow.class.php');
$flag = isset($flags) ? join(',',$flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1: 0;
if(empty($typeid2)) $typeid2 = 0;
if(!isset($autokey)) $autokey = 0;
if(!isset($remote)) $remote = 0;
if(!isset($dellink)) $dellink = 0;
if(!isset($autolitpic)) $autolitpic = 0;
if(empty($litpic_b64)) $litpic_b64 = '';
if(empty($typeid))
{
-------------------------------*/ else if ($dopost == 'save') {
require_once(DEDEINC . '/image.func.php');
require_once(DEDEINC . '/oxwindow.class.php');
$flag = isset($flags) ? join(',', $flags) : '';
$notpost = isset($notpost) && $notpost == 1 ? 1 : 0;
if (empty($typeid2)) $typeid2 = 0;
if (!isset($autokey)) $autokey = 0;
if (!isset($remote)) $remote = 0;
if (!isset($dellink)) $dellink = 0;
if (!isset($autolitpic)) $autolitpic = 0;
if (empty($litpic_b64)) $litpic_b64 = '';
if (empty($typeid)) {
ShowMsg("请指定文档的栏目!", "-1");
exit();
}
if(empty($channelid))
{
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1");
exit();
}
if(!CheckChannel($typeid, $channelid))
{
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1");
exit();
}
if(!TestPurview('a_Edit'))
{
if(TestPurview('a_AccEdit'))
{
if (!TestPurview('a_Edit')) {
if (TestPurview('a_AccEdit')) {
CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!");
}
else
{
} else {
CheckArcAdmin($id, $cuserLogin->getUserID());
}
}
@@ -103,96 +90,86 @@ else if($dopost=='save')
//对保存的内容进行处理
$pubdate = GetMkTime($pubdate);
$sortrank = AddDay($pubdate,$sortup);
$ismake = $ishtml==0 ? -1 : 0;
$sortrank = AddDay($pubdate, $sortup);
$ismake = $ishtml == 0 ? -1 : 0;
$autokey = 1;
$title = dede_htmlspecialchars(cn_substrR($title,$cfg_title_maxlen));
$shorttitle = cn_substrR($shorttitle,36);
$color = cn_substrR($color,7);
$writer = cn_substrR($writer,20);
$source = cn_substrR($source,30);
$description = cn_substrR($description,250);
$keywords = trim(cn_substrR($keywords,60));
$filename = trim(cn_substrR($filename,40));
$title = dede_htmlspecialchars(cn_substrR($title, $cfg_title_maxlen));
$shorttitle = cn_substrR($shorttitle, 36);
$color = cn_substrR($color, 7);
$writer = cn_substrR($writer, 20);
$source = cn_substrR($source, 30);
$description = cn_substrR($description, 250);
$keywords = trim(cn_substrR($keywords, 60));
$filename = trim(cn_substrR($filename, 40));
$isremote = 0;
$serviterm=empty($serviterm)? "" : $serviterm;
if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
{
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) {
$arcrank = -1;
}
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if(empty($ddisremote))
{
if (empty($ddisremote)) {
$ddisremote = 0;
}
$litpic = GetDDImage('none',$picname,$ddisremote);
$litpic = GetDDImage('none', $picname, $ddisremote);
//分析body里的内容
$body = AnalyseHtmlBody($body,$description,$litpic,$keywords,'htmltext');
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if(!empty($dede_addonfields))
{
$addonfields = explode(';',$dede_addonfields);
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if(is_array($addonfields))
{
foreach($addonfields as $v)
{
if($v=='')
{
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$vs = explode(',',$v);
if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]);
}else
{
if(!isset(${$vs[0]}))
{
${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]);
} else {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id);
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
$inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'";
}
}
}
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode( ',', $litpic_b64 );
$data = explode(',', $litpic_b64);
$ntime = time();
$savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime);
$savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime);
CreateDir($savepath);
$fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999));
$fullUrl = $fullUrl.".png";
file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] ));
$fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999));
$fullUrl = $fullUrl . ".png";
file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
WaterImg($cfg_basedir . $fullUrl, 'up');
$litpic = $fullUrl;
}
//处理图片文档的自定义属性
if($litpic!='' && !preg_match("#p#", $flag))
{
$flag = ($flag=='' ? 'p' : $flag.',p');
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag . ',p');
}
if($redirecturl!='' && !preg_match("#j#", $flag))
{
$flag = ($flag=='' ? 'j' : $flag.',j');
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag . ',j');
}
//跳转网址的文档强制为动态
if(preg_match("#j#", $flag)) $ismake = -1;
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$query = "UPDATE #@__archives SET
typeid='$typeid',
@@ -218,43 +195,40 @@ else if($dopost=='save')
weight='$weight'
WHERE id='$id'; ";
if(!$dsql->ExecuteNoneQuery($query))
{
ShowMsg('更新数据库archives表时出错,请检查',-1);
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg('更新数据库archives表时出错,请检查', -1);
exit();
}
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if($addtable!='')
{
if ($addtable != '') {
$useip = GetIP();
$templet = empty($templet) ? '' : $templet;
$iquery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},redirecturl='$redirecturl',templet='$templet',userip='$useip' WHERE aid='$id'";
if(!$dsql->ExecuteNoneQuery($iquery))
{
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;");
if (!$dsql->ExecuteNoneQuery($iquery)) {
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!", "javascript:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
if($cfg_remote_site=='Y' && $isremote=="1")
{
if($serviterm!=""){
if ($cfg_remote_site == 'Y' && $isremote == "1") {
if ($serviterm != "") {
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config=array( 'hostname' => $servurl, 'username' => $servuser,
'password' => $servpwd,'debug' => 'TRUE');
$config = array(
'hostname' => $servurl, 'username' => $servuser,
'password' => $servpwd, 'debug' => 'TRUE'
);
} else {
$config=array();
$config = array();
}
if(!$ftp->connect($config)) exit('Error:None FTP Connection!');
if (!$ftp->connect($config)) exit('Error:None FTP Connection!');
}
$artUrl = MakeArt($id,true,true,$isremote);
if($artUrl=='')
{
$artUrl = $cfg_phpurl."/view.php?aid=$id";
$artUrl = MakeArt($id, true, true, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl . "/view.php?aid=$id";
}
ClearMyAddon($id, $title);
@@ -264,18 +238,18 @@ else if($dopost=='save')
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
MakeArt($id, true, true, $isremote);
}
}
}
}
//返回成功信息
$msg = "
  请选择你的后续操作:
<a href='article_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>发布新文章</a>
&nbsp;&nbsp;
<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
<a href='archives_do.php?aid=" . $id . "&dopost=editArchives' class='btn btn-secondary btn-sm'>查看更改</a>
&nbsp;&nbsp;
<a href='$artUrl' target='_blank' class='btn btn-secondary btn-sm'>查看文章</a>
&nbsp;&nbsp;
@@ -289,6 +263,6 @@ else if($dopost=='save')
$win = new OxWindow();
$win->AddTitle("成功更改文章:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand","&nbsp;",false);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}
}

+ 31
- 42
src/dede/article_keywords_main.php View File

@@ -1,104 +1,93 @@
<?php
/**
* 文档关键词管理
*
* @version $Id: article_keywords_main.php 1 14:12 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('sys_Keyword');
require_once(DEDEINC."/datalistcp.class.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
if(empty($dopost)) $dopost = '';
require_once(DEDEINC . "/datalistcp.class.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
if (empty($dopost)) $dopost = '';
//保存批量更改
if($dopost=='saveall')
{
if ($dopost == 'saveall') {
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "article_keywords_main.php" : $_COOKIE['ENV_GOBACK_URL'];
if(!isset($aids))
{
ShowMsg("你没有选择要更改的内容!",$ENV_GOBACK_URL);
if (!isset($aids)) {
ShowMsg("你没有选择要更改的内容!", $ENV_GOBACK_URL);
exit();
}
foreach($aids as $aid)
{
$rpurl = ${'rpurl_'.$aid};
$rpurlold = ${'rpurlold_'.$aid};
$keyword = ${'keyword_'.$aid};
foreach ($aids as $aid) {
$rpurl = ${'rpurl_' . $aid};
$rpurlold = ${'rpurlold_' . $aid};
$keyword = ${'keyword_' . $aid};
//删除项目
if(!empty(${'isdel_'.$aid}))
{
if (!empty(${'isdel_' . $aid})) {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__keywords` WHERE aid='$aid'");
continue;
}
//禁用项目
$staold = ${'staold_'.$aid};
$sta = empty(${'isnouse_'.$aid}) ? 1 : 0;
if($staold!=$sta)
{
$staold = ${'staold_' . $aid};
$sta = empty(${'isnouse_' . $aid}) ? 1 : 0;
if ($staold != $sta) {
$query1 = "UPDATE `#@__keywords` SET sta='$sta',rpurl='$rpurl' WHERE aid='$aid' ";
$dsql->ExecuteNoneQuery($query1);
continue;
}
//更新链接网址
if($rpurl!=$rpurlold)
{
if ($rpurl != $rpurlold) {
$query1 = "UPDATE `#@__keywords` SET rpurl='$rpurl' WHERE aid='$aid' ";
$dsql->ExecuteNoneQuery($query1);
}
}
ShowMsg("完成指定的更改!",$ENV_GOBACK_URL);
ShowMsg("完成指定的更改!", $ENV_GOBACK_URL);
exit();
}
//增加关键字
else if($dopost=='add')
{
else if ($dopost == 'add') {
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "-1" : $_COOKIE['ENV_GOBACK_URL'];
$keyword = trim($keyword);
$rank = preg_replace("#[^0-9]#", '', $rank);
if($keyword=='')
{
ShowMsg("关键字不能为空!",-1);
if ($keyword == '') {
ShowMsg("关键字不能为空!", -1);
exit();
}
$row = $dsql->GetOne("SELECT * FROM `#@__keywords` WHERE keyword LIKE '$keyword'");
if(is_array($row))
{
ShowMsg("关键字已存在库中!","-1");
if (is_array($row)) {
ShowMsg("关键字已存在库中!", "-1");
exit();
}
$inquery = "INSERT INTO `#@__keywords`(keyword,rank,sta,rpurl) VALUES ('$keyword','$rank','1','$rpurl');";
$dsql->ExecuteNoneQuery($inquery);
ShowMsg("成功增加一个关键字!",$ENV_GOBACK_URL);
ShowMsg("成功增加一个关键字!", $ENV_GOBACK_URL);
exit();
}
if(empty($keyword))
{
if (empty($keyword)) {
$keyword = '';
$addquery = '';
}
else
{
} else {
$addquery = " WHERE keyword LIKE '%$keyword%' ";
}
$sql = "SELECT * FROM `#@__keywords` $addquery ORDER BY rank DESC";
$dlist = new DataListCP();
$dlist->pageSize = 20;
$dlist->SetParameter("keyword",$keyword);
$dlist->SetTemplate(DEDEADMIN."/templets/article_keywords_main.htm");
$dlist->SetParameter("keyword", $keyword);
$dlist->SetTemplate(DEDEADMIN . "/templets/article_keywords_main.htm");
$dlist->SetSource($sql);
$dlist->Display();
function GetSta($sta)
{
if($sta==1) return '';
if ($sta == 1) return '';
else return ' checked="1" ';
}
}

+ 68
- 116
src/dede/article_keywords_make.php View File

@@ -1,30 +1,29 @@
<?php
/**
* 文档关键词生成
*
* @version $Id: article_keywords_make.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
@ob_start();
@set_time_limit(3600);
require_once(dirname(__FILE__).'/config.php');
require_once(dirname(__FILE__) . '/config.php');
CheckPurview('sys_Keyword');
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
//分析已存在的关键字(适用于默认的文章模型)
if($dopost=='analyse')
{
if ($dopost == 'analyse') {
echo "正在读取关键字数据库...<br/>\r\n";
flush();
$ws = $wserr = $wsnew = "";
$dsql->SetQuery("SELECT * FROM `#@__keywords`");
$dsql->Execute();
while($row = $dsql->GetObject())
{
if($row->sta==1) $ws[$row->keyword] = 1;
while ($row = $dsql->GetObject()) {
if ($row->sta == 1) $ws[$row->keyword] = 1;
else $wserr[$row->keyword] = 1;
}
echo "完成关键字数据库的载入!<br/>\r\n";
@@ -33,36 +32,25 @@ if($dopost=='analyse')
flush();
$dsql->SetQuery("SELECT id,keywords FROM `#@__archives`");
$dsql->Execute();
while($row = $dsql->GetObject())
{
$keywords = explode(',',trim($row->keywords));
while ($row = $dsql->GetObject()) {
$keywords = explode(',', trim($row->keywords));
$nerr = false;
$mykey = '';
if(is_array($keywords))
{
foreach($keywords as $v)
{
if (is_array($keywords)) {
foreach ($keywords as $v) {
$v = trim($v);
if($v=='')
{
if ($v == '') {
continue;
}
if(isset($ws[$v]))
{
$mykey .= $v." ";
}
else if(isset($wsnew[$v]))
{
$mykey .= $v.' ';
if (isset($ws[$v])) {
$mykey .= $v . " ";
} else if (isset($wsnew[$v])) {
$mykey .= $v . ' ';
$wsnew[$v]++;
}
else if(isset($wserr[$v]))
{
} else if (isset($wserr[$v])) {
$nerr = true;
}
else
{
$mykey .= $v." ";
} else {
$mykey .= $v . " ";
$wsnew[$v] = 1;
}
}
@@ -70,75 +58,59 @@ if($dopost=='analyse')
}
echo "完成档案数据库的处理!<br/>\r\n";
flush();
if(is_array($wsnew))
{
if (is_array($wsnew)) {
echo "对关键字进行排序...<br/>\r\n";
flush();
arsort($wsnew);
echo "把关键字保存到数据库...<br/>\r\n";
flush();
foreach($wsnew as $k=>$v)
{
if(strlen($k)>20)
{
foreach ($wsnew as $k => $v) {
if (strlen($k) > 20) {
continue;
}
$dsql->SetQuery("INSERT INTO `#@__keywords`(keyword,rank,sta,rpurl) VALUES('".addslashes($k)."','$v','1','')");
$dsql->SetQuery("INSERT INTO `#@__keywords`(keyword,rank,sta,rpurl) VALUES('" . addslashes($k) . "','$v','1','')");
$dsql->Execute();
}
echo "完成关键字的导入!<br/>\r\n";
flush();
sleep(1);
}
else
{
} else {
echo "没发现任何新的关键字!<br/>\r\n";
flush();
sleep(1);
}
ShowMsg('完成所有操作,现在转到关键字列表页!','article_keywords_main.php');
ShowMsg('完成所有操作,现在转到关键字列表页!', 'article_keywords_main.php');
exit();
}
//自动获取关键字(适用于默认的文章模型)
else if($dopost=='fetch')
{
require_once(DEDEINC."/splitword.class.php");
if(empty($startdd))
{
else if ($dopost == 'fetch') {
require_once(DEDEINC . "/splitword.class.php");
if (empty($startdd)) {
$startdd = 0;
}
if(empty($pagesize))
{
if (empty($pagesize)) {
$pagesize = 20;
}
if(empty($totalnum))
{
if (empty($totalnum)) {
$totalnum = 0;
}
//统计记录总数
if($totalnum==0)
{
if ($totalnum == 0) {
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__archives` WHERE channel='1' ");
$totalnum = $row['dd'];
}
//获取记录,并分析关键字
if($totalnum > $startdd+$pagesize)
{
if ($totalnum > $startdd + $pagesize) {
$limitSql = " LIMIT $startdd,$pagesize";
}
else if(($totalnum-$startdd)>0)
{
$limitSql = " LIMIT $startdd,".($totalnum - $startdd);
}
else
{
} else if (($totalnum - $startdd) > 0) {
$limitSql = " LIMIT $startdd," . ($totalnum - $startdd);
} else {
$limitSql = '';
}
$tjnum = $startdd;
if($limitSql!='')
{
if ($limitSql != '') {
$fquery = "SELECT arc.id,arc.title,arc.keywords,addon.body FROM `#@__archives` arc
LEFT JOIN `#@__addonarticle` addon ON addon.aid=arc.id WHERE arc.channel='1' $limitSql ";
$dsql->SetQuery($fquery);
@@ -148,104 +120,84 @@ else if($dopost=='fetch')
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port);
$client->appid = $cfg_bizcore_appid;
$client->key = $cfg_bizcore_key;
while($row=$dsql->GetObject())
{
if($row->keywords!='')
{
while ($row = $dsql->GetObject()) {
if ($row->keywords != '') {
continue;
}
$tjnum++;
$id = $row->id;
$keywords = "";
$data = $client->Spliteword($row->title.Html2Text($row->body));
$data = $client->Spliteword($row->title . Html2Text($row->body));
$keywords = $data->data;
$keywords = addslashes($keywords);
if($keywords=='')
{
if ($keywords == '') {
$keywords = ',';
}
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET keywords='$keywords' WHERE id='$id'");
}
$client->Close();
} else {
$sp = new SplitWord($cfg_soft_lang , $cfg_soft_lang );
while($row=$dsql->GetObject())
{
if($row->keywords!='')
{
$sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
while ($row = $dsql->GetObject()) {
if ($row->keywords != '') {
continue;
}
$tjnum++;
$id = $row->id;
$keywords = "";
$sp->SetSource($row->title, $cfg_soft_lang , $cfg_soft_lang );
$sp->SetSource($row->title, $cfg_soft_lang, $cfg_soft_lang);
$sp->SetResultType(2);
$sp->StartAnalysis(TRUE);
$titleindexs = $sp->GetFinallyIndex();
$sp->SetSource(Html2Text($row->body), $cfg_soft_lang , $cfg_soft_lang );
$sp->SetSource(Html2Text($row->body), $cfg_soft_lang, $cfg_soft_lang);
$sp->SetResultType(2);
$sp->StartAnalysis(TRUE);
$allindexs = $sp->GetFinallyIndex();
if(is_array($allindexs) && is_array($titleindexs))
{
foreach($titleindexs as $k => $v)
{
if(strlen($keywords)>=30)
{
if (is_array($allindexs) && is_array($titleindexs)) {
foreach ($titleindexs as $k => $v) {
if (strlen($keywords) >= 30) {
break;
}
else
{
if(strlen($k) <= 2) continue;
$keywords .= $k.",";
} else {
if (strlen($k) <= 2) continue;
$keywords .= $k . ",";
}
}
foreach($allindexs as $k => $v)
{
if(strlen($keywords)>=30)
{
foreach ($allindexs as $k => $v) {
if (strlen($keywords) >= 30) {
break;
}
else if(!in_array($k,$titleindexs))
{
if(strlen($k) <= 2) continue;
$keywords .= $k.",";
} else if (!in_array($k, $titleindexs)) {
if (strlen($k) <= 2) continue;
$keywords .= $k . ",";
}
}
}
$keywords = addslashes($keywords);
if($keywords=='')
{
if ($keywords == '') {
$keywords = ',';
}
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET keywords='$keywords' WHERE id='$id'");
}
unset($sp);
}
}//end if limit
} //end if limit
//返回提示信息
if($totalnum>0) $tjlen = ceil( ($tjnum/$totalnum) * 100 );
else $tjlen=100;
if ($totalnum > 0) $tjlen = ceil(($tjnum / $totalnum) * 100);
else $tjlen = 100;
$dvlen = $tjlen * 2;
$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:$dvlen;height:15;background-color:#829D83'></div></div>";
$tjsta .= "<br/>完成处理文档总数的:$tjlen %,位置:{$startdd},继续执行任务...";
if($tjnum < $totalnum)
{
$nurl = "article_keywords_make.php?dopost=fetch&totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize";
ShowMsg($tjsta,$nurl,0,500);
}
else
{
ShowMsg("完成所有任务!","javascript:;");
if ($tjnum < $totalnum) {
$nurl = "article_keywords_make.php?dopost=fetch&totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize";
ShowMsg($tjsta, $nurl, 0, 500);
} else {
ShowMsg("完成所有任务!", "javascript:;");
}
exit();
}


+ 11
- 10
src/dede/article_keywords_select.php View File

@@ -1,37 +1,38 @@
<?php
/**
* 文档关键词选择
*
* @version $Id: article_keywords_select.php$
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/datalistcp.class.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/datalistcp.class.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
$f = RemoveXSS($f);
if(empty($keywords)) $keywords = "";
if (empty($keywords)) $keywords = "";
$sql = "SELECT * FROM #@__keywords ORDER BY rank DESC";
$dlist = new DataListCP();
$dlist->SetTemplate(DEDEADMIN."/templets/article_keywords_select.htm");
$dlist->SetTemplate(DEDEADMIN . "/templets/article_keywords_select.htm");
$dlist->pageSize = 300;
$dlist->SetParameter("f",$f);
$dlist->SetParameter("f", $f);
$dlist->SetSource($sql);
$dlist->Display();
function GetSta($sta)
{
if($sta==1) return "正常";
if ($sta == 1) return "正常";
else return "<font color='red'>禁用</font>";
}
function GetMan($sta)
{
if($sta==1) return "<u>禁用</u>";
if ($sta == 1) return "<u>禁用</u>";
else return "<u>启用</u>";
}
}

+ 16
- 23
src/dede/article_select_sw.php View File

@@ -1,53 +1,46 @@
<?php
/**
* @version $Id: article_select_sw.php 1 8:26 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require(dirname(__FILE__)."/config.php");
require(dirname(__FILE__) . "/config.php");
header("Pragma:no-cache");
header("Cache-Control:no-cache");
header("Expires:0");
//来源列表
if($t=='source')
{
$m_file = DEDEDATA."/admin/source.txt";
if ($t == 'source') {
$m_file = DEDEDATA . "/admin/source.txt";
$allsources = file($m_file);
echo "<div class='coolbg4'>[<a href=\"javascript:OpenMyWin('article_source_edit.php');ClearDivCt('mysource');\">设置</a>]&nbsp;";
echo "[<a href='#' onclick='javascript:HideObj(\"mysource\");ChangeFullDiv(\"hide\");'>关闭</a>]</div>\r\n<div class='wsselect'>\r\n";
foreach($allsources as $v)
{
foreach ($allsources as $v) {
$v = trim($v);
if($v!="")
{
if ($v != "") {
echo "<a href='#' onclick='javascript:PutSource(\"$v\")'>$v</a> | \r\n";
}
}
echo "</div><div class='coolbg5'>&nbsp;</div>";
}
else
{
} else {
//作者列表
$m_file = DEDEDATA."/admin/writer.txt";
$m_file = DEDEDATA . "/admin/writer.txt";
echo "<div class='coolbg4'>[<a href=\"javascript:OpenMyWin('article_writer_edit.php');ClearDivCt('mywriter');\">设置</a>]&nbsp;";
echo "[<a href='#' onclick='javascript:HideObj(\"mywriter\");ChangeFullDiv(\"hide\");'>关闭</a>]</div>\r\n<div class='wsselect'>\r\n";
if(filesize($m_file)>0)
{
$fp = fopen($m_file,'r');
$str = fread($fp,filesize($m_file));
if (filesize($m_file) > 0) {
$fp = fopen($m_file, 'r');
$str = fread($fp, filesize($m_file));
fclose($fp);
$strs = explode(',',$str);
foreach($strs as $str)
{
$strs = explode(',', $str);
foreach ($strs as $str) {
$str = trim($str);
if($str!="")
{
if ($str != "") {
echo "<a href='#' onclick='javascript:PutWriter(\"$str\")'>$str</a> | ";
}
}
}
echo "</div><div class='coolbg5'>&nbsp;</div>\r\n";
}
}

+ 17
- 18
src/dede/article_source_edit.php View File

@@ -1,44 +1,43 @@
<?php
/**
* 文章来源编辑
*
* @version $Id: archives_add.php 1 14:30 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/oxwindow.class.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/oxwindow.class.php");
CheckPurview('sys_Source');
if(empty($dopost)) $dopost = '';
if(empty($allsource)) $allsource = '';
if (empty($dopost)) $dopost = '';
if (empty($allsource)) $allsource = '';
else $allsource = stripslashes($allsource);
$m_file = DEDEDATA."/admin/source.txt";
$m_file = DEDEDATA . "/admin/source.txt";
//保存
if($dopost=='save')
{
$fp = fopen($m_file,'w');
flock($fp,3);
fwrite($fp,$allsource);
if ($dopost == 'save') {
$fp = fopen($m_file, 'w');
flock($fp, 3);
fwrite($fp, $allsource);
fclose($fp);
echo "<script>alert('Save OK!');</script>";
}
//读出
if(empty($allsource) && filesize($m_file)>0)
{
$fp = fopen($m_file,'r');
$allsource = fread($fp,filesize($m_file));
if (empty($allsource) && filesize($m_file) > 0) {
$fp = fopen($m_file, 'r');
$allsource = fread($fp, filesize($m_file));
fclose($fp);
}
$wintitle = "文章来源管理";
$wecome_info = "文章来源管理";
$win = new OxWindow();
$win->Init('article_source_edit.php','js/blank.js','POST');
$win->AddHidden('dopost','save');
$win->Init('article_source_edit.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'save');
$win->AddTitle("每行保存一个来源:");
$win->AddMsgItem("<textarea name='allsource' id='allsource' style='width:100%;height:300px'>$allsource</textarea>");
$winform = $win->GetWindow('ok');
$win->Display();
$win->Display();

+ 19
- 20
src/dede/article_string_mix.php View File

@@ -1,49 +1,48 @@
<?php

/**
* 防采集混淆字符串管理
*
* @version $Id: article_string_mix.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/oxwindow.class.php');
CheckPurview('sys_StringMix');
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';

if(empty($allsource)) $allsource = '';
if (empty($allsource)) $allsource = '';
else $allsource = stripslashes($allsource);

$m_file = DEDEDATA."/downmix.data.php";
$m_file = DEDEDATA . "/downmix.data.php";

//保存
if($dopost=="save")
{
CheckCSRF();
$fp = fopen($m_file,'w');
flock($fp,3);
fwrite($fp,$allsource);
if ($dopost == "save") {
CheckCSRF();
$fp = fopen($m_file, 'w');
flock($fp, 3);
fwrite($fp, $allsource);
fclose($fp);
echo "<script>alert('Save OK!');</script>";
}

//读出
if(empty($allsource) && filesize($m_file)>0)
{
$fp = fopen($m_file,'r');
$allsource = fread($fp,filesize($m_file));
if (empty($allsource) && filesize($m_file) > 0) {
$fp = fopen($m_file, 'r');
$allsource = fread($fp, filesize($m_file));
fclose($fp);
}
make_hash();
$wintitle = "防采集混淆字符串管理";
$wecome_info = "防采集混淆字符串管理";
$win = new OxWindow();
$win->Init('article_string_mix.php','js/blank.js','POST');
$win->AddHidden('dopost','save');
$win->AddHidden('token',$_SESSION['token']);
$win->Init('article_string_mix.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'save');
$win->AddHidden('token', $_SESSION['token']);
$win->AddTitle("如果你要启用字符串混淆来防采集,请在文档模板需要的字段加上 function='RndString(@me)' 属性,如:{dede:field name='body' function='RndString(@me)'/}。");
$win->AddMsgItem("<textarea name='allsource' id='allsource' style='width:100%;height:300px'>$allsource</textarea>");
$winform = $win->GetWindow('ok');
$win->Display();
$win->Display();

+ 24
- 31
src/dede/article_template_rand.php View File

@@ -1,59 +1,54 @@
<?php

/**
* 文档随机模板
*
* @version $Id: article_template_rand.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/oxwindow.class.php');
CheckPurview('sys_StringMix');
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
$templates = empty($templates) ? '' : stripslashes($templates);
$m_file = DEDEDATA.'/template.rand.php';
$m_file = DEDEDATA . '/template.rand.php';

//----------------------action
$okmsg = '';
//保存配置
if($dopost=='save')
{
if ($dopost == 'save') {
CheckCSRF();
$fp = fopen($m_file,'w');
flock($fp,3);
fwrite($fp,$templates);
$fp = fopen($m_file, 'w');
flock($fp, 3);
fwrite($fp, $templates);
fclose($fp);
$okmsg = '成功保存配置信息 AT:('.MyDate('H:i:s', time()).')';
$okmsg = '成功保存配置信息 AT:(' . MyDate('H:i:s', time()) . ')';
}
//对旧文档进行随机模板处理
else if($dopost=='makeold')
{
else if ($dopost == 'makeold') {
CheckCSRF();
set_time_limit(3600);
if(!file_exists($m_file))
{
if (!file_exists($m_file)) {
AjaxHead();
echo "配置文件不存在!";
exit();
}
require_once($m_file);
if($cfg_tamplate_rand==0)
{
if ($cfg_tamplate_rand == 0) {
AjaxHead();
echo "系统没开启允许随机模板的选项!";
exit();
}
$totalTmp = count($cfg_tamplate_arr) - 1;
if( $totalTmp < 1 )
{
if ($totalTmp < 1) {
AjaxHead();
echo "随机模板的数量必须为2个或以上!";
exit();
}
for($i=0; $i < 10; $i++)
{
for ($i = 0; $i < 10; $i++) {
$temp = $cfg_tamplate_arr[mt_rand(0, $totalTmp)];
$dsql->ExecuteNoneQuery(" Update `#@__addonarticle` set templet='$temp' where RIGHT(aid, 1)='$i' ");
}
@@ -62,8 +57,7 @@ else if($dopost=='makeold')
exit();
}
//清除全部的指定模板
else if($dopost=='clearold')
{
else if ($dopost == 'clearold') {
CheckCSRF();
$dsql->ExecuteNoneQuery(" Update `#@__addonarticle` set templet='' ");
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `#@__addonarticle` ");
@@ -74,10 +68,9 @@ else if($dopost=='clearold')

//-------------------------read
//读出
if(empty($templates) && filesize($m_file)>0)
{
$fp = fopen($m_file,'r');
$templates = fread($fp,filesize($m_file));
if (empty($templates) && filesize($m_file) > 0) {
$fp = fopen($m_file, 'r');
$templates = fread($fp, filesize($m_file));
fclose($fp);
}
$wintitle = "随机模板防采集设置";
@@ -119,10 +112,10 @@ function DoRand(jobname)
</table>";

$win = new OxWindow();
$win->Init('article_template_rand.php','js/blank.js','POST');
$win->AddHidden('dopost','save');
$win->AddHidden('token',$_SESSION['token']);
$win->Init('article_template_rand.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'save');
$win->AddHidden('token', $_SESSION['token']);
$win->AddTitle("本设置仅适用于系统默认的文章模型,设置后发布文章时会自动按指定的模板随机获取一个,如果不想使用此功能,把它设置为空即可!");
$win->AddMsgItem($msg);
$winform = $win->GetWindow('ok');
$win->Display();
$win->Display();

+ 44
- 49
src/dede/article_test_same.php View File

@@ -1,24 +1,24 @@
<?php
/**
* 检测重复文档
*
* @version $Id: article_test_same.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
@set_time_limit(0);
CheckPurview('sys_ArcBatch');
if(empty($dopost)) $dopost = '';
if($dopost=='analyse')
{
if (empty($dopost)) $dopost = '';
if ($dopost == 'analyse') {
$arr = $dsql->getone("SELECT maintable FROM `#@__channeltype` WHERE id='$channelid' ");
if(is_array($arr)) {
if (is_array($arr)) {
$maintable = $arr['maintable'];
} else {
showmsg('频道id不正确,无法处理!','javascript:;');
showmsg('频道id不正确,无法处理!', 'javascript:;');
exit();
}
$dsql->SetQuery("SELECT COUNT(title) AS dd,title FROM `$maintable` WHERE channel='$channelid' GROUP BY title ORDER BY dd DESC LIMIT 0, $pagesize");
@@ -28,56 +28,51 @@ if($dopost=='analyse')
exit();
}
//删除选中的内容(只保留一条)
else if($dopost=='delsel')
{
require_once(dirname(__FILE__)."/../include/typelink.class.php");
require_once(dirname(__FILE__)."/inc/inc_batchup.php");
if(empty($titles))
{
else if ($dopost == 'delsel') {
require_once(dirname(__FILE__) . "/../include/typelink.class.php");
require_once(dirname(__FILE__) . "/inc/inc_batchup.php");
if (empty($titles)) {
header("Content-Type: text/html; charset={$cfg_ver_lang}");
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\">\r\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\">\r\n";
echo "没有指定删除的文档!";
exit();
}
$titless = split('`',$titles);
if($channelid < -1) {
$orderby = ($deltype=='delnew' ? " ORDER BY aid DESC " : " ORDER BY aid ASC ");
$titless = split('`', $titles);
if ($channelid < -1) {
$orderby = ($deltype == 'delnew' ? " ORDER BY aid DESC " : " ORDER BY aid ASC ");
} else {
$orderby = ($deltype=='delnew' ? " ORDER BY id DESC " : " ORDER BY id ASC ");
$orderby = ($deltype == 'delnew' ? " ORDER BY id DESC " : " ORDER BY id ASC ");
}
$totalarc = 0;
foreach($titless as $title)
{
$title = trim($title);
$title = addslashes( $title=='' ? '' : urldecode($title) );
if($channelid < -1) {
$q1 = "SELECT aid as id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
}
else {
$q1 = "SELECT id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
}
$dsql->SetQuery($q1);
$dsql->Execute();
$rownum = $dsql->GetTotalRow();
if($rownum < 2) continue;
$i = 1;
while($row = $dsql->GetObject())
{
$i++;
$naid = $row->id;
$ntitle = $row->title;
if($i > $rownum) continue;
$totalarc++;
DelArc($naid, 'OFF');
}
foreach ($titless as $title) {
$title = trim($title);
$title = addslashes($title == '' ? '' : urldecode($title));
if ($channelid < -1) {
$q1 = "SELECT aid as id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
} else {
$q1 = "SELECT id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
}
$dsql->SetQuery($q1);
$dsql->Execute();
$rownum = $dsql->GetTotalRow();
if ($rownum < 2) continue;
$i = 1;
while ($row = $dsql->GetObject()) {
$i++;
$naid = $row->id;
$ntitle = $row->title;
if ($i > $rownum) continue;
$totalarc++;
DelArc($naid, 'OFF');
}
}
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `$maintable`; ");
ShowMsg("一共删除了[{$totalarc}]篇重复的文档!","javascript:;");
ShowMsg("一共删除了[{$totalarc}]篇重复的文档!", "javascript:;");
exit();
}
@@ -85,5 +80,5 @@ else if($dopost=='delsel')
$channelinfos = array();
$dsql->setquery("SELECT id,typename,maintable,addtable FROM `#@__channeltype` ");
$dsql->execute();
while($row = $dsql->getarray()) $channelinfos[] = $row;
include DedeInclude('templets/article_test_same.htm');
while ($row = $dsql->getarray()) $channelinfos[] = $row;
include DedeInclude('templets/article_test_same.htm');

+ 6
- 6
src/dede/article_test_title.php View File

@@ -1,19 +1,19 @@
<?php
/**
* 检测重复文档
*
* @version $Id: article_test_same.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
AjaxHead();
if(empty($t) || $cfg_check_title=='N') exit;
if (empty($t) || $cfg_check_title == 'N') exit;
$row = $dsql->GetOne("SELECT id FROM `#@__archives` WHERE title LIKE '$t' ");
if(is_array($row))
{
if (is_array($row)) {
echo "提示:系统已经存在标题为 '<a href='../plus/view.php?aid={$row['id']}' style='color:red' target='_blank'><u>$t</u></a>' 的文档。[<a href='#' onclick='javascript:HideObj(\"mytitle\")'>关闭</a>]";
}
}

+ 17
- 18
src/dede/article_writer_edit.php View File

@@ -1,46 +1,45 @@
<?php
/**
* 文章作者管理
*
* @version $Id: article_writer_edit.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/oxwindow.class.php');
CheckPurview('sys_Writer');
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if(empty($allwriter)) $allwriter = '';
if (empty($allwriter)) $allwriter = '';
else $allwriter = stripslashes($allwriter);
$m_file = DEDEDATA."/admin/writer.txt";
$m_file = DEDEDATA . "/admin/writer.txt";
//保存
if($dopost=="save")
{
$fp = fopen($m_file,'w');
flock($fp,3);
fwrite($fp,$allwriter);
if ($dopost == "save") {
$fp = fopen($m_file, 'w');
flock($fp, 3);
fwrite($fp, $allwriter);
fclose($fp);
echo "<script>alert('Save OK!');</script>";
}
//读出
if(empty($allwriter) && filesize($m_file)>0)
{
$fp = fopen($m_file,'r');
$allwriter = fread($fp,filesize($m_file));
if (empty($allwriter) && filesize($m_file) > 0) {
$fp = fopen($m_file, 'r');
$allwriter = fread($fp, filesize($m_file));
fclose($fp);
}
$wintitle = "文章作者管理";
$wecome_info = "文章作者管理";
$win = new OxWindow();
$win->Init('article_writer_edit.php','js/blank.js','POST');
$win->AddHidden('dopost','save');
$win->Init('article_writer_edit.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'save');
$win->AddTitle("把作者姓名用半角逗号“,”分开:");
$win->AddMsgItem("<textarea name='allwriter' id='allwriter' style='width:100%;height:300px'>$allwriter</textarea>");
$winform = $win->GetWindow('ok');
$win->Display();
$win->Display();

+ 19
- 25
src/dede/baidunews.php View File

@@ -1,28 +1,27 @@
<?php
/**
* 百度新闻
*
* @version $Id: baidunews.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
if(empty($do))
{
include DEDEADMIN.'/templets/baidunews.htm';
if (empty($do)) {
include DEDEADMIN . '/templets/baidunews.htm';
} else {
$baidunews = "<?xml version=\"1.0\" encoding=\"".$cfg_soft_lang."\" ?>\n";
$baidunews = "<?xml version=\"1.0\" encoding=\"" . $cfg_soft_lang . "\" ?>\n";
$baidunews .= "<document>\n";
$baidunews .= "<webSite>$cfg_webname </webSite>\n";
$baidunews .= "<webMaster>$cfg_adminemail </webMaster>\n";
$baidunews .= "<updatePeri>$cfg_updateperi </updatePeri>\n";
$limit = $cfg_baidunews_limit;
if($limit > 100 || $limit < 1)
{
if ($limit > 100 || $limit < 1) {
$limit = 100;
}
@@ -34,32 +33,27 @@ if(empty($do))
";
$dsql->SetQuery($query);
$dsql->Execute();
while($row = $dsql->GetArray())
{
while ($row = $dsql->GetArray()) {
$title = dede_htmlspecialchars($row['title']);
$row1 = GetOneArchive($row['id']);
if(strpos($row1['arcurl'],'http://') === false)
{
$link = ($cfg_basehost=='' ? 'http://'.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$row1['arcurl'];
}else
{
if (strpos($row1['arcurl'], 'http://') === false) {
$link = ($cfg_basehost == '' ? 'http://' . $_SERVER["HTTP_HOST"] . $cfg_cmspath : $cfg_basehost) . $row1['arcurl'];
} else {
$link = $row1['arcurl'];
}
$link = dede_htmlspecialchars($link);
$description = dede_htmlspecialchars(strip_tags($row['description']));
$text = dede_htmlspecialchars(strip_tags($row['body']));
$image = $row['litpic'] =='' ? '' :$row['litpic'];
if($image != '' && strpos($image, 'http://') === false)
{
$image = ($cfg_basehost=='' ? 'http://'.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$image;
$image = $row['litpic'] == '' ? '' : $row['litpic'];
if ($image != '' && strpos($image, 'http://') === false) {
$image = ($cfg_basehost == '' ? 'http://' . $_SERVER["HTTP_HOST"] . $cfg_cmspath : $cfg_basehost) . $image;
}
//$headlineimg = '';
$keywords = dede_htmlspecialchars($row['keywords']);
$category = dede_htmlspecialchars($row['typename']);
$author = dede_htmlspecialchars($row['writer']);
$source = dede_htmlspecialchars($row['source']);
$pubdate = dede_htmlspecialchars(gmdate('Y-m-d H:i',$row['pubdate'] + $cfg_cli_time * 3600));
$pubdate = dede_htmlspecialchars(gmdate('Y-m-d H:i', $row['pubdate'] + $cfg_cli_time * 3600));
$baidunews .= "<item>\n";
$baidunews .= "<title>$title </title>\n";
@@ -77,8 +71,8 @@ if(empty($do))
}
$baidunews .= "</document>\n";
$fp = fopen(dirname(__FILE__).'/'.$filename,'w');
fwrite($fp,$baidunews);
$fp = fopen(dirname(__FILE__) . '/' . $filename, 'w');
fwrite($fp, $baidunews);
fclose($fp);
showmsg("<a href='{$filename}' target=\"_blank\">{$filename} make success</a>",'javascript:;');
}
showmsg("<a href='{$filename}' target=\"_blank\">{$filename} make success</a>", 'javascript:;');
}

+ 20
- 29
src/dede/cards_make.php View File

@@ -1,23 +1,23 @@
<?php
/**
* 生成点卡
*
* @version $Id: cards_make.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('member_Card');
if(empty($dopost)) $dopost = '';
if($dopost == '') include(DEDEADMIN."/templets/cards_make.htm");
if (empty($dopost)) $dopost = '';
if ($dopost == '') include(DEDEADMIN . "/templets/cards_make.htm");
//生成点卡
elseif($dopost == 'make')
{
elseif ($dopost == 'make') {
$row = $dsql->GetOne("SELECT * FROM #@__moneycard_record ORDER BY aid DESC");
!is_array($row) ? $startid=100000 : $startid=$row['aid']+100000;
!is_array($row) ? $startid = 100000 : $startid = $row['aid'] + 100000;
$row = $dsql->GetOne("SELECT * FROM #@__moneycard_type WHERE tid='$cardtype'");
$money = $row['money'];
$num = $row['num'];
@@ -29,33 +29,24 @@ elseif($dopost == 'make')
header("Content-Type: text/html; charset={$cfg_soft_lang}");
for(;$startid<$endid;$startid++)
{
$cardid = $snprefix.$startid.'-';
for($p=0;$p<$pwdgr;$p++)
{
for($i=0; $i < $pwdlen; $i++)
{
if($ctype==1)
{
$c = mt_rand(49,57); $c = chr($c);
}
else
{
$c = mt_rand(65,90);
if($c==79)
{
for (; $startid < $endid; $startid++) {
$cardid = $snprefix . $startid . '-';
for ($p = 0; $p < $pwdgr; $p++) {
for ($i = 0; $i < $pwdlen; $i++) {
if ($ctype == 1) {
$c = mt_rand(49, 57);
$c = chr($c);
} else {
$c = mt_rand(65, 90);
if ($c == 79) {
$c = 'M';
}
else
{
} else {
$c = chr($c);
}
}
$cardid .= $c;
}
if($p<$pwdgr-1)
{
if ($p < $pwdgr - 1) {
$cardid .= '-';
}
}
@@ -65,4 +56,4 @@ elseif($dopost == 'make')
echo "成功生成点卡:{$cardid}<br/>";
}
echo "成功生成 {$mnum} 个点卡!";
}
}

+ 26
- 26
src/dede/cards_manage.php View File

@@ -1,44 +1,44 @@
<?php
/**
* 点卡管理
*
* @version $Id: cards_manage.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC.'/datalistcp.class.php');
$dopost=empty($dopost)? "" : $dopost;
if($dopost=="delete"){
$ids = explode('`',$aids);
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . '/datalistcp.class.php');
$dopost = empty($dopost) ? "" : $dopost;
if ($dopost == "delete") {
$ids = explode('`', $aids);
$dquery = "";
foreach($ids as $id){
if($dquery=="") $dquery .= "aid='$id' ";
foreach ($ids as $id) {
if ($dquery == "") $dquery .= "aid='$id' ";
else $dquery .= " OR aid='$id' ";
}
if($dquery!="") $dquery = " WHERE ".$dquery;
if ($dquery != "") $dquery = " WHERE " . $dquery;
$dsql->ExecuteNoneQuery("DELETE FROM #@__moneycard_record $dquery");
ShowMsg("成功删除指定的记录!","cards_manage.php");
exit();
}else{
ShowMsg("成功删除指定的记录!", "cards_manage.php");
exit();
} else {
$addsql = '';
if(isset($isexp)) $addsql = " WHERE isexp='$isexp' ";
if (isset($isexp)) $addsql = " WHERE isexp='$isexp' ";
$sql = "SELECT * FROM #@__moneycard_record $addsql ORDER BY aid DESC";
$dlist = new DataListCP();
$dlist->pageSize = 25; //设定每页显示记录数(默认25条)
if(isset($isexp)) $dlist->SetParameter("isexp",$isexp);
if (isset($isexp)) $dlist->SetParameter("isexp", $isexp);
$dlist->dsql->SetQuery("SELECT * FROM #@__moneycard_type ");
$dlist->dsql->Execute('ts');
while($rw = $dlist->dsql->GetArray('ts'))
{
while ($rw = $dlist->dsql->GetArray('ts')) {
$TypeNames[$rw['tid']] = $rw['pname'];
}
$tplfile = DEDEADMIN."/templets/cards_manmage.htm";
$tplfile = DEDEADMIN . "/templets/cards_manmage.htm";
//这两句的顺序不能更换
$dlist->SetTemplate($tplfile); //载入模板
$dlist->SetSource($sql); //设定查询SQL
@@ -48,20 +48,20 @@ if($dopost=="delete"){
function GetMemberID($mid)
{
global $dsql;
if($mid==0) return '0';
if ($mid == 0) return '0';
$row = $dsql->GetOne("SELECT userid FROM #@__member WHERE mid='$mid' ");
if(is_array($row)) return "<a href='member_view.php?mid={$mid}'>".$row['userid']."</a>";
if (is_array($row)) return "<a href='member_view.php?mid={$mid}'>" . $row['userid'] . "</a>";
else return '0';
}
function GetUseDate($time=0)
function GetUseDate($time = 0)
{
if(!empty($time)) return GetDateMk($time);
if (!empty($time)) return GetDateMk($time);
else return '未使用';
}
function GetSta($sta)
{
if($sta==1) return '已售出';
else if($sta==-1) return '已使用';
if ($sta == 1) return '已售出';
else if ($sta == -1) return '已使用';
else return '未使用';
}
}

+ 15
- 21
src/dede/cards_type.php View File

@@ -1,41 +1,36 @@
<?php
/**
* 点卡类型
*
* @version $Id: cards_type.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(dirname(__FILE__) . '/config.php');
CheckPurview('member_Type');
if(empty($dopost)) $dopost = "";
if (empty($dopost)) $dopost = "";
//保存更改
if($dopost=="save")
{
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for(;$startID<=$endID;$startID++)
{
for (; $startID <= $endID; $startID++) {
$query = '';
$tid = ${'ID_'.$startID};
$pname = ${'pname_'.$startID};
$money = ${'money_'.$startID};
$num = ${'num_'.$startID};
if(isset(${'check_'.$startID}))
{
if($pname!='')
{
$tid = ${'ID_' . $startID};
$pname = ${'pname_' . $startID};
$money = ${'money_' . $startID};
$num = ${'num_' . $startID};
if (isset(${'check_' . $startID})) {
if ($pname != '') {
$query = "UPDATE #@__moneycard_type SET pname='$pname',money='$money',num='$num' WHERE tid='$tid'";
$dsql->ExecuteNoneQuery($query);
$query = "UPDATE #@__moneycard_record SET money='$money',num='$num' WHERE ctid='$tid' ; ";
$dsql->ExecuteNoneQuery($query);
}
}
else
{
} else {
$query = "DELETE FROM #@__moneycard_type WHERE tid='$tid' ";
$dsql->ExecuteNoneQuery($query);
$query = "DELETE FROM #@__moneycard_record WHERE ctid='$tid' AND isexp<>-1 ; ";
@@ -44,12 +39,11 @@ if($dopost=="save")
}
//增加新记录
if(isset($check_new) && $pname_new!='')
{
if (isset($check_new) && $pname_new != '') {
$query = "INSERT INTO #@__moneycard_type(num,pname,money) VALUES('{$num_new}','{$pname_new}','{$money_new}');";
$dsql->ExecuteNoneQuery($query);
}
header("Content-Type: text/html; charset={$cfg_soft_lang}");
echo "<script> alert('成功更新点卡产品分类表!'); </script>";
}
require_once(DEDEADMIN."/templets/cards_type.htm");
require_once(DEDEADMIN . "/templets/cards_type.htm");

+ 94
- 130
src/dede/catalog_add.php View File

@@ -1,64 +1,57 @@
<?php
/**
* 栏目添加
*
* @version $Id: catalog_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/typelink.class.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/typelink.class.php");
if(empty($listtype)) $listtype='';
if(empty($dopost)) $dopost = '';
if(empty($upinyin)) $upinyin = 0;
if(empty($channelid)) $channelid = 1;
if(isset($channeltype)) $channelid = $channeltype;
if (empty($listtype)) $listtype = '';
if (empty($dopost)) $dopost = '';
if (empty($upinyin)) $upinyin = 0;
if (empty($channelid)) $channelid = 1;
if (isset($channeltype)) $channelid = $channeltype;
$id = empty($id) ? 0 :intval($id);
$reid = empty($reid) ? 0 :intval($reid);
$id = empty($id) ? 0 : intval($id);
$reid = empty($reid) ? 0 : intval($reid);
$nid = 'article';
if($id==0 && $reid==0)
{
if ($id == 0 && $reid == 0) {
CheckPurview('t_New');
}
else
{
} else {
$checkID = empty($id) ? $reid : $id;
CheckPurview('t_AccNew');
CheckCatalog($checkID, '你无权在本栏目下创建子类!');
}
if(empty($myrow)) $myrow = array();
if (empty($myrow)) $myrow = array();
$dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id");
$dsql->Execute();
while($row=$dsql->GetObject())
{
while ($row = $dsql->GetObject()) {
$channelArray[$row->id]['typename'] = $row->typename;
$channelArray[$row->id]['nid'] = $row->nid;
if($row->id==$channelid)
{
if ($row->id == $channelid) {
$nid = $row->nid;
}
}
if($dopost=='quick')
{
if ($dopost == 'quick') {
$tl = new TypeLink(0);
$typeOptions = $tl->GetOptionArray(0,0,$channelid);
$typeOptions = $tl->GetOptionArray(0, 0, $channelid);
include DedeInclude('templets/catalog_add_quick.htm');
exit();
}
/*---------------------
function action_savequick(){ }
---------------------*/
else if($dopost=='savequick')
{
if(!isset($savetype)) $savetype = '';
$isdefault = isset($isdefault)? $isdefault : 0;
---------------------*/ else if ($dopost == 'savequick') {
if (!isset($savetype)) $savetype = '';
$isdefault = isset($isdefault) ? $isdefault : 0;
$tempindex = "{style}/index_{$nid}.htm";
$templist = "{style}/list_{$nid}.htm";
$temparticle = "{style}/article_{$nid}.htm";
@@ -66,86 +59,72 @@ else if($dopost=='savequick')
tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`)
VALUES('~reid~','~topid~','~rank~','~typename~','~typedir~','$isdefault','$defaultname','$issend','$channeltype',
'$tempindex','$templist','$temparticle','default','$namerule','$namerule2','0','0','','','~typename~','0','','','0','0','0','','')";
if (empty($savetype))
{
foreach($_POST as $k=>$v)
{
if(preg_match("#^posttype#", $k))
{
if (empty($savetype)) {
foreach ($_POST as $k => $v) {
if (preg_match("#^posttype#", $k)) {
$k = str_replace('posttype', '', $k);
}
else
{
} else {
continue;
}
$rank = ${'rank'.$k};
$toptypename = trim(${'toptype'.$k});
$sontype = trim(${'sontype'.$k});
$rank = ${'rank' . $k};
$toptypename = trim(${'toptype' . $k});
$sontype = trim(${'sontype' . $k});
$toptypedir = GetPinyin(stripslashes($toptypename));
$toptypedir = $referpath=='parent' ? $nextdir.'/'.$toptypedir : '/'.$toptypedir;
if(empty($toptypename))
{
$toptypedir = $referpath == 'parent' ? $nextdir . '/' . $toptypedir : '/' . $toptypedir;
if (empty($toptypename)) {
continue;
}
$sql = str_replace('~reid~','0',$queryTemplate);
$sql = str_replace('~topid~','0',$sql);
$sql = str_replace('~rank~',$rank,$sql);
$sql = str_replace('~typename~',$toptypename,$sql);
$sql = str_replace('~typedir~',$toptypedir,$sql);
$sql = str_replace('~reid~', '0', $queryTemplate);
$sql = str_replace('~topid~', '0', $sql);
$sql = str_replace('~rank~', $rank, $sql);
$sql = str_replace('~typename~', $toptypename, $sql);
$sql = str_replace('~typedir~', $toptypedir, $sql);
$dsql->ExecuteNoneQuery($sql);
$tid = $dsql->GetLastID();
if($tid>0 && $sontype!='')
{
$sontypes = explode(',',$sontype);
foreach($sontypes as $k=>$v)
{
if ($tid > 0 && $sontype != '') {
$sontypes = explode(',', $sontype);
foreach ($sontypes as $k => $v) {
$v = trim($v);
if($v=='')
{
if ($v == '') {
continue;
}
$typedir = $toptypedir.'/'.GetPinyin(stripslashes($v));
$sql = str_replace('~reid~',$tid,$queryTemplate);
$sql = str_replace('~topid~',$tid,$sql);
$sql = str_replace('~rank~',$k,$sql);
$sql = str_replace('~typename~',$v,$sql);
$sql = str_replace('~typedir~',$typedir,$sql);
$typedir = $toptypedir . '/' . GetPinyin(stripslashes($v));
$sql = str_replace('~reid~', $tid, $queryTemplate);
$sql = str_replace('~topid~', $tid, $sql);
$sql = str_replace('~rank~', $k, $sql);
$sql = str_replace('~typename~', $v, $sql);
$sql = str_replace('~typedir~', $typedir, $sql);
$dsql->ExecuteNoneQuery($sql);
}
}
}
} else {
$row = $dsql->GetOne("SELECT `typedir` FROM `#@__arctype` WHERE `id`={$reid}");
foreach($_POST as $k=>$v)
{
if(preg_match("#^posttype#", $k))
{
foreach ($_POST as $k => $v) {
if (preg_match("#^posttype#", $k)) {
$k = str_replace('posttype', '', $k);
}
else
{
} else {
continue;
}
$rank = ${'rank'.$k};
$toptypename = trim(${'reltype'.$k});
$rank = ${'rank' . $k};
$toptypename = trim(${'reltype' . $k});
$toptypedir = GetPinyin(stripslashes($toptypename));
switch ($referpath) {
case 'parent':
$toptypedir = $nextdir.'/'.$toptypedir;
$toptypedir = $nextdir . '/' . $toptypedir;
break;
case 'typepath':
$toptypedir = isset($row['typedir'])? $row['typedir'].'/'.$toptypedir : '/'.$toptypedir;
break;
$toptypedir = isset($row['typedir']) ? $row['typedir'] . '/' . $toptypedir : '/' . $toptypedir;
break;
default:
$toptypedir = '/'.$toptypedir;
$toptypedir = '/' . $toptypedir;
break;
}
if(empty($toptypename))
{
if (empty($toptypename)) {
continue;
}
$sql = str_replace('~reid~', $reid, $queryTemplate);
@@ -157,73 +136,63 @@ else if($dopost=='savequick')
}
}
UpDateCatCache();
ShowMsg('成功增加指定栏目!','catalog_main.php');
ShowMsg('成功增加指定栏目!', 'catalog_main.php');
exit();
}
/*---------------------
function action_save(){ }
---------------------*/
else if($dopost=='save')
{
---------------------*/ else if ($dopost == 'save') {
$smalltypes = '';
if(empty($smalltype)) $smalltype = '';
if(is_array($smalltype)) $smalltypes = join(',',$smalltype);
if(!isset($sitepath)) $sitepath = '';
if($topid==0 && $reid>0) $topid = $reid;
if($ispart!=0) $cross = 0;
$description = Html2Text($description,1);
$keywords = Html2Text($keywords,1);
if($ispart != 2 )
{
if (empty($smalltype)) $smalltype = '';
if (is_array($smalltype)) $smalltypes = join(',', $smalltype);
if (!isset($sitepath)) $sitepath = '';
if ($topid == 0 && $reid > 0) $topid = $reid;
if ($ispart != 0) $cross = 0;
$description = Html2Text($description, 1);
$keywords = Html2Text($keywords, 1);
if ($ispart != 2) {
//栏目的参照目录
if($referpath=='cmspath') $nextdir = '{cmspath}';
if($referpath=='basepath') $nextdir = '';
if ($referpath == 'cmspath') $nextdir = '{cmspath}';
if ($referpath == 'basepath') $nextdir = '';
//用拼音命名
if($upinyin==1 || $typedir=='')
{
if ($upinyin == 1 || $typedir == '') {
$typedir = GetPinyin(stripslashes($typename));
}
$typedir = $nextdir.'/'.$typedir;
$typedir = $nextdir . '/' . $typedir;
$typedir = preg_replace("#\/{1,}#", "/", $typedir);
}
//开启多站点时的设置(仅针对顶级栏目)
if($reid==0 && $moresite==1)
{
if ($reid == 0 && $moresite == 1) {
$sitepath = $typedir;
//检测二级网址
if($siteurl!='')
{
if ($siteurl != '') {
$siteurl = preg_replace("#\/$#", "", $siteurl);
if(!preg_match("#http:\/\/#i", $siteurl))
{
ShowMsg("你绑定的二级域名无效,请用(http://host)的形式!","-1");
if (!preg_match("#http:\/\/#i", $siteurl)) {
ShowMsg("你绑定的二级域名无效,请用(http://host)的形式!", "-1");
exit();
}
if(preg_match("#".$cfg_basehost."#i", $siteurl))
{
ShowMsg("你绑定的二级域名与当前站点是同一个域,不需要绑定!","-1");
if (preg_match("#" . $cfg_basehost . "#i", $siteurl)) {
ShowMsg("你绑定的二级域名与当前站点是同一个域,不需要绑定!", "-1");
exit();
}
}
}
//创建目录
if($ispart != 2)
{
if ($ispart != 2) {
$true_typedir = str_replace("{cmspath}", $cfg_cmspath, $typedir);
$true_typedir = preg_replace("#\/{1,}#", "/", $true_typedir);
if(!CreateDir($true_typedir))
{
ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!","-1");
if (!CreateDir($true_typedir)) {
ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!", "-1");
exit();
}
}
$in_query = "INSERT INTO `#@__arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype,
tempindex,templist,temparticle,modname,namerule,namerule2,
ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`)
@@ -231,24 +200,20 @@ else if($dopost=='save')
'$tempindex','$templist','$temparticle','default','$namerule','$namerule2',
'$ispart','$corank','$description','$keywords','$seotitle','$moresite','$siteurl','$sitepath','$ishidden','$cross','$crossid','$content','$smalltypes')";
if(!$dsql->ExecuteNoneQuery($in_query))
{
ShowMsg("保存目录数据时失败,请检查你的输入资料是否存在问题!","-1");
if (!$dsql->ExecuteNoneQuery($in_query)) {
ShowMsg("保存目录数据时失败,请检查你的输入资料是否存在问题!", "-1");
exit();
}
UpDateCatCache();
if($reid>0)
{
PutCookie('lastCid',GetTopid($reid),3600*24,'/');
if ($reid > 0) {
PutCookie('lastCid', GetTopid($reid), 3600 * 24, '/');
}
ShowMsg("成功创建一个分类!","catalog_main.php");
ShowMsg("成功创建一个分类!", "catalog_main.php");
exit();
}//End dopost==save
} //End dopost==save
//获取从父目录继承的默认参数
if($dopost=='')
{
if ($dopost == '') {
$channelid = 1;
$issend = 1;
$corank = 0;
@@ -256,8 +221,7 @@ if($dopost=='')
$topid = 0;
$typedir = '';
$moresite = 0;
if($id>0)
{
if ($id > 0) {
$myrow = $dsql->GetOne(" SELECT tp.*,ch.typename AS ctypename FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id=$id ");
$channelid = $myrow['channeltype'];
$issennd = $myrow['issend'];
@@ -270,4 +234,4 @@ if($dopost=='')
$moresite = empty($myrow['moresite']) ? 0 : $myrow['moresite'];
}
include DedeInclude('templets/catalog_add.htm');
include DedeInclude('templets/catalog_add.htm');

+ 17
- 17
src/dede/catalog_del.php View File

@@ -1,42 +1,42 @@
<?php
/**
* 删除栏目
*
* @version $Id: catalog_del.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(dirname(__FILE__) . '/config.php');
//检查权限许可
CheckPurview('t_Del,t_AccDel');
require_once(DEDEINC.'/typeunit.class.admin.php');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(DEDEINC . '/typeunit.class.admin.php');
require_once(DEDEINC . '/oxwindow.class.php');
$id = trim(preg_replace("#[^0-9]#", '', $id));
//检查栏目操作许可
CheckCatalog($id,"你无权删除本栏目!");
if(empty($dopost)) $dopost='';
if($dopost=='ok')
{
CheckCatalog($id, "你无权删除本栏目!");
if (empty($dopost)) $dopost = '';
if ($dopost == 'ok') {
$ut = new TypeUnit();
$ut->DelType($id,$delfile);
$ut->DelType($id, $delfile);
UpDateCatCache();
ShowMsg("成功删除一个栏目!","catalog_main.php");
ShowMsg("成功删除一个栏目!", "catalog_main.php");
exit();
}
$dsql->SetQuery("SELECT typename,typedir FROM #@__arctype WHERE id=".$id);
$dsql->SetQuery("SELECT typename,typedir FROM #@__arctype WHERE id=" . $id);
$row = $dsql->GetOne();
$wintitle = "删除栏目确认";
$wecome_info = "<a href='catalog_main.php'>栏目管理</a> &gt;&gt; 删除栏目确认";
$win = new OxWindow();
$win->Init('catalog_del.php','js/blank.js','POST');
$win->AddHidden('id',$id);
$win->AddHidden('dopost','ok');
$win->Init('catalog_del.php', 'js/blank.js', 'POST');
$win->AddHidden('id', $id);
$win->AddHidden('dopost', 'ok');
$win->AddTitle("你要确实要删除栏目: [{$row['typename']}] 吗?");
$win->AddItem('栏目的文件保存目录:',$row['typedir']);
$win->AddItem('是否删除文件:',"<label><input type='radio' name='delfile' class='np' value='no' checked='1' /> 否</label> <label>&nbsp;<input type='radio' name='delfile' class='np' value='yes' /> 是</label>");
$win->AddItem('栏目的文件保存目录:', $row['typedir']);
$win->AddItem('是否删除文件:', "<label><input type='radio' name='delfile' class='np' value='no' checked='1' /> 否</label> <label>&nbsp;<input type='radio' name='delfile' class='np' value='yes' /> 是</label>");
$winform = $win->GetWindow('ok');
$win->Display();
$win->Display();

+ 1
- 1
src/dede/catalog_do.php View File

@@ -4,7 +4,7 @@
* 栏目操作
*
* @version $Id: catalog_do.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


+ 141
- 158
src/dede/catalog_edit.php View File

@@ -1,16 +1,17 @@
<?php
/**
* 栏目编辑
*
* @version $Id: catalog_edit.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/typelink.class.php");
if(empty($dopost)) $dopost = '';
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/typelink.class.php");
if (empty($dopost)) $dopost = '';
$id = isset($id) ? intval($id) : 0;
//检查权限许可
@@ -22,19 +23,17 @@ CheckCatalog($id, '你无权更改本栏目!');
/*-----------------------
function action_save()
----------------------*/
if($dopost=="save")
{
$description = Html2Text($description,1);
$keywords = Html2Text($keywords,1);
if ($dopost == "save") {
$description = Html2Text($description, 1);
$keywords = Html2Text($keywords, 1);
$uptopsql = $smalltypes = '';
if(isset($smalltype) && is_array($smalltype)) $smalltypes = join(',',$smalltype);
if($topid==0)
{
if (isset($smalltype) && is_array($smalltype)) $smalltypes = join(',', $smalltype);
if ($topid == 0) {
$sitepath = $typedir;
$uptopsql = " ,siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' ";
}
if($ispart!=0) $cross = 0;
if ($ispart != 0) $cross = 0;
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
sortrank='$sortrank',
@@ -63,29 +62,25 @@ if($dopost=="save")
$uptopsql
WHERE id='$id' ";
if(!$dsql->ExecuteNoneQuery($upquery))
{
ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!","-1");
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1");
exit();
}
//如果选择子栏目可投稿,更新顶级栏目为可投稿
if($topid>0 && $issend==1)
{
if ($topid > 0 && $issend == 1) {
$dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
}
$slinks = " id IN (".GetSonIds($id).")";
$slinks = " id IN (" . GetSonIds($id) . ")";
//修改顶级栏目时强制修改下级的多站点支持属性
if($topid==0 && preg_match("#,#", $slinks))
{
if ($topid == 0 && preg_match("#,#", $slinks)) {
$upquery = "UPDATE `#@__arctype` SET moresite='$moresite', siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' WHERE 1=1 AND $slinks";
$dsql->ExecuteNoneQuery($upquery);
}
//更改子栏目属性
if(!empty($upnext))
{
if (!empty($upnext)) {
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
defaultname='$defaultname',
@@ -97,38 +92,33 @@ if($dopost=="save")
namerule2='$namerule2',
ishidden='$ishidden'
WHERE 1=1 AND $slinks";
if(!$dsql->ExecuteNoneQuery($upquery))
{
ShowMsg("更改当前栏目成功,但更改下级栏目属性时失败!","-1");
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("更改当前栏目成功,但更改下级栏目属性时失败!", "-1");
exit();
}
}
UpDateCatCache();
ShowMsg("成功更改一个分类!","catalog_main.php");
ShowMsg("成功更改一个分类!", "catalog_main.php");
exit();
}//End Save Action
else if ($dopost=="savetime")
{
} //End Save Action
else if ($dopost == "savetime") {
$uptopsql = '';
$slinks = " id IN (".GetSonIds($id).")";
$slinks = " id IN (" . GetSonIds($id) . ")";
//顶级栏目二级域名根目录处理
if($topid==0 && $moresite==1)
{
if ($topid == 0 && $moresite == 1) {
$sitepath = $typedir;
$uptopsql = " ,sitepath='$sitepath' ";
if(preg_match("#,#", $slinks))
{
if (preg_match("#,#", $slinks)) {
$upquery = "UPDATE `#@__arctype` SET sitepath='$sitepath' WHERE $slinks";
$dsql->ExecuteNoneQuery($upquery);
}
}
//如果选择子栏目可投稿,更新顶级栏目为可投稿
if($topid > 0 && $issend==1)
{
if ($topid > 0 && $issend == 1) {
$dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
}
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
sortrank='$sortrank',
@@ -139,14 +129,13 @@ else if ($dopost=="savetime")
ispart='$ispart',
corank='$corank' $uptopsql
WHERE id='$id' ";
if(!$dsql->ExecuteNoneQuery($upquery))
{
ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!","-1");
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1");
exit();
}
UpDateCatCache();
ShowMsg("成功更改一个分类!","catalog_main.php");
ShowMsg("成功更改一个分类!", "catalog_main.php");
exit();
}
@@ -154,137 +143,131 @@ else if ($dopost=="savetime")
$dsql->SetQuery("SELECT tp.*,ch.typename as ctypename FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id=$id");
$myrow = $dsql->GetOne();
$topid = $myrow['topid'];
if($topid>0)
{
if ($topid > 0) {
$toprow = $dsql->GetOne("SELECT moresite,siteurl,sitepath FROM `#@__arctype` WHERE id=$topid");
foreach($toprow as $k=>$v)
{
if(!preg_match("#[0-9]#", $k))
{
foreach ($toprow as $k => $v) {
if (!preg_match("#[0-9]#", $k)) {
$myrow[$k] = $v;
}
}
}
$myrow['content']=empty($myrow['content'])? "&nbsp;" : $myrow['content'];
$myrow['content'] = empty($myrow['content']) ? "&nbsp;" : $myrow['content'];
//读取频道模型信息
$channelid = $myrow['channeltype'];
$dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id");
$dsql->Execute();
while($row = $dsql->GetObject())
{
while ($row = $dsql->GetObject()) {
$channelArray[$row->id]['typename'] = $row->typename;
$channelArray[$row->id]['nid'] = $row->nid;
if($row->id==$channelid)
{
if ($row->id == $channelid) {
$nid = $row->nid;
}
}
PutCookie('lastCid',GetTopid($id),3600*24,"/");
if($dopost == 'time')
{
?>
<form name="form1" action="catalog_edit.php" method="post" onSubmit="return checkSubmit();">
<input type="hidden" name="dopost" value="savetime" />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="topid" value="<?php echo $myrow['topid']; ?>" />
<input type="hidden" name="moresite" value="<?php echo $myrow['moresite']; ?>" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class='bline' height="26" align="center" colspan="2">
<a href='catalog_edit.php?id=<?php echo $id; ?>'><u>当前是快捷编辑模式,如果您要修改更详细的参数,请使用高级模式&gt;&gt;</u></a>
</td>
</tr>
<tr>
<td width="150" class='bline' height="26" align="center">是否支持投稿:</td>
<td class='bline'>
<label><input type='radio' name='issend' value='0' class='np' <?php if($myrow['issend']=="0") echo " checked='1' ";?> />
不支持</label>&nbsp;
<label><input type='radio' name='issend' value='1' class='np' <?php if($myrow['issend']=="1") echo " checked='1' ";?> />
支持</label></td>
</tr>
<!-- 在快速修改更改内容模型后,因为模板没改变,会导致错误,因此去除些选择框。 -->
<tr>
<td class='bline' height="26" align="center"><font color='red'>内容模型:</font> </td>
<td class='bline'>
<?php
foreach($channelArray as $k=>$arr)
{
if($k==$channelid) echo "{$arr['typename']} | {$arr['nid']}";
}
?>
<a href='catalog_edit.php?id=<?php echo $id; ?>'><u>[修改]</u></a>
</td>
</tr>
<tr>
<td class='bline' height="26" align="center"><font color='red'>栏目名称:</font></td>
<td class='bline'><input name="typename" type="text" id="typename" size="30" value="<?php echo $myrow['typename']?>" class="iptxt" /></td>
</tr>
<tr>
<td class='bline' height="26" align="center"> 排列顺序: </td>
<td class='bline'> <input name="sortrank" size="6" type="text" value="<?php echo $myrow['sortrank']?>" class="iptxt" />
(由低 -&gt; 高) </td>
</tr>
<tr>
<td class='bline' height="26" align="center">浏览权限:</td>
<td class='bline'> <select name="corank" id="corank" style="width:100">
<?php
$dsql->SetQuery("SELECT * FROM #@__arcrank WHERE rank >= 0");
$dsql->Execute();
while($row = $dsql->GetObject())
{
if($myrow['corank']==$row->rank)
echo "<option value='".$row->rank."' selected>".$row->membername."</option>\r\n";
else
echo "<option value='".$row->rank."'>".$row->membername."</option>\r\n";
}
?>
</select>
(仅限制栏目里的文档浏览权限) </td>
</tr>
<tr>
<td class='bline' height="26" align="center">文件保存目录:</td>
<td class='bline'><input name="typedir" type="text" id="typedir" value="<?php echo $myrow['typedir']?>" style="width:300px" class="iptxt" /></td>
</tr>
<tr>
<td height="26" align="center" class='bline'>栏目列表选项:</td>
<td class='bline'>
<label><input type='radio' name='isdefault' value='1' class='np'<?php if($myrow['isdefault']==1) echo " checked='1' ";?>/>
链接到默认页</label>
<label><input type='radio' name='isdefault' value='0' class='np'<?php if($myrow['isdefault']==0) echo " checked='1' ";?>/>
链接到列表第一页</label>
<label><input type='radio' name='isdefault' value='-1' class='np'<?php if($myrow['isdefault']==-1) echo " checked='1' ";?>/>
使用动态页</label> </td>
</tr>
<tr>
<td class='bline' height="26" align="center">默认页的名称: </td>
<td class='bline'><input name="defaultname" type="text" value="<?php echo $myrow['defaultname']?>" class="iptxt" /></td>
</tr>
<tr>
<td height="26" class='bline' align="center">栏目属性:</td>
<td class='bline'>
<label><input name="ispart" type="radio" id="radio" value="0" class='np'<?php if($myrow['ispart']==0) echo " checked='1' ";?>/>
最终列表栏目(允许在本栏目发布文档,并生成文档列表)</label><br>
<label><input name="ispart" type="radio" id="radio2" value="1" class='np'<?php if($myrow['ispart']==1) echo " checked='1' ";?>/>
PutCookie('lastCid', GetTopid($id), 3600 * 24, "/");
if ($dopost == 'time') {
?>
<form name="form1" action="catalog_edit.php" method="post" onSubmit="return checkSubmit();">
<input type="hidden" name="dopost" value="savetime" />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="topid" value="<?php echo $myrow['topid']; ?>" />
<input type="hidden" name="moresite" value="<?php echo $myrow['moresite']; ?>" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class='bline' height="26" align="center" colspan="2">
<a href='catalog_edit.php?id=<?php echo $id; ?>'><u>当前是快捷编辑模式,如果您要修改更详细的参数,请使用高级模式&gt;&gt;</u></a>
</td>
</tr>
<tr>
<td width="150" class='bline' height="26" align="center">是否支持投稿:</td>
<td class='bline'>
<label><input type='radio' name='issend' value='0' class='np' <?php if ($myrow['issend'] == "0") echo " checked='1' "; ?> />
不支持</label>&nbsp;
<label><input type='radio' name='issend' value='1' class='np' <?php if ($myrow['issend'] == "1") echo " checked='1' "; ?> />
支持</label></td>
</tr>
<!-- 在快速修改更改内容模型后,因为模板没改变,会导致错误,因此去除些选择框。 -->
<tr>
<td class='bline' height="26" align="center">
<font color='red'>内容模型:</font>
</td>
<td class='bline'>
<?php
foreach ($channelArray as $k => $arr) {
if ($k == $channelid) echo "{$arr['typename']} | {$arr['nid']}";
}
?>
<a href='catalog_edit.php?id=<?php echo $id; ?>'><u>[修改]</u></a>
</td>
</tr>
<tr>
<td class='bline' height="26" align="center">
<font color='red'>栏目名称:</font>
</td>
<td class='bline'><input name="typename" type="text" id="typename" size="30" value="<?php echo $myrow['typename'] ?>" class="iptxt" /></td>
</tr>
<tr>
<td class='bline' height="26" align="center"> 排列顺序: </td>
<td class='bline'> <input name="sortrank" size="6" type="text" value="<?php echo $myrow['sortrank'] ?>" class="iptxt" />
(由低 -&gt; 高) </td>
</tr>
<tr>
<td class='bline' height="26" align="center">浏览权限:</td>
<td class='bline'> <select name="corank" id="corank" style="width:100">
<?php
$dsql->SetQuery("SELECT * FROM #@__arcrank WHERE rank >= 0");
$dsql->Execute();
while ($row = $dsql->GetObject()) {
if ($myrow['corank'] == $row->rank)
echo "<option value='" . $row->rank . "' selected>" . $row->membername . "</option>\r\n";
else
echo "<option value='" . $row->rank . "'>" . $row->membername . "</option>\r\n";
}
?>
</select>
(仅限制栏目里的文档浏览权限) </td>
</tr>
<tr>
<td class='bline' height="26" align="center">文件保存目录:</td>
<td class='bline'><input name="typedir" type="text" id="typedir" value="<?php echo $myrow['typedir'] ?>" style="width:300px" class="iptxt" /></td>
</tr>
<tr>
<td height="26" align="center" class='bline'>栏目列表选项:</td>
<td class='bline'>
<label><input type='radio' name='isdefault' value='1' class='np' <?php if ($myrow['isdefault'] == 1) echo " checked='1' "; ?> />
链接到默认页</label>
<label><input type='radio' name='isdefault' value='0' class='np' <?php if ($myrow['isdefault'] == 0) echo " checked='1' "; ?> />
链接到列表第一页</label>
<label><input type='radio' name='isdefault' value='-1' class='np' <?php if ($myrow['isdefault'] == -1) echo " checked='1' "; ?> />
使用动态页</label> </td>
</tr>
<tr>
<td class='bline' height="26" align="center">默认页的名称: </td>
<td class='bline'><input name="defaultname" type="text" value="<?php echo $myrow['defaultname'] ?>" class="iptxt" /></td>
</tr>
<tr>
<td height="26" class='bline' align="center">栏目属性:</td>
<td class='bline'>
<label><input name="ispart" type="radio" id="radio" value="0" class='np' <?php if ($myrow['ispart'] == 0) echo " checked='1' "; ?> />
最终列表栏目(允许在本栏目发布文档,并生成文档列表)</label><br>
<label><input name="ispart" type="radio" id="radio2" value="1" class='np' <?php if ($myrow['ispart'] == 1) echo " checked='1' "; ?> />
频道封面(栏目本身不允许发布文档)</label><br>
<label><input name="ispart" type="radio" id="radio3" value="2" class='np'<?php if($myrow['ispart']==2) echo " checked='1' ";?>/>
外部连接(在"文件保存目录"处填写网址) </label> </td>
</tr>
<tr>
<td align="center" colspan="2" height="54" bgcolor='#FAFEE0'>
<input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np"/>
&nbsp;&nbsp;&nbsp;
<a title='关闭' onclick='CloseMsg()'><img src="images/button_back.gif" width="60" height="22" border="0"></a>
</td>
</tr>
</table>
</form>
<?php
频道封面(栏目本身不允许发布文档)</label><br>
<label><input name="ispart" type="radio" id="radio3" value="2" class='np' <?php if ($myrow['ispart'] == 2) echo " checked='1' "; ?> />
外部连接(在"文件保存目录"处填写网址) </label> </td>
</tr>
<tr>
<td align="center" colspan="2" height="54" bgcolor='#FAFEE0'>
<input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np" />
&nbsp;&nbsp;&nbsp;
<a title='关闭' onclick='CloseMsg()'><img src="images/button_back.gif" width="60" height="22" border="0"></a>
</td>
</tr>
</table>
</form>
<?php
exit();
}
else
{
} else {
include DedeInclude('templets/catalog_edit.htm');
}
?>

+ 5
- 4
src/dede/catalog_main.php View File

@@ -1,14 +1,15 @@
<?php
/**
* 栏目管理
*
* @version $Id: catalog_main.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/typeunit.class.admin.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/typeunit.class.admin.php");
$userChannel = $cuserLogin->getUserChannel();
include DedeInclude('templets/catalog_main.htm');
include DedeInclude('templets/catalog_main.htm');

+ 9
- 11
src/dede/catalog_menu.php View File

@@ -1,26 +1,24 @@
<?php
/**
* 栏目菜单
*
* @version $Id: catalog_menu.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/typeunit.class.menu.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/typeunit.class.menu.php");
$userChannel = $cuserLogin->getUserChannel();
if(empty($opendir)) $opendir=-1;
if($userChannel>0) $opendir=$userChannel;
if (empty($opendir)) $opendir = -1;
if ($userChannel > 0) $opendir = $userChannel;
if($cuserLogin->adminStyle=='dedecms')
{
if ($cuserLogin->adminStyle == 'dedecms') {
include DedeInclude('templets/catalog_menu.htm');
exit();
}
else
{
} else {
include DedeInclude('templets/catalog_menu2.htm');
exit();
}
}

+ 54
- 80
src/dede/co_add.php View File

@@ -1,42 +1,37 @@
<?php
/**
* 采集规则添加
*
* @version $Id: co_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('co_AddNote');
if(empty($step)) $step = "";
if(empty($exrule)) $exrule = "";
if (empty($step)) $step = "";
if (empty($exrule)) $exrule = "";
//选择操作频道类型,载入表单
/*----------------------
function Init(){ }
----------------------*/
if(empty($step))
{
require_once(DEDEADMIN."/templets/co_add_step0.htm");
if (empty($step)) {
require_once(DEDEADMIN . "/templets/co_add_step0.htm");
exit();
}
else if($step==1)
{
require_once(DEDEADMIN."/templets/co_add_step1.htm");
} else if ($step == 1) {
require_once(DEDEADMIN . "/templets/co_add_step1.htm");
exit();
}
//保存索引规则
/*----------------------
function Save_List(){ }
----------------------*/
else if($step==2)
{
----------------------*/ else if ($step == 2) {
//对完整规则进行测试
if($dopost=='test')
{
include(DEDEINC."/dedecollection.class.php");
if ($dopost == 'test') {
include(DEDEINC . "/dedecollection.class.php");
$usemore = (!isset($usemore) ? 0 : 1);
$listconfig = "{dede:noteinfo notename=\\\"$notename\\\" channelid=\\\"$channelid\\\" macthtype=\\\"$macthtype\\\"
refurl=\\\"$refurl\\\" sourcelang=\\\"$sourcelang\\\" cosort=\\\"$cosort\\\" isref=\\\"$isref\\\" exptime=\\\"$exptime\\\" usemore=\\\"$usemore\\\" /}
@@ -52,70 +47,58 @@ startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$ur
{/dede:listrule}\r\n";
$tmplistconfig = stripslashes($listconfig);
$notename = stripslashes($notename);
if($sourcetype=='rss' && $refurl='')
{
if ($sourcetype == 'rss' && $refurl = '') {
$refurl = $rssurl;
}
$refurl = stripslashes($refurl);
$errmsg = '';
$freq = empty($freq)? "" : $freq;
$extypeid = empty($freq)? "" : $extypeid;
$freq = empty($freq) ? "" : $freq;
$extypeid = empty($freq) ? "" : $extypeid;
//测试规则
if($sourcetype=='rss')
{
if ($sourcetype == 'rss') {
$links = GetRssLinks(stripslashes($rssurl));
$demopage = $rssurl;
}
else
{
} else {
$links = array();
$lists = GetUrlFromListRule($regxurl,stripslashes($addurls),$startid,$endid,$addv,$usemore,stripslashes($batchrule));
if(isset($lists[0][0]))
{
$lists = GetUrlFromListRule($regxurl, stripslashes($addurls), $startid, $endid, $addv, $usemore, stripslashes($batchrule));
if (isset($lists[0][0])) {
$demopage = $lists[0][0];
$dc = new DedeCollection();
$dc->LoadListConfig($tmplistconfig);
$listurl = '';
$links = $dc->Testlists($listurl);
$errmsg = $dc->errString;
}
else
{
} else {
$demopage = '没有匹配到适合的列表页!';
}
}
require_once(DEDEADMIN."/templets/co_add_step1_test.htm");
require_once(DEDEADMIN . "/templets/co_add_step1_test.htm");
exit();
}
//从预览并提示进入下一步
else
{
else {
$row = $dsql->GetOne("SELECT nid,channelid FROM `#@__co_note` WHERE isok=0 AND notename LIKE '$notename' ");
if(!is_array($row))
{
if (!is_array($row)) {
$uptime = time();
$listconfig = urldecode($listconfig);
$inquery = " INSERT INTO `#@__co_note`(`channelid`,`notename`,`sourcelang`,`uptime`,`cotime`,`pnum`,`isok`,`usemore`,`listconfig`,`itemconfig`)
VALUES ('$channelid','$notename','$sourcelang','$uptime','0','0','0','$usemore','$listconfig',''); ";
$rs = $dsql->ExecuteNoneQuery($inquery);
if(!$rs)
{
ShowMsg("保存信息时出现错误!".$dsql->GetError(),"-1");
if (!$rs) {
ShowMsg("保存信息时出现错误!" . $dsql->GetError(), "-1");
exit();
}
$nid = $dsql->GetLastID();
}
else
{
$channelid=$row['channelid'];
} else {
$channelid = $row['channelid'];
$uptime = time();
if(empty($freq)) $freq = 1;
if(empty($extypeid)) $extypeid = 0;
if(empty($islisten)) $islisten = 0;
if (empty($freq)) $freq = 1;
if (empty($extypeid)) $extypeid = 0;
if (empty($islisten)) $islisten = 0;
$usemore = (!isset($usemore) ? 0 : 1);
$query = " UPDATE `#@__co_note` SET
`channelid`='$channelid',
`notename`='$notename',
@@ -127,9 +110,9 @@ startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$ur
$dsql->ExecuteNoneQuery($query);
$nid = $row['nid'];
}
if(!isset($previewurl)) $previewurl = '';
require_once(DEDEINC.'/dedetag.class.php');
require_once(DEDEADMIN."/templets/co_add_step2.htm");
if (!isset($previewurl)) $previewurl = '';
require_once(DEDEINC . '/dedetag.class.php');
require_once(DEDEADMIN . "/templets/co_add_step2.htm");
exit();
}
}
@@ -137,9 +120,7 @@ startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$ur
//保存文章规则
/*----------------------
function Save_Art(){ }
----------------------*/
else if($step==5)
{
----------------------*/ else if ($step == 5) {
/*
[previewurl] => ''
*/
@@ -147,42 +128,35 @@ else if($step==5)
$itemconfig .= "{dede:previewurl}$previewurl{/dede:previewurl}\r\n";
$itemconfig .= "{dede:keywordtrim}$keywordtrim{/dede:keywordtrim}\r\n";
$itemconfig .= "{dede:descriptiontrim}$descriptiontrim{/dede:descriptiontrim}\r\n";
$fs = explode(',','value,match,isunit,isdown,trim,function');
foreach($fields as $field)
{
foreach($fs as $f)
{
$GLOBALS[$f.'_'.$field] = (!isset($GLOBALS[$f.'_'.$field]) ? '' : $GLOBALS[$f.'_'.$field]);
$fs = explode(',', 'value,match,isunit,isdown,trim,function');
foreach ($fields as $field) {
foreach ($fs as $f) {
$GLOBALS[$f . '_' . $field] = (!isset($GLOBALS[$f . '_' . $field]) ? '' : $GLOBALS[$f . '_' . $field]);
}
$matchstr = $GLOBALS["match_".$field];
$trimstr = $GLOBALS["trim_".$field];
$trimstr = trim(str_replace('&nbsp;','#n#',$trimstr));
$matchstr = trim(str_replace('&nbsp;','#n#',$matchstr));
if($trimstr!='' && !preg_match("#{dede:trim#i", $trimstr))
{
$matchstr = $GLOBALS["match_" . $field];
$trimstr = $GLOBALS["trim_" . $field];
$trimstr = trim(str_replace('&nbsp;', '#n#', $trimstr));
$matchstr = trim(str_replace('&nbsp;', '#n#', $matchstr));
if ($trimstr != '' && !preg_match("#{dede:trim#i", $trimstr)) {
$trimstr = " {dede:trim}$trimstr{/dede:trim}\r\n";
}
$itemconfig .= "{dede:item field=\\'".$field."\\' value=\\'".$GLOBALS["value_".$field]."\\' isunit=\\'".$GLOBALS["isunit_".$field]."\\' isdown=\\'".$GLOBALS["isdown_".$field]."\\'}
{dede:match}".$matchstr."{/dede:match}
$itemconfig .= "{dede:item field=\\'" . $field . "\\' value=\\'" . $GLOBALS["value_" . $field] . "\\' isunit=\\'" . $GLOBALS["isunit_" . $field] . "\\' isdown=\\'" . $GLOBALS["isdown_" . $field] . "\\'}
{dede:match}" . $matchstr . "{/dede:match}
$trimstr
{dede:function}".$GLOBALS["function_".$field]."{/dede:function}
{dede:function}" . $GLOBALS["function_" . $field] . "{/dede:function}
{/dede:item}\r\n";
}
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET itemconfig='$itemconfig' WHERE nid='$nid' ");
//echo $dsql->GetError();
require_once(DEDEINC.'/dedecollection.class.php');
require_once(DEDEADMIN."/templets/co_add_step2_test.htm");
require_once(DEDEINC . '/dedecollection.class.php');
require_once(DEDEADMIN . "/templets/co_add_step2_test.htm");
exit();
}
else if($step==6)
{
} else if ($step == 6) {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET isok='1' WHERE nid='$nid' ");
ShowMsg("成功设置一个规则!","co_main.php");
ShowMsg("成功设置一个规则!", "co_main.php");
exit();
}
else if($step==7)
{
} else if ($step == 7) {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET isok='1' WHERE nid='$nid' ");
ShowMsg("成功设置一个规则,现在转向采集页面!","co_gather_start.php?nid=$nid");
ShowMsg("成功设置一个规则,现在转向采集页面!", "co_gather_start.php?nid=$nid");
exit();
}
}

+ 79
- 124
src/dede/co_do.php View File

@@ -1,16 +1,17 @@
<?php
/**
* 采集操作
*
* @version $Id: co_do.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/oxwindow.class.php");
if(!isset($nid)) $nid=0;
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/oxwindow.class.php");
if (!isset($nid)) $nid = 0;
$ENV_GOBACK_URL = empty($_COOKIE["ENV_GOBACK_URL"]) ? "co_url.php" : $_COOKIE["ENV_GOBACK_URL"];
//删除节点
@@ -18,14 +19,13 @@ $ENV_GOBACK_URL = empty($_COOKIE["ENV_GOBACK_URL"]) ? "co_url.php" : $_COOKIE["E
/*
function co_delete()
*/
if($dopost=="delete")
{
if ($dopost == "delete") {
CheckPurview('co_Del');
$nid = intval($nid);
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='$nid'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_note` WHERE nid='$nid'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls` WHERE nid='$nid'");
ShowMsg("成功删除一个节点!","co_main.php");
ShowMsg("成功删除一个节点!", "co_main.php");
exit();
}
@@ -33,185 +33,149 @@ if($dopost=="delete")
//清空采集内容时仍会保留旧的网址索引,在监控模式下始终采集新的内容
/*
function url_clear()
*/
else if($dopost=="clear")
{
*/ else if ($dopost == "clear") {
CheckPurview('co_Del');
if(!isset($ids)) $ids='';
if(empty($ids))
{
if(!empty($nid))
{
if (!isset($ids)) $ids = '';
if (empty($ids)) {
if (!empty($nid)) {
$nid = intval($nid);
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='$nid'");
}
ShowMsg("成功清空一个节点采集的内容!","co_main.php");
ShowMsg("成功清空一个节点采集的内容!", "co_main.php");
exit();
}
else
{
if(!empty($clshash))
{
} else {
if (!empty($clshash)) {
$dsql->SetQuery("SELECT nid,url FROM `#@__co_htmls` WHERE aid IN($ids) ");
$dsql->Execute();
while($arr = $dsql->GetArray())
{
while ($arr = $dsql->GetArray()) {
$nhash = md5($arr['url']);
$nid = $row['nid'];
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls ` WHERE nid='$nid' AND hash='$nhash' ");
}
}
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE aid IN($ids) ");
ShowMsg("成功删除指定的网址内容!",$ENV_GOBACK_URL);
ShowMsg("成功删除指定的网址内容!", $ENV_GOBACK_URL);
exit();
}
}
else if($dopost=="clearct")
{
} else if ($dopost == "clearct") {
CheckPurview('co_Del');
if(!empty($ids))
{
if (!empty($ids)) {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET isdown=0,result='' WHERE aid IN($ids) ");
}
ShowMsg("成功清除所有内容!",$ENV_GOBACK_URL);
ShowMsg("成功清除所有内容!", $ENV_GOBACK_URL);
exit();
}
/*
function url_clearall()
*/
else if($dopost=="clearall")
{
*/ else if ($dopost == "clearall") {
CheckPurview('co_Del');
$dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` ");
ShowMsg("成功清空所有采集的临时内容!","co_main.php");
ShowMsg("成功清空所有采集的临时内容!", "co_main.php");
exit();
}
//内容替换
/*
function co_replace() { }
*/
else if($dopost=="replace")
{
*/ else if ($dopost == "replace") {
//if()
//$nid $aid $regtype $fdstring $rpstring
$rpstring = trim($rpstring);
if($regtype=='string')
{
if ($regtype == 'string') {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET `result`=REPLACE(`result`,'$fdstring','$rpstring') WHERE nid='$nid' ");
}
else
{
} else {
//返回一条测试结果,并要求用户确认操作
if(empty($rpok))
{
if (empty($rpok)) {
$fdstring = stripslashes($fdstring);
$rpstring = stripslashes($rpstring);
$hiddenrpvalue = "<textarea name='fdstring' style='display:none'>{$fdstring}</textarea>\r\n<textarea name='rpstring' style='display:none'>{$rpstring}</textarea>\r\n";
$fdstring = str_replace("\\/","#ASZZ#",$fdstring);
$fdstring = str_replace('/',"\\/",$fdstring);
$fdstring = str_replace('#ASZZ#',"\\/",$fdstring);
$fdstring = str_replace("\\/", "#ASZZ#", $fdstring);
$fdstring = str_replace('/', "\\/", $fdstring);
$fdstring = str_replace('#ASZZ#', "\\/", $fdstring);
$result = $rs = stripslashes($rs);
if($fdstring!='')
{
$result = trim(preg_replace("/$fdstring/isU",$rpstring,$rs));
if ($fdstring != '') {
$result = trim(preg_replace("/$fdstring/isU", $rpstring, $rs));
}
$wintitle = "采集管理-内容替换";
$wecome_info = "<a href='co_main.php'>采集管理</a>::内容替换";
$win = new OxWindow();
$win->Init("co_do.php","js/blank.js","POST");
$win->AddHidden('dopost',$dopost);
$win->AddHidden('nid',$nid);
$win->AddHidden('regtype','regex');
$win->AddHidden('aid',$aid);
$win->AddHidden('rpok','ok');
$win->Init("co_do.php", "js/blank.js", "POST");
$win->AddHidden('dopost', $dopost);
$win->AddHidden('nid', $nid);
$win->AddHidden('regtype', 'regex');
$win->AddHidden('aid', $aid);
$win->AddHidden('rpok', 'ok');
$win->AddTitle("内容替换操作确认:如果下面结果正确,点击确认,系统将替换当前节点所有内容!{$hiddenrpvalue}");
$win->AddItem("原来的内容:","<textarea name='rs' style='width:90%;height:250px'>{$rs}</textarea>\r\n");
$win->AddItem("按规则替换后的内容:","<textarea name='okrs' style='width:90%;height:250px'>{$result}</textarea>\r\n");
$win->AddItem("原来的内容:", "<textarea name='rs' style='width:90%;height:250px'>{$rs}</textarea>\r\n");
$win->AddItem("按规则替换后的内容:", "<textarea name='okrs' style='width:90%;height:250px'>{$result}</textarea>\r\n");
$winform = $win->GetWindow("ok");
$win->Display();
exit();
}
else
{
if($fdstring!='')
{
} else {
if ($fdstring != '') {
$dsql->SetQuery("SELECT `aid`,`result` FROM `#@__co_htmls` WHERE nid='$nid' ");
$dsql->Execute();
while($row = $dsql->GetArray())
{
while ($row = $dsql->GetArray()) {
$fdstring = stripslashes($fdstring);
$rpstring = stripslashes($rpstring);
$fdstring = str_replace("\\/","#ASZZ#",$fdstring);
$fdstring = str_replace('/',"\\/",$fdstring);
$fdstring = str_replace('#ASZZ#',"\\/",$fdstring);
$result = trim(preg_replace("/$fdstring/isU",$rpstring,$row['result']));
$fdstring = str_replace("\\/", "#ASZZ#", $fdstring);
$fdstring = str_replace('/', "\\/", $fdstring);
$fdstring = str_replace('#ASZZ#', "\\/", $fdstring);
$result = trim(preg_replace("/$fdstring/isU", $rpstring, $row['result']));
$result = addslashes($result);
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET `result`='$result' WHERE aid='{$row['aid']}' ");
}
}
}
}
ShowMsg("成功替换当前节点所有数据!","co_view.php?aid=$aid");
ShowMsg("成功替换当前节点所有数据!", "co_view.php?aid=$aid");
exit();
}
//复制节点
/*
function co_copy()
*/
else if($dopost=="copy")
{
*/ else if ($dopost == "copy") {
CheckPurview('co_AddNote');
if(empty($mynotename))
{
if (empty($mynotename)) {
$wintitle = "采集管理-复制节点";
$wecome_info = "<a href='co_main.php'>采集管理</a>::复制节点";
$win = new OxWindow();
$win->Init("co_do.php","js/blank.js","POST");
$win->AddHidden("dopost",$dopost);
$win->AddHidden("nid",$nid);
$win->Init("co_do.php", "js/blank.js", "POST");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("nid", $nid);
$win->AddTitle("请输入新节点名称:");
$win->AddItem("新节点名称:","<input type='text' name='mynotename' value='' size='30' />");
$win->AddItem("新节点名称:", "<input type='text' name='mynotename' value='' size='30' />");
$winform = $win->GetWindow("ok");
$win->Display();
exit();
}
$row = $dsql->GetOne("SELECT * FROM `#@__co_note` WHERE nid='$nid'");
foreach($row as $k=>$v)
{
if(!isset($$k))
{
foreach ($row as $k => $v) {
if (!isset($$k)) {
$$k = addslashes($v);
}
}
$usemore = (empty($usemore) ? '0' : $usemore);
$inQuery = " INSERT INTO `#@__co_note`(`channelid`,`notename`,`sourcelang`,`uptime`,`cotime`,`pnum`,`isok`,`listconfig`,`itemconfig`,`usemore`)
VALUES ('$channelid','$mynotename','$sourcelang','".time()."','0','0','0','$listconfig','$itemconfig','$usemore'); ";
VALUES ('$channelid','$mynotename','$sourcelang','" . time() . "','0','0','0','$listconfig','$itemconfig','$usemore'); ";
$dsql->ExecuteNoneQuery($inQuery);
ShowMsg("成功复制一个节点!",$ENV_GOBACK_URL);
ShowMsg("成功复制一个节点!", $ENV_GOBACK_URL);
exit();
}
//测试Rss源是否正确
/*-----------------------
function co_testrss()
-------------------------*/
else if($dopost=="testrss")
{
-------------------------*/ else if ($dopost == "testrss") {
CheckPurview('co_AddNote');
$msg = '';
if($rssurl=='')
{
if ($rssurl == '') {
$msg = '你没有指定RSS地址!';
}
else
{
include(DEDEINC."/dedecollection.func.php");
} else {
include(DEDEINC . "/dedecollection.func.php");
$arr = GetRssLinks($rssurl);
$msg = "从 {$rssurl} 发现的网址:<br />";
$i=1;
if(is_array($arr))
{
foreach($arr as $ar)
{
$i = 1;
if (is_array($arr)) {
foreach ($arr as $ar) {
$msg .= "<hr size='1' />\r\n";
$msg .= "link: {$ar['link']}<br />title: {$ar['title']}<br />image: {$ar['image']}\r\n";
$i++;
@@ -229,23 +193,17 @@ else if($dopost=="testrss")
//测试批量网址是否正确
/*-----------------------
function co_testregx()
-------------------------*/
else if($dopost=="testregx")
{
-------------------------*/ else if ($dopost == "testregx") {
CheckPurview('co_AddNote');
$msg = '';
if($regxurl=='')
{
if ($regxurl == '') {
$msg = '你没有指定匹配的网址!';
}
else
{
include(DEDEINC."/dedecollection.func.php");
} else {
include(DEDEINC . "/dedecollection.func.php");
$msg = "匹配的网址:<br />";
$lists = GetUrlFromListRule($regxurl, '', $startid, $endid, $addv);
foreach($lists as $surl)
{
$msg .= $surl[0]."<br />\r\n";
foreach ($lists as $surl) {
$msg .= $surl[0] . "<br />\r\n";
}
}
$wintitle = "采集管理-测试匹配规则";
@@ -260,28 +218,25 @@ else if($dopost=="testregx")
//采集未下载内容
/*--------------------
function co_all()
---------------------*/
else if($dopost=="coall")
{
---------------------*/ else if ($dopost == "coall") {
CheckPurview('co_PlayNote');
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` ");
$totalnum = $mrow['dd'];
if($totalnum==0)
{
ShowMsg("没发现可下载的内容!","-1");
if ($totalnum == 0) {
ShowMsg("没发现可下载的内容!", "-1");
exit();
}
$wintitle = "采集管理-采集未下载内容";
$wecome_info = "<a href='co_main.php'>采集管理</a>::采集未下载内容";
$win = new OxWindow();
$win->Init("co_gather_start_action.php","js/blank.js","GET");
$win->AddHidden('startdd','0');
$win->AddHidden('pagesize','5');
$win->AddHidden('sptime','0');
$win->AddHidden('nid','0');
$win->AddHidden('totalnum',$totalnum);
$win->Init("co_gather_start_action.php", "js/blank.js", "GET");
$win->AddHidden('startdd', '0');
$win->AddHidden('pagesize', '5');
$win->AddHidden('sptime', '0');
$win->AddHidden('nid', '0');
$win->AddHidden('totalnum', $totalnum);
$win->AddMsgItem("本操作会检测并下载‘<a href='co_url.php'><u>临时内容</u></a>’中所有未下载的内容,是否继续?");
$winform = $win->GetWindow("ok");
$win->Display();
exit();
}
}

+ 48
- 76
src/dede/co_edit.php View File

@@ -1,29 +1,28 @@
<?php
/**
* 采集规则编辑
*
* @version $Id: co_edit.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(dirname(__FILE__) . '/config.php');
CheckPurview('co_EditNote');
require_once(DEDEINC.'/dedetag.class.php');
require_once(DEDEINC . '/dedetag.class.php');
$nid = (isset($nid) ? intval($nid) : '');
if($nid=='')
{
ShowMsg('参数无效!','-1');
if ($nid == '') {
ShowMsg('参数无效!', '-1');
exit();
}
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
/*----------------------
function _Save()
----------------------*/
if($dopost=='save' || $dopost=='saveandtest')
{
if ($dopost == 'save' || $dopost == 'saveandtest') {
$usemore = (!isset($usemore) ? 0 : 1);
$listconfig = "{dede:noteinfo notename=\\\"$notename\\\" channelid=\\\"$channelid\\\" macthtype=\\\"$macthtype\\\"
refurl=\\\"$refurl\\\" sourcelang=\\\"$sourcelang\\\" cosort=\\\"$cosort\\\"
@@ -41,32 +40,29 @@ startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$ur
$itemconfig .= "{dede:previewurl}$previewurl{/dede:previewurl}\r\n";
$itemconfig .= "{dede:keywordtrim}$keywordtrim{/dede:keywordtrim}\r\n";
$itemconfig .= "{dede:descriptiontrim}$descriptiontrim{/dede:descriptiontrim}\r\n";
$fs = explode(',','value,match,isunit,isdown,trim,function');
foreach($fields as $field)
{
foreach($fs as $f)
{
$GLOBALS[$f.'_'.$field] = (!isset($GLOBALS[$f.'_'.$field]) ? '' : $GLOBALS[$f.'_'.$field]);
$fs = explode(',', 'value,match,isunit,isdown,trim,function');
foreach ($fields as $field) {
foreach ($fs as $f) {
$GLOBALS[$f . '_' . $field] = (!isset($GLOBALS[$f . '_' . $field]) ? '' : $GLOBALS[$f . '_' . $field]);
}
$matchstr = $GLOBALS["match_".$field];
$trimstr = $GLOBALS["trim_".$field];
$matchstr = $GLOBALS["match_" . $field];
$trimstr = $GLOBALS["trim_" . $field];
$trimstr = trim(str_replace('&nbsp;', '#n#', $trimstr));
$matchstr = trim(str_replace('&nbsp;', '#n#', $matchstr));
if($trimstr!='' && !preg_match("#{dede:trim#isU", $trimstr))
{
if ($trimstr != '' && !preg_match("#{dede:trim#isU", $trimstr)) {
$trimstr = " {dede:trim}$trimstr{/dede:trim}\r\n";
}
$itemconfig .= "{dede:item field=\\'".$field."\\' value=\\'".$GLOBALS["value_".$field]."\\' isunit=\\'".$GLOBALS["isunit_".$field]."\\' isdown=\\'".$GLOBALS["isdown_".$field]."\\'}
{dede:match}".$matchstr."{/dede:match}
$itemconfig .= "{dede:item field=\\'" . $field . "\\' value=\\'" . $GLOBALS["value_" . $field] . "\\' isunit=\\'" . $GLOBALS["isunit_" . $field] . "\\' isdown=\\'" . $GLOBALS["isdown_" . $field] . "\\'}
{dede:match}" . $matchstr . "{/dede:match}
$trimstr
{dede:function}".$GLOBALS["function_".$field]."{/dede:function}
{dede:function}" . $GLOBALS["function_" . $field] . "{/dede:function}
{/dede:item}";
}
$uptime = time();
if(empty($freq)) $freq = 1;
if(empty($extypeid)) $extypeid = 0;
if(empty($islisten)) $islisten = 0;
if (empty($freq)) $freq = 1;
if (empty($extypeid)) $extypeid = 0;
if (empty($islisten)) $islisten = 0;
$query = " UPDATE `#@__co_note` SET
`channelid`='$channelid',
@@ -80,27 +76,23 @@ startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$ur
WHERE nid='$nid'; ";
$rs = $dsql->ExecuteNoneQuery($query);
echo $dsql->GetError();
if($donext=='save')
{
ShowMsg("成功保存配置!","co_main.php");
}
else
{
require_once(dirname(__FILE__)."/co_test_rule.php");
if ($donext == 'save') {
ShowMsg("成功保存配置!", "co_main.php");
} else {
require_once(dirname(__FILE__) . "/co_test_rule.php");
}
exit();
}
$arr = $dsql->GetOne("SELECT * FROM `#@__co_note` WHERE nid='$nid'");
//如果内容规则未设置,转到设置内容规则的表单
if(trim($arr['itemconfig'])=='')
{
if (trim($arr['itemconfig']) == '') {
$channelid = $arr['channelid'];
$nid = $arr['nid'];
if(!isset($previewurl)) $previewurl = '';
if (!isset($previewurl)) $previewurl = '';
require_once(DEDEINC.'/dedetag.class.php');
require_once(DEDEADMIN."/templets/co_add_step2.htm");
require_once(DEDEINC . '/dedetag.class.php');
require_once(DEDEADMIN . "/templets/co_add_step2.htm");
exit();
}
$usemore = $arr['usemore'];
@@ -109,48 +101,32 @@ $notes = array();
$dsql->FreeResult();
$dtp = new DedeTagParse();
$dtp2 = new DedeTagParse();
$dtp->LoadString($arr['listconfig'].$arr['itemconfig']);
$dtp->LoadString($arr['listconfig'] . $arr['itemconfig']);
$channelid = $arr['channelid'];
$notes['keywordtrim'] = '';
$notes['descriptiontrim'] = '';
foreach($dtp->CTags as $tid => $ctag)
{
if($ctag->GetName()=='item')
{
foreach ($dtp->CTags as $tid => $ctag) {
if ($ctag->GetName() == 'item') {
$f = $ctag->GetAtt('field');
$notes[$f]['item'] = $ctag;
$dtp2->LoadString($ctag->GetInnerText());
$notes[$f]['trim'] = '';
foreach($dtp2->CTags as $ctag2)
{
if($ctag2->GetName()=='trim')
{
$notes[$f]['trim'] .= "{dede:trim replace=\"".$ctag2->GetAtt('replace')."\"}".$ctag2->GetInnerText()."{/dede:trim}\r\n";
}
else if($ctag2->GetName()=='match')
{
$notes[$f]['match'] = $ctag2->GetInnerText()."\r\n";
}
else if($ctag2->GetName()=='function')
{
$notes[$f]['function'] = $ctag2->GetInnerText()."\r\n";
foreach ($dtp2->CTags as $ctag2) {
if ($ctag2->GetName() == 'trim') {
$notes[$f]['trim'] .= "{dede:trim replace=\"" . $ctag2->GetAtt('replace') . "\"}" . $ctag2->GetInnerText() . "{/dede:trim}\r\n";
} else if ($ctag2->GetName() == 'match') {
$notes[$f]['match'] = $ctag2->GetInnerText() . "\r\n";
} else if ($ctag2->GetName() == 'function') {
$notes[$f]['function'] = $ctag2->GetInnerText() . "\r\n";
}
}
}
else if($ctag->GetName()=='keywordtrim')
{
} else if ($ctag->GetName() == 'keywordtrim') {
$notes['keywordtrim'] = $ctag->GetInnerText();
}
else if($ctag->GetName()=='descriptiontrim')
{
} else if ($ctag->GetName() == 'descriptiontrim') {
$notes['descriptiontrim'] = $ctag->GetInnerText();
}
else if($ctag->GetName()=='noteinfo')
{
} else if ($ctag->GetName() == 'noteinfo') {
$noteinfo = $ctag;
}
else if($ctag->GetName()=='listrule')
{
} else if ($ctag->GetName() == 'listrule') {
$listrule = $ctag;
$dtp2->LoadString($ctag->GetInnerText());
$addurls = $dtp2->GetTagByName('addurls');
@@ -158,15 +134,11 @@ foreach($dtp->CTags as $tid => $ctag)
$areastart = $dtp2->GetTagByName('areastart');
$areaend = $dtp2->GetTagByName('areaend');
$batchrule = $dtp2->GetTagByName('batchrule');
}
else if($ctag->GetName()=='sppage')
{
} else if ($ctag->GetName() == 'sppage') {
$sppage = $ctag;
}
else if($ctag->GetName()=='previewurl')
{
} else if ($ctag->GetName() == 'previewurl') {
$previewurl = trim($ctag->GetInnerText());
}
}
if(!isset($previewurl)) $previewurl = '';
require_once(DEDEADMIN.'/templets/co_edit.htm');
if (!isset($previewurl)) $previewurl = '';
require_once(DEDEADMIN . '/templets/co_edit.htm');

+ 9
- 11
src/dede/co_edit_text.php View File

@@ -1,20 +1,20 @@
<?php
/**
* 采集规则编辑-专家更改模式
*
* @version $Id: co_edit_text.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require(dirname(__FILE__)."/config.php");
require(dirname(__FILE__) . "/config.php");
CheckPurview('co_EditNote');
if(empty($job)) $job='';
if (empty($job)) $job = '';
if($job=='')
{
require_once(DEDEINC."/oxwindow.class.php");
if ($job == '') {
require_once(DEDEINC . "/oxwindow.class.php");
$wintitle = "更改采集规则";
$wecome_info = "<a href='co_main.php'><u>采集点管理</u></a>::更改采集规则 - 专家更改模式";
$win = new OxWindow();
@@ -29,12 +29,10 @@ if($job=='')
$winform = $win->GetWindow("ok");
$win->Display();
exit();
}
else
{
} else {
CheckPurview('co_EditNote');
$query = "UPDATE `#@__co_note` SET listconfig='$listconfig',itemconfig='$itemconfig' WHERE nid='$nid' ";
$rs = $dsql->ExecuteNoneQuery($query);
ShowMsg("成功修改一个规则!","co_main.php");
ShowMsg("成功修改一个规则!", "co_main.php");
exit();
}
}

+ 73
- 132
src/dede/co_export.php View File

@@ -1,69 +1,59 @@
<?php
/**
* 导出采集规则
*
* @version $Id: co_edit_text.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('co_Export');
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
if($dopost!='done')
{
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
if ($dopost != 'done') {
require_once(DEDEADMIN . "/inc/inc_catalog_options.php");
$totalcc = $channelid = $usemore = 0;
if(!empty($nid))
{
if (!empty($nid)) {
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' AND isdown='1' ");
$totalcc = $mrow['dd'];
$rrow = $dsql->GetOne("SELECT channelid,usemore FROM `#@__co_note` WHERE nid='$nid' ");
$channelid = $rrow['channelid'];
$usemore = $rrow['usemore'];
}
else
{
} else {
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE isdown='1' ");
$totalcc = $mrow['dd'];
}
include DedeInclude("templets/co_export.htm");
exit();
}
else
{
require_once(DEDEINC.'/dedecollection.class.php');
} else {
require_once(DEDEINC . '/dedecollection.class.php');
$channelid = isset($channelid) && is_numeric($channelid) ? $channelid : 0;
$typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0;
$pageno = isset($pageno) && is_numeric($pageno) ? $pageno : 1;
$startid = isset($startid) && is_numeric($startid) ? $startid : 0;
$endid = isset($endid) && is_numeric($endid) ? $endid : 0;
if(!isset($makehtml)) $makehtml = 0;
if(!isset($onlytitle)) $onlytitle = 0;
if(!isset($usetitle)) $usetitle = 0;
if(!isset($autotype)) $autotype = 0;
if (!isset($makehtml)) $makehtml = 0;
if (!isset($onlytitle)) $onlytitle = 0;
if (!isset($usetitle)) $usetitle = 0;
if (!isset($autotype)) $autotype = 0;
$co = new DedeCollection();
$co->LoadNote($nid);
$orderway = (($co->noteInfos['cosort']=='desc' || $co->noteInfos['cosort']=='asc') ? $co->noteInfos['cosort'] : 'desc');
if($channelid==0 && $typeid==0)
{
ShowMsg('请指定默认导出栏目或频道ID!','javascript:;');
$orderway = (($co->noteInfos['cosort'] == 'desc' || $co->noteInfos['cosort'] == 'asc') ? $co->noteInfos['cosort'] : 'desc');
if ($channelid == 0 && $typeid == 0) {
ShowMsg('请指定默认导出栏目或频道ID!', 'javascript:;');
exit();
}
if($channelid==0)
{
if ($channelid == 0) {
$row = $dsql->GetOne("SELECT ch.* FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id='$typeid'; ");
}
else
{
} else {
$row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'; ");
}
if(!is_array($row))
{
if (!is_array($row)) {
echo "找不到频道内容模型信息,无法完成操作!";
exit();
}
@@ -72,9 +62,8 @@ else
$channelid = $row['id'];
$maintable = $row['maintable'];
$addtable = $row['addtable'];
if(empty($maintable)) $maintable = '#@__archives';
if(empty($addtable))
{
if (empty($maintable)) $maintable = '#@__archives';
if (empty($addtable)) {
echo "找不主表配置信息,无法完成操作!";
exit();
}
@@ -90,37 +79,26 @@ else
//生成附加表插入的SQL语句
$inadd_f = $inadd_v = '';
$dtp = new DedeTagParse();
$dtp->SetNameSpace('field','<','>');
$dtp->SetNameSpace('field', '<', '>');
$dtp->LoadString($row['fieldset']);
foreach($dtp->CTags as $ctag)
{
foreach ($dtp->CTags as $ctag) {
$tname = $ctag->GetTagName();
$inadd_f .= ",`$tname`";
$notsend = $ctag->GetAtt('notsend');
$fieldtype = $ctag->GetAtt('type');
if($notsend==1)
{
if ($notsend == 1) {
//对不同类型设置默认值
if($ctag->GetAtt('default')!='')
{
if ($ctag->GetAtt('default') != '') {
$dfvalue = $ctag->GetAtt('default');
}
else if($fieldtype=='int' || $fieldtype=='float' || $fieldtype=='number')
{
} else if ($fieldtype == 'int' || $fieldtype == 'float' || $fieldtype == 'number') {
$dfvalue = '0';
}
else if($fieldtype=='dtime')
{
} else if ($fieldtype == 'dtime') {
$dfvalue = time();
}
else
{
} else {
$dfvalue = '';
}
$inadd_v .= ",'$dfvalue'";
}
else
{
} else {
$inadd_v .= ",'@$tname@'";
}
}
@@ -129,69 +107,53 @@ else
//导出数据的SQL操作
$dtp = new DedeTagParse();
$totalpage = $totalcc / $pagesize;
$startdd = ($pageno-1) * $pagesize;
if(!empty($nid))
{
$startdd = ($pageno - 1) * $pagesize;
if (!empty($nid)) {
$dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE nid='$nid' AND isdown='1' ORDER BY aid $orderway LIMIT $startdd,$pagesize");
}
else
{
} else {
$dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE isdown='1' ORDER BY aid $orderway LIMIT $startdd,$pagesize");
}
$dsql->Execute();
while($row = $dsql->GetObject())
{
if(trim($row->result=='')) continue;
while ($row = $dsql->GetObject()) {
if (trim($row->result == '')) continue;
//$addSqlTemplate,$mainSqlTemplate,$indexSqlTemplate
$ntypeid = ($autotype==1 && $row->typeid != 0) ? $row->typeid : $typeid;
$ntypeid = ($autotype == 1 && $row->typeid != 0) ? $row->typeid : $typeid;
$indexSql = str_replace('@typeid@', $ntypeid, $indexSqlTemplate);
$mainSql = str_replace('@typeid@', $ntypeid, $mainSqlTemplate);
$addSql = str_replace('@typeid@', $ntypeid, $addSqlTemplate);
$dtp->LoadString($row->result);
$exid = $row->aid;
if(!is_array($dtp->CTags)) continue;
if (!is_array($dtp->CTags)) continue;
//获取时间和标题
$pubdate = $sortrank = time();
$title = $row->title;
$litpic = '';
foreach ($dtp->CTags as $ctag)
{
foreach ($dtp->CTags as $ctag) {
$itemName = $ctag->GetAtt('name');
if($itemName == 'title' && $usetitle==0)
{
if ($itemName == 'title' && $usetitle == 0) {
$title = trim($ctag->GetInnerText());
if($title=='')
{
if ($title == '') {
$title = $row->title;
}
}
else if($itemName == 'pubdate')
{
} else if ($itemName == 'pubdate') {
$pubdate = trim($ctag->GetInnerText());
if(preg_match("#[^0-9]#", $pubdate))
{
if (preg_match("#[^0-9]#", $pubdate)) {
$pubdate = $sortrank = GetMkTime($pubdate);
}
else
{
} else {
$pubdate = $sortrank = time();
}
}
else if($itemName == 'litpic')
{
} else if ($itemName == 'litpic') {
$litpic = trim($ctag->GetInnerText());
}
}
//检测重复标题
$title = addslashes($title);
if($onlytitle)
{
if ($onlytitle) {
$testrow = $dsql->GetOne("SELECT COUNT(ID) AS dd FROM `$maintable` WHERE title LIKE '$title'");
if($testrow['dd']>0)
{
if ($testrow['dd'] > 0) {
echo "数据库已存在标题为: {$title} 的文档,程序阻止了此本条内容导入<br />\r\n";
continue;
}
@@ -200,15 +162,13 @@ else
//替换固定的项目
$senddate = time();
$flag = '';
if($litpic!='') $flag = 'p';
if ($litpic != '') $flag = 'p';
//随机推荐
if($randcc>0)
{
if ($randcc > 0) {
$rflag = mt_rand(1, $randcc);
if($rflag==$randcc)
{
$flag = ($flag=='' ? 'c' : $flag.',c');
if ($rflag == $randcc) {
$flag = ($flag == '' ? 'c' : $flag . ',c');
}
}
$indexSql = str_replace('@senddate@', $senddate, $indexSql);
@@ -218,15 +178,13 @@ else
$mainSql = str_replace('@pubdate@', $pubdate, $mainSql);
$mainSql = str_replace('@senddate@', $senddate, $mainSql);
$mainSql = str_replace('@title@', cn_substr($title, $cfg_title_maxlen), $mainSql);
//$mainSql = str_replace('@title@', cn_substr($title, 60), $mainSql); 原来的语句,采集的文章导出到栏目后标题不全
//$mainSql = str_replace('@title@', cn_substr($title, 60), $mainSql); 原来的语句,采集的文章导出到栏目后标题不全
$addSql = str_replace('@sortrank@', $sortrank, $addSql);
$addSql = str_replace('@senddate@', $senddate, $addSql);
//替换模型里的其它字段
foreach($dtp->CTags as $ctag)
{
if($ctag->GetName()!='field')
{
foreach ($dtp->CTags as $ctag) {
if ($ctag->GetName() != 'field') {
continue;
}
$itemname = $ctag->GetAtt('name');
@@ -237,25 +195,20 @@ else
//插入数据库
$rs = $dsql->ExecuteNoneQuery($indexSql);
if($rs)
{
if ($rs) {
$aid = $dsql->GetLastID();
$mainSql = str_replace('@aid@', $aid, $mainSql);
$addSql = str_replace('@aid@', $aid, $addSql);
$mainSql = preg_replace("#@([a-z0-9]{1,})@#", '', $mainSql);
$addSql = preg_replace("#@([a-z0-9]{1,})@#", '', $addSql);
$rs = $dsql->ExecuteNoneQuery($mainSql);
if(!$rs)
{
echo "导入 '$title' 时错误:".$dsql->GetError()."<br />";
if (!$rs) {
echo "导入 '$title' 时错误:" . $dsql->GetError() . "<br />";
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$aid' ");
}
else
{
} else {
$rs = $dsql->ExecuteNoneQuery($addSql);
if(!$rs)
{
echo "导入 '$title' 时错误:".$dsql->GetError()."<br />";
if (!$rs) {
echo "导入 '$title' 时错误:" . $dsql->GetError() . "<br />";
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$aid' ");
$dsql->ExecuteNoneQuery("DELETE FROM `$maintable` WHERE id='$aid' ");
}
@@ -265,43 +218,31 @@ else
}
//检测是否完成或后续操作
if($totalpage <= $pageno)
{
if($channelid>0 && $makehtml==1)
{
if( $autotype==0 && !empty($nid) )
{
if ($totalpage <= $pageno) {
if ($channelid > 0 && $makehtml == 1) {
if ($autotype == 0 && !empty($nid)) {
$mhtml = "makehtml_archives_action.php?typeid=$typeid&startid=$startid&endid=$endid&pagesize=20";
ShowMsg("完成数据导入,准备生成文档HTML...",$mhtml);
ShowMsg("完成数据导入,准备生成文档HTML...", $mhtml);
exit();
}
else
{
ShowMsg("完成所有数据导入,请手工更新HTML!","javascript:;");
} else {
ShowMsg("完成所有数据导入,请手工更新HTML!", "javascript:;");
exit();
}
}
else
{
ShowMsg("完成所有数据导入!","javascript:;");
} else {
ShowMsg("完成所有数据导入!", "javascript:;");
exit();
}
}
else
{
if($totalpage>0)
{
} else {
if ($totalpage > 0) {
$rs = substr(($pageno / $totalpage * 100), 0, 2);
}
else
{
} else {
$rs = 100;
}
$pageno++;
$gourl = "co_export.php?dopost=done&nid=$nid&totalcc=$totalcc&channelid=$channelid&pageno=$pageno";
$gourl .= "&nid=$nid&typeid=$typeid&autotype=$autotype&arcrank=$arcrank&pagesize=$pagesize&randcc=$randcc";
$gourl .= "&startid=$startid&endid=$endid&onlytitle=$onlytitle&usetitle=$usetitle&makehtml=$makehtml";
ShowMsg("完成 {$rs}% 导入,继续执行操作...",$gourl,'',500);
ShowMsg("完成 {$rs}% 导入,继续执行操作...", $gourl, '', 500);
exit();
}
}
}

+ 1
- 3
src/dede/co_export_corule.php View File

@@ -4,7 +4,7 @@
* 统一转换为unicode编码然后再base64加密
*
* @version $Id: co_export_corule.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
@@ -32,5 +32,3 @@ $win->Init();
$win->AddTitle("以下为规则 [{$row['notename']}] 的文本配置,你可以共享给你的朋友:");
$winform = $win->GetWindow("hand","<textarea name='config' style='width:100%;height:450px;word-wrap: break-word;word-break:break-all;'>".$noteconfig."</textarea>");
$win->Display();
?>

+ 8
- 11
src/dede/co_gather_start.php View File

@@ -1,28 +1,25 @@
<?php
/**
* 采集指定节点
*
* @version $Id: co_gather_start.php$
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/dedecollection.class.php");
if(!empty($nid))
{
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/dedecollection.class.php");
if (!empty($nid)) {
$ntitle = '采集指定节点:';
$nid = intval($nid);
$co = new DedeCollection();
$co->LoadNote($nid);
$row = $dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid'; ");
if($row['dd']==0)
{
if ($row['dd'] == 0) {
$unum = "没有记录或从来没有采集过这个节点!";
}
else
{
} else {
$unum = "共有 {$row['dd']} 个历史种子网址!<a href='javascript:SubmitNew();'>[<u>更新种子网址,并采集</u>]</a>";
}
} else {
@@ -31,4 +28,4 @@ if(!empty($nid))
$ntitle = '监控式采集:';
$unum = "没指定采集节点,将使用检测新内容采集模式!";
}
include DedeInclude('templets/co_gather_start.htm');
include DedeInclude('templets/co_gather_start.htm');

+ 35
- 51
src/dede/co_gather_start_action.php View File

@@ -1,87 +1,71 @@
<?php
/**
* 开始采集指定节点操作
*
* @version $Id: co_gather_start_action.php$
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('co_PlayNote');
require_once(DEDEINC.'/dedecollection.class.php');
if($totalnum==0)
{
ShowMsg('获取到的网址为零:可能是规则不对或没发现新内容!','javascript:;');
require_once(DEDEINC . '/dedecollection.class.php');
if ($totalnum == 0) {
ShowMsg('获取到的网址为零:可能是规则不对或没发现新内容!', 'javascript:;');
exit();
}
if(!isset($oldstart)) $oldstart = $startdd;
if(empty($notckpic)) $notckpic = 0;
if (!isset($oldstart)) $oldstart = $startdd;
if (empty($notckpic)) $notckpic = 0;
if($totalnum > $startdd+$pagesize) $limitSql = " LIMIT $startdd,$pagesize ";
else $limitSql = " LIMIT $startdd,".($totalnum - $startdd);
if ($totalnum > $startdd + $pagesize) $limitSql = " LIMIT $startdd,$pagesize ";
else $limitSql = " LIMIT $startdd," . ($totalnum - $startdd);
if($totalnum - $startdd < 1)
{
if(empty($nid))
{
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."'; ");
}
else
{
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."' WHERE nid='$nid'; ");
if ($totalnum - $startdd < 1) {
if (empty($nid)) {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "'; ");
} else {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "' WHERE nid='$nid'; ");
}
ShowMsg('完成当前下载任务!','javascript:;');
ShowMsg('完成当前下载任务!', 'javascript:;');
exit();
}
$co = new DedeCollection();
if(!empty($nid)) $co->LoadNote($nid);
if (!empty($nid)) $co->LoadNote($nid);
//没指定采集ID时下载所有内容
if(!empty($nid))
{
if (!empty($nid)) {
$dsql->SetQuery("SELECT aid,nid,url,isdown,litpic FROM `#@__co_htmls` WHERE nid=$nid $limitSql ");
}
else
{
} else {
$dsql->SetQuery("SELECT aid,nid,url,isdown,litpic FROM `#@__co_htmls` $limitSql ");
}
$dsql->Execute(99);
$tjnum = $startdd;
while($row = $dsql->GetObject(99))
{
if($row->isdown==0)
{
if(empty($nid)) $co->LoadNote($row->nid);
$co->DownUrl($row->aid,$row->url,$row->litpic);
while ($row = $dsql->GetObject(99)) {
if ($row->isdown == 0) {
if (empty($nid)) $co->LoadNote($row->nid);
$co->DownUrl($row->aid, $row->url, $row->litpic);
}
$tjnum++;
if($sptime>0) sleep($sptime);
if ($sptime > 0) sleep($sptime);
}
if($totalnum-$oldstart!=0)
{
$tjlen = ceil( (($tjnum-$oldstart)/($totalnum-$oldstart)) * 100 );
if ($totalnum - $oldstart != 0) {
$tjlen = ceil((($tjnum - $oldstart) / ($totalnum - $oldstart)) * 100);
$dvlen = $tjlen * 2;
$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:$dvlen;height:15;background-color:#829D83'></div></div>";
$tjsta .= "<br/>完成当前任务的:$tjlen %,继续执行任务...";
}
if($tjnum < $totalnum)
{
ShowMsg($tjsta, "co_gather_start_action.php?notckpic=$notckpic&sptime=$sptime&nid=$nid&oldstart=$oldstart&totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize","",0);
if ($tjnum < $totalnum) {
ShowMsg($tjsta, "co_gather_start_action.php?notckpic=$notckpic&sptime=$sptime&nid=$nid&oldstart=$oldstart&totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize", "", 0);
exit();
}
else
{
if(empty($nid))
{
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."'; ");
}
else
{
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."' WHERE nid='$nid'; ");
} else {
if (empty($nid)) {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "'; ");
} else {
$dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "' WHERE nid='$nid'; ");
}
ShowMsg("完成当前下载任务!","javascript:;");
ShowMsg("完成当前下载任务!", "javascript:;");
exit();
}
}

+ 1
- 3
src/dede/co_get_corule.php View File

@@ -3,7 +3,7 @@
* 导入采集规则
*
* @version $Id: co_get_corule.php 1 17:13 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
@@ -97,5 +97,3 @@ else
ShowMsg("成功导入一个规则!","co_main.php");
exit();
}
?>

+ 32
- 49
src/dede/co_getsource_url_action.php View File

@@ -1,21 +1,22 @@
<?php
/**
* 下载种子网址中未下载内容模式
*
* @version $Id: co_get_corule.php 1 17:13 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('co_PlayNote');
require_once(DEDEINC.'/dedecollection.class.php');
require_once(DEDEINC . '/dedecollection.class.php');
if(empty($islisten)) $islisten = 0;
if(empty($glstart)) $glstart = 0;
if(empty($totalnum)) $totalnum = 0;
if(empty($notckpic)) $notckpic = 0;
if (empty($islisten)) $islisten = 0;
if (empty($glstart)) $glstart = 0;
if (empty($totalnum)) $totalnum = 0;
if (empty($notckpic)) $notckpic = 0;
$nid = (isset($nid) ? intval($nid) : 0);
@@ -23,19 +24,15 @@ $nid = (isset($nid) ? intval($nid) : 0);
/*-----------------------------
function Download_not_down() { }
------------------------------*/
if($islisten==0)
{
if ($islisten == 0) {
$mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' ");
$totalnum = $mrow['dd'];
$gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime";
if($totalnum <= 0)
{
ShowMsg("你指定的模式为:<font color='red'>[下载种子网址中未下载内容]</font>,<br />使用这个模式节点必须已经有种子网址,否则请使用其它模式!","javascript:;");
if ($totalnum <= 0) {
ShowMsg("你指定的模式为:<font color='red'>[下载种子网址中未下载内容]</font>,<br />使用这个模式节点必须已经有种子网址,否则请使用其它模式!", "javascript:;");
exit();
}
else
{
ShowMsg("检测节点正常,现转向网页采集...",$gurl."&totalnum=$totalnum");
} else {
ShowMsg("检测节点正常,现转向网页采集...", $gurl . "&totalnum=$totalnum");
exit();
}
}
@@ -43,48 +40,38 @@ if($islisten==0)
//监控式采集(检测新内容)
/*-----------------------------
function Download_new() { }
------------------------------*/
else if($islisten==1)
{
------------------------------*/ else if ($islisten == 1) {
$gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=1&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime";
$gurlList = "co_getsource_url_action.php?islisten=1&nid=0&pagesize=$pagesize&sptime=$sptime";
//针对专门节点
if(!empty($nid))
{
if (!empty($nid)) {
$co = new DedeCollection();
$co->LoadNote($nid);
$limitList = $co->GetSourceUrl(1,0,100);
$limitList = $co->GetSourceUrl(1, 0, 100);
$row = $co->dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid' ");
$totalnum = $row['dd'];
if($totalnum==0)
{
ShowMsg("在这节点中没发现有新内容....","javascript:;");
if ($totalnum == 0) {
ShowMsg("在这节点中没发现有新内容....", "javascript:;");
exit();
}
else
{
ShowMsg("已获得所有种子网址,转向网页采集...",$gurl."&totalnum=$totalnum");
} else {
ShowMsg("已获得所有种子网址,转向网页采集...", $gurl . "&totalnum=$totalnum");
exit();
}
}
//针对所有节点
else
{
else {
$curpos = (isset($curpos) ? intval($curpos) : 0);
$row = $dsql->GetOne("SELECT nid FROM `#@__co_note` ORDER BY nid ASC LIMIT $curpos,1");
$nnid = $row['nid'];
if(!is_array($row))
{
ShowMsg("完成所有节点检测....","co_gather_start_action.php?notckpic=0&sptime=0&nid=0&startdd=0&pagesize=5&totalnum=".$totalnum);
if (!is_array($row)) {
ShowMsg("完成所有节点检测....", "co_gather_start_action.php?notckpic=0&sptime=0&nid=0&startdd=0&pagesize=5&totalnum=" . $totalnum);
exit();
}
else
{
} else {
$co = new DedeCollection();
$co->LoadNote($nnid);
$limitList = $co->GetSourceUrl(1,0,100);
$limitList = $co->GetSourceUrl(1, 0, 100);
$curpos++;
ShowMsg("已检测节点( {$nnid} ),继续下一个节点...",$gurlList."&curpos=$curpos");
ShowMsg("已检测节点( {$nnid} ),继续下一个节点...", $gurlList . "&curpos=$curpos");
exit();
}
}
@@ -92,24 +79,20 @@ else if($islisten==1)
//重新下载所有内容模式
/*-----------------------------
function Download_all() { }
------------------------------*/
else
{
------------------------------*/ else {
$gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime";
$gurlList = "co_getsource_url_action.php?islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime";
$co = new DedeCollection();
$co->LoadNote($nid);
$limitList = $co->GetSourceUrl($islisten, $glstart, $pagesize);
if($limitList==0)
{
if ($limitList == 0) {
$row = $co->dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid'");
$totalnum = $row['dd'];
ShowMsg("已获得所有种子网址,转向网页采集...",$gurl."&totalnum=$totalnum");
ShowMsg("已获得所有种子网址,转向网页采集...", $gurl . "&totalnum=$totalnum");
exit();
}
if($limitList>0)
{
ShowMsg("采集列表剩余:{$limitList} 个页面,继续采集...",$gurlList."&glstart=".($glstart+$pagesize),0,100);
if ($limitList > 0) {
ShowMsg("采集列表剩余:{$limitList} 个页面,继续采集...", $gurlList . "&glstart=" . ($glstart + $pagesize), 0, 100);
exit();
}
}
}

+ 8
- 7
src/dede/co_main.php View File

@@ -1,26 +1,27 @@
<?php
/**
* 采集规则管理
*
* @version $Id: co_main.php 1 17:13 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/datalistcp.class.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time()+3600, "/");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/datalistcp.class.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
$sql = "SELECT co.nid,co.channelid,co.notename,co.sourcelang,co.uptime,co.cotime,co.pnum,ch.typename";
$sql .= " FROM `#@__co_note` co LEFT JOIN `#@__channeltype` ch ON ch.id=co.channelid ORDER BY co.nid DESC";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/co_main.htm");
$dlist->SetTemplet(DEDEADMIN . "/templets/co_main.htm");
$dlist->SetSource($sql);
$dlist->display();
function GetDatePage($mktime)
{
return $mktime=='0' ? '从未采集过' : MyDate('Y-m-d',$mktime);
return $mktime == '0' ? '从未采集过' : MyDate('Y-m-d', $mktime);
}
function TjUrlNum($nid)
@@ -28,4 +29,4 @@ function TjUrlNum($nid)
global $dsql;
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' ");
return $row['dd'];
}
}

+ 5
- 4
src/dede/co_test_rule.php View File

@@ -1,17 +1,18 @@
<?php
/**
* 采集规则测试
*
* @version $Id: co_test_rule.php 1 17:13 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/dedecollection.class.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/dedecollection.class.php");
$nid = intval($nid);
$co = new DedeCollection();
$co->LoadNote($nid);
include DedeInclude('templets/co_test_rule.htm');
exit();
exit();

+ 17
- 22
src/dede/co_url.php View File

@@ -1,33 +1,31 @@
<?php
/**
* 采集地址
*
* @version $Id: co_url.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/datalistcp.class.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/datalistcp.class.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
$where = "";
if(!isset($nid)) $nid="";
if(!empty($nid)) $where = " where cu.nid='$nid' ";
if(empty($small)) $small = 0;
if (!isset($nid)) $nid = "";
if (!empty($nid)) $where = " where cu.nid='$nid' ";
if (empty($small)) $small = 0;
if($nid!='')
{
if ($nid != '') {
$exportbt = "
<input type='button' name='b0' value='导出内容' class='coolbg np'
style='width:80px' onClick=\"location.href='co_export.php?nid=$nid';\" />
<input type='button' name='b0' value='采集本节点' class='coolbg np'
style='width:80px' onClick=\"location.href='co_gather_start.php?nid=$nid';\" />
";
}
else
{
} else {
$exportbt = "";
}
@@ -38,25 +36,22 @@ $where ORDER BY cu.aid DESC";
$dlist = new DataListCP();
$dlist->SetParameter("nid", $nid);
$dlist->SetParameter("small", $small);
if($small==0)
{
$dlist->SetTemplate(DEDEADMIN."/templets/co_url.htm");
}
else
{
$dlist->SetTemplate(DEDEADMIN."/templets/co_url_2.htm");
if ($small == 0) {
$dlist->SetTemplate(DEDEADMIN . "/templets/co_url.htm");
} else {
$dlist->SetTemplate(DEDEADMIN . "/templets/co_url_2.htm");
}
$dlist->SetSource($sql);
$dlist->display();
function IsDownLoad($isd)
{
if($isd=="0") return "未下载";
if ($isd == "0") return "未下载";
else return "已下载";
}
function IsExData($isex)
{
if($isex==0) return "未导出";
if ($isex == 0) return "未导出";
else return "已导出";
}
}

+ 13
- 16
src/dede/co_view.php View File

@@ -1,31 +1,29 @@
<?php
/**
* @version $Id: co_url.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/dedecollection.class.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/dedecollection.class.php");
$backurl = isset($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : "co_url.php";
if(empty($action)) $action='';
if($aid=='')
{
ShowMsg('参数无效!','-1');
if (empty($action)) $action = '';
if ($aid == '') {
ShowMsg('参数无效!', '-1');
exit();
}
//保存更改
if($action=="save")
{
if ($action == "save") {
$result = '';
for($i=0;$i < $endid;$i++)
{
$result .= "{dede:field name=\\'".${"noteid_$i"}."\\'}".${"value_$i"}."{/dede:field}\r\n";
for ($i = 0; $i < $endid; $i++) {
$result .= "{dede:field name=\\'" . ${"noteid_$i"} . "\\'}" . ${"value_$i"} . "{/dede:field}\r\n";
}
$dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET result='$result' WHERE aid='$aid'; ");
ShowMsg("成功保存一条记录!",$backurl);
ShowMsg("成功保存一条记录!", $backurl);
exit();
}
$dsql->SetSql("SELECT * FROM `#@__co_htmls` WHERE aid='$aid'");
@@ -38,8 +36,7 @@ $dtime = $row->dtime;
$body = $row->result;
$litpic = $row->litpic;
$fields = array();
if($isdown == 0)
{
if ($isdown == 0) {
$co = new DedeCollection();
$co->LoadNote($nid);
$co->DownUrl($aid, $url, $litpic);
@@ -56,4 +53,4 @@ if($isdown == 0)
$dtp = new DedeTagParse();
$dtp->SetNameSpace("dede", "{", "}");
$dtp->LoadString($body);
include DedeInclude('templets/co_view.htm');
include DedeInclude('templets/co_view.htm');

+ 65
- 78
src/dede/config.php View File

@@ -1,25 +1,25 @@
<?php

/**
* 管理目录配置文件
*
* @version $Id: config.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
define('DEDEADMIN', str_replace("\\", '/', dirname(__FILE__) ) );
require_once(DEDEADMIN.'/../include/common.inc.php');
require_once(DEDEINC.'/userlogin.class.php');
define('DEDEADMIN', str_replace("\\", '/', dirname(__FILE__)));
require_once(DEDEADMIN . '/../include/common.inc.php');
require_once(DEDEINC . '/userlogin.class.php');
header('Cache-Control:private');
$dsql->safeCheck = FALSE;
$dsql->SetLongLink();
$cfg_admin_skin = 1; // 后台管理风格

if(file_exists(DEDEDATA.'/admin/skin.txt'))
{
$skin = file_get_contents(DEDEDATA.'/admin/skin.txt');
$cfg_admin_skin = !in_array($skin, array(1,2,3,4))? 1 : $skin;
if (file_exists(DEDEDATA . '/admin/skin.txt')) {
$skin = file_get_contents(DEDEDATA . '/admin/skin.txt');
$cfg_admin_skin = !in_array($skin, array(1, 2, 3, 4)) ? 1 : $skin;
}

// 检查CSRF
@@ -28,21 +28,22 @@ function CheckCSRF()
$cc_csrf_token_check = GetCookie("dede_csrf_token");
if (
!(isset($_POST['_csrf_token'], $cc_csrf_token_check)
&& is_string($_POST['_csrf_token']) && is_string($cc_csrf_token_check)
&& hash_equals($_POST['_csrf_token'], $cc_csrf_token_check))
&& is_string($_POST['_csrf_token']) && is_string($cc_csrf_token_check)
&& hash_equals($_POST['_csrf_token'], $cc_csrf_token_check))
) {
ShowMsg('CSRF校验失败,请刷新页面重新提交', '-1');
exit();
}
DropCookie("dede_csrf_token");
}

// 生成CSRF校验token,在比较重要的表单中应该要加上这个token校验
$cc_csrf_token = GetCookie("dede_csrf_token");
if (!isset($GLOBALS['csrf_token']) || $GLOBALS['csrf_token'] === null) {
if (isset($cc_csrf_token) && is_string($cc_csrf_token)
&& preg_match('#^[0-9a-f]{32}$#iS',$cc_csrf_token) === 1
if (
isset($cc_csrf_token) && is_string($cc_csrf_token)
&& preg_match('#^[0-9a-f]{32}$#iS', $cc_csrf_token) === 1
) {
$GLOBALS['csrf_token'] = $cc_csrf_token;
} else {
@@ -61,29 +62,26 @@ $isUrlOpen = @ini_get('allow_url_fopen');
$dedeNowurl = GetCurUrl();
$dedeNowurls = explode('?', $dedeNowurl);
$s_scriptName = $dedeNowurls[0];
$cfg_remote_site = empty($cfg_remote_site)? 'N' : $cfg_remote_site;
$cfg_remote_site = empty($cfg_remote_site) ? 'N' : $cfg_remote_site;

//检验用户登录状态
$cuserLogin = new userLogin();

if($cuserLogin->getUserID()==-1)
{
if ( preg_match("#PHP (.*) Development Server#",$_SERVER['SERVER_SOFTWARE']) )
{
if ($cuserLogin->getUserID() == -1) {
if (preg_match("#PHP (.*) Development Server#", $_SERVER['SERVER_SOFTWARE'])) {
$dirname = dirname($_SERVER['SCRIPT_NAME']);
header("location:{$dirname}/login.php?gotopage=".urlencode($dedeNowurl));
header("location:{$dirname}/login.php?gotopage=" . urlencode($dedeNowurl));
} else {
header("location:login.php?gotopage=".urlencode($dedeNowurl));
header("location:login.php?gotopage=" . urlencode($dedeNowurl));
}
exit();
}

function XSSClean($val)
{
if (is_array($val))
{
if (is_array($val)) {
foreach ($val as $key => $v) {
if(in_array($key,array('tags','body','dede_fields','dede_addonfields','dopost','introduce'))) continue;
if (in_array($key, array('tags', 'body', 'dede_fields', 'dede_addonfields', 'dopost', 'introduce'))) continue;
$val[$key] = XSSClean($val[$key]);
}
return $val;
@@ -91,66 +89,58 @@ function XSSClean($val)
return RemoveXss($val);
}

if($cfg_dede_log=='Y')
{
if ($cfg_dede_log == 'Y') {
$s_nologfile = '_main|_list';
$s_needlogfile = 'sys_|file_';
$s_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
$s_query = isset($dedeNowurls[1]) ? $dedeNowurls[1] : '';
$s_scriptNames = explode('/', $s_scriptName);
$s_scriptNames = $s_scriptNames[count($s_scriptNames)-1];
$s_scriptNames = $s_scriptNames[count($s_scriptNames) - 1];
$s_userip = GetIP();
if( $s_method=='POST' || (!preg_match("#".$s_nologfile."#i", $s_scriptNames) && $s_query!='') || preg_match("#".$s_needlogfile."#i",$s_scriptNames) )
{
if ($s_method == 'POST' || (!preg_match("#" . $s_nologfile . "#i", $s_scriptNames) && $s_query != '') || preg_match("#" . $s_needlogfile . "#i", $s_scriptNames)) {
$inquery = "INSERT INTO `#@__log`(adminid,filename,method,query,cip,dtime)
VALUES ('".$cuserLogin->getUserID()."','{$s_scriptNames}','{$s_method}','".addslashes($s_query)."','{$s_userip}','".time()."');";
VALUES ('" . $cuserLogin->getUserID() . "','{$s_scriptNames}','{$s_method}','" . addslashes($s_query) . "','{$s_userip}','" . time() . "');";
$dsql->ExecuteNoneQuery($inquery);
}
}

//管理缓存、管理员频道缓存
$cache1 = DEDEDATA.'/cache/inc_catalog_base.inc';
if(!file_exists($cache1)) UpDateCatCache();
$cacheFile = DEDEDATA.'/cache/admincat_'.$cuserLogin->userID.'.inc';
if(file_exists($cacheFile)) require_once($cacheFile);
$cache1 = DEDEDATA . '/cache/inc_catalog_base.inc';
if (!file_exists($cache1)) UpDateCatCache();
$cacheFile = DEDEDATA . '/cache/admincat_' . $cuserLogin->userID . '.inc';
if (file_exists($cacheFile)) require_once($cacheFile);

//更新服务器
require_once (DEDEDATA.'/admin/config_update.php');
require_once(DEDEDATA . '/admin/config_update.php');

if(strlen($cfg_cookie_encode)<=10)
{
$chars='abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789';
$hash='';
$length = rand(28,32);
if (strlen($cfg_cookie_encode) <= 10) {
$chars = 'abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789';
$hash = '';
$length = rand(28, 32);
$max = strlen($chars) - 1;
for($i = 0; $i < $length; $i++) {
for ($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
}
$dsql->ExecuteNoneQuery("UPDATE `#@__sysconfig` SET `value`='{$hash}' WHERE varname='cfg_cookie_encode' ");
$configfile = DEDEDATA.'/config.cache.inc.php';
if(!is_writeable($configfile))
{
$dsql->ExecuteNoneQuery("UPDATE `#@__sysconfig` SET `value`='{$hash}' WHERE varname='cfg_cookie_encode' ");
$configfile = DEDEDATA . '/config.cache.inc.php';
if (!is_writeable($configfile)) {
echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数!";
exit();
}
$fp = fopen($configfile,'w');
flock($fp,3);
fwrite($fp,"<"."?php\r\n");
$fp = fopen($configfile, 'w');
flock($fp, 3);
fwrite($fp, "<" . "?php\r\n");
$dsql->SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC ");
$dsql->Execute();
while($row = $dsql->GetArray())
{
if($row['type']=='number')
{
if($row['value']=='') $row['value'] = 0;
fwrite($fp,"\${$row['varname']} = ".$row['value'].";\r\n");
}
else
{
fwrite($fp,"\${$row['varname']} = '".str_replace("'",'',$row['value'])."';\r\n");
while ($row = $dsql->GetArray()) {
if ($row['type'] == 'number') {
if ($row['value'] == '') $row['value'] = 0;
fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n");
} else {
fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n");
}
}
fwrite($fp,"?".">");
fwrite($fp, "?" . ">");
fclose($fp);
}

@@ -163,19 +153,18 @@ if(strlen($cfg_cookie_encode)<=10)
function UpDateCatCache()
{
global $dsql, $cache1, $cuserLogin;
$cache2 = DEDEDATA.'/cache/channelsonlist.inc';
$cache3 = DEDEDATA.'/cache/channeltoplist.inc';
$cache2 = DEDEDATA . '/cache/channelsonlist.inc';
$cache3 = DEDEDATA . '/cache/channeltoplist.inc';
$dsql->SetQuery("SELECT id,reid,channeltype,issend,typename FROM `#@__arctype`");
$dsql->Execute();
$fp1 = fopen($cache1,'w');
$fp1 = fopen($cache1, 'w');
$phph = '?';
$fp1Header = "<{$phph}php\r\nglobal \$cfg_Cs;\r\n\$cfg_Cs=array();\r\n";
fwrite($fp1,$fp1Header);
while($row=$dsql->GetObject())
{
fwrite($fp1, $fp1Header);
while ($row = $dsql->GetObject()) {
// 将typename缓存起来
$row->typename = base64_encode($row->typename);
fwrite($fp1,"\$cfg_Cs[{$row->id}]=array({$row->reid},{$row->channeltype},{$row->issend},'{$row->typename}');\r\n");
fwrite($fp1, "\$cfg_Cs[{$row->id}]=array({$row->reid},{$row->channeltype},{$row->issend},'{$row->typename}');\r\n");
}
fwrite($fp1, "{$phph}>");
fclose($fp1);
@@ -187,12 +176,10 @@ function UpDateCatCache()
// 清空选项缓存
function ClearOptCache()
{
$tplCache = DEDEDATA.'/tplcache/';
$fileArray = glob($tplCache."inc_option_*.inc");
if (count($fileArray) > 1)
{
foreach ($fileArray as $key => $value)
{
$tplCache = DEDEDATA . '/tplcache/';
$fileArray = glob($tplCache . "inc_option_*.inc");
if (count($fileArray) > 1) {
foreach ($fileArray as $key => $value) {
if (file_exists($value)) unlink($value);
else continue;
}
@@ -209,9 +196,9 @@ function ClearOptCache()
* @param bool $isabs 是否为管理目录
* @return string
*/
function DedeInclude($filename, $isabs=FALSE)
function DedeInclude($filename, $isabs = FALSE)
{
return $isabs ? $filename : DEDEADMIN.'/'.$filename;
return $isabs ? $filename : DEDEADMIN . '/' . $filename;
}

/**
@@ -221,14 +208,14 @@ function DedeInclude($filename, $isabs=FALSE)
* @param int $mid 用户ID
* @return string
*/
if(!function_exists('GetMemberName')){
function GetMemberName($mid=0)
{
if (!function_exists('GetMemberName')) {
function GetMemberName($mid = 0)
{
global $dsql;
if (empty($mid)) {
return "管理员";
}
$rs = $dsql->GetOne("SELECT * FROM `#@__member` WHERE mid='{$mid}' ");
return $rs['uname'];
}
return $rs['uname'];
}
}

+ 10
- 11
src/dede/content_att.php View File

@@ -1,31 +1,30 @@
<?php
/**
* 内容属性
*
* @version $Id: content_att.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('sys_Att');
if(empty($dopost)) $dopost = '';
if (empty($dopost)) $dopost = '';
//保存更改
if($dopost=="save")
{
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for(; $startID<=$endID; $startID++)
{
$att = ${'att_'.$startID};
$attname = ${'attname_'.$startID};
$sortid = ${'sortid_'.$startID};
for (; $startID <= $endID; $startID++) {
$att = ${'att_' . $startID};
$attname = ${'attname_' . $startID};
$sortid = ${'sortid_' . $startID};
$query = "UPDATE `#@__arcatt` SET `attname`='$attname',`sortid`='$sortid' WHERE att='$att' ";
$dsql->ExecuteNoneQuery($query);
}
echo "<script> alert('成功更新自定文档义属性表!'); </script>";
}
include DedeInclude('templets/content_att.htm');
include DedeInclude('templets/content_att.htm');

+ 5
- 4
src/dede/content_batch_up.php View File

@@ -1,13 +1,14 @@
<?php
/**
* 内容处理函数
*
* @version $Id: content_batch_up.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/typelink.class.php');
include DedeInclude('templets/content_batch_up.htm');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/typelink.class.php');
include DedeInclude('templets/content_batch_up.htm');

+ 67
- 96
src/dede/content_batchup_action.php View File

@@ -1,167 +1,146 @@
<?php
/**
* 内容处理函数
*
* @version $Id: content_batch_up.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('sys_ArcBatch');
require_once(DEDEINC."/typelink.class.php");
require_once(DEDEADMIN."/inc/inc_batchup.php");
require_once(DEDEINC . "/typelink.class.php");
require_once(DEDEADMIN . "/inc/inc_batchup.php");
@set_time_limit(0);
//typeid,startid,endid,seltime,starttime,endtime,action,newtypeid
//批量操作
//check del move makehtml
//获取ID条件
if(empty($startid)) $startid = 0;
if(empty($endid)) $endid = 0;
if(empty($seltime)) $seltime = 0;
if(empty($typeid)) $typeid = 0;
if(empty($userid)) $userid = '';
if (empty($startid)) $startid = 0;
if (empty($endid)) $endid = 0;
if (empty($seltime)) $seltime = 0;
if (empty($typeid)) $typeid = 0;
if (empty($userid)) $userid = '';
//生成HTML操作由其它页面处理
if($action=="makehtml")
{
if ($action == "makehtml") {
$jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid";
$jumpurl .= "&typeid=$typeid&pagesize=20&seltime=$seltime";
$jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime);
$jumpurl .= "&stime=" . urlencode($starttime) . "&etime=" . urlencode($endtime);
header("Location: $jumpurl");
exit();
}
$gwhere = " WHERE 1 ";
if($startid >0 ) $gwhere .= " AND id>= $startid ";
if($endid > $startid) $gwhere .= " AND id<= $endid ";
if ($startid > 0) $gwhere .= " AND id>= $startid ";
if ($endid > $startid) $gwhere .= " AND id<= $endid ";
$idsql = '';
if($typeid!=0)
{
if ($typeid != 0) {
$ids = GetSonIds($typeid);
$gwhere .= " AND typeid IN($ids) ";
}
if($seltime==1)
{
if ($seltime == 1) {
$t1 = GetMkTime($starttime);
$t2 = GetMkTime($endtime);
$gwhere .= " AND (senddate >= $t1 AND senddate <= $t2) ";
}
if(!empty($userid))
{
$row = $dsql->GetOne("SELECT `mid` FROM #@__member WHERE `userid` LIKE '$userid'");
if(is_array($row))
{
$gwhere .= " AND mid = {$row['mid']} ";
}
if (!empty($userid)) {
$row = $dsql->GetOne("SELECT `mid` FROM #@__member WHERE `userid` LIKE '$userid'");
if (is_array($row)) {
$gwhere .= " AND mid = {$row['mid']} ";
}
}
//特殊操作
if(!empty($heightdone)) $action=$heightdone;
if (!empty($heightdone)) $action = $heightdone;
//指量审核
if($action=='check')
{
if(empty($startid) || empty($endid) || $endid < $startid)
{
ShowMsg('该操作必须指定起始ID!','javascript:;');
if ($action == 'check') {
if (empty($startid) || empty($endid) || $endid < $startid) {
ShowMsg('该操作必须指定起始ID!', 'javascript:;');
exit();
}
$jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid";
$jumpurl .= "&typeid=$typeid&pagesize=20&seltime=$seltime";
$jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime);
$jumpurl .= "&stime=" . urlencode($starttime) . "&etime=" . urlencode($endtime);
$dsql->SetQuery("SELECT id,arcrank FROM `#@__arctiny` $gwhere");
$dsql->Execute('c');
while($row = $dsql->GetObject('c'))
{
if($row->arcrank==-1)
{
while ($row = $dsql->GetObject('c')) {
if ($row->arcrank == -1) {
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank=0 WHERE id='{$row->id}'");
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET arcrank=0 WHERE id='{$row->id}'");
}
}
ShowMsg("完成数据库的审核处理,准备更新HTML...",$jumpurl);
ShowMsg("完成数据库的审核处理,准备更新HTML...", $jumpurl);
exit();
}
//批量删除
else if($action=='del')
{
if(empty($startid) || empty($endid) || $endid < $startid)
{
ShowMsg('该操作必须指定起始ID!','javascript:;');
else if ($action == 'del') {
if (empty($startid) || empty($endid) || $endid < $startid) {
ShowMsg('该操作必须指定起始ID!', 'javascript:;');
exit();
}
$dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere");
$dsql->Execute('x');
$tdd = 0;
while($row = $dsql->GetObject('x'))
{
if(DelArc($row->id)) $tdd++;
while ($row = $dsql->GetObject('x')) {
if (DelArc($row->id)) $tdd++;
}
ShowMsg("成功删除 $tdd 条记录!","javascript:;");
ShowMsg("成功删除 $tdd 条记录!", "javascript:;");
exit();
}
//删除空标题文档
else if($action=='delnulltitle')
{
else if ($action == 'delnulltitle') {
$dsql->SetQuery("SELECT id FROM `#@__archives` WHERE trim(title)='' ");
$dsql->Execute('x');
$tdd = 0;
while($row = $dsql->GetObject('x'))
{
if(DelArc($row->id)) $tdd++;
while ($row = $dsql->GetObject('x')) {
if (DelArc($row->id)) $tdd++;
}
ShowMsg("成功删除 $tdd 条记录!","javascript:;");
ShowMsg("成功删除 $tdd 条记录!", "javascript:;");
exit();
}
//删除空内容文章
else if($action=='delnullbody')
{
else if ($action == 'delnullbody') {
$dsql->SetQuery("SELECT aid FROM `#@__addonarticle` WHERE LENGTH(body) < 10 ");
$dsql->Execute('x');
$tdd = 0;
while($row = $dsql->GetObject('x'))
{
if(DelArc($row->aid)) $tdd++;
while ($row = $dsql->GetObject('x')) {
if (DelArc($row->aid)) $tdd++;
}
ShowMsg("成功删除 $tdd 条记录!","javascript:;");
ShowMsg("成功删除 $tdd 条记录!", "javascript:;");
exit();
}
//修正缩略图错误
else if($action=='modddpic')
{
else if ($action == 'modddpic') {
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET litpic='' WHERE trim(litpic)='litpic' ");
ShowMsg("成功修正缩略图错误!","javascript:;");
ShowMsg("成功修正缩略图错误!", "javascript:;");
exit();
}
//批量移动
else if($action=='move')
{
if(empty($typeid))
{
ShowMsg('该操作必须指定栏目!','javascript:;');
else if ($action == 'move') {
if (empty($typeid)) {
ShowMsg('该操作必须指定栏目!', 'javascript:;');
exit();
}
$typeold = $dsql->GetOne("SELECT * FROM #@__arctype WHERE id='$typeid'; ");
$typenew = $dsql->GetOne("SELECT * FROM #@__arctype WHERE id='$newtypeid'; ");
if(!is_array($typenew))
{
if (!is_array($typenew)) {
ShowMsg("无法检测移动到的新栏目的信息,不能完成操作!", "javascript:;");
exit();
}
if($typenew['ispart']!=0)
{
if ($typenew['ispart'] != 0) {
ShowMsg("你不能把数据移动到非最终列表的栏目!", "javascript:;");
exit();
}
if($typenew['channeltype']!=$typeold['channeltype'])
{
ShowMsg("不能把数据移动到内容类型不同的栏目!","javascript:;");
if ($typenew['channeltype'] != $typeold['channeltype']) {
ShowMsg("不能把数据移动到内容类型不同的栏目!", "javascript:;");
exit();
}
$gwhere .= " And channel='".$typenew['channeltype']."' And title like '%$keyword%'";
$gwhere .= " And channel='" . $typenew['channeltype'] . "' And title like '%$keyword%'";
$ch = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id={$typenew['channeltype']} ");
$addtable = $ch['addtable'];
@@ -169,47 +148,39 @@ else if($action=='move')
$dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere");
$dsql->Execute('m');
$tdd = 0;
while($row = $dsql->GetObject('m'))
{
while ($row = $dsql->GetObject('m')) {
$rs = $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET typeid='$newtypeid' WHERE id='{$row->id}'");
$rs = $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET typeid='$newtypeid' WHERE id='{$row->id}'");
if($addtable!='')
{
if ($addtable != '') {
$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET typeid='$newtypeid' WHERE aid='{$row->id}' ");
}
if($rs) $tdd++;
if ($rs) $tdd++;
//DelArc($row->id,true);
}
if($tdd>0)
{
if ($tdd > 0) {
$jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid";
$jumpurl .= "&typeid=$newtypeid&pagesize=20&seltime=$seltime";
$jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime);
ShowMsg("成功移动 $tdd 条记录,准备重新生成HTML...",$jumpurl);
}
else
{
ShowMsg("完成操作,没移动任何数据...","javascript:;");
$jumpurl .= "&stime=" . urlencode($starttime) . "&etime=" . urlencode($endtime);
ShowMsg("成功移动 $tdd 条记录,准备重新生成HTML...", $jumpurl);
} else {
ShowMsg("完成操作,没移动任何数据...", "javascript:;");
}
}
//删除空标题内容
else if($action=='delnulltitle')
{
else if ($action == 'delnulltitle') {
$dsql->SetQuery("SELECT id FROM #@__archives WHERE trim(title)='' ");
$dsql->Execute('x');
$tdd = 0;
while($row = $dsql->GetObject('x'))
{
if(DelArc($row->id)) $tdd++;
while ($row = $dsql->GetObject('x')) {
if (DelArc($row->id)) $tdd++;
}
ShowMsg("成功删除 $tdd 条记录!","javascript:;");
ShowMsg("成功删除 $tdd 条记录!", "javascript:;");
exit();
}
//修正缩略图错误
else if($action=='modddpic')
{
else if ($action == 'modddpic') {
$dsql->ExecuteNoneQuery("UPDATE #@__archives SET litpic='' WHERE trim(litpic)='litpic' ");
ShowMsg("成功修正缩略图错误!","javascript:;");
ShowMsg("成功修正缩略图错误!", "javascript:;");
exit();
}

+ 3
- 2
src/dede/content_i_list.php View File

@@ -1,12 +1,13 @@
<?php
/**
* 内容列表
*
* @version $Id: content_i_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
$s_tmplets = "templets/content_i_list.htm";
include(dirname(__FILE__)."/content_list.php");
include(dirname(__FILE__) . "/content_list.php");

+ 61
- 96
src/dede/content_list.php View File

@@ -1,29 +1,30 @@
<?php
/**
* 内容列表
* content_s_list.php、content_i_list.php、content_select_list.php
* 均使用本文件作为实际处理代码,只是使用的模板不同,如有相关变动,只需改本文件及相关模板即可
*
* @version $Id: content_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/datalistcp.class.php');
require_once(DEDEADMIN.'/inc/inc_list_functions.php');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/typelink.class.php');
require_once(DEDEINC . '/datalistcp.class.php');
require_once(DEDEADMIN . '/inc/inc_list_functions.php');
$cid = isset($cid) ? intval($cid) : 0;
$channelid = isset($channelid) ? intval($channelid) : 0;
$mid = isset($mid) ? intval($mid) : 0;
if(!isset($keyword)) $keyword = '';
if(!isset($flag)) $flag = '';
if(!isset($f)) $f = '';
if(!isset($arcrank)) $arcrank = '';
if(!isset($dopost)) $dopost = '';
if (!isset($keyword)) $keyword = '';
if (!isset($flag)) $flag = '';
if (!isset($f)) $f = '';
if (!isset($arcrank)) $arcrank = '';
if (!isset($dopost)) $dopost = '';
$arcrank = RemoveXSS($arcrank);
@@ -32,73 +33,54 @@ CheckPurview('a_List,a_AccList,a_MyList');
//栏目浏览许可
$userCatalogSql = '';
if(TestPurview('a_List'))
{
;
}
else if(TestPurview('a_AccList'))
{
if($cid==0 && $cfg_admin_channel == 'array')
{
if (TestPurview('a_List')) {;
} else if (TestPurview('a_AccList')) {
if ($cid == 0 && $cfg_admin_channel == 'array') {
$admin_catalog = join(',', $admin_catalogs);
$userCatalogSql = " arc.typeid IN($admin_catalog) ";
}
else
{
} else {
CheckCatalog($cid, '你无权浏览非指定栏目的内容!');
}
if(TestPurview('a_MyList')) $mid = $cuserLogin->getUserID();
if (TestPurview('a_MyList')) $mid = $cuserLogin->getUserID();
}
$adminid = $cuserLogin->getUserID();
$maintable = '#@__archives';
setcookie('ENV_GOBACK_URL', $dedeNowurl, time()+3600, '/');
setcookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/');
$tl = new TypeLink($cid);
//----------------------------------------
//在不指定排序条件和关键字的情况下直接统计微表
//----------------------------------------
if(empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag))
{
if (empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag)) {
$tinyQuerys = array();
if(!empty($userCatalogSql))
{
if (!empty($userCatalogSql)) {
$tinyQuerys[] = str_replace('arc.', '', $userCatalogSql);
}
if(!empty($channelid) && empty($cid))
{
if (!empty($channelid) && empty($cid)) {
$tinyQuerys[] = " channel = '$channelid' ";
}
else
{
} else {
$tinyQuerys[] = " channel>0 ";
}
if(!empty($arcrank))
{
if (!empty($arcrank)) {
$tinyQuerys[] = " arcrank='$arcrank' ";
}
else
{
} else {
$tinyQuerys[] = " arcrank > -2 ";
}
if(!empty($mid))
{
if (!empty($mid)) {
$tinyQuerys[] = " mid='$mid' ";
}
if(!empty($cid))
{
$tinyQuerys[] = " typeid in(".GetSonIds($cid).") ";
if (!empty($cid)) {
$tinyQuerys[] = " typeid in(" . GetSonIds($cid) . ") ";
}
if(count($tinyQuerys)>0)
{
$tinyQuery = "WHERE ".join(' AND ',$tinyQuerys);
if (count($tinyQuerys) > 0) {
$tinyQuery = "WHERE " . join(' AND ', $tinyQuerys);
}
// 缓存处理
$sql = "SELECT COUNT(*) AS dd FROM `#@__arctiny` $tinyQuery ";
@@ -106,50 +88,42 @@ if(empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag))
$totalresult = $arr['dd'];
}
if($cid==0)
{
if($channelid==0)
{
if ($cid == 0) {
if ($channelid == 0) {
$positionname = '所有栏目&gt;';
}
else
{
} else {
$row = $tl->dsql->GetOne("SELECT id,typename,maintable FROM `#@__channeltype` WHERE id='$channelid'");
$positionname = $row['typename']." &gt; ";
$positionname = $row['typename'] . " &gt; ";
$maintable = $row['maintable'];
$channelid = $row['id'];
}
}
else
{
$positionname = str_replace($cfg_list_symbol," &gt; ",$tl->GetPositionName())." &gt; ";
} else {
$positionname = str_replace($cfg_list_symbol, " &gt; ", $tl->GetPositionName()) . " &gt; ";
}
//当选择的是单表模型栏目时,直接跳转到单表模型管理区
if(empty($channelid)
&& isset($tl->TypeInfos['channeltype']))
{
if (
empty($channelid)
&& isset($tl->TypeInfos['channeltype'])
) {
$channelid = $tl->TypeInfos['channeltype'];
}
if($channelid < -1 )
{
if ($channelid < -1) {
header("location:content_sg_list.php?f=$f&cid=$cid&channelid=$channelid&keyword=$keyword");
exit();
}
// 栏目大于800则需要缓存数据
$optHash = md5($cid. serialize($admin_catalogs).$channelid);
$optCache = DEDEDATA."/tplcache/inc_option_$optHash.inc";
$optHash = md5($cid . serialize($admin_catalogs) . $channelid);
$optCache = DEDEDATA . "/tplcache/inc_option_$optHash.inc";
$typeCount = 0;
if (file_exists($cache1)) require_once($cache1);
else $cfg_Cs = array();
$typeCount = count($cfg_Cs);
if ( $typeCount > 800)
{
if (file_exists($optCache))
{
if ($typeCount > 800) {
if (file_exists($optCache)) {
$optionarr = file_get_contents($optCache);
} else {
$optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid);
@@ -163,44 +137,35 @@ $whereSql = empty($channelid) ? " WHERE arc.channel > 0 AND arc.arcrank > -2 "
$flagsArr = '';
$dsql->Execute('f', 'SELECT * FROM `#@__arcatt` ORDER BY sortid ASC');
while($frow = $dsql->GetArray('f'))
{
$flagsArr .= ($frow['att']==$flag ? "<option value='{$frow['att']}' selected>{$frow['attname']}</option>\r\n" : "<option value='{$frow['att']}'>{$frow['attname']}</option>\r\n");
while ($frow = $dsql->GetArray('f')) {
$flagsArr .= ($frow['att'] == $flag ? "<option value='{$frow['att']}' selected>{$frow['attname']}</option>\r\n" : "<option value='{$frow['att']}'>{$frow['attname']}</option>\r\n");
}
if(!empty($userCatalogSql))
{
$whereSql .= " AND ".$userCatalogSql;
if (!empty($userCatalogSql)) {
$whereSql .= " AND " . $userCatalogSql;
}
if(!empty($mid))
{
if (!empty($mid)) {
$whereSql .= " AND arc.mid = '$mid' ";
}
if($keyword != '')
{
if ($keyword != '') {
$whereSql .= " AND ( CONCAT(arc.title,arc.writer) LIKE '%$keyword%') ";
}
if($flag != '')
{
if ($flag != '') {
$whereSql .= " AND FIND_IN_SET('$flag', arc.flag) ";
}
if($cid != 0)
{
$whereSql .= ' AND arc.typeid IN ('.GetSonIds($cid).')';
if ($cid != 0) {
$whereSql .= ' AND arc.typeid IN (' . GetSonIds($cid) . ')';
}
if($arcrank != '')
{
if ($arcrank != '') {
$whereSql .= " AND arc.arcrank = '$arcrank' ";
$CheckUserSend = "<button type='button' class='btn btn-secondary btn-sm' onClick=\"location='catalog_do.php?cid=".$cid."&dopost=listArchives&gurl=content_list.php';\">所有文档</button>";
}
else
{
$CheckUserSend = "<button type='button' class='btn btn-secondary btn-sm' onClick=\"location='catalog_do.php?cid=".$cid."&dopost=listArchives&arcrank=-1&gurl=content_list.php';\">稿件审核</button>";
$CheckUserSend = "<button type='button' class='btn btn-secondary btn-sm' onClick=\"location='catalog_do.php?cid=" . $cid . "&dopost=listArchives&gurl=content_list.php';\">所有文档</button>";
} else {
$CheckUserSend = "<button type='button' class='btn btn-secondary btn-sm' onClick=\"location='catalog_do.php?cid=" . $cid . "&dopost=listArchives&arcrank=-1&gurl=content_list.php';\">稿件审核</button>";
}
$orderby = empty($orderby) ? 'id' : preg_replace("#[^a-z0-9]#", "", $orderby);
$orderbyField = 'arc.'.$orderby;
$orderbyField = 'arc.' . $orderby;
$query = "SELECT arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake,
arc.channel,arc.arcrank,arc.click,arc.title,arc.color,arc.litpic,arc.pubdate,arc.mid
@@ -208,7 +173,7 @@ FROM `$maintable` arc
$whereSql
ORDER BY $orderbyField DESC";
if(empty($f) || !preg_match("#form#", $f)) $f = 'form1.arcid1';
if (empty($f) || !preg_match("#form#", $f)) $f = 'form1.arcid1';
//初始化
$dlist = new DataListCP();
@@ -217,7 +182,7 @@ $dlist->pageSize = 30;
//GET参数
$dlist->SetParameter('dopost', 'listArchives');
$dlist->SetParameter('keyword', $keyword);
if(!empty($mid)) $dlist->SetParameter('mid', $mid);
if (!empty($mid)) $dlist->SetParameter('mid', $mid);
$dlist->SetParameter('cid', $cid);
$dlist->SetParameter('flag', $flag);
$dlist->SetParameter('orderby', $orderby);
@@ -226,8 +191,8 @@ $dlist->SetParameter('channelid', $channelid);
$dlist->SetParameter('f', $f);
//模板
if(empty($s_tmplets)) $s_tmplets = 'templets/content_list.htm';
$dlist->SetTemplate(DEDEADMIN.'/'.$s_tmplets);
if (empty($s_tmplets)) $s_tmplets = 'templets/content_list.htm';
$dlist->SetTemplate(DEDEADMIN . '/' . $s_tmplets);
//查询
$dlist->SetSource($query);


+ 4
- 3
src/dede/content_s_list.php View File

@@ -1,15 +1,16 @@
<?php
/**
* 专题列表
*
* @version $Id: content_s_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('spec_List');
$s_tmplets = "templets/content_s_list.htm";
$channelid = -1;
include(dirname(__FILE__)."/content_list.php");
include(dirname(__FILE__) . "/content_list.php");

+ 3
- 2
src/dede/content_select_list.php View File

@@ -1,12 +1,13 @@
<?php
/**
* 选择文章
*
* @version $Id: content_select_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
$s_tmplets = "templets/content_select_list.htm";
include(dirname(__FILE__)."/content_list.php");
include(dirname(__FILE__) . "/content_list.php");

+ 31
- 45
src/dede/content_sg_list.php View File

@@ -1,23 +1,23 @@
<?php
/**
* 单表模型列表
*
* @version $Id: content_sg_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
$cid = isset($cid) ? intval($cid) : 0;
$channelid = isset($channelid) ? intval($channelid) : 0;
$mid = isset($mid) ? intval($mid) : 0;
if(!isset($keyword)) $keyword = '';
if(!isset($arcrank)) $arcrank = '';
if (!isset($keyword)) $keyword = '';
if (!isset($arcrank)) $arcrank = '';
if(empty($cid) && empty($channelid))
{
ShowMsg("该页面必须指定栏目ID或内容模型ID才能浏览!","javascript:;");
if (empty($cid) && empty($channelid)) {
ShowMsg("该页面必须指定栏目ID或内容模型ID才能浏览!", "javascript:;");
exit();
}
@@ -25,61 +25,47 @@ if(empty($cid) && empty($channelid))
CheckPurview('a_List,a_AccList,a_MyList');
//栏目浏览许可
if(TestPurview('a_List'))
{
}
else if(TestPurview('a_AccList'))
{
if($cid==0)
{
if (TestPurview('a_List')) {
} else if (TestPurview('a_AccList')) {
if ($cid == 0) {
$ucid = $cid = $cuserLogin->getUserChannel();
}
else
{
CheckCatalog($cid,"你无权浏览非指定栏目的内容!");
} else {
CheckCatalog($cid, "你无权浏览非指定栏目的内容!");
}
}
$adminid = $cuserLogin->getUserID();
$maintable = '#@__archives';
require_once(DEDEINC."/typelink.class.php");
require_once(DEDEINC."/datalistcp.class.php");
require_once(DEDEADMIN."/inc/inc_list_functions.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
require_once(DEDEINC . "/typelink.class.php");
require_once(DEDEINC . "/datalistcp.class.php");
require_once(DEDEADMIN . "/inc/inc_list_functions.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
$tl = new TypeLink($cid);
$listtable = @trim($tl->TypeInfos['addtable']);
if( !empty($channelid) && !empty($ucid) && $tl->TypeInfos['channeltype'] != $channelid)
{
ShowMsg('你没权限访问此页!','javascript:;');
exit();
if (!empty($channelid) && !empty($ucid) && $tl->TypeInfos['channeltype'] != $channelid) {
ShowMsg('你没权限访问此页!', 'javascript:;');
exit();
}
if($cid==0)
{
if ($cid == 0) {
$row = $tl->dsql->GetOne("SELECT typename,addtable FROM `#@__channeltype` WHERE id='$channelid'");
$positionname = $row['typename']." &gt; ";
$positionname = $row['typename'] . " &gt; ";
$listtable = $row['addtable'];
}
else
{
$positionname = str_replace($cfg_list_symbol, " &gt; ", $tl->GetPositionName())." &gt; ";
} else {
$positionname = str_replace($cfg_list_symbol, " &gt; ", $tl->GetPositionName()) . " &gt; ";
}
$optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid);
$whereSql = $channelid==0 ? " WHERE arc.channel < -1 " : " WHERE arc.channel = '$channelid' ";
$whereSql = $channelid == 0 ? " WHERE arc.channel < -1 " : " WHERE arc.channel = '$channelid' ";
if(!empty($mid)) $whereSql .= " AND arc.mid = '$mid' ";
if($keyword!='') $whereSql .= " AND (arc.title like '%$keyword%') ";
if($cid!=0) $whereSql .= " AND arc.typeid in (".GetSonIds($cid).")";
if (!empty($mid)) $whereSql .= " AND arc.mid = '$mid' ";
if ($keyword != '') $whereSql .= " AND (arc.title like '%$keyword%') ";
if ($cid != 0) $whereSql .= " AND arc.typeid in (" . GetSonIds($cid) . ")";
if($arcrank!='')
{
if ($arcrank != '') {
$whereSql .= " AND arc.arcrank = '$arcrank' ";
$CheckUserSend = "<button type='button' class='btn btn-secondary btn-sm' onClick=\"location='content_sg_list.php?cid={$cid}&channelid={$channelid}&dopost=listArchives';\">所有文档</button>";
}
else
{
} else {
$CheckUserSend = "<button type='button' class='btn btn-secondary btn-sm' onClick=\"location='content_sg_list.php?cid={$cid}&channelid={$channelid}&dopost=listArchives&arcrank=-1';\">稿件审核</button>";
}
@@ -95,7 +81,7 @@ $dlist->SetParameter("dopost", "listArchives");
$dlist->SetParameter("keyword", $keyword);
$dlist->SetParameter("cid", $cid);
$dlist->SetParameter("channelid", $channelid);
$dlist->SetTemplate(DEDEADMIN."/templets/content_sg_list.htm");
$dlist->SetTemplate(DEDEADMIN . "/templets/content_sg_list.htm");
$dlist->SetSource($query);
$dlist->Display();
$dlist->Close();
$dlist->Close();

+ 14
- 23
src/dede/content_tj.php View File

@@ -1,14 +1,15 @@
<?php
/**
* 内容统计
*
* @version $Id: content_tj.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('sys_ArcTj');
$row1 = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__arctiny` ");
$row2 = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__feedback` ");
@@ -23,38 +24,28 @@ $row3 = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__member` ");
*/
function GetArchives($dsql, $ordertype)
{
$starttime = time() - (24*3600*30);
if($ordertype=='monthFeedback' ||$ordertype=='monthHot')
{
$starttime = time() - (24 * 3600 * 30);
if ($ordertype == 'monthFeedback' || $ordertype == 'monthHot') {
$swhere = " where senddate>$starttime ";
}
else
{
} else {
$swhere = "";
}
if(preg_match("#feedback#", $ordertype))
{
if (preg_match("#feedback#", $ordertype)) {
$ordersql = " ORDER BY scores DESC ";
}
else
{
} else {
$ordersql = " ORDER BY click DESC ";
}
$query = "SELECT id,title,click,scores FROM #@__archives $swhere $ordersql LIMIT 0,20 ";
$dsql->SetQuery($query);
$dsql->Execute('ga');
while($row = $dsql->GetObject('ga'))
{
if(preg_match("#feedback#i", $ordertype))
{
$moreinfo = "[<a target='_blank' href='".$GLOBALS['cfg_phpurl']."/feedback.php?aid={$row->id}'><u>评论:{$row->scores}</u></a>]";
}
else
{
while ($row = $dsql->GetObject('ga')) {
if (preg_match("#feedback#i", $ordertype)) {
$moreinfo = "[<a target='_blank' href='" . $GLOBALS['cfg_phpurl'] . "/feedback.php?aid={$row->id}'><u>评论:{$row->scores}</u></a>]";
} else {
$moreinfo = "[点击:{$row->click}]";
}
echo "·<a href='archives_do.php?aid={$row->id}&dopost=viewArchives' target='_blank'>";
echo cn_substr($row->title, 30)."</a>{$moreinfo}<br/>\r\n";
echo cn_substr($row->title, 30) . "</a>{$moreinfo}<br/>\r\n";
}
}
include DedeInclude('templets/content_tj.htm');
include DedeInclude('templets/content_tj.htm');

+ 22
- 25
src/dede/dialog/config.php View File

@@ -1,15 +1,16 @@
<?php
/**
* 该页仅用于检测用户登录的情况,如要手工更改系统配置,请更改common.inc.php
*
* @version $Id: config.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/../../include/common.inc.php");
require_once(DEDEINC."/userlogin.class.php");
require_once(dirname(__FILE__) . "/../../include/common.inc.php");
require_once(DEDEINC . "/userlogin.class.php");
//获得当前脚本名称,如果你的系统被禁用了$_SERVER变量,请自行更改这个选项
$dedeNowurl = '';
@@ -17,44 +18,40 @@ $s_scriptName = '';
$isUrlOpen = @ini_get('allow_url_fopen');
$dedeNowurl = GetCurUrl();
$dedeNowurls = explode("?",$dedeNowurl);
$dedeNowurls = explode("?", $dedeNowurl);
$s_scriptName = $dedeNowurls[0];
//检验用户登录状态
$cuserLogin = new userLogin();
if($cuserLogin->getUserID() <=0 )
{
if(empty($adminDirHand))
{
ShowMsg("<b>提示:需输入后台管理目录才能登录</b><br /><form>请输入后台管理目录名:<input type='hidden' name='gotopage' value='".urlencode($dedeNowurl)."' /><input type='text' name='adminDirHand' value='dede' style='width:120px;' /><input style='width:80px;' type='submit' name='sbt' value='转入登录' /></form>", "javascript:;");
if ($cuserLogin->getUserID() <= 0) {
if (empty($adminDirHand)) {
ShowMsg("<b>提示:需输入后台管理目录才能登录</b><br /><form>请输入后台管理目录名:<input type='hidden' name='gotopage' value='" . urlencode($dedeNowurl) . "' /><input type='text' name='adminDirHand' value='dede' style='width:120px;' /><input style='width:80px;' type='submit' name='sbt' value='转入登录' /></form>", "javascript:;");
exit();
}
$adminDirHand = HtmlReplace($adminDirHand, 1);
$gurl = "../../{$adminDirHand}/login.php?gotopage=".urlencode($dedeNowurl);
$adminDirHand = HtmlReplace($adminDirHand, 1);
$gurl = "../../{$adminDirHand}/login.php?gotopage=" . urlencode($dedeNowurl);
echo "<script language='javascript'>location='$gurl';</script>";
exit();
}
//启用远程站点则创建FTP类
if($cfg_remote_site=='Y')
{
require_once(DEDEINC.'/ftp.class.php');
if(file_exists(DEDEDATA."/cache/inc_remote_config.php"))
{
require_once DEDEDATA."/cache/inc_remote_config.php";
if ($cfg_remote_site == 'Y') {
require_once(DEDEINC . '/ftp.class.php');
if (file_exists(DEDEDATA . "/cache/inc_remote_config.php")) {
require_once DEDEDATA . "/cache/inc_remote_config.php";
}
if(empty($remoteuploads)) $remoteuploads = 0;
if(empty($remoteupUrl)) $remoteupUrl = '';
if (empty($remoteuploads)) $remoteuploads = 0;
if (empty($remoteupUrl)) $remoteupUrl = '';
//初始化FTP配置
$ftpconfig = array(
'hostname'=>$rmhost,
'port'=>$rmport,
'username'=>$rmname,
'password'=>$rmpwd
'hostname' => $rmhost,
'port' => $rmport,
'username' => $rmname,
'password' => $rmpwd
);
$ftp = new FTP;
$ftp = new FTP;
$ftp->connect($ftpconfig);
}
}

+ 105
- 105
src/dede/dialog/select_images.php View File

@@ -4,7 +4,7 @@
* 图片选择框
*
* @version $Id: select_images.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
@@ -141,77 +141,77 @@ if (!empty($noeditor)) {
window.close();
}
</SCRIPT>
<table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC' class="table maintable table-borderless" style="margin:0 auto">
<tr bgcolor='#FFFFFF'>
<td colspan='4'>
<table width='100%' border='0' cellspacing='0' cellpadding='2'>
<tr bgcolor="#CCCCCC">
<td width="8%" align="center" class='linerow' bgcolor='#EEF4EA'><strong>预览</strong></td>
<td width="47%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择图片</strong></td>
<td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
<td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
</tr>
<tr>
<td class='linerow' colspan='4' bgcolor='#F9FBF0'>
点击“V”预览图片,点击图片名选择图片,显示图片后点击该图片关闭预览。
</td>
</tr>
<?php
$dh = dir($inpath);
$ty1 = "";
$ty2 = "";
while ($file = $dh->read()) {
<table width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#CBD8AC' class="table maintable table-borderless" style="margin:0 auto">
<tr bgcolor='#FFFFFF'>
<td colspan='4'>
<table width='100%' border='0' cellspacing='0' cellpadding='2'>
<tr bgcolor="#CCCCCC">
<td width="8%" align="center" class='linerow' bgcolor='#EEF4EA'><strong>预览</strong></td>
<td width="47%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择图片</strong></td>
<td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
<td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
</tr>
<tr>
<td class='linerow' colspan='4' bgcolor='#F9FBF0'>
点击“V”预览图片,点击图片名选择图片,显示图片后点击该图片关闭预览。
</td>
</tr>
<?php
$dh = dir($inpath);
$ty1 = "";
$ty2 = "";
while ($file = $dh->read()) {
//-----计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 2);
} else {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
//-----计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 2);
} else {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "\n<tr>
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "\n<tr>
<td class='linerow' colspan='2'>
<a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=" . urlencode($tmp) . $addparm . "'><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
<td colspan='2' class='linerow'> 当前目录:$activepath</td>
</tr>
";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "\n<tr>
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "\n<tr>
<td bgcolor='#F9FBF0' class='linerow' colspan='2'>
<a href='select_images.php?imgstick=$imgstick&v=$v&f=$f&activepath=" . urlencode("$activepath/$file") . $addparm . "'><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a></td>
<td class='linerow'> </td>
<td bgcolor='#F9FBF0' class='linerow'> </td>
</tr>";
echo "$line";
} else if (preg_match("#\.(" . $cfg_imgtype . ")#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
$reurl = $remoteupUrl . $reurl;
} else {
$reurl = $reurl;
}
echo "$line";
} else if (preg_match("#\.(" . $cfg_imgtype . ")#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
$reurl = $remoteupUrl . $reurl;
} else {
$reurl = $reurl;
}
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
$line = "\n<tr>
<td align='center' class='linerow' bgcolor='#F9FBF0'>
<a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif' width='16' height='16' border='0' align=absmiddle></a>
</td>
@@ -220,20 +220,20 @@ if (!empty($noeditor)) {
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
$reurl = $remoteupUrl . $reurl;
} else {
$reurl = $reurl;
}
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
$reurl = $remoteupUrl . $reurl;
} else {
$reurl = $reurl;
}
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "\n<tr>
$line = "\n<tr>
<td align='center' class='linerow' bgcolor='#F9FBF0'>
<a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif' width='16' height='16' border='0' align=absmiddle></a>
</td>
@@ -243,42 +243,42 @@ if (!empty($noeditor)) {
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
} //End Loop
$dh->close();
?>
<tr>
<td colspan='4' bgcolor='#E8F1DE'>
<table width='100%'>
<form action='select_images_post.php' method='POST' enctype="multipart/form-data" name='myform'>
<?php $noeditor = !empty($noeditor) ? "<input type='hidden' name='noeditor' value='yes'>" : '';
echo $noeditor; ?>
<input type='hidden' name='activepath' value='<?php echo $activepath ?>'>
<input type='hidden' name='f' value='<?php echo $f ?>'>
<input type='hidden' name='v' value='<?php echo $v ?>'>
<input type='hidden' name='imgstick' value='<?php echo $imgstick ?>'>
<input type='hidden' name='CKEditorFuncNum' value='<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>'>
<input type='hidden' name='job' value='upload'>
<tr>
<td background="img/tbg.gif" bgcolor="#99CC00">
&nbsp;上 传: <input type='file' name='imgfile' style='width:200px' />
<label><input type='checkbox' name='needwatermark' value='1' class='np' <?php if ($photo_markup == '1') echo "checked"; ?> /> 水印 </label>
<label><input type='checkbox' name='resize' value='1' class='np' /> 缩小 </label>
宽:<input type='text' style='width:46px' name='iwidth' value='<?php echo $cfg_ddimg_width ?>' />
高:<input type='text' style='width:46px' name='iheight' value='<?php echo $cfg_ddimg_height ?>' />
<button type='submit' name='sb1' class="btn btn-secondary btn-sm">确定</button>
</td>
</tr>
</form>
</table>
echo "$line";
}
} //End Loop
$dh->close();
?>
<tr>
<td colspan='4' bgcolor='#E8F1DE'>
<table width='100%'>
<form action='select_images_post.php' method='POST' enctype="multipart/form-data" name='myform'>
<?php $noeditor = !empty($noeditor) ? "<input type='hidden' name='noeditor' value='yes'>" : '';
echo $noeditor; ?>
<input type='hidden' name='activepath' value='<?php echo $activepath ?>'>
<input type='hidden' name='f' value='<?php echo $f ?>'>
<input type='hidden' name='v' value='<?php echo $v ?>'>
<input type='hidden' name='imgstick' value='<?php echo $imgstick ?>'>
<input type='hidden' name='CKEditorFuncNum' value='<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>'>
<input type='hidden' name='job' value='upload'>
<tr>
<td background="img/tbg.gif" bgcolor="#99CC00">
&nbsp;上 传: <input type='file' name='imgfile' style='width:200px' />
<label><input type='checkbox' name='needwatermark' value='1' class='np' <?php if ($photo_markup == '1') echo "checked"; ?> /> 水印 </label>
<label><input type='checkbox' name='resize' value='1' class='np' /> 缩小 </label>
宽:<input type='text' style='width:46px' name='iwidth' value='<?php echo $cfg_ddimg_width ?>' />
高:<input type='text' style='width:46px' name='iheight' value='<?php echo $cfg_ddimg_height ?>' />
<button type='submit' name='sb1' class="btn btn-secondary btn-sm">确定</button>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

+ 43
- 56
src/dede/dialog/select_images_post.php View File

@@ -1,121 +1,108 @@
<?php
/**
* 图片选择
*
* @version $Id: select_images_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/image.func.php");
require_once(dirname(__FILE__) . "/config.php");
require_once(DEDEINC . "/image.func.php");
if(empty($activepath))
{
$activepath ='';
if (empty($activepath)) {
$activepath = '';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if(strlen($activepath) < strlen($cfg_image_dir))
{
if (strlen($activepath) < strlen($cfg_image_dir)) {
$activepath = $cfg_image_dir;
}
}
if(empty($imgfile))
{
$imgfile='';
if (empty($imgfile)) {
$imgfile = '';
}
if(!is_uploaded_file($imgfile))
{
ShowMsg("你没有选择上传的文件!".$imgfile, "-1");
if (!is_uploaded_file($imgfile)) {
ShowMsg("你没有选择上传的文件!" . $imgfile, "-1");
exit();
}
$CKEditorFuncNum = (isset($CKEditorFuncNum))? $CKEditorFuncNum : 1;
$CKEditorFuncNum = (isset($CKEditorFuncNum)) ? $CKEditorFuncNum : 1;
$imgfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $imgfile_name));
if(!preg_match("#\.(".$cfg_imgtype.")#i", $imgfile_name))
{
if (!preg_match("#\.(" . $cfg_imgtype . ")#i", $imgfile_name)) {
ShowMsg("你所上传的图片类型不在许可列表,请更改系统对扩展名限定的配置!", "-1");
exit();
}
$nowtme = time();
$sparr = Array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp");
$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp");
$imgfile_type = strtolower(trim($imgfile_type));
if(!in_array($imgfile_type, $sparr))
{
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!","-1");
if (!in_array($imgfile_type, $sparr)) {
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!", "-1");
exit();
}
$mdir = MyDate($cfg_addon_savetype, $nowtme);
if(!is_dir($cfg_basedir.$activepath."/$mdir"))
{
MkdirAll($cfg_basedir.$activepath."/$mdir",$cfg_dir_purview);
if (!is_dir($cfg_basedir . $activepath . "/$mdir")) {
MkdirAll($cfg_basedir . $activepath . "/$mdir", $cfg_dir_purview);
CloseFtp();
}
$filename_name = $cuserLogin->getUserID().'-'.dd2char(MyDate("ymdHis", $nowtme).mt_rand(100,999));
$filename = $mdir.'/'.$filename_name;
$filename_name = $cuserLogin->getUserID() . '-' . dd2char(MyDate("ymdHis", $nowtme) . mt_rand(100, 999));
$filename = $mdir . '/' . $filename_name;
$fs = explode('.', $imgfile_name);
$filename = $filename.'.'.$fs[count($fs)-1];
$filename_name = $filename_name.'.'.$fs[count($fs)-1];
$fullfilename = $cfg_basedir.$activepath."/".$filename;
$filename = $filename . '.' . $fs[count($fs) - 1];
$filename_name = $filename_name . '.' . $fs[count($fs) - 1];
$fullfilename = $cfg_basedir . $activepath . "/" . $filename;
move_uploaded_file($imgfile, $fullfilename) or die("上传文件到 $fullfilename 失败!");
if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
if ($cfg_remote_site == 'Y' && $remoteuploads == 1) {
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, '', $fullfilename);
$localfile = '../..'.$remotefile;
$localfile = '../..' . $remotefile;
//创建远程文件夹
$remotedir = preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/', '', $remotefile);
$ftp->rmkdir($remotedir);
$ftp->upload($localfile, $remotefile);
}
@unlink($imgfile);
if(empty($resize))
{
if (empty($resize)) {
$resize = 0;
}
if($resize==1)
{
if(in_array($imgfile_type, $cfg_photo_typenames))
{
if ($resize == 1) {
if (in_array($imgfile_type, $cfg_photo_typenames)) {
ImageResize($fullfilename, $iwidth, $iheight);
}
}
else
{
if(in_array($imgfile_type, $cfg_photo_typenames))
{
} else {
if (in_array($imgfile_type, $cfg_photo_typenames)) {
WaterImg($fullfilename, 'up');
}
}
$info = '';
$sizes[0] = 0; $sizes[1] = 0;
$sizes[0] = 0;
$sizes[1] = 0;
$sizes = getimagesize($fullfilename, $info);
$imgwidthValue = $sizes[0];
$imgheightValue = $sizes[1];
$imgsize = filesize($fullfilename);
$inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('0','$filename','".$activepath."/".$filename."','1','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtme}','".$cuserLogin->getUserID()."'); ";
VALUES ('0','$filename','" . $activepath . "/" . $filename . "','1','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtme}','" . $cuserLogin->getUserID() . "'); ";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $activepath.'/'.$filename);
$CKUpload = isset($CKUpload)? $CKUpload : FALSE;
if ($GLOBALS['cfg_html_editor']=='ckeditor' && $CKUpload)
{
$fileurl = $activepath.'/'.$filename;
$result = array('url' => $fileurl,"uploaded"=>1,'fileName'=>$filename);
AddMyAddon($fid, $activepath . '/' . $filename);
$CKUpload = isset($CKUpload) ? $CKUpload : FALSE;
if ($GLOBALS['cfg_html_editor'] == 'ckeditor' && $CKUpload) {
$fileurl = $activepath . '/' . $filename;
$result = array('url' => $fileurl, "uploaded" => 1, 'fileName' => $filename);
echo json_encode($result);
exit;
}
if(!empty($noeditor)){
ShowMsg("成功上传一幅图片!","select_images.php?imgstick=$imgstick&comeback=".urlencode($filename_name)."&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&noeditor=yes&activepath=".urlencode($activepath)."/$mdir&d=".time());
}else{
ShowMsg("成功上传一幅图片!","select_images.php?imgstick=$imgstick&comeback=".urlencode($filename_name)."&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&activepath=".urlencode($activepath)."/$mdir&d=".time());
if (!empty($noeditor)) {
ShowMsg("成功上传一幅图片!", "select_images.php?imgstick=$imgstick&comeback=" . urlencode($filename_name) . "&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&noeditor=yes&activepath=" . urlencode($activepath) . "/$mdir&d=" . time());
} else {
ShowMsg("成功上传一幅图片!", "select_images.php?imgstick=$imgstick&comeback=" . urlencode($filename_name) . "&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&activepath=" . urlencode($activepath) . "/$mdir&d=" . time());
}
exit();
exit();

+ 1
- 1
src/dede/dialog/select_media.php View File

@@ -4,7 +4,7 @@
* 多媒体选择框
*
* @version $Id: select_media.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


+ 1
- 1
src/dede/dialog/select_media_post.php View File

@@ -4,7 +4,7 @@
* 多媒体发送
*
* @version $Id: select_media_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


+ 1
- 1
src/dede/dialog/select_soft.php View File

@@ -4,7 +4,7 @@
* 软件选择框
*
* @version $Id: select_soft.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


+ 1
- 1
src/dede/dialog/select_soft_post.php View File

@@ -4,7 +4,7 @@
* 软件发送
*
* @version $Id: select_soft_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


+ 114
- 114
src/dede/dialog/select_templets.php View File

@@ -4,7 +4,7 @@
* 模板选择框
*
* @version $Id: select_templets.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
@@ -59,187 +59,187 @@ if (empty($comeback)) {
window.close();
}
</SCRIPT>
<!-- 开始文件列表 -->
<table width='100%' border='0' align="center" cellspacing='0' cellpadding='2' class="table maintable table-bordered mt-3">
<tr bgcolor="#CCCCCC">
<td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
<td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
<td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
</tr>
<?php
$dh = dir($inpath);
$ty1 = "";
$ty2 = "";
while ($file = $dh->read()) {
//-----计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 2);
} else {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
//------判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#", "", $activepath);
$line = "\n<tr>
<!-- 开始文件列表 -->
<table width='100%' border='0' align="center" cellspacing='0' cellpadding='2' class="table maintable table-bordered mt-3">
<tr bgcolor="#CCCCCC">
<td width="55%" align="center" background="img/wbg.gif" class='linerow'><strong>点击名称选择文件</strong></td>
<td width="15%" align="center" bgcolor='#EEF4EA' class='linerow'><strong>文件大小</strong></td>
<td width="30%" align="center" background="img/wbg.gif" class='linerow'><strong>最后修改时间</strong></td>
</tr>
<?php
$dh = dir($inpath);
$ty1 = "";
$ty2 = "";
while ($file = $dh->read()) {
//-----计算文件大小和创建时间
if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) {
$filesize = filesize("$inpath/$file");
$filesize = $filesize / 1024;
if ($filesize != "")
if ($filesize < 0.1) {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 2);
} else {
@list($ty1, $ty2) = split("\.", $filesize);
$filesize = $ty1 . "." . substr($ty2, 0, 1);
}
$filetime = filemtime("$inpath/$file");
$filetime = MyDate("Y-m-d H:i:s", $filetime);
}
//------判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#", "", $activepath);
$line = "\n<tr>
<td class='linerow'> <a href='select_templets.php?f=$f&activepath=" . urlencode($tmp) . "'><img src=img/dir2.gif border=0 width=16 height=16 align=absmiddle>上级目录</a></td>
<td colspan='2' class='linerow'> 当前目录:$activepath</td>
</tr>\r\n";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "\n<tr>
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "\n<tr>
<td bgcolor='#F9FBF0' class='linerow'>
<a href=select_templets.php?f=$f&activepath=" . urlencode("$activepath/$file") . "><img src=img/dir.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>-</td>
<td bgcolor='#F9FBF0' class='linerow'>-</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(htm|html)#i", $file)) {
echo "$line";
} else if (preg_match("#\.(htm|html)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$line = "\n<tr>
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/htm.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(css)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
echo "$line";
} else if (preg_match("#\.(css)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "/#", "", $reurl);
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "/#", "", $reurl);
$line = "\n<tr>
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/css.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(js)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
echo "$line";
} else if (preg_match("#\.(js)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$line = "\n<tr>
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/js.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$line = "\n<tr>
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/jpg.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(gif|png)#i", $file)) {
echo "$line";
} else if (preg_match("#\.(gif|png)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$line = "\n<tr>
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/gif.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(txt)#i", $file)) {
echo "$line";
} else if (preg_match("#\.(txt)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl);
$line = "\n<tr>
$line = "\n<tr>
<td class='linerow' bgcolor='#F9FBF0'>
<a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src=img/txt.gif border=0 width=16 height=16 align=absmiddle>$file</a>
</td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow' bgcolor='#F9FBF0'>$filetime</td>
</tr>";
echo "$line";
}
} //End Loop
$dh->close();
?>
<!-- 文件列表完 -->
<tr>
<td colspan='3' bgcolor='#E8F1DE'>
<table width='100%'>
<form action='select_templets_post.php' method='POST' enctype="multipart/form-data" name='myform'>
<input type='hidden' name='activepath' value='<?php echo $activepath ?>'>
<input type='hidden' name='f' value='<?php echo $f ?>'>
<input type='hidden' name='job' value='upload'>
<tr>
<td background="img/tbg.gif" bgcolor="#99CC00">
&nbsp;上 传: <input type='file' name='uploadfile' style='width:320px'>
改名:<input type='text' name='filename' value='' style='width:100px'>
<button type='submit' name='sb1' class="btn btn-secondary btn-sm">确定</button>
</td>
</tr>
</form>
</table>
</td>
</tr>
echo "$line";
}
} //End Loop
$dh->close();
?>
<!-- 文件列表完 -->
<tr>
<td colspan='3' bgcolor='#E8F1DE'>
<table width='100%'>
<form action='select_templets_post.php' method='POST' enctype="multipart/form-data" name='myform'>
<input type='hidden' name='activepath' value='<?php echo $activepath ?>'>
<input type='hidden' name='f' value='<?php echo $f ?>'>
<input type='hidden' name='job' value='upload'>
<tr>
<td background="img/tbg.gif" bgcolor="#99CC00">
&nbsp;上 传: <input type='file' name='uploadfile' style='width:320px'>
改名:<input type='text' name='filename' value='' style='width:100px'>
<button type='submit' name='sb1' class="btn btn-secondary btn-sm">确定</button>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>

+ 19
- 26
src/dede/dialog/select_templets_post.php View File

@@ -1,51 +1,44 @@
<?php
/**
* 模板发送
*
* @version $Id: select_templets_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeCMS.Dialog
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
$cfg_txttype = "htm|html|tpl|txt";
if(empty($uploadfile))
{
if (empty($uploadfile)) {
$uploadfile = "";
}
if(!is_uploaded_file($uploadfile))
{
ShowMsg("你没有选择上传的文件!","-1");
if (!is_uploaded_file($uploadfile)) {
ShowMsg("你没有选择上传的文件!", "-1");
exit();
}
if(!preg_match("#^text#", $uploadfile_type))
{
ShowMsg("你上传的不是文本类型附件!","-1");
if (!preg_match("#^text#", $uploadfile_type)) {
ShowMsg("你上传的不是文本类型附件!", "-1");
exit();
}
if(!preg_match("#\.(".$cfg_txttype.")#i", $uploadfile_name))
{
ShowMsg("你所上传的模板文件类型不能被识别,只允许htm、html、tpl、txt扩展名!","-1");
if (!preg_match("#\.(" . $cfg_txttype . ")#i", $uploadfile_name)) {
ShowMsg("你所上传的模板文件类型不能被识别,只允许htm、html、tpl、txt扩展名!", "-1");
exit();
}
if($filename!='')
{
if ($filename != '') {
$filename = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $filename));
}
else
{
} else {
$uploadfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $uploadfile_name));
$filename = $uploadfile_name;
if($filename=='' || !preg_match("#\.(".$cfg_txttype.")#i", $filename))
{
ShowMsg("你所上传的文件存在问题,请检查文件类型是否适合!","-1");
if ($filename == '' || !preg_match("#\.(" . $cfg_txttype . ")#i", $filename)) {
ShowMsg("你所上传的文件存在问题,请检查文件类型是否适合!", "-1");
exit();
}
}
$fullfilename = $cfg_basedir.$activepath."/".$filename;
move_uploaded_file($uploadfile,$fullfilename) or die("上传文件到 $fullfilename 失败!");
$fullfilename = $cfg_basedir . $activepath . "/" . $filename;
move_uploaded_file($uploadfile, $fullfilename) or die("上传文件到 $fullfilename 失败!");
@unlink($uploadfile);
ShowMsg("成功上传文件!","select_templets.php?comeback=".urlencode($filename)."&f=$f&activepath=".urlencode($activepath)."&d=".time());
exit();
ShowMsg("成功上传文件!", "select_templets.php?comeback=" . urlencode($filename) . "&f=$f&activepath=" . urlencode($activepath) . "&d=" . time());
exit();

+ 23
- 36
src/dede/diy_add.php View File

@@ -1,53 +1,46 @@
<?php
/**
* 增加自定义表单
*
* @version $Id: diy_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('c_New');
$mysql_version = $dsql->GetVersion();
$mysql_versions = explode(".",trim($mysql_version));
$mysql_version = $mysql_versions[0].".".$mysql_versions[1];
if(empty($action))
{
$mysql_versions = explode(".", trim($mysql_version));
$mysql_version = $mysql_versions[0] . "." . $mysql_versions[1];
if (empty($action)) {
$row = $dsql->GetOne("SELECT diyid FROM #@__diyforms ORDER BY diyid DESC LIMIT 0,1 ");
if(is_array($row)) $newdiyid = $row['diyid']+1;
if (is_array($row)) $newdiyid = $row['diyid'] + 1;
else $newdiyid = 1;
include(DEDEADMIN."/templets/diy_add.htm");
}
else
{
if(preg_match("#[^0-9-]#", $diyid) || empty($diyid))
{
ShowMsg("<font color=red>'自定义表单diyid'</font>必须为数字!","-1");
include(DEDEADMIN . "/templets/diy_add.htm");
} else {
if (preg_match("#[^0-9-]#", $diyid) || empty($diyid)) {
ShowMsg("<font color=red>'自定义表单diyid'</font>必须为数字!", "-1");
exit();
}
if($table=="")
{
if ($table == "") {
ShowMsg("表名不能为空!", "-1");
exit();
}
$public = isset($public) && is_numeric($public) ? $public : 0;
$name = dede_htmlspecialchars($name);
$row = $dsql->GetOne("SELECT * FROM #@__diyforms WHERE diyid='$diyid' OR `table` LIKE '$table' OR name LIKE '$name' ");
if(is_array($row))
{
ShowMsg("可能自定义表单的‘diyid’、‘名称’在数据库中已存在,不能重复使用!","-1");
if (is_array($row)) {
ShowMsg("可能自定义表单的‘diyid’、‘名称’在数据库中已存在,不能重复使用!", "-1");
exit();
}
$query = "SHOW TABLES FROM {$dsql->dbName} ";
$dsql->SetQuery($query);
$dsql->Execute();
while($row = $dsql->getarray())
{
if(empty($row[0])) $row[0] = '';
if($table == $row[0])
{
while ($row = $dsql->getarray()) {
if (empty($row[0])) $row[0] = '';
if ($table == $row[0]) {
showmsg('指定的表在数据库中重复', '-1');
exit();
}
@@ -56,22 +49,16 @@ else
`id` int(10) unsigned NOT NULL auto_increment,
`ifcheck` tinyint(1) NOT NULL default '0',
";
if($mysql_version < 4.1)
{
if ($mysql_version < 4.1) {
$sql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; ";
} else {
$sql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; ";
}
else
{
$sql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
}
if($dsql->ExecuteNoneQuery($sql))
{
if ($dsql->ExecuteNoneQuery($sql)) {
$query = "INSERT INTO #@__diyforms (`diyid`, `name`, `table`, `info`, `listtemplate`, `viewtemplate`, `posttemplate`, `public` ) VALUES ('$diyid', '$name', '$table', '', '$listtemplate', '$viewtemplate', '$posttemplate', '$public')";
$dsql->ExecuteNoneQuery($query);
showmsg('自定义表单创建成功,请自行添加字段', 'diy_main.php');
}
else
{
} else {
showmsg('自定义表单创建失败', '-1');
}
}
}

+ 18
- 23
src/dede/diy_edit.php View File

@@ -1,46 +1,43 @@
<?php
/**
* 编辑自定义表单
*
* @version $Id: diy_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('c_Edit');
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEINC."/oxwindow.class.php");
require_once(DEDEINC . "/dedetag.class.php");
require_once(DEDEINC . "/oxwindow.class.php");
if(empty($dopost)) $dopost="";
if (empty($dopost)) $dopost = "";
$diyid = (empty($diyid) ? 0 : intval($diyid));
/*----------------
function __SaveEdit()
-----------------*/
if($dopost=="save")
{
if ($dopost == "save") {
$public = isset($public) && is_numeric($public) ? $public : 0;
$name = dede_htmlspecialchars($name);
$query = "UPDATE `#@__diyforms` SET name = '$name', listtemplate='$listtemplate', viewtemplate='$viewtemplate', posttemplate='$posttemplate', public='$public' WHERE diyid='$diyid' ";
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功更改一个自定义表单!","diy_main.php");
ShowMsg("成功更改一个自定义表单!", "diy_main.php");
exit();
}
/*----------------
function __Delete()
-----------------*/
else if($dopost=="delete")
{
-----------------*/ else if ($dopost == "delete") {
@set_time_limit(0);
CheckPurview('c_Del');
$row = $dsql->GetOne("SELECT * FROM #@__diyforms WHERE diyid='$diyid'");
if(empty($job)) $job = "";
if (empty($job)) $job = "";
//确认提示
if($job=="")
{
if ($job == "") {
$wintitle = "自定义表单管理-删除自定义表单";
$wecome_info = "<a href='diy_main.php'>自定义表单管理</a>::删除自定义表单";
$win = new OxWindow();
@@ -48,19 +45,17 @@ else if($dopost=="delete")
$win->AddHidden("job", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("diyid", $diyid);
$win->AddTitle("!将删除所有与该自定义表单相关的文件和数据<br />你确实要删除 \"".$row['name']."\" 这个自定义表单?");
$win->AddTitle("!将删除所有与该自定义表单相关的文件和数据<br />你确实要删除 \"" . $row['name'] . "\" 这个自定义表单?");
$winform = $win->GetWindow("ok");
$win->Display();
exit();
}
//操作
else if($job=="yes")
{
$row = $dsql->GetOne("SELECT `table` FROM `#@__diyforms` WHERE diyid='$diyid'",MYSQL_ASSOC);
if(!is_array($row))
{
ShowMsg("你所指定的自定义表单信息不存在!","-1");
else if ($job == "yes") {
$row = $dsql->GetOne("SELECT `table` FROM `#@__diyforms` WHERE diyid='$diyid'", MYSQL_ASSOC);
if (!is_array($row)) {
ShowMsg("你所指定的自定义表单信息不存在!", "-1");
exit();
}
@@ -69,7 +64,7 @@ else if($dopost=="delete")
//删除频道配置信息
$dsql->ExecuteNoneQuery("DELETE FROM `#@__diyforms` WHERE diyid='$diyid'");
ShowMsg("成功删除一个自定义表单!","diy_main.php");
ShowMsg("成功删除一个自定义表单!", "diy_main.php");
exit();
}
}
@@ -78,4 +73,4 @@ else if($dopost=="delete")
function edit()
-----------------*/
$row = $dsql->GetOne("Select * From #@__diyforms where diyid='$diyid'");
include DEDEADMIN."/templets/diy_edit.htm";
include DEDEADMIN . "/templets/diy_edit.htm";

+ 32
- 44
src/dede/diy_field_add.php View File

@@ -1,87 +1,80 @@
<?php
/**
* 增加自定义表单字段
*
* @version $Id: diy_field_add.php 1 18:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
//增加权限检查
require_once(DEDEADMIN.'/inc/inc_admin_channel.php');
if(empty($action)) $action = '';
require_once(DEDEADMIN . '/inc/inc_admin_channel.php');
if (empty($action)) $action = '';
$mysql_version = $dsql->GetVersion();
$mysql_versions = explode(".",trim($mysql_version));
$mysql_version = $mysql_versions[0].".".$mysql_versions[1];
$mysql_versions = explode(".", trim($mysql_version));
$mysql_version = $mysql_versions[0] . "." . $mysql_versions[1];
/*----------------------
function Save()
---------------------*/
if($action=='save')
{
if ($action == 'save') {
//模型信息
$fieldname = strtolower($fieldname);
$row = $dsql->GetOne("SELECT `table`,`info` FROM #@__diyforms WHERE diyid='$diyid'");
$fieldset = $row['info'];
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEINC . "/dedetag.class.php");
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","<",">");
$dtp->SetNameSpace("field", "<", ">");
$dtp->LoadSource($fieldset);
$trueTable = $row['table'];
//修改字段配置信息
$dfvalue = trim($vdefault);
$isnull = ($isnull==1 ? "true" : "false");
$isnull = ($isnull == 1 ? "true" : "false");
$mxlen = $maxlength;
//检测被修改的字段类型
$fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen);
$fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen);
$ntabsql = $fieldinfos[0];
$buideType = $fieldinfos[1];
$rs = $dsql->ExecuteNoneQuery(" ALTER TABLE `$trueTable` ADD $ntabsql ");
if(!$rs)
{
if (!$rs) {
$gerr = $dsql->GetError();
ShowMsg("增加字段失败,错误提示为:".$gerr,"javascript:;");
ShowMsg("增加字段失败,错误提示为:" . $gerr, "javascript:;");
exit();
}
$ok = FALSE;
//检测旧配置信息,并替换为新配置
if(is_array($dtp->CTags))
{
if (is_array($dtp->CTags)) {
//遍历旧配置
foreach($dtp->CTags as $tagid=>$ctag)
{
if($fieldname == strtolower($ctag->GetName()))
{
$dtp->Assign($tagid,stripslashes($fieldstring), FALSE);
foreach ($dtp->CTags as $tagid => $ctag) {
if ($fieldname == strtolower($ctag->GetName())) {
$dtp->Assign($tagid, stripslashes($fieldstring), FALSE);
$ok = TRUE;
break;
}
}
$oksetting = $ok ? $dtp->GetResultNP() : $fieldset."\n".stripslashes($fieldstring);
}
else
{
$oksetting = $ok ? $dtp->GetResultNP() : $fieldset . "\n" . stripslashes($fieldstring);
} else {
//原来的配置为空
$oksetting = $fieldset."\n".stripslashes($fieldstring);
$oksetting = $fieldset . "\n" . stripslashes($fieldstring);
}
$addlist = GetAddFieldList($dtp,$oksetting);
$addlist = GetAddFieldList($dtp, $oksetting);
$oksetting = addslashes($oksetting);
$rs = $dsql->ExecuteNoneQuery("Update #@__diyforms set `info`='$oksetting' where diyid='$diyid' ");
if(!$rs)
{
if (!$rs) {
$grr = $dsql->GetError();
ShowMsg("保存节点配置出错!".$grr,"javascript:;");
ShowMsg("保存节点配置出错!" . $grr, "javascript:;");
exit();
}
ShowMsg("成功增加一个字段!","diy_edit.php?diyid=$diyid");
ShowMsg("成功增加一个字段!", "diy_edit.php?diyid=$diyid");
exit();
}
@@ -95,13 +88,10 @@ $tabsql = "CREATE TABLE IF NOT EXISTS `$trueTable`(
`id` int(10) unsigned NOT NULL auto_increment,
`ifcheck` tinyint(1) NOT NULL default '0',
";
if($mysql_version < 4.1)
{
if ($mysql_version < 4.1) {
$tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; ";
}
else
{
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
} else {
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; ";
}
$dsql->ExecuteNoneQuery($tabsql);
@@ -109,13 +99,11 @@ $dsql->ExecuteNoneQuery($tabsql);
$fields = array();
$rs = $dsql->SetQuery("show fields from `$trueTable`");
$dsql->Execute('a');
while($nrow = $dsql->GetArray('a',MYSQL_ASSOC))
{
while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) {
$fields[strtolower($nrow['Field'])] = 1;
}
$f = '';
foreach($fields as $k=>$v)
{
$f .= ($f=='' ? $k : ' '.$k);
foreach ($fields as $k => $v) {
$f .= ($f == '' ? $k : ' ' . $k);
}
require_once(DEDEADMIN."/templets/diy_field_add.htm");
require_once(DEDEADMIN . "/templets/diy_field_add.htm");

+ 39
- 57
src/dede/diy_field_edit.php View File

@@ -1,41 +1,40 @@
<?php
/**
* 编辑自定义表单字段
*
* @version $Id: diy_field_edit.php 1 18:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
//增加权限检查
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEADMIN."/inc/inc_admin_channel.php");
if(empty($action)) $action = '';
require_once(DEDEINC . "/dedetag.class.php");
require_once(DEDEADMIN . "/inc/inc_admin_channel.php");
if (empty($action)) $action = '';
//获取模型信息
$mysql_version = $dsql->GetVersion();
$mysql_versions = explode(".",trim($mysql_version));
$mysql_version = $mysql_versions[0].".".$mysql_versions[1];
$mysql_versions = explode(".", trim($mysql_version));
$mysql_version = $mysql_versions[0] . "." . $mysql_versions[1];
$row = $dsql->GetOne("SELECT `table`,`info` FROM #@__diyforms WHERE diyid='$diyid'");
$fieldset = $row['info'];
$trueTable = $row['table'];
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field","<",">");
$dtp->SetNameSpace("field", "<", ">");
$dtp->LoadSource($fieldset);
foreach($dtp->CTags as $ctag)
{
if(strtolower($ctag->GetName())==strtolower($fname)) break;
foreach ($dtp->CTags as $ctag) {
if (strtolower($ctag->GetName()) == strtolower($fname)) break;
}
//字段类型信息
$ds = file(DEDEADMIN."/inc/fieldtype.txt");
foreach($ds as $d)
{
$dds = explode(',',trim($d));
$ds = file(DEDEADMIN . "/inc/fieldtype.txt");
foreach ($ds as $d) {
$dds = explode(',', trim($d));
$fieldtypes[$dds[0]] = $dds[1];
}
@@ -43,12 +42,10 @@ foreach($ds as $d)
/*--------------------
function _SAVE()
----------------------*/
if($action=='save')
{
if ($action == 'save') {
if(!isset($fieldtypes[$dtype]))
{
ShowMsg("你修改的是系统专用类型的数据,禁止操作!","-1");
if (!isset($fieldtypes[$dtype])) {
ShowMsg("你修改的是系统专用类型的数据,禁止操作!", "-1");
exit();
}
@@ -57,13 +54,10 @@ if($action=='save')
`id` int(10) unsigned NOT NULL auto_increment,
`ifcheck` tinyint(1) NOT NULL default '0',
";
if($mysql_version < 4.1)
{
if ($mysql_version < 4.1) {
$tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; ";
}
else
{
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
} else {
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; ";
}
$dsql->ExecuteNoneQuery($tabsql);
@@ -71,71 +65,59 @@ if($action=='save')
$fields = array();
$rs = $dsql->SetQuery("show fields from `$trueTable`");
$dsql->Execute('a');
while($nrow = $dsql->GetArray('a',MYSQL_ASSOC))
{
$fields[ strtolower($nrow['Field']) ] = $nrow['Type'];
while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) {
$fields[strtolower($nrow['Field'])] = $nrow['Type'];
}
//修改字段配置信息
$dfvalue = $vdefault;
$isnull = ($isnull==1 ? "true" : "false");
$isnull = ($isnull == 1 ? "true" : "false");
$mxlen = $maxlength;
$fieldname = strtolower($fname);
//检测被修改的字段类型,并更新数据表
$fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen);
$fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen);
$ntabsql = $fieldinfos[0];
$buideType = $fieldinfos[1];
$tabsql = '';
//检测旧数据类型,并替换为新配置
foreach($dtp->CTags as $tagid=>$ctag)
{
if(trim($fieldname)==trim(strtolower($ctag->GetName())))
{
foreach ($dtp->CTags as $tagid => $ctag) {
if (trim($fieldname) == trim(strtolower($ctag->GetName()))) {
if(isset($fields[$fieldname]) && $fields[$fieldname]!=$buideType)
{
$tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` ".$ntabsql;
if (isset($fields[$fieldname]) && $fields[$fieldname] != $buideType) {
$tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` " . $ntabsql;
$dsql->ExecuteNoneQuery($tabsql);
}
else if(!isset($fields[$fieldname]))
{
$tabsql = "ALTER TABLE `$trueTable` ADD ".$ntabsql;
} else if (!isset($fields[$fieldname])) {
$tabsql = "ALTER TABLE `$trueTable` ADD " . $ntabsql;
$dsql->ExecuteNoneQuery($tabsql);
}
else
{
} else {
$tabsql = '';
}
$dtp->Assign($tagid,stripslashes($fieldstring), FALSE);
$dtp->Assign($tagid, stripslashes($fieldstring), FALSE);
break;
}
}
$oksetting = $dtp->GetResultNP();
$oksetting = addslashes($oksetting);
$dsql->ExecuteNoneQuery("UPDATE #@__diyforms SET info='$oksetting' WHERE diyid='$diyid' ");
ShowMsg("成功更改一个字段的配置!","diy_edit.php?diyid={$diyid}");
ShowMsg("成功更改一个字段的配置!", "diy_edit.php?diyid={$diyid}");
exit();
}
/*------------------
删除字段
function _DELETE()
-------------------*/
else if($action=="delete")
{
-------------------*/ else if ($action == "delete") {
//检测旧数据类型,并替换为新配置
foreach($dtp->CTags as $tagid=>$ctag)
{
if(strtolower($ctag->GetName())==strtolower($fname))
{
$dtp->Assign($tagid,"#@Delete@#");
foreach ($dtp->CTags as $tagid => $ctag) {
if (strtolower($ctag->GetName()) == strtolower($fname)) {
$dtp->Assign($tagid, "#@Delete@#");
}
}
$oksetting = addslashes($dtp->GetResultNP());
$dsql->ExecuteNoneQuery("UPDATE #@__diyforms SET info='$oksetting' WHERE diyid='$diyid' ");
$dsql->ExecuteNoneQuery("ALTER TABLE `$trueTable` DROP `$fname` ");
ShowMsg("成功删除一个字段!","diy_edit.php?diyid=$diyid");
ShowMsg("成功删除一个字段!", "diy_edit.php?diyid=$diyid");
exit();
}
require_once(DEDEADMIN."/templets/diy_field_edit.htm");
require_once(DEDEADMIN . "/templets/diy_field_edit.htm");

+ 65
- 115
src/dede/diy_list.php View File

@@ -1,114 +1,92 @@
<?php
/**
* 自定义表单列表
*
* @version $Id: diy_list.php 1 18:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('c_New');
$diyid = isset($diyid) && is_numeric($diyid) ? $diyid : 0;
$action = isset($action) && in_array($action, array('post', 'list', 'edit', 'check', 'delete')) ? $action : '';
if(empty($diyid))
{
if (empty($diyid)) {
showMsg("非法操作!", 'javascript:;');
exit();
}
require_once DEDEINC.'/diyform.cls.php';
require_once DEDEINC . '/diyform.cls.php';
$diy = new diyform($diyid);
if($action == 'post')
{
if(empty($do))
{
$postform = $diy->getForm('post','','admin');
include DEDEADMIN.'/templets/diy_post.htm';
}
else if($do == 2)
{
if ($action == 'post') {
if (empty($do)) {
$postform = $diy->getForm('post', '', 'admin');
include DEDEADMIN . '/templets/diy_post.htm';
} else if ($do == 2) {
$dede_fields = empty($dede_fields) ? '' : trim($dede_fields);
$dede_fieldshash = empty($dede_fieldshash) ? '' : trim($dede_fieldshash);
if(!empty($dede_fields))
{
if($dede_fieldshash != md5($dede_fields.$cfg_cookie_encode))
{
if (!empty($dede_fields)) {
if ($dede_fieldshash != md5($dede_fields . $cfg_cookie_encode)) {
showMsg("数据校验不对,程序返回", '-1');
exit();
}
}
$diyform = $dsql->getOne("SELECT * FROM #@__diyforms WHERE diyid=$diyid");
if(!is_array($diyform))
{
if (!is_array($diyform)) {
showmsg("自定义表单不存在", '-1');
exit();
}
$addvar = $addvalue = '';
if(!empty($dede_fields))
{
if (!empty($dede_fields)) {
$fieldarr = explode(';', $dede_fields);
if(is_array($fieldarr))
{
foreach($fieldarr as $field)
{
if($field == '')
{
if (is_array($fieldarr)) {
foreach ($fieldarr as $field) {
if ($field == '') {
continue;
}
$fieldinfo = explode(',', $field);
if($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata')
{
if ($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata') {
${$fieldinfo[0]} = filterscript(stripslashes(${$fieldinfo[0]}));
${$fieldinfo[0]} = addslashes(${$fieldinfo[0]});
${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','member');
}
else
{
${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','member');
${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'member');
} else {
${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'member');
}
$addvar .= ', `'.$fieldinfo[0].'`';
$addvalue .= ", '".${$fieldinfo[0]}."'";
$addvar .= ', `' . $fieldinfo[0] . '`';
$addvalue .= ", '" . ${$fieldinfo[0]} . "'";
}
}
}
$query = "INSERT INTO `{$diy->table}` (`id`, `ifcheck` $addvar) VALUES (NULL, 0 $addvalue)";
if($dsql->ExecuteNoneQuery($query))
{
if ($dsql->ExecuteNoneQuery($query)) {
$goto = "diy_list.php?action=list&diyid={$diy->diyid}";
showmsg('发布成功', $goto);
}
else
{
} else {
showmsg('对不起,发布不成功', '-1');
}
}
} else if ($action == 'list')
{
include_once DEDEINC.'/datalistcp.class.php';
} else if ($action == 'list') {
include_once DEDEINC . '/datalistcp.class.php';
$query = "SELECT * FROM {$diy->table} ORDER BY id DESC";
$datalist = new DataListCP();
$datalist->pageSize = 10;
$datalist->SetParameter('action', 'list');
$datalist->SetParameter('diyid', $diyid);
$datalist->SetTemplate(DEDEADMIN.'/templets/diy_list.htm');
$datalist->SetTemplate(DEDEADMIN . '/templets/diy_list.htm');
$datalist->SetSource($query);
$fieldlist = $diy->getFieldList();
$datalist->Display();
} else if ($action == 'edit')
{
if(empty($do))
{
} else if ($action == 'edit') {
if (empty($do)) {
$id = isset($id) && is_numeric($id) ? $id : 0;
if(empty($id))
{
if (empty($id)) {
showMsg('非法操作!未指定id', 'javascript:;');
exit();
}
$query = "SELECT * FROM {$diy->table} WHERE id=$id";
$row = $dsql->GetOne($query);
if(!is_array($row))
{
if (!is_array($row)) {
showmsg("你访问的记录不存在或未经审核", '-1');
exit();
}
@@ -116,111 +94,83 @@ if($action == 'post')
$fieldlist = $diy->getFieldList();
$c1 = $row['ifcheck'] == 1 ? 'checked' : '';
$c2 = $row['ifcheck'] == 0 ? 'checked' : '';
include DEDEADMIN.'/templets/diy_edit_content.htm';
}
else if($do == 2)
{
include DEDEADMIN . '/templets/diy_edit_content.htm';
} else if ($do == 2) {
$dede_fields = empty($dede_fields) ? '' : trim($dede_fields);
$diyform = $dsql->GetOne("SELECT * FROM #@__diyforms WHERE diyid=$diyid");
$diyco = $dsql->GetOne("SELECT * FROM `$diy->table` WHERE id='$id'");
if(!is_array($diyform))
{
if (!is_array($diyform)) {
showmsg("自定义表单不存在", '-1');
exit();
}
$addsql = '';
if(!empty($dede_fields))
{
if (!empty($dede_fields)) {
$fieldarr = explode(';', $dede_fields);
if(is_array($fieldarr))
{
foreach($fieldarr as $field)
{
if($field == '')
{
if (is_array($fieldarr)) {
foreach ($fieldarr as $field) {
if ($field == '') {
continue;
}
$fieldinfo = explode(',', $field);
if($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata')
{
if ($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata') {
${$fieldinfo[0]} = filterscript(stripslashes(${$fieldinfo[0]}));
${$fieldinfo[0]} = addslashes(${$fieldinfo[0]});
${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','member');
${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'member');
${$fieldinfo[0]} = empty(${$fieldinfo[0]}) ? $diyco[$fieldinfo[0]] : ${$fieldinfo[0]};
}
else
{
} else {
${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','diy', $fieldinfo[0]);
${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'diy', $fieldinfo[0]);
${$fieldinfo[0]} = empty(${$fieldinfo[0]}) ? $diyco[$fieldinfo[0]] : ${$fieldinfo[0]};
}
$addsql .= !empty($addsql)?',`'.$fieldinfo[0]."`='".${$fieldinfo[0]}."'" : '`'.$fieldinfo[0]."`='".${$fieldinfo[0]}."'";
$addsql .= !empty($addsql) ? ',`' . $fieldinfo[0] . "`='" . ${$fieldinfo[0]} . "'" : '`' . $fieldinfo[0] . "`='" . ${$fieldinfo[0]} . "'";
}
}
}
$query = "UPDATE `$diy->table` SET $addsql WHERE id=$id";
if($dsql->ExecuteNoneQuery($query))
{
if ($dsql->ExecuteNoneQuery($query)) {
$goto = "diy_list.php?action=list&diyid={$diy->diyid}";
showmsg('编辑成功', $goto);
}
else
{
} else {
showmsg('编辑成功', '-1');
}
}
}elseif($action == 'check')
{
if(is_array($id))
{
} elseif ($action == 'check') {
if (is_array($id)) {
$ids = implode(',', $id);
}
else
{
} else {
showmsg('未选中要操作的内容', '-1');
exit();
}
$query = "UPDATE `$diy->table` SET ifcheck=1 WHERE id IN ($ids)";
if($dsql->ExecuteNoneQuery($query))
{
if ($dsql->ExecuteNoneQuery($query)) {
showmsg('审核成功', "diy_list.php?action=list&diyid={$diy->diyid}");
}
else
{
} else {
showmsg('审核失败', "diy_list.php?action=list&diyid={$diy->diyid}");
}
}elseif($action == 'delete')
{
if(empty($do))
{
if(is_array($id))
{
} elseif ($action == 'delete') {
if (empty($do)) {
if (is_array($id)) {
$ids = implode(',', $id);
}else
{
} else {
showmsg('未选中要操作的内容', '-1');
exit();
}
$query = "DELETE FROM `$diy->table` WHERE id IN ($ids)";
if($dsql->ExecuteNoneQuery($query))
{
if ($dsql->ExecuteNoneQuery($query)) {
showmsg('删除成功', "diy_list.php?action=list&diyid={$diy->diyid}");
}
else
{
} else {
showmsg('删除失败', "diy_list.php?action=list&diyid={$diy->diyid}");
}
} else if($do=1){
} else if ($do = 1) {
$row = $dsql->GetOne("SELECT * FROM `$diy->table` WHERE id='$id'");
if(file_exists($cfg_basedir.$row[$name])){
unlink($cfg_basedir.$row[$name]);
if (file_exists($cfg_basedir . $row[$name])) {
unlink($cfg_basedir . $row[$name]);
$dsql->ExecuteNoneQuery("UPDATE `$diy->table` SET $name='' WHERE id='$id'");
showmsg('文件删除成功',"diy_list.php?action=list&diyid={$diy->diyid}");
}else{
showmsg('文件不存在','-1');
showmsg('文件删除成功', "diy_list.php?action=list&diyid={$diy->diyid}");
} else {
showmsg('文件不存在', '-1');
}
}
}else
{
} else {
showmsg('未定义操作', "-1");
}
}

+ 8
- 7
src/dede/diy_main.php View File

@@ -1,21 +1,22 @@
<?php
/**
* 自定义表单列表管理
*
* @version $Id: diy_main.php 1 18:31 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('c_List');
require_once(DEDEINC."/datalistcp.class.php");
require_once(DEDEINC."/common.func.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
require_once(DEDEINC . "/datalistcp.class.php");
require_once(DEDEINC . "/common.func.php");
setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/");
$sql = "Select `diyid`,`name`,`table` From #@__diyforms order by diyid asc";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/diy_main.htm");
$dlist->SetTemplet(DEDEADMIN . "/templets/diy_main.htm");
$dlist->SetSource($sql);
$dlist->display();
$dlist->Close();
$dlist->Close();

+ 26
- 35
src/dede/erraddsave.php View File

@@ -1,30 +1,28 @@
<?php
/**
* 纠错管理
*
* @version $Id: erraddsave.php 1 19:09 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/datalistcp.class.php');
require_once(DEDEINC.'/common.func.php');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/datalistcp.class.php');
require_once(DEDEINC . '/common.func.php');
if(empty($dopost)) $dopost ='';
if(empty($fmdo)) $fmdo = '';
if (empty($dopost)) $dopost = '';
if (empty($fmdo)) $fmdo = '';
function username($mid)
{
global $dsql;
if(!isset($mid) || empty($mid))
{
if (!isset($mid) || empty($mid)) {
return "游客";
exit();
}
else
{
} else {
$sql = "SELECT uname FROM `#@__member` WHERE `mid` = '$mid'";
$row = $dsql->GetOne($sql);
return $row['uname'];
@@ -35,8 +33,7 @@ function username($mid)
function typename($me)
{
switch ($me)
{
switch ($me) {
case $me == 1:
return $me = "错别字";
break;
@@ -64,36 +61,30 @@ function typename($me)
}
}
if($dopost == "delete")
{
if($id=='')
{
ShowMsg("参数无效!","-1");
if ($dopost == "delete") {
if ($id == '') {
ShowMsg("参数无效!", "-1");
exit();
}
if($fmdo=='yes')
{
if ($fmdo == 'yes') {
$id = explode("`", $id);
foreach ($id as $var)
{
foreach ($id as $var) {
$query = "DELETE FROM `#@__erradd` WHERE `id` = '$var'";
$dsql->ExecuteNoneQuery($query);
}
ShowMsg("成功删除指定的文档!","erraddsave.php");
ShowMsg("成功删除指定的文档!", "erraddsave.php");
exit();
}
else
{
require_once(DEDEINC."/oxwindow.class.php");
} else {
require_once(DEDEINC . "/oxwindow.class.php");
$wintitle = "删除";
$wecome_info = "<a href='erraddsave.php'>错误管理</a>::删除错误";
$win = new OxWindow();
$win->Init("erraddsave.php","js/blank.js","POST");
$win->AddHidden("fmdo","yes");
$win->AddHidden("dopost",$dopost);
$win->AddHidden("id",$id);
$win->Init("erraddsave.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("id", $id);
$win->AddTitle("你确实要删除“ $id ”这些错误提示?");
$winform = $win->GetWindow("ok");
$win->Display();
@@ -104,6 +95,6 @@ if($dopost == "delete")
$sql = "SELECT * FROM `#@__erradd` ORDER BY id desc";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/erradd.htm");
$dlist->SetTemplet(DEDEADMIN . "/templets/erradd.htm");
$dlist->SetSource($sql);
$dlist->display();
$dlist->display();

+ 7
- 9
src/dede/exit.php View File

@@ -1,26 +1,24 @@
<?php
/**
* 退出
*
* @version $Id: exit.php 1 19:09 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/../include/common.inc.php');
require_once(DEDEINC.'/userlogin.class.php');
require_once(dirname(__FILE__) . '/../include/common.inc.php');
require_once(DEDEINC . '/userlogin.class.php');
$cuserLogin = new userLogin();
$cuserLogin->exitUser();
if(empty($needclose))
{
if (empty($needclose)) {
header('location:index.php');
}
else
{
} else {
$msg = "<script language='javascript'>
if(document.all) window.opener=true;
window.close();
</script>";
echo $msg;
}
}

+ 16
- 17
src/dede/feedback_edit.php View File

@@ -1,44 +1,43 @@
<?php
/**
* 评论编辑
*
* @version $Id: feedback_edit.php 1 19:09 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('sys_Feedback');
$id = isset($id) && is_numeric($id) ? $id : 0;
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL'])? "feedback_main.php" : $_COOKIE['ENV_GOBACK_URL'];
if(empty($dopost)) $dopost = "";
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "feedback_main.php" : $_COOKIE['ENV_GOBACK_URL'];
if (empty($dopost)) $dopost = "";
if($dopost=='edit')
{
if ($dopost == 'edit') {
$msg = cn_substrR($msg, 3500);
$adminmsg = trim($adminmsg);
if($adminmsg!="")
{
if ($adminmsg != "") {
$adminmsg = cn_substrR($adminmsg, 1500);
$adminmsg = str_replace("<","&lt;", $adminmsg);
$adminmsg = str_replace(">","&gt;", $adminmsg);
$adminmsg = str_replace(" ","&nbsp;&nbsp;", $adminmsg);
$adminmsg = str_replace("\r\n","<br/>\n", $adminmsg);
$msg = $msg."<br/>\n"."<font color=red>管理员回复: $adminmsg</font>\n";
$adminmsg = str_replace("<", "&lt;", $adminmsg);
$adminmsg = str_replace(">", "&gt;", $adminmsg);
$adminmsg = str_replace(" ", "&nbsp;&nbsp;", $adminmsg);
$adminmsg = str_replace("\r\n", "<br/>\n", $adminmsg);
$msg = $msg . "<br/>\n" . "<font color=red>管理员回复: $adminmsg</font>\n";
}
$query = "UPDATE `#@__feedback` SET username='$username',msg='$msg',ischeck=1 WHERE id=$id";
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功回复一则留言!",$ENV_GOBACK_URL);
ShowMsg("成功回复一则留言!", $ENV_GOBACK_URL);
exit();
} elseif ($dopost === 'makehtml') {
require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
require_once(DEDEADMIN . '/inc/inc_archives_functions.php');
$query = "SELECT * FROM `#@__feedback` WHERE id=$id";
$row = $dsql->GetOne($query);
MakeArt($row['aid']);
ShowMsg("成功更新评论所在的文档内容",$ENV_GOBACK_URL);
ShowMsg("成功更新评论所在的文档内容", $ENV_GOBACK_URL);
exit();
}
$query = "SELECT * FROM `#@__feedback` WHERE id=$id";
$row = $dsql->GetOne($query);
include DedeInclude('templets/feedback_edit.htm');
include DedeInclude('templets/feedback_edit.htm');

+ 4
- 3
src/dede/feedback_main.php View File

@@ -4,7 +4,7 @@
* 评论管理
*
* @version $Id: feedback_main.php 1 19:09 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
@@ -44,7 +44,8 @@ if (!empty($job)) {
}
// 更新回复统计
function UpdateReplycount($id){
function UpdateReplycount($id)
{
global $dsql;
$row = $dsql->GetOne("SELECT COUNT(*) as dd FROM `#@__feedback` WHERE fid = $id AND ischeck=1");
$dsql->ExecNoneQuery("UPDATE `#@__feedback` SET `replycount`='{$row['dd']}' WHERE `id`=$id;");
@@ -74,7 +75,7 @@ else if ($job == 'delall') {
}
//审核评论
else if ($job == 'check') {
$query = "UPDATE `#@__feedback` SET ischeck=1 WHERE id IN($ids) ";
$dsql->ExecuteNoneQuery($query);


+ 2
- 2
src/dede/file_class.php View File

@@ -1,9 +1,9 @@
<?php if (!defined('DEDEINC')) exit('dedecms');
<?php if (!defined('DEDEINC')) exit('dedebiz');
/**
* 文件管理逻辑类
*
* @version $Id: file_class.php 1 19:09 2010年7月12日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


+ 38
- 59
src/dede/file_manage_control.php View File

@@ -1,22 +1,23 @@
<?php

/**
* 文件管理控制
*
* @version $Id: file_manage_control.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require(dirname(__FILE__)."/config.php");
require(dirname(__FILE__) . "/config.php");
CheckPurview('plus_文件管理器');
require(DEDEINC."/oxwindow.class.php");
require_once(DEDEADMIN.'/file_class.php');
require(DEDEINC . "/oxwindow.class.php");
require_once(DEDEADMIN . '/file_class.php');
$activepath = str_replace("..", "", $activepath);
$activepath = preg_replace("#^\/{1,}#", "/", $activepath);
if($activepath == "/") $activepath = "";
if($activepath == "") $inpath = $cfg_basedir;
else $inpath = $cfg_basedir.$activepath;
if ($activepath == "/") $activepath = "";
if ($activepath == "") $inpath = $cfg_basedir;
else $inpath = $cfg_basedir . $activepath;

//文件管理器交互与逻辑控制文件
$fmm = new FileManagement();
@@ -25,18 +26,15 @@ $fmm->Init();
/*---------------
function __rename();
----------------*/
if($fmdo=="rename")
{
$fmm->RenameFile($oldfilename,$newfilename);
if ($fmdo == "rename") {
$fmm->RenameFile($oldfilename, $newfilename);
}

//新建目录

/*---------------
function __newdir();
----------------*/
else if($fmdo=="newdir")
{
----------------*/ else if ($fmdo == "newdir") {
CheckCSRF();
$fmm->NewDir($newpath);
}
@@ -45,19 +43,15 @@ else if($fmdo=="newdir")

/*---------------
function __move();
----------------*/
else if($fmdo=="move")
{
$fmm->MoveFile($filename,$newpath);
----------------*/ else if ($fmdo == "move") {
$fmm->MoveFile($filename, $newpath);
}

//删除文件

/*---------------
function __delfile();
----------------*/
else if($fmdo=="del")
{
----------------*/ else if ($fmdo == "del") {
$fmm->DeleteFile($filename);
}

@@ -65,9 +59,7 @@ else if($fmdo=="del")

/*---------------
function __saveEdit();
----------------*/
else if($fmdo=="edit")
{
----------------*/ else if ($fmdo == "edit") {
CheckCSRF();
$filename = str_replace("..", "", $filename);
$file = "$cfg_basedir$activepath/$filename";
@@ -75,13 +67,10 @@ else if($fmdo=="edit")
$fp = fopen($file, "w");
fputs($fp, $str);
fclose($fp);
if(empty($backurl))
{
ShowMsg("成功保存一个文件!","file_manage_main.php?activepath=$activepath");
}
else
{
ShowMsg("成功保存文件!",$backurl);
if (empty($backurl)) {
ShowMsg("成功保存一个文件!", "file_manage_main.php?activepath=$activepath");
} else {
ShowMsg("成功保存文件!", $backurl);
}
exit();
}
@@ -108,58 +97,48 @@ else if($fmdo=="editview")
//文件上传
/*---------------
function __upload();
----------------*/
else if($fmdo=="upload")
{
$j=0;
for($i=1; $i<=50; $i++)
{
$upfile = "upfile".$i;
$upfile_name = "upfile".$i."_name";
if(!isset(${$upfile}) || !isset(${$upfile_name}))
{
----------------*/ else if ($fmdo == "upload") {
$j = 0;
for ($i = 1; $i <= 50; $i++) {
$upfile = "upfile" . $i;
$upfile_name = "upfile" . $i . "_name";
if (!isset(${$upfile}) || !isset(${$upfile_name})) {
continue;
}
$upfile = ${$upfile};
$upfile_name = ${$upfile_name};
if(is_uploaded_file($upfile))
{
if(!file_exists($cfg_basedir.$activepath."/".$upfile_name))
{
move_uploaded_file($upfile, $cfg_basedir.$activepath."/".$upfile_name);
if (is_uploaded_file($upfile)) {
if (!file_exists($cfg_basedir . $activepath . "/" . $upfile_name)) {
move_uploaded_file($upfile, $cfg_basedir . $activepath . "/" . $upfile_name);
}
@unlink($upfile);
$j++;
}
}
ShowMsg("成功上传 $j 个文件到: $activepath","file_manage_main.php?activepath=$activepath");
ShowMsg("成功上传 $j 个文件到: $activepath", "file_manage_main.php?activepath=$activepath");
exit();
}

//空间检查
else if($fmdo=="space")
{
if($activepath=="")
{
else if ($fmdo == "space") {
if ($activepath == "") {
$ecpath = "所有目录";
}
else
{
} else {
$ecpath = $activepath;
}
$titleinfo = "目录 <a href='file_manage_main.php?activepath=$activepath'><b><u>$ecpath</u></b></a> 空间使用状况:<br/>";
$wintitle = "文件管理";
$wecome_info = "文件管理::空间大小检查 [<a href='file_manage_main.php?activepath=$activepath'>文件浏览器</a>]</a>";
$activepath=$cfg_basedir.$activepath;
$activepath = $cfg_basedir . $activepath;
$space = new SpaceUse;
$space->checksize($activepath);
$total=$space->totalsize;
$totalkb=$space->setkb($total);
$totalmb=$space->setmb($total);
$total = $space->totalsize;
$totalkb = $space->setkb($total);
$totalmb = $space->setmb($total);
$win = new OxWindow();
$win->Init("","js/blank.js","POST");
$win->Init("", "js/blank.js", "POST");
$win->AddTitle($titleinfo);
$win->AddMsgItem("  $totalmb M<br/>  $totalkb KB<br/>  $total 字节");
$winform = $win->GetWindow("");
$win->Display();
}
}

+ 10
- 12
src/dede/file_manage_main.php View File

@@ -1,32 +1,30 @@
<?php
/**
* 文件管理器
*
* @version $Id: file_manage_main.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require(dirname(__FILE__)."/config.php");
require(dirname(__FILE__) . "/config.php");
CheckPurview('plus_文件管理器');
if(!isset($activepath)) $activepath=$cfg_cmspath;
if (!isset($activepath)) $activepath = $cfg_cmspath;
$inpath = "";
$activepath = str_replace("..", "", $activepath);
$activepath = preg_replace("#^\/{1,}#", "/", $activepath);
if($activepath == "/") $activepath = "";
if ($activepath == "/") $activepath = "";
if($activepath == "") $inpath = $cfg_basedir;
else $inpath = $cfg_basedir.$activepath;
if ($activepath == "") $inpath = $cfg_basedir;
else $inpath = $cfg_basedir . $activepath;
$activeurl = $activepath;
if(preg_match("#".$cfg_templets_dir."#i", $activepath))
{
if (preg_match("#" . $cfg_templets_dir . "#i", $activepath)) {
$istemplets = TRUE;
}
else
{
} else {
$istemplets = FALSE;
}
include DedeInclude('templets/file_manage_main.htm');
include DedeInclude('templets/file_manage_main.htm');

+ 55
- 67
src/dede/file_manage_view.php View File

@@ -1,136 +1,126 @@
<?php

/**
* 文件查看
*
* @version $Id: file_manage_view.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('plus_文件管理器');
require_once(DEDEINC."/oxwindow.class.php");
require_once(DEDEINC . "/oxwindow.class.php");
$activepath = str_replace("..", "", $activepath);
$activepath = preg_replace("#^\/{1,}#", "/", $activepath);
if($activepath == "/") $activepath = "";
if($activepath == "") $inpath = $cfg_basedir;
else $inpath = $cfg_basedir.$activepath;
if ($activepath == "/") $activepath = "";
if ($activepath == "") $inpath = $cfg_basedir;
else $inpath = $cfg_basedir . $activepath;

//显示控制层
//更改文件名
if($fmdo=="rename")
{
if($activepath=="") $ndirstring = "根目录";
if ($fmdo == "rename") {
if ($activepath == "") $ndirstring = "根目录";
$ndirstring = $activepath;
$wintitle = "&nbsp;文件管理";
$wecome_info = "文件管理::更改文件名 [<a href='file_manage_main.php?activepath=$activepath'>文件浏览器</a>]</a>";
$win = new OxWindow();
$win->Init("file_manage_control.php","js/blank.js","POST");
$win->AddHidden("fmdo",$fmdo);
$win->AddHidden("activepath",$activepath);
$win->AddHidden("filename",$filename);
$win->Init("file_manage_control.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", $fmdo);
$win->AddHidden("activepath", $activepath);
$win->AddHidden("filename", $filename);
$win->AddTitle("更改文件名,当前路径:$ndirstring");
$win->AddItem("旧名称:","<input name='oldfilename' type='input' id='oldfilename' size='40' value='$filename'>");
$win->AddItem("新名称:","<input name='newfilename' type='input' size='40' id='newfilename'>");
$win->AddItem("旧名称:", "<input name='oldfilename' type='input' id='oldfilename' size='40' value='$filename'>");
$win->AddItem("新名称:", "<input name='newfilename' type='input' size='40' id='newfilename'>");
$winform = $win->GetWindow("ok");
$win->Display();
}
//新建目录
else if($fmdo=="newdir")
{
if($activepath=="") $activepathname="根目录";
else $activepathname=$activepath;
else if ($fmdo == "newdir") {
if ($activepath == "") $activepathname = "根目录";
else $activepathname = $activepath;

$wintitle = "&nbsp;文件管理";
$wecome_info = "&nbsp;文件管理::新建目录 [<a href='file_manage_main.php?activepath=$activepath'>文件浏览器</a>]</a>";
$win = new OxWindow();
$win->Init("file_manage_control.php","js/blank.js","POST");
$win->AddHidden("fmdo",$fmdo);
$win->AddHidden("activepath",$activepath);
$win->AddHidden("token",make_hash());
$win->Init("file_manage_control.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", $fmdo);
$win->AddHidden("activepath", $activepath);
$win->AddHidden("token", make_hash());
$win->AddTitle("当前目录 $activepathname ");
$win->AddItem("新目录:","<input name='newpath' type='input' class='alltxt' id='newpath'>");
$win->AddItem("新目录:", "<input name='newpath' type='input' class='alltxt' id='newpath'>");
$winform = $win->GetWindow("ok");
$win->Display();
}

//移动文件
else if($fmdo=="move")
{
else if ($fmdo == "move") {
$wintitle = "&nbsp;文件管理";
$wecome_info = "&nbsp;文件管理::移动文件 [<a href='file_manage_main.php?activepath=$activepath'>文件浏览器</a>]</a>";
$win = new OxWindow();
$win->Init("file_manage_control.php","js/blank.js","POST");
$win->AddHidden("fmdo",$fmdo);
$win->AddHidden("activepath",$activepath);
$win->AddHidden("filename",$filename);
$win->Init("file_manage_control.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", $fmdo);
$win->AddHidden("activepath", $activepath);
$win->AddHidden("filename", $filename);
$win->AddTitle("新位置前面不加'/'表示相对于当前位置,加'/'表示相对于根目录。");
$win->AddItem("被移动文件:",$filename);
$win->AddItem("当前位置:",$activepath);
$win->AddItem("新位置:","<input name='newpath' type='input' class='alltxt' id='newpath' size='40'>");
$win->AddItem("被移动文件:", $filename);
$win->AddItem("当前位置:", $activepath);
$win->AddItem("新位置:", "<input name='newpath' type='input' class='alltxt' id='newpath' size='40'>");
$winform = $win->GetWindow("ok");
$win->Display();
}

//删除文件
else if($fmdo=="del")
{
else if ($fmdo == "del") {
$wintitle = "&nbsp;文件管理";
$wecome_info = "&nbsp;文件管理::删除文件 [<a href='file_manage_main.php?activepath=$activepath'>文件浏览器</a>]</a>";
$win = new OxWindow();
$win->Init("file_manage_control.php","js/blank.js","POST");
$win->AddHidden("fmdo",$fmdo);
$win->AddHidden("activepath",$activepath);
$win->AddHidden("filename",$filename);
if(@is_dir($cfg_basedir.$activepath."/$filename"))
{
$win->Init("file_manage_control.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", $fmdo);
$win->AddHidden("activepath", $activepath);
$win->AddHidden("filename", $filename);
if (@is_dir($cfg_basedir . $activepath . "/$filename")) {
$wmsg = "你确信要删除目录:$filename 吗?";
}
else
{
} else {
$wmsg = "你确信要删除文件:$filename 吗?";
}
$win->AddTitle("删除文件确认");
$win->AddMsgItem($wmsg,"50");
$win->AddMsgItem($wmsg, "50");
$winform = $win->GetWindow("ok");
$win->Display();
}

//编辑文件
else if($fmdo=="edit")
{
if(!isset($backurl))
{
else if ($fmdo == "edit") {
if (!isset($backurl)) {
$backurl = "";
}

$activepath = str_replace("..","",$activepath);
$filename = str_replace("..","",$filename);
$activepath = str_replace("..", "", $activepath);
$filename = str_replace("..", "", $filename);
$file = "$cfg_basedir$activepath/$filename";
$content = "";
if(is_file($file))
{
$fp = fopen($file,"r");
$content = fread($fp,filesize($file));
if (is_file($file)) {
$fp = fopen($file, "r");
$content = fread($fp, filesize($file));
fclose($fp);
$content = dede_htmlspecialchars($content);
}
$contentView = "<textarea name='str' id='str' style='width:99%;height:450px;background:#ffffff;'>$content</textarea>\r\n";
$GLOBALS['filename'] = $filename;
$path_parts = pathinfo($filename);
if ( $path_parts['extension'] == 'php' )
{
if ($path_parts['extension'] == 'php') {
$GLOBALS['extension'] = 'text/x-php';
} else if($path_parts['extension'] == 'js'){
} else if ($path_parts['extension'] == 'js') {
$GLOBALS['extension'] = 'text/javascript';
} else if($path_parts['extension'] == 'css'){
} else if ($path_parts['extension'] == 'css') {
$GLOBALS['extension'] = 'text/css';
} else {
$GLOBALS['extension'] = 'text/html';
}
$ctp = new DedeTagParse();
$ctp->LoadTemplate(DEDEADMIN."/templets/file_edit.htm");
$ctp->LoadTemplate(DEDEADMIN . "/templets/file_edit.htm");
$ctp->display();
}
/*编辑文件,可视化模式
@@ -165,22 +155,20 @@ else if($fmdo=="editview")
}
*/
//新建文件
else if($fmdo=="newfile")
{
else if ($fmdo == "newfile") {
$content = "";
$GLOBALS['filename'] = "newfile.txt";
$GLOBALS['extension'] = 'text/html';
$contentView = "<textarea id='str' name='str' style='width:99%;height:400'></textarea>\r\n";
$GLOBALS['token'] = make_hash();
$ctp = new DedeTagParse();
$ctp->LoadTemplate(DEDEADMIN."/templets/file_edit.htm");
$ctp->LoadTemplate(DEDEADMIN . "/templets/file_edit.htm");
$ctp->display();
}

//上传文件
else if($fmdo=="upload")
{
else if ($fmdo == "upload") {
$ctp = new DedeTagParse();
$ctp->LoadTemplate(DEDEADMIN."/templets/file_upload.htm");
$ctp->LoadTemplate(DEDEADMIN . "/templets/file_upload.htm");
$ctp->display();
}
}

+ 23
- 27
src/dede/freelist_add.php View File

@@ -1,48 +1,44 @@
<?php
/**
* 增加自由列表
*
* @version $Id: freelist_add.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('c_FreeList');
if(empty($dopost))
{
require_once DEDEINC.'/typelink.class.php';
if (empty($dopost)) {
require_once DEDEINC . '/typelink.class.php';
include DedeInclude('templets/freelist_add.htm');
exit();
}
else if($dopost=='save')
{
if(!isset($types)) $types = '';
if(!isset($nodefault)) $nodefault = '0';
} else if ($dopost == 'save') {
if (!isset($types)) $types = '';
if (!isset($nodefault)) $nodefault = '0';
$atts = " pagesize='$pagesize' col='$col' titlelen='$titlelen' orderby='$orderby' orderway='$order' ";
$ntype = '';
$edtime = time();
if(empty($channel))
{
showmsg('频道类型不能为空','-1');
if (empty($channel)) {
showmsg('频道类型不能为空', '-1');
exit();
}
if(is_array($types))
{
foreach($types as $v) $ntype .= $v.' ';
if (is_array($types)) {
foreach ($types as $v) $ntype .= $v . ' ';
}
if($ntype!='') $atts .= " type='".trim($ntype)."' ";
if(!empty($typeid)) $atts .= " typeid='$typeid' ";
if(!empty($channel)) $atts .= " channel='$channel' ";
if(!empty($subday)) $atts .= " subday='$subday' ";
if(!empty($keywordarc)) $atts .= " keyword='$keywordarc' ";
if(!empty($att)) $atts .= " att='$att' ";
if ($ntype != '') $atts .= " type='" . trim($ntype) . "' ";
if (!empty($typeid)) $atts .= " typeid='$typeid' ";
if (!empty($channel)) $atts .= " channel='$channel' ";
if (!empty($subday)) $atts .= " subday='$subday' ";
if (!empty($keywordarc)) $atts .= " keyword='$keywordarc' ";
if (!empty($att)) $atts .= " att='$att' ";
$innertext = trim($innertext);
if(!empty($innertext)) $innertext = stripslashes($innertext);
if (!empty($innertext)) $innertext = stripslashes($innertext);
$listTag = "{dede:list $atts}$innertext{/dede:list}";
$listTag = addslashes($listTag);
$inquery = "
@@ -52,4 +48,4 @@ else if($dopost=='save')
$dsql->ExecuteNoneQuery($inquery);
ShowMsg("成功增加一个自由列表!", "freelist_main.php");
exit();
}
}

+ 25
- 28
src/dede/freelist_edit.php View File

@@ -1,49 +1,46 @@
<?php
/**
* 编辑自由列表
*
* @version $Id: freelist_edit.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if(empty($dopost))
{
require_once DEDEINC.'/typelink.class.php';
require_once DEDEINC.'/dedetag.class.php';
require_once(dirname(__FILE__) . "/config.php");
if (empty($dopost)) {
require_once DEDEINC . '/typelink.class.php';
require_once DEDEINC . '/dedetag.class.php';
$aid = isset($aid) && is_numeric($aid) ? $aid : 0;
$row = $dsql->GetOne("Select * From `#@__freelist` where aid='$aid' ");
$dtp = new DedeTagParse();
$dtp->SetNameSpace("dede","{","}");
$dtp->LoadSource("--".$row['listtag']."--");
$dtp->SetNameSpace("dede", "{", "}");
$dtp->LoadSource("--" . $row['listtag'] . "--");
$ctag = $dtp->GetTag('list');
include DedeInclude('templets/freelist_edit.htm');
exit();
}
else if( $dopost=='save' )
{
if(!isset($types)) $types = '';
if(!isset($nodefault)) $nodefault = '0';
} else if ($dopost == 'save') {
if (!isset($types)) $types = '';
if (!isset($nodefault)) $nodefault = '0';
$atts = " pagesize='$pagesize' col='$col' titlelen='$titlelen' orderby='$orderby' orderway='$order' \r\n";
$ntype = '';
$edtime = time();
if(is_array($types))
{
foreach($types as $v) $ntype .= $v.' ';
if (is_array($types)) {
foreach ($types as $v) $ntype .= $v . ' ';
}
if($ntype!='') $atts .= " type='".trim($ntype)."' ";
if(!empty($typeid)) $atts .= " typeid='$typeid' ";
if(!empty($channel)) $atts .= " channel='$channel' ";
if(!empty($subday)) $atts .= " subday='$subday' ";
if(!empty($keywordarc)) $atts .= " keyword='$keywordarc' ";
if(!empty($att)) $atts .= " att='$att' ";
if ($ntype != '') $atts .= " type='" . trim($ntype) . "' ";
if (!empty($typeid)) $atts .= " typeid='$typeid' ";
if (!empty($channel)) $atts .= " channel='$channel' ";
if (!empty($subday)) $atts .= " subday='$subday' ";
if (!empty($keywordarc)) $atts .= " keyword='$keywordarc' ";
if (!empty($att)) $atts .= " att='$att' ";
$innertext = trim($innertext);
if(!empty($innertext)) $innertext = stripslashes($innertext);
if (!empty($innertext)) $innertext = stripslashes($innertext);
$listTag = "{dede:list $atts}$innertext{/dede:list}";
$listTag = addslashes($listTag);
$inquery = "
@@ -55,6 +52,6 @@ else if( $dopost=='save' )
description='$description' WHERE aid='$aid';
";
$dsql->ExecuteNoneQuery($inquery);
ShowMsg("成功更改一个自由列表!","freelist_main.php");
ShowMsg("成功更改一个自由列表!", "freelist_main.php");
exit();
}
}

+ 1
- 3
src/dede/freelist_main.php View File

@@ -3,7 +3,7 @@
* 自由列表管理
*
* @version $Id: freelist_main.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
@@ -97,5 +97,3 @@ function GetTagList($dsql,$pageno,$pagesize,$orderby='aid')
}
echo "</table>\r\n";
}
?>

+ 23
- 32
src/dede/friendlink_add.php View File

@@ -1,64 +1,55 @@
<?php
/**
* 友情链接添加
*
* @version $Id: friendlink_add.php 1 10:59 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require(dirname(__FILE__)."/config.php");
require(dirname(__FILE__) . "/config.php");
CheckPurview('plus_友情链接模块');
if(empty($dopost)) $dopost="";
if (empty($dopost)) $dopost = "";
if($dopost=="add")
{
if ($dopost == "add") {
$dtime = time();
if(is_uploaded_file($logoimg))
{
if (is_uploaded_file($logoimg)) {
$names = split("\.", $logoimg_name);
$shortname = ".".$names[count($names)-1];
if(!preg_match("#(jpg|gif|png)$#", $shortname))
{
$shortname = "." . $names[count($names) - 1];
if (!preg_match("#(jpg|gif|png)$#", $shortname)) {
$shortname = '.gif';
}
$filename = MyDate("ymdHis", time()).mt_rand(1000,9999).$shortname;
$imgurl = $cfg_medias_dir."/flink";
if(!is_dir($cfg_basedir.$imgurl))
{
MkdirAll($cfg_basedir.$imgurl, $cfg_dir_purview);
$filename = MyDate("ymdHis", time()) . mt_rand(1000, 9999) . $shortname;
$imgurl = $cfg_medias_dir . "/flink";
if (!is_dir($cfg_basedir . $imgurl)) {
MkdirAll($cfg_basedir . $imgurl, $cfg_dir_purview);
CloseFtp();
}
$imgurl = $imgurl."/".$filename;
move_uploaded_file($logoimg,$cfg_basedir.$imgurl) or die("复制文件到:".$cfg_basedir.$imgurl."失败");
$imgurl = $imgurl . "/" . $filename;
move_uploaded_file($logoimg, $cfg_basedir . $imgurl) or die("复制文件到:" . $cfg_basedir . $imgurl . "失败");
@unlink($logoimg);
}
else
{
} else {
$imgurl = $logo;
}
//强制检测用户友情链接分类是否数据结构不符
if(empty($typeid) || preg_match("#[^0-9]#", $typeid))
{
if (empty($typeid) || preg_match("#[^0-9]#", $typeid)) {
$typeid = 0;
$dsql->ExecuteNoneQuery("ALTER TABLE `#@__flinktype` CHANGE `ID` `id` MEDIUMINT( 8 ) UNSIGNED DEFAULT NULL AUTO_INCREMENT; ");
}
$query = "INSERT INTO `#@__flink`(sortrank,url,webname,logo,msg,email,typeid,dtime,ischeck)
VALUES('$sortrank','$url','$webname','$imgurl','$msg','$email','$typeid','$dtime','$ischeck'); ";
$rs = $dsql->ExecuteNoneQuery($query);
$burl = empty($_COOKIE['ENV_GOBACK_URL']) ? "friendlink_main.php" : $_COOKIE['ENV_GOBACK_URL'];
if($rs)
{
ShowMsg("成功增加一个链接!",$burl,0,500);
if ($rs) {
ShowMsg("成功增加一个链接!", $burl, 0, 500);
exit();
}
else
{
ShowMsg("增加链接时出错,请向官方反馈,原因:".$dsql->GetError(),"javascript:;");
} else {
ShowMsg("增加链接时出错,请向官方反馈,原因:" . $dsql->GetError(), "javascript:;");
exit();
}
}
include DedeInclude('templets/friendlink_add.htm');
include DedeInclude('templets/friendlink_add.htm');

+ 36
- 47
src/dede/friendlink_edit.php View File

@@ -1,79 +1,68 @@
<?php
/**
* 友情链接编辑
*
* @version $Id: friendlink_edit.php 1 10:59 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__) . "/config.php");
CheckPurview('plus_友情链接模块');
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? 'friendlink_main.php' : $_COOKIE['ENV_GOBACK_URL'];
if(empty($dopost)) $dopost = "";
if (empty($dopost)) $dopost = "";
if(isset($allid))
{
$aids = explode(',',$allid);
if(count($aids)==1)
{
if (isset($allid)) {
$aids = explode(',', $allid);
if (count($aids) == 1) {
$id = $aids[0];
$dopost = "delete";
}
}
if($dopost=="delete")
{
if ($dopost == "delete") {
$id = preg_replace("#[^0-9]#", "", $id);
$dsql->ExecuteNoneQuery("DELETE FROM `#@__flink` WHERE id='$id'");
ShowMsg("成功删除一个链接!",$ENV_GOBACK_URL);
ShowMsg("成功删除一个链接!", $ENV_GOBACK_URL);
exit();
}
else if($dopost=="delall")
{
$aids = explode(',',$aids);
if(isset($aids) && is_array($aids))
{
foreach($aids as $aid)
{
} else if ($dopost == "delall") {
$aids = explode(',', $aids);
if (isset($aids) && is_array($aids)) {
foreach ($aids as $aid) {
$aid = preg_replace("#[^0-9]#", "", $aid);
$dsql->ExecuteNoneQuery("DELETE FROM `#@__flink` WHERE id='$aid'");
}
ShowMsg("成功删除指定链接!",$ENV_GOBACK_URL);
ShowMsg("成功删除指定链接!", $ENV_GOBACK_URL);
exit();
}
else
{
ShowMsg("你没选定任何链接!",$ENV_GOBACK_URL);
} else {
ShowMsg("你没选定任何链接!", $ENV_GOBACK_URL);
exit();
}
}
else if($dopost=="saveedit")
{
require_once DEDEINC.'/request.class.php';
$request = new Request();
$request->Init();
} else if ($dopost == "saveedit") {
require_once DEDEINC . '/request.class.php';
$request = new Request();
$request->Init();
$id = preg_replace("#[^0-9]#", "", $request->Item('id', 0));
$logo = $request->Item('logo', '');
$logoimg = $request->Upfile('logoimg', '');
if(!empty($logoimg))
{
$request->MoveUploadFile('logoimg', DEDEROOT.'/uploads/flink/'.$request->GetFileInfo('logoimg', 'name'));
$logo = $cfg_cmspath.'/uploads/flink/'.$request->GetFileInfo('logoimg', 'name');
}
$sortrank = $request->Item('sortrank', 1);
$url = $request->Item('url', '');
$webname = $request->Item('webname', '');
$msg = $request->Item('msg', '');
$email = $request->Item('email', '');
$typeid = $request->Item('typeid', 0);
$ischeck = $request->Item('ischeck', 0);
$logo = $request->Item('logo', '');
$logoimg = $request->Upfile('logoimg', '');
if (!empty($logoimg)) {
$request->MoveUploadFile('logoimg', DEDEROOT . '/uploads/flink/' . $request->GetFileInfo('logoimg', 'name'));
$logo = $cfg_cmspath . '/uploads/flink/' . $request->GetFileInfo('logoimg', 'name');
}
$sortrank = $request->Item('sortrank', 1);
$url = $request->Item('url', '');
$webname = $request->Item('webname', '');
$msg = $request->Item('msg', '');
$email = $request->Item('email', '');
$typeid = $request->Item('typeid', 0);
$ischeck = $request->Item('ischeck', 0);
$query = "UPDATE `#@__flink` SET sortrank='$sortrank',url='$url',webname='$webname',logo='$logo',msg='$msg',
email='$email',typeid='$typeid',ischeck='$ischeck' WHERE id='$id' ";
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功更改一个链接!",$ENV_GOBACK_URL);
ShowMsg("成功更改一个链接!", $ENV_GOBACK_URL);
exit();
}
$myLink = $dsql->GetOne("SELECT #@__flink.*,#@__flinktype.typename FROM #@__flink LEFT JOIN #@__flinktype ON #@__flink.typeid=#@__flinktype.id WHERE #@__flink.id=$id");
include DedeInclude('templets/friendlink_edit.htm');
include DedeInclude('templets/friendlink_edit.htm');

+ 14
- 13
src/dede/friendlink_main.php View File

@@ -1,46 +1,47 @@
<?php
/**
* 友情链接管理
*
* @version $Id: friendlink_main.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/datalistcp.class.php');
setcookie('ENV_GOBACK_URL', $dedeNowurl, time()+3600, '/');
require_once(dirname(__FILE__) . '/config.php');
require_once(DEDEINC . '/datalistcp.class.php');
setcookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/');
if(empty($keyword)) $keyword = '';
if(empty($ischeck)) {
if (empty($keyword)) $keyword = '';
if (empty($ischeck)) {
$ischeck = 0;
$ischeckSql = '';
} else {
if($ischeck==-1) $ischeckSql = " And ischeck < 1 ";
if ($ischeck == -1) $ischeckSql = " And ischeck < 1 ";
else $ischeckSql = " And ischeck='$ischeck' ";
}
$selCheckArr = array(0=>'不限类型', -1=>'未审核', 1=>'内页', 2=>'首页');
$selCheckArr = array(0 => '不限类型', -1 => '未审核', 1 => '内页', 2 => '首页');
$sql = "SELECT * FROM `#@__flink` WHERE CONCAT(`url`,`webname`,`email`) LIKE '%$keyword%' $ischeckSql ORDER BY dtime desc";
$dlist = new DataListCP();
$dlist->SetParameter('keyword', $keyword);
$dlist->SetParameter('ischeck', $ischeck);
$dlist->SetTemplet(DEDEADMIN.'/templets/friendlink_main.htm');
$dlist->SetTemplet(DEDEADMIN . '/templets/friendlink_main.htm');
$dlist->SetSource($sql);
$dlist->display();
function GetPic($pic)
{
if($pic=='') return '无图标';
if ($pic == '') return '无图标';
else return "<img src='$pic' width='88' height='31' border='0' />";
}
function GetSta($sta)
{
if($sta==1) return '内页';
if($sta==2) return '首页';
if ($sta == 1) return '内页';
if ($sta == 2) return '首页';
else return '未审核';
}
}

+ 13
- 19
src/dede/friendlink_type.php View File

@@ -1,43 +1,37 @@
<?php
/**
* 友情链接类型
*
* @version $Id: friendlink_type.php 1 8:48 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if(empty($dopost)) $dopost = '';
require_once(dirname(__FILE__) . "/config.php");
if (empty($dopost)) $dopost = '';
//保存更改
if($dopost=="save")
{
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for(;$startID<=$endID;$startID++)
{
for (; $startID <= $endID; $startID++) {
$query = '';
$tid = ${'ID_'.$startID};
$pname = ${'pname_'.$startID};
if(isset(${'check_'.$startID}))
{
if($pname!='')
{
$tid = ${'ID_' . $startID};
$pname = ${'pname_' . $startID};
if (isset(${'check_' . $startID})) {
if ($pname != '') {
$query = "UPDATE `#@__flinktype` SET typename='$pname' WHERE id='$tid' ";
$dsql->ExecuteNoneQuery($query);
}
}
else
{
} else {
$query = "DELETE FROM `#@__flinktype` WHERE id='$tid' ";
$dsql->ExecuteNoneQuery($query);
}
}
//增加新记录
if(isset($check_new) && $pname_new!='')
{
if (isset($check_new) && $pname_new != '') {
$query = "INSERT INTO `#@__flinktype`(typename) VALUES('{$pname_new}');";
$dsql->ExecuteNoneQuery($query);
}
@@ -45,4 +39,4 @@ if($dopost=="save")
echo "<script> alert('成功更新友情链接网站分类表!'); </script>";
}
include DedeInclude('templets/friendlink_type.htm');
include DedeInclude('templets/friendlink_type.htm');

+ 0
- 19
src/dede/getdedesysmsg.php View File

@@ -1,19 +0,0 @@
<?php
/**
* 获取dede系统提示信息
*
* @version $Id: getdedesysmsg.php 1 11:06 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEINC.'/dedehttpdown.class.php');
AjaxHead();
$dhd = new DedeHttpDown();
$dhd->OpenUrl('http://www.dedecms.com/officialinfo.html');
$str = trim($dhd->GetHtml());
$dhd->Close();
if($cfg_soft_lang=='utf-8') $str = gb2utf8($str);
echo $str;

+ 49
- 64
src/dede/imagecut.php View File

@@ -1,56 +1,49 @@
<?php
/**
* 截取图片
*
* @version $Id: imagecut.php 1 11:06 2010年7月13日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
require_once(dirname(__FILE__) . '/config.php');
$action = isset($action) ? trim($action) : '';
if(empty($action))
{
if(!@is_file($cfg_basedir.$file))
{
ShowMsg("对不起,必须选择站内的图片才能进行裁剪!<br />点击'<a href='./dialog/select_images.php?f=form1.picname&imgstick=small'>站内选择</a>', 上传或选择一个图片,然后才能进行裁剪!", "./dialog/select_images.php?f=form1.picname&imgstick=small", 0 , 10000);
if (empty($action)) {
if (!@is_file($cfg_basedir . $file)) {
ShowMsg("对不起,必须选择站内的图片才能进行裁剪!<br />点击'<a href='./dialog/select_images.php?f=form1.picname&imgstick=small'>站内选择</a>', 上传或选择一个图片,然后才能进行裁剪!", "./dialog/select_images.php?f=form1.picname&imgstick=small", 0, 10000);
exit();
}
include DEDEADMIN.'/templets/imagecut.htm';
include DEDEADMIN . '/templets/imagecut.htm';
exit();
}
elseif($action == 'cut')
{
require_once(DEDEINC.'/image.func.php');
} elseif ($action == 'cut') {
require_once(DEDEINC . '/image.func.php');
if(!@is_file($cfg_basedir.$file))
{
if (!@is_file($cfg_basedir . $file)) {
ShowMsg('对不起,请重新选择裁剪图片!', '-1');
exit();
}
if(empty($width))
{
if (empty($width)) {
ShowMsg('对不起,请选择裁剪图片的尺寸!', '-1');
exit();
}
if(empty($height))
{
if (empty($height)) {
ShowMsg('对不起,请选择裁剪图片的尺寸!', '-1');
exit();
}
$imginfo = getimagesize($cfg_basedir.$file);
$imginfo = getimagesize($cfg_basedir . $file);
$imgw = $imginfo[0];
$imgh = $imginfo[1];
$temp = 400/$imgw;
$temp = 400 / $imgw;
$newwidth = 400;
$newheight = $imgh * $temp;
$srcFile = $cfg_basedir.$file;
$srcFile = $cfg_basedir . $file;
$thumb = imagecreatetruecolor($newwidth, $newheight);
$thumba = imagecreatetruecolor($width, $height);
switch($imginfo['mime'])
{
switch ($imginfo['mime']) {
case 'image/jpeg':
$source = imagecreatefromjpeg($srcFile);
break;
@@ -65,29 +58,25 @@ elseif($action == 'cut')
break;
}
imagecopyresized($thumb, $source, 0, 0, 0, 0 , $newwidth, $newheight, $imgw, $imgh);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $imgw, $imgh);
imagecopy($thumba, $thumb, 0, 0, $left, $top, $newwidth, $newheight);
$ddn = substr($srcFile, -3);
$ddpicok = $reObjJs = '';
if( empty($isupload) )
{
$ddpicok = preg_replace("#\.".$ddn."$#", '-lp.'.$ddn, $file);
if (empty($isupload)) {
$ddpicok = preg_replace("#\." . $ddn . "$#", '-lp.' . $ddn, $file);
$reObjJs = " var backObj = window.opener.document.form1.picname;
var prvObj = window.opener.document.getElementById('divpicview');\r\n";
}
else
{
} else {
$ddpicok = $file;
$reObjJs = " var backObj = window.opener.parent.document.form1.picname;
var prvObj = window.opener.parent.document.getElementById('divpicview');\r\n";
}
$ddpicokurl = $cfg_basedir.$ddpicok;
switch($imginfo['mime'])
{
$ddpicokurl = $cfg_basedir . $ddpicok;
switch ($imginfo['mime']) {
case 'image/jpeg':
imagejpeg($thumba, $ddpicokurl, 85);
break;
@@ -101,41 +90,37 @@ elseif($action == 'cut')
ShowMsg("对不起,裁剪图片类型不支持请选择其他类型图片!", "-1");
break;
}
//对任意裁剪方式再次缩小图片至限定大小
if($newwidth > $cfg_ddimg_width || $newheight > $cfg_ddimg_height)
{
if ($newwidth > $cfg_ddimg_width || $newheight > $cfg_ddimg_height) {
ImageResize($ddpicokurl, $cfg_ddimg_width, $cfg_ddimg_height);
}
//如果从其它图中剪出, 保存附件信息
if( empty($isupload) )
{
$inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('$ddpicok','$ddpicok','1','0','0','0','".filesize($ddpicokurl)."','".time()."','".$cuserLogin->getUserID()."'); ";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $ddpicok);
if (empty($isupload)) {
$inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('$ddpicok','$ddpicok','1','0','0','0','" . filesize($ddpicokurl) . "','" . time() . "','" . $cuserLogin->getUserID() . "'); ";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $ddpicok);
}
?>
<SCRIPT language=JavaScript>
function ReturnImg(reimg)
{
<?php echo $reObjJs; ?>
backObj.value = reimg;
if(prvObj)
{
prvObj.style.width = '150px';
prvObj.innerHTML = "<img src='"+reimg+"?n' width='150' />";
}
if(document.all) {
window.opener=true;
}
window.close();
}
ReturnImg("<?php echo $ddpicok; ?>");
</SCRIPT>
<SCRIPT language=JavaScript>
function ReturnImg(reimg) {
<?php echo $reObjJs; ?>
backObj.value = reimg;
if (prvObj) {
prvObj.style.width = '150px';
prvObj.innerHTML = "<img src='" + reimg + "?n' width='150' />";
}
if (document.all) {
window.opener = true;
}
window.close();
}
ReturnImg("<?php echo $ddpicok; ?>");
</SCRIPT>
<?php
}
?>

+ 292
- 291
src/dede/inc/inc_action_info.php View File

@@ -1,505 +1,506 @@
<?php
/**
* 后台操作记录信息
*
* @version $Id: inc_action_info.php 2 14:55 2010-11-11 tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/../config.php");
require_once(dirname(__FILE__) . "/../config.php");
$cuserLogin = new userLogin();
//后台功能操作配置项
$actionSearch[0] =array(
$actionSearch[0] = array(
'toptitle' => '核心',
'title' => '常规操作',
'description' =>'站点档案常规功能操作',
'description' => '站点档案常规功能操作',
'soniterm' => array(
0 => array(
'title' =>'网站栏目管理',
'description' =>'站点所有栏目管理',
'purview' =>'t_List,t_AccList',
'linkurl' =>'catalog_main.php'
'title' => '网站栏目管理',
'description' => '站点所有栏目管理',
'purview' => 't_List,t_AccList',
'linkurl' => 'catalog_main.php'
),
1 => array(
'title' =>'等审核的档案',
'description' =>'所有内容模型发表的未经审核内容列表',
'purview' =>'a_Check,a_AccCheck',
'linkurl' =>'content_list.php?arcrank=-1'
'title' => '等审核的档案',
'description' => '所有内容模型发表的未经审核内容列表',
'purview' => 'a_Check,a_AccCheck',
'linkurl' => 'content_list.php?arcrank=-1'
),
2 => array(
'title' =>'我发布的文档',
'description' =>'现在登录的管理员所发表的所有内容模型中的文档',
'purview' =>'a_List,a_AccList,a_MyList',
'linkurl' =>'content_list.php?mid='.$cuserLogin->userID
'title' => '我发布的文档',
'description' => '现在登录的管理员所发表的所有内容模型中的文档',
'purview' => 'a_List,a_AccList,a_MyList',
'linkurl' => 'content_list.php?mid=' . $cuserLogin->userID
),
3 => array(
'title' =>'评论管理',
'description' =>'网站所有评论管理',
'purview' =>'sys_Feedback',
'linkurl' =>'feedback_main.php'
'title' => '评论管理',
'description' => '网站所有评论管理',
'purview' => 'sys_Feedback',
'linkurl' => 'feedback_main.php'
),
4 => array(
'title' =>'内容回收站',
'description' =>'如果在"系统基本参数"的"核心设置"中开启了"文章回收站(是/否)开启功能",后台删除的文档将会存放在此处',
'purview' =>'a_List,a_AccList,a_MyList',
'linkurl' =>'recycling.php'
'title' => '内容回收站',
'description' => '如果在"系统基本参数"的"核心设置"中开启了"文章回收站(是/否)开启功能",后台删除的文档将会存放在此处',
'purview' => 'a_List,a_AccList,a_MyList',
'linkurl' => 'recycling.php'
)
)
);
$actionSearch[1] = array(
'toptitle' => '核心',
'toptitle' => '核心',
'title' => '内容管理',
'description' => '网站对应内容模型的文档管理',
'soniterm' => array(
0 => array(
'title' =>'专题管理',
'description' =>'所有专题内容的管理',
'purview' =>'spec_New',
'linkurl' =>'content_s_list.php'
'title' => '专题管理',
'description' => '所有专题内容的管理',
'purview' => 'spec_New',
'linkurl' => 'content_s_list.php'
),
)
);
$actionSearch[2] = array(
'toptitle' => '核心',
'toptitle' => '核心',
'title' => '附件管理',
'description' => '所有上传的附件管理',
'soniterm' => array(
0 => array(
'title' =>'上传新文件 ',
'description' =>'通过这可以上传图片、FLASH、视频/音频、附件/其它等附件 ',
'purview' =>'',
'linkurl' =>'media_add.php'
'title' => '上传新文件 ',
'description' => '通过这可以上传图片、FLASH、视频/音频、附件/其它等附件 ',
'purview' => '',
'linkurl' => 'media_add.php'
),
1 => array(
'title' =>'附件数据管理 ',
'description' =>'列出所有上传的附件',
'purview' =>'sys_Upload,sys_MyUpload',
'linkurl' =>'media_main.php'
'title' => '附件数据管理 ',
'description' => '列出所有上传的附件',
'purview' => 'sys_Upload,sys_MyUpload',
'linkurl' => 'media_main.php'
),
2 => array(
'title' =>'文件式管理器 ',
'description' =>'应用文件浏览的模式进行附件的管理',
'purview' =>'plus_文件管理器',
'linkurl' =>'media_main.php?dopost=filemanager'
'title' => '文件式管理器 ',
'description' => '应用文件浏览的模式进行附件的管理',
'purview' => 'plus_文件管理器',
'linkurl' => 'media_main.php?dopost=filemanager'
),
)
);
$actionSearch[3] = array(
'toptitle' => '核心',
'toptitle' => '核心',
'title' => '频道模型',
'description' => '所有上传的附件管理',
'soniterm' => array(
0 => array(
'title' =>'内容模型管理 ',
'description' =>'可以对现有商品、软件、图片集、普通文章、专题、分类信息等模型就行管理,也可以创建新的内容模型',
'purview' =>'c_List',
'linkurl' =>'mychannel_main.php'
'title' => '内容模型管理 ',
'description' => '可以对现有商品、软件、图片集、普通文章、专题、分类信息等模型就行管理,也可以创建新的内容模型',
'purview' => 'c_List',
'linkurl' => 'mychannel_main.php'
),
1 => array(
'title' =>'单页文档管理 ',
'description' =>'创建和管理单页面',
'purview' =>'temp_One',
'linkurl' =>'templets_one.php'
'title' => '单页文档管理 ',
'description' => '创建和管理单页面',
'purview' => 'temp_One',
'linkurl' => 'templets_one.php'
),
2 => array(
'title' =>'联动类别管理 ',
'description' =>'创建和管理所有的联动',
'purview' =>'c_Stepseclect',
'linkurl' =>'stepselect_main.php?dopost=filemanager'
'title' => '联动类别管理 ',
'description' => '创建和管理所有的联动',
'purview' => 'c_Stepseclect',
'linkurl' => 'stepselect_main.php?dopost=filemanager'
),
3 => array(
'title' =>'自由列表管理 ',
'description' =>'创建不同的列表形式',
'purview' =>'c_List',
'linkurl' =>'freelist_main.php'
'title' => '自由列表管理 ',
'description' => '创建不同的列表形式',
'purview' => 'c_List',
'linkurl' => 'freelist_main.php'
),
4 => array(
'title' =>'自定义表单 ',
'description' =>'创建和管理自定义表单',
'purview' =>'c_List',
'linkurl' =>'diy_main.php'
'title' => '自定义表单 ',
'description' => '创建和管理自定义表单',
'purview' => 'c_List',
'linkurl' => 'diy_main.php'
),
)
);
$actionSearch[4] = array(
'toptitle' => '核心',
'toptitle' => '核心',
'title' => '批量维护',
'description' => '对一些东西进行批量的删除,添加等等',
'soniterm' => array(
0 => array(
'title' =>'更新系统缓存 ',
'description' =>'更新栏目缓存、更新枚举缓存 、清理arclist调用缓存 、清理过期会员访问历史 、删除过期短信',
'purview' =>'sys_ArcBatch',
'linkurl' =>'sys_cache_up.php'
'title' => '更新系统缓存 ',
'description' => '更新栏目缓存、更新枚举缓存 、清理arclist调用缓存 、清理过期会员访问历史 、删除过期短信',
'purview' => 'sys_ArcBatch',
'linkurl' => 'sys_cache_up.php'
),
1 => array(
'title' =>'文档批量维护 ',
'description' =>'批量的对某个栏目或者全部栏目的内容进行审核文档、更新HTML、移动文档、删除文档',
'purview' =>'sys_ArcBatch',
'linkurl' =>'content_batch_up.php'
'title' => '文档批量维护 ',
'description' => '批量的对某个栏目或者全部栏目的内容进行审核文档、更新HTML、移动文档、删除文档',
'purview' => 'sys_ArcBatch',
'linkurl' => 'content_batch_up.php'
),
2 => array(
'title' =>'搜索关键词维护 ',
'description' =>'对已经进行的所有所搜的关键词进行管理',
'purview' =>'sys_Keyword',
'linkurl' =>'search_keywords_main.php?dopost=filemanager'
'title' => '搜索关键词维护 ',
'description' => '对已经进行的所有所搜的关键词进行管理',
'purview' => 'sys_Keyword',
'linkurl' => 'search_keywords_main.php?dopost=filemanager'
),
3 => array(
'title' =>'文档关键词维护 ',
'description' =>'对文档中的关键词进行批量的维护',
'purview' =>'sys_Keyword',
'linkurl' =>'article_keywords_main.php'
'title' => '文档关键词维护 ',
'description' => '对文档中的关键词进行批量的维护',
'purview' => 'sys_Keyword',
'linkurl' => 'article_keywords_main.php'
),
4 => array(
'title' =>'重复文档检测 ',
'description' =>'可以对网站中出现的重复标题的文档进行处理',
'purview' =>'sys_ArcBatch',
'linkurl' =>'article_test_same.php'
'title' => '重复文档检测 ',
'description' => '可以对网站中出现的重复标题的文档进行处理',
'purview' => 'sys_ArcBatch',
'linkurl' => 'article_test_same.php'
),
5 => array(
'title' =>'自动摘要|分页 ',
'description' =>'用于自动更新您系统没有填写摘要的文档的摘要信息或更新没分页的文档的自动分页标识',
'purview' =>'sys_Keyword',
'linkurl' =>'article_description_main.php'
'title' => '自动摘要|分页 ',
'description' => '用于自动更新您系统没有填写摘要的文档的摘要信息或更新没分页的文档的自动分页标识',
'purview' => 'sys_Keyword',
'linkurl' => 'article_description_main.php'
),
6 => array(
'title' =>'Tag标签管理 ',
'description' =>'对整个网站的tag进行批量的维护',
'purview' =>'sys_Keyword',
'linkurl' =>'tags_main.php'
'title' => 'Tag标签管理 ',
'description' => '对整个网站的tag进行批量的维护',
'purview' => 'sys_Keyword',
'linkurl' => 'tags_main.php'
),
7 => array(
'title' =>'数据库内容替换 ',
'description' =>'可以对数据库中的某张表中的字段进行内容的批量替换',
'purview' =>'sys_ArcBatch',
'linkurl' =>'sys_data_replace.php'
'title' => '数据库内容替换 ',
'description' => '可以对数据库中的某张表中的字段进行内容的批量替换',
'purview' => 'sys_ArcBatch',
'linkurl' => 'sys_data_replace.php'
),
)
);
$actionSearch[5] = array(
'toptitle' => '会员',
'toptitle' => '会员',
'title' => '会员管理',
'description' => '注册会员及积分等配置管理',
'soniterm' => array(
0 => array(
'title' =>'注册会员列表',
'description' =>'所有注册会员的管理项,其中包含修改,删除,查看会员文档以及提升管理员等操作',
'purview' =>'member_List',
'linkurl' =>'member_main.php'
'title' => '注册会员列表',
'description' => '所有注册会员的管理项,其中包含修改,删除,查看会员文档以及提升管理员等操作',
'purview' => 'member_List',
'linkurl' => 'member_main.php'
),
1 => array(
'title' =>'会员级别设置',
'description' =>'设置会员的级别,可以通过设计不同会员的访问权限来对会员级别进行一个扩展',
'purview' =>'member_Type',
'linkurl' =>'member_rank.php'
'title' => '会员级别设置',
'description' => '设置会员的级别,可以通过设计不同会员的访问权限来对会员级别进行一个扩展',
'purview' => 'member_Type',
'linkurl' => 'member_rank.php'
),
2 => array(
'title' =>'积分头衔设置',
'description' =>'会员积分等级设置,根据会员活动积分对会员进行头衔划分',
'purview' =>'member_Type',
'linkurl' =>'member_scores.php'
'title' => '积分头衔设置',
'description' => '会员积分等级设置,根据会员活动积分对会员进行头衔划分',
'purview' => 'member_Type',
'linkurl' => 'member_scores.php'
),
4 => array(
'title' =>'会员短信管理',
'description' =>'会员之间发送的短消息管理,其中包含群发短消息和对单个会员发送短消息两种',
'purview' =>'member_Type',
'linkurl' =>'member_pm.php'
'title' => '会员短信管理',
'description' => '会员之间发送的短消息管理,其中包含群发短消息和对单个会员发送短消息两种',
'purview' => 'member_Type',
'linkurl' => 'member_pm.php'
),
)
);
$actionSearch[6] = array(
'toptitle' => '会员',
'toptitle' => '会员',
'title' => '支付工具',
'description' => '站点财务相关设置,包含点卡,商店订单等操作',
'soniterm' => array(
0 => array(
'title' =>'点卡产品分类',
'description' =>'网站点卡产品分类,可以添加不同点数的点卡产品类型',
'purview' =>'sys_Data',
'linkurl' =>'cards_type.php'
'title' => '点卡产品分类',
'description' => '网站点卡产品分类,可以添加不同点数的点卡产品类型',
'purview' => 'sys_Data',
'linkurl' => 'cards_type.php'
),
1 => array(
'title' =>'点卡产品管理',
'description' =>'管理网站点卡,可以在这里生成点卡以及查看点卡的当前状态',
'purview' =>'sys_Data',
'linkurl' =>'cards_manage.php'
'title' => '点卡产品管理',
'description' => '管理网站点卡,可以在这里生成点卡以及查看点卡的当前状态',
'purview' => 'sys_Data',
'linkurl' => 'cards_manage.php'
),
2 => array(
'title' =>'会员产品分类',
'description' =>'可以将会员类型进行产品划分,比如出售高级会员1年这种,在这里可以对会员产品进行定义',
'purview' =>'sys_Data',
'linkurl' =>'member_type.php'
'title' => '会员产品分类',
'description' => '可以将会员类型进行产品划分,比如出售高级会员1年这种,在这里可以对会员产品进行定义',
'purview' => 'sys_Data',
'linkurl' => 'member_type.php'
),
3 => array(
'title' =>'会员消费记录',
'description' =>'会员在前台进行操作、消费积分的消费记录,同时可以查看消费充值订单的付款情况',
'purview' =>'sys_Data',
'linkurl' =>'member_operations.php'
'title' => '会员消费记录',
'description' => '会员在前台进行操作、消费积分的消费记录,同时可以查看消费充值订单的付款情况',
'purview' => 'sys_Data',
'linkurl' => 'member_operations.php'
),
4 => array(
'title' =>'商店订单记录',
'description' =>'前台会员商店提交的订单记录,这里可以对这些订单进行一个统一的管理',
'purview' =>'sys_Data',
'linkurl' =>'shops_operations.php'
'title' => '商店订单记录',
'description' => '前台会员商店提交的订单记录,这里可以对这些订单进行一个统一的管理',
'purview' => 'sys_Data',
'linkurl' => 'shops_operations.php'
),
5 => array(
'title' =>'支付接口设置',
'description' =>'商店以及会员产品付款用到的在线付款方式需要设置的支付接口,这里含有常用的接口,例如:支付宝,易宝等',
'purview' =>'sys_Data',
'linkurl' =>'sys_payment.php'
'title' => '支付接口设置',
'description' => '商店以及会员产品付款用到的在线付款方式需要设置的支付接口,这里含有常用的接口,例如:支付宝,易宝等',
'purview' => 'sys_Data',
'linkurl' => 'sys_payment.php'
),
6 => array(
'title' =>'配货方式设置',
'description' =>'网站在线商城的送货方式,这里可以对其进行编辑管理',
'purview' =>'sys_Data',
'linkurl' =>'shops_delivery.php'
'title' => '配货方式设置',
'description' => '网站在线商城的送货方式,这里可以对其进行编辑管理',
'purview' => 'sys_Data',
'linkurl' => 'shops_delivery.php'
),
7 => array(
'title' =>'汇款账号设置',
'description' =>'银行付款的账号设置,用户可以查看到你的银行付款账号方便支付',
'purview' =>'sys_Data',
'linkurl' =>'shops_bank.php'
'title' => '汇款账号设置',
'description' => '银行付款的账号设置,用户可以查看到你的银行付款账号方便支付',
'purview' => 'sys_Data',
'linkurl' => 'shops_bank.php'
),
)
);
$actionSearch[7] = array(
'toptitle' => '生成',
'toptitle' => '生成',
'title' => '自动任务',
'description' => '一键生成静态管理',
'soniterm' => array(
0 => array(
'title' =>'一键更新网站',
'description' =>'可以一键生成所有静态页面',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_all.php'
'title' => '一键更新网站',
'description' => '可以一键生成所有静态页面',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_all.php'
),
1 => array(
'title' =>'更新系统缓存',
'description' =>'更新栏目缓存、更新枚举缓存、清理arclist调用缓存、清理过期会员访问历史、删除过期短信 ',
'purview' =>'sys_ArcBatch',
'linkurl' =>'sys_cache_up.php'
'title' => '更新系统缓存',
'description' => '更新栏目缓存、更新枚举缓存、清理arclist调用缓存、清理过期会员访问历史、删除过期短信 ',
'purview' => 'sys_ArcBatch',
'linkurl' => 'sys_cache_up.php'
),
)
);
$actionSearch[8] = array(
'toptitle' => '生成',
'toptitle' => '生成',
'title' => 'HTML更新',
'description' => '针对主页、栏目、文档、专题等等进行更新',
'soniterm' => array(
0 => array(
'title' =>'更新主页HTML',
'description' =>'生成网站主页面的HTML',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_homepage.php'
'title' => '更新主页HTML',
'description' => '生成网站主页面的HTML',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_homepage.php'
),
1 => array(
'title' =>'更新栏目 HTML',
'description' =>'对每个栏目进行静态HTML页面的生成',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_list.php'
'title' => '更新栏目 HTML',
'description' => '对每个栏目进行静态HTML页面的生成',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_list.php'
),
2 => array(
'title' =>'更新文档HTML',
'description' =>'对每个栏目下的文档进行静态HTML页面的生成',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_archives.php'
),
'title' => '更新文档HTML',
'description' => '对每个栏目下的文档进行静态HTML页面的生成',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_archives.php'
),
3 => array(
'title' =>'更新网站地图',
'description' =>'生成网站地图的静态HTML页面',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_map_guide.php'
'title' => '更新网站地图',
'description' => '生成网站地图的静态HTML页面',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_map_guide.php'
),
4 => array(
'title' =>'更新RSS文件 HTML',
'description' =>'对全站的RSS进行更新',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_rss.php'
'title' => '更新RSS文件 HTML',
'description' => '对全站的RSS进行更新',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_rss.php'
),
5 => array(
'title' =>'获取JS文件',
'description' =>'可以获取某个栏目的js连接',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_js.php'
'title' => '获取JS文件',
'description' => '可以获取某个栏目的js连接',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_js.php'
),
6 => array(
'title' =>'更新专题 HTML',
'description' =>'对专题进行静态HTML页面的生成',
'purview' =>'sys_MakeHtml',
'linkurl' =>'makehtml_spec.php'
'title' => '更新专题 HTML',
'description' => '对专题进行静态HTML页面的生成',
'purview' => 'sys_MakeHtml',
'linkurl' => 'makehtml_spec.php'
),
)
);
$actionSearch[9] = array(
'toptitle' => '模板',
'toptitle' => '模板',
'title' => '模板管理',
'description' => '针对主页、栏目、文档、专题等等进行更新',
'soniterm' => array(
0 => array(
'title' =>'默认模板管理 ',
'description' =>'对网站正在采用的模板文件进行管理',
'purview' =>'temp_All',
'linkurl' =>'templets_main.php'
'title' => '默认模板管理 ',
'description' => '对网站正在采用的模板文件进行管理',
'purview' => 'temp_All',
'linkurl' => 'templets_main.php'
),
1 => array(
'title' =>'标签源码管理 ',
'description' =>'对现有的标签文件进行修改、添加',
'purview' =>'temp_All',
'linkurl' =>'templets_tagsource.php'
'title' => '标签源码管理 ',
'description' => '对现有的标签文件进行修改、添加',
'purview' => 'temp_All',
'linkurl' => 'templets_tagsource.php'
),
2 => array(
'title' =>'自定义宏标记',
'description' =>'管理自定义标记',
'purview' =>'temp_MyTag',
'linkurl' =>'mytag_main.php'
),
'title' => '自定义宏标记',
'description' => '管理自定义标记',
'purview' => 'temp_MyTag',
'linkurl' => 'mytag_main.php'
),
3 => array(
'title' =>'智能标记向导',
'description' =>'可以根据需要生成相应的调用标签',
'purview' =>'temp_Other',
'linkurl' =>'mytag_tag_guide.php'
'title' => '智能标记向导',
'description' => '可以根据需要生成相应的调用标签',
'purview' => 'temp_Other',
'linkurl' => 'mytag_tag_guide.php'
),
4 => array(
'title' =>'全局标记测试 ',
'description' =>'可以对全局的标签调用进行测试',
'purview' =>'temp_Test',
'linkurl' =>'tag_test.php'
'title' => '全局标记测试 ',
'description' => '可以对全局的标签调用进行测试',
'purview' => 'temp_Test',
'linkurl' => 'tag_test.php'
),
)
);
$actionSearch[10] = array(
'toptitle' => '系统',
'toptitle' => '系统',
'title' => '系统设置',
'description' => '对网站的一些基本信息和配置进行管理',
'soniterm' => array(
0 => array(
'title' =>'系统基本参数',
'description' =>'包含站点设置、核心设置 、附件设置、会员设置、互动设置、性能选项、其它选项、模块设置、添加新变量等分类,其中有网站基本信息和网站的基本设置选项',
'purview' =>'sys_Edit',
'linkurl' =>'sys_info.php'
'title' => '系统基本参数',
'description' => '包含站点设置、核心设置 、附件设置、会员设置、互动设置、性能选项、其它选项、模块设置、添加新变量等分类,其中有网站基本信息和网站的基本设置选项',
'purview' => 'sys_Edit',
'linkurl' => 'sys_info.php'
),
1 => array(
'title' =>'系统用户管理',
'description' =>'对现有的网站管理员进行管理',
'purview' =>'sys_User',
'linkurl' =>'sys_admin_user.php'
'title' => '系统用户管理',
'description' => '对现有的网站管理员进行管理',
'purview' => 'sys_User',
'linkurl' => 'sys_admin_user.php'
),
2 => array(
'title' =>'用户组设定',
'description' =>'对网站管理员进行用户组别的划分',
'purview' =>'sys_Group',
'linkurl' =>'sys_group.php'
'title' => '用户组设定',
'description' => '对网站管理员进行用户组别的划分',
'purview' => 'sys_Group',
'linkurl' => 'sys_group.php'
),
3 => array(
'title' =>'系统日志管理',
'description' =>'对每个登录后台的管理员进行的操作进行记录',
'purview' =>'sys_Log',
'linkurl' =>'log_list.php'
'title' => '系统日志管理',
'description' => '对每个登录后台的管理员进行的操作进行记录',
'purview' => 'sys_Log',
'linkurl' => 'log_list.php'
),
5 => array(
'title' =>'图片水印设置',
'description' =>'对于上传的图片添加的水印进行配置',
'purview' =>'sys_Edit',
'linkurl' =>'sys_info_mark.php'
'title' => '图片水印设置',
'description' => '对于上传的图片添加的水印进行配置',
'purview' => 'sys_Edit',
'linkurl' => 'sys_info_mark.php'
),
6 => array(
'title' =>'自定义文档属性',
'description' =>'在以往的版本中,网站主页、频道封面的设计,都只能单调的用 arclist 标记把某栏目最新或按特定排序方式的文档无选择的读出来,这样做法存在很大的不足,在发布的时候对适合的文档选择专门的属性,那么使用arclist的地方就会按您的意愿显示指定的文档。',
'purview' =>'sys_Att',
'linkurl' =>'content_att.php'
'title' => '自定义文档属性',
'description' => '在以往的版本中,网站主页、频道封面的设计,都只能单调的用 arclist 标记把某栏目最新或按特定排序方式的文档无选择的读出来,这样做法存在很大的不足,在发布的时候对适合的文档选择专门的属性,那么使用arclist的地方就会按您的意愿显示指定的文档。',
'purview' => 'sys_Att',
'linkurl' => 'content_att.php'
),
7 => array(
'title' =>'软件频道设置',
'description' =>'可以对软件下载时的连接显示方式,下载方式,镜像服务器等等进行配置',
'purview' =>'sys_SoftConfig',
'linkurl' =>'soft_config.php'
'title' => '软件频道设置',
'description' => '可以对软件下载时的连接显示方式,下载方式,镜像服务器等等进行配置',
'purview' => 'sys_SoftConfig',
'linkurl' => 'soft_config.php'
),
8 => array(
'title' =>'防采集串混淆',
'description' =>'防采集混淆字符串管理',
'purview' =>'sys_StringMix',
'linkurl' =>'article_string_mix.php'
'title' => '防采集串混淆',
'description' => '防采集混淆字符串管理',
'purview' => 'sys_StringMix',
'linkurl' => 'article_string_mix.php'
),
9 => array(
'title' =>'随机模板设置',
'description' =>'本设置仅适用于系统默认的文章模型,设置后发布文章时会自动按指定的模板随机获取一个,如果不想使用此功能,把它设置为空即可!',
'purview' =>'sys_StringMix',
'linkurl' =>'article_template_rand.php'
'title' => '随机模板设置',
'description' => '本设置仅适用于系统默认的文章模型,设置后发布文章时会自动按指定的模板随机获取一个,如果不想使用此功能,把它设置为空即可!',
'purview' => 'sys_StringMix',
'linkurl' => 'article_template_rand.php'
),
10 => array(
'title' =>'计划任务管理',
'description' =>'可以添加一个指定时间运行的程序',
'purview' =>'sys_task',
'linkurl' =>'sys_task.php'
'title' => '计划任务管理',
'description' => '可以添加一个指定时间运行的程序',
'purview' => 'sys_task',
'linkurl' => 'sys_task.php'
),
11 => array(
'title' =>'数据库备份/还原',
'description' =>'对数据库进行备份和还原',
'purview' =>'sys_data',
'linkurl' =>'sys_data.php'
'title' => '数据库备份/还原',
'description' => '对数据库进行备份和还原',
'purview' => 'sys_data',
'linkurl' => 'sys_data.php'
),
12 => array(
'title' =>'SQL命令行工具',
'description' =>'可以在针对每张数据表执行单行或者多行的SQL语句',
'purview' =>'sys_data',
'linkurl' =>'sys_sql_query.php'
'title' => 'SQL命令行工具',
'description' => '可以在针对每张数据表执行单行或者多行的SQL语句',
'purview' => 'sys_data',
'linkurl' => 'sys_sql_query.php'
),
14 => array(
'title' =>'病毒扫描[S]',
'description' =>'以DedeCMS开发模式为标准对现有的文件进行扫描并进行判断',
'purview' =>'sys_verifies',
'linkurl' =>'sys_safetest.php'
'title' => '病毒扫描[S]',
'description' => '以DedeCMSV6开发模式为标准对现有的文件进行扫描并进行判断',
'purview' => 'sys_verifies',
'linkurl' => 'sys_safetest.php'
),
15 => array(
'title' =>'系统错误修复[S]',
'description' =>'由于手动升级时用户没运行指定的SQL语句,或自动升级的遗漏处理或处理出错,可能会导致一些错误,使用本工具会自动检测并处理。',
'purview' =>'sys_verifies',
'linkurl' =>'sys_repair.php'
'title' => '系统错误修复[S]',
'description' => '由于手动升级时用户没运行指定的SQL语句,或自动升级的遗漏处理或处理出错,可能会导致一些错误,使用本工具会自动检测并处理。',
'purview' => 'sys_verifies',
'linkurl' => 'sys_repair.php'
),
)
);
$actionSearch[11] = array(
'toptitle' => '采集',
'toptitle' => '采集',
'title' => '采集管理',
'description' => '内容采集管理操作',
'soniterm' => array(
0 => array(
'title' =>'采集节点管理 ',
'description' =>'单个采集节点的管理页面,可以添加采集,导入,导出采集节点等',
'purview' =>'co_ListNote',
'linkurl' =>'co_main.php'
'title' => '采集节点管理 ',
'description' => '单个采集节点的管理页面,可以添加采集,导入,导出采集节点等',
'purview' => 'co_ListNote',
'linkurl' => 'co_main.php'
),
1 => array(
'title' =>'临时内容管理 ',
'description' =>'采集的临时内容存放处',
'purview' =>'co_ViewNote',
'linkurl' =>'co_url.php'
'title' => '临时内容管理 ',
'description' => '采集的临时内容存放处',
'purview' => 'co_ViewNote',
'linkurl' => 'co_url.php'
),
2 => array(
'title' =>'导入采集规则',
'description' =>'导入采集的规则',
'purview' =>'co_GetOut',
'linkurl' =>'co_get_corule.php'
),
'title' => '导入采集规则',
'description' => '导入采集的规则',
'purview' => 'co_GetOut',
'linkurl' => 'co_get_corule.php'
),
3 => array(
'title' =>'智能标记向导',
'description' =>'可以根据需要生成相应的调用标签',
'purview' =>'temp_Other',
'linkurl' =>'mytag_tag_guide.php'
'title' => '智能标记向导',
'description' => '可以根据需要生成相应的调用标签',
'purview' => 'temp_Other',
'linkurl' => 'mytag_tag_guide.php'
),
4 => array(
'title' =>'监控采集模式 ',
'description' =>'监控采集模式',
'purview' =>'co_GetOut',
'linkurl' =>'co_gather_start.php'
'title' => '监控采集模式 ',
'description' => '监控采集模式',
'purview' => 'co_GetOut',
'linkurl' => 'co_gather_start.php'
),
5 => array(
'title' =>'采集未下载内容 ',
'description' =>'采集没有下载完成的内容',
'purview' =>'co_GetOut',
'linkurl' =>'co_do.php?dopost=coall'
'title' => '采集未下载内容 ',
'description' => '采集没有下载完成的内容',
'purview' => 'co_GetOut',
'linkurl' => 'co_do.php?dopost=coall'
),
)
);
);

+ 141
- 231
src/dede/inc/inc_archives_all.php View File

@@ -1,14 +1,15 @@
<?php
/**
* 模型解析相关函数
*
* @version $Id: inc_archives_all.php 1 9:56 2010年7月21日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
/**
* 获得一个附加表单
*
@@ -27,123 +28,94 @@ function GetFormItem($ctag)
</tr>
</table>\r\n";
$innertext = trim($ctag->GetInnerText());
if($innertext != "")
{
if($ctag->GetAtt("type") == 'select')
{
if ($innertext != "") {
if ($ctag->GetAtt("type") == 'select') {
$myformItem = '';
$items = explode(',', $innertext);
$myformItem = "<select name='$fieldname' style='width:150px'>";
foreach($items as $v)
{
foreach ($items as $v) {
$v = trim($v);
if($v!='')
{
$myformItem.= "<option value='$v'>$v</option>\r\n";
if ($v != '') {
$myformItem .= "<option value='$v'>$v</option>\r\n";
}
}
$myformItem .= "</select>\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $myformItem,$formitem);
$formitem = str_replace("~form~", $myformItem, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type") == 'radio')
{
} else if ($ctag->GetAtt("type") == 'radio') {
$myformItem = '';
$items = explode(',', $innertext);
foreach($items as $v)
{
foreach ($items as $v) {
$v = trim($v);
$i = 0;
if($v!='')
{
if($i==0)
{
if ($v != '') {
if ($i == 0) {
$myformItem .= "<label><input type='radio' name='$fieldname' class='np' value='$v' checked> $v</label>\r\n";
}
else
{
} else {
$myformItem .= "<label><input type='radio' name='$fieldname' class='np' value='$v'> $v</label>\r\n";
}
}
}
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $myformItem,$formitem);
$formitem = str_replace("~form~", $myformItem, $formitem);
return $formitem;
}
else
{
} else {
$formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace('~form~', $innertext,$formitem);
$formitem = str_replace('~form~', $innertext, $formitem);
$formitem = str_replace('@value', '', $formitem);
return $formitem;
}
}
if($ctag->GetAtt("type")=="htmltext"||$ctag->GetAtt("type")=="textdata")
{
if ($ctag->GetAtt("type") == "htmltext" || $ctag->GetAtt("type") == "textdata") {
$formitem = "";
$formitem .= "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">".$ctag->GetAtt('itemname')."</td><td>";
$formitem .= GetEditor($fieldname,'',350,'Basic','string');
$formitem .= "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">" . $ctag->GetAtt('itemname') . "</td><td>";
$formitem .= GetEditor($fieldname, '', 350, 'Basic', 'string');
$formitem .= "</td></tr></table>\r\n";
return $formitem;
}
else if($ctag->GetAtt("type")=="multitext")
{
} else if ($ctag->GetAtt("type") == "multitext") {
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:100%;height:80'></textarea>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="datetime")
{
} else if ($ctag->GetAtt("type") == "datetime") {
$nowtime = GetDateTimeMk(time());
$innertext = "<input name=\"$fieldname\" value=\"$nowtime\" type=\"text\" id=\"$fieldname\" style=\"width:200\">";
$innertext .= "<input name=\"selPubtime\" type=\"button\" id=\"selkeyword\" value=\"选择\" onClick=\"showCalendar('$fieldname', 'Y-m-d H:i:00', '24');\">";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="img")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='".$fieldname."_bt' type='button' value='浏览...' onClick=\"SelectImage('form1.$fieldname','big')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
} else if ($ctag->GetAtt("type") == "img") {
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectImage('form1.$fieldname','big')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="media")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='".$fieldname."_bt' type='button' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
} else if ($ctag->GetAtt("type") == "media") {
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="addon")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='".$fieldname."_bt' type='button' value='浏览...' onClick=\"SelectSoft('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
} else if ($ctag->GetAtt("type") == "addon") {
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectSoft('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="media")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='".$fieldname."_bt' type='button' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
} else if ($ctag->GetAtt("type") == "media") {
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if ($ctag->GetAtt("type")=="relation") {
} else if ($ctag->GetAtt("type") == "relation") {
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:100%;height:80'></textarea>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else
{
if($ctag->GetAtt('default')!="") $dfvalue = $ctag->GetAtt('default');
} else {
if ($ctag->GetAtt('default') != "") $dfvalue = $ctag->GetAtt('default');
else $dfvalue = "";
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:200' value='$dfvalue'>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
}
@@ -159,103 +131,77 @@ function GetFormItem($ctag)
* @param string $addvar 增加值
* @return string
*/
function GetFieldValue($dvalue,$dtype,$aid=0,$job='add',$addvar='')
function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '')
{
global $cfg_cookie_encode,$cfg_dir_purview,$isUrlOpen;
if($dtype=="int")
{
global $cfg_cookie_encode, $cfg_dir_purview, $isUrlOpen;
if ($dtype == "int") {
$dvalue = trim(preg_replace("#[^0-9]#", "", $dvalue));
if($dvalue=="") $dvalue = 0;
if ($dvalue == "") $dvalue = 0;
return $dvalue;
}
else if($dtype=="float")
{
} else if ($dtype == "float") {
$dvalue = trim(preg_replace("#[^0-9\.]#", "", $dvalue));
if($dvalue=="") $dvalue = 0;
if ($dvalue == "") $dvalue = 0;
return $dvalue;
}
else if($dtype=="datetime")
{
} else if ($dtype == "datetime") {
return GetMkTime($dvalue);
}
else if($dtype=="textdata")
{
if($job=='edit')
{
} else if ($dtype == "textdata") {
if ($job == 'edit') {
$addvarDirs = explode('/', $addvar);
$addvarDir = preg_replace("#\/".$addvarDirs[count($addvarDirs)-1]."$#", "", $addvar);
$mdir = $GLOBALS['cfg_basedir'].$addvarDir;
if(!is_dir($mdir))
{
$addvarDir = preg_replace("#\/" . $addvarDirs[count($addvarDirs) - 1] . "$#", "", $addvar);
$mdir = $GLOBALS['cfg_basedir'] . $addvarDir;
if (!is_dir($mdir)) {
MkdirAll($mdir, $GLOBALS['cfg_dir_purview']);
}
$fp = fopen($GLOBALS['cfg_basedir'].$addvar, "w");
$fp = fopen($GLOBALS['cfg_basedir'] . $addvar, "w");
fwrite($fp, stripslashes($dvalue));
fclose($fp);
CloseFtp();
return $addvar;
}
else
{
$ipath = $GLOBALS['cfg_cmspath']."/data/textdata";
$tpath = ceil($aid/5000);
if(!is_dir($GLOBALS['cfg_basedir'].$ipath))
{
MkdirAll($GLOBALS['cfg_basedir'].$ipath,$cfg_dir_purview);
} else {
$ipath = $GLOBALS['cfg_cmspath'] . "/data/textdata";
$tpath = ceil($aid / 5000);
if (!is_dir($GLOBALS['cfg_basedir'] . $ipath)) {
MkdirAll($GLOBALS['cfg_basedir'] . $ipath, $cfg_dir_purview);
}
if(!is_dir($GLOBALS['cfg_basedir'].$ipath.'/'.$tpath))
{
MkdirAll($GLOBALS['cfg_basedir'].$ipath.'/'.$tpath,$cfg_dir_purview);
if (!is_dir($GLOBALS['cfg_basedir'] . $ipath . '/' . $tpath)) {
MkdirAll($GLOBALS['cfg_basedir'] . $ipath . '/' . $tpath, $cfg_dir_purview);
}
$ipath = $ipath.'/'.$tpath;
$filename = "{$ipath}/{$aid}-".cn_substr(md5($cfg_cookie_encode), 0, 16).".txt";
$fp = fopen($GLOBALS['cfg_basedir'].$filename,"w");
$ipath = $ipath . '/' . $tpath;
$filename = "{$ipath}/{$aid}-" . cn_substr(md5($cfg_cookie_encode), 0, 16) . ".txt";
$fp = fopen($GLOBALS['cfg_basedir'] . $filename, "w");
fwrite($fp, stripslashes($dvalue));
fclose($fp);
CloseFtp();
return $filename;
}
}
else if($dtype=="img")
{
} else if ($dtype == "img") {
$iurl = stripslashes($dvalue);
if(trim($iurl)=="")
{
if (trim($iurl) == "") {
return "";
}
$iurl = trim(str_replace($GLOBALS['cfg_basehost'],"",$iurl));
$imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}";
if(preg_match("#^http:\/\/#i", $iurl) && $GLOBALS['isUrlOpen'])
{
$iurl = trim(str_replace($GLOBALS['cfg_basehost'], "", $iurl));
$imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}";
if (preg_match("#^http:\/\/#i", $iurl) && $GLOBALS['isUrlOpen']) {
//远程图片
$reimgs = "";
if($isUrlOpen)
{
$reimgs = GetRemoteImage($iurl,$GLOBALS['adminid']);
if(is_array($reimgs))
{
$imgurl = "{dede:img text='' width='".$reimgs[1]."' height='".$reimgs[2]."'} ".$reimgs[0]." {/dede:img}";
if ($isUrlOpen) {
$reimgs = GetRemoteImage($iurl, $GLOBALS['adminid']);
if (is_array($reimgs)) {
$imgurl = "{dede:img text='' width='" . $reimgs[1] . "' height='" . $reimgs[2] . "'} " . $reimgs[0] . " {/dede:img}";
}
} else {
$imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}";
}
else
{
$imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}";
}
}
else if($iurl!="")
{
} else if ($iurl != "") {
//站内图片
$imgfile = $GLOBALS['cfg_basedir'].$iurl;
if(is_file($imgfile))
{
$imgfile = $GLOBALS['cfg_basedir'] . $iurl;
if (is_file($imgfile)) {
$imginfos = GetImageSize($imgfile);
$imgurl = "{dede:img text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}";
$imgurl = "{dede:img text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}";
}
}
return addslashes($imgurl);
}
else
{
} else {
return $dvalue;
}
}
@@ -280,58 +226,42 @@ function GetFormItemValue($ctag, $fvalue)
</tr>
</table>\r\n";
$innertext = trim($ctag->GetInnerText());
if($innertext != "")
{
if($ctag->GetAtt("type") == 'select')
{
if ($innertext != "") {
if ($ctag->GetAtt("type") == 'select') {
$myformItem = '';
$items = explode(',', $innertext);
$myformItem = "<select name='$fieldname' style='width:150px'>";
foreach($items as $v)
{
foreach ($items as $v) {
$v = trim($v);
if($v!='')
{
if($fvalue==$v)
{
$myformItem.= "<option value='$v' selected>$v</option>\r\n";
}
else
{
$myformItem.= "<option value='$v'>$v</option>\r\n";
if ($v != '') {
if ($fvalue == $v) {
$myformItem .= "<option value='$v' selected>$v</option>\r\n";
} else {
$myformItem .= "<option value='$v'>$v</option>\r\n";
}
}
}
$myformItem .= "</select>\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $myformItem,$formitem);
$formitem = str_replace("~form~", $myformItem, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=='radio')
{
} else if ($ctag->GetAtt("type") == 'radio') {
$myformItem = '';
$items = explode(',', $innertext);
foreach($items as $v)
{
foreach ($items as $v) {
$v = trim($v);
if($v!='')
{
if($fvalue==$v)
{
$myformItem.= "<label><input type='radio' name='$fieldname' class='np' value='$v' checked> $v</label>\r\n";
}
else
{
$myformItem.= "<label><input type='radio' name='$fieldname' class='np' value='$v'> $v</label>\r\n";
if ($v != '') {
if ($fvalue == $v) {
$myformItem .= "<label><input type='radio' name='$fieldname' class='np' value='$v' checked> $v</label>\r\n";
} else {
$myformItem .= "<label><input type='radio' name='$fieldname' class='np' value='$v'> $v</label>\r\n";
}
}
}
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $myformItem,$formitem);
$formitem = str_replace("~form~", $myformItem, $formitem);
return $formitem;
}
else
{
} else {
$formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace('~form~', $innertext, $formitem);
$formitem = str_replace('@value', $fvalue, $formitem);
@@ -340,86 +270,66 @@ function GetFormItemValue($ctag, $fvalue)
}
//文本数据的特殊处理
if($ctag->GetAtt("type")=="textdata")
{
if(is_file($GLOBALS['cfg_basedir'].$fvalue))
{
$fp = fopen($GLOBALS['cfg_basedir'].$fvalue, 'r');
if ($ctag->GetAtt("type") == "textdata") {
if (is_file($GLOBALS['cfg_basedir'] . $fvalue)) {
$fp = fopen($GLOBALS['cfg_basedir'] . $fvalue, 'r');
$okfvalue = "";
while(!feof($fp))
{
$okfvalue .= fgets($fp,1024);
while (!feof($fp)) {
$okfvalue .= fgets($fp, 1024);
}
fclose($fp);
} else {
$okfvalue = "";
}
else
{
$okfvalue="";
}
$formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">".$ctag->GetAtt('itemname')."</td>\r\n";
$formitem .= "<td>\r\n".GetEditor($fieldname,$okfvalue,350,'Basic','string')."</td>\r\n";
$formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">" . $ctag->GetAtt('itemname') . "</td>\r\n";
$formitem .= "<td>\r\n" . GetEditor($fieldname, $okfvalue, 350, 'Basic', 'string') . "</td>\r\n";
$formitem .= "</tr></table>\r\n";
$formitem .= "<input type='hidden' name='{$fieldname}_file' value='{$fvalue}'>\r\n";
return $formitem;
}
else if($ctag->GetAtt("type")=="htmltext")
{
$formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">".$ctag->GetAtt('itemname')."</td>\r\n";
$formitem .= "<td>\r\n".GetEditor($fieldname,$fvalue,350,'Basic','string')."</td>\r\n";
} else if ($ctag->GetAtt("type") == "htmltext") {
$formitem = "<table width=\"800\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\">" . $ctag->GetAtt('itemname') . "</td>\r\n";
$formitem .= "<td>\r\n" . GetEditor($fieldname, $fvalue, 350, 'Basic', 'string') . "</td>\r\n";
$formitem .= "</tr></table>\r\n";
return $formitem;
}
else if($ctag->GetAtt("type")=="multitext")
{
} else if ($ctag->GetAtt("type") == "multitext") {
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:100%;height:80'>$fvalue</textarea>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="datetime")
{
} else if ($ctag->GetAtt("type") == "datetime") {
$nowtime = GetDateTimeMk($fvalue);
$innertext = "<input name=\"$fieldname\" value=\"$nowtime\" type=\"text\" id=\"$fieldname\" style=\"width:200\">";
$innertext .= "<input name=\"selPubtime\" type=\"button\" id=\"selkeyword\" value=\"选择\" onClick=\"showCalendar('$fieldname', 'Y-m-d H:i:00', '24');\">";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="img")
{
} else if ($ctag->GetAtt("type") == "img") {
$ndtp = new DedeTagParse();
$ndtp->LoadSource($fvalue);
if(!is_array($ndtp->CTags))
{
if (!is_array($ndtp->CTags)) {
$ndtp->Clear();
$fvalue = "";
}
$ntag = $ndtp->GetTag("img");
$fvalue = trim($ntag->GetInnerText());
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300'><input name='".$fieldname."_bt' type='button' value='浏览...' onClick=\"SelectImage('form1.$fieldname','big')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectImage('form1.$fieldname','big')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="media")
{
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300'><input name='".$fieldname."_bt' type='button' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
} else if ($ctag->GetAtt("type") == "media") {
$innertext = "<input type='text' name='$fieldname' value='$fvalue' id='$fieldname' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectMedia('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else if($ctag->GetAtt("type")=="addon")
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' value='$fvalue' style='width:300'><input name='".$fieldname."_bt' type='button' value='浏览...' onClick=\"SelectSoft('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
} else if ($ctag->GetAtt("type") == "addon") {
$innertext = "<input type='text' name='$fieldname' id='$fieldname' value='$fvalue' style='width:300'><input name='" . $fieldname . "_bt' type='button' value='浏览...' onClick=\"SelectSoft('form1.$fieldname')\">\r\n";
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
else
{
} else {
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:200' value='$fvalue'>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
$formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem);
$formitem = str_replace("~form~", $innertext, $formitem);
return $formitem;
}
}
}

+ 1
- 1
src/dede/inc/inc_archives_functions.php View File

@@ -4,7 +4,7 @@
* 文档操作相关函数
*
* @version $Id: inc_archives_functions.php 1 9:56 2010年7月21日Z tianya $
* @package DedeCMS.Administrator
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save