Skip to content

Commit

Permalink
#1709 - use utf8 save ucfirst
Browse files Browse the repository at this point in the history
  • Loading branch information
GodMod committed Jul 21, 2018
1 parent 8bcbb91 commit 53090c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions core/core.functions.php
Expand Up @@ -821,6 +821,15 @@ function is_utf8($str){
return true; // kein ungültiges UTF-8-Zeichen gefunden
}

function utf8_ucfirst($str) {
if(function_exists('mb_strtoupper')){
$fc = mb_strtoupper(mb_substr($str, 0, 1));
return $fc.mb_substr($str, 1);
} else {
return ucfirst($str);
}
}

function clean_username($strUsername){
$strUsername = utf8_strtolower($strUsername);
return $strUsername;
Expand Down
10 changes: 5 additions & 5 deletions core/routing.class.php
Expand Up @@ -106,7 +106,7 @@ public function getPageObjects($blnIncludeStatic = false){
foreach($arrFiles as $strFilename) {
$strObjectName = str_replace('_pageobject.class.php', '', $strFilename);
if (!$blnIncludeStatic && in_array($strObjectName, $this->arrStaticRoutes)) continue;
$arrOut[$strObjectName] = ucfirst($strObjectName);
$arrOut[$strObjectName] = utf8_ucfirst($strObjectName);
}
return $arrOut;
}
Expand All @@ -118,12 +118,12 @@ public function build($arrPageObject, $strParamText=false, $strParam=false, $bln
if (is_array($arrPageObject)){
foreach($arrPageObject as $key => $strPageObject){
if ($key == 0){
$strPath .= ucfirst($this->get($strPageObject, true));
$strPath .= utf8_ucfirst($this->get($strPageObject, true));
} else {
$strPath .= '/'.$strPageObject;
}
}
} else $strPath .= ucfirst($this->get($arrPageObject, true));
} else $strPath .= utf8_ucfirst($this->get($arrPageObject, true));

if ($strParamText || $strParam) $strPath .= '/';
if ($strParamText) $strPath .= $this->clean($strParamText);
Expand All @@ -144,7 +144,7 @@ public function build($arrPageObject, $strParamText=false, $strParam=false, $bln

public function simpleBuild($strPageObject){
$strPath = $this->controller_path;
$strPath .= ucfirst($this->get($strPageObject, true));
$strPath .= utf8_ucfirst($this->get($strPageObject, true));
if (substr($strPath, -1, 1) != "/") $strPath .= '/';
return $strPath;
}
Expand All @@ -168,7 +168,7 @@ public function clean($strText){
$a_satzzeichen = array("\"",",",";",".",":","!","?", "&", "=", "/", "|", "#", "*", "+", "(", ")", "%", "$", "´", "", "", "", "", "`", "^", '"', "'", ">", "<");
$strText = str_replace($a_satzzeichen, "", $strText);
$strText = htmlspecialchars($strText);
return ucfirst($strText);
return utf8_ucfirst($strText);
}

public function getPageObject($strObjectName){
Expand Down

0 comments on commit 53090c5

Please sign in to comment.