@@ -1,7 +1,10 @@ | |||
.DS_Store | |||
src/data/tplcache/ | |||
src/data/tplcache/*.inc | |||
src/data/tplcache/*.txt | |||
src/data/sessions* | |||
src/data/cache/ | |||
src/data/cache/*.inc | |||
src/data/cache/*.dat | |||
src/data/cache/*/ | |||
src/data/common.inc.php | |||
src/data/config.cache.bak.php | |||
src/data/config.cache.inc.php | |||
@@ -10,12 +13,9 @@ src/install/index.php.bak | |||
src/install/index.html | |||
src/install/module-install.php.bak | |||
src/a/*/ | |||
src/uploads/allimg/* | |||
src/.txt | |||
src/data/enums/ | |||
src/index.html | |||
src/data/admin/ | |||
src/data/module/ | |||
src/uploads/*.php | |||
src/data/time.lock.inc | |||
src/m/index.html | |||
@@ -36,5 +36,7 @@ src/data/sitemap.html | |||
src/data/js/ | |||
src/data/vote/*.js | |||
src/data/module/*.xml | |||
src/data/module/*.php | |||
src/data/*.db | |||
src/uploads/soft/*/ | |||
src/static/allimg/*/ |
@@ -1,22 +1,22 @@ | |||
# DedeBIZ | |||
## DedeCMSV6 | |||
国内流行的内容管理系统(CMS)多端全媒体解决方案,DedeBIZ系统基于PHP7.X开发,具有很强的可扩展性,并且完全开放源代码。DedeBIZ商业支持采用现流行的Go语言设计开发,让DedeCMS系统拥有简单易用、灵活扩展特性之外更安全、高效。模板设计制作简单一直是系统的一大特点,全新的版本延续了之前标签引擎,同时采用响应式模板引擎Bootstrap作为系统模板渲染引擎,让搭建跨终端(移动、PC)全媒体站点更简单。 | |||
国内流行的内容管理系统(CMS)多端全媒体解决方案,DedeCMSV6系统基于PHP7.X开发,同时兼容PHP8,具有很强的可扩展性,并且完全开放源代码DedeBIZ商业支持采用现流行的Go语言设计开发,让系统拥有简单易用、灵活扩展特性之外更安全、高效,模板设计制作简单一直是系统的一大特点,全新的版本延续了之前标签引擎,同时采用响应式模板引擎Bootstrap作为系统模板渲染引擎,让搭建跨终端(移动、PC)全媒体站点更简单。 | |||
## 版本说明 | |||
DedeBIZ.x是一个LTS版本,支持将到2022年10月截止,目前DedeBIZ已经发布,可以[点击下载](https://www.dedebiz.com/download)获取。 | |||
DedeCMSV6.x是一个LTS版本,支持将到2025年10月截止,目前DedeCMSV6已经发布,可以[点击下载](https://www.dedebiz.com/download)获取 | |||
## 参与开源 | |||
访问[代码托管](https://www.dedebiz.com/git),可以看到我们已经将代码托管在几个知名代码托管平台,可以通过提交Pull requests的方式来贡献您的力量。 | |||
访问[代码托管](https://www.dedebiz.com/git),可以看到我们已经将代码托管在几个知名代码托管平台,可以通过提交Pull requests的方式来贡献您的力量 | |||
## v6.1 Roadmap | |||
## v6.2 Roadmap | |||
我们将会收集、整理新的功能需求制定新的Roadmap。 | |||
我们将会收集、整理新的功能需求制定新的Roadmap | |||
[开发者](https://www.dedebiz.com/developer)可以到[工单管理](https://www.zhelixie.com/DedeBiz/DedeBIZ/issues)中进行交流反馈。 | |||
[开发者](https://www.dedebiz.com/developer)可以到[工单管理](https://www.zhelixie.com/DedeBiz/DedeBIZ/issues)中进行交流反馈 | |||
普通用户可以通过微信公众号或者邮件的方式进行反馈,详见本页底部资源。 | |||
普通用户可以通过微信公众号或者邮件的方式进行反馈,详见本页底部资源 | |||
在这里,可以查看版本[更新记录](docs/changelog.md) | |||
@@ -24,13 +24,11 @@ DedeBIZ.x是一个LTS版本,支持将到2022年10月截止,目前DedeBIZ已 | |||
1.Windows 平台 | |||
IIS/Apache/Nginx + PHP5/PHP7/PHP8 + MySQL5/8/10 | |||
如果在windows环境中使用,建议用DedeCMS提供的DedeAMPZ套件以达到最佳使用性能。 | |||
IIS/Apache/Nginx + PHP5.3+/PHP7/PHP8 + MySQL5/8/10 | |||
2.Linux/Unix 平台 | |||
Apache/Nginx + PHP5/PHP7 + MySQL5/8/10 (PHP必须在非安全模式下运行) | |||
Apache/Nginx + PHP5.3+/PHP7 + MySQL5/8/10 (PHP必须在非安全模式下运行) | |||
建议使用平台:Linux + Apache2.2 + PHP7.4 + MySQL5.0 | |||
@@ -38,6 +36,8 @@ Apache/Nginx + PHP5/PHP7 + MySQL5/8/10 (PHP必须在非安全模式下运行) | |||
CURL:数据采集 | |||
Fileinfo:文件上传安全校验 | |||
GD扩展库:图像验证码、水印、二维码生成 | |||
MySQL扩展库:数据存储 | |||
@@ -50,17 +50,15 @@ Sockets:支持接入DedeBIZ商业组件模块 | |||
``` | |||
/ | |||
..../install 安装程序目录,安装完后可删除[安装时必须有可写入权限] | |||
..../dede 默认后台管理目录(可任意改名) | |||
..../include 类库文件目录[建议关闭对外访问权限] | |||
..../plus 插件扩展程序目录 | |||
..../member 会员目录 | |||
..../static 静态资源存放目录 | |||
..../uploads 默认上传目录[必须可写入] | |||
..../a 默认HTML文件存放目录[必须可写入] | |||
..../templets 系统默认内核模板目录 | |||
..../data 系统缓存或其它可写入数据存放目录[必须可写入] | |||
..../special 专题目录[生成一次专题后可以删除special/index.php,必须可写入] | |||
..../admin 默认后台管理目录[可任意改名] | |||
..../apps 插件扩展程序目录[不可写入,可执行] | |||
..../data 系统缓存或其它可写入数据存放目录[必须可写入,但不可执行] | |||
..../install 安装程序目录,安装完后可删除[安装时必须有可写入权限] | |||
..../static 静态资源存放目录[必须可写入,无需执行] | |||
..../system 类库文件目录[建议关闭对外访问权限] | |||
..../theme 系统默认内核模板目录[建议关闭对外访问权限] | |||
..../user 会员目录 | |||
``` | |||
5.PHP环境容易碰到的不兼容性问题 | |||
@@ -69,7 +67,7 @@ Sockets:支持接入DedeBIZ商业组件模块 | |||
* php的上传的临时文件夹没设置好或没写入权限,这会导致文件上传的功能无法使用; | |||
* 出现莫名的错误,如安装时显示空白,这样能是由于系统没装载mysql扩展导致的,对于初级用户,可以下载dede的php套件包,以方便简单的使用。 | |||
* 出现莫名的错误,如安装时显示空白,这样能是由于系统没装载mysql扩展导致的,对于初级用户,可以下载dede的php套件包,以方便简单的使用 | |||
## 程序安装使用 | |||
@@ -77,15 +75,15 @@ 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) | |||
## DedeBIZ命令行工具 | |||
在程序包中,我们增加了一个命令行工具`dedebiz`,通过这个命令行工具,我们可以完成例如:静态文件生成、快速搭建开发环境、更新系统等功能。 | |||
在程序包中,我们增加了一个命令行工具`dedebiz`,通过这个命令行工具,我们可以完成例如:静态文件生成、快速搭建开发环境、更新系统等功能 | |||
保证我们系统PATH目录中含有`php`命令,如果是Linux系统,我们可以赋予`dedebiz`文件可执行的权限。 | |||
保证我们系统PATH目录中含有`php`命令,如果是Linux系统,我们可以赋予`dedebiz`文件可执行的权限 | |||
运行`php dedebiz`命令(如果系统中有bash命令行,直接可以执行`./dedebiz`)我们可以看到如下信息: | |||
@@ -104,9 +102,9 @@ WEBSITE: | |||
https://www.dedebiz.com/help/ | |||
``` | |||
如果我们想要生成静态文件,可以执行`./dedebiz m o`,便可以自动生成。 | |||
如果我们想要生成静态文件,可以执行`./dedebiz m o`,便可以自动生成 | |||
除了上面的“程序安装使用”中的步骤,我们也可以通过命令行工具快速开始一个本地开发的站点,执行脚本`./dedebiz q`,就可以快速初始化一个本地开发的站点,非常方便。 | |||
除了上面的“程序安装使用”中的步骤,我们也可以通过命令行工具快速开始一个本地开发的站点,执行脚本`./dedebiz q`,就可以快速初始化一个本地开发的站点,非常方便 | |||
 | |||
@@ -114,7 +112,7 @@ WEBSITE: | |||
详细参考:[DedeBIZ站点授权协议](https://www.dedebiz.com/license) | |||
我们对DedeBIZ系统授权的态度是“鼓励但不强制”,购买授权是对知识产权的尊重,是对我们技术服务的认可。 | |||
我们对DedeBIZ系统授权的态度是“鼓励但不强制”,购买授权是对知识产权的尊重,是对我们技术服务的认可 | |||
## 相关资源 | |||
@@ -5,12 +5,13 @@ | |||
* | |||
* @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 | |||
//切换工作目录到./public | |||
$workDir = dirname(__FILE__) . "/src"; | |||
chdir($workDir); | |||
if (substr(php_sapi_name(), 0, 3) === 'cgi') { | |||
@@ -32,7 +33,7 @@ WEBSITE: | |||
https://www.dedebiz.com/help/ | |||
"; | |||
// 将选项转化为SQL IN参数 | |||
//将选项转化为SQL IN参数 | |||
function Option2SQLin($str = "") | |||
{ | |||
$str = preg_replace("#[^0-9-,]#", "", $str); | |||
@@ -72,8 +73,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"); | |||
} | |||
@@ -81,18 +82,18 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { | |||
echo "Open http://localhost:8088\n\r"; | |||
passthru(PHP_BINARY . ' -S localhost:8088 -t' . escapeshellarg('./')); | |||
} else if (count($argv) > 1 && ($argv[1] == "make" || $argv[1] == "m")) { | |||
if (!file_exists($workDir . "/include/common.inc.php")) { | |||
if (!file_exists($workDir . "/system/common.inc.php")) { | |||
DedeCli::error("Check your root path is right"); | |||
exit; | |||
} | |||
require_once($workDir . "/include/common.inc.php"); | |||
require_once(DEDEINC . "/cli.class.php"); | |||
require_once($workDir . "/system/common.inc.php"); | |||
require_once(DEDEINC . "/libraries/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 +121,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 +141,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 +163,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 +185,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 +200,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 +235,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 +249,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 { | |||
@@ -271,10 +272,10 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { | |||
exit; | |||
} | |||
} else if (count($argv) > 1 && ($argv[1] == "update" || $argv[1] == "u")) { | |||
define("DEDEINC", $workDir."/include"); | |||
define("DEDEINC", $workDir."/system"); | |||
require_once(DEDEINC."/dedehttpdown.class.php"); | |||
require_once(DEDEINC . "/cli.class.php"); | |||
// 更新系统 | |||
require_once(DEDEINC . "/libraries/cli.class.php"); | |||
//更新系统 | |||
$latestURL = "https://cdn.dedebiz.com/release/latest.txt"; | |||
$del = new DedeHttpDown(); | |||
$del->OpenUrl($latestURL); | |||
@@ -292,11 +293,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无其他依赖 | |||
define("DEDEINC", $workDir."/system"); | |||
require_once(DEDEINC . "/libraries/cli.class.php"); | |||
//快速开始一个用于开发的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 +305,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")); | |||
@@ -318,6 +319,8 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { | |||
$dbprefix = "dede_"; | |||
$dblang = "utf8"; | |||
mkdir($workDir.'/data/tplcache', 0777); | |||
//common.inc.php | |||
$configStr1 = str_replace("~dbtype~",$dbtype,$configStr1); | |||
$configStr1 = str_replace("~dbhost~",$dbhost,$configStr1); | |||
@@ -326,7 +329,7 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { | |||
$configStr1 = str_replace("~dbpwd~",$dbpwd,$configStr1); | |||
$configStr1 = str_replace("~dbprefix~",$dbprefix,$configStr1); | |||
$configStr1 = str_replace("~dblang~",$dblang,$configStr1); | |||
$fp = fopen($workDir."/data/common.inc.php","w") or die("error,check ../data writeable"); | |||
$fp = fopen($workDir."/data/common.inc.php","w") or die("error,check /data writeable"); | |||
fwrite($fp,$configStr1); | |||
fclose($fp); | |||
@@ -461,6 +464,10 @@ if (count($argv) > 1 && ($argv[1] == "serv" || $argv[1] == "s")) { | |||
if (phpversion() < "5.4") { | |||
die("DedeBIZ:command web server not support\n\n"); | |||
} | |||
// 写入安装程序锁 | |||
file_put_contents($workDir.'/install/install_lock.txt', 'ok'); | |||
echo "Start Dev Server For DedeBIZ\n\r"; | |||
echo "Open http://localhost:8088\n\r"; | |||
passthru(PHP_BINARY . ' -S localhost:8088 -t' . escapeshellarg('./')); | |||
@@ -1,13 +1,16 @@ | |||
# 更新记录 | |||
通过访问 https://www.dedebiz.com/git 获取完整更新记录 | |||
## v6.0.4 | |||
# v6.1.0 | |||
- 兼容PHP8+; | |||
- 修正已知存在的安全问题; | |||
- 优化系统管理后台界面; | |||
- 修正sqlite3下的错误; | |||
- 系统结构调整,更合理规范; | |||
- 增加编辑器多图上传插件; | |||
- 修正自定义表单相关错误; | |||
## v6.0.0 | |||
# v6.0.0 | |||
- 调整DedeCMS目录结构,将原有include中外部访问的内容迁移出去; | |||
- 修正已知存在的安全问题; | |||
- 升级内置编辑器ckeditor4为最新版本; | |||
@@ -19,8 +22,8 @@ | |||
- 调整会员中心UI,移除对文件上传的支持,增加系统安全性; | |||
- 移除对Flash的依赖支持,今后版本采用HTML5相关特性; | |||
- 调整v6版本程序升级相关功能; | |||
- 兼容PHP7.4,DedeCMS未来的版本以PHP7.X为主,实验性支持PHP8.X; | |||
- 兼容PHP7.4,未来的版本以PHP7.X为主,实验性支持PHP8.X; | |||
- 系统支持HTTPS; | |||
- 默认模板重新设计制作,采用响应式布局; | |||
- 官方网站页面调整,调整部分内容以适应未来的版本更新; | |||
- 增加DedeBIZ商业支持,构建更安全、稳定的DedeCMS生态; | |||
- 增加DedeBIZ商业支持,构建更安全、稳定的织梦生态; |
@@ -1,21 +1,18 @@ | |||
<?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'); |
@@ -1,97 +1,90 @@ | |||
<?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:#dc3545">'.$this->keyword.'</span>', $text[$key]); | |||
} | |||
} | |||
} else { | |||
$text = str_replace($this->keyword, '<span style="color:#dc3545">'.$this->keyword.'</span>', $text); | |||
} | |||
return $text; | |||
} | |||
function _strpos($string, $find) | |||
{ | |||
if (function_exists('stripos')) return stripos($string, $find); | |||
return strpos($string, $find); | |||
} | |||
} |
@@ -1,5 +1,4 @@ | |||
<?php | |||
/** | |||
* 广告添加 | |||
* | |||
@@ -9,12 +8,10 @@ | |||
* @license https://www.dedebiz.com/license | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require(dirname(__FILE__)."/config.php"); | |||
CheckPurview('plus_广告管理'); | |||
require_once DEDEINC."/typelink.class.php"; | |||
require_once DEDEINC."/typelink/typelink.class.php"; | |||
if (empty($dopost)) $dopost = ""; | |||
if ($dopost == "save") { | |||
CheckCSRF(); | |||
//timeset tagname typeid normbody expbody | |||
@@ -74,4 +71,4 @@ $startDay = time(); | |||
$endDay = AddDay($startDay, 30); | |||
$startDay = GetDateTimeMk($startDay); | |||
$endDay = GetDateTimeMk($endDay); | |||
include DedeInclude('templets/ad_add.htm'); | |||
include DedeInclude('templets/ad_add.htm'); |
@@ -1,5 +1,4 @@ | |||
<?php | |||
/** | |||
* 广告编辑 | |||
* | |||
@@ -11,25 +10,23 @@ | |||
*/ | |||
require(dirname(__FILE__)."/config.php"); | |||
CheckPurview('plus_广告管理'); | |||
require_once(DEDEINC.'/typelink.class.php'); | |||
require_once(DEDEINC.'/typelink/typelink.class.php'); | |||
if (empty($dopost)) $dopost = ''; | |||
$aid = preg_replace("#[^0-9]#", '', $aid); | |||
$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "ad_main.php" : $_COOKIE['ENV_GOBACK_URL']; | |||
if ($dopost == 'delete') { | |||
$dsql->ExecuteNoneQuery("DELETE FROM `#@__myad` WHERE aid='$aid' "); | |||
ShowMsg("成功删除一则广告代码", $ENV_GOBACK_URL); | |||
exit(); | |||
} else if ($dopost == "gettag") { | |||
require_once(DEDEINC.'/oxwindow.class.php'); | |||
require_once(DEDEINC.'/libraries/oxwindow.class.php'); | |||
$jscode = "<script src='{$cfg_phpurl}/ad_js.php?aid=$aid' language='javascript'></script>"; | |||
$showhtml = "<xmp style='color:#333333;background-color:#ffffff'>\r\n\r\n$jscode\r\n\r\n</xmp>"; | |||
$showhtml .= "预览:<iframe name='testfrm' frameborder='0' src='ad_edit.php?aid={$aid}&dopost=testjs' id='testfrm' width='100%' height='200'></iframe>"; | |||
$row = $dsql->GetOne("SELECT tagname from `#@__myad` WHERE aid='$aid' "); | |||
$showtag = '{'."dede:myad name='{$row['tagname']}'/".'}'; | |||
$info = "<b>说明:</b>如果嵌入的是织梦CMS广告标签,那么将会解析成标签中的内容到页面,广告更改后需要重新生成。<br /> | |||
如果不希望重新生成所有页面,则直接调用JS代码即可。 | |||
$info = "<b>说明:</b>如果嵌入的是织梦CMS广告标签,那么将会解析成标签中的内容到页面,广告修改后需要重新生成<br> | |||
如果不希望重新生成所有页面,则直接调用JS代码即可 | |||
"; | |||
$wintitle = "广告管理-获取广告标签"; | |||
$wecome_info = "<a href='ad_main.php'>广告管理</a>::获取JS"; | |||
@@ -63,10 +60,9 @@ if ($dopost == 'delete') { | |||
WHERE aid='$aid' | |||
"; | |||
$dsql->ExecuteNoneQuery($query); | |||
ShowMsg("成功更改一则广告代码", $ENV_GOBACK_URL); | |||
ShowMsg("成功修改一则广告代码", $ENV_GOBACK_URL); | |||
exit(); | |||
} | |||
$row = $dsql->GetOne("SELECT * FROM `#@__myad` WHERE aid='$aid'"); | |||
$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC'); | |||
$option = ''; | |||
@@ -77,4 +73,4 @@ while ($arr = $dsql->GetArray('dd')) { | |||
$option .= "<option value='{$arr['id']}'>{$arr['typename']}</option>\n\r"; | |||
} | |||
} | |||
include DedeInclude('templets/ad_edit.htm'); | |||
include DedeInclude('templets/ad_edit.htm'); |
@@ -1,60 +1,54 @@ | |||
<?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 "限时标记"; | |||
} | |||
} |
@@ -1,43 +1,40 @@ | |||
<?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'); |
@@ -1,314 +1,313 @@ | |||
<?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> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>更改图集</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布图片管理</a> $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", " ", 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.'/libraries/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."/libraries/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> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>修改图集</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布图片管理</a> $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", " ", FALSE); | |||
$win->Display(); | |||
} |
@@ -1,378 +1,383 @@ | |||
<?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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看更改</a> <a href='$arcUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理已发布图片</a> $backurl"; | |||
$wintitle = "成功更改图集"; | |||
$wecome_info = "文章管理::更改图集"; | |||
$win = new OxWindow(); | |||
$win->AddTitle("成功更改一个图集:"); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand", " ", 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.'/libraries/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; | |||
} | |||
$mime = get_mime_type($tmpFile); | |||
if (preg_match("#^unknow#", $mime)) { | |||
ShowMsg("系统不支持fileinfo组件,建议php.ini中开启", -1); | |||
exit; | |||
} | |||
if (!preg_match("#^image#i", $mime)) { | |||
ShowMsg("非图片格式文件,无法正常上传", -1); | |||
exit; | |||
} | |||
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."/libraries/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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看修改</a> <a href='$arcUrl' target='_blank' class='btn btn-success btn-sm'>预览文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理已发布图片</a> $backurl"; | |||
$wintitle = "成功修改图集"; | |||
$wecome_info = "文章管理::修改图集"; | |||
$win = new OxWindow(); | |||
$win->AddTitle("成功修改一个图集:"); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand", " ", false); | |||
$win->Display(); | |||
} |
@@ -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"; |
@@ -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> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>更改文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a> $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', ' ', 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.'/libraries/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> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>修改文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a> $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', ' ', false); | |||
$win->Display(); | |||
} |
@@ -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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看更改</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a> $backurl"; | |||
$wintitle = "成功更改文档"; | |||
$wecome_info = "文档管理::更改文档"; | |||
$win = new OxWindow(); | |||
$win->AddTitle("成功更改文档:"); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand", " ", 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.'/libraries/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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看修改</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a> $backurl"; | |||
$wintitle = "成功修改文档"; | |||
$wecome_info = "文档管理::修改文档"; | |||
$win = new OxWindow(); | |||
$win->AddTitle("成功修改文档:"); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand", " ", false); | |||
$win->Display(); | |||
} |
@@ -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> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>更改文档</a> <a href='content_sg_list.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a> <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", " ", 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.'/libraries/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> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>修改文档</a> <a href='content_sg_list.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>已发布文档管理</a> <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", " ", false); | |||
$win->Display(); | |||
} |
@@ -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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看更改</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='catalog_do.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a> <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", " ", 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.'/libraries/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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看修改</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文档</a> <a href='catalog_do.php?cid=$typeid&channelid={$channelid}&dopost=listArchives' class='btn btn-success btn-sm'>管理文档</a> <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", " ", false); | |||
$win->Display(); | |||
} |
@@ -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> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>更改文章</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文章管理</a> $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", " ", 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.'/libraries/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> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a> <a href='archives_do.php?aid=".$arcID."&dopost=editArchives' class='btn btn-success btn-sm'>修改文章</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>已发布文章管理</a> $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", " ", false); | |||
$win->Display(); | |||
} |
@@ -1,43 +1,40 @@ | |||
<?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."/libraries/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(); |
@@ -1,120 +1,120 @@ | |||
<?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"> </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"> </td> | |||
<td colspan="2"><textarea name="rule" style="width:300px;height:80px"><?php echo $row['rule']; ?></textarea></td> | |||
</tr> | |||
<tr> | |||
<td height="32"> </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" /></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"> </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"> </td> | |||
<td colspan="2"><textarea name="rule" style="width:300px;height:80px"><?php echo $row['rule']; ?></textarea></td> | |||
</tr> | |||
<tr> | |||
<td height="30"> </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(); |
@@ -1,167 +1,157 @@ | |||
<?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(); | |||
} | |||
} //更新自动分页处理代码结束 | |||
} |
@@ -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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看更改</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文章</a> $backurl"; | |||
$wintitle = "成功更改文章"; | |||
$wecome_info = "文章管理::更改文章"; | |||
$win = new OxWindow(); | |||
$win->AddTitle("成功更改文章:"); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand", " ", 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.'/libraries/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> <a href='archives_do.php?aid=".$id."&dopost=editArchives' class='btn btn-success btn-sm'>查看修改</a> <a href='$artUrl' target='_blank' class='btn btn-success btn-sm'>查看文章</a> <a href='catalog_do.php?cid=$typeid&dopost=listArchives' class='btn btn-success btn-sm'>管理文章</a> $backurl"; | |||
$wintitle = "成功修改文章"; | |||
$wecome_info = "文章管理::修改文章"; | |||
$win = new OxWindow(); | |||
$win->AddTitle("成功修改文章:"); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow("hand", " ", false); | |||
$win->Display(); | |||
} |
@@ -1,93 +1,90 @@ | |||
<?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" '; | |||
} |
@@ -1,204 +1,202 @@ | |||
<?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."/libraries/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'); |
@@ -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:#dc3545'>禁用</span>"; | |||
} | |||
function GetMan($sta) | |||
{ | |||
if ($sta == 1) return "禁用"; | |||
else return "启用"; | |||
} |
@@ -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>] "; | |||
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'> </div>"; | |||
} else { | |||
//作者列表 | |||
$m_file = DEDEDATA."/admin/writer.txt"; | |||
echo "<div class='coolbg4'>[<a href=\"javascript:OpenMyWin('article_writer_edit.php');ClearDivCt('mywriter');\">设置</a>] "; | |||
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'> </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>] "; | |||
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'> </div>"; | |||
} else { | |||
//作者列表 | |||
$m_file = DEDEDATA."/admin/writer.txt"; | |||
echo "<div class='coolbg4'>[<a href=\"javascript:OpenMyWin('article_writer_edit.php');ClearDivCt('mywriter');\">设置</a>] "; | |||
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'> </div>\r\n"; | |||
} |
@@ -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."/libraries/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(); |
@@ -1,5 +1,4 @@ | |||
<?php | |||
/** | |||
* 防采集混淆字符串管理 | |||
* | |||
@@ -10,14 +9,14 @@ | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__).'/config.php'); | |||
require_once(DEDEINC.'/oxwindow.class.php'); | |||
require_once(DEDEINC.'/libraries/oxwindow.class.php'); | |||
CheckPurview('sys_StringMix'); | |||
if (empty($dopost)) $dopost = ''; | |||
if (empty($allsource)) $allsource = ''; | |||
else $allsource = stripslashes($allsource); | |||
$m_file = DEDEDATA."/downmix.data.php"; | |||
$m_file = DEDEDATA."/downmix.data.inc"; | |||
//保存 | |||
if ($dopost == "save") { | |||
@@ -42,7 +41,7 @@ $win = new OxWindow(); | |||
$win->Init('article_string_mix.php', 'js/blank.js', 'POST'); | |||
$win->AddHidden('dopost', 'save'); | |||
$win->AddHidden('token', $_SESSION['token']); | |||
$win->AddTitle("如果您要启用字符串混淆来防采集,请在文档模板需要的字段加上 function='RndString(@me)' 属性,如:{dede:field name='body' function='RndString(@me)'/}。"); | |||
$win->AddTitle("如果您要启用字符串混淆来防采集,请在文档模板需要的字段加上 function='RndString(@me)' 属性,如:{dede:field name='body' function='RndString(@me)'/}"); | |||
$win->AddMsgItem("<textarea name='allsource' id='allsource' style='width:100%;height:300px'>$allsource</textarea>"); | |||
$winform = $win->GetWindow('ok'); | |||
$win->Display(); |
@@ -1,5 +1,4 @@ | |||
<?php | |||
/** | |||
* 文档随机模板 | |||
* | |||
@@ -10,13 +9,11 @@ | |||
* @link https://www.dedebiz.com | |||
*/ | |||
require_once(dirname(__FILE__).'/config.php'); | |||
require_once(DEDEINC.'/oxwindow.class.php'); | |||
require_once(DEDEINC.'/libraries/oxwindow.class.php'); | |||
CheckPurview('sys_StringMix'); | |||
if (empty($dopost)) $dopost = ''; | |||
$templates = empty($templates) ? '' : stripslashes($templates); | |||
$m_file = DEDEDATA.'/template.rand.php'; | |||
//----------------------action | |||
$okmsg = ''; | |||
//保存配置 | |||
if ($dopost == 'save') { | |||
@@ -65,8 +62,6 @@ else if ($dopost == 'clearold') { | |||
echo "全部清除操作成功"; | |||
exit(); | |||
} | |||
//-------------------------read | |||
//读出 | |||
if (empty($templates) && filesize($m_file) > 0) { | |||
$fp = fopen($m_file, 'r'); | |||
@@ -77,9 +72,9 @@ $wintitle = "随机模板防采集设置"; | |||
$wecome_info = "随机模板防采集设置"; | |||
make_hash(); | |||
$msg = " | |||
<link href='css/base.css' rel='stylesheet' type='text/css' /> | |||
<link rel='stylesheet' href='css/base.css' /> | |||
<script language='javascript' src='js/main.js'></script> | |||
<script language='javascript' src='../static/js/dedeajax2.js'></script> | |||
<script language='javascript' src='../static/js/webajax.js'></script> | |||
<script language='javascript'> | |||
function DoRand(jobname) | |||
{ | |||
@@ -92,7 +87,7 @@ function DoRand(jobname) | |||
} | |||
</script> | |||
<div id='loading' style='z-index:3000;top:160;left:300;position:absolute;display:none;'> | |||
<img src='images/loadinglit.gif' /> 请稍后,正在操作中... | |||
<img src='images/loadinglit.gif' /> 请稍后,正在操作中 | |||
</div> | |||
<table width='98%' align='center'> | |||
<tr> | |||
@@ -100,7 +95,7 @@ function DoRand(jobname) | |||
如果您想对旧的文章应用随机模板设置,请点击此对旧文章进行处理(必须设置好模板项) | |||
<a href='#' onclick='DoRand(\"makeold\")' class='btn btn-success btn-sm'>设置全部</a> | |||
<a href='#' onclick='DoRand(\"clearold\")' class='btn btn-success btn-sm'>取消全部</a> | |||
<span id='tmpct' style='color:red;font-weight:bold'>$okmsg</span> | |||
<span id='tmpct' style='color:#dc3545;font-weight:bold'>$okmsg</span> | |||
</td> | |||
</tr> | |||
<tr> | |||
@@ -110,7 +105,6 @@ function DoRand(jobname) | |||
<td><textarea name='templates' id='templates' style='width:100%;height:250px'>$templates</textarea></td> | |||
</tr> | |||
</table>"; | |||
$win = new OxWindow(); | |||
$win->Init('article_template_rand.php', 'js/blank.js', 'POST'); | |||
$win->AddHidden('dopost', 'save'); | |||
@@ -118,4 +112,4 @@ $win->AddHidden('token', $_SESSION['token']); | |||
$win->AddTitle("本设置仅适用于系统默认的文章模型,设置后发布文章时会自动按指定的模板随机获取一个,如果不想使用此功能,把它设置为空即可"); | |||
$win->AddMsgItem($msg); | |||
$winform = $win->GetWindow('ok'); | |||
$win->Display(); | |||
$win->Display(); |
@@ -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(DEDEINC."/typelink/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'); |
@@ -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='../apps/view.php?aid={$row['id']}' style='color:#dc3545' target='_blank'>$t</a>' 的文档[<a href='#' onclick='javascript:HideObj(\"mytitle\")'>关闭</a>]"; | |||
} |
@@ -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.'/libraries/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(); |
@@ -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:;'); | |||
} |
@@ -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} 个点卡"; | |||
} |
@@ -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 '未使用'; | |||
} |
@@ -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"); |
@@ -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/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'); |
@@ -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> >> 删除栏目确认"; | |||
$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> <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.'/typelink/typeunit.class.admin.php'); | |||
require_once(DEDEINC.'/libraries/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> >> 删除栏目确认"; | |||
$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> <input type='radio' name='delfile' class='np' value='yes' /> 是</label>"); | |||
$winform = $win->GetWindow('ok'); | |||
$win->Display(); |
@@ -1,299 +1,308 @@ | |||
<?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> >> 合并栏目"; | |||
$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> >> 移动栏目"; | |||
$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."/archive/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/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."/typelink/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.'/libraries/oxwindow.class.php'); | |||
require_once(DEDEINC.'/typelink/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> >> 合并栏目"; | |||
$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:#dc3545'>$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.'/libraries/oxwindow.class.php'); | |||
require_once(DEDEINC.'/typelink/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> >> 移动栏目"; | |||
$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(); | |||
} | |||
} |
@@ -1,246 +1,247 @@ | |||
<?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']) ? " " : $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' "; ?>> 不支持</label> | |||
<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; ?>' 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">(由低 -> 高)</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' "; ?>> 链接到默认页</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'] ?>" 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' "; ?>> 最终列表栏目(允许在本栏目发布文档,并生成文档列表)</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'> | |||
<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/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']) ? " " : $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 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> | |||
<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; ?>' 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">(由低 -> 高)</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' "; ?>> 链接到默认页</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'] ?>" 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' "; ?>> 最终列表栏目(允许在本栏目发布文档,并生成文档列表)</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'> | |||
<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'); | |||
} | |||
?> |
@@ -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."/typelink/typeunit.class.admin.php"); | |||
$userChannel = $cuserLogin->getUserChannel(); | |||
include DedeInclude('templets/catalog_main.htm'); |
@@ -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/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(); | |||
} |
@@ -9,14 +9,14 @@ | |||
* @link https://www.dedebiz.com | |||
*/ | |||
define('DEDEADMIN', str_replace("\\", '/', dirname(__FILE__))); | |||
require_once(DEDEADMIN . '/../include/common.inc.php'); | |||
require_once(DEDEINC . '/userlogin.class.php'); | |||
require_once(DEDEADMIN.'/../system/common.inc.php'); | |||
require_once(DEDEINC.'/userlogin.class.php'); | |||
header('Cache-Control:private'); | |||
$dsql->safeCheck = FALSE; | |||
$dsql->SetLongLink(); | |||
$cfg_admin_skin = 1;//后台管理风格 | |||
if (file_exists(DEDEDATA . '/admin/skin.txt')) { | |||
$skin = file_get_contents(DEDEDATA . '/admin/skin.txt'); | |||
if (file_exists(DEDEDATA.'/admin/skin.txt')) { | |||
$skin = file_get_contents(DEDEDATA.'/admin/skin.txt'); | |||
$cfg_admin_skin = !in_array($skin, array(1, 2, 3, 4)) ? 1 : $skin; | |||
} | |||
//检查CSRF | |||
@@ -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(); | |||
@@ -51,9 +51,9 @@ $cuserLogin = new userLogin(); | |||
if ($cuserLogin->getUserID() == -1) { | |||
if (preg_match("#PHP (.*) Development Server#", $_SERVER['SERVER_SOFTWARE'])) { | |||
$dirname = dirname($_SERVER['SCRIPT_NAME']); | |||
header("location:{$dirname}/login.php?gotopage=" . urlencode($dedeNowurl)); | |||
header("location:{$dirname}/login.php?gotopage=".urlencode($dedeNowurl)); | |||
} else { | |||
header("location:login.php?gotopage=" . urlencode($dedeNowurl)); | |||
header("location:login.php?gotopage=".urlencode($dedeNowurl)); | |||
} | |||
exit(); | |||
} | |||
@@ -76,19 +76,22 @@ if ($cfg_dede_log == 'Y') { | |||
$s_scriptNames = explode('/', $s_scriptName); | |||
$s_scriptNames = $s_scriptNames[count($s_scriptNames) - 1]; | |||
$s_userip = GetIP(); | |||
if ($s_method == 'POST' || (!preg_match("#" . $s_nologfile . "#i", $s_scriptNames) && $s_query != '') || preg_match("#" . $s_needlogfile . "#i", $s_scriptNames)) { | |||
if ($s_method == 'POST' || (!preg_match("#".$s_nologfile."#i", $s_scriptNames) && $s_query != '') || preg_match("#".$s_needlogfile."#i", $s_scriptNames)) { | |||
$inquery = "INSERT INTO `#@__log`(adminid,filename,method,query,cip,dtime) | |||
VALUES ('" . $cuserLogin->getUserID() . "','{$s_scriptNames}','{$s_method}','" . addslashes($s_query) . "','{$s_userip}','" . time() . "');"; | |||
VALUES ('".$cuserLogin->getUserID()."','{$s_scriptNames}','{$s_method}','".addslashes($s_query)."','{$s_userip}','".time()."');"; | |||
$dsql->ExecuteNoneQuery($inquery); | |||
} | |||
} | |||
if (file_exists(DEDEDATA."/downmix.data.php")) { | |||
rename(DEDEDATA."/downmix.data.php",DEDEDATA."/downmix.data.inc"); | |||
} | |||
//管理缓存管理员频道缓存 | |||
$cache1 = DEDEDATA . '/cache/inc_catalog_base.inc'; | |||
$cache1 = DEDEDATA.'/cache/inc_catalog_base.inc'; | |||
if (!file_exists($cache1)) UpDateCatCache(); | |||
$cacheFile = DEDEDATA . '/cache/admincat_' . $cuserLogin->userID . '.inc'; | |||
$cacheFile = DEDEDATA.'/cache/admincat_'.$cuserLogin->userID.'.inc'; | |||
if (file_exists($cacheFile)) require_once($cacheFile); | |||
//更新服务器 | |||
require_once(DEDEDATA . '/admin/config_update.php'); | |||
require_once(DEDEDATA.'/admin/config_update.php'); | |||
if (strlen($cfg_cookie_encode) <= 10) { | |||
$chars = 'abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789'; | |||
$hash = ''; | |||
@@ -98,25 +101,25 @@ if (strlen($cfg_cookie_encode) <= 10) { | |||
$hash .= $chars[mt_rand(0, $max)]; | |||
} | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__sysconfig` SET `value`='{$hash}' WHERE varname='cfg_cookie_encode' "); | |||
$configfile = DEDEDATA . '/config.cache.inc.php'; | |||
$configfile = DEDEDATA.'/config.cache.inc.php'; | |||
if (!is_writeable($configfile)) { | |||
echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数"; | |||
exit(); | |||
} | |||
$fp = fopen($configfile, 'w'); | |||
flock($fp, 3); | |||
fwrite($fp, "<" . "?php\r\n"); | |||
fwrite($fp, "<"."?php\r\n"); | |||
$dsql->SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC "); | |||
$dsql->Execute(); | |||
while ($row = $dsql->GetArray()) { | |||
if ($row['type'] == 'number') { | |||
if ($row['value'] == '') $row['value'] = 0; | |||
fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n"); | |||
fwrite($fp, "\${$row['varname']} = ".$row['value'].";\r\n"); | |||
} else { | |||
fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n"); | |||
fwrite($fp, "\${$row['varname']} = '".str_replace("'", '', $row['value'])."';\r\n"); | |||
} | |||
} | |||
fwrite($fp, "?" . ">"); | |||
fwrite($fp, "?".">"); | |||
fclose($fp); | |||
} | |||
/** | |||
@@ -128,8 +131,8 @@ if (strlen($cfg_cookie_encode) <= 10) { | |||
function UpDateCatCache() | |||
{ | |||
global $dsql, $cache1, $cuserLogin; | |||
$cache2 = DEDEDATA . '/cache/channelsonlist.inc'; | |||
$cache3 = DEDEDATA . '/cache/channeltoplist.inc'; | |||
$cache2 = DEDEDATA.'/cache/channelsonlist.inc'; | |||
$cache3 = DEDEDATA.'/cache/channeltoplist.inc'; | |||
$dsql->SetQuery("SELECT id,reid,channeltype,issend,typename FROM `#@__arctype`"); | |||
$dsql->Execute(); | |||
$fp1 = fopen($cache1, 'w'); | |||
@@ -150,8 +153,8 @@ function UpDateCatCache() | |||
//清空选项缓存 | |||
function ClearOptCache() | |||
{ | |||
$tplCache = DEDEDATA . '/tplcache/'; | |||
$fileArray = glob($tplCache . "inc_option_*.inc"); | |||
$tplCache = DEDEDATA.'/tplcache/'; | |||
$fileArray = glob($tplCache."inc_option_*.inc"); | |||
if (count($fileArray) > 1) { | |||
foreach ($fileArray as $key => $value) { | |||
if (file_exists($value)) unlink($value); | |||
@@ -171,7 +174,7 @@ function ClearOptCache() | |||
*/ | |||
function DedeInclude($filename, $isabs = FALSE) | |||
{ | |||
return $isabs ? $filename : DEDEADMIN . '/' . $filename; | |||
return $isabs ? $filename : DEDEADMIN.'/'.$filename; | |||
} | |||
/** | |||
* 根据用户mid获取用户名称 |
@@ -1,30 +1,27 @@ | |||
<?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'); |
@@ -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/typelink.class.php'); | |||
include DedeInclude('templets/content_batch_up.htm'); |
@@ -1,186 +1,180 @@ | |||
<?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/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(); | |||
} |
@@ -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"); |
@@ -1,203 +1,170 @@ | |||
<?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 = '所有栏目>'; | |||
} else { | |||
$row = $tl->dsql->GetOne("SELECT id,typename,maintable FROM `#@__channeltype` WHERE id='$channelid'"); | |||
$positionname = $row['typename']." > "; | |||
$maintable = $row['maintable']; | |||
$channelid = $row['id']; | |||
} | |||
} else { | |||
$positionname = str_replace($cfg_list_symbol, " > ", $tl->GetPositionName())." > "; | |||
} | |||
//当选择的是单表模型栏目时,直接跳转到单表模型管理区 | |||
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/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 = '所有栏目>'; | |||
} else { | |||
$row = $tl->dsql->GetOne("SELECT id,typename,maintable FROM `#@__channeltype` WHERE id='$channelid'"); | |||
$positionname = $row['typename']." > "; | |||
$maintable = $row['maintable']; | |||
$channelid = $row['id']; | |||
} | |||
} else { | |||
$positionname = str_replace($cfg_list_symbol, " > ", $tl->GetPositionName())." > "; | |||
} | |||
//当选择的是单表模型栏目时,直接跳转到单表模型管理区 | |||
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 = 40; | |||
//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(); | |||
$dlist->Close(); |
@@ -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"); |
@@ -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"); |
@@ -1,87 +1,77 @@ | |||
<?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']." > "; | |||
$listtable = $row['addtable']; | |||
} else { | |||
$positionname = str_replace($cfg_list_symbol, " > ", $tl->GetPositionName())." > "; | |||
} | |||
$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/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']." > "; | |||
$listtable = $row['addtable']; | |||
} else { | |||
$positionname = str_replace($cfg_list_symbol, " > ", $tl->GetPositionName())." > "; | |||
} | |||
$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(); |
@@ -1,51 +1,49 @@ | |||
<?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'); |
@@ -1 +1 @@ | |||
div.flash{margin:10px 5px;width:375px;border-color:#D9E4FF;border-radius:.2rem}#btnSubmit{margin:0 0 0 155px}.progressWrapper{width:357px;overflow:hidden}.progressContainer{padding:4px;margin:5px;background-color:#f8f8f8;border:solid 1px #E8E8E8;overflow:hidden}.message{margin:10px 0;padding:10px 20px;background-color:#FFC;border:solid 1px #FD9;overflow:hidden}.red{background-color:#FFEBEB;border:solid 1px #B50000}.green{background-color:#EBFFEB;border:solid 1px #DDF0DD}.blue{background-color:#F0F5FF;border:solid 1px #CEE2F2}.progressName{width:320px;height:14px;text-align:left;white-space:nowrap;overflow:hidden}.progressBarInProgress,.progressBarComplete,.progressBarError{margin-top:2px;width:0;height:2px;font-size:0;background-color:blue}.progressBarComplete{width:100%;background-color:green;visibility:hidden}.progressBarError{width:100%;background-color:red;visibility:hidden}.progressBarStatus{margin-top:2px;width:340px;text-align:left;white-space:nowrap}a.progressCancel{font-size:0;display:block;height:14px;width:14px;background-image:url(../images/cancelbutton.gif);background-repeat:no-repeat;background-position:-14px 0;float:right}a.progressCancel:hover{background-position:0 0}.swfupload{vertical-align:top}.albCt{float:left;width:240px;height:180px;margin-right:10px;margin-bottom:10px;border:1px dashed #eee;background:#f8f8f8;text-align:center;padding:10px}.albEdit{height:180px}.picinfo{height:30px;line-height:30px;margin:10px 0}.thumbnails img,.thumbnailsEdit img{margin:5px}.albCt img{height:100px!important} | |||
div.flash{margin:10px 5px;width:375px;border-color:#D9E4FF;border-radius:.2rem}#btnSubmit{margin:0 0 0 155px}.progressWrapper{width:357px;overflow:hidden}.progressContainer{padding:4px;margin:5px;background-color:#f8f8f8;border:solid 1px #E8E8E8;overflow:hidden}.message{margin:10px 0;padding:10px 20px;background-color:#FFC;border:solid 1px #FD9;overflow:hidden}.red{background-color:#FFEBEB;border:solid 1px #B50000}.green{background-color:#EBFFEB;border:solid 1px #DDF0DD}.blue{background-color:#F0F5FF;border:solid 1px #CEE2F2}.progressName{width:320px;height:14px;text-align:left;white-space:nowrap;overflow:hidden}.progressBarInProgress,.progressBarComplete,.progressBarError{margin-top:2px;width:0;height:2px;font-size:0;background-color:blue}.progressBarComplete{width:100%;background-color:green;visibility:hidden}.progressBarError{width:100%;background-color:#dc3545;visibility:hidden}.progressBarStatus{margin-top:2px;width:340px;text-align:left;white-space:nowrap}a.progressCancel{font-size:0;display:block;height:14px;width:14px;background-image:url(../images/cancelbutton.gif);background-repeat:no-repeat;background-position:-14px 0;float:right}a.progressCancel:hover{background-position:0 0}.swfupload{vertical-align:top}.albCt{float:left;width:240px;height:180px;margin-right:10px;margin-bottom:10px;border:1px dashed #eee;background:#f8f8f8;text-align:center;padding:10px}.albEdit{height:180px}.picinfo{height:30px;line-height:30px;margin:10px 0}.thumbnails img,.thumbnailsEdit img{margin:5px}.albCt img{height:100px!important} |
@@ -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; } |
@@ -0,0 +1 @@ | |||
*{padding:0;margin:0;letter-spacing:.4px;box-sizing:border-box}body{line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;color:#424b51;background:#fff;overflow:hidden}body.hidemenu{background:none}a{text-decoration:none}ul{list-style:none}.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%}.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{display:block;padding:0 10px;height:30px;line-height:30px;color:#666}.qucikmenu ul li a:hover{background:#f6f6f6}.pagemask{position:absolute;display:none;width:100%;height:100%;background:#424b51;opacity:.7;z-index:100}.iframemask{position:absolute;display:none;z-index:80;top:0;left:0;width:100%;height:100%;background:#fff;border:none;opacity:0}.allmenu{position:absolute;display:none;margin-left:-400px;padding:10px;width:800px;top:76px;left:50%;background:#fff;border-radius:.2rem;z-index:999}.allmenu .allmenu-box{margin:0 auto;text-align:left;overflow:hidden;padding-left:2px}.maptop{margin-left:-1px;padding-right:6px;padding-left:6px;float:left;width:130px;overflow:hidden}.maptop dt.bigitem{padding:6px 10px;line-height:18px;color:#fff;background:#424b51}.mapitem dt{line-height:30px;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{padding:10px;margin-top:20px;width:70%;clear:both}#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;font-size:12px;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}.allsearch{float:left;margin-top:6px;border:1px solid #fff;border-radius:.2rem}.np{margin-top:6px;margin-left:10px;width:40px;height:18px;font-size:12px;color:#fff;background:#57960f;border-radius:.2rem;border:0;cursor:pointer} |
@@ -0,0 +1 @@ | |||
.title{color:#666600}.title span{padding-left:6px}#addTab{position:absolute;left:460px;top:260px;min-width:360px;height:200px;z-index:2;background:#fff;border:1px solid #ccc;padding:0px;display:none;border-radius:.2rem}#editTab{position:absolute;left:460px;top:260px;min-width:360px;height:300px;z-index:1;background:#fff;border:1px solid #ccc;padding:0px;display:none;border-radius:.2rem}.txt{float:left}.updatedvt{width:98%;border-bottom:1px dashed #dcdcdc}.upinfotitle{border-bottom:1px solid #ccc;color:#dc3545;font-weight:bold}.verline{border-bottom:1px dashed #ccc}.itemTable{background:#CBD8AC}#loaddiv{top:0;left:0;background:#ccc;filter:Alpha(opacity=70);-moz-opacity:0.7;position:absolute;z-index:10000;width:100%;height:100%}#mainmsg{padding-right:8px}.rightside{width:49%;float:left;margin-right:1%;height:670px}.column{width:49%;float:left;margin-right:0.5%}.placeholder{width:98%;margin-left:1%;background:#f0f0f0;border:1px dashed #ddd}.dbox{border:1px solid #DEEAB6;width:98%;margin-left:1%;margin-top:8px}.dbox dt{height:28px;line-height:28px;font-weight:bold;color:#4D6C2F;cursor:move}.dbox dt .l{float:left;padding-left:8px}.dbox dt .r{float:right;padding-right:8px}.dbox dt.lside{border-bottom:1px solid #CFD7C4;background:rgb(239,248,229)}.dbox dt.rside{border-bottom:1px solid #DEEAB6;background:url(../images/wbg.gif)repeat-x}.dbox dd{padding:0px}.dbox dd.intable{padding-top:0}#updatetest{padding:6px;padding-left:110px;background:url(../images/ico_spider.gif)no-repeat scroll 10px 15px transparent}#quickmenu{width:100%;height:46px;overflow:hidden}#quickmenu .icoitem{float:left;height:24px;line-height:24px;margin-top:10px;padding-left:30px;overflow:hidden}.dboxtable td.nline{height:26px;border-bottom:1px dashed #CFD7C4}.dboxtable1 ul li{float:left;display:inline;width:48%;height:26px;line-height:26px;border-bottom:1px dashed #CFD7C4;text-align:center}.biz p{padding:0 15px}.biz img{float:right;margin:40px 15px 0 15px} |
@@ -0,0 +1 @@ | |||
div{margin:0px;padding:0px}body{margin:auto;padding:0px;background:#9ad075;text-align:center}dl.bitem{width:148px;margin:0px 0px 6px 6px}dl.bitem dt{background:url(../images/menubg.gif);height:26px;line-height:26px;text-align:center;cursor:pointer}dl.bitem dd{padding:6px;background-color:#fff}.fllct{float:left;width:90px}.flrct{padding-top:2px;float:left}div.items{line-height:22px;background:url(../images/arr4.gif) no-repeat 10px 9px}span.items{padding:10px 0px 10px 22px;background:url(../images/arr4.gif) no-repeat 10px 12px}ul{padding-top:2px}li{height:22px}.sitemu li{padding:0px 0px 0px 22px;line-height:24px;background:url(../images/arr4.gif) no-repeat 10px 9px} |
@@ -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__)."/../../system/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(); | |||
} |
@@ -0,0 +1,227 @@ | |||
<?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} | |||
table{background:#fff} | |||
a{text-decoration:none!important} | |||
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)} | |||
.napisdiv{left:10;top:10;width:150px;height:100px;position:absolute;z-index:3;display:none} | |||
.linerow{border-bottom:1px solid #eee!important} | |||
</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('(?:[\?&]|&)' + 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:260px;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="8%" class="linerow">预览</td> | |||
<td width="40%" class="linerow">选择图片</td> | |||
<td width="22%" 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:#dc3545' "; | |||
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:#dc3545' "; | |||
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> |
@@ -1,100 +1,100 @@ | |||
<?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; | |||
$mime = get_mime_type($imgfile); | |||
if (preg_match("#^unknow#", $mime)) { | |||
ShowMsg("系统不支持fileinfo组件,建议php.ini中开启", -1); | |||
exit; | |||
} | |||
if (!preg_match("#^(image|video|audio|application)#i", $mime)) { | |||
ShowMsg("仅支持媒体文件及应用程序上传", -1); | |||
exit; | |||
} | |||
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(); |
@@ -0,0 +1,185 @@ | |||
<?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} | |||
table{background:#fff} | |||
a{text-decoration:none!important} | |||
.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:360px;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:#dc3545' "; | |||
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:#dc3545' "; | |||
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|mp3|mp4)#i", $file)) { | |||
$reurl = "$activeurl/$file"; | |||
$reurl = preg_replace("#^\.\.#", "", $reurl); | |||
$reurl = $reurl; | |||
if ($file == $comeback) $lstyle = " style='color:#dc3545' "; | |||
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:#dc3545' "; | |||
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> |
@@ -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"); |
@@ -0,0 +1,221 @@ | |||
<?php | |||
require_once(dirname(__FILE__)."/config.php"); | |||
include(DEDEDATA.'/mark/inc_photowatermark_config.php'); | |||
?> | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |||
<meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1.0,maximum-scale=1.0"> | |||
<meta name="apple-mobile-web-app-capable" content="yes"> | |||
<meta name="apple-mobile-web-app-status-bar-style" content="black"> | |||
<meta name="format-detection" content="telephone=no"> | |||
<title>插入多图</title> | |||
<style> | |||
body{margin:0;line-height:1.5;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;color:#424b51;background:#fff} | |||
ul{margin:0;padding:0;list-style:none} | |||
input[type=radio],input[type=checkbox]{margin:0;height:auto;box-shadow:none;outline:none;vertical-align:text-top} | |||
button+button{margin-left:10px} | |||
#wrap{padding:10px} | |||
#topbar{padding:10px 0;border-bottom:1px solid #ccc;text-align:right} | |||
#topbar button{display:inline-block;border:0;padding:.25rem .5rem;line-height:1.5;font-size:12px;color:#fff;background:#28a745;border-color:#28a745;border-radius:.25rem;transition:all .6s;text-align:center} | |||
.topbar button+.topbar button{margin-left:10px} | |||
#topbar button:focus{background:#006829;border-color:#005b24;box-shadow:0 0 0 0.2rem rgba(38,159,86,.5);outline:none} | |||
#file_list{display:grid;grid-gap:10px;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));padding-top:10px} | |||
#file_list:empty:after{content:'可以直接拖拽文件到这里'} | |||
#file_list li{position:relative;display:block;vertical-align:top;padding:10px;border-radius:.25rem} | |||
#file_list li.up-now:after{content:'';position:absolute;top:0;left:0;display:block;width:100%;height:100%;background:rgba(255,255,255,0.8) url(loading.gif) center center no-repeat;border-radius:.25rem;z-index:999} | |||
#file_list li:hover{background:#f2f2f2} | |||
#file_list li .picbox{display:flex;flex:0 0 auto;justify-content:center;overflow:hidden;position:relative;width:100%;padding-top:90%;align-items:center} | |||
#file_list li .picbox img{display:block;max-width:100%;max-height:100%;position:absolute;top:50%;left:50%;transform:translateX(-50%) translateY(-50%);border-radius:.25rem} | |||
#file_list li .namebox{padding:10px;display:flex;justify-content:center;align-items:flex-start} | |||
#file_list li.up-over .picbox:after{content:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20viewBox%3D%220%200%201024%201024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M512%200C229.376%200%200%20229.376%200%20512s229.376%20512%20512%20512%20512-229.376%20512-512S794.624%200%20512%200z%22%20fill%3D%22%234AC711%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M855.552%20394.752l-358.4%20358.4a50.9952%2050.9952%200%200%201-72.192%200l-204.8-204.8c-18.944-19.968-18.944-51.2%200-71.168a50.5344%2050.5344%200%200%201%2072.192-1.024L460.8%20644.608l322.048-322.048c19.968-18.944%2051.2-18.944%2071.168%200%2020.48%2019.456%2020.992%2051.712%201.536%2072.192z%22%20fill%3D%22%23FFFFFF%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E);position:absolute;bottom:10px;right:0;z-index:9} | |||
#file_list li .tools{display:none;position:absolute;bottom:12px;right:10px;z-index:99} | |||
#file_list li:hover .tools{display:block} | |||
#file_list li .tools .remove{cursor:pointer} | |||
#file_list li .tools .remove:after{content:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20width=%2224%22%20height=%2224%22%20viewBox=%220%200%2024%2024%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cpath%20d=%22M17%206h3a1%201%200%200%201%200%202h-1v11a3%203%200%200%201-3%203H8a3%203%200%200%201-3-3V8H4a1%201%200%201%201%200-2h3V5a3%203%200%200%201%203-3h4a3%203%200%200%201%203%203v1zm-2%200V5a1%201%200%200%200-1-1h-4a1%201%200%200%200-1%201v1h6zm2%202H7v11a1%201%200%200%200%201%201h8a1%201%200%200%200%201-1V8zm-8%203a1%201%200%200%201%202%200v6a1%201%200%200%201-2%200v-6zm4%200a1%201%200%200%201%202%200v6a1%201%200%200%201-2%200v-6z%22%3E%3C/path%3E%3C/svg%3E)} | |||
</style> | |||
</head> | |||
<body> | |||
<div id="wrap"> | |||
<div id="topbar"> | |||
<label><input type="checkbox" name="isWater" id="isWater" <?php if ($photo_markup == '1') echo "checked"; ?>> 是否水印 </label> | |||
<button class="addfile">添加文件</button> | |||
<button class="upall">全部上传</button> | |||
<button class="removeall">清空列表</button> | |||
</div> | |||
<ul id="file_list"></ul> | |||
</div> | |||
<script> | |||
var axupimgs={}; | |||
axupimgs.res = [];//存放本地文件的数组 | |||
var blobInfo = {file:null} | |||
blobInfo.blob = function(){return this.file;} | |||
var upload_handler = async(blobInfo, succFun, failFun)=>{ | |||
var file = blobInfo.blob(); | |||
formData = new FormData(); | |||
formData.append('upload', file, file.name); | |||
if (document.querySelector('#isWater').checked) { | |||
formData.append('needwatermark', 1); | |||
} else { | |||
//formData.append('needwatermark', 0); | |||
} | |||
let res = await fetch('select_images_post.php', { | |||
method: 'POST', | |||
body: formData | |||
}); | |||
let data = await res.json(); | |||
succFun(data.url); | |||
}; | |||
var upload_base_path = axupimgs.images_upload_base_path; | |||
//为列表添加排序 | |||
function reSort(){ | |||
document.querySelectorAll('#file_list li').forEach((el,i)=>{ | |||
el.setAttribute('data-num',i); | |||
}); | |||
} | |||
function isFileImage(file) { | |||
return file && file['type'].split('/')[0] === 'image'; | |||
} | |||
function addList(files){ | |||
var files_sum = files.length; | |||
var vDom = document.createDocumentFragment(); | |||
for(let i=0;i<files_sum;i++){ | |||
let file = files[i]; | |||
if (!isFileImage(file)) { | |||
alert("选择非图片文件无法上传") | |||
return; | |||
} | |||
let blobUrl = window.URL.createObjectURL(file) | |||
axupimgs.res.push({file:file,blobUrl:blobUrl,url:''}); | |||
let li = document.createElement('li'); | |||
li.setAttribute('class','up-no'); | |||
li.setAttribute('data-time',file.lastModified); | |||
li.innerHTML='<div class="picbox"><img src="'+blobUrl+'"></div><div class="namebox"><span>'+file.name+'</span></div><div class="tools"><a class="remove"></a></div>'; | |||
vDom.appendChild(li); | |||
} | |||
document.querySelector('#file_list').appendChild(vDom); | |||
//reSort(); | |||
} | |||
//清空列表 | |||
document.querySelector('#topbar .removeall').addEventListener('click',()=>{ | |||
axupimgs.res=[] | |||
document.querySelectorAll('#file_list li').forEach((el,i)=>{ | |||
el.parentNode.removeChild(el) | |||
}); | |||
}); | |||
//拖拽添加 | |||
document.addEventListener('dragover', (e)=>{ | |||
e.stopPropagation(); | |||
e.preventDefault(); | |||
e.dataTransfer.dropEffect = 'copy'; | |||
}); | |||
document.addEventListener('drop', (e)=>{ | |||
e.stopPropagation(); | |||
e.preventDefault(); | |||
if(!e.dataTransfer.files){return false;} | |||
var dropfiles = e.dataTransfer.files; | |||
if(!(dropfiles.length>0)){return false;} | |||
var exts=axupimgs.axupimgs_filetype.replace(/(\s)+/g,'').toLowerCase().split(','); | |||
var files=[]; | |||
for( let file of dropfiles ){ | |||
ext = file.name.split('.'); | |||
ext = '.'+ext[ext.length-1]; | |||
for(let s of exts){ | |||
if(s==ext){ | |||
files.push(file); | |||
break; | |||
} | |||
} | |||
} | |||
if(files.length>0){ addList(files) } | |||
}); | |||
//添加文件 | |||
document.querySelector('#topbar .addfile').addEventListener('click',()=>{ | |||
var input = document.createElement('input'); | |||
input.setAttribute('type', 'file'); | |||
input.setAttribute('multiple', 'multiple'); | |||
input.setAttribute('accept', axupimgs.axupimgs_filetype); | |||
input.click(); | |||
input.onchange = function() { | |||
var files = this.files; | |||
addList(files); | |||
} | |||
}); | |||
var file_i = 0; | |||
function upAllFiles(n){ | |||
var len = axupimgs.res.length; | |||
file_i = n; | |||
if(len == n){ | |||
file_i=0; | |||
document.querySelector('#topbar .upall').innerText='全部上传'; | |||
//返回 | |||
console.log(axupimgs.res); | |||
axupimgs.res.forEach((v,k)=>{ | |||
let addonHTML = `<img src='${v.url}'/>`; | |||
window.opener.CKEDITOR.instances["<?php echo $f ?>"].insertHtml(addonHTML); | |||
}) | |||
window.close(); | |||
return true; | |||
} | |||
if( axupimgs.res[n].url!='' ){ | |||
n++; | |||
upAllFiles(n) | |||
} else { | |||
blobInfo.file=axupimgs.res[n].file; | |||
blobInfo.isWater = document.querySelector('#isWater').checked; | |||
upload_handler(blobInfo,function(url){ | |||
if(upload_base_path){ | |||
if(upload_base_path.slice(-1)=='/' && url.substr(0,1)=='/' ){ | |||
url = upload_base_path + url.slice(1); | |||
}else if(upload_base_path.slice(-1)!='/' && url.substr(0,1)!='/' ){ | |||
url = upload_base_path + '/' + url; | |||
} else { | |||
url = upload_base_path + url; | |||
} | |||
} | |||
axupimgs.res[file_i].url = url; | |||
filename = url.split('/').pop(); | |||
var li = document.querySelectorAll('#file_list li')[file_i]; | |||
li.setAttribute('class','up-over'); | |||
li.querySelector('.namebox span').innerText = filename; | |||
n++ | |||
upAllFiles(n); | |||
},function(err){ | |||
document.querySelector('#topbar .upall').innerText='全部上传'; | |||
document.querySelectorAll('#file_list li.up-now').forEach((el,i)=>{ | |||
el.setAttribute('class','up-no'); | |||
}); | |||
alert(err); | |||
}); | |||
} | |||
} | |||
document.querySelector('#topbar .upall').addEventListener('click',(e)=>{ | |||
if(e.target.innerText!='全部上传'){return false;} | |||
if(axupimgs.res.length>0){ | |||
document.querySelectorAll('#file_list li.up-no').forEach((el,i)=>{ | |||
el.classList ? el.classList.add('up-now') : el.className+=' up-now'; | |||
}); | |||
e.target.innerText='上传中'; | |||
upAllFiles(0); | |||
} | |||
}); | |||
var observ_flist = new MutationObserver( (muList,observe)=>{ | |||
if(muList[0].addedNodes.length>0){ | |||
muList[0].addedNodes.forEach((el)=>{ | |||
el.querySelector('.remove').addEventListener('click',(e)=>{ | |||
var li = e.target.parentNode.parentNode; | |||
var n = li.getAttribute('data-num'); | |||
var el = document.querySelectorAll('#file_list li')[n]; | |||
el.parentNode.removeChild(el); | |||
axupimgs.res.splice(n,1); | |||
}); | |||
}); | |||
} | |||
reSort(); | |||
}); | |||
observ_flist.observe(document.querySelector('#file_list'),{childList:true}); | |||
</script> | |||
</body> | |||
</html> |
@@ -1,175 +1,172 @@ | |||
<?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="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} | |||
table{background:#fff} | |||
a{text-decoration:none!important} | |||
.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:#dc3545' "; | |||
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:#dc3545' "; | |||
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> |
@@ -1,104 +1,100 @@ | |||
<?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; | |||
$mime = get_mime_type($uploadfile); | |||
if (preg_match("#^unknow#", $mime)) { | |||
ShowMsg("系统不支持fileinfo组件,建议php.ini中开启", -1); | |||
exit; | |||
} | |||
if (!preg_match("#^(image|video|audio|application)#i", $mime)) { | |||
ShowMsg("仅支持媒体文件及应用程序上传", -1); | |||
exit; | |||
} | |||
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(); | |||
} |
@@ -1,201 +1,194 @@ | |||
<?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} | |||
table{background:#fff} | |||
a{text-decoration:none!important} | |||
.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:#dc3545' "; | |||
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:#dc3545' "; | |||
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:#dc3545' "; | |||
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:#dc3545' "; | |||
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:#dc3545' "; | |||
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:#dc3545' "; | |||
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> |
@@ -1,44 +1,39 @@ | |||
<?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 = $uploadfile_name; | |||
} | |||
$filename = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $filename)); | |||
if ($filename == '' || !preg_match("#\.(".$cfg_txttype.")#i", $filename)) { | |||
ShowMsg("您所上传的文件存在问题,请检查文件类型是否适合", "-1"); | |||
} | |||
$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(); |
@@ -1,64 +1,69 @@ | |||
<?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:#dc3545'>'自定义表单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(); | |||
} | |||
if ($cfg_dbtype=="sqlite") { | |||
$query = " SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"; | |||
} else { | |||
$query = "SHOW TABLES"; | |||
} | |||
$dsql->SetQuery($query); | |||
$dsql->Execute("biz"); | |||
while ($row = $dsql->GetArray("biz")) { | |||
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'); | |||
} | |||
} |