Skip to content

Commit

Permalink
Allows Names with Diacritics #47
Browse files Browse the repository at this point in the history
  • Loading branch information
kimbtech committed Feb 3, 2024
1 parent 0fd15a8 commit 04d8974
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2.8.1
2.8.2
2.8
2
2 changes: 1 addition & 1 deletion php/classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Config {
/**
* The system's version.
*/
const VERSION = 'v2.8.1';
const VERSION = 'v2.8.2';

/**
* The real domain which should be used.
Expand Down
17 changes: 12 additions & 5 deletions php/classes/Inner.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public function radioForm() : void {
$radios[] = array(
"ID" => $id,
"COUNT" => $count,
"NAME" => $radio['name'],
"NAME" => htmlspecialchars($radio['name'], encoding: 'UTF-8'),
"URL" => $radio['url'],
"PROXY_YES" => $radio['proxy'] ? 'checked="checked"' : '',
"PROXY_NO" => !$radio['proxy'] ? 'checked="checked"' : '',
"TYPE_RADIO" => $radio['type'] != 'nc' ? 'checked="checked"' : '',
"TYPE_NC" => $radio['type'] == 'nc' ? 'checked="checked"' : '',
"LOGO" => $radio['logo'],
"DESC" => $radio['desc'],
"DESC" => htmlspecialchars($radio['desc'], encoding: 'UTF-8'),
"CAT_OPTIONS" => array_reduce(
$categories,
fn($c, $i) => $c.'<option value="'.$i.'" '.($i === $radio['category'] ? 'selected' : '').'>'.$i.'</option>',
Expand All @@ -108,7 +108,7 @@ public function podcastForm() : void {
$podcasts[] = array(
"ID" => $id,
"COUNT" => $count,
"NAME" => $pod['name'],
"NAME" => htmlspecialchars($pod['name'], encoding: 'UTF-8'),
"URL" => $pod['url'],
"TYPE_RSS" => $pod['type'] == 'rss' ? 'checked="checked"' : '',
"TYPE_NC" => $pod['type'] == 'nc' ? 'checked="checked"' : '',
Expand Down Expand Up @@ -142,8 +142,15 @@ public static function filterURL(string $url) : string {
}

public static function filterName(string $name): string{
$name = str_replace( ['ä','ü','ß','ö','Ä','Ü','Ö'], ['ae','ue','ss','oe','Ae','Ue','Oe'], $name);
$name = substr( preg_replace( '/[^0-9A-Za-z \.\-\_\,\&\;\/\(\)]/', '', $name ), 0, 200 );
// $name = str_replace( ['ä','ü','ß','ö','Ä','Ü','Ö'], ['ae','ue','ss','oe','Ae','Ue','Oe'], $name);
$name = substr( preg_replace(
'/[^ -\x{2122}]/u',
// pattern inspired from
// https://stackoverflow.com/a/43106144 by mickmackusa
// CC BY-SA, https://creativecommons.org/licenses/by-sa/3.0/
'', $name
), 0, 200 );

return empty($name) ? 'empty' : $name;
}

Expand Down

0 comments on commit 04d8974

Please sign in to comment.