return; } require_once PHORUM_PATH . '/include/api/mail.php'; require_once PHORUM_PATH . '/include/api/ban.php'; // email-verification if ($PHORUM['registration_control']) { //$PHORUM['DATA']['PROFILE']['email_temp']="email_address@bogus.com|bla"; if (!empty($PHORUM['DATA']['PROFILE']['email_temp'])) { list($PHORUM['DATA']['PROFILE']['email_temp_part'], $bogus) = explode("|", $PHORUM['DATA']['PROFILE']['email_temp']); } } $email_temp_part = ""; if (count($_POST)) { if (empty($_POST["email"])) { $error = $PHORUM["DATA"]["LANG"]["ErrRequired"]; } elseif (!phorum_api_mail_check_address($_POST["email"])) { $error = $PHORUM["DATA"]["LANG"]["ErrEmail"]; } elseif ($PHORUM['user']['email'] != $_POST["email"] && phorum_api_user_search("email", $_POST["email"])) { $error = $PHORUM["DATA"]["LANG"]["ErrEmailExists"]; } elseif (($banerr = phorum_api_ban_check($_POST["email"], PHORUM_BAD_EMAILS)) !== NULL) { $error = $banerr; } elseif (isset($PHORUM['DATA']['PROFILE']['email_temp_part']) && !empty($_POST['email_verify_code']) && $PHORUM['DATA']['PROFILE']['email_temp_part'] . "|" . $_POST['email_verify_code'] != $PHORUM['DATA']['PROFILE']['email_temp']) { $error = $PHORUM['DATA']['LANG']['ErrWrongMailcode']; } else { // flip this due to db vs. UI wording. $_POST["hide_email"] = isset($_POST["hide_email"]) ? 0 : 1; $_POST['moderation_email'] = isset($_POST['moderation_email']) && phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_MESSAGES, PHORUM_ACCESS_ANY) ? 1 : 0; // Remember this for the template. if (isset($PHORUM['DATA']['PROFILE']['email_temp_part'])) { $email_temp_part = $PHORUM['DATA']['PROFILE']['email_temp_part']; }
/** * @deprecated Replaced by {@link phorum_api_mail_check_address()}. */ function phorum_valid_email($address) { require_once PHORUM_PATH . '/include/api/mail.php'; return phorum_api_mail_check_address($address); }
* function phorum_mod_foo_check_post ($args) * { * list ($message, $error) = $args; * if (!empty($error)) return $args; * * if (stristr($message["body"], "bar") !== false) { * return array($message, "The body may not contain 'bar'"); * } * * return $args; * } * </hookcode> */ if (!$error && isset($PHORUM["hooks"]["check_post"])) { list($message, $error) = phorum_api_hook("check_post", array($message, $error)); } // Data integrity checks for all messages. if (!$error) { if (!isset($message["subject"]) || trim($message["subject"]) == '') { $error = $PHORUM["DATA"]["LANG"]["ErrSubject"]; } elseif (!isset($message["body"]) || trim($message["body"]) == '') { $error = $PHORUM["DATA"]["LANG"]["ErrBody"]; } elseif (!empty($message["email"]) && !phorum_api_mail_check_address($message["email"])) { $error = $PHORUM["DATA"]["LANG"]["ErrEmail"]; } elseif (strlen($message["body"]) > MAX_MESSAGE_LENGTH) { $error = $PHORUM["DATA"]["LANG"]["ErrBodyTooLarge"]; } } if ($error) { $PHORUM["DATA"]["ERROR"] = $error; }
} //process new user data } elseif (isset($_POST["addUser"])) { $user_data = $_POST; //check for pre-existing username if (!empty($_POST["username"])) { $existing_user = phorum_api_user_search("username", $_POST["username"]); if (!empty($existing_user)) { $error = 'The user name "' . htmlspecialchars($_POST[username]) . '" is already in use!'; } } else { $error = "You must provide a user name!"; } //check for a valid email if (!empty($_POST["email"])) { $valid_email = phorum_api_mail_check_address($_POST["email"]); if ($valid_email !== true) { $error = 'The email "' . htmlspecialchars($_POST[email]) . '" is not valid!'; } } else { $error = "You must provide an e-mail!"; } //check for password and password confirmation if (isset($_POST['password1']) && !empty($_POST['password1']) && !empty($_POST['password2']) && $_POST['password1'] != $_POST['password2']) { $error = "Passwords don't match!"; } elseif (!empty($_POST['password1']) && !empty($_POST['password2'])) { $user_data['password'] = $_POST['password1']; $user_data['password_temp'] = $_POST['password1']; } else { $error = "You must assign a password!"; }
* * // return an error * $error = "You can't continue as module is run! ;-)"; * * return array($userdata,$checks,$error); * } * </hookcode> */ $todo_checks = array('username_empty' => 1, 'username_unique' => 1, 'email_valid' => 1, 'email_unique' => 1, 'password' => 1, 'banlists' => 1); if (isset($PHORUM["hooks"]["before_register_check"])) { list($_POST, $todo_checks, $error) = phorum_api_hook("before_register_check", array($_POST, $todo_checks, $error)); } // Check if all required fields are filled and valid. if ($todo_checks['username_empty'] && (!isset($_POST["username"]) || empty($_POST['username']))) { $error = $PHORUM["DATA"]["LANG"]["ErrUsername"]; } elseif ($todo_checks['email_valid'] && !isset($_POST["email"]) || !phorum_api_mail_check_address($_POST["email"])) { $error = $PHORUM["DATA"]["LANG"]["ErrEmail"]; } elseif ($todo_checks['password'] && (empty($_POST["password"]) || $_POST["password"] != $_POST["password2"])) { $error = $PHORUM["DATA"]["LANG"]["ErrPassword"]; } elseif ($todo_checks['username_unique'] && phorum_api_user_search("username", $_POST["username"])) { $error = $PHORUM["DATA"]["LANG"]["ErrRegisterdName"]; } elseif ($todo_checks['email_unique'] && phorum_api_user_search("email", $_POST["email"])) { $error = $PHORUM["DATA"]["LANG"]["ErrRegisterdEmail"]; } // Check banlists. if ($todo_checks['banlists'] && empty($error)) { $error = phorum_api_ban_check_multi(array(array($_POST["username"], PHORUM_BAD_NAMES), array($_POST["email"], PHORUM_BAD_EMAILS), array(NULL, PHORUM_BAD_IPS))); } // Create user if no errors have been encountered. if (empty($error)) { // Setup the default userdata to store.