$id = intval($id);
        $query = $db->query("SELECT * FROM {$tablepre}announcements WHERE id='{$id}' AND author='{$discuz_user}'");
        if (!($announce = $db->fetch_array($query))) {
            showmessage('modcp_ann_nofound');
        }
        if (!submitcheck('submit')) {
            $announce['starttime'] = $announce['starttime'] ? gmdate($dateformat, $announce['starttime'] + $_DCACHE['settings']['timeoffset'] * 3600) : '';
            $announce['endtime'] = $announce['endtime'] ? gmdate($dateformat, $announce['endtime'] + $_DCACHE['settings']['timeoffset'] * 3600) : '';
            $announce['message'] = $announce['type'] != 1 ? dhtmlspecialchars($announce['message']) : $announce['message'];
            $announce['checked'] = $announce['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
        } else {
            $announce['starttime'] = $starttime;
            $announce['endtime'] = $endtime;
            $announce['checked'] = $type != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
            $message = $message[$type];
            save_announce($id, $starttime, $endtime, $subject, $type, $message, $displayorder);
            $edit_successed = true;
        }
        break;
}
$annlist = get_annlist();
function get_annlist()
{
    global $db, $tablepre, $adminid, $discuz_userss, $dateformat, $_DCACHE;
    $annlist = array();
    $query = $db->query("SELECT * FROM {$tablepre}announcements ORDER BY displayorder, starttime DESC, id DESC");
    while ($announce = $db->fetch_array($query)) {
        $announce['disabled'] = $announce['author'] != $discuz_userss ? 'disabled' : '';
        $announce['starttime'] = $announce['starttime'] ? gmdate($dateformat, $announce['starttime'] + $_DCACHE['settings']['timeoffset'] * 3600) : '-';
        $announce['endtime'] = $announce['endtime'] ? gmdate($dateformat, $announce['endtime'] + $_DCACHE['settings']['timeoffset'] * 3600) : '-';
        $annlist[$announce['id']] = $announce;
        $id = intval($_G['gp_id']);
        $query = DB::query("SELECT * FROM " . DB::table('forum_announcement') . " WHERE id='{$id}' AND author='{$_G['username']}'");
        if (!($announce = DB::fetch($query))) {
            showmessage('modcp_ann_nofound');
        }
        if (!submitcheck('submit')) {
            $announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '';
            $announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
            $announce['message'] = $announce['type'] != 1 ? dhtmlspecialchars($announce['message']) : $announce['message'];
            $announce['checked'] = $announce['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
        } else {
            $announce['starttime'] = $_G['gp_starttime'];
            $announce['endtime'] = $_G['gp_endtime'];
            $announce['checked'] = $_G['gp_type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
            $message = $_G['gp_message'][$_G['gp_type']];
            save_announce($id, $_G['gp_starttime'], $_G['gp_endtime'], $_G['gp_subject'], $_G['gp_type'], $message, $_G['gp_displayorder']);
            $edit_successed = true;
        }
        break;
}
$annlist = get_annlist();
function get_annlist()
{
    global $_G;
    $annlist = array();
    $query = DB::query("SELECT * FROM " . DB::table('forum_announcement') . " ORDER BY displayorder, starttime DESC, id DESC");
    while ($announce = DB::fetch($query)) {
        $announce['disabled'] = $announce['author'] != $_G['member']['username'] ? 'disabled' : '';
        $announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '-';
        $announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '-';
        $annlist[$announce['id']] = $announce;
Esempio n. 3
0
        $id = intval($_GET['id']);
        $announce = C::t('forum_announcement')->fetch_by_id_username($id, $_G['username']);
        if (!count($announce)) {
            showmessage('modcp_ann_nofound');
        }
        if (!submitcheck('submit')) {
            $announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '';
            $announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
            $announce['message'] = $announce['type'] != 1 ? dhtmlspecialchars($announce['message']) : $announce['message'];
            $announce['checked'] = $announce['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
        } else {
            $announce['starttime'] = $_GET['starttime'];
            $announce['endtime'] = $_GET['endtime'];
            $announce['checked'] = $_GET['type'] != 1 ? array('selected="selected"', '') : array('', 'selected="selected"');
            $message = $_GET['message'][$_GET['type']];
            save_announce($id, $_GET['starttime'], $_GET['endtime'], $_GET['subject'], $_GET['type'], $message, $_GET['displayorder']);
            $edit_successed = true;
        }
        break;
}
$annlist = get_annlist();
function get_annlist()
{
    global $_G;
    $annlist = C::t('forum_announcement')->fetch_all_by_displayorder();
    foreach ($annlist as $announce) {
        $announce['disabled'] = $announce['author'] != $_G['member']['username'] ? 'disabled' : '';
        $announce['starttime'] = $announce['starttime'] ? dgmdate($announce['starttime'], 'd') : '-';
        $announce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '-';
        $annlist[$announce['id']] = $announce;
    }