Browse Source

合并分支

tags/6.1.0^2
tianya 2 years ago
parent
commit
42bc5289ba
100 changed files with 7288 additions and 6975 deletions
  1. +1
    -1
      README.md
  2. +19
    -19
      dedebiz
  3. +20
    -21
      src/admin/action_search.php
  4. +96
    -97
      src/admin/actionsearch_class.php
  5. +0
    -2
      src/admin/ad_add.php
  6. +2
    -3
      src/admin/ad_edit.php
  7. +59
    -60
      src/admin/ad_main.php
  8. +42
    -43
      src/admin/adtype_main.php
  9. +313
    -313
      src/admin/album_add.php
  10. +377
    -377
      src/admin/album_edit.php
  11. +20
    -22
      src/admin/album_testhtml.php
  12. +198
    -198
      src/admin/archives_add.php
  13. +893
    -893
      src/admin/archives_do.php
  14. +209
    -209
      src/admin/archives_edit.php
  15. +151
    -151
      src/admin/archives_sg_add.php
  16. +139
    -139
      src/admin/archives_sg_edit.php
  17. +234
    -234
      src/admin/article_add.php
  18. +42
    -43
      src/admin/article_allowurl_edit.php
  19. +119
    -120
      src/admin/article_coonepage_rule.php
  20. +166
    -167
      src/admin/article_description_main.php
  21. +224
    -224
      src/admin/article_edit.php
  22. +92
    -93
      src/admin/article_keywords_main.php
  23. +203
    -204
      src/admin/article_keywords_make.php
  24. +37
    -38
      src/admin/article_keywords_select.php
  25. +45
    -46
      src/admin/article_select_sw.php
  26. +42
    -43
      src/admin/article_source_edit.php
  27. +0
    -1
      src/admin/article_string_mix.php
  28. +0
    -1
      src/admin/article_template_rand.php
  29. +83
    -84
      src/admin/article_test_same.php
  30. +18
    -19
      src/admin/article_test_title.php
  31. +44
    -45
      src/admin/article_writer_edit.php
  32. +77
    -78
      src/admin/baidunews.php
  33. +58
    -59
      src/admin/cards_make.php
  34. +66
    -67
      src/admin/cards_manage.php
  35. +48
    -49
      src/admin/cards_type.php
  36. +212
    -237
      src/admin/catalog_add.php
  37. +41
    -42
      src/admin/catalog_del.php
  38. +298
    -299
      src/admin/catalog_do.php
  39. +250
    -245
      src/admin/catalog_edit.php
  40. +14
    -15
      src/admin/catalog_main.php
  41. +23
    -24
      src/admin/catalog_menu.php
  42. +1
    -1
      src/admin/config.php
  43. +29
    -30
      src/admin/content_att.php
  44. +13
    -14
      src/admin/content_batch_up.php
  45. +185
    -186
      src/admin/content_batchup_action.php
  46. +12
    -13
      src/admin/content_i_list.php
  47. +202
    -203
      src/admin/content_list.php
  48. +15
    -16
      src/admin/content_s_list.php
  49. +12
    -13
      src/admin/content_select_list.php
  50. +86
    -87
      src/admin/content_sg_list.php
  51. +50
    -51
      src/admin/content_tj.php
  52. +0
    -0
      src/admin/css/albumupload.css
  53. +1
    -0
      src/admin/css/base.css
  54. +53
    -53
      src/admin/css/boxy.css
  55. +0
    -0
      src/admin/css/codemirror.css
  56. +1
    -0
      src/admin/css/frame.css
  57. +0
    -0
      src/admin/css/indexbody.css
  58. +0
    -0
      src/admin/css/lurd.css
  59. +0
    -0
      src/admin/css/menuold.css
  60. +0
    -0
      src/admin/css/tb-box.css
  61. +31
    -37
      src/admin/dialog/config.php
  62. +0
    -0
      src/admin/dialog/img/addnews.gif
  63. +0
    -0
      src/admin/dialog/img/adminuserico.gif
  64. +0
    -0
      src/admin/dialog/img/allbg.gif
  65. +0
    -0
      src/admin/dialog/img/book1.gif
  66. +0
    -0
      src/admin/dialog/img/css.gif
  67. +0
    -0
      src/admin/dialog/img/dir.gif
  68. +0
    -0
      src/admin/dialog/img/dir2.gif
  69. +0
    -0
      src/admin/dialog/img/exe.gif
  70. +0
    -0
      src/admin/dialog/img/flash.gif
  71. +0
    -0
      src/admin/dialog/img/gif.gif
  72. +0
    -0
      src/admin/dialog/img/htm.gif
  73. +0
    -0
      src/admin/dialog/img/img.gif
  74. +0
    -0
      src/admin/dialog/img/jpg.gif
  75. +0
    -0
      src/admin/dialog/img/js.gif
  76. +0
    -0
      src/admin/dialog/img/mp3.gif
  77. +0
    -0
      src/admin/dialog/img/php.gif
  78. +0
    -0
      src/admin/dialog/img/picviewnone.gif
  79. +0
    -0
      src/admin/dialog/img/rm.gif
  80. +0
    -0
      src/admin/dialog/img/sp_bg.gif
  81. +0
    -0
      src/admin/dialog/img/tbg.gif
  82. +0
    -0
      src/admin/dialog/img/tbgv.gif
  83. +0
    -0
      src/admin/dialog/img/txt.gif
  84. +0
    -0
      src/admin/dialog/img/wbg.gif
  85. +0
    -0
      src/admin/dialog/img/wmv.gif
  86. +0
    -0
      src/admin/dialog/img/zip.gif
  87. +228
    -0
      src/admin/dialog/select_images.php
  88. +91
    -100
      src/admin/dialog/select_images_post.php
  89. +187
    -0
      src/admin/dialog/select_media.php
  90. +25
    -27
      src/admin/dialog/select_media_post.php
  91. +172
    -174
      src/admin/dialog/select_soft.php
  92. +91
    -104
      src/admin/dialog/select_soft_post.php
  93. +194
    -200
      src/admin/dialog/select_templets.php
  94. +42
    -44
      src/admin/dialog/select_templets_post.php
  95. +63
    -64
      src/admin/diy_add.php
  96. +75
    -76
      src/admin/diy_edit.php
  97. +108
    -109
      src/admin/diy_field_add.php
  98. +122
    -123
      src/admin/diy_field_edit.php
  99. +203
    -203
      src/admin/diy_list.php
  100. +21
    -22
      src/admin/diy_main.php

+ 1
- 1
README.md View File

@@ -77,7 +77,7 @@ Sockets:支持接入DedeBIZ商业组件模块

2.上传程序目录中的`/src`到网站根目录;

3.运行`http://www.yourname.com/install/index.php`(yourname表示的域名),按照安装提速说明进行程序安装;
3.运行`http://www.yourname.com/install/index.php`(yourname表示的域名),按照安装提速说明进行程序安装;

详细安装步骤可以查看[帮助文档](https://www.dedebiz.com/help)



+ 19
- 19
dedebiz View File

@@ -5,11 +5,11 @@
*
* @version 2020年12月11日 tianya $
* @package DedeBIZ.Command
* @copyright Copyright (c) 2021, DedeBIZ.COM
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
// 切换工作目录到./src
//切换工作目录到./src
$workDir = dirname(__FILE__) . "/src";
chdir($workDir);

@@ -32,7 +32,7 @@ WEBSITE:
https://www.dedebiz.com/help/
";

// 将选项转化为SQL IN参数
//将选项转化为SQL IN参数
function Option2SQLin($str = "")
{
$str = preg_replace("#[^0-9-,]#", "", $str);
@@ -72,8 +72,8 @@ function RandEncode($length=26)
}

if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
// PHP5.4以下不支持内建服务器
// 用于开发调试
//PHP5.4以下不支持内建服务器
//用于开发调试
if (phpversion() < "5.4") {
die("DedeBIZ:command web server not support\n\n");
}
@@ -89,10 +89,10 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
require_once($workDir . "/include/common.inc.php");
require_once(DEDEINC . "/cli.class.php");

// 一个命令行的生成工具
//一个命令行的生成工具
if (count($argv) > 2 && ($argv[2] == "arc" || $argv[2] == "a")) {
// 生成文档
// make arc typeid=1
//生成文档
//make arc typeid=1
$t1 = ExecTime();
$addsql = "1=1";
$typeid = Option2SQLin(DedeCli::getOption("typeid"));
@@ -120,7 +120,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
DedeCli::write($queryTime);
exit;
} else if (count($argv) > 2 && ($argv[2] == "list" || $argv[2] == "l")) {
// 生成栏目
//生成栏目
$addsql = "1=1";
$typeid = Option2SQLin(DedeCli::getOption("typeid"));
if (!empty($typeid)) {
@@ -140,7 +140,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
}
exit;
} else if (count($argv) > 2 && ($argv[2] == "index" || $argv[2] == "i")) {
// 生成首页
//生成首页
$position = DedeCli::getOption("position");
if (empty($position)) {
$position = "../index.html";
@@ -162,7 +162,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$pv->SaveToHtml($homeFile);
DedeCli::write("Make index html successfull");
} else if (count($argv) > 2 && ($argv[2] == "auto" || $argv[2] == "o")) {
// 自动生成
//自动生成
function OptimizeData($dsql)
{
global $cfg_dbprefix;
@@ -184,7 +184,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
exit;
}

// 1.生成首页
//1.生成首页
$pv = new PartView();
$row = $pv->dsql->GetOne("SELECT * FROM `#@__homepageset` ");
$templet = str_replace("{style}", $cfg_df_style, $row['templet']);
@@ -199,7 +199,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
if (file_exists($homeFile)) @unlink($homeFile);
}
DedeCli::write("Make index html successfull");
// 2.生成栏目
//2.生成栏目
$query = "SELECT DISTINCT typeid From `#@__arctiny` WHERE senddate >=" . $start . " AND arcrank>-1";
$dsql->SetQuery($query);
$dsql->Execute();
@@ -234,7 +234,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
DedeCli::write("Make list html successfull");
}

// 生成文档
//生成文档
$tt = $dsql->GetOne("SELECT COUNT(id) as dd FROM `#@__arctiny` WHERE senddate >=" . $start . " AND arcrank>-1");
$total = intval($tt['dd']);
$dsql->Execute('out', "SELECT id FROM `#@__arctiny` WHERE senddate >=" . $start . " AND arcrank>-1 ORDER BY typeid ASC");
@@ -248,7 +248,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
}
DedeCli::write("Make archives html successfull");
// 优化数据
//优化数据
OptimizeData($dsql);
DedeCli::write("Optimize data successfull");
} else {
@@ -274,7 +274,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
define("DEDEINC", $workDir."/include");
require_once(DEDEINC."/dedehttpdown.class.php");
require_once(DEDEINC . "/cli.class.php");
// 更新系统
//更新系统
$latestURL = "https://cdn.dedebiz.com/release/latest.txt";
$del = new DedeHttpDown();
$del->OpenUrl($latestURL);
@@ -292,11 +292,11 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
$del->OpenUrl($fileHashURL);
$filelist = $del->GetJSON();
$offFiles = array();
// TODO 命令行自动更新
//TODO 命令行自动更新
} else if (count($argv) > 1 && ($argv[1] == "quick" || $argv[1] == "q")){
define("DEDEINC", $workDir."/include");
require_once(DEDEINC . "/cli.class.php");
// 快速开始一个用于开发的DedeBIZ环境,基于SQLite无其他依赖
//快速开始一个用于开发的DedeBIZ环境,基于SQLite无其他依赖
if (file_exists($workDir."/data/DedeBIZ.db")) {
DedeCli::write("development environment has inited");
echo "Start Dev Server For DedeBIZ\n\r";
@@ -304,7 +304,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) {
passthru(PHP_BINARY . ' -S localhost:8088 -t' . escapeshellarg('./'));
exit;
}
// 初始化安装一个开发环境
//初始化安装一个开发环境
$db = new SQLite3($workDir.'/data/DedeBIZ.db');
$fp = fopen($workDir."/install/common.inc.php","r");
$configStr1 = fread($fp,filesize($workDir."/install/common.inc.php"));


src/dede/action_search.php → src/admin/action_search.php View File

@@ -1,21 +1,20 @@
<?php
/**
* 检索操作
*
* @version $Id: action_search.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
//增加权限检查
if (empty($dopost)) $dopost = "";
$keyword = empty($keyword) ? "" : RemoveXss($keyword);
$actsearch = new ActionSearch($keyword);
$asresult = $actsearch->Search();
include DedeInclude('templets/action_search.htm');
<?php
/**
* 检索操作
*
* @version $Id: action_search.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");

//增加权限检查
if (empty($dopost)) $dopost = "";

$keyword = empty($keyword) ? "" : RemoveXss($keyword);
$actsearch = new ActionSearch($keyword);
$asresult = $actsearch->Search();
include DedeInclude('templets/action_search.htm');

src/dede/actionsearch_class.php → src/admin/actionsearch_class.php View File

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

function __construct($keyword)
{
$this->asarray = $this->GetSearchstr();
$this->keyword = $keyword;
}

//初始化系统
function ActionSearch($keyword)
{
$this->__construct($keyword);
}

function GetSearchstr()
{
require_once(dirname(__FILE__)."/inc/inc_action_info.php");
return is_array($actionSearch) ? $actionSearch : array();
}

function search()
{
$this->searchkeyword();
return $this->result;
}

/**
* 遍历功能配置项进行关键词匹配
*
* @return void
*/
function searchkeyword()
{
$i = 0; //数组序列索引
foreach ($this->asarray as $key => $value) {
//对二级项目进行匹配
if (is_array($this->asarray[$key]['soniterm'])) {
foreach ($this->asarray[$key]['soniterm'] as $k => $val) {
//进行权限判断
if (TestPurview($val['purview'])) {
//如果有操作权限
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']);
$this->result[$i]['description'] = $this->redColorKeyword($this->asarray[$key]['description']);
//二级项目匹配
$this->result[$i]['soniterm'][] = $this->redColorKeyword($val);
}
}
}
}
$i++;
}
}

/**
* 加亮关键词
*
* @access public
* @param string $text 关键词
* @return string
*/
function redColorKeyword($text)
{
if (is_array($text)) {
foreach ($text as $key => $value) {
if ($key == 'title' || $key == 'description') {
//仅对title,description进行数组替换
$text[$key] = str_replace($this->keyword, '<span style="color:#e74d58">'.$this->keyword.'</span>', $text[$key]);
}
}
} else {
$text = str_replace($this->keyword, '<span style="color:#e74d58">'.$this->keyword.'</span>', $text);
}
return $text;
}

function _strpos($string, $find)
{
if (function_exists('stripos')) return stripos($string, $find);
return strpos($string, $find);
}
}

src/dede/ad_add.php → src/admin/ad_add.php View File

@@ -1,5 +1,4 @@
<?php

/**
* 广告添加
*
@@ -9,7 +8,6 @@
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/

require(dirname(__FILE__)."/config.php");
CheckPurview('plus_广告管理');
require_once DEDEINC."/typelink.class.php";

src/dede/ad_edit.php → src/admin/ad_edit.php View File

@@ -1,5 +1,4 @@
<?php

/**
* 广告编辑
*
@@ -28,7 +27,7 @@ if ($dopost == 'delete') {
$row = $dsql->GetOne("SELECT tagname from `#@__myad` WHERE aid='$aid' ");

$showtag = '{'."dede:myad name='{$row['tagname']}'/".'}';
$info = "<b>说明:</b>如果嵌入的是织梦CMS广告标签,那么将会解析成标签中的内容到页面,广告改后需要重新生成。<br />
$info = "<b>说明:</b>如果嵌入的是织梦CMS广告标签,那么将会解析成标签中的内容到页面,广告改后需要重新生成。<br />
如果不希望重新生成所有页面,则直接调用JS代码即可。
";
$wintitle = "广告管理-获取广告标签";
@@ -63,7 +62,7 @@ if ($dopost == 'delete') {
WHERE aid='$aid'
";
$dsql->ExecuteNoneQuery($query);
ShowMsg("成功改一则广告代码", $ENV_GOBACK_URL);
ShowMsg("成功改一则广告代码", $ENV_GOBACK_URL);
exit();
}


src/dede/ad_main.php → src/admin/ad_main.php View File

@@ -1,60 +1,59 @@
<?php
/**
* 广告管理
*
* @version $Id: ad_main.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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, '/');
$clsid = isset($clsid) ? intval($clsid) : 0;
$keyword = isset($keyword) ? addslashes($keyword) : '';
$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$option = '';
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%') ";
$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
LEFT JOIN `#@__arctype` tp on tp.id=ad.typeid
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->SetSource($sql);
$dlist->display();
function TestType($tname, $type = "")
{
if ($tname == "") {
return ($type == 1) ? "默认分类" : "所有栏目";
} else {
return $tname;
}
}
function TimeSetValue($ts)
{
if ($ts == 0) {
return "不限时间";
} else {
return "限时标记";
}
}
<?php
/**
* 广告管理
*
* @version $Id: ad_main.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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, '/');

$clsid = isset($clsid) ? intval($clsid) : 0;
$keyword = isset($keyword) ? addslashes($keyword) : '';

$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC');
$option = '';
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%') ";

$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
LEFT JOIN `#@__arctype` tp on tp.id=ad.typeid
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->SetSource($sql);
$dlist->display();

function TestType($tname, $type = "")
{
if ($tname == "") {
return ($type == 1) ? "默认分类" : "所有栏目";
} else {
return $tname;
}
}

function TimeSetValue($ts)
{
if ($ts == 0) {
return "不限时间";
} else {
return "限时标记";
}
}

src/dede/adtype_main.php → src/admin/adtype_main.php View File

@@ -1,43 +1,42 @@
<?php
/**
* 友情链接类型
*
* @version $Id: friendlink_type.php 1 8:48 2010年7月13日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($dopost)) $dopost = '';
//保存更改
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for (; $startID <= $endID; $startID++) {
$query = '';
$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 {
$query = "DELETE FROM `#@__myadtype` WHERE id='$tid' ";
$dsql->ExecuteNoneQuery($query);
}
}
//增加新记录
if (isset($check_new) && $pname_new != '') {
$query = "INSERT INTO `#@__myadtype`(typename) VALUES('{$pname_new}');";
$dsql->ExecuteNoneQuery($query);
}
header("Content-Type: text/html; charset={$cfg_soft_lang}");
ShowMsg("成功更新广告分类列表", 'adtype_main.php');
exit;
}
include DedeInclude('templets/adtype_main.htm');
<?php
/**
* 友情链接类型
*
* @version $Id: friendlink_type.php 1 8:48 2010年7月13日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($dopost)) $dopost = '';

//保存修改
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for (; $startID <= $endID; $startID++) {
$query = '';
$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 {
$query = "DELETE FROM `#@__myadtype` WHERE id='$tid' ";
$dsql->ExecuteNoneQuery($query);
}
}
//增加新记录
if (isset($check_new) && $pname_new != '') {
$query = "INSERT INTO `#@__myadtype`(typename) VALUES('{$pname_new}');";
$dsql->ExecuteNoneQuery($query);
}
header("Content-Type: text/html; charset={$cfg_soft_lang}");
ShowMsg("成功更新广告分类列表", 'adtype_main.php');
exit;
}

include DedeInclude('templets/adtype_main.htm');

src/dede/album_add.php → src/admin/album_add.php View File

@@ -1,314 +1,314 @@
<?php
/**
* 图集发布
*
* @version $Id: album_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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");
if (empty($dopost)) $dopost = '';
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) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
} 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");
exit();
}
/*--------------------------------
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) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$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));
$userip = GetIP();
$isremote = 0;
$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 ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
$imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$row' col='$col' value='$pagestyle'/}\r\n";
$hasone = FALSE;
//处理并保存从网上复制的图片
/*---------------------
function _getformhtml()
------------------*/
if ($formhtml == 1) {
$imagebody = stripslashes($imagebody);
$imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
if ($ddisfirst == 1 && $litpic == '' && !empty($litpicname)) {
$litpic = $litpicname;
$hasone = TRUE;
}
}
/*---------------------
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);
$ntime = time();
if (file_exists($zipfile)) {
@mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile, $tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
$i = 0;
foreach ($imgs as $imgold) {
$i++;
$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);
unlink($imgold);
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);
}
}
$info = '';
$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');";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $iurl);
WaterImg($imgfile, 'up');
if (!$hasone && $ddisfirst == 1 && $litpic == '') {
if (empty($litpicname)) {
$litpicname = $iurl;
$litpicname = GetImageMapDD($iurl, $cfg_ddimg_width);
}
$litpic = $litpicname;
$hasone = TRUE;
}
}
}
if ($delzip == 1) unlink($zipfile);
$fm->RmDirFiles($tmpzipdir);
}
}
if ($albums !== "") {
$albumsArr = json_decode(stripslashes($albums), true);
for ($i = 0; $i <= count($albumsArr) - 1; $i++) {
$album = $albumsArr[$i];
$data = explode(',', $album['img']);
$ntime = time();
$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]));
$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";
if ($ddisfirst == 1 && $litpic == '' && !empty($fullUrl)) {
$litpic = $fullUrl;
}
}
}
$imgurls = addslashes($imgurls);
//处理body字段自动摘要、自动提取缩略图等
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery(" DELETE FROM `#@__arctiny` WHERE id='$arcID' ");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//加入附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if (empty($addtable)) {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//生成HTML
InsertTags($tags, $arcID);
$artUrl = MakeArt($arcID, TRUE, TRUE, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='album_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布图片</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改图集</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布图片管理</a>&nbsp;&nbsp;$backurl";
$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);
$win->Display();
<?php
/**
* 图集发布
*
* @version $Id: album_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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");
if (empty($dopost)) $dopost = '';
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) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
} 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");
exit();
}
/*--------------------------------
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) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$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));
$userip = GetIP();
$isremote = 0;
$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 ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
$imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$row' col='$col' value='$pagestyle'/}\r\n";
$hasone = FALSE;
//处理并保存从网上复制的图片
/*---------------------
function _getformhtml()
------------------*/
if ($formhtml == 1) {
$imagebody = stripslashes($imagebody);
$imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
if ($ddisfirst == 1 && $litpic == '' && !empty($litpicname)) {
$litpic = $litpicname;
$hasone = TRUE;
}
}
/*---------------------
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);
$ntime = time();
if (file_exists($zipfile)) {
@mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile, $tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
$i = 0;
foreach ($imgs as $imgold) {
$i++;
$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);
unlink($imgold);
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);
}
}
$info = '';
$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');";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $iurl);
WaterImg($imgfile, 'up');
if (!$hasone && $ddisfirst == 1 && $litpic == '') {
if (empty($litpicname)) {
$litpicname = $iurl;
$litpicname = GetImageMapDD($iurl, $cfg_ddimg_width);
}
$litpic = $litpicname;
$hasone = TRUE;
}
}
}
if ($delzip == 1) unlink($zipfile);
$fm->RmDirFiles($tmpzipdir);
}
}
if ($albums !== "") {
$albumsArr = json_decode(stripslashes($albums), true);
for ($i = 0; $i <= count($albumsArr) - 1; $i++) {
$album = $albumsArr[$i];
$data = explode(',', $album['img']);
$ntime = time();
$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]));
$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";
if ($ddisfirst == 1 && $litpic == '' && !empty($fullUrl)) {
$litpic = $fullUrl;
}
}
}
$imgurls = addslashes($imgurls);
//处理body字段自动摘要、自动提取缩略图等
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_v = '';
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') {
continue;
}
$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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery(" DELETE FROM `#@__arctiny` WHERE id='$arcID' ");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//加入附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if (empty($addtable)) {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//生成HTML
InsertTags($tags, $arcID);
$artUrl = MakeArt($arcID, TRUE, TRUE, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='album_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布图片</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改图集</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布图片管理</a>&nbsp;&nbsp;$backurl";
$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);
$win->Display();
}

src/dede/album_edit.php → src/admin/album_edit.php View File

@@ -1,378 +1,378 @@
<?php
/**
* 图集编辑
*
* @version $Id: album_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($dopost)) $dopost = '';
if ($dopost != 'save') {
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
//读取归档信息
$arcQuery = "SELECT ch.typename as channelname,ar.membername as rankname,arc.*
FROM `#@__archives` arc
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");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$cInfos = $dsql->GetOne($query);
if (!is_array($cInfos)) {
ShowMsg("读取频道配置信息出错!", "javascript:;");
exit();
}
$addtable = $cInfos['addtable'];
$addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'");
$channelid = $arcRow['channel'];
$imgurls = $addRow["imgurls"];
$maxwidth = $addRow["maxwidth"];
$pagestyle = $addRow["pagestyle"];
$irow = $addRow["row"];
$icol = $addRow["col"];
$isrm = $addRow["isrm"];
$body = $addRow["body"];
$ddmaxwidth = $addRow["ddmaxwidth"];
$pagepicnum = $addRow["pagepicnum"];
$tags = GetTags($aid);
$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');
$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;
if ($typeid == 0) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
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));
$isremote = 0;
$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 ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
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 ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$query = "
UPDATE `#@__archives` SET
typeid='$typeid',
typeid2='$typeid2',
sortrank='$sortrank',
flag='$flag',
click='$click',
ismake='$ismake',
arcrank='$arcrank',
money='$money',
title='$title',
color='$color',
source='$source',
writer='$writer',
litpic='$litpic',
pubdate='$pubdate',
notpost='$notpost',
description='$description',
keywords='$keywords',
shorttitle='$shorttitle',
filename='$filename',
dutyadmin='$adminid'
WHERE id='$id'; ";
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg("更新数据库archives表时出错,请检查".$dsql->GetError(), "javascript:;");
exit();
}
$imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$row' col='$col' value='$pagestyle'/}\r\n";
$hasone = false;
//----------------------------------------
//检查旧的图片是否有更新,并保存
//-----------------------------------------
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;
//有上传文件的情况
if (isset(${'imgfile'.$i}) && is_uploaded_file(${'imgfile'.$i})) {
$tmpFile = ${'imgfile'.$i};
//检测上传的图片, 如果类型不对,保留原来图片
$imginfos = @GetImageSize($tmpFile, $info);
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";
continue;
}
move_uploaded_file($tmpFile, $imgfile);
$imginfos = @GetImageSize($imgfile, $info);
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);
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";
}
//没上传图片(只修改msg信息)
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";
}
}
//----------------------------
//从HTML中获取新图片
//----------------------------
if ($formhtml == 1 && !empty($imagebody)) {
$imagebody = stripslashes($imagebody);
$imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
if ($ddisfirst == 1 && $litpic == "" && !empty($litpicname)) {
$litpic = $litpicname;
$hasone = true;
}
}
/*---------------------
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);
$ntime = time();
if (file_exists($zipfile)) {
@mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile, $tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
$i = 0;
foreach ($imgs as $imgold) {
$i++;
$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);
unlink($imgold);
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";
//把图片信息保存到媒体文档管理档案中
$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');";
$dsql->ExecuteNoneQuery($inquery);
if (
!$hasone && $ddisfirst == 1
&& $litpic == "" && !empty($litpicname)
) {
if (file_exists($cfg_basedir.$litpicname)) {
$litpic = $litpicname;
$hasone = true;
}
}
}
}
if ($delzip == 1) {
unlink($zipfile);
}
$fm->RmDirFiles($tmpzipdir);
}
}
if ($albums !== "") {
$albumsArr = json_decode(stripslashes($albums), true);
// var_dump($albumsArr);exit;
for ($i = 0; $i <= count($albumsArr) - 1; $i++) {
$album = $albumsArr[$i];
$data = explode(',', $album['img']);
$ntime = time();
$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]));
$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 = addslashes($imgurls);
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//更新附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if ($addtable != '') {
$useip = GetIP();
$query = "Update `$addtable`
set typeid='$typeid',
pagestyle='$pagestyle',
body='$body',
maxwidth = '$maxwidth',
ddmaxwidth = '$ddmaxwidth',
pagepicnum = '$pagepicnum',
imgurls='$imgurls',
`row`='$row',
col='$col',
isrm='$isrm'{$inadd_f},
redirecturl='$redirecturl',
userip = '$useip'
WHERE aid='$id'; ";
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因".$dsql->GetError(), "javascript:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
$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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='album_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布图片</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$arcUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理已发布图片</a>&nbsp;&nbsp;$backurl";
$wintitle = "成功更改图集";
$wecome_info = "文章管理::更改图集";
$win = new OxWindow();
$win->AddTitle("成功更改一个图集:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
<?php
/**
* 图集编辑
*
* @version $Id: album_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($dopost)) $dopost = '';
if ($dopost != 'save') {
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
//读取归档信息
$arcQuery = "SELECT ch.typename as channelname,ar.membername as rankname,arc.*
FROM `#@__archives` arc
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");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$cInfos = $dsql->GetOne($query);
if (!is_array($cInfos)) {
ShowMsg("读取频道配置信息出错!", "javascript:;");
exit();
}
$addtable = $cInfos['addtable'];
$addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'");
$channelid = $arcRow['channel'];
$imgurls = $addRow["imgurls"];
$maxwidth = $addRow["maxwidth"];
$pagestyle = $addRow["pagestyle"];
$irow = $addRow["row"];
$icol = $addRow["col"];
$isrm = $addRow["isrm"];
$body = $addRow["body"];
$ddmaxwidth = $addRow["ddmaxwidth"];
$pagepicnum = $addRow["pagepicnum"];
$tags = GetTags($aid);
$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');
$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;
if ($typeid == 0) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
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));
$isremote = 0;
$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 ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
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 ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$query = "
UPDATE `#@__archives` SET
typeid='$typeid',
typeid2='$typeid2',
sortrank='$sortrank',
flag='$flag',
click='$click',
ismake='$ismake',
arcrank='$arcrank',
money='$money',
title='$title',
color='$color',
source='$source',
writer='$writer',
litpic='$litpic',
pubdate='$pubdate',
notpost='$notpost',
description='$description',
keywords='$keywords',
shorttitle='$shorttitle',
filename='$filename',
dutyadmin='$adminid'
WHERE id='$id'; ";
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg("更新数据库archives表时出错,请检查".$dsql->GetError(), "javascript:;");
exit();
}
$imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$row' col='$col' value='$pagestyle'/}\r\n";
$hasone = false;
//----------------------------------------
//检查旧的图片是否有更新,并保存
//-----------------------------------------
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;
//有上传文件的情况
if (isset(${'imgfile'.$i}) && is_uploaded_file(${'imgfile'.$i})) {
$tmpFile = ${'imgfile'.$i};
//检测上传的图片, 如果类型不对,保留原来图片
$imginfos = @GetImageSize($tmpFile, $info);
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";
continue;
}
move_uploaded_file($tmpFile, $imgfile);
$imginfos = @GetImageSize($imgfile, $info);
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);
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";
}
//没上传图片(只修改msg信息)
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";
}
}
//----------------------------
//从HTML中获取新图片
//----------------------------
if ($formhtml == 1 && !empty($imagebody)) {
$imagebody = stripslashes($imagebody);
$imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
if ($ddisfirst == 1 && $litpic == "" && !empty($litpicname)) {
$litpic = $litpicname;
$hasone = true;
}
}
/*---------------------
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);
$ntime = time();
if (file_exists($zipfile)) {
@mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile, $tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
$i = 0;
foreach ($imgs as $imgold) {
$i++;
$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);
unlink($imgold);
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";
//把图片信息保存到媒体文档管理档案中
$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');";
$dsql->ExecuteNoneQuery($inquery);
if (
!$hasone && $ddisfirst == 1
&& $litpic == "" && !empty($litpicname)
) {
if (file_exists($cfg_basedir.$litpicname)) {
$litpic = $litpicname;
$hasone = true;
}
}
}
}
if ($delzip == 1) {
unlink($zipfile);
}
$fm->RmDirFiles($tmpzipdir);
}
}
if ($albums !== "") {
$albumsArr = json_decode(stripslashes($albums), true);
//var_dump($albumsArr);exit;
for ($i = 0; $i <= count($albumsArr) - 1; $i++) {
$album = $albumsArr[$i];
$data = explode(',', $album['img']);
$ntime = time();
$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]));
$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 = addslashes($imgurls);
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//更新附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if ($addtable != '') {
$useip = GetIP();
$query = "Update `$addtable`
set typeid='$typeid',
pagestyle='$pagestyle',
body='$body',
maxwidth = '$maxwidth',
ddmaxwidth = '$ddmaxwidth',
pagepicnum = '$pagepicnum',
imgurls='$imgurls',
`row`='$row',
col='$col',
isrm='$isrm'{$inadd_f},
redirecturl='$redirecturl',
userip = '$useip'
WHERE aid='$id'; ";
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg("更新附加表 `$addtable` 时出错,请检查原因".$dsql->GetError(), "javascript:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
$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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='album_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布图片</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$arcUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理已发布图片</a>&nbsp;&nbsp;$backurl";
$wintitle = "成功修改图集";
$wecome_info = "文章管理::修改图集";
$win = new OxWindow();
$win->AddTitle("成功修改一个图集:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}

src/dede/album_testhtml.php → src/admin/album_testhtml.php View File

@@ -1,22 +1,20 @@
<?php
/**
* 图集测试
*
* @version $Id: album_testhtml.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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";
preg_match_all("/(src|SRC)=[\"|'| ]{0,}(http:\/\/(.*)\.(gif|jpg|jpeg|png))/isU", $myhtml, $img_array);
$img_array = array_unique($img_array[2]);
echo "<div class='coolbg62'><xmp>";
echo "捕获的图片:\r\n";
print_r($img_array);
echo "</xmp></div>\r\n";
<?php
/**
* 图集测试
*
* @version $Id: album_testhtml.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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";
preg_match_all("/(src|SRC)=[\"|'| ]{0,}(http:\/\/(.*)\.(gif|jpg|jpeg|png))/isU", $myhtml, $img_array);
$img_array = array_unique($img_array[2]);
echo "<div class='coolbg62'><xmp>";
echo "捕获的图片:\r\n";
print_r($img_array);
echo "</xmp></div>\r\n";

src/dede/archives_add.php → src/admin/archives_add.php View File

@@ -1,199 +1,199 @@
<?php
/**
* 文档发布
*
* @version $Id: archives_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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');
if (empty($dopost)) $dopost = '';
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) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
} else {
if ($channelid == 0) {
ShowMsg('无法识别模型信息,因此无法操作', '-1');
exit();
}
}
//获得频道模型信息
$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/archives_add.htm');
exit();
}
/*--------------------------------
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) {
ShowMsg('请指定文档的栏目', '-1');
exit();
}
if (empty($channelid)) {
ShowMsg('文档为非指定的类型,请检查您发布内容的表单是否合法', '-1');
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg('您所选择的栏目与当前模型不相符,请选择白色的选项', '-1');
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$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));
$userip = GetIP();
$isremote = 0;
$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)) {
$ddisremote = 0;
}
$litpic = GetDDImage('none', $picname, $ddisremote);
// 处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
//分析处理附加表数据
$inadd_f = $inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') continue;
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
${$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);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//保存到附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
}
//生成HTML
InsertTags($tags, $arcID);
$artUrl = MakeArt($arcID, true, true, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布文档</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a>&nbsp;&nbsp;$backurl";
$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);
$win->Display();
<?php
/**
* 文档发布
*
* @version $Id: archives_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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');
if (empty($dopost)) $dopost = '';
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) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
} else {
if ($channelid == 0) {
ShowMsg('无法识别模型信息,因此无法操作', '-1');
exit();
}
}
//获得频道模型信息
$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/archives_add.htm');
exit();
}
/*--------------------------------
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) {
ShowMsg('请指定文档的栏目', '-1');
exit();
}
if (empty($channelid)) {
ShowMsg('文档为非指定的类型,请检查您发布内容的表单是否合法', '-1');
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg('您所选择的栏目与当前模型不相符,请选择白色的选项', '-1');
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$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));
$userip = GetIP();
$isremote = 0;
$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)) {
$ddisremote = 0;
}
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
//分析处理附加表数据
$inadd_f = $inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') continue;
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
${$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);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//保存到附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
}
//生成HTML
InsertTags($tags, $arcID);
$artUrl = MakeArt($arcID, true, true, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布文档</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a>&nbsp;&nbsp;$backurl";
$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);
$win->Display();
}

src/admin/archives_do.php
File diff suppressed because it is too large
View File


src/dede/archives_edit.php → src/admin/archives_edit.php View File

@@ -1,210 +1,210 @@
<?php
/**
* 文档编辑
*
* @version $Id: archives_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($dopost)) $dopost = '';
if ($dopost != 'save') {
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
//读取归档信息
$arcQuery = "SELECT ch.typename as channelname,ar.membername as rankname,arc.*
FROM `#@__archives` arc
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");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$cInfos = $dsql->GetOne($query);
if (!is_array($cInfos)) {
ShowMsg("读取频道配置信息出错!", "javascript:;");
exit();
}
$addtable = $cInfos['addtable'];
$addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'");
$channelid = $arcRow['channel'];
$tags = GetTags($aid);
include DedeInclude("templets/archives_edit.htm");
exit();
}
/*--------------------------------
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");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
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, $cfg_auot_description);
$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;
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$inQuery = "UPDATE `#@__archives` SET
typeid='$typeid',
typeid2='$typeid2',
sortrank='$sortrank',
flag='$flag',
notpost='$notpost',
click='$click',
ismake='$ismake',
arcrank='$arcrank',
money='$money',
title='$title',
color='$color',
writer='$writer',
source='$source',
litpic='$litpic',
pubdate='$pubdate',
description='$description',
keywords='$keywords',
shorttitle='$shorttitle',
filename='$filename',
dutyadmin='$adminid',
weight='$weight'
WHERE id='$id'; ";
if (!$dsql->ExecuteNoneQuery($inQuery)) {
ShowMsg("更新数据库archives表时出错,请检查", "-1");
exit();
}
$cts = $dsql->GetOne("SELECT addtable From `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['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:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
$artUrl = MakeArt($id, TRUE, TRUE, $isremote);
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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布新文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a>&nbsp;&nbsp;$backurl";
$wintitle = "成功更改文档";
$wecome_info = "文档管理::更改文档";
$win = new OxWindow();
$win->AddTitle("成功更改文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
<?php
/**
* 文档编辑
*
* @version $Id: archives_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($dopost)) $dopost = '';
if ($dopost != 'save') {
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
//读取归档信息
$arcQuery = "SELECT ch.typename as channelname,ar.membername as rankname,arc.*
FROM `#@__archives` arc
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");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$cInfos = $dsql->GetOne($query);
if (!is_array($cInfos)) {
ShowMsg("读取频道配置信息出错!", "javascript:;");
exit();
}
$addtable = $cInfos['addtable'];
$addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'");
$channelid = $arcRow['channel'];
$tags = GetTags($aid);
include DedeInclude("templets/archives_edit.htm");
exit();
}
/*--------------------------------
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");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
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, $cfg_auot_description);
$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;
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$inQuery = "UPDATE `#@__archives` SET
typeid='$typeid',
typeid2='$typeid2',
sortrank='$sortrank',
flag='$flag',
notpost='$notpost',
click='$click',
ismake='$ismake',
arcrank='$arcrank',
money='$money',
title='$title',
color='$color',
writer='$writer',
source='$source',
litpic='$litpic',
pubdate='$pubdate',
description='$description',
keywords='$keywords',
shorttitle='$shorttitle',
filename='$filename',
dutyadmin='$adminid',
weight='$weight'
WHERE id='$id'; ";
if (!$dsql->ExecuteNoneQuery($inQuery)) {
ShowMsg("更新数据库archives表时出错,请检查", "-1");
exit();
}
$cts = $dsql->GetOne("SELECT addtable From `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['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:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
$artUrl = MakeArt($id, TRUE, TRUE, $isremote);
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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布新文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a>&nbsp;&nbsp;$backurl";
$wintitle = "成功修改文档";
$wecome_info = "文档管理::修改文档";
$win = new OxWindow();
$win->AddTitle("成功修改文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}

src/dede/archives_sg_add.php → src/admin/archives_sg_add.php View File

@@ -1,152 +1,152 @@
<?php
/**
* 单表模型文档发布
*
* @version $Id: archives_sg_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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");
if (empty($dopost)) $dopost = '';
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) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
} else {
if ($channelid == 0) {
ShowMsg("无法识别模型信息,因此无法操作", "-1");
exit();
}
}
//获得频道模型信息
$cInfos = $dsql->GetOne(" SELECT * FROM `#@__channeltype` WHERE id='$channelid' ");
$channelid = $cInfos['id'];
include DedeInclude("templets/archives_sg_add.htm");
exit();
}
/*--------------------------------
function __save(){ }
-------------------------------*/
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");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
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);
$isremote = 0;
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$adminid = $cuserLogin->getUserID();
$userip = GetIP();
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $senddate, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
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)) {
$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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
}
//生成HTML
$artUrl = MakeArt($arcID, TRUE, TRUE, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_sg_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布文档</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改文档</a>&nbsp;&nbsp;<a href='content_sg_list.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a>&nbsp;&nbsp;<a href='catalog_main.php' class='btn btn-success btn-sm'>网站栏目管理</a>";
$wintitle = "成功发布文档";
$wecome_info = "文档管理::发布文档";
$win = new OxWindow();
$win->AddTitle("成功发布文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
<?php
/**
* 单表模型文档发布
*
* @version $Id: archives_sg_add.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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");
if (empty($dopost)) $dopost = '';
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) {
$row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; ");
$channelid = $row['channeltype'];
} else {
if ($channelid == 0) {
ShowMsg("无法识别模型信息,因此无法操作", "-1");
exit();
}
}
//获得频道模型信息
$cInfos = $dsql->GetOne(" SELECT * FROM `#@__channeltype` WHERE id='$channelid' ");
$channelid = $cInfos['id'];
include DedeInclude("templets/archives_sg_add.htm");
exit();
}
/*--------------------------------
function __save(){ }
-------------------------------*/
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");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
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);
$isremote = 0;
$serviterm = empty($serviterm) ? "" : $serviterm;
if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1;
$adminid = $cuserLogin->getUserID();
$userip = GetIP();
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $senddate, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
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)) {
$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)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
}
//生成HTML
$artUrl = MakeArt($arcID, TRUE, TRUE, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_sg_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布文档</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改文档</a>&nbsp;&nbsp;<a href='content_sg_list.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a>&nbsp;&nbsp;<a href='catalog_main.php' class='btn btn-success btn-sm'>网站栏目管理</a>";
$wintitle = "成功发布文档";
$wecome_info = "文档管理::发布文档";
$win = new OxWindow();
$win->AddTitle("成功发布文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}

src/dede/archives_sg_edit.php → src/admin/archives_sg_edit.php View File

@@ -1,139 +1,139 @@
<?php
/**
* 单表模型文档编辑
*
* @version $Id: archives_sg_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($dopost)) $dopost = '';
if ($dopost != 'save') {
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
//读取归档信息
$arcQuery = "SELECT ch.*,arc.* FROM `#@__arctiny` arc
LEFT JOIN `#@__channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
$cInfos = $dsql->GetOne($arcQuery);
if (!is_array($cInfos)) {
ShowMsg("读频道模型信息出错", "-1");
exit();
}
$addtable = $cInfos['addtable'];
$addRow = $dsql->GetOne("SELECT arc.*,ar.membername as rankname FROM `$addtable` arc LEFT JOIN `#@__arcrank` ar on ar.rank=arc.arcrank WHERE arc.aid='$aid'");
$channelid = $cInfos['channel'];
$tags = GetTags($aid);
include DedeInclude('templets/archives_sg_edit.htm');
exit();
}
/*--------------------------------
function __save(){ }
-------------------------------*/
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");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_Edit')) {
if (TestPurview('a_AccEdit')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的文档权限");
} else {
CheckArcAdmin($id, $cuserLogin->getUserID());
}
}
//对保存的内容进行处理
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;
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
// 加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//处理图片文档的自定义属性
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 != '') {
$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:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, '');
$artUrl = MakeArt($id, TRUE, TRUE, $isremote);
if ($artUrl == '') $artUrl = $cfg_phpurl."/view.php?aid=$id";
ClearMyAddon($id, $title);
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_sg_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布新文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a>&nbsp;&nbsp;<a href='catalog_main.php' class='btn btn-success btn-sm'>网站栏目管理</a>";
$wintitle = "成功更改文档";
$wecome_info = "文档管理::更改文档";
$win = new OxWindow();
$win->AddTitle("成功更改文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}
<?php
/**
* 单表模型文档编辑
*
* @version $Id: archives_sg_edit.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($dopost)) $dopost = '';
if ($dopost != 'save') {
require_once(DEDEADMIN."/inc/inc_catalog_options.php");
require_once(DEDEINC."/dedetag.class.php");
ClearMyAddon();
$aid = intval($aid);
//读取归档信息
$arcQuery = "SELECT ch.*,arc.* FROM `#@__arctiny` arc
LEFT JOIN `#@__channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
$cInfos = $dsql->GetOne($arcQuery);
if (!is_array($cInfos)) {
ShowMsg("读频道模型信息出错", "-1");
exit();
}
$addtable = $cInfos['addtable'];
$addRow = $dsql->GetOne("SELECT arc.*,ar.membername as rankname FROM `$addtable` arc LEFT JOIN `#@__arcrank` ar on ar.rank=arc.arcrank WHERE arc.aid='$aid'");
$channelid = $cInfos['channel'];
$tags = GetTags($aid);
include DedeInclude('templets/archives_sg_edit.htm');
exit();
}
/*--------------------------------
function __save(){ }
-------------------------------*/
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");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_Edit')) {
if (TestPurview('a_AccEdit')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的文档权限");
} else {
CheckArcAdmin($id, $cuserLogin->getUserID());
}
}
//对保存的内容进行处理
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;
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if (empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//处理图片文档的自定义属性
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 != '') {
$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:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, '');
$artUrl = MakeArt($id, TRUE, TRUE, $isremote);
if ($artUrl == '') $artUrl = $cfg_phpurl."/view.php?aid=$id";
ClearMyAddon($id, $title);
//返回成功信息
$msg = "请选择您的后续操作:<a href='archives_sg_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布新文档</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a>&nbsp;&nbsp;<a href='catalog_main.php' class='btn btn-success btn-sm'>网站栏目管理</a>";
$wintitle = "成功修改文档";
$wecome_info = "文档管理::修改文档";
$win = new OxWindow();
$win->AddTitle("成功修改文档:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}

src/dede/article_add.php → src/admin/article_add.php View File

@@ -1,235 +1,235 @@
<?php
/**
* 文档发布
*
* @version $Id: article_add.php 2020年9月14日 tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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');
if (file_exists(DEDEDATA.'/template.rand.php')) {
require_once(DEDEDATA.'/template.rand.php');
}
if (empty($dopost)) $dopost = '';
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);
if (empty($litpic_b64)) $litpic_b64 = '';
if (empty($geturl)) $geturl = '';
$keywords = $writer = $source = $body = $description = $title = '';
//采集单个网页
if (preg_match("#^http:\/\/#", $geturl)) {
require_once(DEDEADMIN."/inc/inc_coonepage.php");
$redatas = CoOnePage($geturl);
extract($redatas);
}
//获得频道模型ID
if ($cid > 0 && $channelid == 0) {
$row = $dsql->GetOne("Select channeltype From `#@__arctype` where id='$cid'; ");
$channelid = $row['channeltype'];
} else {
if ($channelid == 0) {
$channelid = 1;
}
}
//获得频道模型信息
$cInfos = $dsql->GetOne(" Select * From `#@__channeltype` where id='$channelid' ");
//获取文章最大id以确定当前权重
$maxWright = $dsql->GetOne("SELECT COUNT(*) AS cc FROM `#@__archives`");
include DedeInclude("templets/article_add.htm");
exit();
}
/*--------------------------------
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 = '';
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 (empty($typeid)) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$sortrank = AddDay($pubdate, $sortup);
$ismake = $ishtml == 0 ? -1 : 0;
$title = preg_replace("#\"#", '"', $title);
$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, $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')) {
$arcrank = -1;
}
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if (empty($ddisremote)) {
$ddisremote = 0;
}
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
if (trim($title) == '') {
ShowMsg('标题不能为空', '-1');
exit();
}
//处理body字段自动摘要、自动提取缩略图等
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//自动分页
if ($sptype == 'auto') {
$body = SpLongBody($body, $spsize * 1024, "#p#分页标题#e#");
}
//分析处理附加表数据
$inadd_f = $inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') continue;
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
${$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);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
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','0','$notpost','$description','$keywords','$filename','$adminid','$weight');";
if (!$dsql->ExecuteNoneQuery($query)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//保存到附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if (empty($addtable)) {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作。", "javascript:;");
exit();
}
$useip = GetIP();
$templet = empty($templet) ? '' : $templet;
$query = "INSERT INTO `{$addtable}`(aid,typeid,redirecturl,templet,userip,body{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$templet','$useip','$body'{$inadd_v})";
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}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//生成HTML
InsertTags($tags, $arcID);
$picTitle = false;
if (count($_SESSION['bigfile_info']) > 0) {
foreach ($_SESSION['bigfile_info'] as $k => $v) {
if (!empty($v)) {
$pictitle = ${'picinfook'.$k};
$titleSet = '';
if (!empty($pictitle)) {
$picTitle = TRUE;
$titleSet = ",title='{$pictitle}'";
}
$dsql->ExecuteNoneQuery("UPDATE `#@__uploads` SET arcid='{$arcID}'{$titleSet} WHERE url LIKE '{$v}'; ");
}
}
}
$artUrl = MakeArt($arcID, true, true, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='article_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布文章</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改文章</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文章管理</a>&nbsp;&nbsp;$backurl";
$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);
$win->Display();
<?php
/**
* 文档发布
*
* @version $Id: article_add.php 2020年9月14日 tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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');
if (file_exists(DEDEDATA.'/template.rand.php')) {
require_once(DEDEDATA.'/template.rand.php');
}
if (empty($dopost)) $dopost = '';
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);
if (empty($litpic_b64)) $litpic_b64 = '';
if (empty($geturl)) $geturl = '';
$keywords = $writer = $source = $body = $description = $title = '';
//采集单个网页
if (preg_match("#^http:\/\/#", $geturl)) {
require_once(DEDEADMIN."/inc/inc_coonepage.php");
$redatas = CoOnePage($geturl);
extract($redatas);
}
//获得频道模型ID
if ($cid > 0 && $channelid == 0) {
$row = $dsql->GetOne("Select channeltype From `#@__arctype` where id='$cid'; ");
$channelid = $row['channeltype'];
} else {
if ($channelid == 0) {
$channelid = 1;
}
}
//获得频道模型信息
$cInfos = $dsql->GetOne(" Select * From `#@__channeltype` where id='$channelid' ");
//获取文章最大id以确定当前权重
$maxWright = $dsql->GetOne("SELECT COUNT(*) AS cc FROM `#@__archives`");
include DedeInclude("templets/article_add.htm");
exit();
}
/*--------------------------------
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 = '';
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 (empty($typeid)) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
if (!TestPurview('a_New')) {
CheckCatalog($typeid, "对不起,您没有操作栏目 {$typeid} 的权限");
}
//对保存的内容进行处理
if (empty($writer)) $writer = $cuserLogin->getUserName();
if (empty($source)) $source = '未知';
$pubdate = GetMkTime($pubdate);
$senddate = time();
$sortrank = AddDay($pubdate, $sortup);
$ismake = $ishtml == 0 ? -1 : 0;
$title = preg_replace("#\"#", '"', $title);
$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, $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')) {
$arcrank = -1;
}
$adminid = $cuserLogin->getUserID();
//处理上传的缩略图
if (empty($ddisremote)) {
$ddisremote = 0;
}
$litpic = GetDDImage('none', $picname, $ddisremote);
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//生成文档ID
$arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid);
if (empty($arcID)) {
ShowMsg("无法获得主键,因此无法进行后续操作", "-1");
exit();
}
if (trim($title) == '') {
ShowMsg('标题不能为空', '-1');
exit();
}
//处理body字段自动摘要、自动提取缩略图等
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//自动分页
if ($sptype == 'auto') {
$body = SpLongBody($body, $spsize * 1024, "#p#分页标题#e#");
}
//分析处理附加表数据
$inadd_f = $inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
if (is_array($addonfields)) {
foreach ($addonfields as $v) {
if ($v == '') continue;
$vs = explode(',', $v);
if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') {
${$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);
}
$inadd_f .= ','.$vs[0];
$inadd_v .= " ,'".${$vs[0]}."' ";
}
}
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
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','0','$notpost','$description','$keywords','$filename','$adminid','$weight');";
if (!$dsql->ExecuteNoneQuery($query)) {
$gerr = $dsql->GetError();
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//保存到附加表
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['addtable']);
if (empty($addtable)) {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'");
ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作。", "javascript:;");
exit();
}
$useip = GetIP();
$templet = empty($templet) ? '' : $templet;
$query = "INSERT INTO `{$addtable}`(aid,typeid,redirecturl,templet,userip,body{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$templet','$useip','$body'{$inadd_v})";
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}` 时出错,请把相关信息提交给DedeBIZ官方".str_replace('"', '', $gerr), "javascript:;");
exit();
}
//生成HTML
InsertTags($tags, $arcID);
$picTitle = false;
if (count($_SESSION['bigfile_info']) > 0) {
foreach ($_SESSION['bigfile_info'] as $k => $v) {
if (!empty($v)) {
$pictitle = ${'picinfook'.$k};
$titleSet = '';
if (!empty($pictitle)) {
$picTitle = TRUE;
$titleSet = ",title='{$pictitle}'";
}
$dsql->ExecuteNoneQuery("UPDATE `#@__uploads` SET arcid='{$arcID}'{$titleSet} WHERE url LIKE '{$v}'; ");
}
}
}
$artUrl = MakeArt($arcID, true, true, $isremote);
if ($artUrl == '') {
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='article_add.php?cid=$typeid' class='btn btn-success btn-sm'>继续发布文章</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>改文章</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文章管理</a>&nbsp;&nbsp;$backurl";
$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);
$win->Display();
}

src/dede/article_allowurl_edit.php → src/admin/article_allowurl_edit.php View File

@@ -1,43 +1,42 @@
<?php
/**
* 允许的站内链接
*
* @version $Id: article_allowurl_edit.php 1 11:36 2010年10月8日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
CheckPurview('sys_Source');
if (empty($dopost)) $dopost = '';
if (empty($allurls)) $allsource = '';
else $allurls = stripslashes($allurls);
$m_file = DEDEDATA."/admin/allowurl.txt";
//保存
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));
fclose($fp);
}
$wintitle = "";
$wecome_info = "允许的超链接";
$win = new OxWindow();
$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();
<?php
/**
* 允许的站内链接
*
* @version $Id: article_allowurl_edit.php 1 11:36 2010年10月8日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
CheckPurview('sys_Source');
if (empty($dopost)) $dopost = '';
if (empty($allurls)) $allsource = '';
else $allurls = stripslashes($allurls);

$m_file = DEDEDATA."/admin/allowurl.txt";

//保存
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));
fclose($fp);
}
$wintitle = "";
$wecome_info = "允许的超链接";
$win = new OxWindow();
$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();

src/dede/article_coonepage_rule.php → src/admin/article_coonepage_rule.php View File

@@ -1,120 +1,119 @@
<?php
/**
* 文档规则采集
*
* @version $Id: article_coonepage_rule.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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 = '';
/*------
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();
}
}
/*------
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);
}
/*------
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();
}
/*------
function _EditNoteLoad(){ }
-------*/ 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.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-success btn-sm" type="submit" name="Submit" value="">保存规则</button>
<button type="reset" class="btn btn-success btn-sm" name="Submit2">重置</button></td>
</tr>
</table>
</form>
<?php
exit();
} //loadedit
/*---------------
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->SetSource($sql);
$dlist->Display();
<?php
/**
* 文档规则采集
*
* @version $Id: article_coonepage_rule.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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 = '';

/*------
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();
}
}
/*------
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);
}

/*------
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();
}
/*------
function _EditNoteLoad(){ }
-------*/ 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.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="30">&nbsp;</td>
<td colspan="2"><button class="btn btn-success btn-sm" type="submit" name="Submit" value="">保存规则</button>
<button type="reset" class="btn btn-success btn-sm" name="Submit2">重置</button></td>
</tr>
</table>
</form>
<?php
exit();
} //loadedit
/*---------------
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->SetSource($sql);
$dlist->Display();

src/dede/article_description_main.php → src/admin/article_description_main.php View File

@@ -1,167 +1,166 @@
<?php
/**
* 文档描述管理
*
* @version $Id: article_description_main.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
CheckPurview('sys_Keyword');
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';
$table = preg_replace("#[^0-9a-zA-Z_\#@]#", "", $table);
$field = preg_replace("#[^0-9a-zA-Z_\[\]]#", "", $field);
$channel = intval($channel);
if ($dsize > 250) $dsize = 250;
$tjnum = 0;
//获取自动摘要
if ($dojob == 'des') {
if (empty($totalnum)) {
$addquery = "";
if ($sid != 0) {
$addquery .= " AND id>='$sid' ";
}
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) {
$addquery = "";
if ($sid != 0) {
$addquery .= " AND #@__archives.id>='$sid' ";
}
if ($eid != 0) {
$addquery .= " AND #@__archives.id<='$eid' ";
}
$fquery = "SELECT #@__archives.id,#@__archives.title,#@__archives.description,{$table}.{$field}
FROM #@__archives LEFT JOIN {$table} ON {$table}.aid=#@__archives.id
WHERE #@__archives.channel='{$channel}' $addquery LIMIT $startdd,$pagesize ; ";
$dsql->SetQuery($fquery);
$dsql->Execute();
while ($row = $dsql->GetArray()) {
$body = $row[$field];
$description = $row['description'];
if (strlen($description) > 10 || $description == '-') {
continue;
}
$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 = "-";
}
$dsql->ExecuteNoneQuery("UPDATE #@__archives SET description='{$des}' WHERE id='{$row['id']}';");
}
//返回进度信息
$startdd = $startdd + $pagesize;
if ($totalnum > $startdd) {
$tjlen = ceil(($startdd / $totalnum) * 100);
} else {
$tjlen = 100;
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
$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 %,继续执行任务...";
$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);
exit();
} else {
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
} //获取自动摘要代码结束
//更新自动分页
if ($dojob == 'page') {
require_once(DEDEADMIN."/inc/inc_archives_functions.php");
$addquery = "";
if ($sid != 0) {
$addquery .= " and aid>='$sid' ";
}
if ($eid != 0) {
$addquery .= " and aid<='$eid' ";
}
//统计记录总数
if ($totalnum == 0) {
$sql = "SELECT COUNT(*) AS dd FROM $table WHERE 1 $addquery";
$row = $dsql->GetOne($sql);
$totalnum = $row['dd'];
}
//获取记录,并分析
if ($totalnum > $startdd + $pagesize) {
$limitSql = " LIMIT $startdd,$pagesize";
} else if (($totalnum - $startdd) > 0) {
$limitSql = " LIMIT $startdd,".($totalnum - $startdd);
} else {
$limitSql = "";
}
$tjnum = $startdd;
if ($limitSql != "") {
$fquery = "SELECT aid,$field FROM $table WHERE 1 $addquery $limitSql ;";
$dsql->SetQuery($fquery);
$dsql->Execute();
while ($row = $dsql->GetArray()) {
$tjnum++;
$body = $row[$field];
$aid = $row['aid'];
if (strlen($body) < $msize) {
continue;
}
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
//返回进度提示
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 %,继续执行任务...";
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 {
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
} //更新自动分页处理代码结束
}
<?php
/**
* 文档描述管理
*
* @version $Id: article_description_main.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
CheckPurview('sys_Keyword');
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';

$table = preg_replace("#[^0-9a-zA-Z_\#@]#", "", $table);
$field = preg_replace("#[^0-9a-zA-Z_\[\]]#", "", $field);
$channel = intval($channel);
if ($dsize > 250) $dsize = 250;
$tjnum = 0;

//获取自动摘要
if ($dojob == 'des') {
if (empty($totalnum)) {
$addquery = "";
if ($sid != 0) {
$addquery .= " AND id>='$sid' ";
}
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) {
$addquery = "";
if ($sid != 0) {
$addquery .= " AND #@__archives.id>='$sid' ";
}
if ($eid != 0) {
$addquery .= " AND #@__archives.id<='$eid' ";
}
$fquery = "SELECT #@__archives.id,#@__archives.title,#@__archives.description,{$table}.{$field}
FROM #@__archives LEFT JOIN {$table} ON {$table}.aid=#@__archives.id
WHERE #@__archives.channel='{$channel}' $addquery LIMIT $startdd,$pagesize ; ";
$dsql->SetQuery($fquery);
$dsql->Execute();
while ($row = $dsql->GetArray()) {
$body = $row[$field];
$description = $row['description'];
if (strlen($description) > 10 || $description == '-') {
continue;
}
$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 = "-";
}
$dsql->ExecuteNoneQuery("UPDATE #@__archives SET description='{$des}' WHERE id='{$row['id']}';");
}

//返回进度信息
$startdd = $startdd + $pagesize;
if ($totalnum > $startdd) {
$tjlen = ceil(($startdd / $totalnum) * 100);
} else {
$tjlen = 100;
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
$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 %,继续执行任务...";
$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);
exit();
} else {
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
} //获取自动摘要代码结束

//更新自动分页
if ($dojob == 'page') {
require_once(DEDEADMIN."/inc/inc_archives_functions.php");

$addquery = "";
if ($sid != 0) {
$addquery .= " and aid>='$sid' ";
}
if ($eid != 0) {
$addquery .= " and aid<='$eid' ";
}

//统计记录总数
if ($totalnum == 0) {
$sql = "SELECT COUNT(*) AS dd FROM $table WHERE 1 $addquery";
$row = $dsql->GetOne($sql);
$totalnum = $row['dd'];
}

//获取记录,并分析
if ($totalnum > $startdd + $pagesize) {
$limitSql = " LIMIT $startdd,$pagesize";
} else if (($totalnum - $startdd) > 0) {
$limitSql = " LIMIT $startdd,".($totalnum - $startdd);
} else {
$limitSql = "";
}
$tjnum = $startdd;
if ($limitSql != "") {
$fquery = "SELECT aid,$field FROM $table WHERE 1 $addquery $limitSql ;";
$dsql->SetQuery($fquery);
$dsql->Execute();
while ($row = $dsql->GetArray()) {
$tjnum++;
$body = $row[$field];
$aid = $row['aid'];
if (strlen($body) < $msize) {
continue;
}
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

//返回进度提示
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 %,继续执行任务...";

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 {
ShowMsg('完成所有任务', 'javascript:;');
exit();
}
} //更新自动分页处理代码结束
}

src/dede/article_edit.php → src/admin/article_edit.php View File

@@ -1,225 +1,225 @@
<?php
/**
* 文档编辑
*
* @version $Id: article_edit.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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');
}
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");
ClearMyAddon();
//读取归档信息
$query = "SELECT ch.typename AS channelname,ar.membername AS rankname,arc.*
FROM `#@__archives` arc
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");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$cInfos = $dsql->GetOne($query);
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:;");
exit();
}
$channelid = $arcRow['channel'];
$tags = GetTags($aid);
include DedeInclude("templets/article_edit.htm");
exit();
}
/*--------------------------------
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)) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
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;
$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));
$isremote = 0;
$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);
//分析body里的内容
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$query = "UPDATE `#@__archives` SET
`typeid`='$typeid',
`typeid2`='$typeid2',
`sortrank`='$sortrank',
`flag`='$flag',
`click`='$click',
`ismake`='$ismake',
`arcrank`='$arcrank',
`money`='$money',
`title`='$title',
`color`='$color',
`writer`='$writer',
`source`='$source',
`litpic`='$litpic',
`pubdate`='$pubdate',
`notpost`='$notpost',
`description`='$description',
`keywords`='$keywords',
`shorttitle`='$shorttitle',
`filename`='$filename',
`dutyadmin`='$adminid',
`weight`='$weight'
WHERE `id`='$id'; ";
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg('更新数据库archives表时出错,请检查', -1);
exit();
}
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['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:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
$artUrl = MakeArt($id, true, true, $isremote);
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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='article_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布新文章</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文章</a>&nbsp;&nbsp;$backurl";
$wintitle = "成功更改文章";
$wecome_info = "文章管理::更改文章";
$win = new OxWindow();
$win->AddTitle("成功更改文章:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
<?php
/**
* 文档编辑
*
* @version $Id: article_edit.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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');
}
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");
ClearMyAddon();
//读取归档信息
$query = "SELECT ch.typename AS channelname,ar.membername AS rankname,arc.*
FROM `#@__archives` arc
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");
exit();
}
$query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'";
$cInfos = $dsql->GetOne($query);
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:;");
exit();
}
$channelid = $arcRow['channel'];
$tags = GetTags($aid);
include DedeInclude("templets/article_edit.htm");
exit();
}
/*--------------------------------
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)) {
ShowMsg("请指定文档的栏目", "-1");
exit();
}
if (empty($channelid)) {
ShowMsg("文档为非指定的类型,请检查您发布内容的表单是否合法", "-1");
exit();
}
if (!CheckChannel($typeid, $channelid)) {
ShowMsg("您所选择的栏目与当前模型不相符,请选择白色的选项", "-1");
exit();
}
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;
$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));
$isremote = 0;
$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);
//分析body里的内容
$body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext');
//分析处理附加表数据
$inadd_f = '';
$inadd_v = '';
if (!empty($dede_addonfields)) {
$addonfields = explode(';', $dede_addonfields);
$inadd_f = '';
$inadd_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 {
if (!isset(${$vs[0]})) {
${$vs[0]} = '';
}
${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id);
}
$inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
}
}
}
//处理新的缩略图上传
if ($litpic_b64 != "") {
$data = explode(',', $litpic_b64);
$ntime = time();
$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]));
//加水印
WaterImg($cfg_basedir.$fullUrl, 'up');
$litpic = $fullUrl;
}
//处理图片文档的自定义属性
if ($litpic != '' && !preg_match("#p#", $flag)) {
$flag = ($flag == '' ? 'p' : $flag.',p');
}
if ($redirecturl != '' && !preg_match("#j#", $flag)) {
$flag = ($flag == '' ? 'j' : $flag.',j');
}
//跳转网址的文档强制为动态
if (preg_match("#j#", $flag)) $ismake = -1;
//更新数据库的SQL语句
$query = "UPDATE #@__archives SET
typeid='$typeid',
typeid2='$typeid2',
sortrank='$sortrank',
flag='$flag',
click='$click',
ismake='$ismake',
arcrank='$arcrank',
money='$money',
title='$title',
color='$color',
writer='$writer',
source='$source',
litpic='$litpic',
pubdate='$pubdate',
notpost='$notpost',
description='$description',
keywords='$keywords',
shorttitle='$shorttitle',
filename='$filename',
dutyadmin='$adminid',
weight='$weight'
WHERE id='$id'; ";
if (!$dsql->ExecuteNoneQuery($query)) {
ShowMsg('更新数据库archives表时出错,请检查', -1);
exit();
}
$cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = trim($cts['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:;");
exit();
}
}
//生成HTML
UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags);
$artUrl = MakeArt($id, true, true, $isremote);
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);
}
}
}
}
//返回成功信息
$msg = "请选择您的后续操作:<a href='article_add.php?cid=$typeid' class='btn btn-success btn-sm'>发布新文章</a>&nbsp;&nbsp;<a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看改</a>&nbsp;&nbsp;<a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a>&nbsp;&nbsp;<a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文章</a>&nbsp;&nbsp;$backurl";
$wintitle = "成功修改文章";
$wecome_info = "文章管理::修改文章";
$win = new OxWindow();
$win->AddTitle("成功修改文章:");
$win->AddMsgItem($msg);
$winform = $win->GetWindow("hand", "&nbsp;", false);
$win->Display();
}

src/dede/article_keywords_main.php → src/admin/article_keywords_main.php View File

@@ -1,93 +1,92 @@
<?php
/**
* 文档关键词管理
*
* @version $Id: article_keywords_main.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 = '';
//保存批量更改
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);
exit();
}
foreach ($aids as $aid) {
$rpurl = ${'rpurl_'.$aid};
$rpurlold = ${'rpurlold_'.$aid};
$keyword = ${'keyword_'.$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) {
$query1 = "UPDATE `#@__keywords` SET sta='$sta',rpurl='$rpurl' WHERE aid='$aid' ";
$dsql->ExecuteNoneQuery($query1);
continue;
}
//更新链接网址
if ($rpurl != $rpurlold) {
$query1 = "UPDATE `#@__keywords` SET rpurl='$rpurl' WHERE aid='$aid' ";
$dsql->ExecuteNoneQuery($query1);
}
}
ShowMsg("完成指定的更改!", $ENV_GOBACK_URL);
exit();
}
//增加关键字
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);
exit();
}
$row = $dsql->GetOne("SELECT * FROM `#@__keywords` WHERE keyword LIKE '$keyword'");
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);
exit();
}
if (empty($keyword)) {
$keyword = '';
$addquery = '';
} 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->SetSource($sql);
$dlist->Display();
function GetSta($sta)
{
if ($sta == 1) return '';
else return ' checked="1" ';
}
<?php
/**
* 文档关键词管理
*
* @version $Id: article_keywords_main.php 1 14:12 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 = '';


//保存批量修改
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);
exit();
}
foreach ($aids as $aid) {
$rpurl = ${'rpurl_'.$aid};
$rpurlold = ${'rpurlold_'.$aid};
$keyword = ${'keyword_'.$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) {
$query1 = "UPDATE `#@__keywords` SET sta='$sta',rpurl='$rpurl' WHERE aid='$aid' ";
$dsql->ExecuteNoneQuery($query1);
continue;
}

//更新链接网址
if ($rpurl != $rpurlold) {
$query1 = "UPDATE `#@__keywords` SET rpurl='$rpurl' WHERE aid='$aid' ";
$dsql->ExecuteNoneQuery($query1);
}
}
ShowMsg("完成指定的修改!", $ENV_GOBACK_URL);
exit();
}
//增加关键字
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);
exit();
}
$row = $dsql->GetOne("SELECT * FROM `#@__keywords` WHERE keyword LIKE '$keyword'");
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);
exit();
}
if (empty($keyword)) {
$keyword = '';
$addquery = '';
} 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->SetSource($sql);
$dlist->Display();

function GetSta($sta)
{
if ($sta == 1) return '';
else return ' checked="1" ';
}

src/dede/article_keywords_make.php → src/admin/article_keywords_make.php View File

@@ -1,204 +1,203 @@
<?php
/**
* 文档关键词生成
*
* @version $Id: article_keywords_make.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');
CheckPurview('sys_Keyword');
if (empty($dopost)) $dopost = '';
//分析已存在的关键字(适用于默认的文章模型)
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;
else $wserr[$row->keyword] = 1;
}
echo "完成关键字数据库的载入!<br/>\r\n";
flush();
echo "读取档案数据库,并对禁用的关键字和生字进行处理...<br/>\r\n";
flush();
$dsql->SetQuery("SELECT id,keywords FROM `#@__archives`");
$dsql->Execute();
while ($row = $dsql->GetObject()) {
$keywords = explode(',', trim($row->keywords));
$nerr = false;
$mykey = '';
if (is_array($keywords)) {
foreach ($keywords as $v) {
$v = trim($v);
if ($v == '') {
continue;
}
if (isset($ws[$v])) {
$mykey .= $v." ";
} else if (isset($wsnew[$v])) {
$mykey .= $v.' ';
$wsnew[$v]++;
} else if (isset($wserr[$v])) {
$nerr = true;
} else {
$mykey .= $v." ";
$wsnew[$v] = 1;
}
}
}
}
echo "完成档案数据库的处理!<br/>\r\n";
flush();
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) {
continue;
}
$dsql->SetQuery("INSERT INTO `#@__keywords`(keyword,`rank`,sta,rpurl) VALUES('".addslashes($k)."','$v','1','')");
$dsql->Execute();
}
echo "完成关键字的导入!<br/>\r\n";
flush();
sleep(1);
} else {
echo "没发现任何新的关键字!<br/>\r\n";
flush();
sleep(1);
}
ShowMsg('完成所有操作,现在转到关键字列表页!', 'article_keywords_main.php');
exit();
}
//自动获取关键字(适用于默认的文章模型)
else if ($dopost == 'fetch') {
require_once(DEDEINC."/splitword.class.php");
if (empty($startdd)) {
$startdd = 0;
}
if (empty($pagesize)) {
$pagesize = 20;
}
if (empty($totalnum)) {
$totalnum = 0;
}
//统计记录总数
if ($totalnum == 0) {
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__archives` WHERE channel='1' ");
$totalnum = $row['dd'];
}
//获取记录,并分析关键字
if ($totalnum > $startdd + $pagesize) {
$limitSql = " LIMIT $startdd,$pagesize";
} else if (($totalnum - $startdd) > 0) {
$limitSql = " LIMIT $startdd,".($totalnum - $startdd);
} else {
$limitSql = '';
}
$tjnum = $startdd;
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);
$dsql->Execute();
if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) {
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port);
$client->appid = $cfg_bizcore_appid;
$client->key = $cfg_bizcore_key;
while ($row = $dsql->GetObject()) {
if ($row->keywords != '') {
continue;
}
$tjnum++;
$id = $row->id;
$keywords = "";
$data = $client->Spliteword($row->title.Html2Text($row->body));
$keywords = $data->data;
$keywords = addslashes($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 != '') {
continue;
}
$tjnum++;
$id = $row->id;
$keywords = "";
$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->SetResultType(2);
$sp->StartAnalysis(TRUE);
$allindexs = $sp->GetFinallyIndex();
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.",";
}
}
foreach ($allindexs as $k => $v) {
if (strlen($keywords) >= 30) {
break;
} else if (!in_array($k, $titleindexs)) {
if (strlen($k) <= 2) continue;
$keywords .= $k.",";
}
}
}
$keywords = addslashes($keywords);
if ($keywords == '') {
$keywords = ',';
}
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET keywords='$keywords' WHERE id='$id'");
}
unset($sp);
}
} //end if limit
//返回提示信息
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:;");
}
exit();
}
include DedeInclude('templets/article_keywords_make.htm');
<?php
/**
* 文档关键词生成
*
* @version $Id: article_keywords_make.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');
CheckPurview('sys_Keyword');
if (empty($dopost)) $dopost = '';

//分析已存在的关键字(适用于默认的文章模型)
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;
else $wserr[$row->keyword] = 1;
}
echo "完成关键字数据库的载入!<br/>\r\n";
flush();
echo "读取档案数据库,并对禁用的关键字和生字进行处理...<br/>\r\n";
flush();
$dsql->SetQuery("SELECT id,keywords FROM `#@__archives`");
$dsql->Execute();
while ($row = $dsql->GetObject()) {
$keywords = explode(',', trim($row->keywords));
$nerr = false;
$mykey = '';
if (is_array($keywords)) {
foreach ($keywords as $v) {
$v = trim($v);
if ($v == '') {
continue;
}
if (isset($ws[$v])) {
$mykey .= $v." ";
} else if (isset($wsnew[$v])) {
$mykey .= $v.' ';
$wsnew[$v]++;
} else if (isset($wserr[$v])) {
$nerr = true;
} else {
$mykey .= $v." ";
$wsnew[$v] = 1;
}
}
}
}
echo "完成档案数据库的处理!<br/>\r\n";
flush();
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) {
continue;
}
$dsql->SetQuery("INSERT INTO `#@__keywords`(keyword,rank,sta,rpurl) VALUES('".addslashes($k)."','$v','1','')");
$dsql->Execute();
}
echo "完成关键字的导入!<br/>\r\n";
flush();
sleep(1);
} else {
echo "没发现任何新的关键字!<br/>\r\n";
flush();
sleep(1);
}
ShowMsg('完成所有操作,现在转到关键字列表页!', 'article_keywords_main.php');
exit();
}
//自动获取关键字(适用于默认的文章模型)
else if ($dopost == 'fetch') {
require_once(DEDEINC."/splitword.class.php");
if (empty($startdd)) {
$startdd = 0;
}
if (empty($pagesize)) {
$pagesize = 20;
}
if (empty($totalnum)) {
$totalnum = 0;
}

//统计记录总数
if ($totalnum == 0) {
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__archives` WHERE channel='1' ");
$totalnum = $row['dd'];
}

//获取记录,并分析关键字
if ($totalnum > $startdd + $pagesize) {
$limitSql = " LIMIT $startdd,$pagesize";
} else if (($totalnum - $startdd) > 0) {
$limitSql = " LIMIT $startdd,".($totalnum - $startdd);
} else {
$limitSql = '';
}
$tjnum = $startdd;
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);
$dsql->Execute();

if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) {
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port);
$client->appid = $cfg_bizcore_appid;
$client->key = $cfg_bizcore_key;
while ($row = $dsql->GetObject()) {
if ($row->keywords != '') {
continue;
}
$tjnum++;
$id = $row->id;
$keywords = "";
$data = $client->Spliteword($row->title.Html2Text($row->body));
$keywords = $data->data;
$keywords = addslashes($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 != '') {
continue;
}
$tjnum++;
$id = $row->id;
$keywords = "";

$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->SetResultType(2);
$sp->StartAnalysis(TRUE);
$allindexs = $sp->GetFinallyIndex();
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.",";
}
}
foreach ($allindexs as $k => $v) {
if (strlen($keywords) >= 30) {
break;
} else if (!in_array($k, $titleindexs)) {
if (strlen($k) <= 2) continue;
$keywords .= $k.",";
}
}
}
$keywords = addslashes($keywords);
if ($keywords == '') {
$keywords = ',';
}
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET keywords='$keywords' WHERE id='$id'");
}
unset($sp);
}
} //end if limit


//返回提示信息
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:;");
}
exit();
}
include DedeInclude('templets/article_keywords_make.htm');

src/dede/article_keywords_select.php → src/admin/article_keywords_select.php View File

@@ -1,38 +1,37 @@
<?php
/**
* 文档关键词选择
*
* @version $Id: article_keywords_select.php$
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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, "/");
$f = RemoveXSS($f);
if (empty($keywords)) $keywords = "";
$sql = "SELECT * FROM `#@__keywords` ORDER BY `rank` DESC";
$dlist = new DataListCP();
$dlist->SetTemplate(DEDEADMIN."/templets/article_keywords_select.htm");
$dlist->pageSize = 300;
$dlist->SetParameter("f", $f);
$dlist->SetSource($sql);
$dlist->Display();
function GetSta($sta)
{
if ($sta == 1) return "正常";
else return "<font color='red'>禁用</font>";
}
function GetMan($sta)
{
if ($sta == 1) return "禁用";
else return "启用";
}
<?php
/**
* 文档关键词选择
*
* @version $Id: article_keywords_select.php$
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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, "/");

$f = RemoveXSS($f);

if (empty($keywords)) $keywords = "";

$sql = "SELECT * FROM #@__keywords ORDER BY rank DESC";
$dlist = new DataListCP();
$dlist->SetTemplate(DEDEADMIN."/templets/article_keywords_select.htm");
$dlist->pageSize = 300;
$dlist->SetParameter("f", $f);
$dlist->SetSource($sql);
$dlist->Display();

function GetSta($sta)
{
if ($sta == 1) return "正常";
else return "<span style='color:#e74d58'>禁用</span>";
}

function GetMan($sta)
{
if ($sta == 1) return "禁用";
else return "启用";
}

src/dede/article_select_sw.php → src/admin/article_select_sw.php View File

@@ -1,46 +1,45 @@
<?php
/**
* @version $Id: article_select_sw.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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";
$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) {
$v = trim($v);
if ($v != "") {
echo "<a href='#' onclick='javascript:PutSource(\"$v\")'>$v</a> | \r\n";
}
}
echo "</div><div class='coolbg5'>&nbsp;</div>";
} else {
//作者列表
$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));
fclose($fp);
$strs = explode(',', $str);
foreach ($strs as $str) {
$str = trim($str);
if ($str != "") {
echo "<a href='#' onclick='javascript:PutWriter(\"$str\")'>$str</a> | ";
}
}
}
echo "</div><div class='coolbg5'>&nbsp;</div>\r\n";
}
<?php
/**
* @version $Id: article_select_sw.php 1 8:26 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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";
$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) {
$v = trim($v);
if ($v != "") {
echo "<a href='#' onclick='javascript:PutSource(\"$v\")'>$v</a> | \r\n";
}
}
echo "</div><div class='coolbg5'>&nbsp;</div>";
} else {
//作者列表
$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));
fclose($fp);
$strs = explode(',', $str);
foreach ($strs as $str) {
$str = trim($str);
if ($str != "") {
echo "<a href='#' onclick='javascript:PutWriter(\"$str\")'>$str</a> | ";
}
}
}
echo "</div><div class='coolbg5'>&nbsp;</div>\r\n";
}

src/dede/article_source_edit.php → src/admin/article_source_edit.php View File

@@ -1,43 +1,42 @@
<?php
/**
* 文章来源编辑
*
* @version $Id: archives_add.php 1 14:30 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
CheckPurview('sys_Source');
if (empty($dopost)) $dopost = '';
if (empty($allsource)) $allsource = '';
else $allsource = stripslashes($allsource);
$m_file = DEDEDATA."/admin/source.txt";
//保存
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));
fclose($fp);
}
$wintitle = "文章来源管理";
$wecome_info = "文章来源管理";
$win = new OxWindow();
$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();
<?php
/**
* 文章来源编辑
*
* @version $Id: archives_add.php 1 14:30 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
CheckPurview('sys_Source');
if (empty($dopost)) $dopost = '';
if (empty($allsource)) $allsource = '';
else $allsource = stripslashes($allsource);

$m_file = DEDEDATA."/admin/source.txt";

//保存
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));
fclose($fp);
}
$wintitle = "文章来源管理";
$wecome_info = "文章来源管理";
$win = new OxWindow();
$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();

src/dede/article_string_mix.php → src/admin/article_string_mix.php View File

@@ -1,5 +1,4 @@
<?php

/**
* 防采集混淆字符串管理
*

src/dede/article_template_rand.php → src/admin/article_template_rand.php View File

@@ -1,5 +1,4 @@
<?php

/**
* 文档随机模板
*

src/dede/article_test_same.php → src/admin/article_test_same.php View File

@@ -1,84 +1,83 @@
<?php
/**
* 检测重复文档
*
* @version $Id: article_test_same.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
@set_time_limit(0);
CheckPurview('sys_ArcBatch');
if (empty($dopost)) $dopost = '';
if ($dopost == 'analyse') {
$arr = $dsql->getone("SELECT maintable FROM `#@__channeltype` WHERE id='$channelid' ");
if (is_array($arr)) {
$maintable = $arr['maintable'];
} else {
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");
$dsql->Execute();
$allarc = 0;
include DedeInclude('templets/article_result_same.htm');
exit();
}
//删除选中的内容(只保留一条)
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 "没有指定删除的文档";
exit();
}
$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 ");
}
$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');
}
}
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `$maintable`; ");
ShowMsg("一共删除了[{$totalarc}]篇重复的文档", "javascript:;");
exit();
}
//向导页
$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');
<?php
/**
* 检测重复文档
*
* @version $Id: article_test_same.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
@set_time_limit(0);
CheckPurview('sys_ArcBatch');
if (empty($dopost)) $dopost = '';
if ($dopost == 'analyse') {
$arr = $dsql->getone("SELECT maintable FROM `#@__channeltype` WHERE id='$channelid' ");
if (is_array($arr)) {
$maintable = $arr['maintable'];
} else {
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");
$dsql->Execute();
$allarc = 0;
include DedeInclude('templets/article_result_same.htm');
exit();
}
//删除选中的内容(只保留一条)
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 "没有指定删除的文档";
exit();
}

$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 ");
}

$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');
}
}
$dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `$maintable`; ");
ShowMsg("一共删除了[{$totalarc}]篇重复的文档", "javascript:;");
exit();
}

//向导页
$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');

src/dede/article_test_title.php → src/admin/article_test_title.php View File

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

$row = $dsql->GetOne("SELECT id FROM `#@__archives` WHERE title LIKE '$t' ");
if (is_array($row)) {
echo "提示:系统已经存在标题为 '<a href='../plus/view.php?aid={$row['id']}' style='color:red' target='_blank'>$t</a>' 的文档。[<a href='#' onclick='javascript:HideObj(\"mytitle\")'>关闭</a>]";
}

src/dede/article_writer_edit.php → src/admin/article_writer_edit.php View File

@@ -1,45 +1,44 @@
<?php
/**
* 文章作者管理
*
* @version $Id: article_writer_edit.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');
CheckPurview('sys_Writer');
if (empty($dopost)) $dopost = '';
if (empty($allwriter)) $allwriter = '';
else $allwriter = stripslashes($allwriter);
$m_file = DEDEDATA."/admin/writer.txt";
//保存
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));
fclose($fp);
}
$wintitle = "文章作者管理";
$wecome_info = "文章作者管理";
$win = new OxWindow();
$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();
<?php
/**
* 文章作者管理
*
* @version $Id: article_writer_edit.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');
CheckPurview('sys_Writer');
if (empty($dopost)) $dopost = '';

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

$m_file = DEDEDATA."/admin/writer.txt";

//保存
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));
fclose($fp);
}
$wintitle = "文章作者管理";
$wecome_info = "文章作者管理";
$win = new OxWindow();
$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();

src/dede/baidunews.php → src/admin/baidunews.php View File

@@ -1,78 +1,77 @@
<?php
/**
* 百度新闻
*
* @version $Id: baidunews.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($do)) {
include DEDEADMIN.'/templets/baidunews.htm';
} else {
$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) {
$limit = 100;
}
$query = "SELECT maintable.*, addtable.body, arctype.typename
FROM #@__archives maintable
LEFT JOIN #@__addonarticle addtable ON addtable.aid=maintable.id
LEFT JOIN #@__arctype arctype ON arctype.ID=maintable.typeid
WHERE maintable.channel=1 and maintable.arcrank!=-1 ORDER BY maintable.pubdate DESC LIMIT $limit
";
$dsql->SetQuery($query);
$dsql->Execute();
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 {
$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;
}
//$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));
$baidunews .= "<item>\n";
$baidunews .= "<title>$title </title>\n";
$baidunews .= "<link>$link </link>\n";
$baidunews .= "<description>$description </description>\n";
$baidunews .= "<text>$text </text>\n";
$baidunews .= "<image>$image </image>\n";
//$baidunews .= "<headlineimages/>\n";
$baidunews .= "<keywords>$keywords </keywords>\n";
$baidunews .= "<category>$category </category>\n";
$baidunews .= "<author>$author </author>\n";
$baidunews .= "<source>$source </source>\n";
$baidunews .= "<pubDate>$pubdate </pubDate>\n";
$baidunews .= "</item>\n";
}
$baidunews .= "</document>\n";
$fp = fopen(dirname(__FILE__).'/'.$filename, 'w');
fwrite($fp, $baidunews);
fclose($fp);
showmsg("<a href='{$filename}' target=\"_blank\">{$filename} make success</a>", 'javascript:;');
}
<?php
/**
* 百度新闻
*
* @version $Id: baidunews.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");

if (empty($do)) {
include DEDEADMIN.'/templets/baidunews.htm';
} else {
$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) {
$limit = 100;
}

$query = "SELECT maintable.*, addtable.body, arctype.typename
FROM #@__archives maintable
LEFT JOIN #@__addonarticle addtable ON addtable.aid=maintable.id
LEFT JOIN #@__arctype arctype ON arctype.ID=maintable.typeid
WHERE maintable.channel=1 and maintable.arcrank!=-1 ORDER BY maintable.pubdate DESC LIMIT $limit
";
$dsql->SetQuery($query);
$dsql->Execute();
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 {
$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;
}
//$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));

$baidunews .= "<item>\n";
$baidunews .= "<title>$title </title>\n";
$baidunews .= "<link>$link </link>\n";
$baidunews .= "<description>$description </description>\n";
$baidunews .= "<text>$text </text>\n";
$baidunews .= "<image>$image </image>\n";
//$baidunews .= "<headlineimages/>\n";
$baidunews .= "<keywords>$keywords </keywords>\n";
$baidunews .= "<category>$category </category>\n";
$baidunews .= "<author>$author </author>\n";
$baidunews .= "<source>$source </source>\n";
$baidunews .= "<pubDate>$pubdate </pubDate>\n";
$baidunews .= "</item>\n";
}
$baidunews .= "</document>\n";

$fp = fopen(dirname(__FILE__).'/'.$filename, 'w');
fwrite($fp, $baidunews);
fclose($fp);
showmsg("<a href='{$filename}' target=\"_blank\">{$filename} make success</a>", 'javascript:;');
}

src/dede/cards_make.php → src/admin/cards_make.php View File

@@ -1,59 +1,58 @@
<?php
/**
* 生成点卡
*
* @version $Id: cards_make.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('member_Card');
if (empty($dopost)) $dopost = '';
if ($dopost == '') include(DEDEADMIN."/templets/cards_make.htm");
//生成点卡
elseif ($dopost == 'make') {
$row = $dsql->GetOne("SELECT * FROM #@__moneycard_record ORDER BY aid DESC");
!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'];
$mtime = time();
$utime = 0;
$ctid = $cardtype;
$startid++;
$endid = $startid + $mnum;
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) {
$c = 'M';
} else {
$c = chr($c);
}
}
$cardid .= $c;
}
if ($p < $pwdgr - 1) {
$cardid .= '-';
}
}
$inquery = "INSERT INTO #@__moneycard_record(ctid,cardid,uid,isexp,mtime,utime,money,num)
VALUES('$ctid','$cardid','0','0','$mtime','$utime','$money','$num'); ";
$dsql->ExecuteNoneQuery($inquery);
echo "成功生成点卡:{$cardid}<br/>";
}
echo "成功生成 {$mnum} 个点卡";
}
<?php
/**
* 生成点卡
*
* @version $Id: cards_make.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('member_Card');
if (empty($dopost)) $dopost = '';
if ($dopost == '') include(DEDEADMIN."/templets/cards_make.htm");

//生成点卡
elseif ($dopost == 'make') {
$row = $dsql->GetOne("SELECT * FROM #@__moneycard_record ORDER BY aid DESC");
!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'];
$mtime = time();
$utime = 0;
$ctid = $cardtype;
$startid++;
$endid = $startid + $mnum;

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) {
$c = 'M';
} else {
$c = chr($c);
}
}
$cardid .= $c;
}
if ($p < $pwdgr - 1) {
$cardid .= '-';
}
}
$inquery = "INSERT INTO #@__moneycard_record(ctid,cardid,uid,isexp,mtime,utime,money,num)
VALUES('$ctid','$cardid','0','0','$mtime','$utime','$money','$num'); ";
$dsql->ExecuteNoneQuery($inquery);
echo "成功生成点卡:{$cardid}<br/>";
}
echo "成功生成 {$mnum} 个点卡";
}

src/dede/cards_manage.php → src/admin/cards_manage.php View File

@@ -1,67 +1,66 @@
<?php
/**
* 点卡管理
*
* @version $Id: cards_manage.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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);
$dquery = "";
foreach ($ids as $id) {
if ($dquery == "") $dquery .= "aid='$id' ";
else $dquery .= " OR aid='$id' ";
}
if ($dquery != "") $dquery = " WHERE ".$dquery;
$dsql->ExecuteNoneQuery("DELETE FROM #@__moneycard_record $dquery");
ShowMsg("成功删除指定的记录", "cards_manage.php");
exit();
} else {
$addsql = '';
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);
$dlist->dsql->SetQuery("SELECT * FROM #@__moneycard_type ");
$dlist->dsql->Execute('ts');
while ($rw = $dlist->dsql->GetArray('ts')) {
$TypeNames[$rw['tid']] = $rw['pname'];
}
$tplfile = DEDEADMIN."/templets/cards_manmage.htm";
//这两句的顺序不能更换
$dlist->SetTemplate($tplfile); //载入模板
$dlist->SetSource($sql); //设定查询SQL
$dlist->Display(); //显示
}
function GetMemberID($mid)
{
global $dsql;
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>";
else return '0';
}
function GetUseDate($time = 0)
{
if (!empty($time)) return GetDateMk($time);
else return '未使用';
}
function GetSta($sta)
{
if ($sta == 1) return '已售出';
else if ($sta == -1) return '已使用';
else return '未使用';
}
<?php
/**
* 点卡管理
*
* @version $Id: cards_manage.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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);
$dquery = "";
foreach ($ids as $id) {
if ($dquery == "") $dquery .= "aid='$id' ";
else $dquery .= " OR aid='$id' ";
}
if ($dquery != "") $dquery = " WHERE ".$dquery;
$dsql->ExecuteNoneQuery("DELETE FROM #@__moneycard_record $dquery");
ShowMsg("成功删除指定的记录", "cards_manage.php");
exit();
} else {
$addsql = '';
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);

$dlist->dsql->SetQuery("SELECT * FROM #@__moneycard_type ");
$dlist->dsql->Execute('ts');
while ($rw = $dlist->dsql->GetArray('ts')) {
$TypeNames[$rw['tid']] = $rw['pname'];
}
$tplfile = DEDEADMIN."/templets/cards_manmage.htm";

//这两句的顺序不能更换
$dlist->SetTemplate($tplfile); //载入模板
$dlist->SetSource($sql); //设定查询SQL
$dlist->Display(); //显示
}

function GetMemberID($mid)
{
global $dsql;
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>";
else return '0';
}

function GetUseDate($time = 0)
{
if (!empty($time)) return GetDateMk($time);
else return '未使用';
}
function GetSta($sta)
{
if ($sta == 1) return '已售出';
else if ($sta == -1) return '已使用';
else return '未使用';
}

src/dede/cards_type.php → src/admin/cards_type.php View File

@@ -1,49 +1,48 @@
<?php
/**
* 点卡类型
*
* @version $Id: cards_type.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
CheckPurview('member_Type');
if (empty($dopost)) $dopost = "";
//保存更改
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for (; $startID <= $endID; $startID++) {
$query = '';
$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 {
$query = "DELETE FROM #@__moneycard_type WHERE tid='$tid' ";
$dsql->ExecuteNoneQuery($query);
$query = "DELETE FROM #@__moneycard_record WHERE ctid='$tid' AND isexp<>-1 ; ";
$dsql->ExecuteNoneQuery($query);
}
}
//增加新记录
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");
<?php
/**
* 点卡类型
*
* @version $Id: cards_type.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
CheckPurview('member_Type');
if (empty($dopost)) $dopost = "";

//保存修改
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
for (; $startID <= $endID; $startID++) {
$query = '';
$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 {
$query = "DELETE FROM #@__moneycard_type WHERE tid='$tid' ";
$dsql->ExecuteNoneQuery($query);
$query = "DELETE FROM #@__moneycard_record WHERE ctid='$tid' AND isexp<>-1 ; ";
$dsql->ExecuteNoneQuery($query);
}
}

//增加新记录
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");

src/dede/catalog_add.php → src/admin/catalog_add.php View File

@@ -1,237 +1,212 @@
<?php
/**
* 栏目添加
*
* @version $Id: catalog_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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($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);
$nid = 'article';
if ($id == 0 && $reid == 0) {
CheckPurview('t_New');
} else {
$checkID = empty($id) ? $reid : $id;
CheckPurview('t_AccNew');
CheckCatalog($checkID, '您无权在本栏目下创建子类');
}
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()) {
$channelArray[$row->id]['typename'] = $row->typename;
$channelArray[$row->id]['nid'] = $row->nid;
if ($row->id == $channelid) {
$nid = $row->nid;
}
}
if ($dopost == 'quick') {
$tl = new TypeLink(0);
$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;
$tempindex = "{style}/index_{$nid}.htm";
$templist = "{style}/list_{$nid}.htm";
$temparticle = "{style}/article_{$nid}.htm";
$queryTemplate = "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`)
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)) {
$k = str_replace('posttype', '', $k);
} else {
continue;
}
$rank = ${'rank'.$k};
$toptypename = trim(${'toptype'.$k});
$sontype = trim(${'sontype'.$k});
$toptypedir = GetPinyin(stripslashes($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);
$dsql->ExecuteNoneQuery($sql);
$tid = $dsql->GetLastID();
if ($tid > 0 && $sontype != '') {
$sontypes = explode(',', $sontype);
foreach ($sontypes as $k => $v) {
$v = trim($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);
$dsql->ExecuteNoneQuery($sql);
}
}
}
} else {
$row = $dsql->GetOne("SELECT `typedir` FROM `#@__arctype` WHERE `id`={$reid}");
foreach ($_POST as $k => $v) {
if (preg_match("#^posttype#", $k)) {
$k = str_replace('posttype', '', $k);
} else {
continue;
}
$rank = ${'rank'.$k};
$toptypename = trim(${'reltype'.$k});
$toptypedir = GetPinyin(stripslashes($toptypename));
switch ($referpath) {
case 'parent':
$toptypedir = $nextdir.'/'.$toptypedir;
break;
case 'typepath':
$toptypedir = isset($row['typedir']) ? $row['typedir'].'/'.$toptypedir : '/'.$toptypedir;
break;
default:
$toptypedir = '/'.$toptypedir;
break;
}
if (empty($toptypename)) {
continue;
}
$sql = str_replace('~reid~', $reid, $queryTemplate);
$sql = str_replace('~topid~', $reid, $sql);
$sql = str_replace('~rank~', $rank, $sql);
$sql = str_replace('~typename~', $toptypename, $sql);
$sql = str_replace('~typedir~', $toptypedir, $sql);
$dsql->ExecuteNoneQuery($sql);
}
}
UpDateCatCache();
ShowMsg('成功增加指定栏目', 'catalog_main.php');
exit();
}
/*---------------------
function action_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 ($referpath == 'cmspath') $nextdir = '{cmspath}';
if ($referpath == 'basepath') $nextdir = '';
//用拼音命名
if ($upinyin == 1 || $typedir == '') {
$typedir = GetPinyin(stripslashes($typename));
}
$typedir = $nextdir.'/'.$typedir;
$typedir = preg_replace("#\/{1,}#", "/", $typedir);
}
//开启多站点时的设置(仅针对顶级栏目)
if ($reid == 0 && $moresite == 1) {
$sitepath = $typedir;
//检测二级网址
if ($siteurl != '') {
$siteurl = preg_replace("#\/$#", "", $siteurl);
if (!preg_match("#http:\/\/#i", $siteurl)) {
ShowMsg("您绑定的二级域名无效,请用(http://host)的形式", "-1");
exit();
}
if (preg_match("#".$cfg_basehost."#i", $siteurl)) {
ShowMsg("您绑定的二级域名与当前站点是同一个域,不需要绑定", "-1");
exit();
}
}
}
//创建目录
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");
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`)
VALUES('$reid','$topid','$sortrank','$typename','$typedir','$isdefault','$defaultname','$issend','$channeltype',
'$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");
exit();
}
UpDateCatCache();
if ($reid > 0) {
PutCookie('lastCid', GetTopid($reid), 3600 * 24, '/');
}
ShowMsg("成功创建一个分类", "catalog_main.php");
exit();
} //End dopost==save
//获取从父目录继承的默认参数
if ($dopost == '') {
$channelid = 1;
$issend = 1;
$corank = 0;
$reid = 0;
$topid = 0;
$typedir = '';
$moresite = 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'];
$corank = $myrow['corank'];
$topid = $myrow['topid'];
$typedir = $myrow['typedir'];
}
//父栏目是否为二级站点
$moresite = empty($myrow['moresite']) ? 0 : $myrow['moresite'];
}
include DedeInclude('templets/catalog_add.htm');
<?php
/**
* 栏目添加
*
* @version $Id: catalog_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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($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);
$nid = 'article';
if ($id == 0 && $reid == 0) {
CheckPurview('t_New');
} else {
$checkID = empty($id) ? $reid : $id;
CheckPurview('t_AccNew');
CheckCatalog($checkID, '您无权在本栏目下创建子类');
}
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()) {
$channelArray[$row->id]['typename'] = $row->typename;
$channelArray[$row->id]['nid'] = $row->nid;
if ($row->id == $channelid) {
$nid = $row->nid;
}
}
if ($dopost == 'quick') {
$tl = new TypeLink(0);
$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;
$tempindex = "{style}/index_{$nid}.htm";
$templist = "{style}/list_{$nid}.htm";
$temparticle = "{style}/article_{$nid}.htm";
$queryTemplate = "INSERT INTO `#@__arctype`(reid,topid,sortrank,typename,namegk,enname,ennamegk,litpic,litimg,typedir,isdefault,defaultname,issend,channeltype,tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`)
VALUES('~reid~','~topid~','~rank~','~typename~','~namegk~','~enname~','~ennamegk~','~litpic~','~litimg~','~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)) {
$k = str_replace('posttype', '', $k);
} else {
continue;
}
$rank = ${'rank'.$k};
$toptypename = trim(${'toptype'.$k});
$sontype = trim(${'sontype'.$k});
$toptypedir = GetPinyin(stripslashes($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);
$dsql->ExecuteNoneQuery($sql);
$tid = $dsql->GetLastID();
if ($tid > 0 && $sontype != '') {
$sontypes = explode(',', $sontype);
foreach ($sontypes as $k => $v) {
$v = trim($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);
$dsql->ExecuteNoneQuery($sql);
}
}
}
} else {
$row = $dsql->GetOne("SELECT `typedir` FROM `#@__arctype` WHERE `id`={$reid}");
foreach ($_POST as $k => $v) {
if (preg_match("#^posttype#", $k)) {
$k = str_replace('posttype', '', $k);
} else {
continue;
}
$rank = ${'rank'.$k};
$toptypename = trim(${'reltype'.$k});
$toptypedir = GetPinyin(stripslashes($toptypename));
switch ($referpath) {
case 'parent':
$toptypedir = $nextdir.'/'.$toptypedir;
break;
case 'typepath':
$toptypedir = isset($row['typedir']) ? $row['typedir'].'/'.$toptypedir : '/'.$toptypedir;
break;
default:
$toptypedir = '/'.$toptypedir;
break;
}
if (empty($toptypename)) {
continue;
}
$sql = str_replace('~reid~', $reid, $queryTemplate);
$sql = str_replace('~topid~', $reid, $sql);
$sql = str_replace('~rank~', $rank, $sql);
$sql = str_replace('~typename~', $toptypename, $sql);
$sql = str_replace('~typedir~', $toptypedir, $sql);
$dsql->ExecuteNoneQuery($sql);
}
}
UpDateCatCache();
ShowMsg('成功增加指定栏目', 'catalog_main.php');
exit();
}
/*---------------------
function action_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 ($referpath == 'cmspath') $nextdir = '{cmspath}';
if ($referpath == 'basepath') $nextdir = '';
//用拼音命名
if ($upinyin == 1 || $typedir == '') {
$typedir = GetPinyin(stripslashes($typename));
}
$typedir = $nextdir.'/'.$typedir;
$typedir = preg_replace("#\/{1,}#", "/", $typedir);
}
//开启多站点时的设置(仅针对顶级栏目)
if ($reid == 0 && $moresite == 1) {
$sitepath = $typedir;
//检测二级网址
if ($siteurl != '') {
$siteurl = preg_replace("#\/$#", "", $siteurl);
if (!preg_match("#http:\/\/#i", $siteurl)) {
ShowMsg("您绑定的二级域名无效,请用(http://host)的形式", "-1");
exit();
}
if (preg_match("#".$cfg_basehost."#i", $siteurl)) {
ShowMsg("您绑定的二级域名与当前站点是同一个域,不需要绑定", "-1");
exit();
}
}
}
//创建目录
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");
exit();
}
}
$in_query = "INSERT INTO `#@__arctype`(reid,topid,sortrank,typename,namegk,enname,ennamegk,litpic,litimg,typedir,isdefault,defaultname,issend,channeltype,tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`)
VALUES('$reid','$topid','$sortrank','$typename','$namegk','$enname','$ennamegk','$litpic','$litimg','$typedir','$isdefault','$defaultname','$issend','$channeltype','$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");
exit();
}
UpDateCatCache();
if ($reid > 0) {
PutCookie('lastCid', GetTopid($reid), 3600 * 24, '/');
}
ShowMsg("成功创建一个分类", "catalog_main.php");
exit();
}//End dopost==save
//获取从父目录继承的默认参数
if ($dopost == '') {
$channelid = 1;
$issend = 1;
$corank = 0;
$reid = 0;
$topid = 0;
$typedir = '';
$moresite = 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'];
$corank = $myrow['corank'];
$topid = $myrow['topid'];
$typedir = $myrow['typedir'];
}
//父栏目是否为二级站点
$moresite = empty($myrow['moresite']) ? 0 : $myrow['moresite'];
}
include DedeInclude('templets/catalog_add.htm');

src/dede/catalog_del.php → src/admin/catalog_del.php View File

@@ -1,42 +1,41 @@
<?php
/**
* 删除栏目
*
* @version $Id: catalog_del.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
//检查权限许可
CheckPurview('t_Del,t_AccDel');
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') {
$ut = new TypeUnit();
$ut->DelType($id, $delfile);
UpDateCatCache();
ShowMsg("成功删除一个栏目", "catalog_main.php");
exit();
}
$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->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>");
$winform = $win->GetWindow('ok');
$win->Display();
<?php
/**
* 删除栏目
*
* @version $Id: catalog_del.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');

//检查权限许可
CheckPurview('t_Del,t_AccDel');
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') {
$ut = new TypeUnit();
$ut->DelType($id, $delfile);
UpDateCatCache();
ShowMsg("成功删除一个栏目", "catalog_main.php");
exit();
}
$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->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>");
$winform = $win->GetWindow('ok');
$win->Display();

src/dede/catalog_do.php → src/admin/catalog_do.php View File

@@ -1,299 +1,298 @@
<?php
/**
* 栏目操作
*
* @version $Id: catalog_do.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
if (empty($dopost)) {
ShowMsg("对不起,请指定栏目参数", "catalog_main.php");
exit();
}
$cid = empty($cid) ? 0 : intval($cid);
$unittype = empty($unittype) ? 0 : intval($unittype);
$channelid = empty($channelid) ? 0 : intval($channelid);
/*--------------------------
//增加文档
function addArchives();
---------------------------*/
if ($dopost == "addArchives") {
//默认文章调用发布表单
if (empty($cid) && empty($channelid)) {
header("location:article_add.php");
exit();
}
if (!empty($channelid)) {
//根据模型调用发布表单
$row = $dsql->GetOne("SELECT addcon FROM #@__channeltype WHERE id='$channelid'");
} else {
//根据栏目调用发布表单
$row = $dsql->GetOne("SELECT ch.addcon FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id='$cid' ");
}
$gurl = $row["addcon"];
if ($gurl == "") {
ShowMsg("对不起,您指的栏目可能有误", "catalog_main.php");
exit();
}
//跳转并传递参数
header("location:{$gurl}?channelid={$channelid}&cid={$cid}");
exit();
}
/*--------------------------
//管理文档
function listArchives();
---------------------------*/ else if ($dopost == "listArchives") {
if (!empty($gurl)) {
if (empty($arcrank)) {
$arcrank = '';
}
$gurl = str_replace('..', '', $gurl);
header("location:{$gurl}?arcrank={$arcrank}&cid={$cid}");
exit();
}
if ($cid > 0) {
$row = $dsql->GetOne("SELECT #@__arctype.typename,#@__channeltype.typename AS channelname,#@__channeltype.id,#@__channeltype.mancon FROM #@__arctype LEFT JOIN #@__channeltype on #@__channeltype.id=#@__arctype.channeltype WHERE #@__arctype.id='$cid'");
$gurl = $row["mancon"];
$channelid = $row["id"];
$typename = $row["typename"];
$channelname = $row["channelname"];
if ($gurl == "") {
ShowMsg("对不起,您指的栏目可能有误", "catalog_main.php");
exit();
}
} else if ($channelid > 0) {
$row = $dsql->GetOne("SELECT typename,id,mancon FROM #@__channeltype WHERE id='$channelid'");
$gurl = $row["mancon"];
$channelid = $row["id"];
$typename = "";
$channelname = $row["typename"];
}
if (empty($gurl)) $gurl = 'content_list.php';
header("location:{$gurl}?channelid={$channelid}&cid={$cid}");
exit();
}
/*--------------------------
//浏览通用模板目录
function viewTempletDir();
---------------------------*/ else if ($dopost == "viewTemplet") {
header("location:tpl.php?path=/".$cfg_df_style);
exit();
}
/*------------------------
浏览单个页面的栏目
function ViewSgPage()
------------------------*/ else if ($dopost == "viewSgPage") {
require_once(DEDEINC."/arc.listview.class.php");
$lv = new ListView($cid);
$pageurl = $lv->MakeHtml();
ShowMsg("更新缓冲,请稍后...", $pageurl);
exit();
}
/*------------------------
更改栏目排列顺序
function upRank()
------------------------*/ else if ($dopost == "upRank") {
//检查权限许可
CheckPurview('t_Edit,t_AccEdit');
//检查栏目操作许可
CheckCatalog($cid, "您无权更改本栏目");
$row = $dsql->GetOne("SELECT reid,sortrank FROM #@__arctype WHERE id='$cid'");
$reid = $row['reid'];
$sortrank = $row['sortrank'];
$row = $dsql->GetOne("SELECT sortrank FROM #@__arctype WHERE sortrank<=$sortrank AND reid=$reid ORDER BY sortrank DESC ");
if (is_array($row)) {
$sortrank = $row['sortrank'] - 1;
$dsql->ExecuteNoneQuery("UPDATE #@__arctype SET sortrank='$sortrank' WHERE id='$cid'");
}
UpDateCatCache();
ShowMsg("操作成功,返回目录...", "catalog_main.php");
exit();
} else if ($dopost == "upRankAll") {
//检查权限许可
CheckPurview('t_Edit');
$row = $dsql->GetOne("SELECT id FROM #@__arctype ORDER BY id DESC");
if (is_array($row)) {
$maxID = $row['id'];
for ($i = 1; $i <= $maxID; $i++) {
if (isset(${'sortrank'.$i})) {
$dsql->ExecuteNoneQuery("UPDATE #@__arctype SET sortrank='".(${'sortrank'.$i})."' WHERE id='{$i}';");
}
}
}
UpDateCatCache();
ShowMsg("操作成功,正在返回...", "catalog_main.php");
exit();
}
/*--------------------------
//更新栏目缓存
function UpCatlogCache();
---------------------------*/ else if ($dopost == "upcatcache") {
UpDateCatCache();
$sql = " TRUNCATE TABLE `#@__arctiny`";
$dsql->ExecuteNoneQuery($sql);
//导入普通模型微数据
$sql = "INSERT INTO `#@__arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid)
SELECT id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid FROM `#@__archives` ";
$dsql->ExecuteNoneQuery($sql);
//导入单表模型微数据
$dsql->SetQuery("SELECT id,addtable FROM `#@__channeltype` WHERE id < -1 ");
$dsql->Execute();
$doarray = array();
while ($row = $dsql->GetArray()) {
$tb = str_replace('#@__', $cfg_dbprefix, $row['addtable']);
if (empty($tb) || isset($doarray[$tb])) {
continue;
} else {
$sql = "INSERT INTO `#@__arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid)
SELECT aid, typeid, 0, arcrank, channel, senddate, 0, mid FROM `$tb` ";
$rs = $dsql->executenonequery($sql);
$doarray[$tb] = 1;
}
}
ShowMsg("操作成功,正在返回...", "catalog_main.php");
exit();
}
/*---------------------
获取JS文件
function GetJs
----------------------*/ else if ($dopost == "GetJs") {
header("location:makehtml_js.php");
exit();
}
/*-----------
获得子类的内容
function GetSunListsMenu();
-----------*/ else if ($dopost == "GetSunListsMenu") {
$userChannel = $cuserLogin->getUserChannel();
require_once(DEDEINC."/typeunit.class.menu.php");
AjaxHead();
PutCookie('lastCidMenu', $cid, 3600 * 24, "/");
$tu = new TypeUnit($userChannel);
$tu->LogicListAllSunType($cid, " ");
}
/*-----------
获得子类的内容
function GetSunLists();
-----------*/ else if ($dopost == "GetSunLists") {
require_once(DEDEINC."/typeunit.class.admin.php");
AjaxHead();
PutCookie('lastCid', $cid, 3600 * 24, "/");
$tu = new TypeUnit();
$tu->dsql = $dsql;
echo " <table width='100%' border='0' cellspacing='0' cellpadding='0'>\r\n";
$tu->LogicListAllSunType($cid, " ");
echo " </table>\r\n";
$tu->Close();
}
/*----------------
合并栏目
function unitCatalog() { }
-----------------*/ else if ($dopost == 'unitCatalog') {
CheckPurview('t_Move');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/channelunit.func.php');
if (empty($nextjob)) {
$typeid = isset($typeid) ? intval($typeid) : 0;
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__arctype` WHERE reid='$typeid' ");
$tl = new TypeLink($typeid);
$typename = $tl->TypeInfos['typename'];
$reid = $tl->TypeInfos['reid'];
$channelid = $tl->TypeInfos['channeltype'];
if (!empty($row['dd'])) {
ShowMsg("栏目: $typename($typeid) 有子栏目,不能进行合并操作", '-1');
exit();
}
$typeOptions = $tl->GetOptionArray(0, 0, $channelid);
$wintitle = '合并栏目';
$wecome_info = "<a href='catalog_main.php'>栏目管理</a> &gt;&gt; 合并栏目";
$win = new OxWindow();
$win->Init('catalog_do.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'unitCatalog');
$win->AddHidden('typeid', $typeid);
$win->AddHidden('channelid', $channelid);
$win->AddHidden('nextjob', 'unitok');
$win->AddTitle("合并目录时不会删除原来的栏目目录,合并后需手动更新目标栏目的文档HTML和列表HTML。");
$win->AddItem('您选择的栏目是:', "<font color='red'>$typename($typeid)</font>");
$win->AddItem('您希望合并到那个栏目?', "<select name='unittype'>\r\n{$typeOptions}\r\n</select>");
$win->AddItem('注意事项:', '栏目不能有下级子栏目,只允许子级到更高级或同级或不同父级的情况。');
$winform = $win->GetWindow('ok');
$win->Display();
exit();
} else {
if ($typeid == $unittype) {
ShowMsg("同一栏目无法合并,请后退重试", '-1');
exit();
}
if (IsParent($unittype, $typeid)) {
ShowMsg('不能从父类合并到子类', 'catalog_main.php');
exit();
}
$row = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = (empty($row['addtable']) ? '#@__addonarticle' : $row['addtable']);
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__feedback` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET typeid2='$unittype' WHERE typeid2='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__addonspec` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctype` WHERE id='$typeid' ");
UpDateCatCache();
ShowMsg('成功合并指定栏目', 'catalog_main.php');
exit();
}
}
/*----------------
移动栏目
function moveCatalog() { }
-----------------*/ else if ($dopost == 'moveCatalog') {
CheckPurview('t_Move');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/channelunit.func.php');
if (empty($nextjob)) {
$tl = new TypeLink($typeid);
$typename = $tl->TypeInfos['typename'];
$reid = $tl->TypeInfos['reid'];
$channelid = $tl->TypeInfos['channeltype'];
$typeOptions = $tl->GetOptionArray(0, 0, $channelid);
$wintitle = "移动栏目";
$wecome_info = "<a href='catalog_main.php'>栏目管理</a> &gt;&gt; 移动栏目";
$win = new OxWindow();
$win->Init('catalog_do.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'moveCatalog');
$win->AddHidden('typeid', $typeid);
$win->AddHidden('channelid', $channelid);
$win->AddHidden('nextjob', 'unitok');
$win->AddTitle("移动目录时不会删除原来已创建的列表,移动后需重新对栏目创建HTML。");
$win->AddItem('您选择的栏目是:', "$typename($typeid)");
$win->AddItem('您希望移动到那个栏目?', "<select name='movetype'>\r\n<option value='0'>移动为顶级栏目</option>\r\n$typeOptions\r\n</select>");
$win->AddItem('注意事项:', '不允许从父级移动到子级目录,只允许子级到更高级或同级或不同父级的情况。');
$winform = $win->GetWindow('ok');
$win->Display();
exit();
} else {
if ($typeid == $movetype) {
ShowMsg('移对对象和目标位置相同', 'catalog_main.php');
exit();
}
if (IsParent($movetype, $typeid)) {
ShowMsg('不能从父类移动到子类', 'catalog_main.php');
exit();
}
$dsql->ExecuteNoneQuery(" UPDATE `#@__arctype` SET reid='$movetype' WHERE id='$typeid' ");
UpDateCatCache();
ShowMsg('成功移动目录', 'catalog_main.php');
exit();
}
}
<?php
/**
* 栏目操作
*
* @version $Id: catalog_do.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__).'/config.php');
if (empty($dopost)) {
ShowMsg("对不起,请指定栏目参数", "catalog_main.php");
exit();
}
$cid = empty($cid) ? 0 : intval($cid);
$unittype = empty($unittype) ? 0 : intval($unittype);
$channelid = empty($channelid) ? 0 : intval($channelid);

/*--------------------------
//增加文档
function addArchives();
---------------------------*/
if ($dopost == "addArchives") {
//默认文章调用发布表单
if (empty($cid) && empty($channelid)) {
header("location:article_add.php");
exit();
}
if (!empty($channelid)) {
//根据模型调用发布表单
$row = $dsql->GetOne("SELECT addcon FROM #@__channeltype WHERE id='$channelid'");
} else {
//根据栏目调用发布表单
$row = $dsql->GetOne("SELECT ch.addcon FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id='$cid' ");
}
$gurl = $row["addcon"];
if ($gurl == "") {
ShowMsg("对不起,您指的栏目可能有误", "catalog_main.php");
exit();
}

//跳转并传递参数
header("location:{$gurl}?channelid={$channelid}&cid={$cid}");
exit();
}
/*--------------------------
//管理文档
function listArchives();
---------------------------*/ else if ($dopost == "listArchives") {
if (!empty($gurl)) {
if (empty($arcrank)) {
$arcrank = '';
}
$gurl = str_replace('..', '', $gurl);
header("location:{$gurl}?arcrank={$arcrank}&cid={$cid}");
exit();
}
if ($cid > 0) {
$row = $dsql->GetOne("SELECT #@__arctype.typename,#@__channeltype.typename AS channelname,#@__channeltype.id,#@__channeltype.mancon FROM #@__arctype LEFT JOIN #@__channeltype on #@__channeltype.id=#@__arctype.channeltype WHERE #@__arctype.id='$cid'");
$gurl = $row["mancon"];
$channelid = $row["id"];
$typename = $row["typename"];
$channelname = $row["channelname"];
if ($gurl == "") {
ShowMsg("对不起,您指的栏目可能有误", "catalog_main.php");
exit();
}
} else if ($channelid > 0) {
$row = $dsql->GetOne("SELECT typename,id,mancon FROM #@__channeltype WHERE id='$channelid'");
$gurl = $row["mancon"];
$channelid = $row["id"];
$typename = "";
$channelname = $row["typename"];
}

if (empty($gurl)) $gurl = 'content_list.php';
header("location:{$gurl}?channelid={$channelid}&cid={$cid}");
exit();
}
/*--------------------------
//浏览通用模板目录
function viewTempletDir();
---------------------------*/ else if ($dopost == "viewTemplet") {
header("location:tpl.php?path=/".$cfg_df_style);
exit();
}
/*------------------------
浏览单个页面的栏目
function ViewSgPage()
------------------------*/ else if ($dopost == "viewSgPage") {
require_once(DEDEINC."/arc.listview.class.php");
$lv = new ListView($cid);
$pageurl = $lv->MakeHtml();
ShowMsg("更新缓冲,请稍后...", $pageurl);
exit();
}
/*------------------------
修改栏目排列顺序
function upRank()
------------------------*/ else if ($dopost == "upRank") {
//检查权限许可
CheckPurview('t_Edit,t_AccEdit');

//检查栏目操作许可
CheckCatalog($cid, "您无权修改本栏目");
$row = $dsql->GetOne("SELECT reid,sortrank FROM #@__arctype WHERE id='$cid'");
$reid = $row['reid'];
$sortrank = $row['sortrank'];
$row = $dsql->GetOne("SELECT sortrank FROM #@__arctype WHERE sortrank<=$sortrank AND reid=$reid ORDER BY sortrank DESC ");
if (is_array($row)) {
$sortrank = $row['sortrank'] - 1;
$dsql->ExecuteNoneQuery("UPDATE #@__arctype SET sortrank='$sortrank' WHERE id='$cid'");
}
UpDateCatCache();
ShowMsg("操作成功,返回目录...", "catalog_main.php");
exit();
} else if ($dopost == "upRankAll") {
//检查权限许可
CheckPurview('t_Edit');
$row = $dsql->GetOne("SELECT id FROM #@__arctype ORDER BY id DESC");
if (is_array($row)) {
$maxID = $row['id'];
for ($i = 1; $i <= $maxID; $i++) {
if (isset(${'sortrank'.$i})) {
$dsql->ExecuteNoneQuery("UPDATE #@__arctype SET sortrank='".(${'sortrank'.$i})."' WHERE id='{$i}';");
}
}
}
UpDateCatCache();
ShowMsg("操作成功,正在返回...", "catalog_main.php");
exit();
}
/*--------------------------
//更新栏目缓存
function UpCatlogCache();
---------------------------*/ else if ($dopost == "upcatcache") {
UpDateCatCache();
$sql = " TRUNCATE TABLE `#@__arctiny`";
$dsql->ExecuteNoneQuery($sql);

//导入普通模型微数据
$sql = "INSERT INTO `#@__arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid)
SELECT id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid FROM `#@__archives` ";
$dsql->ExecuteNoneQuery($sql);

//导入单表模型微数据
$dsql->SetQuery("SELECT id,addtable FROM `#@__channeltype` WHERE id < -1 ");
$dsql->Execute();
$doarray = array();
while ($row = $dsql->GetArray()) {
$tb = str_replace('#@__', $cfg_dbprefix, $row['addtable']);
if (empty($tb) || isset($doarray[$tb])) {
continue;
} else {
$sql = "INSERT INTO `#@__arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid)
SELECT aid, typeid, 0, arcrank, channel, senddate, 0, mid FROM `$tb` ";
$rs = $dsql->executenonequery($sql);
$doarray[$tb] = 1;
}
}
ShowMsg("操作成功,正在返回...", "catalog_main.php");
exit();
}
/*---------------------
获取JS文件
function GetJs
----------------------*/ else if ($dopost == "GetJs") {
header("location:makehtml_js.php");
exit();
}
/*-----------
获得子类的内容
function GetSunListsMenu();
-----------*/ else if ($dopost == "GetSunListsMenu") {
$userChannel = $cuserLogin->getUserChannel();
require_once(DEDEINC."/typeunit.class.menu.php");
AjaxHead();
PutCookie('lastCidMenu', $cid, 3600 * 24, "/");
$tu = new TypeUnit($userChannel);
$tu->LogicListAllSunType($cid, " ");
}
/*-----------
获得子类的内容
function GetSunLists();
-----------*/ else if ($dopost == "GetSunLists") {
require_once(DEDEINC."/typeunit.class.admin.php");
AjaxHead();
PutCookie('lastCid', $cid, 3600 * 24, "/");
$tu = new TypeUnit();
$tu->dsql = $dsql;
echo " <table width='100%' border='0' cellspacing='0' cellpadding='0'>\r\n";
$tu->LogicListAllSunType($cid, " ");
echo " </table>\r\n";
$tu->Close();
}
/*----------------
合并栏目
function unitCatalog() { }
-----------------*/ else if ($dopost == 'unitCatalog') {
CheckPurview('t_Move');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/channelunit.func.php');
if (empty($nextjob)) {
$typeid = isset($typeid) ? intval($typeid) : 0;
$row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__arctype` WHERE reid='$typeid' ");
$tl = new TypeLink($typeid);
$typename = $tl->TypeInfos['typename'];
$reid = $tl->TypeInfos['reid'];
$channelid = $tl->TypeInfos['channeltype'];
if (!empty($row['dd'])) {
ShowMsg("栏目: $typename($typeid) 有子栏目,不能进行合并操作", '-1');
exit();
}
$typeOptions = $tl->GetOptionArray(0, 0, $channelid);
$wintitle = '合并栏目';
$wecome_info = "<a href='catalog_main.php'>栏目管理</a> &gt;&gt; 合并栏目";
$win = new OxWindow();
$win->Init('catalog_do.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'unitCatalog');
$win->AddHidden('typeid', $typeid);
$win->AddHidden('channelid', $channelid);
$win->AddHidden('nextjob', 'unitok');
$win->AddTitle("合并目录时不会删除原来的栏目目录,合并后需手动更新目标栏目的文档HTML和列表HTML。");
$win->AddItem('您选择的栏目是:', "<span style='color:#e74d58'>$typename($typeid)</span>");
$win->AddItem('您希望合并到那个栏目?', "<select name='unittype'>\r\n{$typeOptions}\r\n</select>");
$win->AddItem('注意事项:', '栏目不能有下级子栏目,只允许子级到更高级或同级或不同父级的情况。');
$winform = $win->GetWindow('ok');
$win->Display();
exit();
} else {
if ($typeid == $unittype) {
ShowMsg("同一栏目无法合并,请后退重试", '-1');
exit();
}
if (IsParent($unittype, $typeid)) {
ShowMsg('不能从父类合并到子类', 'catalog_main.php');
exit();
}
$row = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' ");
$addtable = (empty($row['addtable']) ? '#@__addonarticle' : $row['addtable']);
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__feedback` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET typeid2='$unittype' WHERE typeid2='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__addonspec` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET typeid='$unittype' WHERE typeid='$typeid' ");
$dsql->ExecuteNoneQuery("DELETE FROM `#@__arctype` WHERE id='$typeid' ");
UpDateCatCache();
ShowMsg('成功合并指定栏目', 'catalog_main.php');
exit();
}
}
/*----------------
移动栏目
function moveCatalog() { }
-----------------*/ else if ($dopost == 'moveCatalog') {
CheckPurview('t_Move');
require_once(DEDEINC.'/oxwindow.class.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/channelunit.func.php');
if (empty($nextjob)) {
$tl = new TypeLink($typeid);
$typename = $tl->TypeInfos['typename'];
$reid = $tl->TypeInfos['reid'];
$channelid = $tl->TypeInfos['channeltype'];
$typeOptions = $tl->GetOptionArray(0, 0, $channelid);
$wintitle = "移动栏目";
$wecome_info = "<a href='catalog_main.php'>栏目管理</a> &gt;&gt; 移动栏目";
$win = new OxWindow();
$win->Init('catalog_do.php', 'js/blank.js', 'POST');
$win->AddHidden('dopost', 'moveCatalog');
$win->AddHidden('typeid', $typeid);
$win->AddHidden('channelid', $channelid);
$win->AddHidden('nextjob', 'unitok');
$win->AddTitle("移动目录时不会删除原来已创建的列表,移动后需重新对栏目创建HTML。");
$win->AddItem('您选择的栏目是:', "$typename($typeid)");
$win->AddItem('您希望移动到那个栏目?', "<select name='movetype'>\r\n<option value='0'>移动为顶级栏目</option>\r\n$typeOptions\r\n</select>");
$win->AddItem('注意事项:', '不允许从父级移动到子级目录,只允许子级到更高级或同级或不同父级的情况。');
$winform = $win->GetWindow('ok');
$win->Display();
exit();
} else {
if ($typeid == $movetype) {
ShowMsg('移对对象和目标位置相同', 'catalog_main.php');
exit();
}
if (IsParent($movetype, $typeid)) {
ShowMsg('不能从父类移动到子类', 'catalog_main.php');
exit();
}
$dsql->ExecuteNoneQuery(" UPDATE `#@__arctype` SET reid='$movetype' WHERE id='$typeid' ");
UpDateCatCache();
ShowMsg('成功移动目录', 'catalog_main.php');
exit();
}
}

src/dede/catalog_edit.php → src/admin/catalog_edit.php View File

@@ -1,246 +1,251 @@
<?php
/**
* 栏目编辑
*
* @version $Id: catalog_edit.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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 = '';
$id = isset($id) ? intval($id) : 0;
//检查权限许可
CheckPurview('t_Edit,t_AccEdit');
//检查栏目操作许可
CheckCatalog($id, '您无权更改本栏目');
/*-----------------------
function action_save()
----------------------*/
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) {
$sitepath = $typedir;
$uptopsql = " ,siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' ";
}
if ($ispart != 0) $cross = 0;
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
sortrank='$sortrank',
typename='$typename',
typedir='$typedir',
isdefault='$isdefault',
defaultname='$defaultname',
issend='$issend',
ishidden='$ishidden',
channeltype='$channeltype',
tempindex='$tempindex',
templist='$templist',
temparticle='$temparticle',
namerule='$namerule',
namerule2='$namerule2',
ispart='$ispart',
corank='$corank',
description='$description',
keywords='$keywords',
seotitle='$seotitle',
moresite='$moresite',
`cross`='$cross',
`content`='$content',
`crossid`='$crossid',
`smalltypes`='$smalltypes'
$uptopsql
WHERE id='$id' ";
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("保存当前栏目更改时失败,请检查您的输入资料是否存在问题", "-1");
exit();
}
//如果选择子栏目可投稿,更新顶级栏目为可投稿
if ($topid > 0 && $issend == 1) {
$dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
}
$slinks = " id IN (".GetSonIds($id).")";
//修改顶级栏目时强制修改下级的多站点支持属性
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)) {
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
defaultname='$defaultname',
channeltype='$channeltype',
tempindex='$tempindex',
templist='$templist',
temparticle='$temparticle',
namerule='$namerule',
namerule2='$namerule2',
ishidden='$ishidden'
WHERE 1=1 AND $slinks";
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("更改当前栏目成功,但更改下级栏目属性时失败", "-1");
exit();
}
}
UpDateCatCache();
ShowMsg("成功更改一个分类", "catalog_main.php");
exit();
} //End Save Action
else if ($dopost == "savetime") {
$uptopsql = '';
$slinks = " id IN (".GetSonIds($id).")";
//顶级栏目二级域名根目录处理
if ($topid == 0 && $moresite == 1) {
$sitepath = $typedir;
$uptopsql = " ,sitepath='$sitepath' ";
if (preg_match("#,#", $slinks)) {
$upquery = "UPDATE `#@__arctype` SET sitepath='$sitepath' WHERE $slinks";
$dsql->ExecuteNoneQuery($upquery);
}
}
//如果选择子栏目可投稿,更新顶级栏目为可投稿
if ($topid > 0 && $issend == 1) {
$dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
}
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
sortrank='$sortrank',
typedir='$typedir',
typename='$typename',
isdefault='$isdefault',
defaultname='$defaultname',
ispart='$ispart',
corank='$corank' $uptopsql
WHERE id='$id' ";
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("保存当前栏目更改时失败,请检查您的输入资料是否存在问题", "-1");
exit();
}
UpDateCatCache();
ShowMsg("成功更改一个分类", "catalog_main.php");
exit();
}
//读取栏目信息
$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) {
$toprow = $dsql->GetOne("SELECT moresite,siteurl,sitepath FROM `#@__arctype` WHERE id=$topid");
foreach ($toprow as $k => $v) {
if (!preg_match("#[0-9]#", $k)) {
$myrow[$k] = $v;
}
}
}
$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()) {
$channelArray[$row->id]['typename'] = $row->typename;
$channelArray[$row->id]['nid'] = $row->nid;
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; ?>'>当前是快捷编辑模式,您要修改更详细的参数,请使用高级模式</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' "; ?>>&nbsp;不支持</label>
<label><input type='radio' name='issend' value='1' class='np' <?php if ($myrow['issend'] == "1") echo " checked='1' "; ?>>&nbsp;支持</label>
</td>
</tr>
<tr>
<td class='bline' height="26" align="center">内容模型:</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; ?>' class='btn btn-success btn-sm'>修改</a>
</td>
</tr>
<tr>
<td class='bline' height="26" align="center">栏目名称:</td>
<td class='bline'><input name="typename" type="text" id="typename" value="<?php echo $myrow['typename'] ?>" style="width:260px" class="iptxt"></td>
</tr>
<tr>
<td class='bline' height="26" align="center"> 排列顺序: </td>
<td class='bline'> <input name="sortrank" type="text" value="<?php echo $myrow['sortrank'] ?>" style="width:100" 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:260px"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' "; ?>>&nbsp;链接到默认页</label>
<label><input type='radio' name='isdefault' value='0' class='np' <?php if ($myrow['isdefault'] == 0) echo " checked='1' "; ?>>&nbsp;链接到列表第一页</label>
<label><input type='radio' name='isdefault' value='-1' class='np' <?php if ($myrow['isdefault'] == -1) echo " checked='1' "; ?>>&nbsp;使用动态页</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'] ?>" style="width:260px" 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' "; ?>>&nbsp;最终列表栏目(允许在本栏目发布文档,并生成文档列表)</label><br>
<label><input name="ispart" type="radio" id="radio2" value="1" class='np' <?php if ($myrow['ispart'] == 1) echo " checked='1' "; ?>>&nbsp;频道封面(栏目本身不允许发布文档)</label><br>
<label><input name="ispart" type="radio" id="radio3" value="2" class='np' <?php if ($myrow['ispart'] == 2) echo " checked='1' "; ?>>&nbsp;外部连接(在"文件保存目录"处填写网址)</label>
</td>
</tr>
<tr>
<td align="center" colspan="2" height="50" bgcolor='#FAFEE0'>
<button onclick='getSelCat("<?php echo $targetid; ?>");' class='btn btn-success'>保存</button>
<button type='button' onclick='CloseMsg()' class='btn btn-success'>关闭</button>
</td>
</tr>
</table>
</form>
<?php
exit();
} else {
include DedeInclude('templets/catalog_edit.htm');
}
<?php
/**
* 栏目编辑
*
* @version $Id: catalog_edit.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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 = '';
$id = isset($id) ? intval($id) : 0;
//检查权限许可
CheckPurview('t_Edit,t_AccEdit');
//检查栏目操作许可
CheckCatalog($id, '您无权修改本栏目');
/*-----------------------
function action_save()
----------------------*/
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) {
$sitepath = $typedir;
$uptopsql = " ,siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' ";
}
if ($ispart != 0) $cross = 0;
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
sortrank='$sortrank',
typename='$typename',
namegk='$namegk',
enname='$enname',
ennamegk='$ennamegk',
litpic='$litpic',
litimg='$litimg',
typedir='$typedir',
isdefault='$isdefault',
defaultname='$defaultname',
issend='$issend',
ishidden='$ishidden',
channeltype='$channeltype',
tempindex='$tempindex',
templist='$templist',
temparticle='$temparticle',
namerule='$namerule',
namerule2='$namerule2',
ispart='$ispart',
corank='$corank',
description='$description',
keywords='$keywords',
seotitle='$seotitle',
moresite='$moresite',
`cross`='$cross',
`content`='$content',
`crossid`='$crossid',
`smalltypes`='$smalltypes'
$uptopsql
WHERE id='$id' ";
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("保存当前栏目修改时失败,请检查您的输入资料是否存在问题", "-1");
exit();
}
//如果选择子栏目可投稿,更新顶级栏目为可投稿
if ($topid > 0 && $issend == 1) {
$dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
}
$slinks = " id IN (".GetSonIds($id).")";
//修改顶级栏目时强制修改下级的多站点支持属性
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)) {
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
defaultname='$defaultname',
channeltype='$channeltype',
tempindex='$tempindex',
templist='$templist',
temparticle='$temparticle',
namerule='$namerule',
namerule2='$namerule2',
ishidden='$ishidden'
WHERE 1=1 AND $slinks";
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("修改当前栏目成功,但修改下级栏目属性时失败", "-1");
exit();
}
}
UpDateCatCache();
ShowMsg("成功修改一个分类", "catalog_main.php");
exit();
}//End Save Action
else if ($dopost == "savetime") {
$uptopsql = '';
$slinks = " id IN (".GetSonIds($id).")";
//顶级栏目二级域名根目录处理
if ($topid == 0 && $moresite == 1) {
$sitepath = $typedir;
$uptopsql = " ,sitepath='$sitepath' ";
if (preg_match("#,#", $slinks)) {
$upquery = "UPDATE `#@__arctype` SET sitepath='$sitepath' WHERE $slinks";
$dsql->ExecuteNoneQuery($upquery);
}
}
//如果选择子栏目可投稿,更新顶级栏目为可投稿
if ($topid > 0 && $issend == 1) {
$dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; ");
}
$upquery = "UPDATE `#@__arctype` SET
issend='$issend',
sortrank='$sortrank',
typedir='$typedir',
typename='$typename',
isdefault='$isdefault',
defaultname='$defaultname',
ispart='$ispart',
corank='$corank' $uptopsql
WHERE id='$id' ";
if (!$dsql->ExecuteNoneQuery($upquery)) {
ShowMsg("保存当前栏目修改时失败,请检查您的输入资料是否存在问题", "-1");
exit();
}
UpDateCatCache();
ShowMsg("成功修改一个分类", "catalog_main.php");
exit();
}
//读取栏目信息
$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) {
$toprow = $dsql->GetOne("SELECT moresite,siteurl,sitepath FROM `#@__arctype` WHERE id=$topid");
foreach ($toprow as $k => $v) {
if (!preg_match("#[0-9]#", $k)) {
$myrow[$k] = $v;
}
}
}
$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()) {
$channelArray[$row->id]['typename'] = $row->typename;
$channelArray[$row->id]['nid'] = $row->nid;
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; ?>">当前是快捷编辑模式,如果您要修改更详细的参数,请使用高级模式&gt;&gt;</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">内容模型:</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; ?>'>[修改]</a>
</td>
</tr>
<tr>
<td class="bline" height="26" align="center">栏目名称:</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>";
else
echo "<option value='".$row->rank."'>".$row->membername."</option>";
}
?>
</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="50" bgcolor='#FAFEE0'>
<input name="imageField" type="image" src="images/button_ok.gif" width="60" height="26" border="0" class="np">
&nbsp;&nbsp;&nbsp;
<a title='关闭' onclick='CloseMsg()'><img src="images/button_back.gif" width="60" height="26" border="0"></a>
</td>
</tr>
</table>
</form>
<?php
exit();
} else {
include DedeInclude('templets/catalog_edit.htm');
}
?>

src/dede/catalog_main.php → src/admin/catalog_main.php View File

@@ -1,15 +1,14 @@
<?php
/**
* 栏目管理
*
* @version $Id: catalog_main.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
$userChannel = $cuserLogin->getUserChannel();
include DedeInclude('templets/catalog_main.htm');
<?php
/**
* 栏目管理
*
* @version $Id: catalog_main.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
$userChannel = $cuserLogin->getUserChannel();
include DedeInclude('templets/catalog_main.htm');

src/dede/catalog_menu.php → src/admin/catalog_menu.php View File

@@ -1,24 +1,23 @@
<?php
/**
* 栏目菜单
*
* @version $Id: catalog_menu.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
$userChannel = $cuserLogin->getUserChannel();
if (empty($opendir)) $opendir = -1;
if ($userChannel > 0) $opendir = $userChannel;
if ($cuserLogin->adminStyle == 'dedecms') {
include DedeInclude('templets/catalog_menu.htm');
exit();
} else {
include DedeInclude('templets/catalog_menu2.htm');
exit();
}
<?php
/**
* 栏目菜单
*
* @version $Id: catalog_menu.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
$userChannel = $cuserLogin->getUserChannel();
if (empty($opendir)) $opendir = -1;
if ($userChannel > 0) $opendir = $userChannel;

if ($cuserLogin->adminStyle == 'dedecms') {
include DedeInclude('templets/catalog_menu.htm');
exit();
} else {
include DedeInclude('templets/catalog_menu2.htm');
exit();
}

src/dede/config.php → src/admin/config.php View File

@@ -40,7 +40,7 @@ if (!isset($GLOBALS['csrf_token']) || $GLOBALS['csrf_token'] === null) {
if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {
PutCookie('dede_csrf_token', $GLOBALS['csrf_token'], 7200, '/');
}
//获得当前脚本名称,如果您的系统被禁用了$_SERVER变量,请自行改这个选项
//获得当前脚本名称,如果您的系统被禁用了$_SERVER变量,请自行改这个选项
$dedeNowurl = $s_scriptName = '';
$isUrlOpen = @ini_get('allow_url_fopen');
$dedeNowurl = GetCurUrl();

src/dede/content_att.php → src/admin/content_att.php View File

@@ -1,30 +1,29 @@
<?php
/**
* 内容属性
*
* @version $Id: content_att.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('sys_Att');
if (empty($dopost)) $dopost = '';
//保存更改
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
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');
<?php
/**
* 内容属性
*
* @version $Id: content_att.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('sys_Att');
if (empty($dopost)) $dopost = '';

//保存修改
if ($dopost == "save") {
$startID = 1;
$endID = $idend;
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');

src/dede/content_batch_up.php → src/admin/content_batch_up.php View File

@@ -1,14 +1,13 @@
<?php
/**
* 内容处理函数
*
* @version $Id: content_batch_up.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');
<?php
/**
* 内容处理函数
*
* @version $Id: content_batch_up.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');

src/dede/content_batchup_action.php → src/admin/content_batchup_action.php View File

@@ -1,186 +1,185 @@
<?php
/**
* 内容处理函数
*
* @version $Id: content_batch_up.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('sys_ArcBatch');
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 = '';
//生成HTML操作由其它页面处理
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);
header("Location: $jumpurl");
exit();
}
$gwhere = " WHERE 1 ";
if ($startid > 0) $gwhere .= " AND id>= $startid ";
if ($endid > $startid) $gwhere .= " AND id<= $endid ";
$idsql = '';
if ($typeid != 0) {
$ids = GetSonIds($typeid);
$gwhere .= " AND typeid IN($ids) ";
}
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($heightdone)) $action = $heightdone;
//指量审核
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);
$dsql->SetQuery("SELECT id,arcrank FROM `#@__arctiny` $gwhere");
$dsql->Execute('c');
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);
exit();
}
//批量删除
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//删除空标题文档
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//删除空内容文章
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//修正缩略图错误
else if ($action == 'modddpic') {
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET litpic='' WHERE trim(litpic)='litpic' ");
ShowMsg("成功修正缩略图错误", "javascript:;");
exit();
}
//批量移动
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)) {
ShowMsg("无法检测移动到的新栏目的信息,不能完成操作", "javascript:;");
exit();
}
if ($typenew['ispart'] != 0) {
ShowMsg("您不能把数据移动到非最终列表的栏目", "javascript:;");
exit();
}
if ($typenew['channeltype'] != $typeold['channeltype']) {
ShowMsg("不能把数据移动到内容类型不同的栏目", "javascript:;");
exit();
}
$gwhere .= " And channel='".$typenew['channeltype']."' And title like '%$keyword%'";
$ch = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id={$typenew['channeltype']} ");
$addtable = $ch['addtable'];
$dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere");
$dsql->Execute('m');
$tdd = 0;
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 != '') {
$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET typeid='$newtypeid' WHERE aid='{$row->id}' ");
}
if ($rs) $tdd++;
//DelArc($row->id,true);
}
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:;");
}
}
//删除空标题内容
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//修正缩略图错误
else if ($action == 'modddpic') {
$dsql->ExecuteNoneQuery("UPDATE #@__archives SET litpic='' WHERE trim(litpic)='litpic' ");
ShowMsg("成功修正缩略图错误", "javascript:;");
exit();
}
<?php
/**
* 内容处理函数
*
* @version $Id: content_batch_up.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('sys_ArcBatch');
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 = '';

//生成HTML操作由其它页面处理
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);
header("Location: $jumpurl");
exit();
}

$gwhere = " WHERE 1 ";
if ($startid > 0) $gwhere .= " AND id>= $startid ";
if ($endid > $startid) $gwhere .= " AND id<= $endid ";
$idsql = '';

if ($typeid != 0) {
$ids = GetSonIds($typeid);
$gwhere .= " AND typeid IN($ids) ";
}
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($heightdone)) $action = $heightdone;

//指量审核
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);
$dsql->SetQuery("SELECT id,arcrank FROM `#@__arctiny` $gwhere");
$dsql->Execute('c');
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);
exit();
}
//批量删除
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//删除空标题文档
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//删除空内容文章
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//修正缩略图错误
else if ($action == 'modddpic') {
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET litpic='' WHERE trim(litpic)='litpic' ");
ShowMsg("成功修正缩略图错误", "javascript:;");
exit();
}
//批量移动
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)) {
ShowMsg("无法检测移动到的新栏目的信息,不能完成操作", "javascript:;");
exit();
}
if ($typenew['ispart'] != 0) {
ShowMsg("您不能把数据移动到非最终列表的栏目", "javascript:;");
exit();
}
if ($typenew['channeltype'] != $typeold['channeltype']) {
ShowMsg("不能把数据移动到内容类型不同的栏目", "javascript:;");
exit();
}
$gwhere .= " And channel='".$typenew['channeltype']."' And title like '%$keyword%'";

$ch = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id={$typenew['channeltype']} ");
$addtable = $ch['addtable'];

$dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere");
$dsql->Execute('m');
$tdd = 0;
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 != '') {
$dsql->ExecuteNoneQuery("UPDATE `$addtable` SET typeid='$newtypeid' WHERE aid='{$row->id}' ");
}
if ($rs) $tdd++;
//DelArc($row->id,true);
}

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:;");
}
}
//删除空标题内容
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++;
}
ShowMsg("成功删除 $tdd 条记录", "javascript:;");
exit();
}
//修正缩略图错误
else if ($action == 'modddpic') {
$dsql->ExecuteNoneQuery("UPDATE #@__archives SET litpic='' WHERE trim(litpic)='litpic' ");
ShowMsg("成功修正缩略图错误", "javascript:;");
exit();
}

src/dede/content_i_list.php → src/admin/content_i_list.php View File

@@ -1,13 +1,12 @@
<?php
/**
* 内容列表
*
* @version $Id: content_i_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
<?php
/**
* 内容列表
*
* @version $Id: content_i_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");

src/dede/content_list.php → src/admin/content_list.php View File

@@ -1,203 +1,202 @@
<?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 DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');
$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 = '';
$arcrank = RemoveXSS($arcrank);
//检查权限许可,总权限
CheckPurview('a_List,a_AccList,a_MyList');
//栏目浏览许可
$userCatalogSql = '';
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 {
CheckCatalog($cid, '您无权浏览非指定栏目的内容');
}
if (TestPurview('a_MyList')) $mid = $cuserLogin->getUserID();
}
$adminid = $cuserLogin->getUserID();
$maintable = '#@__archives';
setcookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/');
$tl = new TypeLink($cid);
//----------------------------------------
//在不指定排序条件和关键字的情况下直接统计微表
//----------------------------------------
if (empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag)) {
$tinyQuerys = array();
if (!empty($userCatalogSql)) {
$tinyQuerys[] = str_replace('arc.', '', $userCatalogSql);
}
if (!empty($channelid) && empty($cid)) {
$tinyQuerys[] = " channel = '$channelid' ";
} else {
$tinyQuerys[] = " channel>0 ";
}
if (!empty($arcrank)) {
$tinyQuerys[] = " arcrank='$arcrank' ";
} else {
$tinyQuerys[] = " arcrank > -2 ";
}
if (!empty($mid)) {
$tinyQuerys[] = " mid='$mid' ";
}
if (!empty($cid)) {
$tinyQuerys[] = " typeid in(".GetSonIds($cid).") ";
}
if (count($tinyQuerys) > 0) {
$tinyQuery = "WHERE ".join(' AND ', $tinyQuerys);
}
// 缓存处理
$sql = "SELECT COUNT(*) AS dd FROM `#@__arctiny` $tinyQuery ";
$arr = $dsql->GetOne($sql);
$totalresult = $arr['dd'];
}
if ($cid == 0) {
if ($channelid == 0) {
$positionname = '所有栏目&gt;';
} else {
$row = $tl->dsql->GetOne("SELECT id,typename,maintable FROM `#@__channeltype` WHERE id='$channelid'");
$positionname = $row['typename']." &gt; ";
$maintable = $row['maintable'];
$channelid = $row['id'];
}
} else {
$positionname = str_replace($cfg_list_symbol, " &gt; ", $tl->GetPositionName())." &gt; ";
}
//当选择的是单表模型栏目时,直接跳转到单表模型管理区
if (
empty($channelid)
&& isset($tl->TypeInfos['channeltype'])
) {
$channelid = $tl->TypeInfos['channeltype'];
}
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";
$typeCount = 0;
if (file_exists($cache1)) require_once($cache1);
else $cfg_Cs = array();
$typeCount = count($cfg_Cs);
if ($typeCount > 800) {
if (file_exists($optCache)) {
$optionarr = file_get_contents($optCache);
} else {
$optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid);
file_put_contents($optCache, $optionarr);
}
} else {
$optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid);
}
$whereSql = empty($channelid) ? " WHERE arc.channel > 0 AND arc.arcrank > -2 " : " WHERE arc.channel = '$channelid' 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");
}
if (!empty($userCatalogSql)) {
$whereSql .= " AND ".$userCatalogSql;
}
if (!empty($mid)) {
$whereSql .= " AND arc.mid = '$mid' ";
}
if ($keyword != '') {
$whereSql .= " AND ( CONCAT(arc.title,arc.writer) LIKE '%$keyword%') ";
}
if ($flag != '') {
$whereSql .= " AND FIND_IN_SET('$flag', arc.flag) ";
}
if ($cid != 0) {
$whereSql .= ' AND arc.typeid IN ('.GetSonIds($cid).')';
}
if ($arcrank != '') {
$whereSql .= " AND arc.arcrank = '$arcrank' ";
$CheckUserSend = "<button type='button' class='btn btn-success btn-sm' onClick=\"location='catalog_do.php?cid=".$cid."&dopost=listArchives&gurl=content_list.php';\">所有文档</button>";
} else {
$CheckUserSend = "<button type='button' class='btn btn-success 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;
$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
FROM `$maintable` arc
$whereSql
ORDER BY $orderbyField DESC";
if (empty($f) || !preg_match("#form#", $f)) $f = 'form1.arcid1';
//初始化
$dlist = new DataListCP();
$dlist->pageSize = 30;
//GET参数
$dlist->SetParameter('dopost', 'listArchives');
$dlist->SetParameter('keyword', $keyword);
if (!empty($mid)) $dlist->SetParameter('mid', $mid);
$dlist->SetParameter('cid', $cid);
$dlist->SetParameter('flag', $flag);
$dlist->SetParameter('orderby', $orderby);
$dlist->SetParameter('arcrank', $arcrank);
$dlist->SetParameter('channelid', $channelid);
$dlist->SetParameter('f', $f);
//模板
if (empty($s_tmplets)) $s_tmplets = 'templets/content_list.htm';
$dlist->SetTemplate(DEDEADMIN.'/'.$s_tmplets);
//查询
$dlist->SetSource($query);
//显示
$dlist->Display();
// echo $dlist->queryTime;
$dlist->Close();
<?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 DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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');

$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 = '';

$arcrank = RemoveXSS($arcrank);

//检查权限许可,总权限
CheckPurview('a_List,a_AccList,a_MyList');

//栏目浏览许可
$userCatalogSql = '';
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 {
CheckCatalog($cid, '您无权浏览非指定栏目的内容');
}
if (TestPurview('a_MyList')) $mid = $cuserLogin->getUserID();
}

$adminid = $cuserLogin->getUserID();
$maintable = '#@__archives';
setcookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/');
$tl = new TypeLink($cid);

//----------------------------------------
//在不指定排序条件和关键字的情况下直接统计微表
//----------------------------------------
if (empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag)) {
$tinyQuerys = array();

if (!empty($userCatalogSql)) {
$tinyQuerys[] = str_replace('arc.', '', $userCatalogSql);
}

if (!empty($channelid) && empty($cid)) {
$tinyQuerys[] = " channel = '$channelid' ";
} else {
$tinyQuerys[] = " channel>0 ";
}

if (!empty($arcrank)) {
$tinyQuerys[] = " arcrank='$arcrank' ";
} else {
$tinyQuerys[] = " arcrank > -2 ";
}

if (!empty($mid)) {
$tinyQuerys[] = " mid='$mid' ";
}

if (!empty($cid)) {
$tinyQuerys[] = " typeid in(".GetSonIds($cid).") ";
}

if (count($tinyQuerys) > 0) {
$tinyQuery = "WHERE ".join(' AND ', $tinyQuerys);
}
//缓存处理
$sql = "SELECT COUNT(*) AS dd FROM `#@__arctiny` $tinyQuery ";
$arr = $dsql->GetOne($sql);
$totalresult = $arr['dd'];
}

if ($cid == 0) {
if ($channelid == 0) {
$positionname = '所有栏目&gt;';
} else {
$row = $tl->dsql->GetOne("SELECT id,typename,maintable FROM `#@__channeltype` WHERE id='$channelid'");
$positionname = $row['typename']." &gt; ";
$maintable = $row['maintable'];
$channelid = $row['id'];
}
} else {
$positionname = str_replace($cfg_list_symbol, " &gt; ", $tl->GetPositionName())." &gt; ";
}

//当选择的是单表模型栏目时,直接跳转到单表模型管理区
if (
empty($channelid)
&& isset($tl->TypeInfos['channeltype'])
) {
$channelid = $tl->TypeInfos['channeltype'];
}
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";

$typeCount = 0;
if (file_exists($cache1)) require_once($cache1);
else $cfg_Cs = array();
$typeCount = count($cfg_Cs);
if ($typeCount > 800) {
if (file_exists($optCache)) {
$optionarr = file_get_contents($optCache);
} else {
$optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid);
file_put_contents($optCache, $optionarr);
}
} else {
$optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid);
}

$whereSql = empty($channelid) ? " WHERE arc.channel > 0 AND arc.arcrank > -2 " : " WHERE arc.channel = '$channelid' 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");
}


if (!empty($userCatalogSql)) {
$whereSql .= " AND ".$userCatalogSql;
}
if (!empty($mid)) {
$whereSql .= " AND arc.mid = '$mid' ";
}
if ($keyword != '') {
$whereSql .= " AND ( CONCAT(arc.title,arc.writer) LIKE '%$keyword%') ";
}
if ($flag != '') {
$whereSql .= " AND FIND_IN_SET('$flag', arc.flag) ";
}
if ($cid != 0) {
$whereSql .= ' AND arc.typeid IN ('.GetSonIds($cid).')';
}
if ($arcrank != '') {
$whereSql .= " AND arc.arcrank = '$arcrank' ";
$CheckUserSend = "<button type='button' class='btn btn-success btn-sm' onClick=\"location='catalog_do.php?cid=".$cid."&dopost=listArchives&gurl=content_list.php';\">所有文档</button>";
} else {
$CheckUserSend = "<button type='button' class='btn btn-success 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;

$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
FROM `$maintable` arc
$whereSql
ORDER BY $orderbyField DESC";

if (empty($f) || !preg_match("#form#", $f)) $f = 'form1.arcid1';

//初始化
$dlist = new DataListCP();
$dlist->pageSize = 30;

//GET参数
$dlist->SetParameter('dopost', 'listArchives');
$dlist->SetParameter('keyword', $keyword);
if (!empty($mid)) $dlist->SetParameter('mid', $mid);
$dlist->SetParameter('cid', $cid);
$dlist->SetParameter('flag', $flag);
$dlist->SetParameter('orderby', $orderby);
$dlist->SetParameter('arcrank', $arcrank);
$dlist->SetParameter('channelid', $channelid);
$dlist->SetParameter('f', $f);

//模板
if (empty($s_tmplets)) $s_tmplets = 'templets/content_list.htm';
$dlist->SetTemplate(DEDEADMIN.'/'.$s_tmplets);

//查询
$dlist->SetSource($query);

//显示
$dlist->Display();
//echo $dlist->queryTime;
$dlist->Close();

src/dede/content_s_list.php → src/admin/content_s_list.php View File

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

src/dede/content_select_list.php → src/admin/content_select_list.php View File

@@ -1,13 +1,12 @@
<?php
/**
* 选择文章
*
* @version $Id: content_select_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");
<?php
/**
* 选择文章
*
* @version $Id: content_select_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, 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");

src/dede/content_sg_list.php → src/admin/content_sg_list.php View File

@@ -1,87 +1,86 @@
<?php
/**
* 单表模型列表
*
* @version $Id: content_sg_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($cid) && empty($channelid)) {
ShowMsg("该页面必须指定栏目ID或内容模型ID才能浏览", "javascript:;");
exit();
}
//检查权限许可,总权限
CheckPurview('a_List,a_AccList,a_MyList');
//栏目浏览许可
if (TestPurview('a_List')) {
} else if (TestPurview('a_AccList')) {
if ($cid == 0) {
$ucid = $cid = $cuserLogin->getUserChannel();
} 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, "/");
$tl = new TypeLink($cid);
$listtable = @trim($tl->TypeInfos['addtable']);
if (!empty($channelid) && !empty($ucid) && $tl->TypeInfos['channeltype'] != $channelid) {
ShowMsg('您没权限访问此页', 'javascript:;');
exit();
}
if ($cid == 0) {
$row = $tl->dsql->GetOne("SELECT typename,addtable FROM `#@__channeltype` WHERE id='$channelid'");
$positionname = $row['typename']." &gt; ";
$listtable = $row['addtable'];
} 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' ";
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 != '') {
$whereSql .= " AND arc.arcrank = '$arcrank' ";
$CheckUserSend = "<button type='button' class='btn btn-success btn-sm' onClick=\"location='content_sg_list.php?cid={$cid}&channelid={$channelid}&dopost=listArchives';\">所有文档</button>";
} else {
$CheckUserSend = "<button type='button' class='btn btn-success btn-sm' onClick=\"location='content_sg_list.php?cid={$cid}&channelid={$channelid}&dopost=listArchives&arcrank=-1';\">稿件审核</button>";
}
$query = "SELECT arc.aid,arc.aid as id,arc.typeid,arc.arcrank,arc.flag,arc.senddate,arc.channel,arc.title,arc.mid,arc.click,tp.typename,ch.typename as channelname
FROM `$listtable` arc
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel
$whereSql
ORDER BY arc.aid DESC";
$dlist = new DataListCP();
$dlist->pageSize = 20;
$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->SetSource($query);
$dlist->Display();
$dlist->Close();
<?php
/**
* 单表模型列表
*
* @version $Id: content_sg_list.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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 (empty($cid) && empty($channelid)) {
ShowMsg("该页面必须指定栏目ID或内容模型ID才能浏览", "javascript:;");
exit();
}

//检查权限许可,总权限
CheckPurview('a_List,a_AccList,a_MyList');

//栏目浏览许可
if (TestPurview('a_List')) {
} else if (TestPurview('a_AccList')) {
if ($cid == 0) {
$ucid = $cid = $cuserLogin->getUserChannel();
} 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, "/");
$tl = new TypeLink($cid);
$listtable = @trim($tl->TypeInfos['addtable']);
if (!empty($channelid) && !empty($ucid) && $tl->TypeInfos['channeltype'] != $channelid) {
ShowMsg('您没权限访问此页', 'javascript:;');
exit();
}

if ($cid == 0) {
$row = $tl->dsql->GetOne("SELECT typename,addtable FROM `#@__channeltype` WHERE id='$channelid'");
$positionname = $row['typename']." &gt; ";
$listtable = $row['addtable'];
} 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' ";

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 != '') {
$whereSql .= " AND arc.arcrank = '$arcrank' ";
$CheckUserSend = "<button type='button' class='btn btn-success btn-sm' onClick=\"location='content_sg_list.php?cid={$cid}&channelid={$channelid}&dopost=listArchives';\">所有文档</button>";
} else {
$CheckUserSend = "<button type='button' class='btn btn-success btn-sm' onClick=\"location='content_sg_list.php?cid={$cid}&channelid={$channelid}&dopost=listArchives&arcrank=-1';\">稿件审核</button>";
}

$query = "SELECT arc.aid,arc.aid as id,arc.typeid,arc.arcrank,arc.flag,arc.senddate,arc.channel,arc.title,arc.mid,arc.click,tp.typename,ch.typename as channelname
FROM `$listtable` arc
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel
$whereSql
ORDER BY arc.aid DESC";
$dlist = new DataListCP();
$dlist->pageSize = 20;
$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->SetSource($query);
$dlist->Display();
$dlist->Close();

src/dede/content_tj.php → src/admin/content_tj.php View File

@@ -1,51 +1,50 @@
<?php
/**
* 内容统计
*
* @version $Id: content_tj.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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` ");
$row3 = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__member` ");
/**
* 获取文档
*
* @param object $dsql
* @param string $ordertype 排序类型
* @return string
*/
function GetArchives($dsql, $ordertype)
{
$starttime = time() - (24 * 3600 * 30);
if ($ordertype == 'monthFeedback' || $ordertype == 'monthHot') {
$swhere = " where senddate>$starttime ";
} else {
$swhere = "";
}
if (preg_match("#feedback#", $ordertype)) {
$ordersql = " ORDER BY scores DESC ";
} 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}'>评论:{$row->scores}</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";
}
}
include DedeInclude('templets/content_tj.htm');
<?php
/**
* 内容统计
*
* @version $Id: content_tj.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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` ");
$row3 = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__member` ");

/**
* 获取文档
*
* @param object $dsql
* @param string $ordertype 排序类型
* @return string
*/
function GetArchives($dsql, $ordertype)
{
$starttime = time() - (24 * 3600 * 30);
if ($ordertype == 'monthFeedback' || $ordertype == 'monthHot') {
$swhere = " where senddate>$starttime ";
} else {
$swhere = "";
}
if (preg_match("#feedback#", $ordertype)) {
$ordersql = " ORDER BY scores DESC ";
} 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}'>评论:{$row->scores}</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";
}
}
include DedeInclude('templets/content_tj.htm');

src/dede/css/albumupload.css → src/admin/css/albumupload.css View File


+ 1
- 0
src/admin/css/base.css
File diff suppressed because it is too large
View File


src/dede/css/boxy.css → src/admin/css/boxy.css View File

@@ -1,53 +1,53 @@
.boxy-wrapper { position: absolute; }
.boxy-wrapper.fixed { position: fixed; }
/* Modal */
.boxy-modal-blackout { position: absolute; background-color: black; left: 0; top: 0; }
/* Border */
.boxy-wrapper { empty-cells: show; }
.boxy-wrapper .top-left,
.boxy-wrapper .top-right,
.boxy-wrapper .bottom-right,
.boxy-wrapper .bottom-left { width: 10px; height: 10px; padding: 0 }
.boxy-wrapper .top-left { background: url('../images/boxy-nw.png'); }
.boxy-wrapper .top-right { background: url('../images/boxy-ne.png'); }
.boxy-wrapper .bottom-right { background: url('../images/boxy-se.png'); }
.boxy-wrapper .bottom-left { background: url('../images/boxy-sw.png'); }
/* IE6+7 hacks for the border. IE7 should support this natively but fails in conjuction with modal blackout bg. */
/* NB: these must be absolute paths or URLs to your images */
.boxy-wrapper .top-left { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-nw.png'); }
.boxy-wrapper .top-right { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-ne.png'); }
.boxy-wrapper .bottom-right { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-se.png'); }
.boxy-wrapper .bottom-left { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-sw.png'); }
.boxy-wrapper .top,
.boxy-wrapper .bottom { height: 10px; background-color: #693; opacity: 0.6; filter: alpha(opacity=60); padding: 0 }
.boxy-wrapper .left,
.boxy-wrapper .right { width: 10px; background-color: #693; opacity: 0.6; filter: alpha(opacity=60); padding: 0 }
/* Title bar */
.boxy-wrapper .title-bar {
padding: 6px;
position: relative;
background: #693;
}
.boxy-wrapper .title-bar.dragging { cursor: move; }
.boxy-wrapper .title-bar h2 { font-size: 12px; color: white; line-height: 1; margin: 0; padding: 0; font-weight: normal; }
.boxy-wrapper .title-bar .close { color: white; position: absolute; top: 6px; right: 6px; font-size: 90%; line-height: 1; }
/* Content Region */
.boxy-inner { background-color: white; padding: 0 }
.boxy-content { padding: 15px; }
/* Question Boxes */
.boxy-wrapper .question { width: 350px; min-height: 80px; }
.boxy-wrapper .answers { text-align: right; }
.boxy-wrapper { position: absolute; }
.boxy-wrapper.fixed { position: fixed; }
/* Modal */
.boxy-modal-blackout { position: absolute; background-color: black; left: 0; top: 0; }
/* Border */
.boxy-wrapper { empty-cells: show; }
.boxy-wrapper .top-left,
.boxy-wrapper .top-right,
.boxy-wrapper .bottom-right,
.boxy-wrapper .bottom-left { width: 10px; height: 10px; padding: 0 }
.boxy-wrapper .top-left { background: url('../images/boxy-nw.png'); }
.boxy-wrapper .top-right { background: url('../images/boxy-ne.png'); }
.boxy-wrapper .bottom-right { background: url('../images/boxy-se.png'); }
.boxy-wrapper .bottom-left { background: url('../images/boxy-sw.png'); }
/* IE6+7 hacks for the border. IE7 should support this natively but fails in conjuction with modal blackout bg. */
/* NB: these must be absolute paths or URLs to your images */
.boxy-wrapper .top-left { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-nw.png'); }
.boxy-wrapper .top-right { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-ne.png'); }
.boxy-wrapper .bottom-right { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-se.png'); }
.boxy-wrapper .bottom-left { #background: none; #filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/boxy-sw.png'); }
.boxy-wrapper .top,
.boxy-wrapper .bottom { height: 10px; background-color: #693; opacity: 0.6; filter: alpha(opacity=60); padding: 0 }
.boxy-wrapper .left,
.boxy-wrapper .right { width: 10px; background-color: #693; opacity: 0.6; filter: alpha(opacity=60); padding: 0 }
/* Title bar */
.boxy-wrapper .title-bar {
padding: 6px;
position: relative;
background: #693;
}
.boxy-wrapper .title-bar.dragging { cursor: move; }
.boxy-wrapper .title-bar h2 { font-size: 12px; color: white; line-height: 1; margin: 0; padding: 0; font-weight: normal; }
.boxy-wrapper .title-bar .close { color: white; position: absolute; top: 6px; right: 6px; font-size: 90%; line-height: 1; }
/* Content Region */
.boxy-inner { background-color: white; padding: 0 }
.boxy-content { padding: 15px; }
/* Question Boxes */
.boxy-wrapper .question { width: 350px; min-height: 80px; }
.boxy-wrapper .answers { text-align: right; }

src/dede/css/codemirror.css → src/admin/css/codemirror.css View File


+ 1
- 0
src/admin/css/frame.css View File

@@ -0,0 +1 @@
*{padding:0;margin:0;box-sizing:border-box}a{text-decoration:none}html,body{width:100%;height:100%}body{height:100%;font-size:12px;overflow:hidden;z-index:1}body.showmenu{background:url(../images/leftmenu_bg.gif)-10px top repeat-y}body.hidemenu{background:none}ul{list-style:none}form{margin:0;padding:0}.head{width:100%;height:76px;overflow:hidden;z-index:8;position:relative}.top{height:46px;width:100%;background-image:linear-gradient(135deg,#008E38 0%,#639709 50%);overflow:hidden;clear:both}.top .top_logo{float:left;margin-left:30px;height:46px;line-height:46px}.top .top_logo a{font-size:18px;font-weight:600;color:#fff}.top .top_version{display:inline-block;margin-top:12px;margin-left:10px;color:#fff}.top .top_link{float:right;margin-right:30px}.top .top_link ul{float:left;line-height:46px;overflow:hidden}.top .top_link ul li.welcome img{margin-top:-2px;margin-right:10px;width:30px;height:30px;vertical-align:middle;border-radius:50%}.top .top_link ul li{float:left;color:#fff}.top .top_link ul li a{color:#fff;padding-left:20px}.top .top_link ul li a:hover{color:#ccc}.top .top_link .quick{padding:3px 0px 0px 0px;float:left}.top .top_link .quick a{display:block;color:#C60;float:left;line-height:21px;height:21px;overflow:hidden}.topnav{width:100%;height:30px;line-height:30px;background:#393d49;overflow:hidden;clear:both}.topnav .menuact{width:168px;float:left;padding-left:30px;overflow:hidden}.topnav .menuact a{overflow:hidden;color:#eee;padding-right:10px}.topnav .menuact a:hover{color:#fff}.nav{float:left;padding-left:2px;line-height:26px;color:#999}.nav ul li{float:left;display:block;margin-left:4px}.nav ul li a{padding:0 10px 0px 10px;color:#FFCC00}.nav ul li a:hover{color:#fff}.nav ul li a.thisclass,.nav ul li a.thisclass:hover{color:#4E8100;display:block;font-weight:bold;background:#fff;line-height:23px;border-top:2px solid #FFDE59;margin-top:4px;padding:0 10px 0px 10px}.sysmsg{padding-right:30px;float:right;width:500px;color:#999;overflow:hidden}.scroll{float:right;overflow:hidden}.scroll ul li,.sysmsg ul li a{color:#bbb}.scroll ul li a:hover{text-decoration:underline}.scroll a{padding-left:10px;color:#fff}body.showmenu .left{display:block}body.hidemenu .left{display:none}body.showmenu .right{left:220px}body.hidemenu .right{left:0}.left{position:absolute;top:76px;width:220px;left:0;bottom:0;z-index:7}.menu{height:100%}.top_link{font-size:12px}.menu iframe{height:100%;width:99.99%;z-index:20}.right{position:absolute;right:0;top:76px;bottom:0;z-index:7}.main{height:100%}.main iframe{height:100%;width:99.99%;z-index:20}.qucikmenu{position:absolute;right:10px;top:32px;z-index:9;display:none}.qucikmenu ul{width:110px;list-style:none;border:1px solid #E7E7E7;background:#fff}.qucikmenu ul li{display:block;text-align:left}.qucikmenu ul li a{height:30px;line-height:30px;display:block;color:#666;padding-left:10px;padding-right:10px}.qucikmenu ul li a:hover{background:#F7F7F7}.pagemask{width:100%;height:100%;background:#424b51;position:absolute;z-index:100;filter:alpha(opacity=70);-moz-opacity:.7;opacity:.7;display:none}.iframemask{position:absolute;z-index:80;top:0;left:0;background:#fff;border:none;filter:alpha(opacity=0);-moz-opacity:0;opacity:0;height:100%;width:100%;display:none}.allmenu{margin-left:-400px;padding:10px;display:none;width:800px;position:absolute;top:76px;left:50%;z-index:999;background:#fff;border-radius:.2rem}.allmenu .allmenu-box{margin:0 auto;text-align:left;overflow:hidden;padding-left:2px}.maptop{float:left;width:130px;overflow:hidden;padding-right:6px;padding-left:6px;margin-left:-1px}.maptop dt.bigitem{padding:5px 10px;line-height:18px;color:#fff;background:#424b51}.mapitem dt{line-height:30px;font-weight:bold;text-indent:10px;background:#EFF1F1}.mapitem ul{margin-top:10px;margin-bottom:10px}.mapitem ul li{text-indent:20px;line-height:24px;background:url(../images/arrr.gif)0 8px no-repeat}.allmenu a{color:#5C604F}.allmenu a:hover{color:#F63}#login .theme{clear:both;padding:10px;width:70%;margin-top:20px}#login .theme li{margin-bottom:15px;margin-top:5px;overflow:hidden}#login .theme span{display:inline-block;float:left;width:150px;height:22px;line-height:22px;color:#424b51;text-align:right}input[type="text"],input[type="password"]{padding:2px 4px;width:140px;height:18px;line-height:18px;border-width:1px;border-style:solid;border-color:#fff;background:#fff;vertical-align:middle}input[type="text"]:focus,input[type="password"]:focus{box-shadow:none;outline:none}* html input.text{width:220px;border:1px solid #a7a6aa;background:#fff url(../images/input.gif)0 0 no-repeat;margin-top:-1px;margin-right:5px;margin-bottom:0;margin-left:2px;padding:3px;line-height:12px}* html input.radio{margin:-1px 0 0 -2px}.allsearch{float:left;margin-top:6px!important;font-size:12px;border:1px solid #fff;border-radius:.2rem}.np{margin-left:10px;width:40px;height:18px;font-size:12px;color:#fff;background:#57960f;border-radius:.2rem;border:none;cursor:pointer}

src/dede/css/indexbody.css → src/admin/css/indexbody.css View File


src/dede/css/lurd.css → src/admin/css/lurd.css View File


src/dede/css/menuold.css → src/admin/css/menuold.css View File


src/dede/css/tb-box.css → src/admin/css/tb-box.css View File


src/dede/dialog/config.php → src/admin/dialog/config.php View File

@@ -1,37 +1,31 @@
<?php
/**
* 该页仅用于检测用户登录的情况,如要手工更改系统配置,请更改common.inc.php
*
* @version $Id: config.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, 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");
//获得当前脚本名称,如果您的系统被禁用了$_SERVER变量,请自行更改这个选项
$dedeNowurl = '';
$s_scriptName = '';
$isUrlOpen = @ini_get('allow_url_fopen');
$dedeNowurl = GetCurUrl();
$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:;");
exit();
}
$adminDirHand = HtmlReplace($adminDirHand, 1);
$gurl = "../../{$adminDirHand}/login.php?gotopage=".urlencode($dedeNowurl);
echo "<script language='javascript'>location='$gurl';</script>";
exit();
}
<?php
/**
* 该页仅用于检测用户登录的情况,如要手工修改系统配置,请修改common.inc.php
*
* @version $Id: config.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, 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");
//获得当前脚本名称,如果您的系统被禁用了$_SERVER变量,请自行修改这个选项
$dedeNowurl = '';
$s_scriptName = '';
$isUrlOpen = @ini_get('allow_url_fopen');
$dedeNowurl = GetCurUrl();
$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:;");
exit();
}
$adminDirHand = HtmlReplace($adminDirHand, 1);
$gurl = "../../{$adminDirHand}/login.php?gotopage=".urlencode($dedeNowurl);
echo "<script language='javascript'>location='$gurl';</script>";
exit();
}

src/dede/dialog/img/addnews.gif → src/admin/dialog/img/addnews.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 255B Width: 16  |  Height: 16  |  Size: 255B

src/dede/dialog/img/adminuserico.gif → src/admin/dialog/img/adminuserico.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 1021B Width: 16  |  Height: 16  |  Size: 1021B

src/dede/dialog/img/allbg.gif → src/admin/dialog/img/allbg.gif View File

Before After
Width: 11  |  Height: 10  |  Size: 56B Width: 11  |  Height: 10  |  Size: 56B

src/dede/dialog/img/book1.gif → src/admin/dialog/img/book1.gif View File

Before After
Width: 20  |  Height: 14  |  Size: 300B Width: 20  |  Height: 14  |  Size: 300B

src/dede/dialog/img/css.gif → src/admin/dialog/img/css.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 352B Width: 16  |  Height: 16  |  Size: 352B

src/dede/dialog/img/dir.gif → src/admin/dialog/img/dir.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 571B Width: 16  |  Height: 16  |  Size: 571B

src/dede/dialog/img/dir2.gif → src/admin/dialog/img/dir2.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 599B Width: 16  |  Height: 16  |  Size: 599B

src/dede/dialog/img/exe.gif → src/admin/dialog/img/exe.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 601B Width: 16  |  Height: 16  |  Size: 601B

src/dede/dialog/img/flash.gif → src/admin/dialog/img/flash.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 353B Width: 16  |  Height: 16  |  Size: 353B

src/dede/dialog/img/gif.gif → src/admin/dialog/img/gif.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 164B Width: 16  |  Height: 16  |  Size: 164B

src/dede/dialog/img/htm.gif → src/admin/dialog/img/htm.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 354B Width: 16  |  Height: 16  |  Size: 354B

src/dede/dialog/img/img.gif → src/admin/dialog/img/img.gif View File

Before After
Width: 25  |  Height: 15  |  Size: 1.2KB Width: 25  |  Height: 15  |  Size: 1.2KB

src/dede/dialog/img/jpg.gif → src/admin/dialog/img/jpg.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 162B Width: 16  |  Height: 16  |  Size: 162B

src/dede/dialog/img/js.gif → src/admin/dialog/img/js.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 244B Width: 16  |  Height: 16  |  Size: 244B

src/dede/dialog/img/mp3.gif → src/admin/dialog/img/mp3.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 586B Width: 16  |  Height: 16  |  Size: 586B

src/dede/dialog/img/php.gif → src/admin/dialog/img/php.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 262B Width: 16  |  Height: 16  |  Size: 262B

src/dede/dialog/img/picviewnone.gif → src/admin/dialog/img/picviewnone.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 373B Width: 16  |  Height: 16  |  Size: 373B

src/dede/dialog/img/rm.gif → src/admin/dialog/img/rm.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 612B Width: 16  |  Height: 16  |  Size: 612B

src/dede/dialog/img/sp_bg.gif → src/admin/dialog/img/sp_bg.gif View File

Before After
Width: 1024  |  Height: 1  |  Size: 673B Width: 1024  |  Height: 1  |  Size: 673B

src/dede/dialog/img/tbg.gif → src/admin/dialog/img/tbg.gif View File

Before After
Width: 10  |  Height: 36  |  Size: 664B Width: 10  |  Height: 36  |  Size: 664B

src/dede/dialog/img/tbgv.gif → src/admin/dialog/img/tbgv.gif View File

Before After
Width: 10  |  Height: 28  |  Size: 382B Width: 10  |  Height: 28  |  Size: 382B

src/dede/dialog/img/txt.gif → src/admin/dialog/img/txt.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 177B Width: 16  |  Height: 16  |  Size: 177B

src/dede/dialog/img/wbg.gif → src/admin/dialog/img/wbg.gif View File

Before After
Width: 15  |  Height: 27  |  Size: 479B Width: 15  |  Height: 27  |  Size: 479B

src/dede/dialog/img/wmv.gif → src/admin/dialog/img/wmv.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 598B Width: 16  |  Height: 16  |  Size: 598B

src/dede/dialog/img/zip.gif → src/admin/dialog/img/zip.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 381B Width: 16  |  Height: 16  |  Size: 381B

+ 228
- 0
src/admin/dialog/select_images.php View File

@@ -0,0 +1,228 @@
<?php
/**
* 图片选择框
*
* @version $Id: select_images.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
include(DEDEDATA.'/mark/inc_photowatermark_config.php');
if (empty($activepath)) {
$activepath = '';
}
if (empty($imgstick)) {
$imgstick = '';
}
$noeditor = isset($noeditor) ? $noeditor : '';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_medias_dir)) {
$activepath = $cfg_medias_dir;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = '..'.$activepath;
if (empty($f)) {
$f = 'form1.picname';
}
$f = RemoveXSS($f);
if (empty($v)) {
$v = 'picview';
}
if (empty($comeback)) {
$comeback = '';
}
$addparm = '';
if (!empty($CKEditor)) {
$addparm = '&CKEditor='.$CKEditor;
$f = $CKEditor;
}
if (!empty($CKEditorFuncNum)) {
$addparm .= '&CKEditorFuncNum='.$CKEditorFuncNum;
}
if (!empty($noeditor)) {
$addparm .= '&noeditor=yes';
}
?>
<html>
<head>
<meta charset="<?php echo $cfg_soft_lang; ?>">
<title>图片浏览器</title>
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/base.css">
<style>
html{background:#f2f2f2}
body{margin:0;line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
.napisdiv{left:40;top:10;width:150px;height:100px;position:absolute;z-index:3;display:none}
</style>
<script>
function nullLink() {
return;
}
function ChangeImage(surl) {
document.getElementById('picview').src = surl;
}
</script>
</head>
<body class="bg">
<div id="floater" class="napisdiv">
<a href="javascript:nullLink();" onClick="document.getElementById('floater').style.display='none';"><img src="img/picviewnone.gif" id="picview" alt="关闭预览"></a>
</div>
<script src="../js/float.js"></script>
<script>
function nullLink() {
return;
}
function ChangeImage(surl) {
document.getElementById('floater').style.display = 'block';
document.getElementById('picview').src = surl;
}
function TNav() {
if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE';
else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF';
else return "OT";
}
//获取地址参数
function getUrlParam(paramName) {
var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
var match = window.location.search.match(reParam);
return (match && match.length > 1) ? match[1] : '';
}
function ReturnImg(reimg) {
var funcNum = getUrlParam('CKEditorFuncNum');
if (funcNum > 1) {
var fileUrl = reimg;
window.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl);
}
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
if (window.opener.document.getElementById('div<?php echo $v ?>')) {
if (TNav() == 'IE') {
//window.opener.document.getElementById('div<?php echo $v ?>').filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = reimg;
window.opener.document.getElementById('div<?php echo $v ?>').src = reimg;
window.opener.document.getElementById('div<?php echo $v ?>').style.width = '150px';
window.opener.document.getElementById('div<?php echo $v ?>').style.height = '100px';
} else
window.opener.document.getElementById('div<?php echo $v ?>').style.backgroundImage = "url(" + reimg + ")";
} else if (window.opener.document.getElementById('<?php echo $v ?>')) {
window.opener.document.getElementById('<?php echo $v ?>').src = reimg;
}
//适配新的缩略图
if (window.opener.document.getElementById('litPic')) {
window.opener.document.getElementById('litPic').src = reimg;
}
if (document.all) window.opener = true;
}
window.close();
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center" class="table table-borderless">
<tr>
<td colspan="4" height="30">
<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">
上传:<input type="file" name="imgfile" style="width:160px;border:none">
<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" name="iwidth" value="<?php echo $cfg_ddimg_width ?>" style="width:46px">
高:<input type="text" name="iheight" value="<?php echo $cfg_ddimg_height ?>" style="width:46px">
<button type="submit" name="sb1" class="btn btn-success btn-sm">确定</button>
</form>
</td>
</tr>
<tr>
<td width="10%" class="linerow">预览</td>
<td width="40%" class="linerow">选择图片</td>
<td width="20%" class="linerow">文件大小</td>
<td width="30%" class="linerow">修改时间</td>
</tr>
<tr>
<td class="linerow" colspan="4">点击图片预览,点击图片名选择图片,显示图片后点击该图片关闭预览。</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", $filetime);
}
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<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'>上级目录</a></td>
<td colspan='2' class='linerow'>当前目录:$activepath</td>
</tr>";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td 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'>$file</a></td>
<td class='linerow'></td>
<td class='linerow'></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(".$cfg_imgtype.")#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "<tr>
<td class='linerow'><a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif'></a></td>
<td class='linerow'><a href=# onclick=\"ReturnImg('$reurl');\" $lstyle><img src='img/gif.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "<tr>
<td class='linerow'><a href=\"#\" onClick=\"ChangeImage('$reurl');\"><img src='img/picviewnone.gif'></a></td>
<td class='linerow'><a href=# onclick=\"ReturnImg('$reurl');\" $lstyle><img src='img/jpg.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
</tr>
</table>
</body>
</html>

src/dede/dialog/select_images_post.php → src/admin/dialog/select_images_post.php View File

@@ -1,100 +1,91 @@
<?php
/**
* 图片选择
*
* @version $Id: select_images_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, 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");
if (empty($activepath)) {
$activepath = '';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_image_dir)) {
$activepath = $cfg_image_dir;
}
}
if (empty($imgfile)) {
$imgfile = '';
}
if (!is_uploaded_file($imgfile)) {
ShowMsg("您没有选择上传的文件!".$imgfile, "-1");
exit();
}
$CKEditorFuncNum = (isset($CKEditorFuncNum)) ? $CKEditorFuncNum : 1;
$imgfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $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");
$imgfile_type = strtolower(trim($imgfile_type));
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);
CloseFtp();
}
$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;
move_uploaded_file($imgfile, $fullfilename) or die("上传文件到 $fullfilename 失败");
@unlink($imgfile);
if (empty($resize)) {
$resize = 0;
}
if ($resize == 1) {
if (in_array($imgfile_type, $cfg_photo_typenames)) {
ImageResize($fullfilename, $iwidth, $iheight);
}
} else {
if (in_array($imgfile_type, $cfg_photo_typenames)) {
WaterImg($fullfilename, 'up');
}
}
$info = '';
$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()."'); ";
$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);
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());
}
exit();
<?php
/**
* 图片选择
*
* @version $Id: select_images_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, 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");
if (empty($activepath)) {
$activepath = '';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_image_dir)) {
$activepath = $cfg_image_dir;
}
}
if (empty($imgfile)) {
$imgfile = '';
}
if (!is_uploaded_file($imgfile)) {
ShowMsg("您没有选择上传的文件".$imgfile, "-1");
exit();
}
$CKEditorFuncNum = (isset($CKEditorFuncNum)) ? $CKEditorFuncNum : 1;
$imgfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $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");
$imgfile_type = strtolower(trim($imgfile_type));
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);
CloseFtp();
}
$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;
move_uploaded_file($imgfile, $fullfilename) or die("上传文件到 $fullfilename 失败");
@unlink($imgfile);
if (empty($resize)) {
$resize = 0;
}
if ($resize == 1) {
if (in_array($imgfile_type, $cfg_photo_typenames)) {
ImageResize($fullfilename, $iwidth, $iheight);
}
} else {
if (in_array($imgfile_type, $cfg_photo_typenames)) {
WaterImg($fullfilename, 'up');
}
}
$info = '';
$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()."'); ";
$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);
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());
}
exit();

+ 187
- 0
src/admin/dialog/select_media.php View File

@@ -0,0 +1,187 @@
<?php
/**
* 多媒体选择框
*
* @version $Id: select_media.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($activepath)) {
$activepath = '';
}
$noeditor = isset($noeditor) ? $noeditor : '';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_other_medias)) {
$activepath = $cfg_other_medias;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = '..'.$activepath;
if (!is_dir($inpath)) {
die('No Exsits Path');
}
if (empty($f)) {
$f = 'form1.enclosure';
}

if (empty($comeback)) {
$comeback = '';
}
$addparm = '';
if (!empty($CKEditor)) {
$addparm = '&CKEditor='.$CKEditor;
}
if (!empty($CKEditorFuncNum)) {
$addparm .= '&CKEditorFuncNum='.$CKEditorFuncNum;
}
if (!empty($noeditor)) {
$addparm .= '&noeditor=yes';
}
?>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=<?php echo $cfg_soft_lang; ?>'>
<title>媒体文件管理器</title>
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/base.css">
<style>
html{background:#f2f2f2}
body{margin:0;line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
</style>
</head>
<body class="bg">
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
}
var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>;
if (window.opener.CKEDITOR != null && funcNum != 1) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
window.close();
}
</script>
<table width="100%" border="0" align="center" cellspacing="0" cellpadding="2" class="table table-borderless">
<tr>
<td colspan="3" height="30">
<form action="select_media_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">
<input type="hidden" name="CKEditorFuncNum" value="<?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>">
上传:<input type="file" name="uploadfile" style="width:160px;border:none">
<button type="submit" name="sb1" class="btn btn-success btn-sm">确定</button>
</form>
</td>
</tr>
<tr>
<td width="55%" align="center" class="linerow">点击名称选择文件</td>
<td width="15%" align="center" class="linerow">文件大小</td>
<td width="30%" align="center" class="linerow">最后修改时间</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", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr>
<td class='linerow'><a href='select_media.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='img/dir2.gif'>上级目录</a></td>
<td colspan='2' class='linerow'>当前目录:$activepath</td>
</tr>";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td class='linerow'><a href=select_media.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='img/dir.gif'>$file</a></td>
<td class='linerow'></td>
<td class='linerow'></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(swf|fly|fla|flv)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\"><img src='img/flash.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td align='center' class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(wmv|avi)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\"><img src='img/wmv.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow' align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(rm|rmvb)#i", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\"><img src='img/rm.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow' align='center'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(mp3|wma)#", $file)) {
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\"><img src='img/mp3.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow' align='center'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
</table>
</body>
</html>

src/dede/dialog/select_media_post.php → src/admin/dialog/select_media_post.php View File

@@ -1,27 +1,25 @@
<?php
/**
* 多媒体发送
*
* @version $Id: select_media_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
include_once(dirname(__FILE__).'/config.php');
$cfg_softtype = $cfg_mediatype."|mp4";
$cfg_soft_dir = $cfg_other_medias;
$bkurl = 'select_media.php';
$uploadmbtype = "多媒体文件类型";
if (empty($activepath)) {
$activepath = '';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_other_medias)) {
$activepath = $cfg_other_medias;
}
}
require_once(dirname(__FILE__)."/select_soft_post.php");
<?php
/**
* 多媒体发送
*
* @version $Id: select_media_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
include_once(dirname(__FILE__).'/config.php');
$cfg_softtype = $cfg_mediatype."|mp4";
$cfg_soft_dir = $cfg_other_medias;
$bkurl = 'select_media.php';
$uploadmbtype = "多媒体文件类型";

if (empty($activepath)) {
$activepath = '';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_other_medias)) {
$activepath = $cfg_other_medias;
}
}
require_once(dirname(__FILE__)."/select_soft_post.php");

src/dede/dialog/select_soft.php → src/admin/dialog/select_soft.php View File

@@ -1,175 +1,173 @@
<?php
/**
* 软件选择框
*
* @version $Id: select_soft.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($activepath)) {
$activepath = '';
}
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_soft_dir)) {
$activepath = $cfg_soft_dir;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = '..'.$activepath;
if (empty($f)) {
$f = 'form1.enclosure';
}
if (!is_dir($inpath)) {
die('No Exsits Path');
}
if (empty($comeback)) {
$comeback = '';
}
$addparm = '';
if (!empty($CKEditor)) {
$addparm = '&CKEditor='.$CKEditor;
}
if (!empty($CKEditorFuncNum)) {
$addparm .= '&CKEditorFuncNum='.$CKEditorFuncNum;
}
if (!empty($noeditor)) {
$addparm .= '&noeditor=yes';
}
?>
<html>
<head>
<meta charset="<?php echo $cfg_soft_lang; ?>">
<title>软件管理器</title>
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/base.css">
<style>
html{background:#f2f2f2}
body{margin:0;line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
</style>
</head>
<body class="bg">
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
}
var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>;
if (window.opener.CKEDITOR != null && funcNum != 1) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
if (window.opener.CKEDITOR.instances.<?php echo $f ?>) {
let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/img/addon.gif'>附件:${reimg}</a>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
}
window.close();
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center" class="table table-borderless">
<tr>
<td colspan="3" height="30">
<form action="select_soft_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">
&nbsp;上传:<input type="file" name="uploadfile" size="24" style="border:none">
&nbsp;
改名:<input type="text" name="newname" style="width:160px">
&nbsp;
<button type="submit" name="sb1" class="btn btn-success btn-sm">确定</button>
</form>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr height="28">
<td width="50%" class="linerow">选择文件</td>
<td width="20%" class="linerow">文件大小</td>
<td width="30%" class="linerow">修改时间</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", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "\n<tr height='26'>
<td class='linerow'><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='img/dir2.gif'>上级目录</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;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "\n<tr height='26'>
<td class='linerow'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='img/dir.gif'>$file</a></td>
<td class='linerow'></td>
<td class='linerow'></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "\n<tr height='26'>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/zip.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = '';
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "\n<tr height='26'>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/exe.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
</table>
</td>
</tr>
<tr>
<td colspan="3" height="30">点击选择的文件,红色字样的为刚上传的文件</td>
</tr>
</table>
</body>
<?php
/**
* 软件选择框
*
* @version $Id: select_soft.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($activepath)) {
$activepath = '';
}
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
if (strlen($activepath) < strlen($cfg_soft_dir)) {
$activepath = $cfg_soft_dir;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = '..'.$activepath;
if (empty($f)) {
$f = 'form1.enclosure';
}
if (!is_dir($inpath)) {
die('No Exsits Path');
}
if (empty($comeback)) {
$comeback = '';
}
$addparm = '';
if (!empty($CKEditor)) {
$addparm = '&CKEditor='.$CKEditor;
}
if (!empty($CKEditorFuncNum)) {
$addparm .= '&CKEditorFuncNum='.$CKEditorFuncNum;
}
if (!empty($noeditor)) {
$addparm .= '&noeditor=yes';
}
?>
<html>
<head>
<meta charset="<?php echo $cfg_soft_lang; ?>">
<title>软件管理器</title>
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/base.css">
<style>
html{background:#f2f2f2}
body{margin:0;line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
</style>
</head>
<body class="bg">
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
if (window.opener.document.<?php echo $f ?> != null) {
window.opener.document.<?php echo $f ?>.value = reimg;
}
var funcNum = <?php echo isset($CKEditorFuncNum) ? $CKEditorFuncNum : 1; ?>;
if (window.opener.CKEDITOR != null && funcNum != 1) {
window.opener.CKEDITOR.tools.callFunction(funcNum, reimg);
}
if (window.opener.CKEDITOR.instances.<?php echo $f ?>) {
let addonHTML = `<a href='${reimg}' target='_blank'><img src='<?php echo $cfg_cmspath ?>/static/img/addon.gif'>附件:${reimg}</a>`;
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML);
}
window.close();
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center" class="table table-borderless">
<tr>
<td colspan="3" height="30">
<form action="select_soft_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">
上传:<input type="file" name="uploadfile" size="24" style="border:none">
改名:<input type="text" name="newname" style="width:160px">
<button type="submit" name="sb1" class="btn btn-success btn-sm">确定</button>
</form>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr height="26">
<td width="45%" class="linerow">选择文件</td>
<td width="25%" class="linerow">文件大小</td>
<td width="30%" class="linerow">修改时间</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", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath);
$line = "<tr height='26'>
<td class='linerow'><a href='select_soft.php?f=$f&activepath=".urlencode($tmp).$addparm."'><img src='img/dir2.gif'>上级目录</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;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr height='26'>
<td class='linerow'><a href=select_soft.php?f=$f&activepath=".urlencode("$activepath/$file").$addparm."><img src='img/dir.gif'>$file</a></td>
<td class='linerow'></td>
<td class='linerow'></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(zip|rar|tgr.gz)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "<tr height='26'>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/zip.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = '';
$reurl = "$activeurl/$file";
$reurl = preg_replace("#^\.\.#", "", $reurl);
$reurl = $reurl;
$line = "<tr height='26'>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/exe.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
</table>
</td>
</tr>
<tr>
<td colspan="3" height="30">点击选择的文件,红色字样的为刚上传的文件。</td>
</tr>
</table>
</body>
</html>

src/dede/dialog/select_soft_post.php → src/admin/dialog/select_soft_post.php View File

@@ -1,104 +1,91 @@
<?php
/**
* 软件发送
*
* @version $Id: select_soft_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
if (!isset($cfg_basedir)) {
include_once(dirname(__FILE__).'/config.php');
}
if (empty($uploadfile)) $uploadfile = '';
if (empty($uploadmbtype)) $uploadmbtype = '软件类型';
if (empty($bkurl)) $bkurl = 'select_soft.php';
$CKEditorFuncNum = (isset($CKEditorFuncNum)) ? $CKEditorFuncNum : 1;
$newname = (empty($newname) ? '' : preg_replace("#[\\ \"\*\?\t\r\n<>':\/|]#", "", $newname));
$uploadfile = isset($imgfile) && empty($uploadfile) ? $imgfile : $uploadfile;
$uploadfile_name = isset($imgfile_name) && empty($uploadfile_name) ? $imgfile_name : $uploadfile_name;
if (!is_uploaded_file($uploadfile)) {
ShowMsg("您没有选择上传的文件或选择的文件大小超出限制!", "-1");
exit();
}
//软件类型所有支持的附件
$cfg_softtype = $cfg_softtype;
$cfg_softtype = str_replace('||', '|', $cfg_softtype);
$uploadfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $uploadfile_name));
if (!preg_match("#\.(".$cfg_softtype.")#i", $uploadfile_name)) {
ShowMsg("您所上传的{$uploadmbtype}不在许可列表,请更改系统对扩展名限定的配置", "-1");
exit();
}
$nowtme = time();
if ($activepath == $cfg_soft_dir) {
$newdir = MyDate($cfg_addon_savetype, $nowtme);
$activepath = $activepath.'/'.$newdir;
if (!is_dir($cfg_basedir.$activepath)) {
MkdirAll($cfg_basedir.$activepath, $cfg_dir_purview);
CloseFtp();
}
}
//文件名(前为手工指定, 后者自动处理)
if (!empty($newname)) {
$filename = $newname;
if (!preg_match("#\.#", $filename)) $fs = explode('.', $uploadfile_name);
else $fs = explode('.', $filename);
if (preg_match("#".$cfg_not_allowall."#", $fs[count($fs) - 1])) {
ShowMsg("您指定的文件名被系统禁止", 'javascript:;');
exit();
}
if (!preg_match("#\.#", $filename)) $filename = $filename.'.'.$fs[count($fs) - 1];
} else {
$filename = $cuserLogin->getUserID().'-'.dd2char(MyDate('ymdHis', $nowtme));
$fs = explode('.', $uploadfile_name);
if (preg_match("#".$cfg_not_allowall."#", $fs[count($fs) - 1])) {
ShowMsg("您上传了某些可能存在不安全因素的文件,系统拒绝操作", 'javascript:;');
exit();
}
$filename = $filename.'.'.$fs[count($fs) - 1];
}
$fullfilename = $cfg_basedir.$activepath.'/'.$filename;
$fullfileurl = $activepath.'/'.$filename;
move_uploaded_file($uploadfile, $fullfilename) or die("上传文件到 $fullfilename 失败");
@unlink($uploadfile);
if ($uploadfile_type == 'application/x-shockwave-flash') {
$mediatype = 2;
} else if (preg_match('#image#i', $uploadfile_type)) {
$mediatype = 1;
} else if (preg_match('#audio|media|video#i', $uploadfile_type)) {
$mediatype = 3;
} else {
$mediatype = 4;
}
$inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('0','$filename','$fullfileurl','$mediatype','0','0','0','{$uploadfile_size}','{$nowtme}','".$cuserLogin->getUserID()."'); ";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $fullfileurl);
if ($ck == 1) {
$funcNum = isset($_GET['CKEditorFuncNum']) ? $_GET['CKEditorFuncNum'] : 1;
$url = $fullfileurl;
$arr = array(
"uploaded" => 1,
"fileName" => $filename,
"url" => $url,
);
echo json_encode($arr);
} else {
ShowMsg("成功上传文件", $bkurl."?comeback=".urlencode($filename)."&f=$f&CKEditorFuncNum=$CKEditorFuncNum&activepath=".urlencode($activepath)."&d=".time());
exit();
}
<?php
/**
* 软件发送
*
* @version $Id: select_soft_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
if (!isset($cfg_basedir)) {
include_once(dirname(__FILE__).'/config.php');
}
if (empty($uploadfile)) $uploadfile = '';
if (empty($uploadmbtype)) $uploadmbtype = '软件类型';
if (empty($bkurl)) $bkurl = 'select_soft.php';
$CKEditorFuncNum = (isset($CKEditorFuncNum)) ? $CKEditorFuncNum : 1;
$newname = (empty($newname) ? '' : preg_replace("#[\\ \"\*\?\t\r\n<>':\/|]#", "", $newname));
$uploadfile = isset($imgfile) && empty($uploadfile) ? $imgfile : $uploadfile;
$uploadfile_name = isset($imgfile_name) && empty($uploadfile_name) ? $imgfile_name : $uploadfile_name;
if (!is_uploaded_file($uploadfile)) {
ShowMsg("您没有选择上传的文件或选择的文件大小超出限制!", "-1");
exit();
}
//软件类型所有支持的附件
$cfg_softtype = $cfg_softtype;
$cfg_softtype = str_replace('||', '|', $cfg_softtype);
$uploadfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $uploadfile_name));
if (!preg_match("#\.(".$cfg_softtype.")#i", $uploadfile_name)) {
ShowMsg("您所上传的{$uploadmbtype}不在许可列表,请修改系统对扩展名限定的配置", "-1");
exit();
}
$nowtme = time();
if ($activepath == $cfg_soft_dir) {
$newdir = MyDate($cfg_addon_savetype, $nowtme);
$activepath = $activepath.'/'.$newdir;
if (!is_dir($cfg_basedir.$activepath)) {
MkdirAll($cfg_basedir.$activepath, $cfg_dir_purview);
CloseFtp();
}
}
//文件名(前为手工指定, 后者自动处理)
if (!empty($newname)) {
$filename = $newname;
if (!preg_match("#\.#", $filename)) $fs = explode('.', $uploadfile_name);
else $fs = explode('.', $filename);
if (preg_match("#".$cfg_not_allowall."#", $fs[count($fs) - 1])) {
ShowMsg("您指定的文件名被系统禁止", 'javascript:;');
exit();
}
if (!preg_match("#\.#", $filename)) $filename = $filename.'.'.$fs[count($fs) - 1];
} else {
$filename = $cuserLogin->getUserID().'-'.dd2char(MyDate('ymdHis', $nowtme));
$fs = explode('.', $uploadfile_name);
if (preg_match("#".$cfg_not_allowall."#", $fs[count($fs) - 1])) {
ShowMsg("您上传了某些可能存在不安全因素的文件,系统拒绝操作", "-1");
exit();
}
$filename = $filename.'.'.$fs[count($fs) - 1];
}
$fullfilename = $cfg_basedir.$activepath.'/'.$filename;
$fullfileurl = $activepath.'/'.$filename;
move_uploaded_file($uploadfile, $fullfilename) or die("上传文件到 $fullfilename 失败");
@unlink($uploadfile);
if ($uploadfile_type == 'application/x-shockwave-flash') {
$mediatype = 2;
} else if (preg_match('#image#i', $uploadfile_type)) {
$mediatype = 1;
} else if (preg_match('#audio|media|video#i', $uploadfile_type)) {
$mediatype = 3;
} else {
$mediatype = 4;
}
$inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('0','$filename','$fullfileurl','$mediatype','0','0','0','{$uploadfile_size}','{$nowtme}','".$cuserLogin->getUserID()."'); ";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $fullfileurl);
if ($ck == 1) {
$funcNum = isset($_GET['CKEditorFuncNum']) ? $_GET['CKEditorFuncNum'] : 1;
$url = $fullfileurl;
$arr = array(
"uploaded" => 1,
"fileName" => $filename,
"url" => $url,
);
echo json_encode($arr);
} else {
ShowMsg("成功上传文件", $bkurl."?comeback=".urlencode($filename)."&f=$f&CKEditorFuncNum=$CKEditorFuncNum&activepath=".urlencode($activepath)."&d=".time());
exit();
}

src/dede/dialog/select_templets.php → src/admin/dialog/select_templets.php View File

@@ -1,201 +1,195 @@
<?php
/**
* 模板选择框
*
* @version $Id: select_templets.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($activepath)) {
$activepath = '';
}
$cfg_txttype = 'htm|html|tpl|txt|dtp';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
$templetdir = $cfg_templets_dir;
if (strlen($activepath) < strlen($templetdir)) {
$activepath = $templetdir;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = '..'.$activepath;
if (!is_dir($inpath)) {
die('No Exsits Path');
}
if (empty($f)) {
$f = 'form1.enclosure';
}
if (empty($comeback)) {
$comeback = '';
}
?>
<html>
<head>
<meta charset="<?php echo $cfg_soft_lang; ?>">
<title>模板管理器</title>
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/base.css">
<style>
html{background:#f2f2f2}
body{margin:0;line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
</style>
</head>
<body class="bg">
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
window.opener.document.<?php echo $f ?>.value = reimg;
if (document.all) window.opener = true;
window.close();
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center" class="table table-borderless">
<tr>
<td width="50%" class="linerow">选择文件</td>
<td width="20%" class="linerow">文件大小</td>
<td width="30%" class="linerow">修改时间</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", $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'>上级目录</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;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "\n<tr>
<td class='linerow'><a href=select_templets.php?f=$f&activepath=".urlencode("$activepath/$file")."><img src='img/dir.gif'>$file</a></td>
<td class='linerow'></td>
<td class='linerow'></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(htm|html)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "\n<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/htm.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(css)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."/#", "", $reurl);
$line = "\n<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/css.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(js)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "\n<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/js.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "\n<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/jpg.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(gif|png)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "\n<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/gif.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(txt)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "\n<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/txt.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td></tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
<tr>
<td colspan="3">
<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>
上传:<input type="file" name="uploadfile" style="width:260px;border:none">
改名:<input type="text" name="filename" style="width:160px">
<button type="submit" name="sb1" class="btn btn-success btn-sm">确定</button>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
<?php
/**
* 模板选择框
*
* @version $Id: select_templets.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
if (empty($activepath)) {
$activepath = '';
}
$cfg_txttype = 'htm|html|tpl|txt|dtp';
$activepath = str_replace('.', '', $activepath);
$activepath = preg_replace("#\/{1,}#", '/', $activepath);
$templetdir = $cfg_templets_dir;
if (strlen($activepath) < strlen($templetdir)) {
$activepath = $templetdir;
}
$inpath = $cfg_basedir.$activepath;
$activeurl = '..'.$activepath;
if (!is_dir($inpath)) {
die('No Exsits Path');
}
if (empty($f)) {
$f = 'form1.enclosure';
}
if (empty($comeback)) {
$comeback = '';
}
?>
<html>
<head>
<meta charset="<?php echo $cfg_soft_lang; ?>">
<title>模板管理器</title>
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/base.css">
<style>
html{background:#f2f2f2}
body{margin:0;line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
</style>
</head>
<body class="bg">
<script>
function nullLink() {
return;
}
function ReturnValue(reimg) {
window.opener.document.<?php echo $f ?>.value = reimg;
if (document.all) window.opener = true;
window.close();
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="1" align="center" class="table table-borderless">
<tr>
<td colspan="3" height="30">
<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">
上传:<input type="file" name="uploadfile" style="width:260px;border:none">
改名:<input type="text" name="filename" style="width:160px">
<button type="submit" name="sb1" class="btn btn-success btn-sm">确定</button>
</form>
</td>
</tr>
<tr>
<td width="50%" class="linerow">选择文件</td>
<td width="20%" class="linerow">文件大小</td>
<td width="30%" class="linerow">修改时间</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", $filetime);
}
//判断文件类型并作处理
if ($file == ".") continue;
else if ($file == "..") {
if ($activepath == "") continue;
$tmp = preg_replace("#[\/][^\/]*$#", "", $activepath);
$line = "<tr>
<td class='linerow'><a href='select_templets.php?f=$f&activepath=".urlencode($tmp)."'><img src='img/dir2.gif'>上级目录</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;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "<tr>
<td class='linerow'><a href=select_templets.php?f=$f&activepath=".urlencode("$activepath/$file")."><img src='img/dir.gif'>$file</a></td>
<td class='linerow'></td>
<td class='linerow'></td>
</tr>";
echo "$line";
} else if (preg_match("#\.(htm|html)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/htm.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(css)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."/#", "", $reurl);
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/css.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(js)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/js.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(jpg)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/jpg.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(gif|png)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/gif.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td>
</tr>";
echo "$line";
} else if (preg_match("#\.(txt)#i", $file)) {
if ($file == $comeback) $lstyle = " style='color:red' ";
else $lstyle = "";
$reurl = "$activeurl/$file";
$reurl = preg_replace("#\.\.#", "", $reurl);
$reurl = preg_replace("#".$templetdir."\/#", "", $reurl);
$line = "<tr>
<td class='linerow'><a href=\"javascript:ReturnValue('$reurl');\" $lstyle><img src='img/txt.gif'>$file</a></td>
<td class='linerow'>$filesize KB</td>
<td class='linerow'>$filetime</td></tr>";
echo "$line";
}
}//End Loop
$dh->close();
?>
</table>
</body>
</html>

src/dede/dialog/select_templets_post.php → src/admin/dialog/select_templets_post.php View File

@@ -1,44 +1,42 @@
<?php
/**
* 模板发送
*
* @version $Id: select_templets_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
$cfg_txttype = "htm|html|tpl|txt";
if (empty($uploadfile)) {
$uploadfile = "";
}
if (!is_uploaded_file($uploadfile)) {
ShowMsg("您没有选择上传的文件!", "-1");
exit();
}
if (!preg_match("#^text#", $uploadfile_type)) {
ShowMsg("您上传的不是文本类型附件!", "-1");
exit();
}
if (!preg_match("#\.(".$cfg_txttype.")#i", $uploadfile_name)) {
ShowMsg("您所上传的模板文件类型不能被识别,只允许htm、html、tpl、txt扩展名", "-1");
exit();
}
if ($filename != '') {
$filename = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $filename));
} 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");
exit();
}
}
$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();
<?php
/**
* 模板发送
*
* @version $Id: select_templets_post.php 1 9:43 2010年7月8日Z tianya $
* @package DedeBIZ.Dialog
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
$cfg_txttype = "htm|html|tpl|txt";
if (empty($uploadfile)) {
$uploadfile = "";
}
if (!is_uploaded_file($uploadfile)) {
ShowMsg("您没有选择上传的文件!", "-1");
exit();
}
if (!preg_match("#^text#", $uploadfile_type)) {
ShowMsg("您上传的不是文本类型附件!", "-1");
exit();
}
if (!preg_match("#\.(".$cfg_txttype.")#i", $uploadfile_name)) {
ShowMsg("您所上传的模板文件类型不能被识别,只允许htm、html、tpl、txt扩展名", "-1");
exit();
}
if ($filename != '') {
$filename = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $filename));
} 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");
exit();
}
}
$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();

src/dede/diy_add.php → src/admin/diy_add.php View File

@@ -1,64 +1,63 @@
<?php
/**
* 增加自定义表单
*
* @version $Id: diy_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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)) {
$row = $dsql->GetOne("SELECT diyid FROM #@__diyforms ORDER BY diyid DESC LIMIT 0,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");
exit();
}
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");
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]) {
showmsg('指定的表在数据库中重复', '-1');
exit();
}
}
$sql = "CREATE TABLE IF NOT EXISTS `$table`(
`id` int(10) unsigned NOT NULL auto_increment,
`ifcheck` tinyint(1) NOT NULL default '0',
";
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."; ";
}
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 {
showmsg('自定义表单创建失败', '-1');
}
}
<?php
/**
* 增加自定义表单
*
* @version $Id: diy_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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)) {
$row = $dsql->GetOne("SELECT diyid FROM #@__diyforms ORDER BY diyid DESC LIMIT 0,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("<span style='color:#e74d58'>'自定义表单diyid'</span>必须为数字", "-1");
exit();
}
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");
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]) {
showmsg('指定的表在数据库中重复', '-1');
exit();
}
}
$sql = "CREATE TABLE IF NOT EXISTS `$table`(
`id` int(10) unsigned NOT NULL auto_increment,
`ifcheck` tinyint(1) NOT NULL default '0',
";
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."; ";
}
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 {
showmsg('自定义表单创建失败', '-1');
}
}

src/dede/diy_edit.php → src/admin/diy_edit.php View File

@@ -1,76 +1,75 @@
<?php
/**
* 编辑自定义表单
*
* @version $Id: diy_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('c_Edit');
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEINC."/oxwindow.class.php");
if (empty($dopost)) $dopost = "";
$diyid = (empty($diyid) ? 0 : intval($diyid));
/*----------------
function __SaveEdit()
-----------------*/
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");
exit();
}
/*----------------
function __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 ($job == "") {
$wintitle = "自定义表单管理-删除自定义表单";
$wecome_info = "<a href='diy_main.php'>自定义表单管理</a>::删除自定义表单";
$win = new OxWindow();
$win->Init("diy_edit.php", "js/blank.js", "POST");
$win->AddHidden("job", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("diyid", $diyid);
$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");
exit();
}
//删除表
$dsql->ExecuteNoneQuery("DROP TABLE IF EXISTS `{$row['table']}`;");
//删除频道配置信息
$dsql->ExecuteNoneQuery("DELETE FROM `#@__diyforms` WHERE diyid='$diyid'");
ShowMsg("成功删除一个自定义表单", "diy_main.php");
exit();
}
}
/*----------------
function edit()
-----------------*/
$row = $dsql->GetOne("Select * From #@__diyforms where diyid='$diyid'");
include DEDEADMIN."/templets/diy_edit.htm";
<?php
/**
* 编辑自定义表单
*
* @version $Id: diy_add.php 1 14:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
CheckPurview('c_Edit');
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEINC."/oxwindow.class.php");

if (empty($dopost)) $dopost = "";
$diyid = (empty($diyid) ? 0 : intval($diyid));

/*----------------
function __SaveEdit()
-----------------*/
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");
exit();
}
/*----------------
function __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 ($job == "") {
$wintitle = "自定义表单管理-删除自定义表单";
$wecome_info = "<a href='diy_main.php'>自定义表单管理</a>::删除自定义表单";
$win = new OxWindow();
$win->Init("diy_edit.php", "js/blank.js", "POST");
$win->AddHidden("job", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("diyid", $diyid);
$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");
exit();
}

//删除表
$dsql->ExecuteNoneQuery("DROP TABLE IF EXISTS `{$row['table']}`;");

//删除频道配置信息
$dsql->ExecuteNoneQuery("DELETE FROM `#@__diyforms` WHERE diyid='$diyid'");
ShowMsg("成功删除一个自定义表单", "diy_main.php");
exit();
}
}

/*----------------
function edit()
-----------------*/
$row = $dsql->GetOne("Select * From #@__diyforms where diyid='$diyid'");
include DEDEADMIN."/templets/diy_edit.htm";

src/dede/diy_field_add.php → src/admin/diy_field_add.php View File

@@ -1,109 +1,108 @@
<?php
/**
* 增加自定义表单字段
*
* @version $Id: diy_field_add.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.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];
/*----------------------
function 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");
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field", "<", ">");
$dtp->LoadSource($fieldset);
$trueTable = $row['table'];
//修改字段配置信息
$dfvalue = trim($vdefault);
$isnull = ($isnull == 1 ? "true" : "false");
$mxlen = $maxlength;
//检测被修改的字段类型
$fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen);
$ntabsql = $fieldinfos[0];
$buideType = $fieldinfos[1];
$rs = $dsql->ExecuteNoneQuery(" ALTER TABLE `$trueTable` ADD $ntabsql ");
if (!$rs) {
$gerr = $dsql->GetError();
ShowMsg("增加字段失败,错误提示为:".$gerr, "javascript:;");
exit();
}
$ok = FALSE;
//检测旧配置信息,并替换为新配置
if (is_array($dtp->CTags)) {
//遍历旧配置
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 = $fieldset."\n".stripslashes($fieldstring);
}
$addlist = GetAddFieldList($dtp, $oksetting);
$oksetting = addslashes($oksetting);
$rs = $dsql->ExecuteNoneQuery("Update #@__diyforms set `info`='$oksetting' where diyid='$diyid' ");
if (!$rs) {
$grr = $dsql->GetError();
ShowMsg("保存节点配置出错".$grr, "javascript:;");
exit();
}
ShowMsg("成功增加一个字段", "diy_edit.php?diyid=$diyid");
exit();
}
//检测模型相关信息,并初始化相关数据
/*----------------------
function ShowPage()
---------------------*/
$row = $dsql->GetOne("SELECT `table` FROM #@__diyforms WHERE diyid='$diyid'");
$trueTable = $row['table'];
$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) {
$tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; ";
} else {
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
}
$dsql->ExecuteNoneQuery($tabsql);
//检测附加表里含有的字段
$fields = array();
$rs = $dsql->SetQuery("show fields from `$trueTable`");
$dsql->Execute('a');
while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) {
$fields[strtolower($nrow['Field'])] = 1;
}
$f = '';
foreach ($fields as $k => $v) {
$f .= ($f == '' ? $k : ' '.$k);
}
require_once(DEDEADMIN."/templets/diy_field_add.htm");
<?php
/**
* 增加自定义表单字段
*
* @version $Id: diy_field_add.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.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];
/*----------------------
function 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");
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field", "<", ">");
$dtp->LoadSource($fieldset);
$trueTable = $row['table'];

//修改字段配置信息
$dfvalue = trim($vdefault);
$isnull = ($isnull == 1 ? "true" : "false");
$mxlen = $maxlength;

//检测被修改的字段类型
$fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen);
$ntabsql = $fieldinfos[0];
$buideType = $fieldinfos[1];

$rs = $dsql->ExecuteNoneQuery(" ALTER TABLE `$trueTable` ADD $ntabsql ");

if (!$rs) {
$gerr = $dsql->GetError();
ShowMsg("增加字段失败,错误提示为:".$gerr, "javascript:;");
exit();
}
$ok = FALSE;

//检测旧配置信息,并替换为新配置
if (is_array($dtp->CTags)) {
//遍历旧配置
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 = $fieldset."\n".stripslashes($fieldstring);
}
$addlist = GetAddFieldList($dtp, $oksetting);
$oksetting = addslashes($oksetting);
$rs = $dsql->ExecuteNoneQuery("Update #@__diyforms set `info`='$oksetting' where diyid='$diyid' ");
if (!$rs) {
$grr = $dsql->GetError();
ShowMsg("保存节点配置出错".$grr, "javascript:;");
exit();
}
ShowMsg("成功增加一个字段", "diy_edit.php?diyid=$diyid");
exit();
}

//检测模型相关信息,并初始化相关数据
/*----------------------
function ShowPage()
---------------------*/
$row = $dsql->GetOne("SELECT `table` FROM #@__diyforms WHERE diyid='$diyid'");
$trueTable = $row['table'];
$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) {
$tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; ";
} else {
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
}
$dsql->ExecuteNoneQuery($tabsql);

//检测附加表里含有的字段
$fields = array();
$rs = $dsql->SetQuery("show fields from `$trueTable`");
$dsql->Execute('a');
while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) {
$fields[strtolower($nrow['Field'])] = 1;
}
$f = '';
foreach ($fields as $k => $v) {
$f .= ($f == '' ? $k : ' '.$k);
}
require_once(DEDEADMIN."/templets/diy_field_add.htm");

src/dede/diy_field_edit.php → src/admin/diy_field_edit.php View File

@@ -1,123 +1,122 @@
<?php
/**
* 编辑自定义表单字段
*
* @version $Id: diy_field_edit.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");
//增加权限检查
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];
$row = $dsql->GetOne("SELECT `table`,`info` FROM #@__diyforms WHERE diyid='$diyid'");
$fieldset = $row['info'];
$trueTable = $row['table'];
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field", "<", ">");
$dtp->LoadSource($fieldset);
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));
$fieldtypes[$dds[0]] = $dds[1];
}
//保存更改
/*--------------------
function _SAVE()
----------------------*/
if ($action == 'save') {
if (!isset($fieldtypes[$dtype])) {
ShowMsg("您修改的是系统专用类型的数据,禁止操作", "-1");
exit();
}
//检测数据库是否存在附加表,不存在则新建一个
$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) {
$tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; ";
} else {
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
}
$dsql->ExecuteNoneQuery($tabsql);
//检测表里含有的字段
$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'];
}
//修改字段配置信息
$dfvalue = $vdefault;
$isnull = ($isnull == 1 ? "true" : "false");
$mxlen = $maxlength;
$fieldname = strtolower($fname);
//检测被修改的字段类型,并更新数据表
$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()))) {
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;
$dsql->ExecuteNoneQuery($tabsql);
} else {
$tabsql = '';
}
$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}");
exit();
}
/*------------------
删除字段
function _DELETE()
-------------------*/ else if ($action == "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");
exit();
}
require_once(DEDEADMIN."/templets/diy_field_edit.htm");
<?php
/**
* 编辑自定义表单字段
*
* @version $Id: diy_field_edit.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__)."/config.php");

//增加权限检查

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];
$row = $dsql->GetOne("SELECT `table`,`info` FROM #@__diyforms WHERE diyid='$diyid'");
$fieldset = $row['info'];
$trueTable = $row['table'];
$dtp = new DedeTagParse();
$dtp->SetNameSpace("field", "<", ">");
$dtp->LoadSource($fieldset);
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));
$fieldtypes[$dds[0]] = $dds[1];
}

//保存修改
/*--------------------
function _SAVE()
----------------------*/
if ($action == 'save') {

if (!isset($fieldtypes[$dtype])) {
ShowMsg("您修改的是系统专用类型的数据,禁止操作", "-1");
exit();
}

//检测数据库是否存在附加表,不存在则新建一个
$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) {
$tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; ";
} else {
$tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; ";
}
$dsql->ExecuteNoneQuery($tabsql);

//检测表里含有的字段
$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'];
}

//修改字段配置信息
$dfvalue = $vdefault;
$isnull = ($isnull == 1 ? "true" : "false");
$mxlen = $maxlength;
$fieldname = strtolower($fname);

//检测被修改的字段类型,并更新数据表
$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()))) {

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;
$dsql->ExecuteNoneQuery($tabsql);
} else {
$tabsql = '';
}
$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}");
exit();
}
/*------------------
删除字段
function _DELETE()
-------------------*/ else if ($action == "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");
exit();
}
require_once(DEDEADMIN."/templets/diy_field_edit.htm");

src/dede/diy_list.php → src/admin/diy_list.php View File

@@ -1,204 +1,204 @@
<?php
/**
* 自定义表单列表
*
* @version $Id: diy_list.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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','excel')) ? $action : '';
if (empty($diyid)) {
showMsg("非法操作!", 'javascript:;');
exit();
}
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) {
$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)) {
showMsg("数据校验不对,程序返回", '-1');
exit();
}
}
$diyform = $dsql->getOne("SELECT * FROM #@__diyforms WHERE diyid=$diyid");
if (!is_array($diyform)) {
showmsg("自定义表单不存在", '-1');
exit();
}
$addvar = $addvalue = '';
if (!empty($dede_fields)) {
$fieldarr = explode(';', $dede_fields);
if (is_array($fieldarr)) {
foreach ($fieldarr as $field) {
if ($field == '') {
continue;
}
$fieldinfo = explode(',', $field);
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');
}
$addvar .= ', `'.$fieldinfo[0].'`';
$addvalue .= ", '".${$fieldinfo[0]}."'";
}
}
}
$query = "INSERT INTO `{$diy->table}` (`id`, `ifcheck` $addvar) VALUES (NULL, 0 $addvalue)";
if ($dsql->ExecuteNoneQuery($query)) {
$goto = "diy_list.php?action=list&diyid={$diy->diyid}";
showmsg('发布成功', $goto);
} else {
showmsg('对不起,发布不成功', '-1');
}
}
} 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->SetSource($query);
$fieldlist = $diy->getFieldList();
$datalist->Display();
} else if ($action == 'edit') {
if (empty($do)) {
$id = isset($id) && is_numeric($id) ? $id : 0;
if (empty($id)) {
showMsg('非法操作未指定id', 'javascript:;');
exit();
}
$query = "SELECT * FROM {$diy->table} WHERE id=$id";
$row = $dsql->GetOne($query);
if (!is_array($row)) {
showmsg("您访问的记录不存在或未经审核", '-1');
exit();
}
$postform = $diy->getForm('edit', $row, 'admin');
$fieldlist = $diy->getFieldList();
$c1 = $row['ifcheck'] == 1 ? 'checked' : '';
$c2 = $row['ifcheck'] == 0 ? 'checked' : '';
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)) {
showmsg("自定义表单不存在", '-1');
exit();
}
$addsql = '';
if (!empty($dede_fields)) {
$fieldarr = explode(';', $dede_fields);
if (is_array($fieldarr)) {
foreach ($fieldarr as $field) {
if ($field == '') {
continue;
}
$fieldinfo = explode(',', $field);
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]} = empty(${$fieldinfo[0]}) ? $diyco[$fieldinfo[0]] : ${$fieldinfo[0]};
} else {
${$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]}."'";
}
}
}
$query = "UPDATE `$diy->table` SET $addsql WHERE id=$id";
if ($dsql->ExecuteNoneQuery($query)) {
$goto = "diy_list.php?action=list&diyid={$diy->diyid}";
showmsg('编辑成功', $goto);
} else {
showmsg('编辑成功', '-1');
}
}
} elseif ($action == 'check') {
if (is_array($id)) {
$ids = implode(',', $id);
} else {
showmsg('未选中要操作的内容', '-1');
exit();
}
$query = "UPDATE `$diy->table` SET ifcheck=1 WHERE id IN ($ids)";
if ($dsql->ExecuteNoneQuery($query)) {
showmsg('审核成功', "diy_list.php?action=list&diyid={$diy->diyid}");
} else {
showmsg('审核失败', "diy_list.php?action=list&diyid={$diy->diyid}");
}
} elseif ($action == 'delete') {
if (empty($do)) {
if (is_array($id)) {
$ids = implode(',', $id);
} else {
showmsg('未选中要操作的内容', '-1');
exit();
}
$query = "DELETE FROM `$diy->table` WHERE id IN ($ids)";
if ($dsql->ExecuteNoneQuery($query)) {
showmsg('删除成功', "diy_list.php?action=list&diyid={$diy->diyid}");
} else {
showmsg('删除失败', "diy_list.php?action=list&diyid={$diy->diyid}");
}
} 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]);
$dsql->ExecuteNoneQuery("UPDATE `$diy->table` SET $name='' WHERE id='$id'");
showmsg('文件删除成功', "diy_list.php?action=list&diyid={$diy->diyid}");
} else {
showmsg('文件不存在', '-1');
}
}
}
elseif($action == 'excel') {
ob_end_clean();//清除缓冲区,避免乱码
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename={$diy->name}_".date("Y-m-d").".xls");
print(chr(0xEF).chr(0xBB).chr(0xBF));//清除bom
$fieldlist = $diy->getFieldList();
echo "<table><tr>";
foreach($fieldlist as $field=>$fielddata)
{
echo "<th>{$fielddata[0]}</th>";
}
echo "<th>状态</th>";
echo "</tr>";
$sql = "SELECT * FROM {$diy->table} ORDER BY id DESC";
$dsql->SetQuery($sql);
$dsql->Execute('t');
while($arr = $dsql->GetArray('t'))
{
echo "<tr>";
foreach($fieldlist as $key => $field)
{
echo "<td>".$arr[$key]."</td>";
}
$status = $arr['ifcheck'] == 1 ? '已审核' : '未审核';
echo "<td>".$status."</td>";
echo "</tr>";
}
echo "</table>";
} else {
showmsg('未定义操作', "-1");
<?php
/**
* 自定义表单列表
*
* @version $Id: diy_list.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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','excel')) ? $action : '';
if (empty($diyid)) {
showMsg("非法操作!", 'javascript:;');
exit();
}
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) {
$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)) {
showMsg("数据校验不对,程序返回", '-1');
exit();
}
}
$diyform = $dsql->getOne("SELECT * FROM #@__diyforms WHERE diyid=$diyid");
if (!is_array($diyform)) {
showmsg("自定义表单不存在", '-1');
exit();
}
$addvar = $addvalue = '';
if (!empty($dede_fields)) {
$fieldarr = explode(';', $dede_fields);
if (is_array($fieldarr)) {
foreach ($fieldarr as $field) {
if ($field == '') {
continue;
}
$fieldinfo = explode(',', $field);
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');
}
$addvar .= ', `'.$fieldinfo[0].'`';
$addvalue .= ", '".${$fieldinfo[0]}."'";
}
}
}
$query = "INSERT INTO `{$diy->table}` (`id`, `ifcheck` $addvar) VALUES (NULL, 0 $addvalue)";
if ($dsql->ExecuteNoneQuery($query)) {
$goto = "diy_list.php?action=list&diyid={$diy->diyid}";
showmsg('发布成功', $goto);
} else {
showmsg('对不起,发布不成功', '-1');
}
}
} 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->SetSource($query);
$fieldlist = $diy->getFieldList();
$datalist->Display();
} else if ($action == 'edit') {
if (empty($do)) {
$id = isset($id) && is_numeric($id) ? $id : 0;
if (empty($id)) {
showMsg('非法操作未指定id', 'javascript:;');
exit();
}
$query = "SELECT * FROM {$diy->table} WHERE id=$id";
$row = $dsql->GetOne($query);
if (!is_array($row)) {
showmsg("您访问的记录不存在或未经审核", '-1');
exit();
}
$postform = $diy->getForm('edit', $row, 'admin');
$fieldlist = $diy->getFieldList();
$c1 = $row['ifcheck'] == 1 ? 'checked' : '';
$c2 = $row['ifcheck'] == 0 ? 'checked' : '';
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)) {
showmsg("自定义表单不存在", '-1');
exit();
}
$addsql = '';
if (!empty($dede_fields)) {
$fieldarr = explode(';', $dede_fields);
if (is_array($fieldarr)) {
foreach ($fieldarr as $field) {
if ($field == '') {
continue;
}
$fieldinfo = explode(',', $field);
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]} = empty(${$fieldinfo[0]}) ? $diyco[$fieldinfo[0]] : ${$fieldinfo[0]};
} else {
${$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]}."'";
}
}
}
$query = "UPDATE `$diy->table` SET $addsql WHERE id=$id";
if ($dsql->ExecuteNoneQuery($query)) {
$goto = "diy_list.php?action=list&diyid={$diy->diyid}";
showmsg('编辑成功', $goto);
} else {
showmsg('编辑成功', '-1');
}
}
} elseif ($action == 'check') {
if (is_array($id)) {
$ids = implode(',', $id);
} else {
showmsg('未选中要操作的内容', '-1');
exit();
}
$query = "UPDATE `$diy->table` SET ifcheck=1 WHERE id IN ($ids)";
if ($dsql->ExecuteNoneQuery($query)) {
showmsg('审核成功', "diy_list.php?action=list&diyid={$diy->diyid}");
} else {
showmsg('审核失败', "diy_list.php?action=list&diyid={$diy->diyid}");
}
} elseif ($action == 'delete') {
if (empty($do)) {
if (is_array($id)) {
$ids = implode(',', $id);
} else {
showmsg('未选中要操作的内容', '-1');
exit();
}
$query = "DELETE FROM `$diy->table` WHERE id IN ($ids)";
if ($dsql->ExecuteNoneQuery($query)) {
showmsg('删除成功', "diy_list.php?action=list&diyid={$diy->diyid}");
} else {
showmsg('删除失败', "diy_list.php?action=list&diyid={$diy->diyid}");
}
} 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]);
$dsql->ExecuteNoneQuery("UPDATE `$diy->table` SET $name='' WHERE id='$id'");
showmsg('文件删除成功', "diy_list.php?action=list&diyid={$diy->diyid}");
} else {
showmsg('文件不存在', '-1');
}
}
}
elseif($action == 'excel') {
ob_end_clean();//清除缓冲区,避免乱码
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename={$diy->name}_".date("Y-m-d").".xls");
print(chr(0xEF).chr(0xBB).chr(0xBF));//清除bom
$fieldlist = $diy->getFieldList();
echo "<table><tr>";
foreach($fieldlist as $field=>$fielddata)
{
echo "<th>{$fielddata[0]}</th>";
}
echo "<th>状态</th>";
echo "</tr>";
$sql = "SELECT * FROM {$diy->table} ORDER BY id DESC";
$dsql->SetQuery($sql);
$dsql->Execute('t');
while($arr = $dsql->GetArray('t'))
{
echo "<tr>";
foreach($fieldlist as $key => $field)
{
echo "<td>".$arr[$key]."</td>";
}
$status = $arr['ifcheck'] == 1 ? '已审核' : '未审核';
echo "<td>".$status."</td>";
echo "</tr>";
}
echo "</table>";
} else {
showmsg('未定义操作', "-1");
}

src/dede/diy_main.php → src/admin/diy_main.php View File

@@ -1,22 +1,21 @@
<?php
/**
* 自定义表单列表管理
*
* @version $Id: diy_main.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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, "/");
$sql = "Select `diyid`,`name`,`table` From #@__diyforms order by diyid asc";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/diy_main.htm");
$dlist->SetSource($sql);
$dlist->display();
$dlist->Close();
<?php
/**
* 自定义表单列表管理
*
* @version $Id: diy_main.php 1 18:31 2010年7月12日Z tianya $
* @package DedeBIZ.Administrator
* @copyright Copyright (c) 2022, DedeBIZ.COM
* @license https://www.dedebiz.com/license
* @link https://www.dedebiz.com
*/
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, "/");
$sql = "Select `diyid`,`name`,`table` From #@__diyforms order by diyid asc";
$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/diy_main.htm");
$dlist->SetSource($sql);
$dlist->display();
$dlist->Close();

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

Loading…
Cancel
Save