1: <?php
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: class PersonView extends AlphaView {
49:
50: 51: 52: 53: 54: 55:
56: public function displayLoginForm() {
57: global $config;
58:
59: $html = '<div class="bordered" style="text-align:center; padding:10px; margin:10px;">';
60: $html .= '<form action="'.FrontController::generateSecureURL('act=Login&no-forceframe=true').'" method="POST" id="loginForm">';
61: $html .= '<table cols="2" align="center">';
62: $html .= '<tr>';
63: if($config->get('security.encrypt.http.fieldnames'))
64: $fieldname = base64_encode(AlphaSecurityUtils::encrypt('email'));
65: else
66: $fieldname = 'email';
67: $stringBox = new StringBox(new String(isset($_POST[$fieldname])? $_POST[$fieldname] : ''), $this->BO->getDataLabel('email'), $fieldname, 'loginForm', '50');
68: $html .= $stringBox->render(true);
69: $html .= '</tr>';
70: $html .= '<tr>';
71: $password = new String();
72: $password->isPassword();
73: if($config->get('security.encrypt.http.fieldnames'))
74: $fieldname = base64_encode(AlphaSecurityUtils::encrypt('password'));
75: else
76: $fieldname = 'password';
77: $stringBox = new StringBox($password, $this->BO->getDataLabel('password'), $fieldname, 'loginForm', '50');
78: $html .= $stringBox->render(true);
79: $html .= '</tr>';
80: $html .= '<tr><td colspan="2">';
81: $fieldname = ($config->get('security.encrypt.http.fieldnames') ? base64_encode(AlphaSecurityUtils::encrypt('loginBut')) : 'loginBut');
82: $temp = new Button('submit','Login',$fieldname);
83: $html .= '<div align="center">'.$temp->render(80).'</div>';
84: $html .= '</td></tr>';
85:
86: $html .= $this->renderSecurityFields();
87:
88: $html .= '</table>';
89: $html .= '</form>';
90:
91: $html .= '<p><a href="'.FrontController::generateSecureURL('act=Login&reset=true&no-forceframe=true').'">Forgotten your password?</a></p>';
92: $html .= '</div>';
93:
94: return $html;
95: }
96:
97: 98: 99: 100: 101: 102:
103: public function displayResetForm() {
104: global $config;
105:
106: $html = '<p>If you have forgotten your password, you can use this form to have a new password automatically generated and sent to your e-mail address.</p>';
107: $html .= '<table cols="2">';
108: $html .= '<form action="'.FrontController::generateSecureURL('act=Login&reset=true&no-forceframe=true').'" method="POST">';
109: $html .= '<tr>';
110: if($config->get('security.encrypt.http.fieldnames'))
111: $fieldname = base64_encode(AlphaSecurityUtils::encrypt('email'));
112: else
113: $fieldname = 'email';
114: $html .= ' <td>E-mail Address</td> <td><input type="text" name="'.$fieldname.'" size="50" value="'.(isset($_POST[$fieldname])? $_POST[$fieldname] : '').'"/></td>';
115: $html .= '</tr>';
116: $html .= '<tr><td colspan="2">';
117: $temp = new Button("submit","Reset Password","resetBut");
118: $html .= $temp->render();
119: $html .= ' ';
120: $temp = new Button("document.location.replace('".$config->get('app.url')."')","Cancel","cancelBut");
121: $html .= $temp->render();
122: $html .= '</td></tr>';
123:
124: $html .= $this->renderSecurityFields();
125:
126: $html .= '</form>';
127: $html .= '</table>';
128:
129: return $html;
130: }
131:
132: 133: 134: 135: 136: 137:
138: public function displayRegisterForm() {
139: global $config;
140:
141: $html = '<p>In order to access this site, you will need to create a user account. In order to do so, please provide a valid email address below and a password will be sent to your inbox shortly (you can change your password once you log in).</p>';
142: $html .= '<table cols="2">';
143: $html .= '<form action="'.$_SERVER["PHP_SELF"].'?reset=true" method="POST">';
144: $html .= '<tr>';
145: if($config->get('security.encrypt.http.fieldnames'))
146: $fieldname = base64_encode(AlphaSecurityUtils::encrypt('displayname'));
147: else
148: $fieldname = 'displayname';
149: $html .= ' <td>Forum name</td> <td><input type="text" name="'.$fieldname.'" size="50" value="'.(isset($_POST[$fieldname])? $_POST[$fieldname] : '').'"/></td>';
150: $html .= '</tr>';
151: $html .= '<tr>';
152: if($config->get('security.encrypt.http.fieldnames'))
153: $fieldname = base64_encode(AlphaSecurityUtils::encrypt('email'));
154: else
155: $fieldname = 'email';
156: $html .= ' <td>E-mail Address</td> <td><input type="text" name="'.$fieldname.'" size="50" value="'.(isset($_POST[$fieldname])? $_POST[$fieldname] : '').'"/></td>';
157: $html .= '</tr>';
158: $html .= '<tr><td colspan="2">';
159: $temp = new Button("submit","Register","registerBut");
160: $html .= $temp->render();
161: $html .= ' ';
162: $temp = new Button("document.location.replace('".$config->get('app.url')."')","Cancel","cancelBut");
163: $html .= $temp->render();
164: $html .= '</td></tr>';
165:
166: $html .= $this->renderSecurityFields();
167:
168: $html .= '</form>';
169: $html .= '</table>';
170:
171: return $html;
172: }
173: }
174:
175: ?>