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);
15 if((! (x($a->config,'admin_email'))) || ($a->config['admin_email'] !== $a->user['email'])) {
16 notice( t('Permission denied.') . EOL);
27 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
32 if(! count($register))
35 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
36 intval($register[0]['uid'])
41 $r = q("DELETE FROM `user` WHERE `uid` = %d LIMIT 1",
42 intval($register[0]['uid'])
44 $r = q("DELETE FROM `contact` WHERE `uid` = %d LIMIT 1",
45 intval($register[0]['uid'])
47 $r = q("DELETE FROM `profile` WHERE `uid` = %d LIMIT 1",
48 intval($register[0]['uid'])
51 $r = q("DELETE FROM `register` WHERE `hash` = '%s' LIMIT 1",
52 dbesc($register[0]['hash'])
54 notice( sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
59 if($cmd === 'allow') {
64 $r = q("DELETE FROM `register` WHERE `hash` = '%s' LIMIT 1",
65 dbesc($register[0]['hash'])
69 $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d LIMIT 1",
70 intval($register[0]['uid'])
73 $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
74 intval($user[0]['uid'])
76 if(count($r) && $r[0]['net-publish']) {
77 $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
78 if($url && strlen(get_config('system','directory_submit_url')))
79 proc_run('php',"include/directory.php","$url");
82 $email_tpl = get_intltext_template("register_open_eml.tpl");
83 $email_tpl = replace_macros($email_tpl, array(
84 '$sitename' => $a->config['sitename'],
85 '$siteurl' => $a->get_baseurl(),
86 '$username' => $user[0]['username'],
87 '$email' => $user[0]['email'],
88 '$password' => $register[0]['password'],
89 '$uid' => $user[0]['uid']
92 $res = mail($user[0]['email'], sprintf(t('Registration details for %s'), $a->config['sitename']),
94 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
95 . 'Content-type: text/plain; charset=UTF-8' . "\n"
96 . 'Content-transfer-encoding: 8bit' );
99 notice( t('Account approved.') . EOL );