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

51 lines
2.1KB

  1. <?php
  2. /**
  3. * 修改投票
  4. *
  5. * @version $id:vote_edit.php 23:54 2010年7月20日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license GNU GPL v2 (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',starttime='$starttime',endtime='$endtime',totalcount='$totalcount',ismore='$ismore',votenote='$votenote',isallow='$isallow',view='$view',spec='$spec',isenable='$isenable' WHERE aid='$aid'";
  32. if ($dsql->ExecuteNoneQuery($query)) {
  33. $vt = new DedeVote($aid);
  34. $vote_file = DEDEDATA."/vote/vote_".$aid.".js";
  35. $vote_content = $vt->GetVoteForm();
  36. $vote_content = preg_replace(array("#/#", "#([\r\n])[\s]+#"), array("\/", " "), $vote_content); //取出文档中的空白字符并进行转义
  37. $vote_content = 'document.write("'.$vote_content.'");';
  38. file_put_contents($vote_file, $vote_content);
  39. ShowMsg('成功修改一组投票', $ENV_GOBACK_URL);
  40. } else {
  41. ShowMsg('修改一组投票失败', $ENV_GOBACK_URL);
  42. }
  43. } else {
  44. $row = $dsql->GetOne("SELECT * FROM `#@__vote` WHERE aid='$aid'");
  45. if (!is_array($row)) {
  46. ShowMsg('指定投票不存在', '-1');
  47. exit();
  48. }
  49. include DedeInclude('templets/vote_edit.htm');
  50. }
  51. ?>