create-prisma-php-app 1.17.2 â 1.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bootstrap.php
CHANGED
|
@@ -89,6 +89,8 @@ class AuthMiddleware
|
|
|
89
89
|
// Handle the case where the requestUri is empty, which means home or "/"
|
|
90
90
|
if (empty($requestUri) || $requestUri === '/') {
|
|
91
91
|
$requestUri = '/';
|
|
92
|
+
} else {
|
|
93
|
+
$requestUri = "/" . $requestUri;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
$regex = "#^/?" . preg_quote($pattern, '#') . "(/.*)?$#";
|
|
@@ -12,12 +12,20 @@ class Validator
|
|
|
12
12
|
/**
|
|
13
13
|
* Validate and sanitize a string.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* This function ensures that the input is a valid string, trims any leading
|
|
16
|
+
* or trailing whitespace, and converts special characters to HTML entities
|
|
17
|
+
* to prevent XSS attacks. If the input is not a string, an empty string is returned.
|
|
18
|
+
*
|
|
19
|
+
* @param mixed $value The value to validate and sanitize.
|
|
20
|
+
* @return string The sanitized string or an empty string if the input is not a string.
|
|
17
21
|
*/
|
|
18
22
|
public static function string($value): string
|
|
19
23
|
{
|
|
20
|
-
|
|
24
|
+
if (is_string($value)) {
|
|
25
|
+
return htmlspecialchars(trim($value), ENT_QUOTES, 'UTF-8');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return '';
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
/**
|
|
@@ -210,4 +218,127 @@ class Validator
|
|
|
210
218
|
$purifier = new HTMLPurifier($config);
|
|
211
219
|
return $purifier->purify($html);
|
|
212
220
|
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Converts emojis or special characters in the message content to appropriate HTML entities or format.
|
|
224
|
+
*
|
|
225
|
+
* @param string $content The content to process.
|
|
226
|
+
* @return string The processed content.
|
|
227
|
+
*/
|
|
228
|
+
public static function emojis($content): string
|
|
229
|
+
{
|
|
230
|
+
static $emojiMap = [
|
|
231
|
+
':)' => 'đ',
|
|
232
|
+
':-)' => 'đ',
|
|
233
|
+
':(' => 'âšī¸',
|
|
234
|
+
':-(' => 'âšī¸',
|
|
235
|
+
':D' => 'đ',
|
|
236
|
+
':-D' => 'đ',
|
|
237
|
+
':P' => 'đ',
|
|
238
|
+
':-P' => 'đ',
|
|
239
|
+
';)' => 'đ',
|
|
240
|
+
';-)' => 'đ',
|
|
241
|
+
':o' => 'đŽ',
|
|
242
|
+
':-o' => 'đŽ',
|
|
243
|
+
':O' => 'đŽ',
|
|
244
|
+
':-O' => 'đŽ',
|
|
245
|
+
'B)' => 'đ',
|
|
246
|
+
'B-)' => 'đ',
|
|
247
|
+
':|' => 'đ',
|
|
248
|
+
':-|' => 'đ',
|
|
249
|
+
':/' => 'đ',
|
|
250
|
+
':-/' => 'đ',
|
|
251
|
+
':\\' => 'đ',
|
|
252
|
+
':-\\' => 'đ',
|
|
253
|
+
':*' => 'đ',
|
|
254
|
+
':-*' => 'đ',
|
|
255
|
+
'<3' => 'â¤ī¸',
|
|
256
|
+
'</3' => 'đ',
|
|
257
|
+
':@' => 'đĄ',
|
|
258
|
+
':-@' => 'đĄ',
|
|
259
|
+
':S' => 'đ',
|
|
260
|
+
':-S' => 'đ',
|
|
261
|
+
':$' => 'đŗ',
|
|
262
|
+
':-$' => 'đŗ',
|
|
263
|
+
':X' => 'đ¤',
|
|
264
|
+
':-X' => 'đ¤',
|
|
265
|
+
':#' => 'đ¤',
|
|
266
|
+
':-#' => 'đ¤',
|
|
267
|
+
':^)' => 'đ',
|
|
268
|
+
':v' => 'đ',
|
|
269
|
+
':3' => 'đē',
|
|
270
|
+
'O:)' => 'đ',
|
|
271
|
+
'O:-)' => 'đ',
|
|
272
|
+
'>:)' => 'đ',
|
|
273
|
+
'>:-)' => 'đ',
|
|
274
|
+
'D:' => 'đ§',
|
|
275
|
+
'D-:' => 'đ§',
|
|
276
|
+
':-o' => 'đ¯',
|
|
277
|
+
':p' => 'đ',
|
|
278
|
+
':-p' => 'đ',
|
|
279
|
+
':b' => 'đ',
|
|
280
|
+
':-b' => 'đ',
|
|
281
|
+
':^/' => 'đ',
|
|
282
|
+
':-^/' => 'đ',
|
|
283
|
+
'>_<' => 'đŖ',
|
|
284
|
+
'-_-' => 'đ',
|
|
285
|
+
'^_^' => 'đ',
|
|
286
|
+
'T_T' => 'đĸ',
|
|
287
|
+
'TT_TT' => 'đ',
|
|
288
|
+
'xD' => 'đ',
|
|
289
|
+
'XD' => 'đ',
|
|
290
|
+
'xP' => 'đ',
|
|
291
|
+
'XP' => 'đ',
|
|
292
|
+
':wave:' => 'đ',
|
|
293
|
+
':thumbsup:' => 'đ',
|
|
294
|
+
':thumbsdown:' => 'đ',
|
|
295
|
+
':clap:' => 'đ',
|
|
296
|
+
':fire:' => 'đĨ',
|
|
297
|
+
':100:' => 'đ¯',
|
|
298
|
+
':poop:' => 'đŠ',
|
|
299
|
+
':smile:' => 'đ',
|
|
300
|
+
':smirk:' => 'đ',
|
|
301
|
+
':sob:' => 'đ',
|
|
302
|
+
':heart:' => 'â¤ī¸',
|
|
303
|
+
':broken_heart:' => 'đ',
|
|
304
|
+
':grin:' => 'đ',
|
|
305
|
+
':joy:' => 'đ',
|
|
306
|
+
':cry:' => 'đĸ',
|
|
307
|
+
':angry:' => 'đ ',
|
|
308
|
+
':sunglasses:' => 'đ',
|
|
309
|
+
':kiss:' => 'đ',
|
|
310
|
+
':thinking:' => 'đ¤',
|
|
311
|
+
':shocked:' => 'đ˛',
|
|
312
|
+
':shhh:' => 'đ¤Ģ',
|
|
313
|
+
':nerd:' => 'đ¤',
|
|
314
|
+
':cool:' => 'đ',
|
|
315
|
+
':scream:' => 'đą',
|
|
316
|
+
':zzz:' => 'đ¤',
|
|
317
|
+
':celebrate:' => 'đ',
|
|
318
|
+
':ok_hand:' => 'đ',
|
|
319
|
+
':pray:' => 'đ',
|
|
320
|
+
':muscle:' => 'đĒ',
|
|
321
|
+
':tada:' => 'đ',
|
|
322
|
+
':eyes:' => 'đ',
|
|
323
|
+
':star:' => 'â',
|
|
324
|
+
':bulb:' => 'đĄ',
|
|
325
|
+
':chicken:' => 'đ',
|
|
326
|
+
':cow:' => 'đŽ',
|
|
327
|
+
':dog:' => 'đļ',
|
|
328
|
+
':cat:' => 'đą',
|
|
329
|
+
':fox:' => 'đĻ',
|
|
330
|
+
':lion:' => 'đĻ',
|
|
331
|
+
':penguin:' => 'đ§',
|
|
332
|
+
':pig:' => 'đˇ',
|
|
333
|
+
':rabbit:' => 'đ°',
|
|
334
|
+
':tiger:' => 'đ¯',
|
|
335
|
+
':unicorn:' => 'đĻ',
|
|
336
|
+
':bear:' => 'đģ',
|
|
337
|
+
':elephant:' => 'đ',
|
|
338
|
+
':monkey:' => 'đ',
|
|
339
|
+
':panda:' => 'đŧ',
|
|
340
|
+
];
|
|
341
|
+
|
|
342
|
+
return strtr($content, $emojiMap);
|
|
343
|
+
}
|
|
213
344
|
}
|