From 9bbdb71ee4ccc1cf5433d8c21c8d96f668f81d2b Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Fri, 6 Aug 2004 20:15:32 +0000
Subject: [PATCH] - Patch #9330: ucfirst() gives problem when used with
 multibyte charset.   Replaced the use of ucfirst() with a CSS-based solution.

---
 database/database.pgsql        | 2 +-
 database/updates.inc           | 4 ++--
 includes/common.inc            | 2 +-
 includes/menu.inc              | 2 +-
 includes/theme.inc             | 4 ++--
 misc/drupal.css                | 8 ++++++++
 modules/block.module           | 2 +-
 modules/block/block.module     | 2 +-
 modules/tracker.module         | 2 +-
 modules/tracker/tracker.module | 2 +-
 modules/user.module            | 2 +-
 modules/user/user.module       | 2 +-
 12 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/database/database.pgsql b/database/database.pgsql
index d59fa6e6bf27..289a2e275240 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -354,7 +354,7 @@ CREATE TABLE node_access (
   grant_update smallint NOT NULL default '0',
   grant_delete smallint NOT NULL default '0',
   PRIMARY KEY  (nid,gid,realm)
-); 
+);
 
 
 --
diff --git a/database/updates.inc b/database/updates.inc
index 21010b7479b6..3d7f408e9816 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -1113,7 +1113,7 @@ function update_88() {
     $ret[] = update_sql("ALTER TABLE {menu} DROP status");
     $ret[] = update_sql("ALTER TABLE {menu} DROP visibility");
     $ret[] = update_sql("ALTER TABLE {menu} ADD type INT(2) UNSIGNED DEFAULT '0' NOT NULL");
-  } 
+  }
   else {
     $ret[] = update_sql("ALTER TABLE {menu} ADD type smallint");
     $ret[] = update_sql("ALTER TABLE {menu} ALTER COLUMN type SET DEFAULT '0'");
@@ -1126,7 +1126,7 @@ function update_88() {
 
 function update_89() {
   $ret = array();
-  
+
   if ($GLOBALS['db_type'] == 'mysql') {
     $ret[] = update_sql("ALTER TABLE {node} CHANGE static sticky INT(2) DEFAULT '0' NOT NULL");
   }
diff --git a/includes/common.inc b/includes/common.inc
index f12a6d191a10..90fe085599b1 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -19,7 +19,7 @@ function drupal_set_title($title = NULL) {
   static $stored_title;
 
   if (isset($title)) {
-    $stored_title = ucfirst($title);
+    $stored_title = $title;
   }
   return $stored_title;
 }
diff --git a/includes/menu.inc b/includes/menu.inc
index ca7a1e3fbb43..d1aa3372c646 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -404,7 +404,7 @@ function menu_get_active_title() {
   $menu = menu_get_menu();
 
   if ($mid = menu_get_active_nontask_item()) {
-    return ucfirst($menu['items'][$mid]['title']);
+    return $menu['items'][$mid]['title'];
   }
 }
 
diff --git a/includes/theme.inc b/includes/theme.inc
index 60f9dfe43061..36181fac07b5 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -204,12 +204,12 @@ function theme_status_messages() {
       if (count($messages) > 1) {
         $output .= " <ul>\n";
         foreach($messages as $message) {
-          $output .= '  <li>'. ucfirst($message) ."</li>\n";
+          $output .= '  <li>'. $message ."</li>\n";
         }
         $output .= " </ul>\n";
       }
       else {
-        $output .= ucfirst($messages[0]);
+        $output .= $messages[0];
       }
       $output .= "</div>\n";
     }
diff --git a/misc/drupal.css b/misc/drupal.css
index b65cb315fee7..f733bd238556 100644
--- a/misc/drupal.css
+++ b/misc/drupal.css
@@ -87,6 +87,14 @@ li a.active {
 td.menu-disabled {
   background: #ccc;
 }
+
+/*
+** CSS capitalization
+*/
+.title:first-letter,
+.messages:first-letter,
+.messages li:first-letter { text-transform: uppercase; }
+
 /*
 ** Other common styles
 */
diff --git a/modules/block.module b/modules/block.module
index 93a93c260bcc..d6aced3ca087 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -361,7 +361,7 @@ function block_list($region) {
         $base = parse_url($base_url);
         $session = session_name() .'='. session_id();
         $url = str_replace(array($base['path'], '?'. $session), '', request_uri());
-        $url = ereg_replace('^/(\?q=)?', '', $url);      
+        $url = ereg_replace('^/(\?q=)?', '', $url);
         $matched = preg_match($block['path'], $url);
       }
       else {
diff --git a/modules/block/block.module b/modules/block/block.module
index 93a93c260bcc..d6aced3ca087 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -361,7 +361,7 @@ function block_list($region) {
         $base = parse_url($base_url);
         $session = session_name() .'='. session_id();
         $url = str_replace(array($base['path'], '?'. $session), '', request_uri());
-        $url = ereg_replace('^/(\?q=)?', '', $url);      
+        $url = ereg_replace('^/(\?q=)?', '', $url);
         $matched = preg_match($block['path'], $url);
       }
       else {
diff --git a/modules/tracker.module b/modules/tracker.module
index f5889ec9f09e..66816fece505 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -63,7 +63,7 @@ function tracker_page($uid = 0) {
     }
 
     $rows[] = array(
-      ucfirst(node_invoke($node->type, 'node_name')),
+      node_invoke($node->type, 'node_name'),
       l($node->title, "node/$node->nid") .' '. (node_is_new($node->nid, $node->changed) ? theme('mark') : ''),
       format_name($node),
       array('class' => 'replies', 'data' => $comments),
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index f5889ec9f09e..66816fece505 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -63,7 +63,7 @@ function tracker_page($uid = 0) {
     }
 
     $rows[] = array(
-      ucfirst(node_invoke($node->type, 'node_name')),
+      node_invoke($node->type, 'node_name'),
       l($node->title, "node/$node->nid") .' '. (node_is_new($node->nid, $node->changed) ? theme('mark') : ''),
       format_name($node),
       array('class' => 'replies', 'data' => $comments),
diff --git a/modules/user.module b/modules/user.module
index 832059081be0..9de1009e2e8a 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -207,7 +207,7 @@ function user_validate_authmap($account, $authname, $module) {
   $result = db_query("SELECT COUNT(*) from {authmap} WHERE uid != %d AND authname = '%s'", $account->uid, $authname);
   if (db_result($result) > 0) {
     $name = module_invoke($module, 'info', 'name');
-    return t('The %u ID %s is already taken.', array('%u' => ucfirst($name), '%s' => "<i>$authname</i>"));
+    return t('The %u ID %s is already taken.', array('%u' => $name, '%s' => "<i>$authname</i>"));
   }
 }
 
diff --git a/modules/user/user.module b/modules/user/user.module
index 832059081be0..9de1009e2e8a 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -207,7 +207,7 @@ function user_validate_authmap($account, $authname, $module) {
   $result = db_query("SELECT COUNT(*) from {authmap} WHERE uid != %d AND authname = '%s'", $account->uid, $authname);
   if (db_result($result) > 0) {
     $name = module_invoke($module, 'info', 'name');
-    return t('The %u ID %s is already taken.', array('%u' => ucfirst($name), '%s' => "<i>$authname</i>"));
+    return t('The %u ID %s is already taken.', array('%u' => $name, '%s' => "<i>$authname</i>"));
   }
 }
 
-- 
GitLab