예제 #1
0
function messages($max_days, $max_number, $mode, $filter_read = 0)
{
    $oldest = 0;
    if ($max_days) {
        $oldest_ts = strtotime('-' . $max_days . ' days');
        $oldest = date('Y-m-d H:i:s', $oldest_ts);
    }
    $messages = '';
    $func = 'load_' . $mode . '_messages';
    $data = $func($oldest, $max_number, $filter_read);
    foreach ($data as $i => $msg_data) {
        $msg = new message($msg_data);
        $msg->load_to();
        $msg->format();
        $messages .= $msg->output;
    }
    return $messages;
}
예제 #2
0
        $sel_person = $found['person'];
        $sel_group = $found['group'];
    }
    if (isset($_POST['text'])) {
        $text = stripslashes($_POST['text']);
    }
    $msg = new message();
    $msg->create($text, $sel_person, $sel_group);
    if ($action == 'send') {
        $msg->insert();
        $_SESSION['notice'] = 'message sent';
        redirect('./');
    }
    if ($action == 'write' || $action == 'preview') {
        $message = '';
        $msg->format();
        $message = $msg->output;
        $v['message'] = $message;
        $v['sel_person'] = $sel_person;
        $v['sel_group'] = $sel_group;
        $v['text'] = $text;
        $content = new tmpl('new.html', $v);
    }
}
if ($action == 'start' || $action == 'search') {
    $v = list_person_group();
    $v['sel_person'] = $sel_person;
    $v['sel_group'] = $sel_group;
    unset_items($v['person'], $sel_person);
    unset_items($v['group'], $sel_group);
    $content = new tmpl('search.html', $v);