Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions includes/controller/guest_login_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function guest_register() {
$nick = "";
$lastname = "";
$prename = "";
$age = "";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the 'Alter' field in the User table is an integer, it cannot be set equal to an empty value

$age = 0;
$tel = "";
$dect = "";
$mobile = "";
Expand All @@ -29,6 +29,8 @@ function guest_register() {
$jabber = "";
$hometown = "";
$comment = "";
$native_lang = "";
$other_langs = "";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two variables are not initialized while showing the form, hence errors were displayed similar to 'Undefined variable $native_lang'

$twitter = "";
$facebook = "";
$github = "";
Expand All @@ -44,7 +46,7 @@ function guest_register() {

$welcome_message = WelcomeMessage();
$display_message = $welcome_message[0]['display_msg'];
$angel_types_source = select_angeltype();
$angel_types_source = select_angeltypes();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A typo, as the function that exist in the system has the name 'select_angeltypes()'

$angel_types = array();
foreach ($angel_types_source as $angel_type) {
$angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : "");
Expand Down Expand Up @@ -182,17 +184,17 @@ function guest_register() {
$ok = false;
$msg .= error(_("Please select a timezone"), true);
}
if (isset($_REQUEST['age']) && preg_match("/^[0-9]{0,4}$/", $_REQUEST['age']))
if (isset($_REQUEST['age']) && $_REQUEST['age'] != '' && preg_match("/^[0-9]{0,4}$/", $_REQUEST['age']))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Alter' field in the user table cannot have an empty value

$age = strip_request_item('age');
if (isset($_REQUEST['tel']))
$tel = strip_request_item('tel');
if (isset($_REQUEST['dect']))
$dect = strip_request_item('dect');
if (isset($_REQUEST['native_lang']))
$native_lang = strip_request_item('native_lang');
if (isset($_REQUEST['other_lang'])) {
if (isset($_REQUEST['other_langs'])) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A typo as the name of the multiselect field is other_langs

$other_langs = "";
$langs = $_REQUEST['other_lang'];
$langs = $_REQUEST['other_langs'];
foreach($langs as $lang) {
$other_langs .= $lang . ',';
}
Expand Down