diff options
Diffstat (limited to 'include/account.php')
-rw-r--r-- | include/account.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/include/account.php b/include/account.php index e448bdcc6..c64197b49 100644 --- a/include/account.php +++ b/include/account.php @@ -11,6 +11,7 @@ require_once('include/text.php'); require_once('include/language.php'); require_once('include/datetime.php'); require_once('include/crypto.php'); +require_once('include/identity.php'); function check_account_email($email) { @@ -247,7 +248,7 @@ function verify_email_address($arr) { $res = mail($arr['email'], email_header_encode(sprintf( t('Registration confirmation for %s'), get_config('system','sitename'))), $email_msg, - 'From: ' . 'Administrator' . '@' . get_app()->get_hostname() . "\n" + 'From: ' . 'Administrator' . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); @@ -313,7 +314,7 @@ function send_reg_approval_email($arr) { $res = mail($admin['email'], sprintf( t('Registration request at %s'), get_config('system','sitename')), $email_msg, - 'From: ' . t('Administrator') . '@' . get_app()->get_hostname() . "\n" + 'From: ' . t('Administrator') . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); @@ -329,7 +330,7 @@ function send_reg_approval_email($arr) { return($delivered ? true : false); } -function send_verification_email($email,$password) { +function send_register_success_email($email,$password) { $email_msg = replace_macros(get_intltext_template('register_open_eml.tpl'), array( '$sitename' => get_config('system','sitename'), @@ -340,7 +341,7 @@ function send_verification_email($email,$password) { $res = mail($email, sprintf( t('Registration details for %s'), get_config('system','sitename')), $email_msg, - 'From: ' . t('Administrator') . '@' . get_app()->get_hostname() . "\n" + 'From: ' . t('Administrator') . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); @@ -353,7 +354,7 @@ function send_verification_email($email,$password) { * @param string $hash * @return array|boolean */ -function user_allow($hash) { +function account_allow($hash) { $ret = array('success' => false); @@ -406,6 +407,9 @@ function user_allow($hash) { pop_lang(); + if(get_config('system','auto_channel_create') || UNO) + auto_channel_create($register[0]['uid']); + if ($res) { info( t('Account approved.') . EOL ); return true; @@ -414,7 +418,7 @@ function user_allow($hash) { /** - * @brief Denies a user registration. + * @brief Denies an account registration. * * This does not have to go through user_remove() and save the nickname * permanently against re-registration, as the person was not yet @@ -423,7 +427,8 @@ function user_allow($hash) { * @param string $hash * @return boolean */ -function user_deny($hash) { + +function account_deny($hash) { $register = q("SELECT * FROM register WHERE hash = '%s' LIMIT 1", dbesc($hash) @@ -452,11 +457,14 @@ function user_deny($hash) { } +// called from regver to activate an account from the email verification link -function user_approve($hash) { +function account_approve($hash) { $ret = array('success' => false); + // Note: when the password in the register table is 'verify', the uid actually contains the account_id + $register = q("SELECT * FROM `register` WHERE `hash` = '%s' and password = 'verify' LIMIT 1", dbesc($hash) ); @@ -491,6 +499,10 @@ function user_approve($hash) { intval($register[0]['uid']) ); + + if(get_config('system','auto_channel_create') || UNO) + auto_channel_create($register[0]['uid']); + info( t('Account verified. Please login.') . EOL ); return true; @@ -643,7 +655,7 @@ function account_service_class_allows($aid, $property, $usage = false) { function service_class_fetch($uid, $property) { $a = get_app(); if($uid == local_channel()) { - $service_class = $a->account['account_service_class']; + $service_class = App::$account['account_service_class']; } else { $r = q("select account_service_class as service_class |