Пример #1
0
            $success_message = T_('Your comment is now visible by the blog members.');
            break;
        case 'review':
            if (is_logged_in() && $current_User->check_perm('blog_comment!review', 'create', false, $blog)) {
                $success_message = T_('Your comment is now visible by moderators only (+You).');
                break;
            }
        default:
            $success_message = T_('Your comment has been submitted. It will appear once it has been approved.');
            break;
    }
    $Messages->add($success_message, 'success');
    if (!is_logged_in()) {
        if ($Settings->get('newusers_canregister') == 'yes' && $Settings->get('registration_is_public') && $Comment->Item->Blog->get_setting('comments_register')) {
            // Redirect to the registration form
            $Messages->add(T_('ATTENTION: Create a user account now so that other users can contact you after reading your comment.'), 'error');
            $register_user = array('name' => $Comment->author, 'email' => $Comment->author_email);
            $Session->set('core.register_user', $register_user);
            header_redirect(get_user_register_url($Comment->Item->get_url('public_view'), 'reg after comment', false, '&'));
        }
        // Not logged in user. We want him to see his comment has not vanished if he checks back on the Item page
        // before the cache has expired. Invalidate cache for that page:
        // Note: this is approximative and may not cover all URLs where the user expects to see the comment...
        // TODO: fp> solution: touch dates?
        load_class('_core/model/_pagecache.class.php', 'PageCache');
        $PageCache = new PageCache($Comment->Item->Blog);
        $PageCache->invalidate($Comment->Item->get_single_url());
    }
}
header_redirect();
// Will save $Messages into Session