国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.2KB

  1. <?php
  2. /**
  3. * 广告编辑
  4. *
  5. * @version $Id: ad_edit.php 1 8:26 2010年7月12日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2019, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. require(dirname(__FILE__)."/config.php");
  12. CheckPurview('plus_广告管理');
  13. require_once(DEDEINC.'/typelink.class.php');
  14. if(empty($dopost)) $dopost = '';
  15. $aid = preg_replace("#[^0-9]#", '', $aid);
  16. $ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "ad_main.php" : $_COOKIE['ENV_GOBACK_URL'];
  17. if($dopost=='delete')
  18. {
  19. $dsql->ExecuteNoneQuery("DELETE FROM `#@__myad` WHERE aid='$aid' ");
  20. ShowMsg("成功删除一则广告代码!",$ENV_GOBACK_URL);
  21. exit();
  22. }
  23. else if($dopost=="gettag")
  24. {
  25. require_once(DEDEINC.'/oxwindow.class.php');
  26. $jscode = "<script src='{$cfg_phpurl}/ad_js.php?aid=$aid' language='javascript'></script>";
  27. $showhtml = "<xmp style='color:#333333;background-color:#ffffff'>\r\n\r\n$jscode\r\n\r\n</xmp>";
  28. $showhtml .= "预览:<iframe name='testfrm' frameborder='0' src='ad_edit.php?aid={$aid}&dopost=testjs' id='testfrm' width='100%' height='200'></iframe>";
  29. $row = $dsql->GetOne("SELECT tagname from `#@__myad` WHERE aid='$aid' ");
  30. $showtag = '{'."dede:myad name='{$row['tagname']}'/".'}';
  31. $info = "<b>说明:</b>如果嵌入的是织梦CMS广告标签,那么将会解析成标签中的内容到页面,广告更改后需要重新生成。<br />
  32. 如果不希望重新生成所有页面,则直接调用JS代码即可。
  33. ";
  34. $wintitle = "广告管理-获取广告标签";
  35. $wecome_info = "<a href='ad_main.php'><u>广告管理</u></a>::获取JS";
  36. $win = new OxWindow();
  37. $win->Init();
  38. $winform = $win->GetWindow("hand",$info);
  39. $win->AddTitle("织梦CMS标签调用代码:");
  40. $winform = $win->GetWindow("hand",$showtag);
  41. $win->myWinItem = '';
  42. $win->AddTitle("以下为选定广告的JS调用代码:");
  43. $winform = $win->GetWindow("hand",$showhtml);
  44. $win->Display();
  45. exit();
  46. }
  47. else if($dopost=='testjs')
  48. {
  49. echo "<script src='{$cfg_phpurl}/ad_js.php?aid=$aid&nocache=1' language='javascript'></script>";
  50. exit();
  51. }
  52. else if($dopost=='saveedit')
  53. {
  54. csrf_check();
  55. $starttime = GetMkTime($starttime);
  56. $endtime = GetMkTime($endtime);
  57. $query = "UPDATE `#@__myad`
  58. SET
  59. clsid='$clsid',
  60. typeid='$typeid',
  61. adname='$adname',
  62. timeset='$timeset',
  63. starttime='$starttime',
  64. endtime='$endtime',
  65. normbody='$normbody',
  66. expbody='$expbody'
  67. WHERE aid='$aid'
  68. ";
  69. $dsql->ExecuteNoneQuery($query);
  70. ShowMsg("成功更改一则广告代码!",$ENV_GOBACK_URL);
  71. exit();
  72. }
  73. $row = $dsql->GetOne("SELECT * FROM `#@__myad` WHERE aid='$aid'");
  74. $dsql->Execute('dd','SELECT * FROM `#@__myadtype` ORDER BY id DESC');
  75. $option = '';
  76. while($arr = $dsql->GetArray('dd'))
  77. {
  78. if ($arr['id'] == $row['clsid'])
  79. {
  80. $option .= "<option value='{$arr['id']}' selected='selected'>{$arr['typename']}</option>\n\r";
  81. } else {
  82. $option .= "<option value='{$arr['id']}'>{$arr['typename']}</option>\n\r";
  83. }
  84. }
  85. include DedeInclude('templets/ad_edit.htm');