| 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 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
require_once(dirname(__FILE__) . '/include/common.php'); |
|---|
| 54 |
|
|---|
| 55 |
require_once('classes/User.php'); |
|---|
| 56 |
require_once('classes/MainUI.php'); |
|---|
| 57 |
$smarty = SmartyWifidog::getObject(); |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
$smarty->assign('sectionTOOLCONTENT', false); |
|---|
| 64 |
$smarty->assign('sectionMAINCONTENT', false); |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
$smarty->assign('username', ""); |
|---|
| 68 |
$smarty->assign('message', ""); |
|---|
| 69 |
$smarty->assign('error', ""); |
|---|
| 70 |
$smarty->assign('auth_sources', ""); |
|---|
| 71 |
$smarty->assign('selected_auth_source', ""); |
|---|
| 72 |
$smarty->assign('SelectNetworkUI', ""); |
|---|
| 73 |
|
|---|
| 74 |
if (isset($_REQUEST["form_request"])) { |
|---|
| 75 |
$account_origin = Network::getObject($_REQUEST['auth_source']); |
|---|
| 76 |
|
|---|
| 77 |
try { |
|---|
| 78 |
|
|---|
| 79 |
* Tool content |
|---|
| 80 |
*/ |
|---|
| 81 |
|
|---|
| 82 |
// Set section of Smarty template |
|---|
| 83 |
$smarty->assign('sectionTOOLCONTENT', true); |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
$html = $smarty->fetch("templates/sites/resend_validation.tpl"); |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
* Main content |
|---|
| 90 |
*/ |
|---|
| 91 |
|
|---|
| 92 |
// Reset ALL smarty SWITCH values |
|---|
| 93 |
$smarty->assign('sectionTOOLCONTENT', false); |
|---|
| 94 |
$smarty->assign('sectionMAINCONTENT', false); |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
$smarty->assign('sectionMAINCONTENT', true); |
|---|
| 98 |
|
|---|
| 99 |
if (empty($account_origin)) { |
|---|
| 100 |
throw new Exception(_("Sorry, this network does not exist !")); |
|---|
| 101 |
} |
|---|
| 102 |
|
|---|
| 103 |
if (!$_REQUEST["username"]) { |
|---|
| 104 |
throw new Exception(_("Please specify a username")); |
|---|
| 105 |
} |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
$user = User::getUserByUsernameAndOrigin($_REQUEST['username'], $account_origin); |
|---|
| 109 |
|
|---|
| 110 |
if ($user == null) { |
|---|
| 111 |
throw new Exception(_("This username could not be found in our database")); |
|---|
| 112 |
} |
|---|
| 113 |
|
|---|
| 114 |
$user->sendValidationEmail(); |
|---|
| 115 |
|
|---|
| 116 |
$smarty->assign('message', _("An email with confirmation instructions was sent to your email address.")); |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
$html_body = $smarty->fetch("templates/sites/validate.tpl"); |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
* Render output |
|---|
| 123 |
*/ |
|---|
| 124 |
$ui = MainUI::getObject(); |
|---|
| 125 |
$ui->addContent('left_area_middle', $html); |
|---|
| 126 |
$ui->addContent('main_area_middle', $html_body); |
|---|
| 127 |
$ui->display(); |
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
exit; |
|---|
| 131 |
} catch (Exception $e) { |
|---|
| 132 |
$smarty->assign('error', $e->getMessage()); |
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
$html = ""; |
|---|
| 136 |
$html_body = ""; |
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
$smarty->assign('sectionTOOLCONTENT', false); |
|---|
| 140 |
$smarty->assign('sectionMAINCONTENT', false); |
|---|
| 141 |
} |
|---|
| 142 |
} |
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
$smarty->assign('sectionTOOLCONTENT', true); |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
$html = $smarty->fetch("templates/sites/resend_validation.tpl"); |
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
$smarty->assign('sectionTOOLCONTENT', false); |
|---|
| 160 |
$smarty->assign('sectionMAINCONTENT', false); |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
$smarty->assign('sectionMAINCONTENT', true); |
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
$sources = array(); |
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
$network_array=Network::getAllNetworks(); |
|---|
| 170 |
|
|---|
| 171 |
foreach ($network_array as $network) { |
|---|
| 172 |
if ($network->getAuthenticator()->isRegistrationPermitted()) { |
|---|
| 173 |
$sources[$network->getId()] = $network->getName(); |
|---|
| 174 |
} |
|---|
| 175 |
} |
|---|
| 176 |
|
|---|
| 177 |
if (isset($sources)) { |
|---|
| 178 |
$smarty->assign('auth_sources', $sources); |
|---|
| 179 |
} |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
if (isset($_REQUEST["auth_source"])) { |
|---|
| 183 |
$smarty->assign('selected_auth_source', $_REQUEST["auth_source"]); |
|---|
| 184 |
} |
|---|
| 185 |
|
|---|
| 186 |
$smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source')); |
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
$html_body = $smarty->fetch("templates/sites/resend_validation.tpl"); |
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
$ui = MainUI::getObject(); |
|---|
| 195 |
$ui->addContent('left_area_middle', $html); |
|---|
| 196 |
$ui->addContent('main_area_middle', $html_body); |
|---|
| 197 |
$ui->display(); |
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
?> |
|---|
| 208 |
|
|---|