function formatPersonEmail($person) { return formatPersonName($person) . ' <' . $person['person_email'] . '>'; }
<a href="profile<?php if ($user['person_id'] !== $person['person_id']) { echo '?person_id=' . $person['person_id']; } ?> " class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></a> <?php echo htmlspecialchars($message); ?> </div> <?php } else { ?> <form method="POST"> <h3><?php echo htmlspecialchars(formatPersonName($person)); ?> </h3> <table class="table table-condensed"> <tbody> <tr> <th>First name</th> <?php if (isset($_POST['edit'])) { ?> <td><input name="person_first_name" class="form-control input-sm" value="<?php echo htmlspecialchars($person['person_first_name']); ?> "/></td> <?php } else {
if ($person === null) { throw new UserException('Profile not found.'); } $unique_id['person_id'] = $person['person_id']; $dal->updateUniqueId($unique_id); $subject = "OpenLCB Unique ID Range Transferred"; $body = "Hi " . formatPersonName($unique_id) . ",\r\n\r\nThe following OpenLCB Unique ID Range has been Transferred.\r\n\r\n" . formatUniqueIdHex($unique_id) . "\r\n\r\nFrom delegating organization or person: " . formatPersonName($unique_id) . "\r\nTo delegating organization or person: " . formatPersonName($person) . "\r\nURL: " . $unique_id['uniqueid_url'] . "\r\nComment: " . $unique_id['uniqueid_user_comment'] . "\r\n\r\nThe OpenLCB Group"; if (!mail_abstraction(array(formatPersonEmail($unique_id)), $subject, $body)) { throw new UserError('Failed to send email.'); } $subject = "OpenLCB Unique ID Range Transferred"; $body = "Hi " . formatPersonName($person) . ",\r\n\r\nThe following OpenLCB Unique ID Range has been Transferred.\r\n\r\n" . formatUniqueIdHex($unique_id) . "\r\n\r\nFrom delegating organization or person: " . formatPersonName($unique_id) . "\r\nTo delegating organization or person: " . formatPersonName($person) . "\r\nURL: " . $unique_id['uniqueid_url'] . "\r\nComment: " . $unique_id['uniqueid_user_comment'] . "\r\n\r\nThe OpenLCB Group"; if (!mail_abstraction(array(formatPersonEmail($person)), $subject, $body)) { throw new UserError('Failed to send email.'); } $body = "The following OpenLCB Unique ID Range has been Transferred.\r\nYou have been notified as you are a moderator.\r\n\r\n" . formatUniqueIdHex($unique_id) . "\r\n\r\nFrom delegating organization or person: " . formatPersonName($unique_id) . "\r\nTo delegating organization or person: " . formatPersonName($person) . "\r\nURL: " . $unique_id['uniqueid_url'] . "\r\nComment: " . $unique_id['uniqueid_user_comment'] . "\r\n\r\nUID: " . 'http://' . $_SERVER['HTTP_HOST'] . '/uniqueidrange?uniqueid_id=' . $unique_id['uniqueid_id'] . "\r\nAll pending UIDs: " . "http://" . $_SERVER['HTTP_HOST'] . '/uniqueidranges?pending'; if (!mail_abstraction(array_map('formatPersonEmail', $dal->selectModerators()), $subject, $body, array(EMAIL_FROM))) { throw new UserError('Failed to send email.'); } $message = 'Transferred.'; } $dal->commit(); } catch (UserException $e) { $dal->rollback(); $error = $e->getMessage(); } catch (Exception $e) { $dal->rollback(); throw $e; } ?> <!DOCTYPE html>
<th>URL</th> <th>Comment</th> </tr> <?php foreach ($sub_unique_ids as $sub_unique_id) { ?> <tr> <td style="font-family: monospace; white-space: pre;"><a href="uniqueidrange?uniqueid_id=<?php echo $sub_unique_id['uniqueid_id']; ?> "><?php echo htmlspecialchars(formatUniqueIdHex($sub_unique_id)); ?> </a></td> <td><?php echo htmlspecialchars(formatPersonName($sub_unique_id)); ?> </td> <td><?php echo htmlspecialchars($sub_unique_id['uniqueid_url']); ?> </td> <td><?php echo htmlspecialchars($sub_unique_id['uniqueid_user_comment']); ?> </td> </tr> <?php } } }
throw new UserException('Password must be at least 8 characters long.'); } if ($_POST['email'] !== $_POST['repeat_email']) { throw new UserException('The entered email addresses do not match.'); } if ($_POST['password'] !== $_POST['repeat_password']) { throw new UserException('The entered passwords do not match.'); } if ($dal->selectPersonByEmail($_POST['email']) !== null) { throw new UserException('The entered email address is already in use.'); } $person = array('person_first_name' => $_POST['first_name'], 'person_last_name' => $_POST['last_name'], 'person_organization' => $_POST['organization'], 'person_email' => $_POST['email'], 'person_subscribe' => isset($_POST['subscribe']) ? 'y' : 'n', 'person_email_verified' => 'n', 'person_email_shared_secret' => randHex()); setPersonPassword($person, $_POST['password']); $dal->insertPerson($person); $url = "http://" . $_SERVER['HTTP_HOST'] . "/register?person_id=" . $person['person_id'] . "&person_email_shared_secret=" . $person['person_email_shared_secret'] . '&verify'; $name = formatPersonName($person); $email = formatPersonEmail($person); $subject = "Register as OpenLCB User"; $body = "Hi {$name},\r\n\r\nYou can verify your email address with the link below.\r\n{$url}\r\n\r\nThe OpenLCB Group"; if (!mail_abstraction(array($email), $subject, $body)) { throw new UserError('Failed to send email.'); } $message = 'Registered and verification email sent.'; } else { if (isset($_GET['verify'])) { $user['person_email_verified'] = 'y'; $dal->updatePerson($user); $message = 'Email address verified.'; } else { if ($user !== null) { header('Location: .');
<?php } ?> </div> </div> <div class="navbar-right"> <?php if ($user !== null) { ?> <a href="profile" class="btn btn-sm navbar-btn<?php if (basename($_SERVER['SCRIPT_NAME']) === 'profile.php' && $person !== null && $user['person_id'] === $person['person_id']) { echo ' active'; } ?> "><span class="glyphicon glyphicon-user"></span> <?php echo htmlspecialchars(formatPersonName($user)); ?> </a> <a href="logout" class="btn btn-sm btn-default navbar-btn"><span class="glyphicon glyphicon-log-out"></span> Logout</a> <?php } else { ?> <a href="register" class="btn btn-sm btn-default navbar-btn<?php if (basename($_SERVER['SCRIPT_NAME']) === 'register.php') { echo ' active'; } ?> "><span class="glyphicon glyphicon-edit"></span> Register</a> <a href="updatepassword" class="btn btn-sm btn-default navbar-btn<?php if (basename($_SERVER['SCRIPT_NAME']) === 'updatepassword.php') { echo ' active';