query('SELECT COUNT(*) FROM '.tname('announcements').' WHERE starttime <= \''.$_SGLOBAL['timestamp'].'\' AND (endtime >= \''.$_SGLOBAL['timestamp'].'\' OR endtime = 0)'); $listcount = $_SGLOBAL['db']->result($query, 0); $multipage = ''; if($listcount) { $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('announcements').' WHERE starttime <= \''.$_SGLOBAL['timestamp'].'\' AND (endtime >= \''.$_SGLOBAL['timestamp'].'\' OR endtime = 0) ORDER BY displayorder DESC, starttime DESC LIMIT '.$start.','.$perpage); while($item = $_SGLOBAL['db']->fetch_array($query)) { $item['starttime'] = $item['starttime'] ? sgmdate($item['starttime']) : '-'; $item['endtime'] = $item['endtime'] ? sgmdate($item['endtime']) : '-'; $item['url'] = geturl('action/announcement/id/'.$item['id']); $listvalue[] = $item; } $urlarr = array('action'=>'announcement'); $multipage = multi($listcount, $perpage, $page, $urlarr, 0); } } else { $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('announcements').' WHERE id=\''.$id.'\''); if($announce = $_SGLOBAL['db']->fetch_array($query)) { $announce['starttime'] = $announce['starttime'] ? sgmdate($announce['starttime']) : '-'; $announce['endtime'] = $announce['endtime'] ? sgmdate($announce['endtime']) : '-'; if (empty($announce['announcementsurl'])) { $announce['url'] = geturl('action/announcement/id/'.$id); } else { sheader($announce['announcementsurl']); } $listvalue[] = $announce; $multipage = '
MORE
'; } else { showmessage('not_found'); } } $title = $lang['announcement']; include template('site_announcement'); ?>