-
Notifications
You must be signed in to change notification settings - Fork 0
/
modinput4.php
95 lines (66 loc) · 2.12 KB
/
modinput4.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/*****
*
* AMP UserData Form View
*
* (c) 2004 Radical Designs
* Written by Blaine Cook, blaine@radicaldesigns.org
*
*****/
//ob_start();
// Set default module.
$intro_id = 57;
$modid = 1;
require_once( 'AMP/BaseDB.php' );
require_once( 'AMP/UserData/Input.inc.php' );
/**
* Check for a cached page
*/
if ( $cached_output = AMP_cached_request( )) {
print $cached_output;
exit;
}
$modin = ( isset( $_REQUEST['modin']) && $_REQUEST['modin']) ? intval( $_REQUEST['modin'] ) : false;
// Fetch the form instance specified by submitted modin value.
$udm =& new UserDataInput( $dbcon, $modin );
if( !$udm->isLive( )) {
ampredirect( AMP_CONTENT_URL_INDEX );
exit;
}
// User ID.
$uid = (isset($_REQUEST['uid'])) ? intval( $_REQUEST['uid'] ) : false;
$otp = (isset($_REQUEST['otp'])) ? $_REQUEST['otp'] : null;
// Check for duplicates, setting $uid if found.
if ( !$uid ) {
$uid = $udm->findDuplicates();
}
// Check for authentication, sending authentication mail if necessary.
if ( $uid ) {
// Set authentication token if uid present
$auth = $udm->authenticate( $uid, $otp );
}
// Fetch or save user data.
if ( ( !$uid || $auth ) && $udm->submitted ) {
// Save only if submitted data is present, and the user is
// authenticated, or if the submission is anonymous (i.e., !$uid)
$udm->saveUser();
} elseif ( $uid && $auth && !$udm->submitted ) {
// Fetch the user data for $uid if there is no submitted data
// and the user is authenticated.
$udm->getUser( $uid );
}
/* Now Output the Form.
Any necessary changes to the form should have been registered
before now, including any error messages, notices, or
complete form overhauls. This can happen either within the
$udm object, or from print() or echo() statements.
By default, the form will include AMP's base template code,
and any database-backed intro text to the appropriate module.
*/
$intro_id = $udm->modTemplateID;
AMP_directDisplay( $udm->output());
require_once( 'AMP/BaseTemplate.php' );
require_once( 'AMP/BaseModuleIntro.php' );
// Append the footer and clean up.
require_once( 'AMP/BaseFooter.php' );
?>