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

65 lines
2.3KB

  1. <?php
  2. /**
  3. * 投票模块编辑
  4. *
  5. * @version $Id: vote_edit.php 1 23:54 2010年7月20日Z tianya $
  6. * @package DedeBIZ.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. if ($dsql->ExecuteNoneQuery("DELETE FROM `#@__vote` WHERE aid='$aid'")) {
  19. if ($dsql->ExecuteNoneQuery("DELETE FROM `#@__vote_member` WHERE voteid='$aid'")) {
  20. ShowMsg('成功删除一组投票!', $ENV_GOBACK_URL);
  21. exit;
  22. }
  23. } else {
  24. ShowMsg('指定删除投票不存在!', $ENV_GOBACK_URL);
  25. exit;
  26. }
  27. } else if ($dopost == "saveedit") {
  28. CheckCSRF();
  29. $starttime = GetMkTime($starttime);
  30. $endtime = GetMkTime($endtime);
  31. $query = "UPDATE `#@__vote` SET votename='$votename',
  32. starttime='$starttime',
  33. endtime='$endtime',
  34. totalcount='$totalcount',
  35. ismore='$ismore',
  36. votenote='$votenote',
  37. isallow='$isallow',
  38. view='$view',
  39. spec='$spec',
  40. isenable='$isenable'
  41. WHERE aid='$aid'
  42. ";
  43. if ($dsql->ExecuteNoneQuery($query)) {
  44. $vt = new DedeVote($aid);
  45. $vote_file = DEDEDATA . "/vote/vote_" . $aid . ".js";
  46. $vote_content = $vt->GetVoteForm();
  47. $vote_content = preg_replace(array("#/#", "#([\r\n])[\s]+#"), array("\/", " "), $vote_content); //取出内容中的空白字符并进行转义
  48. $vote_content = 'document.write("' . $vote_content . '");';
  49. file_put_contents($vote_file, $vote_content);
  50. ShowMsg('成功更改一组投票!', $ENV_GOBACK_URL);
  51. } else {
  52. ShowMsg('更改一组投票失败!', $ENV_GOBACK_URL);
  53. }
  54. } else {
  55. $row = $dsql->GetOne("SELECT * FROM #@__vote WHERE aid='$aid'");
  56. if (!is_array($row)) {
  57. ShowMsg('指定投票不存在!', '-1');
  58. exit();
  59. }
  60. include DedeInclude('templets/vote_edit.htm');
  61. }