5 function regmod_content(&$a) {
9 $_SESSION['return_url'] = $a->cmd;
12 info( t('Please login.') . EOL);
13 $o .= '<br /><br />' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
17 if((! (x($a->config,'admin_email'))) || ($a->config['admin_email'] !== $a->user['email'])) {
18 notice( t('Permission denied.') . EOL);
29 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
34 if(! count($register))
37 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
38 intval($register[0]['uid'])
43 $r = q("DELETE FROM `user` WHERE `uid` = %d LIMIT 1",
44 intval($register[0]['uid'])
46 $r = q("DELETE FROM `contact` WHERE `uid` = %d LIMIT 1",
47 intval($register[0]['uid'])
49 $r = q("DELETE FROM `profile` WHERE `uid` = %d LIMIT 1",
50 intval($register[0]['uid'])
53 $r = q("DELETE FROM `register` WHERE `hash` = '%s' LIMIT 1",
54 dbesc($register[0]['hash'])
56 notice( sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
61 if($cmd === 'allow') {
66 $r = q("DELETE FROM `register` WHERE `hash` = '%s' LIMIT 1",
67 dbesc($register[0]['hash'])
71 $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d LIMIT 1",
72 intval($register[0]['uid'])
75 $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
76 intval($user[0]['uid'])
78 if(count($r) && $r[0]['net-publish']) {
79 $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
80 if($url && strlen(get_config('system','directory_submit_url')))
81 proc_run('php',"include/directory.php","$url");
84 push_lang($register[0]['language']);
86 $email_tpl = get_intltext_template("register_open_eml.tpl");
87 $email_tpl = replace_macros($email_tpl, array(
88 '$sitename' => $a->config['sitename'],
89 '$siteurl' => $a->get_baseurl(),
90 '$username' => $user[0]['username'],
91 '$email' => $user[0]['email'],
92 '$password' => $register[0]['password'],
93 '$uid' => $user[0]['uid']
96 $res = mail($user[0]['email'], sprintf(t('Registration details for %s'), $a->config['sitename']),
98 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
99 . 'Content-type: text/plain; charset=UTF-8' . "\n"
100 . 'Content-transfer-encoding: 8bit' );
105 info( t('Account approved.') . EOL );