X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fregmod.php;h=6cf4c8836c8de48a5c2b617ff625b3253f58ce20;hb=41663c7592abe55a958632c3a48265e0a8544d2b;hp=be57c8d656fd00c62d87fbf5b020086b0f0a4fc9;hpb=669dafcf22e5c4baf5c2248c967226f915cd4403;p=friendica.git
diff --git a/mod/regmod.php b/mod/regmod.php
index be57c8d656..6cf4c8836c 100644
--- a/mod/regmod.php
+++ b/mod/regmod.php
@@ -1,132 +1,109 @@
false, 'verified' => true], ['uid' => $register['uid']]);
- $r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d",
- intval($register[0]['uid'])
- );
+ $profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid'], 'is-default' => true]);
- $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
- intval($user[0]['uid'])
- );
- if (dbm::is_result($r) && $r[0]['net-publish']) {
- $url = System::baseUrl() . '/profile/' . $user[0]['nickname'];
- if ($url && strlen(get_config('system','directory'))) {
- Worker::add(PRIORITY_LOW, "directory", $url);
- }
+ if (DBA::isResult($profile) && $profile['net-publish'] && Config::get('system', 'directory')) {
+ $url = System::baseUrl() . '/profile/' . $user['nickname'];
+ Worker::add(PRIORITY_LOW, "Directory", $url);
}
- push_lang($register[0]['language']);
+ L10n::pushLang($register['language']);
- send_register_open_eml(
- $user[0]['email'],
- $a->config['sitename'],
- System::baseUrl(),
- $user[0]['username'],
- $register[0]['password']);
+ $res = User::sendRegisterOpenEmail(
+ $user,
+ Config::get('config', 'sitename'),
+ $a->getBaseUrl(),
+ defaults($register, 'password', 'Sent in a previous email')
+ );
- pop_lang();
+ L10n::popLang();
- if($res) {
- info( t('Account approved.') . EOL );
+ if ($res) {
+ info(L10n::t('Account approved.') . EOL);
return true;
}
-
}
-
// This does not have to go through user_remove() and save the nickname
// permanently against re-registration, as the person was not yet
// allowed to have friends on this system
-
-function user_deny($hash) {
-
- $register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
- dbesc($hash)
- );
-
- if (!dbm::is_result($register)) {
+function user_deny($hash)
+{
+ $register = Register::getByHash($hash);
+ if (!DBA::isResult($register)) {
return false;
}
- $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
- intval($register[0]['uid'])
- );
+ $user = User::getById($register['uid']);
+ if (!DBA::isResult($user)) {
+ exit();
+ }
- dba::delete('user', array('uid' => $register[0]['uid']));
- dba::delete('register', array('hash' => $register[0]['hash']));
+ DBA::delete('user', ['uid' => $register['uid']]);
- notice(sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
- return true;
+ Register::deleteByHash($register['hash']);
+ notice(L10n::t('Registration revoked for %s', $user['username']) . EOL);
+ return true;
}
-function regmod_content(App $a) {
-
- global $lang;
-
- $_SESSION['return_url'] = $a->cmd;
-
- if (! local_user()) {
- info( t('Please login.') . EOL);
- $o .= '
' . login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
- return $o;
+function regmod_content(App $a)
+{
+ if (!local_user()) {
+ info(L10n::t('Please login.') . EOL);
+ return Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 0 : 1);
}
- if ((!is_site_admin()) || (x($_SESSION,'submanage') && intval($_SESSION['submanage']))) {
- notice( t('Permission denied.') . EOL);
+ if (!is_site_admin() || !empty($_SESSION['submanage'])) {
+ notice(L10n::t('Permission denied.') . EOL);
return '';
}
if ($a->argc != 3) {
- killme();
+ exit();
}
- $cmd = $a->argv[1];
+ $cmd = $a->argv[1];
$hash = $a->argv[2];
-
-
if ($cmd === 'deny') {
user_deny($hash);
- goaway(System::baseUrl()."/admin/users/");
- killme();
+ $a->internalRedirect('admin/users/');
}
if ($cmd === 'allow') {
user_allow($hash);
- goaway(System::baseUrl()."/admin/users/");
- killme();
+ $a->internalRedirect('admin/users/');
}
}