announce.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. define('CURSCRIPT', 'announce');
  4. require_once dirname(__FILE__) . '/global.php';
  5. require_once MYMPS_INC . '/db.class.php';
  6. $part = $part ? $part : 'all';
  7. if ($part == 'add' || $part == 'edit') {
  8. require_once dirname(__FILE__) . '/include/color.inc.php';
  9. $mymps_title_color = $color;
  10. }
  11. if ($part == 'add') {
  12. chk_admin_purview('purview_发布公告');
  13. $acontent = get_editor('content', 'Normal');
  14. $here = '发布网站公告';
  15. include mymps_tpl('announce_add');
  16. } else {
  17. if ($part == 'insert') {
  18. $db->query('Insert Into `' . $db_mymps . 'announce` (id,title,titlecolor,content,pubdate,begintime,endtime,author,redirecturl) Values (\'\',\'' . $title . '\',\'' . $titlecolor . '\',\'' . $content . '\',\'' . $timestamp . '\',\'' . strtotime($begintime) . '\',\'' . strtotime($endtime) . '\',\'' . $author . '\',\'' . $redirecturl . '\')');
  19. $inid = $db->insert_id();
  20. $message = '成功增加一篇公告';
  21. write_msg($message, 'announce.php');
  22. } else {
  23. if ($part == 'edit') {
  24. if (trim($action) == 'dopost') {
  25. $sql = 'UPDATE `' . $db_mymps . 'announce` SET title=\'' . $title . '\',titlecolor =\'' . $titlecolor . '\',content=\'' . $content . '\',author=\'' . $author . '\',pubdate=\'' . $timestamp . '\',begintime=\'' . strtotime($begintime) . '\',endtime=\'' . strtotime($endtime) . '\',redirecturl=\'' . $redirecturl . '\' WHERE id = \'' . $id . '\'';
  26. $res = $db->query($sql);
  27. $message = '成功修改公告。';
  28. write_msg($message, 'announce.php?part=edit&id=' . $id);
  29. } else {
  30. $id = intval($id);
  31. $here = '修改网站公告';
  32. $edit = $db->getRow('SELECT * FROM ' . $db_mymps . 'announce WHERE id = \'' . $id . '\'');
  33. $acontent = get_editor('content', 'Normal', $edit['content']);
  34. include mymps_tpl('announce_edit');
  35. }
  36. } else {
  37. if ($part == 'delete') {
  38. $id = intval($id);
  39. if (empty($id)) {
  40. write_msg('没有选择记录');
  41. } else {
  42. mymps_delete('announce', 'WHERE id = \'' . $id . '\'');
  43. write_msg('删除公告 ' . $id . ' 成功', $url, 'Mymps_record');
  44. }
  45. } else {
  46. if ($part == 'all') {
  47. chk_admin_purview('purview_已发布公告');
  48. $page = empty($page) ? 1 : intval($page);
  49. $where = 'WHERE title like \'%' . $title . '%\' and author like \'%' . $author . '%\'';
  50. $sql = 'SELECT * FROM ' . $db_mymps . 'announce ' . $where . ' ORDER BY id DESC';
  51. $rows_num = mymps_count('announce', $where);
  52. $param = setParam(array('id', 'title', 'author'));
  53. $announce = page1($sql);
  54. $here = '公告列表';
  55. include mymps_tpl('announce_all');
  56. } else {
  57. if ($part == 'delall') {
  58. write_msg('删除公告 ' . mymps_del_all('announce', $_POST[id]) . ' 成功', $url, 'Mymps_record');
  59. }
  60. }
  61. }
  62. }
  63. }
  64. }
  65. is_object($db) && $db->Close();
  66. $db = $mymps_global = $part = $action = $here = NULL;