帝国cms批量推送信息到标题分类
时间:2023年08月06日
/来源:网络
/编辑:佚名
1、将下列代码存放到e/admin/pushinfotype/文件夹下,并且命名为:PushToInfoType.php,注意要修改75行,83行的数据库表前缀zhuanti_,76行模型id号。
<?php
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
define('EmpireCMSAdmin','1');
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../class/functions.php");
require "../".LoadLang("pub/fun.php");
require("../../class/t_functions.php");
require("../../data/dbcache/class.php");
require("../../data/dbcache/MemberLevel.php");
require("../../class/chtmlfun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//验证用户
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
//推送信息到标题分类
function PushInfoToType($add,$userid,$username){
global $empire,$dbtbpre,$lur,$class_r;
$classid=(int)$add['classid'];
$cid=(int)$add['cid'];
$id=explode(',',$add[ids]);
$count=count($id);
//表名
$tbname='';
if($classid)
{
$tbname=$class_r[$classid]['tbname'];
}
if(!$tbname)
{
printerror('ErrorUrl','');
}
for($i=0;$i<$count;$i++)
{
$myid=intval($id[$i]);
$empire->query("update {$dbtbpre}ecms_".$tbname." SET ttid='$cid' where classid='$classid' and id='$myid'");
}
ReTtHtml($cid); //刷新标题分类
echo"<script>alert('标题分类成功');window.close();</script>";
exit();
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews=='PushInfoToType')//推送标题分类
{
PushInfoToType($_POST,$logininid,$loginin);
}
$add='';
//分类
$cid=(int)$_GET['cid'];
//栏目
$classid=(int)$_GET['classid'];
//ID
$ids=RepPostStr($_GET['id'],1);
if(!$ids)
{
echo"<script>alert('请选择信息');window.close();</script>";
exit();
}
//标题分类
$cttidswhere='';
$tts='';
$caddr=$empire->fetch1("select ttids from zhuanti_enewsclassadd where classid='$classid'");
$modid=7;
if($caddr['ttids']!='-')
{
if($caddr['ttids']&&$caddr['ttids']!=',')
{
$cttidswhere=' and typeid in ('.substr($caddr['ttids'],1,-1).')';
}
$ttsql=$empire->query("select typeid,tname from zhuanti_enewsinfotype where mid='$modid'".$cttidswhere." order by myorder");
while($ttr=$empire->fetch($ttsql))
{
$select='';
$tts.="<option value='$ttr[typeid]'".$select.">$ttr[tname]</option>";
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>推送信息到标题分类</title>
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td>位置: 设置信息标题分类
<div align="right"> </div></td>
</tr>
</table>
<form name="form1" method="post" action="PushToInfoType.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<?=$ecms_hashur['form']?>
<tr>
<td>信息ID:<?=$ids?></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr class="header">
<td width="100%" height="25"> <div align="center">所属分类</div></td>
</tr>
<tr bgcolor="#FFFFFF" id="chsp">
<td>
<div align="center">
<?=$tts?"<select name='cid'><option value='0'>标题分类</option>$tts</select>":""?>
</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" colspan="2"><div align="center">
<input type="submit" name="Submit2" value="确定推送">
<input type="button" name="Submit3" value="取消" onclick="window.close();">
<input name="enews" type="hidden" id="enews" value="PushInfoToType">
<input name="classid" type="hidden" id="classid" value="<?=$classid?>">
<input name="ids" type="hidden" id="ids" value="<?=$ids?>">
</div></td>
</tr>
</table>
</form>
</body>
</html>
<?
db_close();
$empire=null;
?>
如图:

帝国cms批量推送信息到标题分类
2、修改/e/data/html/list/listinfo.php文件
//在</script>之前,加上下面的代码:
function PushToInfoType(form)
{
var id='';
id=GetSelectId(form);
if(id=='')
{
alert('请选择要推送的信息');
return false;
}
window.open('pushinfotype/PushToInfoType.php?<?=$ecms_hashur['ehref']?>&classid=<?=$classid?>&id='+id,'PushToInfoType','width=360,height=500,scrollbars=yes,left=300,top=150,resizable=yes');
}
3、在(大概396行)这行下增加::
<input type="button" name="Submit52" value="推送至专题" onClick="PushInfoToZt(this.form);">
(大概396行)这行下增加:
<input type="button" name="Submit54" value="推送标题分类" onClick="PushToInfoType(this.form);">
4、保存后,到后台看有没有推送按钮,测试是否成功


帝国cms批量推送信息到标题分类
<?php
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
define('EmpireCMSAdmin','1');
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../class/functions.php");
require "../".LoadLang("pub/fun.php");
require("../../class/t_functions.php");
require("../../data/dbcache/class.php");
require("../../data/dbcache/MemberLevel.php");
require("../../class/chtmlfun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//验证用户
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
//推送信息到标题分类
function PushInfoToType($add,$userid,$username){
global $empire,$dbtbpre,$lur,$class_r;
$classid=(int)$add['classid'];
$cid=(int)$add['cid'];
$id=explode(',',$add[ids]);
$count=count($id);
//表名
$tbname='';
if($classid)
{
$tbname=$class_r[$classid]['tbname'];
}
if(!$tbname)
{
printerror('ErrorUrl','');
}
for($i=0;$i<$count;$i++)
{
$myid=intval($id[$i]);
$empire->query("update {$dbtbpre}ecms_".$tbname." SET ttid='$cid' where classid='$classid' and id='$myid'");
}
ReTtHtml($cid); //刷新标题分类
echo"<script>alert('标题分类成功');window.close();</script>";
exit();
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews=='PushInfoToType')//推送标题分类
{
PushInfoToType($_POST,$logininid,$loginin);
}
$add='';
//分类
$cid=(int)$_GET['cid'];
//栏目
$classid=(int)$_GET['classid'];
//ID
$ids=RepPostStr($_GET['id'],1);
if(!$ids)
{
echo"<script>alert('请选择信息');window.close();</script>";
exit();
}
//标题分类
$cttidswhere='';
$tts='';
$caddr=$empire->fetch1("select ttids from zhuanti_enewsclassadd where classid='$classid'");
$modid=7;
if($caddr['ttids']!='-')
{
if($caddr['ttids']&&$caddr['ttids']!=',')
{
$cttidswhere=' and typeid in ('.substr($caddr['ttids'],1,-1).')';
}
$ttsql=$empire->query("select typeid,tname from zhuanti_enewsinfotype where mid='$modid'".$cttidswhere." order by myorder");
while($ttr=$empire->fetch($ttsql))
{
$select='';
$tts.="<option value='$ttr[typeid]'".$select.">$ttr[tname]</option>";
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>推送信息到标题分类</title>
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td>位置: 设置信息标题分类
<div align="right"> </div></td>
</tr>
</table>
<form name="form1" method="post" action="PushToInfoType.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<?=$ecms_hashur['form']?>
<tr>
<td>信息ID:<?=$ids?></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr class="header">
<td width="100%" height="25"> <div align="center">所属分类</div></td>
</tr>
<tr bgcolor="#FFFFFF" id="chsp">
<td>
<div align="center">
<?=$tts?"<select name='cid'><option value='0'>标题分类</option>$tts</select>":""?>
</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" colspan="2"><div align="center">
<input type="submit" name="Submit2" value="确定推送">
<input type="button" name="Submit3" value="取消" onclick="window.close();">
<input name="enews" type="hidden" id="enews" value="PushInfoToType">
<input name="classid" type="hidden" id="classid" value="<?=$classid?>">
<input name="ids" type="hidden" id="ids" value="<?=$ids?>">
</div></td>
</tr>
</table>
</form>
</body>
</html>
<?
db_close();
$empire=null;
?>
如图:

帝国cms批量推送信息到标题分类
2、修改/e/data/html/list/listinfo.php文件
//在</script>之前,加上下面的代码:
function PushToInfoType(form)
{
var id='';
id=GetSelectId(form);
if(id=='')
{
alert('请选择要推送的信息');
return false;
}
window.open('pushinfotype/PushToInfoType.php?<?=$ecms_hashur['ehref']?>&classid=<?=$classid?>&id='+id,'PushToInfoType','width=360,height=500,scrollbars=yes,left=300,top=150,resizable=yes');
}
3、在(大概396行)这行下增加::
<input type="button" name="Submit52" value="推送至专题" onClick="PushInfoToZt(this.form);">
(大概396行)这行下增加:
<input type="button" name="Submit54" value="推送标题分类" onClick="PushToInfoType(this.form);">
4、保存后,到后台看有没有推送按钮,测试是否成功


帝国cms批量推送信息到标题分类
新闻资讯 更多
- 【帝国cms教程】帝国CMS模板变量$GLOBALS[navclassid]用法分析04-03
- 【帝国cms教程】鲜为人知帝国CMS内容页调用上一篇和下一篇的精华方法汇总04-03
- 【帝国cms教程】怎么快速找出帝国CMS数据库配置文件路径及迁移网站后修改技巧!04-03
- 【帝国cms教程】帝国CMS模板$GLOBALS[navclassid]用法详解04-03
- 【帝国cms教程】帝国cms 7.5版列表页分页样式修改笔记04-02
- 【帝国cms教程】解决帝国CMS搜索页面模板不支持灵动标签和万能标签的方法04-02
- 【帝国cms教程】帝国CMS只备份栏目和模板的方法04-02
- 【帝国cms教程】帝国CMS怎样删除清空数据库记录?04-02
热门文章
- 178Moban源码谈谈免费源码与收费源码的区别
- 2帝国CMS忘记后台登陆用户名、密码、认证码的解决方法
- 3帝国CMS(EmpireCMS) v7.5后台任意代码执行漏洞及具体修复方法
- 4帝国CMS和WordPress 哪个好?哪个适合建站?
- 5如何解决Discuz的密码错误次数过多请15分钟后登陆的问题
- 6帝国cms灵动标签取得内容和栏目链接地址
- 7emlog pro 注册码“开心”教程(如果有一天,emlog官方版 或者 emlog免费版 跑路了,那用户怎么办?)
- 8织梦CMS在nginx下设置伪静态方法(附nginx伪静态规则)
- 9帝国cms后台登录出现”您还未登录”怎么解决?
- 10帝国cms7.5忘记登录密码 和忘记登录认证码以及多次登录 失败被锁定解决办法