3 require_once('include/enotify.php');
4 require_once('include/user.php');
6 function user_allow($hash) {
10 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
15 if(! count($register))
18 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
19 intval($register[0]['uid'])
25 $r = q("DELETE FROM `register` WHERE `hash` = '%s'",
26 dbesc($register[0]['hash'])
30 $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d",
31 intval($register[0]['uid'])
34 $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
35 intval($user[0]['uid'])
37 if(count($r) && $r[0]['net-publish']) {
38 $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
39 if($url && strlen(get_config('system','directory')))
40 proc_run('php',"include/directory.php","$url");
43 push_lang($register[0]['language']);
45 send_register_open_eml(
47 $a->config['sitename'],
50 $register[0]['password']);
55 info( t('Account approved.') . EOL );
62 // This does not have to go through user_remove() and save the nickname
63 // permanently against re-registration, as the person was not yet
64 // allowed to have friends on this system
66 function user_deny($hash) {
68 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
72 if(! count($register))
75 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
76 intval($register[0]['uid'])
79 $r = q("DELETE FROM `user` WHERE `uid` = %d",
80 intval($register[0]['uid'])
82 $r = q("DELETE FROM `contact` WHERE `uid` = %d",
83 intval($register[0]['uid'])
85 $r = q("DELETE FROM `profile` WHERE `uid` = %d",
86 intval($register[0]['uid'])
89 $r = q("DELETE FROM `register` WHERE `hash` = '%s'",
90 dbesc($register[0]['hash'])
92 notice( sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
97 function regmod_content(&$a) {
101 $_SESSION['return_url'] = $a->cmd;
104 info( t('Please login.') . EOL);
105 $o .= '<br /><br />' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
109 if((!is_site_admin()) || (x($_SESSION,'submanage') && intval($_SESSION['submanage']))) {
110 notice( t('Permission denied.') . EOL);
122 if($cmd === 'deny') {
124 goaway($a->get_baseurl()."/admin/users/");
128 if($cmd === 'allow') {
130 goaway($a->get_baseurl()."/admin/users/");