5 function regmod_content(&$a) {
7 $_SESSION['return_url'] = $a->cmd;
10 notice( t('Please login.') . EOL);
11 $o .= '<br /><br />' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
22 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
27 if(! count($register))
30 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
31 intval($register[0]['uid'])
36 $r = q("DELETE FROM `user` WHERE `uid` = %d LIMIT 1",
37 intval($register[0]['uid'])
39 $r = q("DELETE FROM `contact` WHERE `uid` = %d LIMIT 1",
40 intval($register[0]['uid'])
42 $r = q("DELETE FROM `profile` WHERE `uid` = %d LIMIT 1",
43 intval($register[0]['uid'])
46 $r = q("DELETE FROM `register` WHERE `hash` = '%s' LIMIT 1",
47 dbesc($register[0]['hash'])
49 notice( t('Registration revoked for ') . $user[0]['username'] . EOL);
54 if($cmd === 'allow') {
59 $r = q("DELETE FROM `register` WHERE `hash` = '%s' LIMIT 1",
60 dbesc($register[0]['hash'])
64 $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d LIMIT 1",
65 intval($register[0]['uid'])
68 $email_tpl = load_view_file("view/register_open_eml.tpl");
69 $email_tpl = replace_macros($email_tpl, array(
70 '$sitename' => $a->config['sitename'],
71 '$siteurl' => $a->get_baseurl(),
72 '$username' => $user[0]['username'],
73 '$email' => $user[0]['email'],
74 '$password' => $register[0]['password'],
75 '$uid' => $user[0]['uid']
78 $res = mail($user[0]['email'], t('Registration details for '). $a->config['sitename'],
79 $email_tpl,'From: ' . t('Administrator@') . $_SERVER[SERVER_NAME] );
82 notice( t('Account approved.') . EOL );