File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
Controller/Administration/Api Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -150,11 +150,12 @@ public function convertEncoding(string $outputString = ''): string
150150
151151 /**
152152 * Sanitizes input to avoid CSV injection.
153- * @param string|int $value
153+ * @param int|string $value
154+ * @return string|int
154155 */
155- public static function sanitize ($ value ): string
156+ public static function sanitize (int | string $ value ): string | int
156157 {
157- if (preg_match ('/[=\+\-\@\|]/ ' , $ value )) {
158+ if (preg_match ('/[=\+\-\@\|]/ ' , ( string ) $ value )) {
158159 return '" ' . str_replace ('" ' , '"" ' , $ value ) . '" ' ;
159160 }
160161
Original file line number Diff line number Diff line change 11<?php
22
3- declare (strict_types=1 );
4-
53/**
64 * The Statistics Controller
75 *
1715 * @since 2024-04-21
1816 */
1917
18+ declare (strict_types=1 );
19+
2020namespace phpMyFAQ \Controller \Administration \Api ;
2121
2222use JsonException ;
@@ -78,7 +78,8 @@ public function truncateSessions(Request $request): JsonResponse
7878 return $ this ->json (['error ' => Translation::get (key: 'msgNoPermission ' )], Response::HTTP_UNAUTHORIZED );
7979 }
8080
81- $ month = Filter::filterVar ($ request ->attributes ->get ('month ' ), FILTER_SANITIZE_SPECIAL_CHARS );
81+ $ month = Filter::filterVar ($ request ->getPayload ()->get ('month ' ), FILTER_SANITIZE_SPECIAL_CHARS );
82+
8283 if ($ this ->container ->get (id: 'phpmyfaq.helper.statistics ' )->deleteTrackingFiles ($ month )) {
8384 return $ this ->json (['success ' => Translation::get (key: 'ad_adminlog_delete_success ' )], Response::HTTP_OK );
8485 }
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ public function deleteTrackingFiles(string $month): bool
171171 $ dir = opendir (PMF_ROOT_DIR . '/content/core/data ' );
172172 $ first = PHP_INT_MAX ;
173173 $ last = 0 ;
174+
174175 while ($ trackingFile = readdir ($ dir )) {
175176 // The filename format is: trackingDDMMYYYY
176177 // e.g.: tracking02042006
You can’t perform that action at this time.
0 commit comments