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

76 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. CheckCSRF();
  36. $starttime = GetMkTime($starttime);
  37. $endtime = GetMkTime($endtime);
  38. $query = "UPDATE `#@__vote` SET votename='$votename',
  39. starttime='$starttime',
  40. endtime='$endtime',
  41. totalcount='$totalcount',
  42. ismore='$ismore',
  43. votenote='$votenote',
  44. isallow='$isallow',
  45. view='$view',
  46. spec='$spec',
  47. isenable='$isenable'
  48. WHERE aid='$aid'
  49. ";
  50. if($dsql->ExecuteNoneQuery($query))
  51. {
  52. $vt = new DedeVote($aid);
  53. $vote_file = DEDEDATA."/vote/vote_".$aid.".js";
  54. $vote_content = $vt->GetVoteForm();
  55. $vote_content = preg_replace(array("#/#","#([\r\n])[\s]+#"),array("\/"," "),$vote_content); //取出内容中的空白字符并进行转义
  56. $vote_content = 'document.write("'.$vote_content.'");';
  57. file_put_contents($vote_file,$vote_content);
  58. ShowMsg('成功更改一组投票!',$ENV_GOBACK_URL);
  59. }
  60. else
  61. {
  62. ShowMsg('更改一组投票失败!',$ENV_GOBACK_URL);
  63. }
  64. }
  65. else
  66. {
  67. $row = $dsql->GetOne("SELECT * FROM #@__vote WHERE aid='$aid'");
  68. if(!is_array($row))
  69. {
  70. ShowMsg('指定投票不存在!', '-1');
  71. exit();
  72. }
  73. include DedeInclude('templets/vote_edit.htm');
  74. }