Do better about checking the fields exist before trying to send.
jdarwood007

jdarwood007 commited on 2024-01-31 17:05:15
Showing 1 changed files, with 7 additions and 1 deletions.

... ...
@@ -249,9 +249,15 @@ class SFS
249 249
 		// Guests!
250 250
 		if ($this->user_info['is_guest'])
251 251
 		{
252
-			$guestname = !isset($_POST['guestname']) ? '' : trim($_POST['guestname']);
252
+			$guestname = !isset($_POST['guestname']) ? '' : trim(normalize_spaces(sanitize_chars($_POST['guestname'], 1, ' '), true, true, array('no_breaks' => true, 'replace_tabs' => true, 'collapse_hspace' => true)));
253 253
 			$email = !isset($_POST['email']) ? '' : trim($_POST['email']);
254 254
 
255
+			// SMF will take care of these if we are checking them.
256
+			if (!empty($this->modSettings['sfs_emailcheck']) && empty($modSettings['guest_post_no_email']) && empty($email))
257
+				return false;
258
+			else if (!empty($this->modSettings['sfs_usernamecheck']) && empty($guestname))
259
+				return false;
260
+
255 261
 			return $this->sfsCheck([
256 262
 				['username' => $guestname],
257 263
 				['email' => $email],
258 264