Simple status box for the sidebar.
[elgg_plugins.git] / openid_client / confirm.php
blob0b837d47e6832975a93903411f0c1804f04ece9d
1 <?php
3 require_once(dirname(dirname(dirname(__FILE__)))."/includes.php");
4 require_once('openid_includes.php');
6 $code = optional_param('code');
7 if (empty($code)) {
8 $messages[] = gettext("Your confirmation code appears to be missing. Please check your link and try again.");
9 } elseif ($code{0} == 'a') {
10 // request to activate an account
11 $action = optional_param('action');
12 $showform = false;
13 if ($action && $action == 'submit_form') {
14 $over13 = optional_param('over13');
15 $username = optional_param('username');
16 if (empty($over13)) {
17 $messages[] = gettext("You must indicate that you are at least 13 years old to join.");
18 $showform = true;
19 } elseif (!$details = get_record('invitations','code',$code)) {
20 $messages[] = $invalid_code_msg;
21 } else {
22 // OK, everything seems to be in order, so activate this user
23 set_field('users','email',$details->email,'ident',$details->owner);
24 set_field('users','name',$details->name,'ident',$details->owner);
25 set_field('users','active','yes','ident',$details->owner);
26 $username = get_field('users','username','ident',$details->owner);
27 $alias = get_field('users','alias','ident',$details->owner);
28 $messages[] = gettext("Your account was created! You can now log in using the OpenID ($alias) you supplied.");
30 } else {
31 $showform = true;
33 } elseif ($code{0} == 'c') {
34 // request to change an email address
35 $showform = false;
36 if (!$details = get_record('invitations','code',$code)) {
37 $messages[] = $invalid_code_msg;
38 } else {
39 // OK, everything seems to be in order, so change the email address
40 set_field('users','email',$details->email,'ident',$details->owner);
41 $messages[] = gettext("Your email address has been changed to {$details->email} . "
42 ."You can now login using your OpenID if you are not already logged in.");
46 if ($showform) {
47 $thankYou = gettext("Thank you for registering for an account with {$CFG->sitename}! "
48 ."Registration is completely free, but before you confirm your details,"
49 ." please take a moment to read the following documents:");
50 $terms = gettext("terms and conditions"); // gettext variable
51 $privacy = gettext("Privacy policy"); // gettext variable
52 $age = gettext("Submitting the form below indicates acceptance of these terms. "
53 ."Please note that currently you must be at least 13 years of age to join the site."); // gettext variable
54 $body .= <<< END
56 <p>
57 $thankYou
58 </p>
59 <ul>
60 <li><a href="{$CFG->wwwroot}content/terms.php" target="_blank">$sitename $terms</a></li>
61 <li><a href="{$CFG->wwwroot}content/privacy.php" target="_blank">$privacy</a></li>
62 </ul>
63 <p>
64 $age
65 </p>
67 <form action="" method="post">
69 END;
70 $correctAge = gettext("I am at least thirteen years of age."); // gettext variable
71 $buttonValue = gettext("Join"); // gettext variable
72 $body .= <<< END
73 <p align="center">
74 <label for="over13checkbox"><input type="checkbox" id="over13checkbox" name="over13" value="yes" /> <strong>$correctAge</strong></label>
75 </p>
76 <p align="center">
77 <input type="hidden" name="action" value="submit_form" />
78 <input type="hidden" name="invitecode" value="$code" />
79 <input type="submit" value="$buttonValue" />
80 </p>
81 </form>
83 END;
86 define("context", "OpenID confirmation");
88 templates_page_setup();
90 echo templates_page_draw( array(
91 sitename,
92 templates_draw(array(
93 'body' => $body,
94 'title' => gettext("OpenID confirmation"),
95 'context' => 'contentholder'