magic_downdateline.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: magic_downdateline.php 26749 2011-12-22 07:38:37Z chenmengshu $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class magic_downdateline {
  12. var $version = '1.0';
  13. var $name = 'downdateline_name';
  14. var $description = 'downdateline_desc';
  15. var $price = '20';
  16. var $weight = '20';
  17. var $useevent = 0;
  18. var $targetgroupperm = false;
  19. var $copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>';
  20. var $magic = array();
  21. var $parameters = array();
  22. function getsetting(&$magic) {}
  23. function setsetting(&$magicnew, &$parameters) {}
  24. function usesubmit() {
  25. global $_G;
  26. $id = intval($_GET['id']);
  27. $idtype = $_GET['idtype'];
  28. $blog = magic_check_idtype($id, $idtype);
  29. $newdateline = strtotime($_POST['newdateline']);
  30. if(!$_POST['newdateline'] || $newdateline < strtotime('1970-1-1') || $newdateline > $blog['dateline']) {
  31. showmessage('magicuse_bad_dateline');
  32. }
  33. $tablename = gettablebyidtype($idtype);
  34. C::t($tablename)->update_dateline_by_id_idtype_uid($id, $idtype, $newdateline, $_G['uid']);
  35. C::t('home_feed')->update($id, array('dateline'=>$newdateline), $idtype, $_G['uid']);
  36. usemagic($this->magic['magicid'], $this->magic['num']);
  37. updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
  38. showmessage('magics_use_success', '', array('magicname'=>$_G['setting']['magics']['downdateline']), array('alert' => 'right', 'showdialog' => 1));
  39. }
  40. function show() {
  41. $id = intval($_GET['id']);
  42. $idtype = $_GET['idtype'];
  43. $blog = magic_check_idtype($id, $idtype);
  44. magicshowtips(lang('magic/downdateline', 'downdateline_info'));
  45. $time = dgmdate($blog['dateline'], 'Y-m-d H:i');
  46. $op='use';
  47. include template('home/magic_downdateline');
  48. }
  49. }
  50. ?>