index.php 873 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. defined('IN_PHPCMS') or exit('No permission resources.');
  3. class index {
  4. function __construct() {
  5. $this->db = pc_base::load_model('announce_model');
  6. }
  7. public function init() {
  8. }
  9. /**
  10. * 展示公告
  11. */
  12. public function show() {
  13. if(!isset($_GET['aid'])) {
  14. showmessage(L('illegal_operation'));
  15. }
  16. $_GET['aid'] = intval($_GET['aid']);
  17. $where = '';
  18. $where .= "`aid`='".$_GET['aid']."'";
  19. $where .= " AND `passed`='1' AND (`endtime` >= '".date('Y-m-d')."' or `endtime`='0000-00-00')";
  20. $r = $this->db->get_one($where);
  21. if($r['aid']) {
  22. $this->db->update(array('hits'=>'+=1'), array('aid'=>$r['aid']));
  23. $template = $r['show_template'] ? $r['show_template'] : 'show';
  24. extract($r);
  25. $SEO = seo(get_siteid(), '', $title);
  26. include template('announce', $template, $r['style']);
  27. } else {
  28. showmessage(L('no_exists'));
  29. }
  30. }
  31. }
  32. ?>