4 use Friendica\Core\Config;
5 use Friendica\Core\System;
6 use Friendica\Core\Worker;
7 use Friendica\Database\DBM;
8 use Friendica\Model\User;
9 use Friendica\Module\Login;
11 require_once 'include/enotify.php';
13 function user_allow($hash)
17 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
22 if (!DBM::is_result($register)) {
26 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
27 intval($register[0]['uid'])
30 if (!DBM::is_result($user)) {
34 $r = q("DELETE FROM `register` WHERE `hash` = '%s'",
35 dbesc($register[0]['hash'])
39 $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d",
40 intval($register[0]['uid'])
43 $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
44 intval($user[0]['uid'])
46 if (DBM::is_result($r) && $r[0]['net-publish']) {
47 $url = System::baseUrl() . '/profile/' . $user[0]['nickname'];
48 if ($url && strlen(Config::get('system', 'directory'))) {
49 Worker::add(PRIORITY_LOW, "Directory", $url);
53 push_lang($register[0]['language']);
55 User::sendRegisterOpenEmail(
57 $a->config['sitename'],
60 $register[0]['password']);
65 info(t('Account approved.') . EOL);
70 // This does not have to go through user_remove() and save the nickname
71 // permanently against re-registration, as the person was not yet
72 // allowed to have friends on this system
73 function user_deny($hash)
75 $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
79 if (!DBM::is_result($register)) {
83 $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
84 intval($register[0]['uid'])
87 dba::delete('user', array('uid' => $register[0]['uid']));
88 dba::delete('register', array('hash' => $register[0]['hash']));
90 notice(sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
94 function regmod_content(App $a)
99 info(t('Please login.') . EOL);
100 $o .= '<br /><br />' . Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
104 if ((!is_site_admin()) || (x($_SESSION, 'submanage') && intval($_SESSION['submanage']))) {
105 notice(t('Permission denied.') . EOL);
116 if ($cmd === 'deny') {
118 goaway(System::baseUrl() . "/admin/users/");
122 if ($cmd === 'allow') {
124 goaway(System::baseUrl() . "/admin/users/");