<?php /** * User management - options * * PHP version 5.2 * * @category None * @package None * @author Kae Verens <*****@*****.**> * @license GPL 2.0 * @link http://kvsites.ie/ */ if (@$_REQUEST['action'] == 'save') { Core_siteVar('useraccounts_registrationtokenemail_from', $_REQUEST['email']); Core_siteVar('useraccounts_registrationtokenemail_subject', $_REQUEST['subject']); Core_siteVar('useraccounts_registrationtokenemail_message', $_REQUEST['message']); } echo '<h3>User Options</h3>' . '<p>This list of options governs how users are created.</p>'; $rs = dbAll('select * from site_vars where name like "useraccounts_%"', 'name'); echo '<form action="./siteoptions.php?page=users&tab=options" ' . 'method="post">'; echo '<div id="user-options-wrapper">'; // { token email echo '<h2>User Token email</h2><div><table>' . '<tr><th>From email address</th><td><input name="email" value="' . htmlspecialchars(Core_siteVar('useraccounts_registrationtokenemail_from')) . '"/></td></tr>' . '<tr><th>Subject</th><td><input name="subject" value="' . htmlspecialchars(Core_siteVar('useraccounts_registrationtokenemail_subject')) . '"/></td></tr>' . '<tr><th>Message</th><td><textarea name="message">' . htmlspecialchars(Core_siteVar('useraccounts_registrationtokenemail_message')) . '</textarea></td><td><strong>codes</strong><br/>' . '<code>%token%</code>: the registration token</td></tr>' . '</table></div>'; // } echo '</div><input type="hidden" name="action" value="save"/>' . '<input type="submit" value="Save"/></form>'; WW_addScript('/ww.admin/siteoptions/users-options.js'); WW_addCSS('/ww.admin/siteoptions/users-options.css');
/** * send registration token * * @return array status */ function Core_sendRegistrationToken() { $email = @$_REQUEST['email']; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return array('error' => 'invalid email address'); } $sql = 'select id from user_accounts where email="' . addslashes($email) . '"'; if (dbOne($sql, 'id')) { return array('error' => 'already registered'); } if (!isset($_SESSION['privacy'])) { $_SESSION['privacy'] = array(); } Core_trigger('user-registration-token-sent'); $_SESSION['privacy']['registration'] = array('token' => rand(10000, 99999), 'custom' => array(), 'email' => $email); if (@$_REQUEST['custom'] && is_array($_REQUEST['custom'])) { $_SESSION['privacy']['registration']['custom'] = $_REQUEST['custom']; } $emaildomain = str_replace('www.', '', $_SERVER['HTTP_HOST']); $from = Core_siteVar('useraccounts_registrationtokenemail_from'); Core_mail($email, Core_siteVar('useraccounts_registrationtokenemail_subject'), str_replace('%token%', $_SESSION['privacy']['registration']['token'], Core_siteVar('useraccounts_registrationtokenemail_message')), $from); return array('ok' => 1); }