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 (! dbm::is_result($register)) {
19 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
20 intval($register[0]['uid'])
23 if (! dbm::is_result($user)) {
27 $r = q("DELETE FROM `register` WHERE `hash` = '%s'",
28 dbesc($register[0]['hash'])
32 $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d",
33 intval($register[0]['uid'])
36 $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
37 intval($user[0]['uid'])
39 if (dbm::is_result($r) && $r[0]['net-publish']) {
40 $url = App::get_baseurl() . '/profile/' . $user[0]['nickname'];
41 if ($url && strlen(get_config('system','directory'))) {
42 proc_run(PRIORITY_LOW, "include/directory.php", $url);
46 push_lang($register[0]['language']);
48 send_register_open_eml(
50 $a->config['sitename'],
53 $register[0]['password']);
58 info( t('Account approved.') . EOL );
65 // This does not have to go through user_remove() and save the nickname
66 // permanently against re-registration, as the person was not yet
67 // allowed to have friends on this system
69 function user_deny($hash) {
71 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
75 if(! dbm::is_result($register))
78 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
79 intval($register[0]['uid'])
82 $r = q("DELETE FROM `user` WHERE `uid` = %d",
83 intval($register[0]['uid'])
85 $r = q("DELETE FROM `contact` WHERE `uid` = %d",
86 intval($register[0]['uid'])
88 $r = q("DELETE FROM `profile` WHERE `uid` = %d",
89 intval($register[0]['uid'])
92 $r = q("DELETE FROM `register` WHERE `hash` = '%s'",
93 dbesc($register[0]['hash'])
95 notice( sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
100 function regmod_content(App &$a) {
104 $_SESSION['return_url'] = $a->cmd;
106 if (! local_user()) {
107 info( t('Please login.') . EOL);
108 $o .= '<br /><br />' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
112 if ((!is_site_admin()) || (x($_SESSION,'submanage') && intval($_SESSION['submanage']))) {
113 notice( t('Permission denied.') . EOL);
126 if ($cmd === 'deny') {
128 goaway(App::get_baseurl()."/admin/users/");
132 if ($cmd === 'allow') {
134 goaway(App::get_baseurl()."/admin/users/");