diff options
-rw-r--r-- | Zotlabs/Module/Regate.php | 32 | ||||
-rw-r--r-- | Zotlabs/Module/Register.php | 51 |
2 files changed, 49 insertions, 34 deletions
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php index 372b65433..6c4aeec3e 100644 --- a/Zotlabs/Module/Regate.php +++ b/Zotlabs/Module/Regate.php @@ -178,19 +178,22 @@ class Regate extends \Zotlabs\Web\Controller { $channel_id = $new_channel['channel']['channel_id']; change_channel($channel_id); $nextpage = 'profiles/' . $channel_id; - $msg = 'ZAR1239I ' . t('Channel successfull created') . ' ' . $did2; + $msg_code = 'ZAR1239I'; + $msg = t('Channel successfull created') . ' ' . $did2; } else { - $msg = 'ZAR1239E ' . t('Channel still not created') . ' ' . $did2; + $msg_code = 'ZAR1239E'; + $msg = t('Channel still not created') . ' ' . $did2; } - zar_log($msg . ' ' . $reonar['chan.did1'] . ' (' . $reonar['chan.name'] . ')'); + zar_log($msg_code . ' ' . $msg . ' ' . $reonar['chan.did1'] . ' (' . $reonar['chan.name'] . ')'); } unset($_SESSION['login_return_url']); } else { q("ROLLBACK"); - $msg = 'ZAR1238E ' . t('Account creation error'); - zar_log($msg . ':' . print_r($cra, true)); + $msg_code = 'ZAR1238E'; + $msg = t('Account creation error'); + zar_log($msg_code . ' ' . $msg . ': ' . print_r($cra, true)); } } else { @@ -200,25 +203,32 @@ class Regate extends \Zotlabs\Web\Controller { } else { // nothing to confirm - $msg = 'ZAR1236E' . ' ' . t('Verify failed'); + $msg_code = 'ZAR1236E'; + $msg = t('Verify failed'); } } else { - $msg = 'ZAR1235E' . ' ' . t('Token verification failed'); + $msg_code = 'ZAR1235E'; + $msg = t('Token verification failed'); } } else { - $msg = 'ZAR1234W' . ' ' . t('Request not inside time frame'); + $msg_code = 'ZAR1234W'; + $msg = t('Request not inside time frame'); //info($r[0]['reg_startup'] . EOL . $r[0]['reg_expire'] ); } } else { - $msg = 'ZAR1232E' . ' ' . t('Identity unknown'); - zar_log($msg . ':' . $did2 . $didx); + $msg_code = 'ZAR1232E'; + $msg = t('Identity unknown'); + zar_log($msg_code . ' ' . $msg . ':' . $did2 . $didx); } } else { - $msg = 'ZAR1231E' . t('dId2 mistaken'); + $msg_code = 'ZAR1231E'; + $msg = t('dId2 mistaken'); + zar_log($msg_code . ' ' . $msg); + } } diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 601828d5c..99e59dd77 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -61,24 +61,28 @@ class Register extends Controller { */ - $act = q("SELECT COUNT(*) AS act FROM account")[0]['act']; - $duty = zar_register_dutystate(); - $is247 = false; - $ip = $_SERVER['REMOTE_ADDR']; - $sameip = intval(get_config('system','register_sameip')); - $arr = $_POST; - $invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : ''); - $invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : ''); - $invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : ''); - $name = ''; - $nick = ''; - $email = ((x($arr,'email')) ? notags(punify(trim($arr['email']))) : ''); - $password = ((x($arr,'password')) ? trim($arr['password']) : ''); - $password2 = ((x($arr,'password2')) ? trim($arr['password2']) : ''); + $act = q("SELECT COUNT(*) AS act FROM account")[0]['act']; + $is247 = false; + $ip = $_SERVER['REMOTE_ADDR']; + $sameip = intval(get_config('system','register_sameip')); + $arr = $_POST; + $invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : ''); + $invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : ''); + $invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : ''); + $name = ''; + $nick = ''; + $email = ((x($arr,'email')) ? notags(punify(trim($arr['email']))) : ''); + $password = ((x($arr,'password')) ? trim($arr['password']) : ''); + $password2 = ((x($arr,'password2')) ? trim($arr['password2']) : ''); $register_msg = ((x($arr,'register_msg')) ? notags(trim($arr['register_msg'])) : ''); + $reonar = []; + $auto_create = get_config('system','auto_channel_create', 1); + $duty = zar_register_dutystate(); - $reonar = []; - $auto_create = get_config('system','auto_channel_create', 1); + if (!get_config('system', 'register_duty_jso')) { + // if not yet configured default to true + $duty = array( 'isduty' => true, 'atfrm' => '', 'nowfmt' => ''); + } if($auto_create) { $name = escape_tags(trim($arr['name'])); @@ -132,8 +136,9 @@ class Register extends Controller { if ($act > 0 && !$is247 && !$duty['isduty']) { // normally (except very 1st timr after install), that should never arrive here (ie js hack or sth like) // log suitable for f2b also - $logmsg = 'ZAR0230S Unexpected registration request off duty'; - zar_log($logmsg); + $logmsg = 'Unexpected registration request off duty'; + notice($logmsg); + zar_log('ZAR0230S ' . $logmsg); return; } @@ -472,11 +477,11 @@ class Register extends Controller { $other_sites = '<a href="pubsites">' . t('Register at another affiliated hub in case when prefered') . '</a>'; } - if ( !get_config('system', 'register_duty_jso') ) { - // duty yet not configured - $duty = array( 'isduty' => false, 'atfrm' => '', 'nowfmt' => ''); - } else { - $duty = zar_register_dutystate(); + $duty = zar_register_dutystate(); + + if (!get_config('system', 'register_duty_jso')) { + // if not yet configured default to true + $duty = array( 'isduty' => true, 'atfrm' => '', 'nowfmt' => ''); } $invitations = false; |