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

87 lines
3.2KB

  1. <?php
  2. /**
  3. * 投票模块
  4. *
  5. * @version $Id: vote_add.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. require_once(DEDEINC."/dedevote.class.php");
  13. require_once(DEDEINC."/helpers/filter.helper.php");
  14. CheckPurview('plus_投票模块');
  15. if(empty($dopost)) $dopost = "";
  16. if(empty($isarc)) $isarc = 0;
  17. if($dopost=="save" && $isarc == 0)
  18. {
  19. $starttime = GetMkTime($starttime);
  20. $endtime = GetMkTime($endtime);
  21. $voteitems = "";
  22. $j = 0;
  23. for($i=1; $i<=15; $i++)
  24. {
  25. if(!empty(${"voteitem".$i}))
  26. {
  27. $j++;
  28. $voteitems .= "<v:note id=\\'$j\\' count=\\'0\\'>".${"voteitem".$i}."</v:note>\r\n";
  29. }
  30. }
  31. $inQuery = "INSERT INTO `#@__vote`(votename,starttime,endtime,totalcount,ismore,votenote,isallow,view,spec,isenable)
  32. VALUES('$votename','$starttime','$endtime','0','$ismore','$voteitems','$isallow','$view','$spec','$isenable'); ";
  33. if(!$dsql->ExecuteNoneQuery($inQuery))
  34. {
  35. ShowMsg("增加投票失败,请检查数据是否非法!","-1");
  36. exit();
  37. }
  38. $aid = $dsql->GetLastID();
  39. $vt = new DedeVote($aid);
  40. $vote_content = $vt->GetVoteForm();
  41. $vote_content = preg_replace(array("#/#","#([\r\n])[\s]+#"),array("\/"," "),$vote_content);//取出内容中的空白字符并进行转义
  42. $vote_content = 'document.write("'.$vote_content.'");';
  43. $vote_file = DEDEDATA."/vote/vote_".$aid.".js";
  44. file_put_contents($vote_file, $vote_content);
  45. ShowMsg("成功增加一组投票!","vote_main.php");
  46. exit();
  47. }
  48. else if($dopost=="save" && $isarc == 1)
  49. {
  50. $starttime = GetMkTime($starttime);
  51. $endtime = GetMkTime($endtime);
  52. $voteitems = "";
  53. $j = 0;
  54. for($i=1; $i<=15; $i++)
  55. {
  56. if(!empty(${"voteitem".$i}))
  57. {
  58. $j++;
  59. $voteitems .= "<v:note id=\\'$j\\' count=\\'0\\'>".${"voteitem".$i}."</v:note>\r\n";
  60. }
  61. }
  62. $inQuery = "INSERT INTO `#@__vote`(votename,starttime,endtime,totalcount,ismore,votenote,isallow,view,spec,isenable)
  63. VALUES('$votename','$starttime','$endtime','0','$ismore','$voteitems','$isallow','$view','$spec','$isenable'); ";
  64. if(!$dsql->ExecuteNoneQuery($inQuery))
  65. {
  66. ShowMsg("增加投票失败,请检查数据是否非法!","-1");
  67. exit();
  68. }
  69. $aid = $dsql->GetLastID();
  70. $vt = new DedeVote($aid);
  71. $vote_content = $vt->GetVoteForm();
  72. $vote_content = preg_replace(array("#/#","#([\r\n])[\s]+#"),array("\/"," "),$vote_content);//取出内容中的空白字符并进行转义
  73. $vote_content = 'document.write("'.$vote_content.'");';
  74. $vote_file = DEDEDATA."/vote/vote_".$aid.".js";
  75. file_put_contents($vote_file, $vote_content);
  76. ShowMsg("成功增加一组投票!","vote_main.php?issel=1&aid=".$aid);
  77. exit();
  78. }
  79. $startDay = time();
  80. $endDay = AddDay($startDay,30);
  81. $startDay = GetDateTimeMk($startDay);
  82. $endDay = GetDateTimeMk($endDay);
  83. include DedeInclude('templets/vote_add.htm');