3
* $Horde: horde/signup.php,v 1.17.10.1 2005/01/03 12:25:28 jan Exp $
5
* Copyright 2002-2005 Marko Djukic <marko@oblo.com>
7
* See the enclosed file COPYING for license information (LGPL). If you
8
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
11
@define('AUTH_HANDLER', true);
12
@define('HORDE_BASE', dirname(__FILE__));
13
require_once HORDE_BASE . '/lib/base.php';
14
require_once 'Horde/Auth/Signup.php';
15
require_once 'Horde/Variables.php';
17
// Make sure signups are enabled before proceeding
18
if ($conf['signup']['allow'] !== true) {
19
$notification->push(_("User Registration has been disabled for this site."), 'horde.error');
20
header('Location: ' . Auth::getLoginScreen());
24
$auth = &Auth::singleton($conf['auth']['driver']);
25
$signup = &Auth_Signup::singleton();
27
$renderer = &new Horde_Form_Renderer();
29
$vars = &Variables::getDefaultVariables();
31
$formsignup = &Horde_Form::singleton('HordeSignupForm', $vars);
32
$formsignup->validate($vars);
34
if ($vars->get('formname') != 'hordesignupform') {
35
/* Not yet submitted. */
36
$formsignup->clearValidation();
39
if ($formsignup->isValid() && $vars->get('formname') == 'hordesignupform') {
40
$formsignup->getInfo($vars, $info);
42
if ($auth->hasCapability('add')) {
43
if (!$conf['signup']['approve']) {
44
/* User can sign up directly, no intervention necessary. */
45
$success = $signup->addSignup($info);
46
$success_message = sprintf(_("Added '%s' to the system. You can log in now."), $info['user_name']);
47
} elseif ($conf['signup']['approve']) {
48
/* Insert this user into a queue for admin approval. */
49
$success = $signup->queueSignup($info);
50
$success_message = sprintf(_("Submitted request to add '%s' to the system. You can not log in until your request has been approved."), $info['user_name']);
54
if (is_a($success, 'PEAR_Error')) {
55
$notification->push(sprintf(_("There was a problem adding '%s' to the system. %s."), $info['user_name'], $success->getMessage()), 'horde.error');
57
$notification->push($success_message, 'horde.success');
58
$url = Auth::getLoginScreen('', $info['url']);
59
header('Location: ' . $url);
64
$title = _("User Registration");
65
require HORDE_TEMPLATES . '/common-header.inc';
66
$notification->notify(array('listeners' => 'status'));
67
$formsignup->renderActive($renderer, $vars, 'signup.php', 'post');
68
require HORDE_TEMPLATES . '/common-footer.inc';