@@ -47,11 +47,12 @@ class Messagesystem
4747 *
4848 * Controller für diverse Message Actions
4949 *
50- * @version 2.2
50+ * @version 2.3
5151 * @since 1.0 `[z]milamber` method added
5252 * @since 2.0 `IneX` code optimizations
5353 * @since 2.1 `04.04.2021` `IneX` fixed wrong check if own message, and PHP Deprecated: Non-static method Messagesystem::sendMessage()
5454 * @since 2.2 `04.12.2024` `IneX` fixed passing NULL to htmlspecialchars_decode() stringg parameter is deprecated
55+ * @since 2.3 `15.11.2025` `IneX` Code hardenings
5556 *
5657 * @uses BARBARA_HARRIS
5758 * @uses Messagesystem::sendMessage()
@@ -64,7 +65,7 @@ static function execActions($doAction=null)
6465 global $ user ;
6566
6667 /** Validate parameters */
67- $ doAction = filter_var ($ doAction , FILTER_DEFAULT , FILTER_REQUIRE_SCALAR ) ?? null ;
68+ $ doAction = filter_var ($ doAction , FILTER_SANITIZE_SPECIAL_CHARS ) ?? null ;
6869 zorgDebugger::log ()->debug ('$doAction: %s ' , [$ doAction ]);
6970 if (isset ($ _POST ['message_id ' ]) && is_array ($ _POST ['message_id ' ])) { // $_POST['message_id'] (multiple)
7071 $ i =0 ;
@@ -78,7 +79,7 @@ static function execActions($doAction=null)
7879 $ deleteMessageId = filter_input (INPUT_POST , 'delete_message_id ' , FILTER_VALIDATE_INT ) ?? null ; // $_POST['delete_message_id']
7980 $ msgSubject = htmlspecialchars_decode (filter_input (INPUT_POST , 'subject ' , FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ?: '' , ENT_COMPAT | ENT_SUBSTITUTE );
8081 $ msgText = htmlspecialchars_decode (filter_input (INPUT_POST , 'text ' , FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ?: '' , ENT_COMPAT | ENT_SUBSTITUTE );
81- $ headerLocation = base64url_decode (filter_input (INPUT_POST , 'url ' , FILTER_SANITIZE_FULL_SPECIAL_CHARS )) ?? sprintf ('%s/user/%d?box=inbox ' , SITE_URL , $ user ->id );
82+ $ headerLocation = base64url_decode (filter_input (INPUT_POST , 'url ' , FILTER_SANITIZE_ENCODED )) ?? sprintf ('%s/user/%d?box=inbox ' , SITE_URL , $ user ->id );
8283 zorgDebugger::log ()->debug ('header() Location: %s ' , [$ headerLocation ]);
8384
8485 if ($ doAction === 'sendmessage ' )
@@ -206,7 +207,7 @@ static function execActions($doAction=null)
206207 * @param integer $deleter_userid User-ID welcher die Nachricht(en) löscht
207208 * @global object $db Globales Class-Object mit allen MySQL-Methoden
208209 */
209- function deleteMessage ($ messageid , $ deleter_userid )
210+ static function deleteMessage ($ messageid , $ deleter_userid )
210211 {
211212 global $ db ;
212213
@@ -328,12 +329,9 @@ static function getFormDelete($id)
328329 *
329330 * Baut das HTML-Formular um eine neue Nachrichten zu versenden
330331 *
331- * @author [z]milamber
332- * @author IneX
333- * @date 23.06.2018
334332 * @version 2.0
335- * @since 1.0 initial method release
336- * @since 2.0 frontend is now a template - as it should be
333+ * @since 1.0 `[z]milamber` initial method release
334+ * @since 2.0 `23.06.2018` `IneX` frontend is now a template - as it should be
337335 *
338336 * @param string $to_users Alle Empfänger der Nachricht
339337 * @param string $subject Titel der Nachricht
@@ -348,11 +346,11 @@ static function getFormSend($to_users, $subject, $text, $delete_message_id=0)
348346 global $ user , $ smarty ;
349347
350348 $ smarty ->assign ('form_action ' , base64url_decode (getURL ()));
351- $ smarty ->assign ('form_url ' , getURL ( ));
349+ $ smarty ->assign ('form_url ' , base64url_encode ( ' /profil.php?user_id= ' . strval ( $ user -> id ). ' &box=outbox ' ));
352350 $ smarty ->assign ('subject ' , $ subject );
353351 $ smarty ->assign ('text ' , $ text );
354352 $ smarty ->assign ('userlist ' , $ user ->getFormFieldUserlist ('to_users[] ' , 15 , $ to_users , 4 ));
355- $ smarty ->assign ('backlink_url ' , '/user/ ' . $ user ->id . ' ? box=inbox ' );
353+ $ smarty ->assign ('backlink_url ' , '/profil.php?user_id= ' . strval ( $ user ->id ). ' & box=inbox ' );
356354 $ smarty ->assign ('delete_message_id ' , $ delete_message_id );
357355
358356 return $ smarty ->fetch ('file:layout/partials/messages/messages_send.tpl ' );
@@ -632,7 +630,7 @@ static function getPrevMessageid($id)
632630 * @global object $db Globales Class-Object mit allen MySQL-Methoden
633631 * @return boolean Returns true or false, depening on the susccessful execution
634632 */
635- function sendMessage ($ from_user_id , $ owner , $ subject , $ text ='' , $ to_users ='' , $ isread ='0 ' )
633+ static function sendMessage ($ from_user_id , $ owner , $ subject , $ text ='' , $ to_users ='' , $ isread ='0 ' )
636634 {
637635 global $ db , $ notification ;
638636
0 commit comments