code comments

This commit is contained in:
nobody 2021-08-28 18:51:12 -07:00
parent e7a7cb021b
commit 8360aee13c
2 changed files with 26 additions and 11 deletions

View file

@ -118,8 +118,13 @@ class Register extends Controller {
if ($_REQUEST['permissions_role']) {
set_aconfig($result['account']['account_id'],'register','permissions_role',$_REQUEST['permissions_role']);
}
// At this point the account has been created without error. Purge any error messages from prior failed registration
// attempts which haven't yet been delivered to the browser and start fresh. If you're willing to figure out why they
// weren't delivered to the browser please adopt zap issue 34.
$_SESSION['sysmsg'] = [];
$using_invites = intval(get_config('system','invitation_only'));
$num_invites = intval(get_config('system','number_invites'));
$invite_code = ((x($_POST,'invite_code')) ? notags(trim($_POST['invite_code'])) : '');

View file

@ -1845,19 +1845,24 @@ function can_view_public_stream() {
* @param string $s Text to display
*/
function notice($s) {
if(! session_id())
return;
if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = [];
if (! session_id()) {
return;
}
if (! x($_SESSION, 'sysmsg')) {
$_SESSION['sysmsg'] = [];
}
// ignore duplicated error messages which haven't yet been displayed
// - typically seen as multiple 'permission denied' messages
// as a result of auto-reloading a protected page with &JS=1
if(in_array($s, $_SESSION['sysmsg']))
if (in_array($s, $_SESSION['sysmsg'])) {
return;
}
if(App::$interactive) {
if (App::$interactive) {
$_SESSION['sysmsg'][] = $s;
}
}
@ -1873,16 +1878,21 @@ function notice($s) {
* @param string $s Text to display
*/
function info($s) {
if(! session_id())
if (! session_id()) {
return;
if(! x($_SESSION, 'sysmsg_info'))
}
if (! x($_SESSION, 'sysmsg_info')) {
$_SESSION['sysmsg_info'] = [];
}
if(in_array($s, $_SESSION['sysmsg_info']))
if (in_array($s, $_SESSION['sysmsg_info'])) {
return;
}
if(App::$interactive)
if (App::$interactive) {
$_SESSION['sysmsg_info'][] = $s;
}
}
/**