示例#1
0
function check_ppost_form($msg_subject)
{
    if (!strlen(trim($msg_subject))) {
        set_err('msg_subject', 'Subject required');
    }
    if (post_check_images()) {
        set_err('msg_body', 'Maximum ' . $GLOBALS['MAX_IMAGE_COUNT'] . ' images are allowed per post, please decrease the number of images');
    }
    $list = explode(';', $_POST['msg_to_list']);
    foreach ($list as $v) {
        $v = trim($v);
        if (strlen($v)) {
            if (!($obj = db_sab('SELECT u.users_opt, u.id, ui.ignore_id FROM phpgw_fud_users u LEFT JOIN phpgw_fud_user_ignore ui ON ui.user_id=u.id AND ui.ignore_id=' . _uid . ' WHERE u.alias=' . strnull(addslashes(htmlspecialchars($v)))))) {
                set_err('msg_to_list', 'There is no user named "' . htmlspecialchars($v) . '" this forum');
                break;
            }
            if (!empty($obj->ignore_id)) {
                set_err('msg_to_list', 'You cannot send a private message to "' . htmlspecialchars($v) . '", because this person is ignoring you.');
                break;
            } else {
                if (!($obj->users_opt & 32) && !($GLOBALS['usr']->users_opt & 1048576)) {
                    set_err('msg_to_list', 'You cannot send a private message to "' . htmlspecialchars($v) . '", because this person is not accepting private messages.');
                    break;
                } else {
                    $GLOBALS['recv_user_id'][] = $obj->id;
                }
            }
        }
    }
    if (empty($_POST['msg_to_list'])) {
        set_err('msg_to_list', 'Cannot send a message, missing recipient');
    }
    return $GLOBALS['__error__'];
}
示例#2
0
function check_ppost_form($msg_subject)
{
    if (!strlen(trim($msg_subject))) {
        set_err('msg_subject', 'Oggetto necessario');
    }
    if (post_check_images()) {
        set_err('msg_body', 'Sono consentite un massimo di ' . $GLOBALS['MAX_IMAGE_COUNT'] . ' immagini per messaggio; per cortesia, riduci il numero di immagini');
    }
    $list = explode(';', $_POST['msg_to_list']);
    foreach ($list as $v) {
        $v = trim($v);
        if (strlen($v)) {
            if (!($obj = db_sab('SELECT u.users_opt, u.id, ui.ignore_id FROM phpgw_fud_users u LEFT JOIN phpgw_fud_user_ignore ui ON ui.user_id=u.id AND ui.ignore_id=' . _uid . ' WHERE u.alias=' . strnull(addslashes(htmlspecialchars($v)))))) {
                set_err('msg_to_list', 'Non c'è alcun utente "' . htmlspecialchars($v) . '" in questo forum');
                break;
            }
            if (!empty($obj->ignore_id)) {
                set_err('msg_to_list', 'Non puoi spedire un messaggio personale a "' . htmlspecialchars($v) . '", perchè questo utente ha deciso di ignorarti.');
                break;
            } else {
                if (!($obj->users_opt & 32) && !($GLOBALS['usr']->users_opt & 1048576)) {
                    set_err('msg_to_list', 'Non puoi inviare un messaggio privato a "' . htmlspecialchars($v) . '", perchè non accetta messaggi privati.');
                    break;
                } else {
                    $GLOBALS['recv_user_id'][] = $obj->id;
                }
            }
        }
    }
    if (empty($_POST['msg_to_list'])) {
        set_err('msg_to_list', 'Non è possibile inviare il messaggio, manca il destinatario');
    }
    return $GLOBALS['__error__'];
}