国内流行的内容管理系统(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.

75 lines
2.3KB

  1. <?php
  2. /**
  3. * 投票模块编辑
  4. *
  5. * @version $Id: vote_edit.php 1 23:54 2010年7月20日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require(dirname(__FILE__)."/config.php");
  12. CheckPurview('plus_投票模块');
  13. require_once(DEDEINC."/dedetag.class.php");
  14. if(empty($dopost)) $dopost="";
  15. $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
  16. $ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "vote_main.php" : $_COOKIE['ENV_GOBACK_URL'];
  17. if($dopost=="delete")
  18. {
  19. if($dsql->ExecuteNoneQuery("DELETE FROM `#@__vote` WHERE aid='$aid'"))
  20. {
  21. if($dsql->ExecuteNoneQuery("DELETE FROM `#@__vote_member` WHERE voteid='$aid'"))
  22. {
  23. ShowMsg('成功删除一组投票!', $ENV_GOBACK_URL);
  24. exit;
  25. }
  26. }
  27. else
  28. {
  29. ShowMsg('指定删除投票不存在!', $ENV_GOBACK_URL);
  30. exit;
  31. }
  32. }
  33. else if($dopost=="saveedit")
  34. {
  35. $starttime = GetMkTime($starttime);
  36. $endtime = GetMkTime($endtime);
  37. $query = "UPDATE `#@__vote` SET votename='$votename',
  38. starttime='$starttime',
  39. endtime='$endtime',
  40. totalcount='$totalcount',
  41. ismore='$ismore',
  42. votenote='$votenote',
  43. isallow='$isallow',
  44. view='$view',
  45. spec='$spec',
  46. isenable='$isenable'
  47. WHERE aid='$aid'
  48. ";
  49. if($dsql->ExecuteNoneQuery($query))
  50. {
  51. $vt = new DedeVote($aid);
  52. $vote_file = DEDEDATA."/vote/vote_".$aid.".js";
  53. $vote_content = $vt->GetVoteForm();
  54. $vote_content = preg_replace(array("#/#","#([\r\n])[\s]+#"),array("\/"," "),$vote_content); //取出内容中的空白字符并进行转义
  55. $vote_content = 'document.write("'.$vote_content.'");';
  56. file_put_contents($vote_file,$vote_content);
  57. ShowMsg('成功更改一组投票!',$ENV_GOBACK_URL);
  58. }
  59. else
  60. {
  61. ShowMsg('更改一组投票失败!',$ENV_GOBACK_URL);
  62. }
  63. }
  64. else
  65. {
  66. $row = $dsql->GetOne("SELECT * FROM #@__vote WHERE aid='$aid'");
  67. if(!is_array($row))
  68. {
  69. ShowMsg('指定投票不存在!', '-1');
  70. exit();
  71. }
  72. include DedeInclude('templets/vote_edit.htm');
  73. }