Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
//                                                                            //
5
//   Copyright (C) 2006  Phorum Development Team                              //
6
//   http://www.phorum.org                                                    //
7
//                                                                            //
8
//   This program is free software. You can redistribute it and/or modify     //
9
//   it under the terms of either the current Phorum License (viewable at     //
10
//   phorum.org) or the Phorum License that was distributed with this file    //
11
//                                                                            //
12
//   This program is distributed in the hope that it will be useful,          //
13
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
14
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
15
//                                                                            //
16
//   You should have received a copy of the Phorum License                    //
17
//   along with this program.                                                 //
18
////////////////////////////////////////////////////////////////////////////////
19
 
20
if(!defined("PHORUM")) return;
21
 
22
// For phorum_valid_email()
23
include_once("./include/email_functions.php");
24
 
25
$error = false;
26
 
27
// Post and reply checks for unregistered users.
28
if (! $PHORUM["DATA"]["LOGGEDIN"] &&
29
    ($mode == 'post' || $mode == 'reply'))
30
{
31
    if (empty($message["author"])) {
32
        $error = $PHORUM["DATA"]["LANG"]["ErrAuthor"];
33
    } elseif ((!defined('PHORUM_ENFORCE_UNREGISTERED_NAMES') || (defined('PHORUM_ENFORCE_UNREGISTERED_NAMES') && PHORUM_ENFORCE_UNREGISTERED_NAMES == true)) && phorum_user_check_username($message["author"])) {
34
        $error = $PHORUM["DATA"]["LANG"]["ErrRegisterdName"];
35
    } elseif (!empty($message["email"]) &&
36
              phorum_user_check_email($message["email"])) {
37
        $error = $PHORUM["DATA"]["LANG"]["ErrRegisterdEmail"];
38
    }
39
}
40
 
41
// A hook entry for checking the data from a module.
42
if (! $error) {
43
    list($message, $error) =
44
        phorum_hook("check_post", array($message, $error));
45
}
46
 
47
// Data integrity checks for all messages.
48
if (! $error)
49
{
50
    if (empty($message["subject"])) {
51
        $error = $PHORUM["DATA"]["LANG"]["ErrSubject"];
52
    } elseif (empty($message["body"])) {
53
        $error = $PHORUM["DATA"]["LANG"]["ErrBody"];
54
    } elseif (!empty($message["email"]) &&
55
              !phorum_valid_email($message["email"])) {
56
        $error = $PHORUM["DATA"]["LANG"]["ErrEmail"];
57
    } elseif (strlen($message["body"]) > 64000) {
58
        $error = $PHORUM["DATA"]["LANG"]["ErrBodyTooLarge"];
59
    }
60
}
61
 
62
if ($error) {
63
    $PHORUM["DATA"]["ERROR"] = $error;
64
    $error_flag = true;
65
}
66
 
67
?>