AddSpInfo.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. $link=db_connect();
  7. $empire=new mysqlquery();
  8. $editor=1;
  9. //验证用户
  10. $lur=is_login();
  11. $logininid=$lur['userid'];
  12. $loginin=$lur['username'];
  13. $loginrnd=$lur['rnd'];
  14. $loginlevel=$lur['groupid'];
  15. $loginadminstyleid=$lur['adminstyleid'];
  16. //ehash
  17. $ecms_hashur=hReturnEcmsHashStrAll();
  18. //返回碎片信息内容
  19. function ReturnSpInfoidGetData($add,$userid,$username){
  20. global $empire,$dbtbpre,$class_r,$emod_r;
  21. $idr=explode(',',$add['getinfoid']);
  22. $classid=(int)$idr[0];
  23. $id=(int)$idr[1];
  24. if(!$classid||!$id||!$class_r[$classid][tbname])
  25. {
  26. return '';
  27. }
  28. $mid=$class_r[$classid]['modid'];
  29. $smalltextf=$emod_r[$mid]['smalltextf'];
  30. $sf='';
  31. if($smalltextf&&$smalltextf<>',')
  32. {
  33. $smr=explode(',',$smalltextf);
  34. $sf=$smr[1];
  35. }
  36. $addf='';
  37. if($sf&&!strstr($emod_r[$mid]['tbdataf'],','.$sf.','))
  38. {
  39. $addf=','.$sf;
  40. }
  41. $index_r=$empire->fetch1("select id,checked from {$dbtbpre}ecms_".$class_r[$classid][tbname]."_index where id='$id' limit 1");
  42. if(!$index_r['id'])
  43. {
  44. return '';
  45. }
  46. //返回表
  47. $infotb=ReturnInfoMainTbname($class_r[$classid][tbname],$index_r['checked']);
  48. $infor=$empire->fetch1("select id,classid,isurl,titleurl,isgood,firsttitle,plnum,totaldown,onclick,newstime,titlepic,title,stb".$addf." from ".$infotb." where id='$id' limit 1");
  49. if($sf&&!$addf)
  50. {
  51. //返回表信息
  52. $infodatatb=ReturnInfoDataTbname($class_r[$classid][tbname],$index_r['checked'],$infor['stb']);
  53. $finfor=$empire->fetch1("select ".$sf." from ".$infodatatb." where id='$id' limit 1");
  54. $infor[$sf]=$finfor[$sf];
  55. }
  56. $ret_r['title']=$infor[title];
  57. $ret_r['titleurl']=sys_ReturnBqTitleLink($infor);
  58. $ret_r['titlepic']=$infor[titlepic];
  59. $ret_r['smalltext']=$infor[$sf];
  60. $ret_r['newstime']=$infor[newstime];
  61. return $ret_r;
  62. }
  63. $spid=(int)$_GET['spid'];
  64. //碎片
  65. $spr=$empire->fetch1("select spid,spname,varname,sptype,maxnum,groupid,userclass,username from {$dbtbpre}enewssp where spid='$spid'");
  66. if(!$spr['spid'])
  67. {
  68. printerror('ErrorUrl','');
  69. }
  70. //验证操作权限
  71. CheckDoLevel($lur,$spr[groupid],$spr[userclass],$spr[username]);
  72. $enews=ehtmlspecialchars($_GET['enews']);
  73. $postword='增加碎片信息';
  74. $todaytime=date("Y-m-d H:i:s");
  75. $url="<a href=UpdateSp.php".$ecms_hashur['whehref'].">更新碎片</a>&nbsp;>&nbsp;<a href=ListSpInfo.php?spid=$spid".$ecms_hashur['ehref'].">".$spr[spname]."</a>&nbsp;>&nbsp;增加碎片信息";
  76. $filepass=$spid;
  77. //修改
  78. if($enews=="EditSpInfo")
  79. {
  80. $postword='修改碎片信息';
  81. $sid=(int)$_GET['sid'];
  82. if($spr[sptype]==1)
  83. {
  84. $r=$empire->fetch1("select * from {$dbtbpre}enewssp_1 where sid='$sid' and spid='$spid'");
  85. $newstime=date('Y-m-d H:i:s',$r[newstime]);
  86. //标题属性
  87. if(strstr($r[titlefont],','))
  88. {
  89. $tfontr=explode(',',$r[titlefont]);
  90. $r[titlecolor]=$tfontr[0];
  91. $r[titlefont]=$tfontr[1];
  92. }
  93. if(strstr($r[titlefont],"b|"))
  94. {
  95. $titlefontb=" checked";
  96. }
  97. if(strstr($r[titlefont],"i|"))
  98. {
  99. $titlefonti=" checked";
  100. }
  101. if(strstr($r[titlefont],"s|"))
  102. {
  103. $titlefonts=" checked";
  104. }
  105. $url="<a href=UpdateSp.php".$ecms_hashur['whehref'].">更新碎片</a>&nbsp;>&nbsp;<a href=ListSpInfo.php?spid=$spid".$ecms_hashur['ehref'].">".$spr[spname]."</a>&nbsp;>&nbsp;修改碎片信息";
  106. }
  107. elseif($spr[sptype]==2)
  108. {
  109. $r=$empire->fetch1("select * from {$dbtbpre}enewssp_2 where sid='$sid' and spid='$spid'");
  110. $newstime=date('Y-m-d H:i:s',$r[newstime]);
  111. $url="<a href=UpdateSp.php".$ecms_hashur['whehref'].">更新碎片</a>&nbsp;>&nbsp;<a href=ListSpInfo.php?spid=$spid".$ecms_hashur['ehref'].">".$spr[spname]."</a>&nbsp;>&nbsp;修改碎片信息";
  112. }
  113. elseif($spr[sptype]==3)
  114. {
  115. $r=$empire->fetch1("select * from {$dbtbpre}enewssp_3 where spid='$spid' limit 1");
  116. $url="<a href=UpdateSp.php".$ecms_hashur['whehref'].">更新碎片</a>&nbsp;>&nbsp;".$spr[spname]."&nbsp;>&nbsp;修改碎片信息";
  117. }
  118. }
  119. //取得信息
  120. $ecms=RepPostStr($_GET['ecms'],1);
  121. if($ecms=='InfoidGetData')
  122. {
  123. include("../../data/dbcache/class.php");
  124. $getinfor=ReturnSpInfoidGetData($_GET,$logininid,$loginin);
  125. if($getinfor['title'])
  126. {
  127. $r['title']=$getinfor['title'];
  128. $r['titlepic']=$getinfor['titlepic'];
  129. $r['titleurl']=$getinfor['titleurl'];
  130. $r['newstime']=$getinfor['newstime'];
  131. $r['smalltext']=$getinfor['smalltext'];
  132. $newstime=date('Y-m-d H:i:s',$r[newstime]);
  133. }
  134. }
  135. ?>
  136. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  137. <html>
  138. <head>
  139. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  140. <title>碎片</title>
  141. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  142. <script>
  143. function foreColor(){
  144. if(!Error()) return;
  145. var arr = showModalDialog("../../data/html/selcolor.html", "", "dialogWidth:296px; dialogHeight:280px; status:0");
  146. if (arr != null) document.form1.titlecolor.value=arr;
  147. else document.form1.titlecolor.focus();
  148. }
  149. </script>
  150. <script>
  151. function ToGetInfo(){
  152. var infoid;
  153. infoid=prompt('请输入信息ID,格式:栏目ID,信息ID',',');
  154. if(infoid==''||infoid==null||infoid==',')
  155. {
  156. return false;
  157. }
  158. self.location.href='AddSpInfo.php?<?=$ecms_hashur['ehref']?>&enews=<?=$enews?>&spid=<?=$spid?>&sid=<?=$sid?>&ecms=InfoidGetData&getinfoid='+infoid;
  159. }
  160. </script>
  161. <script type="text/javascript" src="../ecmseditor/js/jstime/WdatePicker.js"></script>
  162. <script type="text/javascript" src="../ecmseditor/js/jscolor/jscolor.js"></script>
  163. </head>
  164. <body>
  165. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  166. <tr>
  167. <td>位置:<?=$url?></td>
  168. </tr>
  169. </table>
  170. <?php
  171. if($spr['sptype']==1)
  172. {
  173. ?>
  174. <form name="form1" method="post" action="ListSpInfo.php">
  175. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  176. <?=$ecms_hashur['form']?>
  177. <input name="filepass" type="hidden" id="filepass" value="<?=$filepass?>">
  178. <tr class="header">
  179. <td height="25" colspan="2">
  180. <?=$postword?>
  181. </td>
  182. </tr>
  183. <tr bgcolor="#FFFFFF">
  184. <td width="14%" height="25">标题:</td>
  185. <td width="86%" height="25"><input name="title" type="text" id="title" size="60" value="<?=ehtmlspecialchars(stripSlashes($r[title]))?>">
  186. <input type="button" name="Submit5" value="通过信息ID获取" onclick="ToGetInfo();"> </td>
  187. </tr>
  188. <tr bgcolor="#FFFFFF">
  189. <td height="25">标题链接:</td>
  190. <td height="25"><input name="titleurl" type="text" id="titleurl" size="60" value="<?=stripSlashes($r[titleurl])?>"></td>
  191. </tr>
  192. <tr bgcolor="#FFFFFF">
  193. <td height="25">标题属性:</td>
  194. <td height="25"> <table width="100%" border="0" cellspacing="1" cellpadding="3">
  195. <tr>
  196. <td> <input name="titlefont[b]" type="checkbox" value="b"<?=$titlefontb?>>
  197. 粗体
  198. <input name="titlefont[i]" type="checkbox" value="i"<?=$titlefonti?>>
  199. 斜体
  200. <input name="titlefont[s]" type="checkbox" value="s"<?=$titlefonts?>>
  201. 删除线 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;颜色:
  202. <input name="titlecolor" type="text" value="<?=stripSlashes($r[titlecolor])?>" size="10" class="color">
  203. </td>
  204. </tr>
  205. <tr>
  206. <td>左边:
  207. <input name="titlepre" type="text" id="titlepre3" value="<?=ehtmlspecialchars(stripSlashes($r[titlepre]))?>" size="21">
  208. 右边:
  209. <input name="titlenext" type="text" id="titlenext" value="<?=ehtmlspecialchars(stripSlashes($r[titlenext]))?>" size="21">
  210. </td>
  211. </tr>
  212. </table></td>
  213. </tr>
  214. <tr bgcolor="#FFFFFF">
  215. <td height="25">标题缩图:</td>
  216. <td height="25"><input name="titlepic" type="text" id="titlepic" size="60" value="<?=stripSlashes($r[titlepic])?>">
  217. <a onclick="window.open('../ecmseditor/FileMain.php?<?=$ecms_hashur['ehref']?>&modtype=7&type=1&classid=&doing=2&field=titlepic&filepass=<?=$filepass?>&sinfo=1','','width=700,height=550,scrollbars=yes');" title="选择已上传的图片"><img src="../../data/images/changeimg.gif" alt="选择/上传图片" width="22" height="22" border="0" align="absbottom"></a></td>
  218. </tr>
  219. <tr bgcolor="#FFFFFF">
  220. <td height="25">标题大图:</td>
  221. <td height="25"><input name="bigpic" type="text" id="bigpic" size="60" value="<?=stripSlashes($r[bigpic])?>">
  222. <a onclick="window.open('../ecmseditor/FileMain.php?<?=$ecms_hashur['ehref']?>&modtype=7&type=1&classid=&doing=2&field=bigpic&filepass=<?=$filepass?>&sinfo=1','','width=700,height=550,scrollbars=yes');" title="选择已上传的图片"><img src="../../data/images/changeimg.gif" alt="选择/上传图片" width="22" height="22" border="0" align="absbottom"></a></td>
  223. </tr>
  224. <tr bgcolor="#FFFFFF">
  225. <td height="25">发布时间:</td>
  226. <td height="25"><input name="newstime" type="text" id="title3" size="60" value="<?=$newstime?>" class="Wdate" onClick="WdatePicker({skin:'default',dateFmt:'yyyy-MM-dd HH:mm:ss'})">
  227. <input type="button" name="Submit3" value="当前时间" onclick="document.form1.newstime.value='<?=$todaytime?>';"></td>
  228. </tr>
  229. <tr bgcolor="#FFFFFF">
  230. <td height="25">内容简介:</td>
  231. <td height="25"><textarea name="smalltext" cols="60" rows="5" id="smalltext"><?=ehtmlspecialchars(stripSlashes($r[smalltext]))?></textarea></td>
  232. </tr>
  233. <tr bgcolor="#FFFFFF">
  234. <td height="25">&nbsp;</td>
  235. <td height="25"><input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置">
  236. <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> <input name="sid" type="hidden" id="sid" value="<?=$r['sid']?>">
  237. <input name="spid" type="hidden" id="spid" value="<?=$spid?>"></td>
  238. </tr>
  239. </table>
  240. </form>
  241. <?php
  242. }
  243. elseif($spr['sptype']==2)
  244. {
  245. ?>
  246. <form name="form1" method="post" action="ListSpInfo.php">
  247. <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  248. <?=$ecms_hashur['form']?>
  249. <input name="filepass" type="hidden" id="filepass" value="<?=$filepass?>">
  250. <tr class="header">
  251. <td height="25" colspan="2">
  252. <?=$postword?>
  253. </td>
  254. </tr>
  255. <tr bgcolor="#FFFFFF">
  256. <td width="14%" height="25">信息位置:</td>
  257. <td width="86%" height="25">栏目ID:
  258. <input name="classid" type="text" id="titlepre5" value="<?=$r[classid]?>" size="21">
  259. 信息ID:
  260. <input name="id" type="text" id="classid" value="<?=$r[id]?>" size="21"></td>
  261. </tr>
  262. <tr bgcolor="#FFFFFF">
  263. <td height="25">发布时间:</td>
  264. <td height="25"><input name="newstime" type="text" id="newstime" size="60" value="<?=$newstime?>" class="Wdate" onClick="WdatePicker({skin:'default',dateFmt:'yyyy-MM-dd HH:mm:ss'})">
  265. <input type="button" name="Submit32" value="当前时间" onclick="document.form1.newstime.value='<?=$todaytime?>';"></td>
  266. </tr>
  267. <tr bgcolor="#FFFFFF">
  268. <td height="25">&nbsp;</td>
  269. <td height="25"><input type="submit" name="Submit4" value="提交"> <input type="reset" name="Submit22" value="重置">
  270. <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> <input name="sid" type="hidden" id="sid3" value="<?=$r['sid']?>">
  271. <input name="spid" type="hidden" id="spid" value="<?=$spid?>"></td>
  272. </tr>
  273. <tr bgcolor="#FFFFFF">
  274. <td height="25">&nbsp;</td>
  275. <td height="25"><font color="#666666">不设置时间直接读取信息本身的发布时间.</font></td>
  276. </tr>
  277. </table>
  278. </form>
  279. <?php
  280. }
  281. elseif($spr['sptype']==3)
  282. {
  283. ?>
  284. <script>
  285. function ReSpInfoBak(){
  286. self.location.href='AddSpInfo.php?<?=$ecms_hashur['ehref']?>&enews=EditSpInfo&spid=<?=$spid?>';
  287. }
  288. </script>
  289. <form name="form1" method="post" action="ListSpInfo.php">
  290. <table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  291. <?=$ecms_hashur['form']?>
  292. <input name="filepass" type="hidden" id="filepass" value="<?=$filepass?>">
  293. <tr class="header">
  294. <td height="25">
  295. <div align="center"><?=$postword?></div></td>
  296. </tr>
  297. <tr bgcolor="#FFFFFF">
  298. <td width="86%" height="25"><div align="center">
  299. <textarea name="sptext" cols="80" rows="27" id="sptext" style="WIDTH: 100%"><?=ehtmlspecialchars(stripSlashes($r[sptext]))?></textarea>
  300. </div></td>
  301. </tr>
  302. <tr bgcolor="#FFFFFF">
  303. <td height="25"><div align="center">
  304. <input type="submit" name="Submit4" value="提交">&nbsp;&nbsp;
  305. &nbsp;&nbsp;<input type="reset" name="Submit22" value="重置">
  306. &nbsp;&nbsp; [<a href="#ecms" onclick="window.open('../template/editor.php?<?=$ecms_hashur['ehref']?>&getvar=opener.document.form1.sptext.value&returnvar=opener.document.form1.sptext.value&fun=ReturnHtml&notfullpage=1','edittemp','width=880,height=600,scrollbars=auto,resizable=yes');">可视化编辑</a>]&nbsp;&nbsp;[<a href="#empirecms" onclick="window.open('SpInfoBak.php?spid=<?=$r[spid]?>&sid=<?=$r['sid']?><?=$ecms_hashur['ehref']?>','ViewSpInfoBak','width=450,height=500,scrollbars=yes,left=300,top=150,resizable=yes');">修改记录</a>]
  307. <input name="enews" type="hidden" id="enews" value="<?=$enews?>">
  308. <input name="sid" type="hidden" id="sid" value="<?=$r['sid']?>">
  309. <input name="spid" type="hidden" id="spid" value="<?=$spid?>">
  310. </div></td>
  311. </tr>
  312. </table>
  313. </form>
  314. <?php
  315. }
  316. ?>
  317. </body>
  318. </html>
  319. <?php
  320. db_close();
  321. $empire=null;
  322. ?>