From: Michael M Slusarz Date: Tue, 13 Jul 2010 19:45:58 +0000 (-0600) Subject: Ticket #9124: Remove horde/Core dependency from horde/Nls. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a0ce9ace9c3114b59d4926dd43c89cd19f4794c4;p=horde.git Ticket #9124: Remove horde/Core dependency from horde/Nls. Move all of the Horde_Nls:: code dependent on Horde configuration to horde/Core. A core dependency has thus manifested itself in a bunch of framework libraries thought to be horde/Core free (since getCharset() is dependent on the local Horde configuration). The following functions have been moved to registry: Horde_Nls::config -> Horde_Registry::$nlsconfig Horde_Nls::select() -> Horde_Registry::preferredLang() Horde_Nls::setLanguage() -> Horde_Registry::setLanguage() Horde_Nls::setTextdomain() -> Horde_Registry::setTextdomain() Horde_Nls::setLanguageEnvironment() -> Horde_Registry::setLanguageEnvironment() Horde_Nls::isValid() -> Horde_Registry::isValidLang() Horde_Nls::getCharset() -> Horde_Registry::getCharset() Horde_Nls::getExternalCharset() -> Horde_Registry::getExternalCharset() Horde_Nls::getEmailCharset() -> Horde_Registry::getEmailCharset() Horde_Nls::setCharset() -> Horde_Registry::setCharset() Horde_Nls::setCharsetEnvironment() -> Horde_Registry::setCharsetEnvironment() Horde_Nls::setTimeZone() -> Horde_Registry::setTimeZone() Horde_Nls::generateFlagImageByHost() -> Horde_Ui_FlagImage::generateFlagImageByHost() Horde_Registry::initApp() now accepts the boolean 'timezone' parameter, which will set the timezone if true. --- diff --git a/agora/lib/Agora.php b/agora/lib/Agora.php index b35d6e101..94c94815f 100644 --- a/agora/lib/Agora.php +++ b/agora/lib/Agora.php @@ -406,7 +406,7 @@ class Agora { $body = new Horde_Mime_Part(); $body->setType('text/plain'); - $body->setCharset(Horde_Nls::getCharset()); + $body->setCharset($GLOBALS['registry']->getCharset()); $body->setContents($message['body']); $body->send($forum['forum_distribution_address'], $msg_headers, $conf['mailer']['type'], $conf['mailer']['params']); diff --git a/agora/lib/Messages.php b/agora/lib/Messages.php index bf06e53e8..71e973f34 100644 --- a/agora/lib/Messages.php +++ b/agora/lib/Messages.php @@ -566,7 +566,7 @@ class Agora_Messages { strftime($GLOBALS['prefs']->getValue('date_format'), $message['message_timestamp'])) . "\n-------------------------------------------------------\n" . $message['body']; - $message['body'] = "\n> " . Horde_String::wrap($message['body'], 60, "\n> ", Horde_Nls::getCharset()); + $message['body'] = "\n> " . Horde_String::wrap($message['body'], 60, "\n> ", $GLOBALS['registry']->getCharset()); return $message; } @@ -993,7 +993,7 @@ class Agora_Messages { foreach ($messages as $id => &$message) { $message['message_id'] = $id; $message['message_author'] = htmlspecialchars($message['message_author']); - $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, Horde_Nls::getCharset()); + $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, $GLOBALS['registry']->getCharset()); $message['message_date'] = $this->dateFormat($message['message_timestamp']); if ($format) { $message['body'] = $this->formatBody($this->convertFromDriver($message['body'])); @@ -1147,7 +1147,7 @@ class Agora_Messages { $message['forum_name'] = $this->convertFromDriver($forums_list[$message['forum_id']]); $message['message_id'] = $id; $message['message_author'] = htmlspecialchars($message['message_author']); - $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, Horde_Nls::getCharset()); + $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, $GLOBALS['registry']->getCharset()); $message['message_body'] = Horde_Text_Filter::filter($this->convertFromDriver($message['body']), 'highlightquotes'); if ($message['attachments']) { $message['message_attachment'] = $this->getAttachmentLink($id); @@ -2113,7 +2113,7 @@ class Agora_Messages { } if (!empty($filter['author'])) { - $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], Horde_Nls::getCharset())); + $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], $GLOBALS['registry']->getCharset())); } /* Sort by result column. */ @@ -2214,7 +2214,7 @@ class Agora_Messages { */ public function convertToDriver($value) { - return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']); + return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']); } /** diff --git a/agora/lib/View.php b/agora/lib/View.php index 6610b0441..d530acdb8 100644 --- a/agora/lib/View.php +++ b/agora/lib/View.php @@ -19,7 +19,7 @@ class Agora_View extends Horde_View { { /* Set default data. */ parent::__construct(array('templatePath' => AGORA_TEMPLATES . '/', - 'encoding' => Horde_Nls::getCharset())); + 'encoding' => $GLOBALS['registry']->getCharset())); } } diff --git a/agora/messages/abuse.php b/agora/messages/abuse.php index 307b11d27..282e4b36f 100644 --- a/agora/messages/abuse.php +++ b/agora/messages/abuse.php @@ -75,7 +75,7 @@ if ($form->validate()) { 'body' => $url . "\n\n" . $registry->getAuth() . "\n\n" . $_SERVER["REMOTE_ADDR"], 'to' => $emails, 'from' => $emails[0], - 'charset' => Horde_Nls::getCharset())); + 'charset' => $GLOBALS['registry']->getCharset())); $mail->addHeader('User-Agent', 'Agora ' . $registry->getVersion()); $mail->send($injector->getInstance('Horde_Mail')); diff --git a/agora/rss/index.php b/agora/rss/index.php index 95bfccd48..d57808098 100644 --- a/agora/rss/index.php +++ b/agora/rss/index.php @@ -20,16 +20,15 @@ $cache = $injector->getInstance('Horde_Cache'); $rss = $cache->get($cache_key, $conf['cache']['default_lifetime']); if (!$rss) { - $title = sprintf(_("Forums in %s"), $registry->get('name', $scope)); $forums = Agora_Messages::singleton($scope); $forums_list = $forums->getForums(0, true, 'forum_name', 0); - $rss = ' + $rss = 'getCharset() . '" ?> ' . htmlspecialchars($title) . ' - ' . str_replace('_', '-', strtolower(Horde_Nls::select())) . ' + ' . str_replace('_', '-', strtolower($registry->preferredLang())) . ' ' . date('r') . ' ' . htmlspecialchars($title) . ' ' . Horde::applicationUrl('index.php', true, -1) . ' @@ -51,5 +50,5 @@ if (!$rss) { $cache->set($cache_key, $rss); } -header('Content-type: text/xml; charset=' . Horde_Nls::getCharset()); +header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset()); echo $rss; diff --git a/agora/rss/messages.php b/agora/rss/messages.php index c7932d411..b2d97f14d 100644 --- a/agora/rss/messages.php +++ b/agora/rss/messages.php @@ -31,11 +31,11 @@ if (!$rss) { exit; } - $rss = ' + $rss = 'getCharset() . '" ?> ' . htmlspecialchars($message['message_subject']) . ' - ' . str_replace('_', '-', strtolower(Horde_Nls::select())) . ' + ' . str_replace('_', '-', strtolower($registry->preferredLang())) . ' ' . date('r') . ' ' . htmlspecialchars($message['message_subject']) . ' ' . Horde::applicationUrl('index.php', true, -1) . ' @@ -59,5 +59,5 @@ if (!$rss) { $cache->set($cache_key, $rss); } -header('Content-type: text/xml; charset=' . Horde_Nls::getCharset()); +header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset()); echo $rss; diff --git a/agora/rss/threads.php b/agora/rss/threads.php index ebd99a709..f95b988cc 100644 --- a/agora/rss/threads.php +++ b/agora/rss/threads.php @@ -59,11 +59,11 @@ if (!$rss) { $threads_list = $threads->getThreads(0, false, 'message_modifystamp', 1, true, '', null, 0, 10); - $rss = ' + $rss = 'getCharset() . '" ?> ' . htmlspecialchars($title) . ' - ' . str_replace('_', '-', strtolower(Horde_Nls::select())) . ' + ' . str_replace('_', '-', strtolower($registry->preferredLang())) . ' ' . date('r') . ' ' . htmlspecialchars($title) . ' ' . Horde::applicationUrl('index.php', true, -1) . ' @@ -98,5 +98,5 @@ if (!$rss) { $cache->set($cache_key, $rss); } -header('Content-type: text/xml; charset=' . Horde_Nls::getCharset()); +header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset()); echo $rss; diff --git a/agora/templates/common-header.inc b/agora/templates/common-header.inc index 27e5ce71d..7902bc0bd 100644 --- a/agora/templates/common-header.inc +++ b/agora/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/ansel/gallery/sort.php b/ansel/gallery/sort.php index d9ecb7d6f..683305e05 100644 --- a/ansel/gallery/sort.php +++ b/ansel/gallery/sort.php @@ -63,7 +63,7 @@ $title = sprintf(_("%s :: Sort"), $gallery->get('name')); require ANSEL_TEMPLATES . '/common-header.inc'; require ANSEL_TEMPLATES . '/menu.inc'; ?> -

+

getCharset()) ?>

@@ -85,7 +85,7 @@ require ANSEL_TEMPLATES . '/menu.inc'; getImages(); foreach ($images as $image) { - $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()) : htmlspecialchars($image->caption, ENT_COMPAT, Horde_Nls::getCharset()); + $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) : htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()); echo '
' . '' . htmlspecialchars($image->filename) . '' diff --git a/ansel/img/ecard.php b/ansel/img/ecard.php index ac7a87720..4b61e3428 100644 --- a/ansel/img/ecard.php +++ b/ansel/img/ecard.php @@ -35,7 +35,7 @@ case 'send': break; } - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); /* Create the text part. */ $textpart = new Horde_Mime_Part(); @@ -59,7 +59,7 @@ case 'send': $img_tag = '

'; $comments = $htmlpart->replaceEOL(Horde_Util::getFormData('ecard_comments')); if (!Horde_Util::getFormData('rtemode')) { - $comments = '

' . htmlspecialchars($comments, ENT_COMPAT, Horde_Nls::getCharset()) . '
'; + $comments = '
' . htmlspecialchars($comments, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '
'; } $htmlpart->setContents('' . $img_tag . $comments . ''); $related->setContentTypeParameter('start', $htmlpart->setContentID()); diff --git a/ansel/lib/Ansel.php b/ansel/lib/Ansel.php index 1b1aac0d1..cd3d8ced2 100644 --- a/ansel/lib/Ansel.php +++ b/ansel/lib/Ansel.php @@ -684,7 +684,7 @@ class Ansel // Check for an active image if (!empty($image_id)) { - $text = '' . htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()) . ''; + $text = '' . htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; $nav = $separator . $text . $nav; $levels++; } @@ -709,7 +709,7 @@ class Ansel } if (!empty($owner_title)) { - $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, Horde_Nls::getCharset()); + $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()); $levels++; if ($gallery) { $nav = $separator . Ansel::getUrlFor('view', array('view' => 'List', 'groupby' => 'owner', 'owner' => $owner, 'havesearch' => $haveSearch))->link() . $owner_title . '
' . $nav; diff --git a/ansel/lib/Block/gallery.php b/ansel/lib/Block/gallery.php index 37b5524c0..eab51a0d1 100644 --- a/ansel/lib/Block/gallery.php +++ b/ansel/lib/Block/gallery.php @@ -68,7 +68,7 @@ class Horde_Block_ansel_gallery extends Horde_Block 'slug' => $gallery->get('slug')), true); return $viewurl->link() - . @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset()) + . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; } diff --git a/ansel/lib/Block/my_galleries.php b/ansel/lib/Block/my_galleries.php index cda1ea68b..e612bfb3c 100644 --- a/ansel/lib/Block/my_galleries.php +++ b/ansel/lib/Block/my_galleries.php @@ -82,7 +82,7 @@ HEADER; $html .= '' . $url->link(array('onmouseout' => '$("ansel_preview").hide();$("ansel_preview").update("");', 'onmouseover' => 'previewImageMg(event, ' . $gallery->getDefaultImage('ansel_default') . ');')) - . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset()) . '' + . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '' . strftime($GLOBALS['prefs']->getValue('date_format'), $gallery->get('last_modified')) . '' . (int)$gallery->countImages(true) . ''; } diff --git a/ansel/lib/Block/recent_comments.php b/ansel/lib/Block/recent_comments.php index 9bdec8e45..c263442be 100644 --- a/ansel/lib/Block/recent_comments.php +++ b/ansel/lib/Block/recent_comments.php @@ -51,7 +51,7 @@ class Horde_Block_ansel_recent_comments extends Horde_Block } // Build the gallery name. if (isset($this->_params['gallery'])) { - $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset()); + $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $style = $gallery->getStyle(); $viewurl = Ansel::getUrlFor('view', diff --git a/ansel/lib/Block/recent_faces.php b/ansel/lib/Block/recent_faces.php index 5056b9ecb..9552accd4 100644 --- a/ansel/lib/Block/recent_faces.php +++ b/ansel/lib/Block/recent_faces.php @@ -38,7 +38,7 @@ class Horde_Block_ansel_recent_faces extends Horde_Block $results = $faces->allFaces(0, $this->_params['limit']); $html = ''; foreach ($results as $face_id => $face) { - $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, Horde_Nls::getCharset()); + $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); $html .= '' . '' . $facenane  . ''; diff --git a/ansel/lib/Block/recently_added.php b/ansel/lib/Block/recently_added.php index db3511ce7..6f3d4419c 100644 --- a/ansel/lib/Block/recently_added.php +++ b/ansel/lib/Block/recently_added.php @@ -54,7 +54,7 @@ class Horde_Block_ansel_recently_added extends Horde_Block // Build the gallery name. if (isset($this->_params['gallery'])) { $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, - Horde_Nls::getCharset()); + $GLOBALS['registry']->getCharset()); } $style = $gallery->getStyle(); @@ -130,7 +130,7 @@ HEADER; true); $galleryLink = $galleryLink->link() . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, - Horde_Nls::getCharset()) + $GLOBALS['registry']->getCharset()) . ''; $caption = substr($image->caption, 0, 30); @@ -153,7 +153,7 @@ HEADER; 'onmouseover' => 'previewImage(event, ' . $image->id . ');')) . @htmlspecialchars( strlen($caption) ? $caption : $image->filename, - ENT_COMPAT, Horde_Nls::getCharset()) + ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '' . $galleryLink . ''; } diff --git a/ansel/lib/Block/recently_added_geodata.php b/ansel/lib/Block/recently_added_geodata.php index 417a6c10a..8cd6b43e8 100644 --- a/ansel/lib/Block/recently_added_geodata.php +++ b/ansel/lib/Block/recently_added_geodata.php @@ -60,7 +60,7 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block { // Build the gallery name. if (isset($this->_params['gallery'])) { - $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset()); + $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $style = $gallery->getStyle(); diff --git a/ansel/lib/GalleryMode/Date.php b/ansel/lib/GalleryMode/Date.php index 56bd32be7..109c44d6b 100644 --- a/ansel/lib/GalleryMode/Date.php +++ b/ansel/lib/GalleryMode/Date.php @@ -122,7 +122,7 @@ class Ansel_GalleryMode_Date $trail[] = array('title' => _("All dates"), 'navdata' => $navdata); } - $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset()); + $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()); $navdata = array('view' => 'Gallery', 'gallery' => $this->_gallery->id, 'slug' => $this->_gallery->get('slug')); diff --git a/ansel/lib/Image.php b/ansel/lib/Image.php index b27ce2b25..f4471a3e8 100644 --- a/ansel/lib/Image.php +++ b/ansel/lib/Image.php @@ -1236,7 +1236,7 @@ class Ansel_Image Implements Iterator $output[$field] = $value; } else { $description = isset($data['description']) ? $data['description'] : $field; - $output[] = '' . $description . '' . htmlspecialchars($value, ENT_COMPAT, Horde_Nls::getCharset()) . ''; + $output[] = '' . $description . '' . htmlspecialchars($value, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; } } diff --git a/ansel/lib/Storage.php b/ansel/lib/Storage.php index 2833f0176..f4cbdeafc 100644 --- a/ansel/lib/Storage.php +++ b/ansel/lib/Storage.php @@ -516,9 +516,9 @@ class Ansel_Storage Horde::logMessage($update, 'ERR'); throw new Ansel_Exception($update); } - $result = $update->execute(array(Horde_String::convertCharset($image->filename, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), + $result = $update->execute(array(Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), $image->type, - Horde_String::convertCharset($image->caption, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), $image->sort, $image->originalDate, $image->lat, @@ -556,9 +556,9 @@ class Ansel_Storage /* Perform the INSERT */ $result = $insert->execute(array($image_id, $image->gallery, - Horde_String::convertCharset($image->filename, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), $image->type, - Horde_String::convertCharset($image->caption, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), $image->uploaded, $image->sort, $image->originalDate, @@ -591,7 +591,7 @@ class Ansel_Storage public function saveImageAttribute($image_id, $attribute, $value) { $insert = $this->_db->prepare('INSERT INTO ansel_image_attributes (image_id, attr_name, attr_value) VALUES (?, ?, ?)'); - $result = $insert->execute(array($image_id, $attribute, Horde_String::convertCharset($value, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']))); + $result = $insert->execute(array($image_id, $attribute, Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']))); if ($result instanceof PEAR_Error) { throw new Ansel_Exception($result); } @@ -965,7 +965,7 @@ class Ansel_Storage if ($galleries[$gallery_id]['perm']) { $data = array((string)Ansel::getImageUrl($image->id, $image_view, $full, $style), - htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()), + htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()), Horde_Text_Filter::filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)), $image->id, 0); @@ -991,7 +991,7 @@ class Ansel_Storage } if (count($json)) { - return Horde_Serialize::serialize($json, Horde_Serialize::JSON, Horde_Nls::getCharset()); + return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); } else { return ''; } diff --git a/ansel/lib/Tags.php b/ansel/lib/Tags.php index d7d727f93..578376523 100644 --- a/ansel/lib/Tags.php +++ b/ansel/lib/Tags.php @@ -49,13 +49,13 @@ class Ansel_Tags } $tag = Horde_String::lower(trim($tag)); $sql = $GLOBALS['ansel_db']->prepare('SELECT tag_id FROM ansel_tags WHERE tag_name = ?'); - $result = $sql->execute(Horde_String::convertCharset($tag, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset'])); + $result = $sql->execute(Horde_String::convertCharset($tag, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset'])); $results = $result->fetchRow(MDB2_FETCHMODE_ASSOC); $result->free(); if (empty($results)) { $id = $GLOBALS['ansel_db']->nextId('ansel_tags'); - $result = $insert->execute(array($id, Horde_String::convertCharset($tag, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']))); + $result = $insert->execute(array($id, Horde_String::convertCharset($tag, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']))); $tagkeys[] = $id; } elseif ($results instanceof PEAR_Error) { Horde::logMessage($results->getMessage(), 'ERR'); diff --git a/ansel/lib/Tile/DateGallery.php b/ansel/lib/Tile/DateGallery.php index ad54c9977..385cdce9a 100644 --- a/ansel/lib/Tile/DateGallery.php +++ b/ansel/lib/Tile/DateGallery.php @@ -105,7 +105,7 @@ class Ansel_Tile_DateGallery /* Variables used in the template file */ $image_link = $view_link . $gallery_image . ''; - $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, Horde_Nls::getCharset()) . ''; + $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; $gallery_count = $dgallery->countImages(true); /* Background color is needed if displaying a mini tile */ diff --git a/ansel/lib/Tile/Gallery.php b/ansel/lib/Tile/Gallery.php index a605bd22f..6a16ce0f8 100644 --- a/ansel/lib/Tile/Gallery.php +++ b/ansel/lib/Tile/Gallery.php @@ -81,7 +81,7 @@ class Ansel_Tile_Gallery } $image_link = $view_link . $gallery_image . ''; - $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset()) + $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT) && !$mini) { @@ -105,7 +105,7 @@ class Ansel_Tile_Gallery if (empty($owner_string)) { $owner_string = $gallery->get('owner'); } - $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, Horde_Nls::getCharset()) . ''; + $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; } $gallery_count = $gallery->countImages(true); diff --git a/ansel/lib/View/Base.php b/ansel/lib/View/Base.php index ad7ad53e9..050ab7905 100644 --- a/ansel/lib/View/Base.php +++ b/ansel/lib/View/Base.php @@ -254,7 +254,7 @@ abstract class Ansel_View_Base } $data = array((string)Ansel::getImageUrl($image->id, $params['image_view'], $params['full'], $style['name']), - htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()), + htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()), Horde_Text_Filter::filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)), $image->id, $curpage); @@ -276,7 +276,7 @@ abstract class Ansel_View_Base $json[] = $data; } - return Horde_Serialize::serialize($json, Horde_Serialize::JSON, Horde_Nls::getCharset()); + return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); } /** diff --git a/ansel/lib/Widget/Links.php b/ansel/lib/Widget/Links.php index ec6485913..36e67bb1d 100644 --- a/ansel/lib/Widget/Links.php +++ b/ansel/lib/Widget/Links.php @@ -24,7 +24,7 @@ class Ansel_Widget_Links extends Ansel_Widget_Base $html = $this->_htmlBegin(); $html .= Ansel::getUrlFor('rss_user', array('owner' => $owner))->link() . Horde::img('feed.png') . ' ' . ($owner ? sprintf(_("Recent photos by %s"), $owner) : _("Recent system photos")) . ''; $slug = $this->_view->gallery->get('slug'); - $html .= '
' . Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $slug))->link() . ' ' . Horde::img('feed.png') . ' ' . sprintf(_("Recent photos in %s"), htmlspecialchars($this->_view->gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset())) . ''; + $html .= '
' . Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $slug))->link() . ' ' . Horde::img('feed.png') . ' ' . sprintf(_("Recent photos in %s"), htmlspecialchars($this->_view->gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset())) . ''; /* Embed html */ if (empty($this->_view->_params['image_id'])) { diff --git a/ansel/rss.php b/ansel/rss.php index 726f3596f..f5fad6d6c 100644 --- a/ansel/rss.php +++ b/ansel/rss.php @@ -269,10 +269,10 @@ if (empty($rss)) { } } - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $xsl = $registry->get('themesuri') . '/feed-rss.xsl'; - $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, Horde_Nls::getCharset()); - $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, Horde_Nls::getCharset()); + $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); + $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); $stream_updated = htmlspecialchars(date('r', $params['last_modified'])); $stream_official = htmlspecialchars($params['link']); $image_url = htmlspecialchars($params['image_url']); diff --git a/ansel/scripts/recursive_import.php b/ansel/scripts/recursive_import.php index ab5db7c10..4d5e64c85 100755 --- a/ansel/scripts/recursive_import.php +++ b/ansel/scripts/recursive_import.php @@ -75,7 +75,7 @@ if (empty($dir)) { $cli->fatal(_("You must specify a valid directory.")); } -Horde_Nls::setCharset('utf-8'); +$registry->setCharset('utf-8'); $gallery_id = processDirectory($dir); if (!$keepEmpties) { $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id); diff --git a/ansel/templates/captions/captions.inc b/ansel/templates/captions/captions.inc index 6f752abd2..cc147240b 100644 --- a/ansel/templates/captions/captions.inc +++ b/ansel/templates/captions/captions.inc @@ -7,7 +7,7 @@

- + getCharset()) ?>

get('desc')): ?> @@ -33,7 +33,7 @@ if ($gallery->countImages()) { echo ''; echo '' . htmlspecialchars($image->filename) . '' . ''; + htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; $count++; if (($count % 2) == 0) { diff --git a/ansel/templates/common-header.inc b/ansel/templates/common-header.inc index 99d87ebd3..7140be40b 100644 --- a/ansel/templates/common-header.inc +++ b/ansel/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> @@ -21,7 +21,7 @@ Horde::outputMetaTags(); Horde::includeScriptFiles(); ?> -<?php echo htmlspecialchars($page_title, ENT_COMPAT, Horde_Nls::getCharset()) ?> +<?php echo htmlspecialchars($page_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?> diff --git a/ansel/templates/faces/gallery.inc b/ansel/templates/faces/gallery.inc index f2f8e1f40..cfdb56c6d 100644 --- a/ansel/templates/faces/gallery.inc +++ b/ansel/templates/faces/gallery.inc @@ -32,7 +32,7 @@ render() ?> -

+

getCharset()) ?>

getStyle(); diff --git a/ansel/templates/image/edit_image.inc b/ansel/templates/image/edit_image.inc index 0265d41e0..704037a21 100644 --- a/ansel/templates/image/edit_image.inc +++ b/ansel/templates/image/edit_image.inc @@ -1,4 +1,4 @@ -

+

getCharset()) ?>

+

getCharset()) ?>

copy()->add(array_merge( diff --git a/ansel/templates/image/preview_image.inc b/ansel/templates/image/preview_image.inc index d9cd9c87f..e5d564fab 100644 --- a/ansel/templates/image/preview_image.inc +++ b/ansel/templates/image/preview_image.inc @@ -1,4 +1,4 @@ -

+

getCharset()) ?>

add( array_merge( diff --git a/ansel/templates/image/resize_image.inc b/ansel/templates/image/resize_image.inc index e5d12f12f..7e655eb17 100644 --- a/ansel/templates/image/resize_image.inc +++ b/ansel/templates/image/resize_image.inc @@ -29,7 +29,7 @@ function resetImage() document.slider.setValue(); } -

+

getCharset()) ?>

- ' ?> + getCharset()) . ' ' . Horde::link(Horde::applicationUrl($refresh_link), _("Refresh List")) . Horde::img('reload.png', _("Refresh List")) . '' ?>
diff --git a/ansel/templates/view/results.inc b/ansel/templates/view/results.inc index 14e8c9b44..9bee44dfa 100644 --- a/ansel/templates/view/results.inc +++ b/ansel/templates/view/results.inc @@ -66,7 +66,7 @@ $allLink = (!empty($this->_owner)) ? Horde::selfUrl()->add(array('view' => 'Resu if ($total) { echo '' . ($total > $this->_perPage ? sprintf(_("%d to %d of %d Items"), $this->_pagestart, $this->_pageend, $total) : sprintf(ngettext("%d Item", "%d Items", $total), $total)) . '' . $allLink . ''; } -echo htmlspecialchars($this->getTitle(), ENT_COMPAT, Horde_Nls::getCharset()) . $this->_search->getTagTrail(); +echo htmlspecialchars($this->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . $this->_search->getTagTrail(); ?> diff --git a/ansel/templates/xppublish/new.inc b/ansel/templates/xppublish/new.inc index 098b74d53..4e9a16f1b 100755 --- a/ansel/templates/xppublish/new.inc +++ b/ansel/templates/xppublish/new.inc @@ -21,7 +21,7 @@
- +
diff --git a/babel/lib/Display.php b/babel/lib/Display.php index 8f7218b26..fd1fe09ca 100644 --- a/babel/lib/Display.php +++ b/babel/lib/Display.php @@ -63,7 +63,7 @@ class Translate_Display { if (preg_match('/charset=(.*)/i', $headers, $m)) { return $m[1]; } - return Horde_Nls::getCharset(); + return $GLOBALS['registry']->getCharset(); } function convert_string($msg) { @@ -72,7 +72,7 @@ class Translate_Display { $f = array('/</', '/>/'); $t = array('<', '>'); $msg = preg_replace($f, $t, $msg); - return Horde_String::convertCharset(html_entity_decode($msg), Horde_Nls::getCharset(), Translate_Display::parseCharset($po->meta['Content-Type'])); + return Horde_String::convertCharset(html_entity_decode($msg), $GLOBALS['registry']->getCharset(), Translate_Display::parseCharset($po->meta['Content-Type'])); } function display_string($msg) { @@ -81,7 +81,7 @@ class Translate_Display { $f = array('//'); $t = array('<', '>'); $msg = preg_replace($f, $t, $msg); - return Horde_String::convertCharset($msg, Translate_Display::parseCharset($po->meta['Content-Type']), Horde_Nls::getCharset()); + return Horde_String::convertCharset($msg, Translate_Display::parseCharset($po->meta['Content-Type']), $GLOBALS['registry']->getCharset()); } function get_percent($used, $total) { diff --git a/babel/templates/common-header.inc b/babel/templates/common-header.inc index 3dfb2b09b..3a4bd4491 100644 --- a/babel/templates/common-header.inc +++ b/babel/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/chora/annotate.php b/chora/annotate.php index d2a080389..1a8d7764b 100644 --- a/chora/annotate.php +++ b/chora/annotate.php @@ -42,7 +42,7 @@ try { Chora::fatal($e); } -$title = sprintf(_("Source Annotation of %s (revision %s)"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)), $rev); +$title = sprintf(_("Source Annotation of %s (revision %s)"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)), $rev); $extraLink = sprintf('%s | %s', Chora::url('co', $where, array('r' => $rev)), _("View"), Chora::url('co', $where, array('r' => $rev, 'p' => 1)), _("Download")); @@ -72,7 +72,7 @@ while (list(,$line) = each($lines)) { } $prev = $fl->queryPreviousRevision($rev); - $line = Horde_Text_Filter::filter($line['line'], 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)); + $line = Horde_Text_Filter::filter($line['line'], 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); include CHORA_TEMPLATES . '/annotate/line.inc'; } diff --git a/chora/browsedir.php b/chora/browsedir.php index 19c095545..5d7bae5f6 100644 --- a/chora/browsedir.php +++ b/chora/browsedir.php @@ -88,7 +88,7 @@ if ($dirList) { continue; } $url = Chora::url('browsedir', $where . '/' . $currentDir . '/', array('onb' => $onb)); - $currDir = Horde_Text_Filter::filter($currentDir, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)); + $currDir = Horde_Text_Filter::filter($currentDir, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); require CHORA_TEMPLATES . '/directory/dir.inc'; } echo ''; @@ -115,7 +115,7 @@ if ($fileList) { $log = $lg->queryLog(); $attic = $currFile->isDeleted(); $fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname; - $name = Horde_Text_Filter::filter($realname, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)); + $name = Horde_Text_Filter::filter($realname, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); $url = Chora::url('browsefile', $fileName, array('onb' => $onb)); $readableDate = Chora::readableTime($date); if ($log) { diff --git a/chora/cvsgraph.php b/chora/cvsgraph.php index 5a96b0700..3776e5906 100644 --- a/chora/cvsgraph.php +++ b/chora/cvsgraph.php @@ -49,7 +49,7 @@ if (Horde_Util::getFormData('show_image')) { passthru($conf['paths']['cvsgraph'] . ' ' . $argstr . ' ' . $file); } else { // Display the wrapper page for the image. - $title = sprintf(_("Graph for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true))); + $title = sprintf(_("Graph for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true))); $extraLink = Chora::getFileViews($where, 'cvsgraph'); require CHORA_TEMPLATES . '/common-header.inc'; diff --git a/chora/diff.php b/chora/diff.php index 0ede4187f..ccf9e5690 100644 --- a/chora/diff.php +++ b/chora/diff.php @@ -55,7 +55,7 @@ if ($type != 'colored') { $abbrev_r1 = $VC->abbrev($r1); $abbrev_r2 = $VC->abbrev($r2); $title = sprintf(_("Diff for %s between version %s and %s"), - Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)), $abbrev_r1, $abbrev_r2); + Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)), $abbrev_r1, $abbrev_r2); /* Format log entries. */ $log_messages = array(); diff --git a/chora/history.php b/chora/history.php index 66382ef23..11e6035e6 100644 --- a/chora/history.php +++ b/chora/history.php @@ -127,7 +127,7 @@ foreach ($grid as $cols) { $maxCol = max($val, $maxCol); } -$title = sprintf(_("Source Branching View for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true))); +$title = sprintf(_("Source Branching View for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true))); $extraLink = Chora::getFileViews($where, 'history'); require CHORA_TEMPLATES . '/common-header.inc'; diff --git a/chora/lib/Chora.php b/chora/lib/Chora.php index 51f881a71..864738e66 100644 --- a/chora/lib/Chora.php +++ b/chora/lib/Chora.php @@ -60,7 +60,7 @@ class Chora if (!empty($onb)) { $url = Horde_Util::addParameter($url, array('onb' => $onb)); } - $bar .= '/ '. Horde_Text_Filter::filter($dir, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)) . ' '; + $bar .= '/ '. Horde_Text_Filter::filter($dir, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)) . ' '; } } @@ -467,7 +467,7 @@ class Chora */ static public function formatLogMessage($log) { - $log = Horde_Text_Filter::filter($log, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => Horde_Nls::getCharset(), 'class' => '')); + $log = Horde_Text_Filter::filter($log, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => '')); return (empty($GLOBALS['conf']['tickets']['regexp']) || empty($GLOBALS['conf']['tickets']['replacement'])) ? $log diff --git a/chora/stats.php b/chora/stats.php index fc298056d..ba53919d4 100644 --- a/chora/stats.php +++ b/chora/stats.php @@ -29,7 +29,7 @@ foreach ($fl->queryLogs() as $lg) { } arsort($stats); -$title = sprintf(_("Statistics for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true))); +$title = sprintf(_("Statistics for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true))); Horde::addScriptFile('tables.js', 'horde'); require CHORA_TEMPLATES . '/common-header.inc'; require CHORA_TEMPLATES . '/menu.inc'; diff --git a/chora/templates/common-header.inc b/chora/templates/common-header.inc index 8cb7a32af..e235bbe1a 100644 --- a/chora/templates/common-header.inc +++ b/chora/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } echo !empty($language) ? '' : ''; @@ -13,7 +13,7 @@ if (!empty($title)) { Horde::outputMetaTags(); if (Horde_Util::nonInputVar('js_vars')) { - Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, Horde_Nls::getCharset())); + Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())); } Horde::includeScriptFiles(); diff --git a/crumb/templates/common-header.inc b/crumb/templates/common-header.inc index c54f0a4e1..1385eaffd 100644 --- a/crumb/templates/common-header.inc +++ b/crumb/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/drag_n_drop_portal/block.php b/drag_n_drop_portal/block.php index c6c926b32..eb3e4886e 100644 --- a/drag_n_drop_portal/block.php +++ b/drag_n_drop_portal/block.php @@ -34,4 +34,4 @@ if ($block instanceof PEAR_Error) { } } -echo Horde_Serialize::serialize($block_data, Horde_Serialize::JSON, Horde_Nls::getCharset()); +echo Horde_Serialize::serialize($block_data, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); diff --git a/drag_n_drop_portal/lib/Block/Layout/View/js.php b/drag_n_drop_portal/lib/Block/Layout/View/js.php index d30ffc8ec..33689edf0 100644 --- a/drag_n_drop_portal/lib/Block/Layout/View/js.php +++ b/drag_n_drop_portal/lib/Block/Layout/View/js.php @@ -92,9 +92,9 @@ class Horde_Block_Layout_View_Js extends Horde_Block_Layout_View { } } - $content = Horde_Serialize::serialize($content, Horde_Serialize::JSON, Horde_Nls::getCharset()); - $title = Horde_Serialize::serialize($title, Horde_Serialize::JSON, Horde_Nls::getCharset()); - $params = Horde_Serialize::serialize($params, Horde_Serialize::JSON, Horde_Nls::getCharset()); + $content = Horde_Serialize::serialize($content, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); + $title = Horde_Serialize::serialize($title, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); + $params = Horde_Serialize::serialize($params, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); $js_init .= 'portal.add(new Xilinus.Widget().' . 'setTitle(title_' . $js_id .').' diff --git a/fima/data.php b/fima/data.php index e9c5fee04..aa0ee84fd 100644 --- a/fima/data.php +++ b/fima/data.php @@ -86,7 +86,7 @@ case 'export': break; case 'eo': case 'desc': - $row[$key] = Horde_String::convertCharset($value, Horde_Nls::getCharset(), $params['charset']); + $row[$key] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $params['charset']); break; default: break; @@ -216,7 +216,7 @@ if ($next_step == Horde_Data::IMPORT_FILE) { $charsets[$charset] = $charset; } } - $my_charset = Horde_Nls::getCharset(true); + $my_charset = $GLOBALS['registry']->getCharset(true); } foreach ($templates[$next_step] as $template) { diff --git a/fima/lib/Driver/sql.php b/fima/lib/Driver/sql.php index eff602afd..7ebda335b 100644 --- a/fima/lib/Driver/sql.php +++ b/fima/lib/Driver/sql.php @@ -532,9 +532,9 @@ class Fima_Driver_sql extends Fima_Driver { $this->_ledger, sprintf('%\'04d', $number), $type, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)(bool)$eo, - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)(bool)$closed); /* Log the query at a DEBUG log level. */ @@ -576,9 +576,9 @@ class Fima_Driver_sql extends Fima_Driver { $this->_params['table_accounts']); $values = array(sprintf('%\'04d', $number), $type, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)(bool)$eo, - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)(bool)$closed, $this->_ledger, $accountId); @@ -722,7 +722,7 @@ class Fima_Driver_sql extends Fima_Driver { $account, (int)(bool)$eo, (float)$amount, - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset'])); + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset'])); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('Fima_Driver_sql::_addPosting(): %s', $query), 'DEBUG'); @@ -769,7 +769,7 @@ class Fima_Driver_sql extends Fima_Driver { $account, (int)(bool)$eo, (float)$amount, - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $this->_ledger, $postingId); diff --git a/fima/lib/base.php b/fima/lib/base.php index edf566344..47ad7c574 100644 --- a/fima/lib/base.php +++ b/fima/lib/base.php @@ -45,7 +45,7 @@ require_once FIMA_BASE . '/lib/Driver.php'; Horde::compressOutput(); // Set the timezone variable. -Horde_Nls::setTimeZone(); +$registry->setTimeZone(); // Create a share instance. $GLOBALS['fima_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); diff --git a/fima/templates/common-header.inc b/fima/templates/common-header.inc index 796bc6906..2f7e2db31 100644 --- a/fima/templates/common-header.inc +++ b/fima/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/folks/config/hooks.php.dist b/folks/config/hooks.php.dist index f7d03f1e1..d49051e08 100644 --- a/folks/config/hooks.php.dist +++ b/folks/config/hooks.php.dist @@ -308,7 +308,7 @@ class Folks_Hooks $value = hash('md5', $value); } $fields[] = 'user_' . Horde_String::lower($field); - $values[] = Horde_String::convertCharset($value, Horde_Nls::getCharset(), $conf['sql']['charset']); + $values[] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']); } $values[] = $userID; diff --git a/folks/lib/Folks.php b/folks/lib/Folks.php index 77b3e8282..c14380348 100644 --- a/folks/lib/Folks.php +++ b/folks/lib/Folks.php @@ -235,7 +235,7 @@ class Folks { */ static public function sendMail($to, $subject, $body, $attaches = array()) { - $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => Horde_Nls::getCharset())); + $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => $GLOBALS['registry']->getCharset())); $mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion()); $mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']); @@ -243,7 +243,7 @@ class Folks { foreach ($attaches as $file) { if (file_exists($file)) { - $mail->addAttachment($file, null, null, Horde_Nls::getCharset()); + $mail->addAttachment($file, null, null, $GLOBALS['registry']->getCharset()); } } diff --git a/folks/lib/Notification/mail.php b/folks/lib/Notification/mail.php index 459d41444..e921cd2be 100644 --- a/folks/lib/Notification/mail.php +++ b/folks/lib/Notification/mail.php @@ -57,7 +57,7 @@ class Folks_Notification_mail extends Folks_Notification { $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'from' => $this->_params['from_addr'], - 'charset' => Horde_Nls::getCharset())); + 'charset' => $GLOBALS['registry']->getCharset())); $mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion()); $mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']); @@ -65,7 +65,7 @@ class Folks_Notification_mail extends Folks_Notification { foreach ($attachments as $file) { if (file_exists($file)) { - $mail->addAttachment($file, null, null, Horde_Nls::getCharset()); + $mail->addAttachment($file, null, null, $GLOBALS['registry']->getCharset()); } } @@ -78,7 +78,7 @@ class Folks_Notification_mail extends Folks_Notification { if (empty($to)) { continue; } - $mail->addHeader('To', $to, Horde_Nls::getCharset(), true); + $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset(), true); $mail->send($GLOBALS['injector']->getInstance('Horde_Mail')); } diff --git a/folks/scripts/mail-filter.php b/folks/scripts/mail-filter.php index fc556f167..eac4f43ff 100644 --- a/folks/scripts/mail-filter.php +++ b/folks/scripts/mail-filter.php @@ -89,7 +89,7 @@ foreach (array('host', 'user', 'pass', 'port', 'protocol', 'folder') as $opt) { // Set charset to UTF-8 for most flexible conversion between email charset and // backend charset. -Horde_Nls::setCharsetEnvironment('UTF-8'); +$registry->setCharsetEnvironment('UTF-8'); // Read and parse the message. $messages = array(); diff --git a/folks/scripts/mail.php b/folks/scripts/mail.php index 6a0ad8651..d2690fb86 100644 --- a/folks/scripts/mail.php +++ b/folks/scripts/mail.php @@ -110,7 +110,7 @@ while ($row =& $res->fetchRow()) { $body2 = sprintf($body, $row[0], $registry->get('name', 'horde'), Folks::getUrlFor('user', $row[0], true, -1)); // Send mail - $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], Horde_Nls::getCharset()); + $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], $GLOBALS['registry']->getCharset()); $mail->addHeader('User-Agent', 'Folks' . $registry->getVersion()); $sent = $mail->send($conf['mailer']['type'], $conf['mailer']['params']); if ($sent instanceof PEAR_Error) { diff --git a/folks/templates/common-header.inc b/folks/templates/common-header.inc index 8666bc05e..0a2ca344e 100644 --- a/folks/templates/common-header.inc +++ b/folks/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/folks/templates/feed/activities.php b/folks/templates/feed/activities.php index 36ec3dc5b..731f5c564 100644 --- a/folks/templates/feed/activities.php +++ b/folks/templates/feed/activities.php @@ -1,4 +1,4 @@ -' ?> +getCharset() . '"?>' ?> diff --git a/folks/templates/feed/feed.php b/folks/templates/feed/feed.php index ed7940296..5c53ee71f 100644 --- a/folks/templates/feed/feed.php +++ b/folks/templates/feed/feed.php @@ -1,4 +1,4 @@ -' ?> +getCharset() . '"?>' ?> diff --git a/framework/Ajax/lib/Horde/Ajax/Imple/SpellChecker.php b/framework/Ajax/lib/Horde/Ajax/Imple/SpellChecker.php index 81e7962a2..c91ef53c8 100644 --- a/framework/Ajax/lib/Horde/Ajax/Imple/SpellChecker.php +++ b/framework/Ajax/lib/Horde/Ajax/Imple/SpellChecker.php @@ -72,7 +72,7 @@ class Horde_Ajax_Imple_SpellChecker extends Horde_Ajax_Imple_Base } Horde::addInlineScript(array( - $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ')' + $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')' ), 'dom'); } diff --git a/framework/Alarm/lib/Horde/Alarm/Sql.php b/framework/Alarm/lib/Horde/Alarm/Sql.php index bfbaa6950..c8c0b16bb 100644 --- a/framework/Alarm/lib/Horde/Alarm/Sql.php +++ b/framework/Alarm/lib/Horde/Alarm/Sql.php @@ -419,7 +419,7 @@ class Horde_Alarm_Sql extends Horde_Alarm */ protected function _toDriver($value) { - return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']); + return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']); } } diff --git a/framework/Auth/lib/Horde/Auth/Cyrsql.php b/framework/Auth/lib/Horde/Auth/Cyrsql.php index a78ba1c61..a472fb6f7 100644 --- a/framework/Auth/lib/Horde/Auth/Cyrsql.php +++ b/framework/Auth/lib/Horde/Auth/Cyrsql.php @@ -245,7 +245,7 @@ class Horde_Auth_Cyrsql extends Horde_Auth_Sql } try { - $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap'); + $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap'); $this->_imap->createMailbox($mailbox); $this->_imap->setACL($mailbox, $this->_params['cyradm'], 'lrswipcda'); } catch (Horde_Imap_Client_Exception $e) { @@ -257,12 +257,12 @@ class Horde_Auth_Cyrsql extends Horde_Auth_Sql ($this->_params['domain_field'] != 'none')) { list($userName, $domain) = explode('@', $userName); $tmp = $userName . $this->_separator . $value . '@' . $domain; -Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $domain, Horde_Nls::getCharset(), 'utf7-imap'); +Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $domain, $GLOBALS['registry']->getCharset(), 'utf7-imap'); } else { $tmp = $userName . $this->_separator . $value; } - $tmp = Horde_String::convertCharset($tmp, Horde_Nls::getCharset(), 'utf7-imap'); + $tmp = Horde_String::convertCharset($tmp, $GLOBALS['registry']->getCharset(), 'utf7-imap'); $this->_imap->createMailbox($tmp); $this->_oimap>setACL($tmp, $this->_params['cyradm'], 'lrswipcda'); } diff --git a/framework/Auth/lib/Horde/Auth/Cyrus.php b/framework/Auth/lib/Horde/Auth/Cyrus.php index 4e002b439..958f1d9e5 100644 --- a/framework/Auth/lib/Horde/Auth/Cyrus.php +++ b/framework/Auth/lib/Horde/Auth/Cyrus.php @@ -119,7 +119,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base { $this->_backend->addUser($userId, $credentials); - $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, Horde_Nls::getCharset(), 'utf7-imap'); + $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap'); try { $this->_imap->createMailbox($mailbox); @@ -131,7 +131,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base is_array($this->_params['folders'])) { foreach ($this->_params['folders'] as $folder) { try { - $this->_imap->createMailbox($mailbox . Horde_String::convertCharset($this->_params['separator'] . $folder, Horde_Nls::getCharset(), 'utf7-imap')); + $this->_imap->createMailbox($mailbox . Horde_String::convertCharset($this->_params['separator'] . $folder, $GLOBALS['registry']->getCharset(), 'utf7-imap')); } catch (Horde_Imap_Client_Exception $e) {} } } @@ -157,7 +157,7 @@ class Horde_Auth_Cyrus extends Horde_Auth_Base { $this->_backend->removeUser($userId); - $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, Horde_Nls::getCharset(), 'utf7-imap'); + $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap'); /* Set ACL for mailbox deletion. */ list($admin) = explode('@', $this->_params['cyradmin']); diff --git a/framework/Auth/lib/Horde/Auth/Imap.php b/framework/Auth/lib/Horde/Auth/Imap.php index cc82a0adf..76277967c 100644 --- a/framework/Auth/lib/Horde/Auth/Imap.php +++ b/framework/Auth/lib/Horde/Auth/Imap.php @@ -99,7 +99,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base { try { $ob = $this->_getOb($this->_params['admin_user'], $this->_params['admin_password']); - $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap'); + $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap'); $ob->createMailbox($mailbox); $ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda'); } catch (Horde_Imap_Client_Exception $e) { @@ -119,7 +119,7 @@ class Horde_Auth_Imap extends Horde_Auth_Base try { $ob = $this->_getOb($this->_params['admin_user'], $this->_params['admin_password']); $ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda'); - $ob->deleteMailbox(Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap')); + $ob->deleteMailbox(Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap')); } catch (Horde_Imap_Client_Exception $e) { throw new Horde_Auth_Exception($e); } diff --git a/framework/Block/lib/Horde/Block/Layout/Manager.php b/framework/Block/lib/Horde/Block/Layout/Manager.php index 274dca661..60213354e 100644 --- a/framework/Block/lib/Horde/Block/Layout/Manager.php +++ b/framework/Block/lib/Horde/Block/Layout/Manager.php @@ -240,7 +240,7 @@ class Horde_Block_Layout_Manager extends Horde_Block_Layout try { $message = Horde::callHook('perms_denied', array('horde:max_blocks')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", Horde::hasPermission('max_blocks')), Horde::hasPermission('max_blocks')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", Horde::hasPermission('max_blocks')), Horde::hasPermission('max_blocks')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $GLOBALS['notification']->push($message, 'horde.error', array('content.raw')); break; diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 675724e9e..3057cbe88 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -535,7 +535,7 @@ HTML; */ static public function sendHTTPResponse($data, $ct) { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); // Output headers and encoded response. switch ($ct) { @@ -587,7 +587,7 @@ HTML; * @param array $options Additional options: *
      * 'charset' - (string) The charset of $data.
-     *             DEFAULT: Horde_Nls::getCharset()
+     *             DEFAULT: Horde_Registry::getCharset()
      * 'urlencode' - (boolean) URL encode the json string
      *               DEFAULT: No
      * 
@@ -596,7 +596,7 @@ HTML; */ static public function escapeJson($data, $options = array()) { - $json = '/*-secure-' . Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? Horde_Nls::getCharset() : $options['charset']) . '*/'; + $json = '/*-secure-' . Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? $GLOBALS['registry']->getCharset() : $options['charset']) . '*/'; return empty($options['urlencode']) ? $json : '\'' . rawurlencode($json) . '\''; @@ -1152,7 +1152,7 @@ HTML; } if (!empty($title)) { if ($escape) { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $old_error = error_reporting(0); $title = str_replace( array("\r", "\n"), '', @@ -1189,7 +1189,7 @@ HTML; $attributes = array()) { if (!empty($title)) { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $old_error = error_reporting(0); $title = '<pre>' . preg_replace(array('/\n/', '/((?))/em', '/

/', '/
/'), array('', 'str_repeat(" ", strlen("$1"))', '<br /> <br />', '<br />'), nl2br(htmlspecialchars(htmlspecialchars($title, ENT_QUOTES, $charset), ENT_QUOTES, $charset))) . '</pre>'; error_reporting($old_error); @@ -1309,7 +1309,7 @@ HTML; */ static public function img($src, $alt = '', $attr = '') { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); /* If browser does not support images, simply return the ALT text. */ if (!$GLOBALS['browser']->hasFeature('images')) { @@ -1355,7 +1355,7 @@ HTML; */ static public function fullSrcImg($src, $options = array()) { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); /* If browser does not support images, simply return the ALT text. */ if (!$GLOBALS['browser']->hasFeature('images')) { @@ -1611,11 +1611,7 @@ HTML; */ static public function stripAccessKey($label) { - if (!isset(Horde_Nls::$config['multibyte'])) { - self::loadConfiguration('nls.php', null, 'horde'); - } - - $multibyte = isset(Horde_Nls::$config['multibyte'][Horde_Nls::getCharset(true)]); + $multibyte = isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)]); return preg_replace('/_([A-Za-z])/', $multibyte && preg_match('/[\x80-\xff]/', $label) ? '' : '\1', $label); @@ -1638,15 +1634,17 @@ HTML; return $stripped_label; } - if (isset($GLOBALS['nls']['multibyte'][Horde_Nls::getCharset(true)])) { + if (isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)])) { /* Prefix parenthesis with the UTF-8 representation of the LRO * (Left-to-Right-Override) Unicode codepoint U+202D. */ - $prefix = Horde_Nls::getCharset() == 'UTF-8' ? "\xe2\x80\xad" : ''; + $prefix = ($GLOBALS['registry']->getCharset() == 'UTF-8') + ? "\xe2\x80\xad" + : ''; return $stripped_label . $prefix . '(' . strtoupper($accessKey) . '' . ')'; - } else { - return str_replace('_' . $accessKey, '' . $accessKey . '', $label); } + + return str_replace('_' . $accessKey, '' . $accessKey . '', $label); } /** diff --git a/framework/Core/lib/Horde/Config.php b/framework/Core/lib/Horde/Config.php index b2df8a015..fec37ccc9 100644 --- a/framework/Core/lib/Horde/Config.php +++ b/framework/Core/lib/Horde/Config.php @@ -1514,7 +1514,7 @@ class Horde_Config return $apps; case 'list-horde-languages': - return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"' . Horde_Nls::getCharset() . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . Horde_Nls::getCharset() . '\")"), $val);'), Horde_Nls::$config['languages']); + return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"' . $GLOBALS['registry']->getCharset() . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . $GLOBALS['registry']->getCharset() . '\")"), $val);'), $GLOBALS['registry']->nlsconfig['languages']); case 'list-blocks': $collection = Horde_Block_Collection::singleton('portal'); diff --git a/framework/Core/lib/Horde/Core/Auth/Signup/Base.php b/framework/Core/lib/Horde/Core/Auth/Signup/Base.php index ddff4ccc1..7d6f7de61 100644 --- a/framework/Core/lib/Horde/Core/Auth/Signup/Base.php +++ b/framework/Core/lib/Horde/Core/Auth/Signup/Base.php @@ -89,7 +89,7 @@ abstract class Horde_Core_Auth_Signup_Base 'body' => $message, 'to' => $conf['signup']['email'], 'from' => $conf['signup']['email'], - 'subject' => Horde_Nls::getCharset())); + 'subject' => $GLOBALS['registry']->getCharset())); $mail->send($GLOBALS['injector']->getInstance('Horde_Mail')); } } diff --git a/framework/Core/lib/Horde/Core/Autoloader/Callback/Nls.php b/framework/Core/lib/Horde/Core/Autoloader/Callback/Nls.php new file mode 100644 index 000000000..2bc7e9d8d --- /dev/null +++ b/framework/Core/lib/Horde/Core/Autoloader/Callback/Nls.php @@ -0,0 +1,16 @@ +getInstance('Net_DNS_Resolver'); + } + +} diff --git a/framework/Core/lib/Horde/Core/Binder/Alarm.php b/framework/Core/lib/Horde/Core/Binder/Alarm.php index 27fa7ee02..8c5b23e98 100644 --- a/framework/Core/lib/Horde/Core/Binder/Alarm.php +++ b/framework/Core/lib/Horde/Core/Binder/Alarm.php @@ -41,7 +41,7 @@ class Horde_Core_Binder_Alarm implements Horde_Injector_Binder $handler_params = array( 'identity' => $injector->getInstance('Horde_Prefs_Identity'), 'mail' => $injector->getInstance('Horde_Mail'), - 'charset' => Horde_Nls::getCharset() + 'charset' => $GLOBALS['registry']->getCharset() ); $alarm->addHandler('mail', new Horde_Alarm_Handler_Mail($handler_params)); diff --git a/framework/Core/lib/Horde/Core/Prefs/Ui.php b/framework/Core/lib/Horde/Core/Prefs/Ui.php index c8b1de44a..3e2d1b47a 100644 --- a/framework/Core/lib/Horde/Core/Prefs/Ui.php +++ b/framework/Core/lib/Horde/Core/Prefs/Ui.php @@ -748,7 +748,7 @@ class Horde_Core_Prefs_Ui // Fall-through default: - $val2 = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'UTF-8'); + $val2 = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'UTF-8'); } // [0] = pref name diff --git a/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php b/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php index bce7bb04f..cb1d9fa27 100644 --- a/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php +++ b/framework/Core/lib/Horde/Core/Prefs/Ui/Widgets.php @@ -83,7 +83,7 @@ class Horde_Core_Prefs_Ui_Widgets ); } Horde::addInlineScript(array( - 'HordeSourceSelectPrefs.source_list = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'HordeSourceSelectPrefs.source_list = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); } @@ -223,8 +223,8 @@ class Horde_Core_Prefs_Ui_Widgets } Horde::addInlineScript(array( - 'HordeAddressbooksPrefs.fields = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset()), - 'HordeAddressbooksPrefs.nonetext = ' . Horde_Serialize::serialize(_("No address book selected."), Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'HordeAddressbooksPrefs.fields = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), + 'HordeAddressbooksPrefs.nonetext = ' . Horde_Serialize::serialize(_("No address book selected."), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); } diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 3f2f07fd7..23f14a017 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -36,6 +36,13 @@ class Horde_Registry protected $_cache = array(); /** + * NLS cached information. + * + * @var array + */ + protected $_nlscache = array(); + + /** * The last modified time of the newest modified registry file. * * @var integer @@ -71,18 +78,25 @@ class Horde_Registry public $applications = array(); /** - * The session handler object. + * The application that called appInit(). * - * @var Horde_SessionHandler + * @var string */ - public $sessionHandler = null; + public $initialApp; /** - * The application that called appInit(). + * NLS configuration. * - * @var string + * @var array */ - public $initialApp; + public $nlsconfig = array(); + + /** + * The session handler object. + * + * @var Horde_SessionHandler + */ + public $sessionHandler = null; /** * Application bootstrap initialization. @@ -94,6 +108,7 @@ class Horde_Registry * * Global variables defined: * $cli - Horde_Cli object (if 'cli' is true) + * $language - Language * $registry - Horde_Registry object * * @param string $app The application to initialize. @@ -120,6 +135,8 @@ class Horde_Registry * 'none' - Do not start a session * 'readonly' - Start session readonly * [DEFAULT] - Start read/write session + * 'timezone' - (boolean) Set the time zone? + * DEFAULT: false * 'user_admin' - (boolean) Set authentication to an admin user? * DEFAULT: false * @@ -143,6 +160,7 @@ class Horde_Registry 'nologintasks' => false, 'session_cache_limiter' => null, 'session_control' => null, + 'timezone' => false, 'user_admin' => null ), $args); @@ -204,6 +222,10 @@ class Horde_Registry $registry->initialApp = $app; + if ($args['timezone']) { + $registry->setTimeZone(); + } + if (!$args['nocompress']) { Horde::compressOutput(); } @@ -231,7 +253,8 @@ class Horde_Registry { /* Define autoloader callbacks. */ $callbacks = array( - 'Horde_Mime' => 'Horde_Core_Autoloader_Callback_Mime' + 'Horde_Mime' => 'Horde_Core_Autoloader_Callback_Mime', + 'Horde_Nls' => 'Horde_Core_Autoloader_Callback_Nls' ); /* Define binders. */ @@ -304,7 +327,6 @@ class Horde_Registry $GLOBALS['__autoloader']->addCallback($key, array($val, 'callback')); } - /* Initialize browser object. */ $GLOBALS['browser'] = $injector->getInstance('Horde_Browser'); @@ -312,8 +334,7 @@ class Horde_Registry * and egg issue - since loadConfiguration() uses registry in certain * instances. However, if HORDE_BASE is defined, and app is * 'horde', registry is not used in the method so we are free to - * call it here (prevents us from duplicating a bunch of code - * here. */ + * call it here (prevents us from duplicating a bunch of code). */ $this->_cache['conf-horde'] = Horde::loadConfiguration('conf.php', 'conf', 'horde'); $conf = $GLOBALS['conf'] = &$this->_cache['conf-horde']; @@ -363,12 +384,11 @@ class Horde_Registry /* Always need to load applications information. */ $this->_loadApplicationsCache($vhost); - /* Initialize the localization routines and variables. We can't use - * Horde_Nls::setLanguageEnvironment() here because that depends on the - * registry to be already initialized. */ - Horde_Nls::setLanguage(); - Horde_Nls::setTextdomain('horde', HORDE_BASE . '/locale', Horde_Nls::getCharset()); - Horde_String::setDefaultCharset(Horde_Nls::getCharset()); + /* Load the language configuration. */ + $this->nlsconfig = Horde::loadConfiguration('nls.php', 'horde_nls_config', 'horde'); + + /* Initialize the localization routines and variables. */ + $this->setLanguageEnvironment(null, 'horde'); $this->_regmtime = max(filemtime(HORDE_BASE . '/config/registry.php'), filemtime(HORDE_BASE . '/config/registry.d')); @@ -1124,10 +1144,10 @@ class Horde_Registry /* Chicken and egg problem: the language environment has to be loaded * before loading the configuration file, because it might contain * gettext strings. Though the preferences can specify a different - * language for this app, the have to be loaded after the + * language for this app, they have to be loaded after the * configuration, because they rely on configuration settings. So try * with the current language, and reset the language later. */ - Horde_Nls::setLanguageEnvironment($GLOBALS['language'], $app); + $this->setLanguageEnvironment($GLOBALS['language'], $app); /* Load config and prefs and set proper language from the prefs. */ $this->_onAppSwitch($app); @@ -1209,7 +1229,7 @@ class Horde_Registry * preferences. */ $language = $GLOBALS['prefs']->getValue('language'); if ($language != $GLOBALS['language']) { - Horde_Nls::setLanguageEnvironment($language, $app); + $this->setLanguageEnvironment($language, $app); } } @@ -2013,7 +2033,7 @@ class Horde_Registry $_SESSION['horde_auth'] = array( 'app' => array(), 'authId' => $authId, - 'browser' => $GLOBALS['injector']->getInstance('Horde_Browser')->getAgentString(), + 'browser' => $GLOBALS['browser']->getAgentString(), 'change' => !empty($options['change']), 'credentials' => $app, 'remoteAddr' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null, @@ -2025,7 +2045,7 @@ class Horde_Registry /* Reload preferences for the new user. */ $this->loadPrefs(); - Horde_Nls::setLanguageEnvironment($GLOBALS['prefs']->getValue('language'), $app); + $this->setLanguageEnvironment($GLOBALS['prefs']->getValue('language'), $app); } /** @@ -2045,7 +2065,7 @@ class Horde_Registry } if (!empty($GLOBALS['conf']['auth']['checkbrowser']) && - ($_SESSION['horde_auth']['browser'] != $GLOBALS['injector']->getInstance('Horde_Browser')->getAgentString())) { + ($_SESSION['horde_auth']['browser'] != $GLOBALS['browser']->getAgentString())) { $auth->setError(Horde_Core_Auth_Application::REASON_BROWSER); return false; } @@ -2053,4 +2073,352 @@ class Horde_Registry return $auth->validateAuth(); } + /* NLS functions. */ + + /** + * Returns the charset for the current language. + * + * @param boolean $original If true returns the original charset of the + * translation, the actually used one otherwise. + * + * @return string The character set that should be used with the current + * locale settings. + */ + public function getCharset($original = false) + { + /* Get cached results. */ + $cacheKey = intval($original); + $charset = $this->_cachedCharset($cacheKey); + if (!is_null($charset)) { + return $charset; + } + + if ($original) { + $charset = empty($this->nlsconfig['charsets'][$GLOBALS['language']]) + ? 'ISO-8859-1' + : $this->nlsconfig['charsets'][$GLOBALS['language']]; + } elseif ($GLOBALS['browser']->hasFeature('utf') && + (Horde_Util::extensionExists('iconv') || + Horde_Util::extensionExists('mbstring'))) { + $charset = 'UTF-8'; + } + + if (is_null($charset)) { + $charset = $this->getExternalCharset(); + } + + $this->_cachedCharset($cacheKey, $charset); + + return $charset; + } + + /** + * Returns the current charset of the environment + * + * @return string The character set that should be used with the current + * locale settings. + */ + public function getExternalCharset() + { + /* Get cached results. */ + $charset = $this->_cachedCharset(2); + if (!is_null($charset)) { + return $charset; + } + + $lang_charset = setlocale(LC_ALL, 0); + if ((strpos($lang_charset, ';') === false) && + (strpos($lang_charset, '/') === false)) { + $lang_charset = explode('.', $lang_charset); + if ((count($lang_charset) == 2) && !empty($lang_charset[1])) { + $this->_cachedCharset(2, $lang_charset[1]); + return $lang_charset[1]; + } + } + + return empty($this->nlsconfig['charsets'][$GLOBALS['language']]) + ? 'ISO-8859-1' + : $this->nlsconfig['charsets'][$GLOBALS['language']]; + } + + /** + * Returns the charset to use for outgoing emails. + * + * @return string The preferred charset for outgoing mails based on + * the user's preferences and the current language. + */ + public function getEmailCharset() + { + $charset = $GLOBALS['prefs']->getValue('sending_charset'); + if (!empty($charset)) { + return $charset; + } + + return isset($this->nlsconfig['emails'][$GLOBALS['language']]) + ? $this->nlsconfig['emails'][$GLOBALS['language']] + : (isset($this->nlsconfig['charsets'][$GLOBALS['language']]) ? $this->nlsconfig['charsets'][$GLOBALS['language']] : 'ISO-8859-1'); + } + + /** + * Selects the most preferred language for the current client session. + * + * @param string $lang Force to use this language. + * + * @return string The selected language abbreviation. + */ + public function preferredLang($lang = null) + { + /* First, check if language pref is locked and, if so, set it to its + * value */ + if (isset($GLOBALS['prefs']) && + $GLOBALS['prefs']->isLocked('language')) { + $language = $GLOBALS['prefs']->getValue('language'); + /* Check if the user selected a language from the login screen */ + } elseif (!empty($lang) && $this->isValidLang($lang)) { + $language = $lang; + /* Check if we have a language set in the session */ + } elseif (isset($_SESSION['horde_language'])) { + $language = $_SESSION['horde_language']; + /* Use site-wide default, if one is defined */ + } elseif (!empty($this->nlsconfig['defaults']['language'])) { + $language = $this->nlsconfig['defaults']['language']; + /* Try browser-accepted languages. */ + } elseif (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + /* The browser supplies a list, so return the first valid one. */ + $browser_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); + foreach ($browser_langs as $lang) { + /* Strip quality value for language */ + if (($pos = strpos($lang, ';')) !== false) { + $lang = substr($lang, 0, $pos); + } + $lang = $this->_mapLang(trim($lang)); + if ($this->isValidLang($lang)) { + $language = $lang; + break; + } + + /* In case there's no full match, save our best guess. Try + * ll_LL, followed by just ll. */ + if (!isset($partial_lang)) { + $ll_LL = Horde_String::lower(substr($lang, 0, 2)) . '_' . Horde_String::upper(substr($lang, 0, 2)); + if ($this->isValidLang($ll_LL)) { + $partial_lang = $ll_LL; + } else { + $ll = $this->_mapLang(substr($lang, 0, 2)); + if ($this->isValidLang($ll)) { + $partial_lang = $ll; + } + } + } + } + } + + if (!isset($language)) { + $language = isset($partial_lang) + ? $partial_lang + /* No dice auto-detecting, default to US English. */ + : 'en_US'; + } + + return basename($language); + } + + /** + * Determines whether the supplied language is valid. + * + * @param string $language The abbreviated name of the language. + * + * @return boolean True if the language is valid, false if it's not + * valid or unknown. + */ + public function isValidLang($language) + { + return !empty($this->nlsconfig['languages'][$language]); + } + + /** + * Sets the UI charset. + * + * In general, the applied charset is automatically determined by browser + * language and browser capabilities and there's no need to manually call + * setCharset. However for headless (RPC) operations the charset may be + * set manually to ensure correct character conversion in the backend. + * + * @param string $charset The new UI charset. + */ + public function setCharset($charset) + { + $this->_cachedCharset(0, $charset); + } + + /** + * Sets the charset and reloads the whole NLS environment. + * + * When setting the charset, the gettext catalogs have to be reloaded too, + * to match the new charset, among other things. This method takes care of + * all this. + * + * @param string $charset The new UI charset. + */ + public function setCharsetEnvironment($charset) + { + unset($GLOBALS['language']); + $this->setCharset($charset); + $this->setLanguageEnvironment(); + } + + /** + * Sets the language. + * + * @param string $lang The language abbreviation. + * + * @throws Horde_Exception + */ + public function setLanguage($lang = null) + { + if (empty($lang) || !$this->isValidLang($lang)) { + $lang = $this->preferredLang(); + } + + $_SESSION['horde_language'] = $lang; + + if (isset($GLOBALS['language'])) { + if ($GLOBALS['language'] == $lang) { + return; + } + $this->clearCache(); + } + $GLOBALS['language'] = $lang; + + /* First try language with the current charset. */ + $lang_charset = $lang . '.' . $this->getCharset(); + if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { + /* Next try language with its default charset. */ + $charset = empty($this->nlsconfig['charsets'][$lang]) + ? 'ISO-8859-1' + : $this->nlsconfig['charsets'][$lang]; + $lang_charset = $lang . '.' . $charset; + $this->_cachedCharset(0, $charset); + if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { + /* At last try language solely. */ + $lang_charset = $lang; + setlocale(LC_ALL, $lang_charset); + } + } + + @putenv('LC_ALL=' . $lang_charset); + @putenv('LANG=' . $lang_charset); + @putenv('LANGUAGE=' . $lang_charset); + } + + /** + * Sets the language and reloads the whole NLS environment. + * + * When setting the language, the gettext catalogs have to be reloaded + * too, charsets have to be updated etc. This method takes care of all + * this. + * + * @param string $language The new language. + * @param string $app The application for reloading the gettext + * catalog. The current application if empty. + */ + public function setLanguageEnvironment($lang = null, $app = null) + { + if (empty($app)) { + $app = $this->getApp(); + } + + $this->setLanguage($lang); + $this->setTextdomain( + $app, + $this->get('fileroot', $app) . '/locale' + ); + Horde_String::setDefaultCharset($this->getCharset()); + } + + /** + * Sets the gettext domain. + * + * @param string $app The application name. + * @param string $directory The directory where the application's + * LC_MESSAGES directory resides. + * @param string $charset The charset. + */ + public function setTextdomain($app, $directory, $charset = null) + { + bindtextdomain($app, $directory); + textdomain($app); + + if (is_null($charset)) { + $charset = $this->getCharset(); + } + + /* The existence of this function depends on the platform. */ + if (function_exists('bind_textdomain_codeset')) { + $this->_cachedCharset(0, bind_textdomain_codeset($app, $charset)); + } + + if (!Horde::contentSent()) { + header('Content-Type: text/html; charset=' . $charset); + } + } + + /** + * Sets the current timezone, if available. + */ + public function setTimeZone() + { + $tz = $GLOBALS['prefs']->getValue('timezone'); + if (!empty($tz)) { + @date_default_timezone_set($tz); + } + } + + /** + * Maps languages with common two-letter codes (such as nl) to the + * full gettext code (in this case, nl_NL). Returns the language + * unmodified if it isn't an alias. + * + * @param string $language The language code to map. + * + * @return string The mapped language code. + */ + protected function _mapLang($language) + { + // Translate the $language to get broader matches. + // (eg. de-DE should match de_DE) + $trans_lang = str_replace('-', '_', $language); + $lang_parts = explode('_', $trans_lang); + $trans_lang = Horde_String::lower($lang_parts[0]); + if (isset($lang_parts[1])) { + $trans_lang .= '_' . Horde_String::upper($lang_parts[1]); + } + + return empty($this->nlsconfig['aliases'][$trans_lang]) + ? $trans_lang + : $this->nlsconfig['aliases'][$trans_lang]; + } + + + /** + * Sets or returns the charset used under certain conditions. + * + * @param integer $index The ID of a cache slot. 0 for the UI charset, 1 + * for the translation charset and 2 for the + * external charset. + * @param string $charset If specified, this charset will be stored in + * the given cache slot. Otherwise the content of + * the specified cache slot will be returned. + */ + protected function _cachedCharset($index, $charset = null) + { + if (is_null($charset)) { + return isset($this->_nlscache['charset'][$index]) + ? $this->_nlscache['charset'][$index] + : null; + } + + $this->_nlscache['charset'][$index] = $charset; + } + } diff --git a/framework/Core/package.xml b/framework/Core/package.xml index fd648aa92..f13530bac 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -76,6 +76,7 @@ Application Framework. + @@ -276,6 +277,10 @@ Application Framework. pear.horde.org + Nls + pear.horde.org + + Text_Filter pear.horde.org @@ -303,6 +308,7 @@ Application Framework. + diff --git a/framework/Crypt/lib/Horde/Crypt/Pgp.php b/framework/Crypt/lib/Horde/Crypt/Pgp.php index 1d3a8a62a..53570127f 100644 --- a/framework/Crypt/lib/Horde/Crypt/Pgp.php +++ b/framework/Crypt/lib/Horde/Crypt/Pgp.php @@ -936,7 +936,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt if ($errno == 0) { throw new Horde_Exception(_("Connection refused to the public keyserver.")); } else { - throw new Horde_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, Horde_Nls::getExternalCharset()), $errno)); + throw new Horde_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, $GLOBALS['registry']->getExternalCharset()), $errno)); } } @@ -1316,7 +1316,7 @@ class Horde_Crypt_Pgp extends Horde_Crypt '--armor', '--always-trust', '--batch', - '--charset ' . Horde_Nls::getCharset(), + '--charset ' . $GLOBALS['registry']->getCharset(), $keyring, '--verify' ); @@ -1388,12 +1388,12 @@ class Horde_Crypt_Pgp extends Horde_Crypt $msg_sign = $this->encrypt($mime_part->toString(array('headers' => true, 'canonical' => true, 'encode' => Horde_Mime_Part::ENCODE_7BIT)), $params); /* Add the PGP signature. */ - $charset = Horde_Nls::getEmailCharset(); + $charset = $GLOBALS['registry']->getEmailCharset(); $pgp_sign = new Horde_Mime_Part(); $pgp_sign->setType('application/pgp-signature'); $pgp_sign->setCharset($charset); $pgp_sign->setDisposition('inline'); - $pgp_sign->setDescription(Horde_String::convertCharset(_("PGP Digital Signature"), Horde_Nls::getCharset(), $charset)); + $pgp_sign->setDescription(Horde_String::convertCharset(_("PGP Digital Signature"), $GLOBALS['registry']->getCharset(), $charset)); $pgp_sign->setContents($msg_sign); /* Get the algorithim information from the signature. Since we are @@ -1433,12 +1433,12 @@ class Horde_Crypt_Pgp extends Horde_Crypt $message_encrypt = $this->encrypt($signenc_body, $params); /* Set up MIME Structure according to RFC 3156. */ - $charset = Horde_Nls::getEmailCharset(); + $charset = $GLOBALS['registry']->getEmailCharset(); $part = new Horde_Mime_Part(); $part->setType('multipart/encrypted'); $part->setCharset($charset); $part->setContentTypeParameter('protocol', 'application/pgp-encrypted'); - $part->setDescription(Horde_String::convertCharset(_("PGP Encrypted Data"), Horde_Nls::getCharset(), $charset)); + $part->setDescription(Horde_String::convertCharset(_("PGP Encrypted Data"), $GLOBALS['registry']->getCharset(), $charset)); $part->setContents("This message is in MIME format and has been PGP encrypted.\n"); $part1 = new Horde_Mime_Part(); @@ -1480,9 +1480,9 @@ class Horde_Crypt_Pgp extends Horde_Crypt $part = $this->encryptMIMEPart($part, $encrypt_params); $part->setContents("This message is in MIME format and has been PGP signed and encrypted.\n"); - $charset = Horde_Nls::getEmailCharset(); + $charset = $GLOBALS['registry']->getEmailCharset(); $part->setCharset($charset); - $part->setDescription(Horde_String::convertCharset(_("PGP Signed/Encrypted Data"), Horde_Nls::getCharset(), $charset)); + $part->setDescription(Horde_String::convertCharset(_("PGP Signed/Encrypted Data"), $GLOBALS['registry']->getCharset(), $charset)); return $part; } @@ -1497,11 +1497,11 @@ class Horde_Crypt_Pgp extends Horde_Crypt */ public function publicKeyMIMEPart($key) { - $charset = Horde_Nls::getEmailCharset(); + $charset = $GLOBALS['registry']->getEmailCharset(); $part = new Horde_Mime_Part(); $part->setType('application/pgp-keys'); $part->setCharset($charset); - $part->setDescription(Horde_String::convertCharset(_("PGP Public Key"), Horde_Nls::getCharset(), $charset)); + $part->setDescription(Horde_String::convertCharset(_("PGP Public Key"), $GLOBALS['registry']->getCharset(), $charset)); $part->setContents($key); return $part; diff --git a/framework/Crypt/lib/Horde/Crypt/Smime.php b/framework/Crypt/lib/Horde/Crypt/Smime.php index 856cf8230..f8c7a28fe 100644 --- a/framework/Crypt/lib/Horde/Crypt/Smime.php +++ b/framework/Crypt/lib/Horde/Crypt/Smime.php @@ -276,11 +276,11 @@ class Horde_Crypt_Smime extends Horde_Crypt $message = $this->encrypt($mime_part->toString(array('headers' => true, 'canonical' => true)), $params); /* Get charset for mime part description. */ - $charset = Horde_Nls::getEmailCharset(); + $charset = $GLOBALS['registry']->getEmailCharset(); $msg = new Horde_Mime_Part(); $msg->setCharset($charset); - $msg->setDescription(Horde_String::convertCharset(_("S/MIME Encrypted Message"), Horde_Nls::getCharset(), $charset)); + $msg->setDescription(Horde_String::convertCharset(_("S/MIME Encrypted Message"), $GLOBALS['registry']->getCharset(), $charset)); $msg->setDisposition('inline'); $msg->setType('application/pkcs7-mime'); $msg->setContentTypeParameter('smime-type', 'enveloped-data'); diff --git a/framework/Crypt/test/Horde/Crypt/bug_6601.phpt b/framework/Crypt/test/Horde/Crypt/bug_6601.phpt index f1ef6edc1..e0a2a86fa 100644 --- a/framework/Crypt/test/Horde/Crypt/bug_6601.phpt +++ b/framework/Crypt/test/Horde/Crypt/bug_6601.phpt @@ -5,17 +5,8 @@ Bug #6601 --FILE-- pgpPrettyKey(file_get_contents(dirname(__FILE__) . '/fixtures/bug_6601.asc')); diff --git a/framework/Crypt/test/Horde/Crypt/pgp_verify.phpt b/framework/Crypt/test/Horde/Crypt/pgp_verify.phpt index a2e6af7f7..251870449 100644 --- a/framework/Crypt/test/Horde/Crypt/pgp_verify.phpt +++ b/framework/Crypt/test/Horde/Crypt/pgp_verify.phpt @@ -5,17 +5,8 @@ Horde_Crypt_pgp::decrypt() signature. --FILE-- decrypt(file_get_contents(dirname(__FILE__) . '/fixtures/clear.txt'), diff --git a/framework/Data/lib/Horde/Data/Csv.php b/framework/Data/lib/Horde/Data/Csv.php index 674383fdb..d4d022e55 100644 --- a/framework/Data/lib/Horde/Data/Csv.php +++ b/framework/Data/lib/Horde/Data/Csv.php @@ -88,14 +88,14 @@ class Horde_Data_Csv extends Horde_Data_Base if ($header) { $head = Horde_File_Csv::read($filename, $conf); if (!empty($charset)) { - $head = Horde_String::convertCharset($head, $charset, Horde_Nls::getCharset()); + $head = Horde_String::convertCharset($head, $charset, $GLOBALS['registry']->getCharset()); } } $data = array(); while ($line = Horde_File_Csv::read($filename, $conf)) { if (!empty($charset)) { - $line = Horde_String::convertCharset($line, $charset, Horde_Nls::getCharset()); + $line = Horde_String::convertCharset($line, $charset, $GLOBALS['registry']->getCharset()); } if (!isset($head)) { $data[] = $line; @@ -232,7 +232,7 @@ class Horde_Data_Csv extends Horde_Data_Base $line_no = 1; while ($line_no < 3 && $line = fgets($fp)) { if (!empty($_SESSION['import_data']['charset'])) { - $line = Horde_String::convertCharset($line, $_SESSION['import_data']['charset'], Horde_Nls::getCharset()); + $line = Horde_String::convertCharset($line, $_SESSION['import_data']['charset'], $GLOBALS['registry']->getCharset()); } $newline = Horde_String::length($line) > 100 ? "\n" : ''; $_SESSION['import_data']['first_lines'] .= substr($line, 0, 100) . $newline; diff --git a/framework/DataTree/DataTree/sql.php b/framework/DataTree/DataTree/sql.php index 223597e6f..d0e5162d1 100644 --- a/framework/DataTree/DataTree/sql.php +++ b/framework/DataTree/DataTree/sql.php @@ -451,7 +451,7 @@ class DataTree_sql extends DataTree { return null; } else { $name = Horde_String::convertCharset($name, $this->_params['charset'], - Horde_Nls::getCharset()); + $GLOBALS['registry']->getCharset()); // Get the parent names, if any. $parent = $this->getParentById($id); if ($parent && !is_a($parent, 'PEAR_Error') && @@ -524,7 +524,7 @@ class DataTree_sql extends DataTree { } else { require_once 'Horde/Serialize.php'; $ser = Horde_Serialize::UTF7_BASIC; - $data = Horde_Serialize::serialize($object->getData(), $ser, Horde_Nls::getCharset()); + $data = Horde_Serialize::serialize($object->getData(), $ser, $GLOBALS['registry']->getCharset()); } } else { $fullname = $object; @@ -599,7 +599,7 @@ class DataTree_sql extends DataTree { ' VALUES (?, ?, ?, ?, ?, ?, ?, ?)'; $values = array((int)$id, $this->_params['group'], - Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), is_null($order) ? NULL : (int)$order, $data, (string)$GLOBALS['registry']->getAuth(), @@ -978,7 +978,7 @@ class DataTree_sql extends DataTree { $id = $this->getId($old_object); $query = 'UPDATE ' . $this->_params['table'] . ' SET datatree_name = ? WHERE datatree_id = ?'; - $values = array(Horde_String::convertCharset($new_object_name, Horde_Nls::getCharset(), $this->_params['charset']), + $values = array(Horde_String::convertCharset($new_object_name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$id); Horde::logMessage('SQL Query by DataTree_sql::rename(): ' . $query . ', ' . var_export($values, true), 'DEBUG'); @@ -1015,11 +1015,11 @@ class DataTree_sql extends DataTree { $data = array(); foreach ($result as $id => $row) { $data[$id] = Horde_Serialize::unserialize($row[0], $row[1], - Horde_Nls::getCharset()); + $GLOBALS['registry']->getCharset()); /* Convert old data to the new format. */ if ($row[1] == Horde_Serialize::BASIC) { $data[$id] = Horde_String::convertCharset($data[$id], - Horde_Nls::getCharset(true)); + $GLOBALS['registry']->getCharset(true)); } $data[$id] = (is_null($data[$id]) || !is_array($data[$id])) @@ -1039,10 +1039,10 @@ class DataTree_sql extends DataTree { $data = Horde_Serialize::unserialize($row['datatree_data'], $row['datatree_serialized'], - Horde_Nls::getCharset()); + $GLOBALS['registry']->getCharset()); /* Convert old data to the new format. */ if ($row['datatree_serialized'] == Horde_Serialize::BASIC) { - $data = Horde_String::convertCharset($data, Horde_Nls::getCharset(true)); + $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getCharset(true)); } return (is_null($data) || !is_array($data)) ? array() : $data; } @@ -1090,7 +1090,7 @@ class DataTree_sql extends DataTree { } $data[$row['datatree_id']][] = array('name' => $row['name'], 'key' => $row['key'], - 'value' => Horde_String::convertCharset($row['value'], $this->_params['charset'], Horde_Nls::getCharset())); + 'value' => Horde_String::convertCharset($row['value'], $this->_params['charset'], $GLOBALS['registry']->getCharset())); } return $data; } else { @@ -1104,7 +1104,7 @@ class DataTree_sql extends DataTree { for ($i = 0; $i < count($rows); $i++) { $rows[$i]['value'] = Horde_String::convertCharset($rows[$i]['value'], $this->_params['charset'], - Horde_Nls::getCharset()); + $GLOBALS['registry']->getCharset()); } return $rows; } @@ -1808,7 +1808,7 @@ class DataTree_sql extends DataTree { $values = array((int)$id, $attr['name'], $attr['key'], - Horde_String::convertCharset($attr['value'], Horde_Nls::getCharset(), $this->_params['charset'])); + Horde_String::convertCharset($attr['value'], $GLOBALS['registry']->getCharset(), $this->_params['charset'])); Horde::logMessage('SQL Query by DataTree_sql::updateData(): ' . $query . ', ' . var_export($values, true), 'DEBUG'); @@ -1829,7 +1829,7 @@ class DataTree_sql extends DataTree { /* Write to the datatree_data field. */ require_once 'Horde/Serialize.php'; $ser = Horde_Serialize::UTF7_BASIC; - $data = Horde_Serialize::serialize($object->getData(), $ser, Horde_Nls::getCharset()); + $data = Horde_Serialize::serialize($object->getData(), $ser, $GLOBALS['registry']->getCharset()); $query = 'UPDATE ' . $this->_params['table'] . ' SET datatree_data = ?, datatree_serialized = ?' . diff --git a/framework/Form/Form/Renderer.php b/framework/Form/Form/Renderer.php index 417de418b..ca166890e 100644 --- a/framework/Form/Form/Renderer.php +++ b/framework/Form/Form/Renderer.php @@ -213,7 +213,7 @@ try { } } } - echo ''; + echo ''; } function renderFormActive(&$form, &$vars) diff --git a/framework/Group/lib/Horde/Group/Kolab.php b/framework/Group/lib/Horde/Group/Kolab.php index c42864b73..8d7ba73af 100644 --- a/framework/Group/lib/Horde/Group/Kolab.php +++ b/framework/Group/lib/Horde/Group/Kolab.php @@ -304,7 +304,7 @@ class Horde_Group_Kolab extends Horde_Group_Ldap } $groups = array(); - $current_charset = Horde_Nls::getCharset(); + $current_charset = $GLOBALS['registry']->getCharset(); for ($i = 0; $i < $result['count']; $i++) { $utf8_dn = Horde_String::convertCharset($result[$i]['dn'], 'UTF-8', $current_charset); $groups[$utf8_dn] = $this->getGroupName($utf8_dn); diff --git a/framework/Group/lib/Horde/Group/Ldap.php b/framework/Group/lib/Horde/Group/Ldap.php index 7bc2b17b0..4711c1edd 100644 --- a/framework/Group/lib/Horde/Group/Ldap.php +++ b/framework/Group/lib/Horde/Group/Ldap.php @@ -370,7 +370,7 @@ class Horde_Group_Ldap extends Horde_Group */ public function getGroupName($dn) { - $dn = Horde_String::convertCharset($dn, Horde_Nls::getCharset(), 'UTF-8'); + $dn = Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), 'UTF-8'); $result = @ldap_explode_dn($dn, 1); if ($result === false) { throw new Horde_Group_Exception('Invalid group ID passed (bad DN syntax)'); @@ -653,7 +653,7 @@ class Horde_Group_Ldap extends Horde_Group } $groups = array(); - $current_charset = Horde_Nls::getCharset(); + $current_charset = $GLOBALS['registry']->getCharset(); for ($i = 0; $i < $result['count']; $i++) { $utf8_dn = Horde_String::convertCharset($result[$i]['dn'], 'UTF-8', $current_charset); $groups[$utf8_dn] = $this->getGroupName($utf8_dn); diff --git a/framework/Kolab/Kolab.php b/framework/Kolab/Kolab.php index 776a76e4f..ad3628b89 100644 --- a/framework/Kolab/Kolab.php +++ b/framework/Kolab/Kolab.php @@ -526,7 +526,7 @@ class Kolab { function &setElemStr(&$parent, $name, $value = '') { - return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, Horde_Nls::getCharset(), 'utf-8')); + return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), 'utf-8')); } function &setVal($name, $value = '') @@ -553,7 +553,7 @@ class Kolab { */ function encodeImapFolderName($name) { - return Horde_String::convertCharset($name, Horde_Nls::getCharset(), 'UTF7-IMAP'); + return Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'); } /** diff --git a/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Base.php b/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Base.php index 7808e0fe7..66ea6334a 100644 --- a/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Base.php +++ b/framework/Kolab_Filter/lib/Horde/Kolab/Filter/Base.php @@ -221,11 +221,11 @@ class Horde_Kolab_Filter_Base Horde::logMessage(sprintf("Arguments: %s", print_r($values, true)), 'DEBUG'); - Horde_Nls::setCharset('utf-8'); + $GLOBALS['registry']->setCharset('utf-8'); if (!empty($conf['kolab']['filter']['locale_path']) && !empty($conf['kolab']['filter']['locale'])) { - Horde_Nls::setTextdomain('Kolab_Filter', $conf['kolab']['filter']['locale_path'], Horde_Nls::getCharset()); + $GLOBALS['registry']->setTextdomain('Kolab_Filter', $conf['kolab']['filter']['locale_path']); setlocale(LC_ALL, $conf['kolab']['filter']['locale']); } diff --git a/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php b/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php index 6d8215d5f..f935b241e 100644 --- a/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php +++ b/framework/Kolab_Format/examples/Horde/Kolab/Format/event.php @@ -16,7 +16,7 @@ */ require_once 'Horde/Autoloader.php'; -Horde_Nls::setCharset('utf-8'); +$registry->setCharset('utf-8'); /** Generate the format handler */ $format = Horde_Kolab_Format::factory('Xml', 'Event'); diff --git a/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php b/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php index 64feb4915..839546b13 100644 --- a/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php +++ b/framework/Kolab_Format/examples/Horde/Kolab/Format/new_type.php @@ -60,7 +60,7 @@ class Horde_Kolab_Format_Xml_String extends Horde_Kolab_Format_Xml } } -Horde_Nls::setCharset('utf-8'); +$registry->setCharset('utf-8'); /** Generate the format handler */ $format = Horde_Kolab_Format::factory('Xml', 'String'); diff --git a/framework/Kolab_Format/lib/Horde/Kolab/Format/Xml.php b/framework/Kolab_Format/lib/Horde/Kolab/Format/Xml.php index b7252cfe7..d2a78de55 100644 --- a/framework/Kolab_Format/lib/Horde/Kolab/Format/Xml.php +++ b/framework/Kolab_Format/lib/Horde/Kolab/Format/Xml.php @@ -775,7 +775,7 @@ class Horde_Kolab_Format_Xml */ protected function _createTextNode($parent, $name, $value) { - $value = Horde_String::convertCharset($value, Horde_Nls::getCharset(), + $value = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), 'utf-8'); $node = $this->_xmldoc->createElement($name); diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php index e39fc8d91..acfdbdb7d 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/ContactTest.php @@ -42,7 +42,7 @@ extends PHPUnit_Framework_TestCase */ protected function setUp() { - Horde_Nls::setCharset('utf-8'); + $GLOBALS['registry']->setCharset('utf-8'); } /** diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php index 640f0592d..7872c173f 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php @@ -43,7 +43,7 @@ extends PHPUnit_Framework_TestCase */ protected function setUp() { - Horde_Nls::setCharset('utf-8'); + $GLOBALS['registry']->setCharset('utf-8'); Horde_String::setDefaultCharset('iso-8859-1'); } diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php index d936c13d9..fd2b28b8e 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php @@ -42,7 +42,7 @@ extends PHPUnit_Framework_TestCase */ protected function setUp() { - Horde_Nls::setCharset('utf-8'); + $GLOBALS['registry']->setCharset('utf-8'); } /** diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php index 3a2cdefec..9281a45e7 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/PreferencesTest.php @@ -44,7 +44,7 @@ extends PHPUnit_Framework_TestCase */ protected function setUp() { - Horde_Nls::setCharset('utf-8'); + $GLOBALS['registry']->setCharset('utf-8'); } /** @@ -140,4 +140,4 @@ class Horde_Kolab_Format_Xml_Hprefs_Dummy extends Horde_Kolab_Format_Xml_Hprefs 0, array('type' => self::TYPE_DATETIME)); } -} \ No newline at end of file +} diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php index 5189a0143..aea4e5a7f 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php @@ -49,7 +49,7 @@ extends PHPUnit_Framework_TestCase $this->markTestSkipped('The Horde_Date_Recurrence class is missing.'); } - Horde_Nls::setCharset('utf-8'); + $GLOBALS['registry']->setCharset('utf-8'); $this->_oldTimezone = date_default_timezone_get(); date_default_timezone_set('Europe/Berlin'); diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php index 91a4a3c23..2bf0d2bdb 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/XmlTest.php @@ -42,7 +42,7 @@ extends PHPUnit_Framework_TestCase */ protected function setUp() { - Horde_Nls::setCharset('utf-8'); + $GLOBALS['registry']->setCharset('utf-8'); } diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Namespace.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Namespace.php index a907aecd9..67a7c115d 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Namespace.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Namespace.php @@ -84,7 +84,7 @@ implements Iterator */ public function __construct() { - $this->_charset = Horde_Nls::getCharset(); + $this->_charset = $GLOBALS['registry']->getCharset(); if (empty($this->_primaryPersonalNamespace)) { $personal = null; foreach ($this->_namespaces as $namespace) { diff --git a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder/Base.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder/Base.php index 8e91fa57f..d77c6579a 100644 --- a/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder/Base.php +++ b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder/Base.php @@ -902,7 +902,7 @@ implements Horde_Kolab_Storage_Folder $part = new Horde_Mime_Part(); $part->setType(isset($data['type']) ? $data['type'] : null); $part->setContents(isset($data['content']) ? $data['content'] : file_get_contents($data['path'])); - $part->setCharset(Horde_Nls::getCharset()); + $part->setCharset($GLOBALS['registry']->getCharset()); $part->setTransferEncoding('quoted-printable'); $part->setDisposition('attachment'); $part->setName($attachment); @@ -925,7 +925,7 @@ implements Horde_Kolab_Storage_Folder $part = new Horde_Mime_Part(); $part->setType($handlers[$type]->getMimeType()); $part->setContents($new_content); - $part->setCharset(Horde_Nls::getCharset()); + $part->setCharset($GLOBALS['registry']->getCharset()); $part->setTransferEncoding('quoted-printable'); $part->setDisposition($handlers[$type]->getDisposition()); $part->setDispositionParameter('x-kolab-type', $type); @@ -1056,8 +1056,8 @@ implements Horde_Kolab_Storage_Folder $part = new Horde_Mime_Part(); $part->setType('text/plain'); $part->setName('Kolab Groupware Information'); - $part->setContents(Horde_String::wrap($kolab_text, 76, "\r\n", Horde_Nls::getCharset())); - $part->setCharset(Horde_Nls::getCharset()); + $part->setContents(Horde_String::wrap($kolab_text, 76, "\r\n", $GLOBALS['registry']->getCharset())); + $part->setCharset($GLOBALS['registry']->getCharset()); $part->setTransferEncoding('quoted-printable'); $mime_message->addPart($part); diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php index 6dbe68c1c..9bc596255 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/CclientTest.php @@ -42,7 +42,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Cclient( $this->group, array() @@ -55,7 +55,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Cclient( $this->group, array() diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php index 9fda3b23f..a47e191aa 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/ImapTest.php @@ -42,7 +42,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Imap( $this->_getNamespaceMock(), $this->group, @@ -56,7 +56,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Imap( $this->_getNamespaceMock(), $this->group, diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php index 77e41cb5b..0f6b440f8 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/MockTest.php @@ -58,7 +58,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Mock( $this->group, array() @@ -71,7 +71,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Mock( $this->group, array() diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php index dbc334db3..517e0e696 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Class/Driver/PearTest.php @@ -42,7 +42,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsNamespaceHandler() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Pear( $this->_getNamespaceMock(), $this->group, @@ -56,7 +56,7 @@ extends PHPUnit_Framework_TestCase public function testGetNamespaceReturnsExpectedNamespaces() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); $driver = new Horde_Kolab_Storage_Driver_Pear( $this->_getNamespaceMock(), $this->group, diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/FolderTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/FolderTest.php index da160bff6..2e24a985a 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/FolderTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/FolderTest.php @@ -88,7 +88,7 @@ class Horde_Kolab_Storage_FolderTest extends PHPUnit_Framework_TestCase $folder = new Horde_Kolab_Storage_Folder_Base('INBOX/Contacts'); $folder->restore($storage, $connection); $folder->setName('TestAÖÜ'); - $this->assertEquals(Horde_String::convertCharset('INBOX/TestAÖÜ', Horde_Nls::getCharset(), 'UTF7-IMAP'), $folder->new_name); + $this->assertEquals(Horde_String::convertCharset('INBOX/TestAÖÜ', $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), $folder->new_name); } /** diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php index bbdce741e..3d0784e00 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/NamespaceTest.php @@ -72,7 +72,7 @@ class Horde_Kolab_Storage_NamespaceTest extends PHPUnit_Framework_TestCase public function testFolderTitleConvertsUtf7() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); foreach ($this->_getNamespaces() as $namespace) { $name = Horde_String::convertCharset('äöü', 'UTF8', 'UTF7-IMAP'); $folder = $this->_getFolder('INBOX/' . $name, $namespace); @@ -190,7 +190,7 @@ class Horde_Kolab_Storage_NamespaceTest extends PHPUnit_Framework_TestCase public function testSetnameConvertsToUtf7() { - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); foreach ($this->_getNamespaces() as $namespace) { $folder = $this->_getFolder(null, $namespace); $folder->restore($this->_storage, $this->_connection); diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php index 51507db24..d08c32949 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Server/DriverTest.php @@ -48,7 +48,7 @@ class Horde_Kolab_Storage_Server_DriverTest extends PHPUnit_Framework_TestCase } /** @todo: FIXME -> required for namespace handling */ - Horde_Nls::setCharset('UTF8'); + $GLOBALS['registry']->setCharset('UTF8'); /** Setup group handler */ require_once 'Horde/Group.php'; diff --git a/framework/Mime/lib/Horde/Mime.php b/framework/Mime/lib/Horde/Mime.php index 583a55d69..e21d8835d 100644 --- a/framework/Mime/lib/Horde/Mime.php +++ b/framework/Mime/lib/Horde/Mime.php @@ -97,7 +97,7 @@ class Horde_Mime static public function encode($text, $charset = null) { if (is_null($charset)) { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); } $charset = Horde_String::lower($charset); @@ -322,7 +322,7 @@ class Horde_Mime $rest = substr($string, (strlen($preceding . $charset . $encoding . $encoded_text) + 6)); if (is_null($to_charset)) { - $to_charset = Horde_Nls::getCharset(); + $to_charset = $GLOBALS['registry']->getCharset(); } switch ($encoding) { diff --git a/framework/Mime/lib/Horde/Mime/Mdn.php b/framework/Mime/lib/Horde/Mime/Mdn.php index a643c43da..e5513d326 100644 --- a/framework/Mime/lib/Horde/Mime/Mdn.php +++ b/framework/Mime/lib/Horde/Mime/Mdn.php @@ -179,7 +179,7 @@ class Horde_Mime_Mdn $msg->setType('multipart/report'); $msg->setContentTypeParameter('report-type', 'disposition-notification'); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); /* The first part is a human readable message. */ $part_one = new Horde_Mime_Part('text/plain'); diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Css.php b/framework/Mime/lib/Horde/Mime/Viewer/Css.php index 859ced961..6b8bbf0b5 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Css.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Css.php @@ -95,7 +95,7 @@ class Horde_Mime_Viewer_Css extends Horde_Mime_Viewer_Source $this->_mimepart->getMimeId() => array( 'data' => $this->_lineNumber(trim($css)), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Deb.php b/framework/Mime/lib/Horde/Mime/Viewer/Deb.php index 7d56c9582..8a02c6705 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Deb.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Deb.php @@ -78,7 +78,7 @@ class Horde_Mime_Viewer_Deb extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => '
' . htmlspecialchars($data) . '
', 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Enriched.php b/framework/Mime/lib/Horde/Mime/Viewer/Enriched.php index f730fb214..92ee2242c 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Enriched.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Enriched.php @@ -64,7 +64,7 @@ class Horde_Mime_Viewer_Enriched extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => Horde_String::convertCharset($this->_toHTML(true), $this->_mimepart->getCharset()), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Enscript.php b/framework/Mime/lib/Horde/Mime/Viewer/Enscript.php index f3c2f44a3..cf7988617 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Enscript.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Enscript.php @@ -36,7 +36,7 @@ class Horde_Mime_Viewer_Enscript extends Horde_Mime_Viewer_Source $this->_mimepart->getMimeId() => array( 'data' => $this->_toHTML(), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -52,7 +52,7 @@ class Horde_Mime_Viewer_Enscript extends Horde_Mime_Viewer_Source $this->_mimepart->getMimeId() => array( 'data' => $this->_toHTML(), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Html.php b/framework/Mime/lib/Horde/Mime/Viewer/Html.php index eb479e546..4509ef16f 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Html.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Html.php @@ -72,7 +72,7 @@ class Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => Horde_String::convertCharset($html['data'], $this->_mimepart->getCharset()), 'status' => $html['status'], - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Msexcel.php b/framework/Mime/lib/Horde/Mime/Viewer/Msexcel.php index 7f7cc92eb..caed1619a 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Msexcel.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Msexcel.php @@ -50,7 +50,7 @@ class Horde_Mime_Viewer_Msexcel extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => file_get_contents($tmp_out), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Mspowerpoint.php b/framework/Mime/lib/Horde/Mime/Viewer/Mspowerpoint.php index 40aaaf91e..0e5c77f71 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Mspowerpoint.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Mspowerpoint.php @@ -53,7 +53,7 @@ class Horde_Mime_Viewer_Mspowerpoint extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $data, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Msword.php b/framework/Mime/lib/Horde/Mime/Viewer/Msword.php index 02c400ca6..6b3ec0335 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Msword.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Msword.php @@ -59,7 +59,7 @@ class Horde_Mime_Viewer_Msword extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $data, 'status' => array(), - 'type' => $type . '; charset=' . Horde_Nls::getCharset() + 'type' => $type . '; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Php.php b/framework/Mime/lib/Horde/Mime/Viewer/Php.php index a53825f63..575389354 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Php.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Php.php @@ -65,7 +65,7 @@ class Horde_Mime_Viewer_Php extends Horde_Mime_Viewer_Source $this->_mimepart->getMimeId() => array( 'data' => $text, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Plain.php b/framework/Mime/lib/Horde/Mime/Viewer/Plain.php index 906853962..71d359768 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Plain.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Plain.php @@ -71,7 +71,7 @@ class Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $data, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Rar.php b/framework/Mime/lib/Horde/Mime/Viewer/Rar.php index 1f8055180..6a22a7b6e 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Rar.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Rar.php @@ -65,7 +65,7 @@ class Horde_Mime_Viewer_Rar extends Horde_Mime_Viewer_Driver $rar = Horde_Compress::factory('rar'); $rarData = $rar->decompress($contents); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $fileCount = count($rarData); $name = $this->_mimepart->getName(true); diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Rfc822.php b/framework/Mime/lib/Horde/Mime/Viewer/Rfc822.php index e3df91c50..226cda5a5 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Rfc822.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Rfc822.php @@ -36,7 +36,7 @@ class Horde_Mime_Viewer_Rfc822 extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $this->_mimepart->getContents(), 'status' => array(), - 'type' => 'text/plain; charset=' . Horde_Nls::getCharset() + 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -85,7 +85,7 @@ class Horde_Mime_Viewer_Rfc822 extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => empty($header_output) ? '' : ('
' . Horde_Text_Filter::filter(implode("
\n", $header_output), 'emails') . '
'), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Richtext.php b/framework/Mime/lib/Horde/Mime/Viewer/Richtext.php index f8c33b20e..ef39696ce 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Richtext.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Richtext.php @@ -73,7 +73,7 @@ class Horde_Mime_Viewer_Richtext extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => Horde_String::convertCharset($this->_toHTML(), $this->_mimepart->getCharset()), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Rpm.php b/framework/Mime/lib/Horde/Mime/Viewer/Rpm.php index 2e4de1f4b..a16dda9bc 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Rpm.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Rpm.php @@ -79,7 +79,7 @@ class Horde_Mime_Viewer_Rpm extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => '
' . htmlentities($data) . '
', 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Rtf.php b/framework/Mime/lib/Horde/Mime/Viewer/Rtf.php index 1404ad78e..75a29f057 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Rtf.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Rtf.php @@ -57,7 +57,7 @@ class Horde_Mime_Viewer_Rtf extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $data, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Smil.php b/framework/Mime/lib/Horde/Mime/Viewer/Smil.php index 2f93f0c79..a956aed74 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Smil.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Smil.php @@ -70,7 +70,7 @@ class Horde_Mime_Viewer_Smil extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $this->_content, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php b/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php index c765b44ae..8c688e026 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php @@ -79,7 +79,7 @@ class Horde_Mime_Viewer_Srchighlite extends Horde_Mime_Viewer_Source $this->_mimepart->getMimeId() => array( 'data' => $this->_lineNumber($results), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Tgz.php b/framework/Mime/lib/Horde/Mime/Viewer/Tgz.php index 9449bf639..0883b0a51 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Tgz.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Tgz.php @@ -92,7 +92,7 @@ class Horde_Mime_Viewer_Tgz extends Horde_Mime_Viewer_Driver $tar = Horde_Compress::factory('tar'); $tarData = $tar->decompress($contents); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $fileCount = count($tarData); $name = $this->_mimepart->getName(true); diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Tnef.php b/framework/Mime/lib/Horde/Mime/Viewer/Tnef.php index 5bd6df338..6fc364358 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Tnef.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Tnef.php @@ -79,7 +79,7 @@ class Horde_Mime_Viewer_Tnef extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $data, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php b/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php index 854915163..ce96ba5c8 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php @@ -401,7 +401,7 @@ class Horde_Mime_Viewer_Vcard extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => Horde::endBuffer() . $html, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Webcpp.php b/framework/Mime/lib/Horde/Mime/Viewer/Webcpp.php index d07600534..8533c3e44 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Webcpp.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Webcpp.php @@ -102,7 +102,7 @@ class Horde_Mime_Viewer_Webcpp extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $results, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Wordperfect.php b/framework/Mime/lib/Horde/Mime/Viewer/Wordperfect.php index 4b11df77f..c6bd76d75 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Wordperfect.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Wordperfect.php @@ -57,7 +57,7 @@ class Horde_Mime_Viewer_Wordperfect extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $data, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Zip.php b/framework/Mime/lib/Horde/Mime/Viewer/Zip.php index 0d38b3336..1089f7d04 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Zip.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Zip.php @@ -114,7 +114,7 @@ class Horde_Mime_Viewer_Zip extends Horde_Mime_Viewer_Driver Horde_String::pad(_("Ratio"), 10, ' ', STR_PAD_LEFT) . "\n", 'space2html', - array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true) + array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true) ) . str_repeat('-', 59 + $maxlen) . "\n"; foreach ($zipInfo as $key => $val) { @@ -131,7 +131,7 @@ class Horde_Mime_Viewer_Zip extends Horde_Mime_Viewer_Driver reset($val); while (list($k, $v) = each($val)) { - $val[$k] = Horde_Text_Filter::filter($v, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)); + $val[$k] = Horde_Text_Filter::filter($v, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); } if (!is_null($this->_callback)) { @@ -147,7 +147,7 @@ class Horde_Mime_Viewer_Zip extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => nl2br($text . str_repeat('-', 59 + $maxlen) . "\n"), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/framework/Model/lib/Horde/Form/Renderer/Xhtml.php b/framework/Model/lib/Horde/Form/Renderer/Xhtml.php index 9468c5828..39443239b 100644 --- a/framework/Model/lib/Horde/Form/Renderer/Xhtml.php +++ b/framework/Model/lib/Horde/Form/Renderer/Xhtml.php @@ -131,7 +131,7 @@ if (document.getElementById(%1$s)){ } } echo ''; } diff --git a/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php b/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php index e164d3b53..be1b5adf3 100644 --- a/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php +++ b/framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php @@ -91,7 +91,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer . 'id="%2$s" value="%3$s"%4$s%5$s%6$s />', ($var->isDisabled() ? ' form-input-disabled" ' : ''), $var->getVarName(), - htmlspecialchars($var->getValue($vars), ENT_QUOTES, Horde_Nls::getCharset()), + htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()), ($var->isDisabled() ? ' disabled="disabled" ' : ''), ($var->type->maxlength ? ' maxlength="' . $var->type->maxlength . '"' : ''), $this->_getActionScripts($form, $var) @@ -113,7 +113,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer return sprintf( '', $var->getVarName(), - htmlspecialchars($var->getValue($vars), ENT_QUOTES, Horde_Nls::getCharset()), + htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()), ($var->isDisabled() ? ' disabled="disabled" ' : ''), $this->_getActionScripts($form, $var) ); @@ -128,7 +128,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer { return sprintf(' ', $var->getVarName(), - htmlspecialchars($var->getValue($vars), ENT_QUOTES, Horde_Nls::getCharset()), + htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()), $var->isDisabled() ? ' disabled="disabled" ' : '', $this->_getActionScripts($form, $var) ); @@ -454,7 +454,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer $prompt = $var->type->prompt; $htmlchars = $var->getOption('htmlchars'); if ($prompt) { - $prompt = ''; + $prompt = ''; } return sprintf(' ', $var->getVarName(), @@ -483,7 +483,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer /* Hidden tag to store the current first level. */ $html = sprintf(' ', $varname, - htmlspecialchars($selected['1'], ENT_QUOTES, Horde_Nls::getCharset())); + htmlspecialchars($selected['1'], ENT_QUOTES, $GLOBALS['registry']->getCharset())); /* First level. */ $values_1 = Horde_Array::valuesToKeys(array_keys($values)); @@ -492,7 +492,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer 'if (this.value) { document.' . $form->getName() . '.formname.value=\'\';' . 'document.' . $form->getName() . '.submit() }', ($var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : '')); if (!empty($prompts)) { - $html .= ''; + $html .= ''; } $html .= $this->_selectOptions($values_1, $selected['1']); $html .= ' '; @@ -502,7 +502,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer $varname, ($var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : '')); if (!empty($prompts)) { - $html .= ''; + $html .= ''; } $values_2 = array(); if (!empty($selected['1'])) { @@ -774,7 +774,7 @@ EOT; function _renderVarDisplayDefault($form, $var, $vars) { return nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, - Horde_Nls::getCharset())); + $GLOBALS['registry']->getCharset())); } function _renderVarDisplay_html($form, $var, $vars) @@ -818,7 +818,7 @@ EOT; return Horde::link($mail_link, $email_val) . htmlspecialchars($display_email) . ''; } else { - return nl2br(htmlspecialchars($display_email, ENT_QUOTES, Horde_Nls::getCharset())); + return nl2br(htmlspecialchars($display_email, ENT_QUOTES, $GLOBALS['registry']->getCharset())); } } @@ -849,7 +849,7 @@ EOT; if (count($values) == 0) { return _("No values"); } elseif (isset($values[$value]) && $value != '') { - return htmlspecialchars($values[$value], ENT_QUOTES, Horde_Nls::getCharset()); + return htmlspecialchars($values[$value], ENT_QUOTES, $GLOBALS['registry']->getCharset()); } } @@ -859,7 +859,7 @@ EOT; if (count($values) == 0) { return _("No values"); } elseif (isset($values[$var->getValue($vars)])) { - return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, Horde_Nls::getCharset()); + return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, $GLOBALS['registry']->getCharset()); } } @@ -876,7 +876,7 @@ EOT; $display[] = $name; } } - return htmlspecialchars(implode(', ', $display), ENT_QUOTES, Horde_Nls::getCharset()); + return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset()); } } @@ -893,7 +893,7 @@ EOT; $display[] = $name; } } - return htmlspecialchars(implode(', ', $display), ENT_QUOTES, Horde_Nls::getCharset()); + return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset()); } } @@ -1064,7 +1064,7 @@ EOT; } } - $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, Horde_Nls::getCharset())); + $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset())); if (!empty($mapurl)) { $html .= '  ' . Horde::link(Horde::externalUrl($mapurl), $desc, null, '_blank') . Horde::img($icon, $desc) . ''; } @@ -1102,7 +1102,7 @@ EOT; function _renderVarDisplay_invalid($form, $var, $vars) { return '

' - . htmlspecialchars($var->type->message, ENT_QUOTES, Horde_Nls::getCharset()) + . htmlspecialchars($var->type->message, ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '

'; } @@ -1221,7 +1221,7 @@ EOT; $selected = ''; } $result .= ' \n"; @@ -1241,7 +1241,7 @@ EOT; $selected = ''; } $result .= " \n"; } diff --git a/framework/Nls/lib/Horde/Nls.php b/framework/Nls/lib/Horde/Nls.php index 081da8ba2..ec721c803 100644 --- a/framework/Nls/lib/Horde/Nls.php +++ b/framework/Nls/lib/Horde/Nls.php @@ -1,28 +1,30 @@ country lookups. + * common methods for handling language data, timezones, and hostname->country + * lookups. * * Copyright 1999-2010 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * - * @author Jon Parise - * @author Chuck Hagenbuch - * @author Jan Schneider - * @author Michael Slusarz - * @package Nls + * @author Jon Parise + * @author Chuck Hagenbuch + * @author Jan Schneider + * @author Michael Slusarz + * @category Horde + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @package Nls */ class Horde_Nls { /** - * Config values. + * DNS resolver. * - * @var array + * @var Net_DNS_Resolver */ - static public $config = array(); + static public $dnsResolver; /** * Cached values. @@ -32,316 +34,6 @@ class Horde_Nls static protected $_cache = array(); /** - * Selects the most preferred language for the current client session. - * - * @return string The selected language abbreviation. - */ - static public function select() - { - $lang = Horde_Util::getFormData('new_lang'); - - /* First, check if language pref is locked and, if so, set it to its - * value */ - if (isset($GLOBALS['prefs']) && - $GLOBALS['prefs']->isLocked('language')) { - $language = $GLOBALS['prefs']->getValue('language'); - /* Check if the user selected a language from the login screen */ - } elseif (!empty($lang) && self::isValid($lang)) { - $language = $lang; - /* Check if we have a language set in the session */ - } elseif (isset($_SESSION['horde_language'])) { - $language = $_SESSION['horde_language']; - /* Use site-wide default, if one is defined */ - } elseif (!empty(self::$config['defaults']['language'])) { - $language = self::$config['defaults']['language']; - /* Try browser-accepted languages. */ - } elseif (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - /* The browser supplies a list, so return the first valid one. */ - $browser_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); - foreach ($browser_langs as $lang) { - /* Strip quality value for language */ - if (($pos = strpos($lang, ';')) !== false) { - $lang = substr($lang, 0, $pos); - } - $lang = self::_map(trim($lang)); - if (self::isValid($lang)) { - $language = $lang; - break; - } - - /* In case there's no full match, save our best guess. Try - * ll_LL, followed by just ll. */ - if (!isset($partial_lang)) { - $ll_LL = Horde_String::lower(substr($lang, 0, 2)) . '_' . Horde_String::upper(substr($lang, 0, 2)); - if (self::isValid($ll_LL)) { - $partial_lang = $ll_LL; - } else { - $ll = self::_map(substr($lang, 0, 2)); - if (self::isValid($ll)) { - $partial_lang = $ll; - } - } - } - } - } - - if (!isset($language)) { - $language = isset($partial_lang) - ? $partial_lang - /* No dice auto-detecting, default to US English. */ - : 'en_US'; - } - - return basename($language); - } - - /** - * Sets the language. - * - * @param string $lang The language abbreviation. - * - * @throws Horde_Exception - */ - static public function setLanguage($lang = null) - { - Horde::loadConfiguration('nls.php', null, 'horde'); - - if (empty($lang) || !self::isValid($lang)) { - $lang = self::select(); - } - - $_SESSION['horde_language'] = $lang; - - if (isset($GLOBALS['language'])) { - if ($GLOBALS['language'] == $lang) { - return; - } elseif (isset($GLOBALS['registry'])) { - $GLOBALS['registry']->clearCache(); - } - } - $GLOBALS['language'] = $lang; - - /* First try language with the current charset. */ - $lang_charset = $lang . '.' . self::getCharset(); - if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { - /* Next try language with its default charset. */ - $charset = empty(self::$config['charsets'][$lang]) - ? 'ISO-8859-1' - : self::$config['charsets'][$lang]; - $lang_charset = $lang . '.' . $charset; - self::_cachedCharset(0, $charset); - if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { - /* At last try language solely. */ - $lang_charset = $lang; - setlocale(LC_ALL, $lang_charset); - } - } - - @putenv('LC_ALL=' . $lang_charset); - @putenv('LANG=' . $lang_charset); - @putenv('LANGUAGE=' . $lang_charset); - } - - /** - * Sets the gettext domain. - * - * @param string $app The application name. - * @param string $directory The directory where the application's - * LC_MESSAGES directory resides. - * @param string $charset The charset. - */ - static public function setTextdomain($app, $directory, $charset) - { - bindtextdomain($app, $directory); - textdomain($app); - - /* The existence of this function depends on the platform. */ - if (function_exists('bind_textdomain_codeset')) { - self::_cachedCharset(0, bind_textdomain_codeset($app, $charset)); - } - - if (!headers_sent()) { - header('Content-Type: text/html; charset=' . $charset); - } - } - - /** - * Sets the language and reloads the whole NLS environment. - * - * When setting the language, the gettext catalogs have to be reloaded - * too, charsets have to be updated etc. This method takes care of all - * this. - * - * @param string $language The new language. - * @param string $app The application for reloading the gettext - * catalog. The current application if empty. - */ - static public function setLanguageEnvironment($language = null, $app = null) - { - if (empty($app)) { - $app = $GLOBALS['registry']->getApp(); - } - self::setLanguage($language); - self::setTextdomain( - $app, - $GLOBALS['registry']->get('fileroot', $app) . '/locale', - self::getCharset() - ); - Horde_String::setDefaultCharset(self::getCharset()); - } - - /** - * Determines whether the supplied language is valid. - * - * @param string $language The abbreviated name of the language. - * - * @return boolean True if the language is valid, false if it's not - * valid or unknown. - */ - static public function isValid($language) - { - return !empty(self::$config['languages'][$language]); - } - - /** - * Maps languages with common two-letter codes (such as nl) to the - * full gettext code (in this case, nl_NL). Returns the language - * unmodified if it isn't an alias. - * - * @param string $language The language code to map. - * - * @return string The mapped language code. - */ - static protected function _map($language) - { - // Translate the $language to get broader matches. - // (eg. de-DE should match de_DE) - $trans_lang = str_replace('-', '_', $language); - $lang_parts = explode('_', $trans_lang); - $trans_lang = Horde_String::lower($lang_parts[0]); - if (isset($lang_parts[1])) { - $trans_lang .= '_' . Horde_String::upper($lang_parts[1]); - } - - // See if we get a match for this - if (!empty(self::$config['aliases'][$trans_lang])) { - return self::$config['aliases'][$trans_lang]; - } - - // If we get that far down, the language cannot be found. - // Return $trans_lang. - return $trans_lang; - } - - /** - * Returns the charset for the current language. - * - * @param boolean $original If true returns the original charset of the - * translation, the actually used one otherwise. - * - * @return string The character set that should be used with the current - * locale settings. - */ - static public function getCharset($original = false) - { - /* Get cached results. */ - $cacheKey = intval($original); - $charset = self::_cachedCharset($cacheKey); - if (!is_null($charset)) { - return $charset; - } - - if ($original) { - $charset = empty(self::$config['charsets'][$GLOBALS['language']]) - ? 'ISO-8859-1' - : self::$config['charsets'][$GLOBALS['language']]; - } else { - $browser = new Horde_Browser(); - if ($browser->hasFeature('utf') && - (Horde_Util::extensionExists('iconv') || - Horde_Util::extensionExists('mbstring'))) { - $charset = 'UTF-8'; - } - } - - if (is_null($charset)) { - $charset = self::getExternalCharset(); - } - - self::_cachedCharset($cacheKey, $charset); - - return $charset; - } - - /** - * Returns the current charset of the environment - * - * @return string The character set that should be used with the current - * locale settings. - */ - static public function getExternalCharset() - { - /* Get cached results. */ - $charset = self::_cachedCharset(2); - if (!is_null($charset)) { - return $charset; - } - - $lang_charset = setlocale(LC_ALL, 0); - if (strpos($lang_charset, ';') === false && - strpos($lang_charset, '/') === false) { - $lang_charset = explode('.', $lang_charset); - if ((count($lang_charset) == 2) && !empty($lang_charset[1])) { - self::_cachedCharset(2, $lang_charset[1]); - return $lang_charset[1]; - } - } - - return empty(self::$config['charsets'][$GLOBALS['language']]) - ? 'ISO-8859-1' - : self::$config['charsets'][$GLOBALS['language']]; - } - - /** - * Sets or returns the charset used under certain conditions. - * - * @param integer $index The ID of a cache slot. 0 for the UI charset, 1 - * for the translation charset and 2 for the - * external charset. - * @param string $charset If specified, this charset will be stored in the - * given cache slot. Otherwise the content of the - * specified cache slot will be returned. - */ - static public function _cachedCharset($index, $charset = null) - { - if (is_null($charset)) { - return isset(self::$_cache['charset'][$index]) - ? self::$_cache['charset'][$index] - : null; - } else { - self::$_cache['charset'][$index] = $charset; - } - } - - /** - * Returns the charset to use for outgoing emails. - * - * @return string The preferred charset for outgoing mails based on - * the user's preferences and the current language. - */ - static public function getEmailCharset() - { - $charset = $GLOBALS['prefs']->getValue('sending_charset'); - if (!empty($charset)) { - return $charset; - } - - return isset(self::$config['emails'][$GLOBALS['language']]) - ? self::$config['emails'][$GLOBALS['language']] - : (isset(self::$config['charsets'][$GLOBALS['language']]) ? self::$config['charsets'][$GLOBALS['language']] : 'ISO-8859-1'); - } - - /** * Check to see if character set is valid for htmlspecialchars() calls. * * @param string $charset The character set to check. @@ -354,12 +46,6 @@ class Horde_Nls return false; } - if (isset(self::$_cache['check'][$charset])) { - return self::$_cache['check'][$charset]; - } elseif (!isset($check)) { - $check = array(); - } - $valid = true; ini_set('track_errors', 1); @@ -369,49 +55,10 @@ class Horde_Nls } ini_restore('track_errors'); - self::$_cache['check'][$charset] = $valid; - return $valid; } /** - * Sets the charset. - * - * In general, the applied charset is automatically determined by browser - * language and browser capabilities and there's no need to manually call - * setCharset. However for headless (RPC) operations the charset may be - * set manually to ensure correct character conversion in the backend. - * - * @param string $charset If specified, this charset will be stored in the - * given cache slot. - * @param integer $index The ID of a cache slot. 0 for the UI charset, 1 - * for the translation charset and 2 for the - * external charset. Defaults to 0: this is the - * charset returned by getCharset and used for - * conversion. - */ - static public function setCharset($charset, $index = 0) - { - self::_cachedCharset($index, $charset); - } - - /** - * Sets the charset and reloads the whole NLS environment. - * - * When setting the charset, the gettext catalogs have to be reloaded too, - * to match the new charset, among other things. This method takes care of - * all this. - * - * @param string $charset The new charset. - */ - static public function setCharsetEnvironment($charset) - { - unset($GLOBALS['language']); - self::setCharset($charset); - self::setLanguageEnvironment(); - } - - /** * Returns a list of available timezones. * * @return array List of timezones. @@ -423,17 +70,6 @@ class Horde_Nls } /** - * Sets the current timezone, if available. - */ - static public function setTimeZone() - { - $tz = $GLOBALS['prefs']->getValue('timezone'); - if (!empty($tz)) { - @date_default_timezone_set($tz); - } - } - - /** * Get the locale info returned by localeconv(), but cache it, to * avoid repeated calls. * @@ -465,25 +101,25 @@ class Horde_Nls if (!isset(self::$_cache['nl_info'])) { self::$_cache['nl_info'] = array(); } + if (!isset(self::$_cache['nl_info'][$item])) { self::$_cache['nl_info'][$item] = nl_langinfo($item); } + return self::$_cache['nl_info'][$item]; } /** * Get country information from a hostname or IP address. * - * @param string $host The hostname or IP address. - * @param Net_DNS_Resolver $dns A DNS resolver object used to look up the - * hostname. + * @param string $host The hostname or IP address. * * @return mixed On success, return an array with the following entries: * 'code' => Country Code * 'name' => Country Name * On failure, return false. */ - static public function getCountryByHost($host, $dns = null) + static public function getCountryByHost($host) { /* List of generic domains that we know is not in the country TLD list. See: http://www.iana.org/gtld/gtld.htm */ @@ -494,15 +130,16 @@ class Horde_Nls $checkHost = $host; if (preg_match('/^\d+\.\d+\.\d+\.\d+$/', $host)) { - if (is_null($dns)) { - $checkHost = @gethostbyaddr($host); - } elseif ($response = $dns->query($host, 'PTR')) { + if (isset(self::$dnsResolver) && + ($response = self::$dnsResolver->query($host, 'PTR'))) { foreach ($response->answer as $val) { if (isset($val->ptrdname)) { $checkHost = $val->ptrdname; break; } } + } else { + $checkHost = @gethostbyaddr($host); } } @@ -552,28 +189,6 @@ class Horde_Nls } /** - * Returns a Horde image link to the country flag. - * - * @param string $host The hostname or IP address. - * @param Net_DNS_Resolver $dns A DNS resolver object used to look up the - * hostname. - * - * @return string The image URL, or the empty string on error. - */ - static public function generateFlagImageByHost($host, $dns = null) - { - $data = self::getCountryByHost($host, $dns); - if ($data === false) { - return ''; - } - - $img = $data['code'] . '.png'; - return file_exists($GLOBALS['registry']->get('themesfs', 'horde') . '/graphics/flags/' . $img) - ? Horde::img('flags/' . $img, $data['name'], array('title' => $data['name'])) - : '[' . $data['name'] . ']'; - } - - /** * Returns either a specific or all ISO-3166 country names. * * @param string $code The ISO 3166 country code. diff --git a/framework/Nls/package.xml b/framework/Nls/package.xml index 9b25f52d6..e6af73b49 100644 --- a/framework/Nls/package.xml +++ b/framework/Nls/package.xml @@ -5,8 +5,9 @@ http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> Nls pear.horde.org - Localization Package - TODO + This package provides Native Language Support (NLS). + + Provide common methods for handling language data, timezones, and hostname->country lookups. Chuck Hagenbuch @@ -30,7 +31,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> beta LGPL - * Initial Horde 4 package. + * Eliminate dependency on horde/Browser and horde/Core. + * Initial Horde 4 package. @@ -57,14 +59,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> 1.5.4 - Browser - pear.horde.org - - - Core - pear.horde.org - - Util pear.horde.org diff --git a/framework/Notification/lib/Horde/Notification/Event/Status.php b/framework/Notification/lib/Horde/Notification/Event/Status.php index 86c0c7d79..fafee18d3 100644 --- a/framework/Notification/lib/Horde/Notification/Event/Status.php +++ b/framework/Notification/lib/Horde/Notification/Event/Status.php @@ -23,7 +23,7 @@ class Horde_Notification_Event_Status extends Horde_Notification_Event $text = $this->message; if (!in_array('content.raw', $this->flags) && class_exists('Horde_Nls')) { - $text = htmlspecialchars($text, ENT_COMPAT, Horde_Nls::getCharset()); + $text = htmlspecialchars($text, ENT_COMPAT, $GLOBALS['registry']->getCharset()); } return $text; diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php index c853114ef..6279d81b9 100644 --- a/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php +++ b/framework/Notification/test/Horde/Notification/Class/Notification/Event/StatusTest.php @@ -35,7 +35,7 @@ class Horde_Notification_Class_Notification_Event_StatusTest extends PHPUnit_Fra if (!class_exists('Horde_Nls')) { $this->markTestSkipped('The Horde_Nls class is not available!'); } - Horde_Nls::setCharset('ISO-8859-1'); + $GLOBALS['registry']->setCharset('ISO-8859-1'); $event = new Horde_Notification_Event_Status('test'); $this->assertEquals('<b>test</b>', (string) $event); } diff --git a/framework/Prefs/lib/Horde/Prefs.php b/framework/Prefs/lib/Horde/Prefs.php index 55e95279d..dba7dfc15 100644 --- a/framework/Prefs/lib/Horde/Prefs.php +++ b/framework/Prefs/lib/Horde/Prefs.php @@ -226,7 +226,7 @@ class Horde_Prefs */ public function getCharset() { - return Horde_Nls::getCharset(); + return $GLOBALS['registry']->getCharset(); } /** @@ -339,7 +339,7 @@ class Horde_Prefs global $conf; if ($convert) { - $val = $this->convertToDriver($val, Horde_Nls::getCharset()); + $val = $this->convertToDriver($val, $GLOBALS['registry']->getCharset()); } // If the preference's value is already equal to $val, don't @@ -396,8 +396,8 @@ class Horde_Prefs /* Default values have the current UI charset. * Stored values have the backend charset. */ $value = $this->isDefault($pref) - ? Horde_String::convertCharset($this->_prefs[$pref]['v'], Horde_Nls::getCharset(), Horde_Nls::getCharset()) - : $this->convertFromDriver($this->_prefs[$pref]['v'], Horde_Nls::getCharset()); + ? Horde_String::convertCharset($this->_prefs[$pref]['v'], $GLOBALS['registry']->getCharset(), $GLOBALS['registry']->getCharset()) + : $this->convertFromDriver($this->_prefs[$pref]['v'], $GLOBALS['registry']->getCharset()); } else { $value = $this->_prefs[$pref]['v']; } @@ -841,7 +841,7 @@ class Horde_Prefs if ($this->_scopes[$pref_scope][$name]['m'] & self::PREFS_DEFAULT) { $this->_scopes[$pref_scope][$name]['v'] = $val; } else { - $this->_scopes[$pref_scope][$name]['v'] = $this->convertToDriver($val, Horde_Nls::getCharset()); + $this->_scopes[$pref_scope][$name]['v'] = $this->convertToDriver($val, $GLOBALS['registry']->getCharset()); } if (!($this->_scopes[$pref_scope][$name]['m'] & self::LOCKED)) { $this->_scopes[$pref_scope][$name]['m'] |= self::DIRTY; diff --git a/framework/Prefs/lib/Horde/Prefs/Identity.php b/framework/Prefs/lib/Horde/Prefs/Identity.php index 66cde77af..feb49f4c5 100644 --- a/framework/Prefs/lib/Horde/Prefs/Identity.php +++ b/framework/Prefs/lib/Horde/Prefs/Identity.php @@ -71,7 +71,7 @@ class Horde_Prefs_Identity if (!($this->_identities = @unserialize($this->_prefs->getValue('identities', false)))) { $this->_identities = $this->_prefs->getDefault('identities'); } else { - $this->_identities = $this->_prefs->convertFromDriver($this->_identities, Horde_Nls::getCharset()); + $this->_identities = $this->_prefs->convertFromDriver($this->_identities, $GLOBALS['registry']->getCharset()); } $this->setDefault($this->_prefs->getValue('default_identity')); @@ -114,7 +114,7 @@ class Horde_Prefs_Identity { $identities = $this->_identities; if (is_array($identities)) { - $identities = $this->_prefs->convertToDriver($identities, Horde_Nls::getCharset()); + $identities = $this->_prefs->convertToDriver($identities, $GLOBALS['registry']->getCharset()); } $this->_prefs->setValue('identities', serialize($identities), false); @@ -406,10 +406,10 @@ class Horde_Prefs_Identity $pref = @unserialize($this->_prefs->getValue('confirm_email', false)); $pref = $pref - ? $this->_prefs->convertFromDriver($pref, Horde_Nls::getCharset()) + ? $this->_prefs->convertFromDriver($pref, $GLOBALS['registry']->getCharset()) : array(); $pref[$hash] = $this->get($id); - $pref = $this->_prefs->convertToDriver($pref, Horde_Nls::getCharset()); + $pref = $this->_prefs->convertToDriver($pref, $GLOBALS['registry']->getCharset()); $this->_prefs->setValue('confirm_email', serialize($pref), false); $new_addr = $this->getValue('from_addr', $id); @@ -429,7 +429,7 @@ class Horde_Prefs_Identity $body = new Horde_Mime_Part(); $body->setType('text/plain'); $body->setContents(Horde_String::wrap($message, 76, "\n")); - $body->setCharset(Horde_Nls::getCharset()); + $body->setCharset($GLOBALS['registry']->getCharset()); $body->send($new_addr, $msg_headers, $GLOBALS['injector']->getInstance('Horde_Mail')); @@ -458,7 +458,7 @@ class Horde_Prefs_Identity return array(_("Email addresses to confirm not found."), 'horde.message'); } - $identity = $this->_prefs->convertFromDriver($confirm[$hash], Horde_Nls::getCharset()); + $identity = $this->_prefs->convertFromDriver($confirm[$hash], $GLOBALS['registry']->getCharset()); $id = array_search($identity['id'], $this->getAll('id')); if ($id === false) { /* Adding a new identity. */ diff --git a/framework/Rampage/scripts/Horde/Rampage/rampage.php b/framework/Rampage/scripts/Horde/Rampage/rampage.php index e61632485..01060de07 100644 --- a/framework/Rampage/scripts/Horde/Rampage/rampage.php +++ b/framework/Rampage/scripts/Horde/Rampage/rampage.php @@ -850,7 +850,7 @@ function render_field($field) case 'mediumtext': case 'longblob': case 'longtext': - return "nl2br(Horde_Text::linkUrls(Horde_Text_Filter::filter(\$zitem['$n'], 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), false, 'text'))"; + return "nl2br(Horde_Text::linkUrls(Horde_Text_Filter::filter(\$zitem['$n'], 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), false, 'text'))"; case 'bool': case 'boolean': @@ -1224,7 +1224,7 @@ function field_get_quoted($field) case 'mediumtext': case 'longblob': case 'longtext': - return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), Horde_Nls::getCharset(), \$this->_params['charset'])"; + return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), $GLOBALS['registry']->getCharset(), \$this->_params['charset'])"; // Integer types case 'bit': diff --git a/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php b/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php index da1522f79..0f1887427 100644 --- a/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php +++ b/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php @@ -34,7 +34,7 @@ class Horde_Rpc_Jsonrpc extends Horde_Rpc function __construct($request, $params = array()) { parent::__construct($request, $params); - Horde_Nls::setCharsetEnvironment('UTF-8'); + $GLOBALS['registry']->setCharsetEnvironment('UTF-8'); } /** diff --git a/framework/Rpc/lib/Horde/Rpc/Soap.php b/framework/Rpc/lib/Horde/Rpc/Soap.php index ec60526b0..9950edea1 100644 --- a/framework/Rpc/lib/Horde/Rpc/Soap.php +++ b/framework/Rpc/lib/Horde/Rpc/Soap.php @@ -48,7 +48,7 @@ class Horde_Rpc_Soap extends Horde_Rpc */ public function __construct($request, $params = array()) { - Horde_Nls::setCharset('UTF-8'); + $GLOBALS['registry']->setCharset('UTF-8'); parent::__construct($request, $params); diff --git a/framework/Rpc/lib/Horde/Rpc/Webdav.php b/framework/Rpc/lib/Horde/Rpc/Webdav.php index ccd57759a..fed5be82f 100644 --- a/framework/Rpc/lib/Horde/Rpc/Webdav.php +++ b/framework/Rpc/lib/Horde/Rpc/Webdav.php @@ -588,7 +588,7 @@ class Horde_Rpc_Webdav extends Horde_Rpc // Handle certain standard properties specially if (in_array('displayname', $properties['DAV:'])) { - $props[] = $this->mkprop('displayname', Horde_String::convertCharset($item['name'], Horde_Nls::getCharset(), 'UTF-8')); + $props[] = $this->mkprop('displayname', Horde_String::convertCharset($item['name'], $GLOBALS['registry']->getCharset(), 'UTF-8')); unset($properties['DAV:']['displayname']); } if (in_array('getlastmodified', $properties['DAV:'])) { diff --git a/framework/Share/lib/Horde/Share/Sql.php b/framework/Share/lib/Horde/Share/Sql.php index d919537c3..0c10c142c 100644 --- a/framework/Share/lib/Horde/Share/Sql.php +++ b/framework/Share/lib/Horde/Share/Sql.php @@ -908,7 +908,7 @@ class Horde_Share_Sql extends Horde_Share foreach ($data as $key => $value) { if (substr($key, 0, 9) == 'attribute') { $data[$key] = Horde_String::convertCharset( - $data[$key], Horde_Nls::getCharset(), $this->_params['charset']); + $data[$key], $GLOBALS['registry']->getCharset(), $this->_params['charset']); } } diff --git a/framework/SpellChecker/lib/Horde/SpellChecker/Aspell.php b/framework/SpellChecker/lib/Horde/SpellChecker/Aspell.php index 16051ad2d..32c900fc7 100644 --- a/framework/SpellChecker/lib/Horde/SpellChecker/Aspell.php +++ b/framework/SpellChecker/lib/Horde/SpellChecker/Aspell.php @@ -46,7 +46,7 @@ class Horde_SpellChecker_Aspell extends Horde_SpellChecker throw new Horde_Exception('Spellcheck failed. Command line: ' . $this->_cmd()); } - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); // Write to stdin. if ($this->_encoding) { diff --git a/framework/SyncML/SyncML/Backend/Horde.php b/framework/SyncML/SyncML/Backend/Horde.php index 576b767e9..5c2560767 100644 --- a/framework/SyncML/SyncML/Backend/Horde.php +++ b/framework/SyncML/SyncML/Backend/Horde.php @@ -45,7 +45,7 @@ class SyncML_Backend_Horde extends SyncML_Backend { { parent::setCharset($charset); - Horde_Nls::setCharset($this->getCharset()); + $GLOBALS['registry']->setCharset($this->getCharset()); Horde_String::setDefaultCharset($this->getCharset()); } diff --git a/framework/SyncML/tests/testsync.php b/framework/SyncML/tests/testsync.php index 06c59e0ce..4678bcbe5 100755 --- a/framework/SyncML/tests/testsync.php +++ b/framework/SyncML/tests/testsync.php @@ -89,7 +89,7 @@ if ($syncml_backend_driver == 'Horde') { require_once dirname(__FILE__) . '/../../../lib/Application.php'; Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true, 'session_control' => 'none')); Horde_String::setDefaultCharset('UTF-8'); - Horde_Nls::setCharset('UTF-8'); + $registry->setCharset('UTF-8'); } if (!empty($testsetuponly)) { diff --git a/framework/Tree/lib/Horde/Tree/Javascript.php b/framework/Tree/lib/Horde/Tree/Javascript.php index 74a3baec1..1f3436e92 100644 --- a/framework/Tree/lib/Horde/Tree/Javascript.php +++ b/framework/Tree/lib/Horde/Tree/Javascript.php @@ -88,7 +88,7 @@ class Horde_Tree_Javascript extends Horde_Tree ); Horde::addInlineScript(array( - 'window.' . $this->_instance . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ')', + 'window.' . $this->_instance . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')', $this->renderNodeDefinitions() ), 'dom'); @@ -115,7 +115,7 @@ class Horde_Tree_Javascript extends Horde_Tree { $this->_buildIndents($this->_root_nodes); - return 'window.' . $this->_instance . '.renderTree(' . Horde_Serialize::serialize($this->_nodes, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ',' . Horde_Serialize::serialize($this->_root_nodes, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ',' . ($this->_static ? 'true' : 'false') . ');'; + return 'window.' . $this->_instance . '.renderTree(' . Horde_Serialize::serialize($this->_nodes, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ',' . Horde_Serialize::serialize($this->_root_nodes, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ',' . ($this->_static ? 'true' : 'false') . ');'; } } diff --git a/framework/Ui/lib/Horde/Ui/FlagImage.php b/framework/Ui/lib/Horde/Ui/FlagImage.php new file mode 100644 index 000000000..ab1cf4a2a --- /dev/null +++ b/framework/Ui/lib/Horde/Ui/FlagImage.php @@ -0,0 +1,39 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @package Ui + */ +class Horde_Ui_FlagImage +{ + /** + * Render the language selection. + * + * @param boolean $form Return the selection box as a complete standalone + * form. + * + * @return string The HTML selection box. + */ + static public function generateFlagImageByHost($host) + { + $data = Horde_Nls::getCountryByHost($host); + if ($data === false) { + return ''; + } + + $img = $data['code'] . '.png'; + return file_exists($GLOBALS['registry']->get('themesfs', 'horde') . '/graphics/flags/' . $img) + ? Horde::img('flags/' . $img, $data['name'], array('title' => $data['name'])) + : '[' . $data['name'] . ']'; + } + +} diff --git a/framework/Ui/lib/Horde/Ui/JsCalendar.php b/framework/Ui/lib/Horde/Ui/JsCalendar.php index 5f15b6d5c..ff7ff2062 100644 --- a/framework/Ui/lib/Horde/Ui/JsCalendar.php +++ b/framework/Ui/lib/Horde/Ui/JsCalendar.php @@ -33,8 +33,8 @@ class Horde_Ui_JsCalendar Horde::addScriptFile('calendar.js', 'horde'); Horde::addInlineScript(array( 'Horde_Calendar.firstDayOfWeek = ' . (isset($GLOBALS['prefs']) ? intval($GLOBALS['prefs']->getValue('first_week_day')) : 1), - 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, Horde_Nls::getCharset()), - 'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, Horde_Nls::getCharset()), + 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), + 'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), )); } diff --git a/framework/Ui/lib/Horde/Ui/Language.php b/framework/Ui/lib/Horde/Ui/Language.php index ee1d35fb1..d4552fe91 100644 --- a/framework/Ui/lib/Horde/Ui/Language.php +++ b/framework/Ui/lib/Horde/Ui/Language.php @@ -26,7 +26,7 @@ class Horde_Ui_Language { $html = ''; if (!$GLOBALS['prefs']->isLocked('language')) { - $_SESSION['horde_language'] = Horde_Nls::select(); + $_SESSION['horde_language'] = $GLOBALS['registry']->preferredLang(); $html = sprintf('', Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/language.php', false, -1)); $html .= ''; diff --git a/framework/Ui/lib/Horde/Ui/VarRenderer.php b/framework/Ui/lib/Horde/Ui/VarRenderer.php index 503c0ffd7..d0ce59a7f 100644 --- a/framework/Ui/lib/Horde/Ui/VarRenderer.php +++ b/framework/Ui/lib/Horde/Ui/VarRenderer.php @@ -36,7 +36,7 @@ class Horde_Ui_VarRenderer public function __construct($params = array()) { $this->_params = $params; - $this->_charset = Horde_Nls::getCharset(); + $this->_charset = $GLOBALS['registry']->getCharset(); } /** diff --git a/framework/Ui/package.xml b/framework/Ui/package.xml index 5215f72db..bcd189e53 100644 --- a/framework/Ui/package.xml +++ b/framework/Ui/package.xml @@ -30,7 +30,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> beta LGPL - * Initial Horde 4 package. + * Added Horde_Ui_FlagImage::. + * Initial Horde 4 package. @@ -41,6 +42,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + @@ -61,12 +63,21 @@ http://pear.php.net/dtd/package-2.0.xsd"> 1.7.0 + + Core + pear.horde.org + + + Nls + pear.horde.org + + diff --git a/framework/iCalendar/iCalendar.php b/framework/iCalendar/iCalendar.php index 5147b8f88..874e7c78b 100644 --- a/framework/iCalendar/iCalendar.php +++ b/framework/iCalendar/iCalendar.php @@ -1025,7 +1025,7 @@ class Horde_iCalendar { // Add CHARSET as well. At least the synthesis client // gets confused otherwise if (empty($params['CHARSET'])) { - $params['CHARSET'] = Horde_Nls::getCharset(); + $params['CHARSET'] = $GLOBALS['registry']->getCharset(); $params_str .= ';CHARSET=' . $params['CHARSET']; } } diff --git a/gollem/templates/common-header.inc b/gollem/templates/common-header.inc index 74fb55de7..b2b617327 100644 --- a/gollem/templates/common-header.inc +++ b/gollem/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/gollem/templates/javascript_defs.php b/gollem/templates/javascript_defs.php index b68990427..d5059f1de 100644 --- a/gollem/templates/javascript_defs.php +++ b/gollem/templates/javascript_defs.php @@ -1,6 +1,6 @@ getCharset(); /* Variables used in core javascript files. */ $var = array( diff --git a/hermes/start.php b/hermes/start.php index 32c314dd0..1d99cc156 100644 --- a/hermes/start.php +++ b/hermes/start.php @@ -29,7 +29,7 @@ if ($form->validate($vars)) { } $now = time(); $timers[$now] = array('name' => Horde_String::convertCharset($vars->get('description'), - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), $prefs->getCharset()), 'time' => $now); $prefs->setValue('running_timers', serialize($timers), false); diff --git a/hermes/templates/common-header.inc b/hermes/templates/common-header.inc index 2c0b5cf88..b29454993 100644 --- a/hermes/templates/common-header.inc +++ b/hermes/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/horde/admin/sessions.php b/horde/admin/sessions.php index 7a8891629..d64b752cc 100644 --- a/horde/admin/sessions.php +++ b/horde/admin/sessions.php @@ -47,7 +47,7 @@ try { } else { $host = @gethostbyaddr($data['remoteAddr']); } - $entry[_("Remote Host:")] = $host . ' [' . $data['remoteAddr'] . '] ' . Horde_Nls::generateFlagImageByHost($host, $injector->getInstance('Net_DNS_Resolver')); + $entry[_("Remote Host:")] = $host . ' [' . $data['remoteAddr'] . '] ' . Horde_Ui_FlagImage::generateFlagImageByHost($host); } echo '
  • ' . $plus . $minus . htmlspecialchars($data['userid']) . ' [' . htmlspecialchars($id) . ']' diff --git a/horde/admin/setup/config.php b/horde/admin/setup/config.php index a919ec61c..1a4d351ab 100644 --- a/horde/admin/setup/config.php +++ b/horde/admin/setup/config.php @@ -57,7 +57,7 @@ if (Horde_Util::getFormData('submitbutton') == _("Revert Configuration")) { } if ($fp = @fopen($path . '/conf.php', 'w')) { /* Can write, so output to file. */ - fwrite($fp, Horde_String::convertCharset($php, Horde_Nls::getCharset(), 'iso-8859-1')); + fwrite($fp, Horde_String::convertCharset($php, $GLOBALS['registry']->getCharset(), 'iso-8859-1')); fclose($fp); $notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success'); $registry->clearCache(); diff --git a/horde/admin/setup/scripts.php b/horde/admin/setup/scripts.php index d50fc899d..a50151022 100644 --- a/horde/admin/setup/scripts.php +++ b/horde/admin/setup/scripts.php @@ -60,7 +60,7 @@ if ($setup == 'conf' && $type == 'php') { $data .= Horde_String::convertCharset(str_replace(array('\\', '\''), array('\\\\', '\\\''), $php), - Horde_Nls::getCharset(), 'iso-8859-1'); + $GLOBALS['registry']->getCharset(), 'iso-8859-1'); $data .= '\');' . "\n"; $data .= ' fclose($fp);' . "\n"; $data .= ' echo \'' . sprintf('Saved %s configuration.', $app) . '\' . "\n";' . "\n"; diff --git a/horde/admin/sqlshell.php b/horde/admin/sqlshell.php index f43f0d958..b9cadcacf 100644 --- a/horde/admin/sqlshell.php +++ b/horde/admin/sqlshell.php @@ -48,7 +48,7 @@ if (Horde_Util::getFormData('list-tables')) { } // Parse out the query results. - $result = $dbh->query(Horde_String::convertCharset($command, Horde_Nls::getCharset(), $conf['sql']['charset'])); + $result = $dbh->query(Horde_String::convertCharset($command, $GLOBALS['registry']->getCharset(), $conf['sql']['charset'])); } if (isset($result)) { diff --git a/horde/config/hooks.php.dist b/horde/config/hooks.php.dist index 6c48ecd5e..6249880b6 100644 --- a/horde/config/hooks.php.dist +++ b/horde/config/hooks.php.dist @@ -288,7 +288,7 @@ class Horde_Hooks // $ldapPort = '389'; // $searchBase = 'ou=people,o=example.com'; // $ldapcharset = 'utf-8'; -// $outputcharset = Horde_Nls::getCharset(); +// $outputcharset = $GLOBALS['registry']->getCharset(); // // $ds = @ldap_connect($ldapServer, $ldapPort); // @@ -582,7 +582,7 @@ class Horde_Hooks // $fields = $values = array(); // foreach ($extra as $field => $value) { // $fields[] = 'object_' . Horde_String::lower($field); -// $values[] = $db->quote(Horde_String::convertCharset($value, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset'])); +// $values[] = $db->quote(Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset'])); // } // $fields[] = 'object_id'; // $values[] = $db->quote($userId); diff --git a/horde/config/nls.php b/horde/config/nls.php index 8fc292418..0d12f9517 100644 --- a/horde/config/nls.php +++ b/horde/config/nls.php @@ -1,9 +1,13 @@ array( /* The language to fall back on if we cannot determine one any other @@ -208,11 +212,11 @@ Horde_Nls::$config = array( ); /* Sort encodings. */ -asort(Horde_Nls::$config['encodings']); +asort($horde_nls_config['encodings']); /* BSD charsets. */ if (strpos(PHP_OS, 'BSD') !== false) { - Horde_Nls::$config['charsets'] = array_merge(Horde_Nls::$config['charsets'], array( + $horde_nls_config['charsets'] = array_merge($horde_nls_config['charsets'], array( 'bs_BA' => 'ISO8859-2', 'cs_CZ' => 'ISO8859-2', 'el_GR' => 'ISO8859-7', @@ -231,10 +235,10 @@ if (strpos(PHP_OS, 'BSD') !== false) { /* Turkish locales. */ if (version_compare(PHP_VERSION, '6', 'ge')) { - Horde_Nls::$config['aliases']['tr'] = 'tr_TR'; - Horde_Nls::$config['charsets']['tr_TR'] = (strpos(PHP_OS, 'BSD') === false) ? 'ISO-8859-9' : 'ISO8859-9'; - Horde_Nls::$config['languages']['tr_TR'] = 'Türkçe'; - Horde_Nls::$config['spelling']['tr_TR'] = '-d tr'; + $horde_nls_config['aliases']['tr'] = 'tr_TR'; + $horde_nls_config['charsets']['tr_TR'] = (strpos(PHP_OS, 'BSD') === false) ? 'ISO-8859-9' : 'ISO8859-9'; + $horde_nls_config['languages']['tr_TR'] = 'Türkçe'; + $horde_nls_config['spelling']['tr_TR'] = '-d tr'; } /* Local overrides. */ diff --git a/horde/lib/Block/sunrise.php b/horde/lib/Block/sunrise.php index 9feec6e7f..aa0844179 100644 --- a/horde/lib/Block/sunrise.php +++ b/horde/lib/Block/sunrise.php @@ -39,7 +39,7 @@ class Horde_Block_Horde_sunrise extends Horde_Block { } // Set the timezone variable, if available. - Horde_Nls::setTimeZone(); + $GLOBALS['registry']->setTimeZone(); list($lat, $long) = explode(':', $this->_params['location']); $rise = $this->_calculateSunset(time(), $lat, $long, false, floor(date('Z') / 3600)); diff --git a/horde/lib/Block/time.php b/horde/lib/Block/time.php index c31add5e2..be544f269 100644 --- a/horde/lib/Block/time.php +++ b/horde/lib/Block/time.php @@ -48,7 +48,7 @@ class Horde_Block_Horde_time extends Horde_Block { } // Set the timezone variable, if available. - Horde_Nls::setTimeZone(); + $GLOBALS['registry']->setTimeZone(); $html = '
    ' . strftime('%A, %B %d, %Y '); diff --git a/horde/lib/Block/twitter_timeline.php b/horde/lib/Block/twitter_timeline.php index 21f662fc0..01f142753 100644 --- a/horde/lib/Block/twitter_timeline.php +++ b/horde/lib/Block/twitter_timeline.php @@ -157,7 +157,7 @@ EOT; Horde::addInlineScript($script, 'dom'); /* Get the user's most recent tweet */ - $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, Horde_Nls::getCharset()); + $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, $GLOBALS['registry']->getCharset()); // Bring in the Facebook CSS $csslink = $GLOBALS['registry']->get('themesuri', 'horde') . '/facebook.css'; diff --git a/horde/lib/Prefs/Ui.php b/horde/lib/Prefs/Ui.php index 2c63a35cf..6a0b9fd6a 100644 --- a/horde/lib/Prefs/Ui.php +++ b/horde/lib/Prefs/Ui.php @@ -65,7 +65,7 @@ class Horde_Prefs_Ui case 'language': if (!$prefs->isLocked('language')) { - $ui->override['language'] = Horde_Nls::$config['languages']; + $ui->override['language'] = $registry->nlsconfig['languages']; array_unshift($ui->override['language'], _("Default")); } @@ -199,7 +199,7 @@ class Horde_Prefs_Ui if ($prefs->isDirty('language')) { if ($prefs->isDirty('language')) { - Horde_Nls::setLanguageEnvironment($prefs->getValue('language')); + $registry->setLanguageEnvironment($prefs->getValue('language')); foreach ($registry->listAPIs() as $api) { if ($registry->hasMethod($api . '/changeLanguage')) { $registry->call($api . '/changeLanguage'); @@ -233,7 +233,7 @@ class Horde_Prefs_Ui * frame. */ if ($old_sidebar) { Horde::addInlineScript( - 'window.parent.frames.location = ' . Horde_Serialize::serialize((string)$url, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ';' + 'window.parent.frames.location = ' . Horde_Serialize::serialize((string)$url, Horde_Serialize::JSON, $registry->getCharset()) . ';' ); } else { Horde::redirect($url); diff --git a/horde/login.php b/horde/login.php index 443b0c936..6580176e0 100644 --- a/horde/login.php +++ b/horde/login.php @@ -168,8 +168,7 @@ if ($error_reason) { } $registry->setupSessionHandler(); - - Horde_Nls::setLanguageEnvironment($language, $vars->app); + $registry->setLanguageEnvironment($language, $vars->app); /* Hook to preselect the correct language in the widget. */ $_GET['new_lang'] = $language; @@ -228,7 +227,7 @@ if ($error_reason) { } else { $new_lang = Horde_Util::getGet('new_lang'); if ($new_lang) { - Horde_Nls::setLanguageEnvironment($new_lang); + $registry->setLanguageEnvironment($new_lang); } } @@ -273,10 +272,10 @@ if (!empty($conf['auth']['alternate_login'])) { /* Build the -getShortName()), ENT_COMPAT, Horde_Nls::getCharset()) ?>" /> +getShortName()), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>" />


    diff --git a/horde/templates/common-header.inc b/horde/templates/common-header.inc index c11cfd1ea..afb74f670 100644 --- a/horde/templates/common-header.inc +++ b/horde/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/hylax/templates/common-header.inc b/hylax/templates/common-header.inc index 2f69c6a1b..348944ae2 100644 --- a/hylax/templates/common-header.inc +++ b/hylax/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/imp/attachment.php b/imp/attachment.php index 468ea91f4..444895523 100644 --- a/imp/attachment.php +++ b/imp/attachment.php @@ -82,8 +82,8 @@ if ($conf['compose']['link_attachments_notify']) { /* Ignore missing addresses, which are returned as <>. */ if (strlen($mail_address) > 2) { $mail_address_full = $mail_identity->getDefaultFromAddress(true); - Horde_Nls::setTimeZone(); - Horde_Nls::setLanguageEnvironment(); + $registry->setTimeZone(); + $registry->setLanguageEnvironment(); /* Set up the mail headers and read the log file. */ $msg_headers = new Horde_Mime_Headers(); @@ -100,7 +100,7 @@ if ($conf['compose']['link_attachments_notify']) { $msg = new Horde_Mime_Part(); $msg->setType('text/plain'); - $msg->setCharset(Horde_Nls::getCharset()); + $msg->setCharset($registry->getCharset()); $d_url = new Horde_Url(Horde::selfUrl(true, false, true)); $msg->setContents(Horde_String::wrap(sprintf(_("Your linked attachment has been downloaded by at least one user.\n\nAttachment name: %s\nAttachment date: %s\n\nClick on the following link to permanently delete the attachment:\n%s"), $file_name, date('r', $time_stamp), $d_url->add('d', $id)))); diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index f721d16ad..47c01d435 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -30,9 +30,11 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -Horde_Registry::appInit('imp', array('impmode' => 'dimp')); +Horde_Registry::appInit('imp', array( + 'impmode' => 'dimp', + 'timezone' => true +)); -Horde_Nls::setTimeZone(); $vars = Horde_Variables::getDefaultVariables(); /* Determine if compose mode is disabled. */ diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index 177264804..4ced357df 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -31,9 +31,11 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -Horde_Registry::appInit('imp', array('impmode' => 'mimp')); +Horde_Registry::appInit('imp', array( + 'impmode' => 'mimp', + 'timezone' => true +)); -Horde_Nls::setTimeZone(); $vars = Horde_Variables::getDefaultVariables(); /* The message text and headers. */ @@ -252,7 +254,7 @@ case _("Send"): switch ($vars->a) { case _("Save Draft"): try { - $notification->push($imp_compose->saveDraft($header, $message, Horde_Nls::getCharset(), false), 'horde.success'); + $notification->push($imp_compose->saveDraft($header, $message, $registry->getCharset(), false), 'horde.success'); if ($prefs->getValue('close_draft')) { $imp_compose->destroy('save_draft'); require IMP_BASE . '/mailbox-mimp.php'; @@ -277,7 +279,7 @@ case _("Send"): ); try { - if ($imp_compose->buildAndSendMessage($message, $header, Horde_Nls::getEmailCharset(), false, $options)) { + if ($imp_compose->buildAndSendMessage($message, $header, $GLOBALS['registry']->getEmailCharset(), false, $options)) { $imp_compose->destroy('send'); $notification->push(_("Message sent successfully."), 'horde.success'); diff --git a/imp/compose.php b/imp/compose.php index 1a68a85e1..ada72ad66 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -17,7 +17,7 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('imp', array('session_control' => 'netscape')); -Horde_Nls::setTimeZone(); +$registry->setTimeZone(); /* The message headers and text. */ $header = array(); @@ -127,10 +127,10 @@ $imp_ui = new IMP_Ui_Compose(); * $encoding - best guessed charset offered to the user as the default value * in the charset dropdown list. */ $charset = $prefs->isLocked('sending_charset') - ? Horde_Nls::getEmailCharset() + ? $registry->getEmailCharset() : $vars->charset; $encoding = empty($charset) - ? Horde_Nls::getEmailCharset() + ? $registry->getEmailCharset() : $charset; /* Is this a popup window? */ @@ -373,7 +373,7 @@ case 'send_message': if (in_array($vars->actionID, array('auto_save_draft', 'save_draft'))) { if (!$readonly_drafts) { try { - $result = $imp_compose->saveDraft($header, $message, Horde_Nls::getCharset(), $rtemode); + $result = $imp_compose->saveDraft($header, $message, $registry->getCharset(), $rtemode); /* Closing draft if requested by preferences. */ if ($vars->actionID == 'save_draft') { @@ -819,7 +819,7 @@ if ($redirect) { $t->set('charset_label', Horde::label('charset', _("C_harset"))); $t->set('charset_tabindex', ++$tabindex); $charset_array = array(); - foreach (Horde_Nls::$config['encodings'] as $charset => $label) { + foreach ($registry->nlsconfig['encodings'] as $charset => $label) { $charset_array[] = array('value' => $charset, 'selected' => (strtolower($charset) == strtolower($encoding)), 'label' => $label); } $t->set('charset_array', $charset_array); diff --git a/imp/config/prefs.php.dist b/imp/config/prefs.php.dist index 1b2346536..8bbb8d119 100644 --- a/imp/config/prefs.php.dist +++ b/imp/config/prefs.php.dist @@ -493,7 +493,7 @@ $_prefs['sending_charset'] = array( 'value' => '', 'shared' => true, 'type' => 'enum', - 'enum' => array_merge(array('' => _("Default")), Horde_Nls::$config['encodings']), + 'enum' => array_merge(array('' => _("Default")), $GLOBALS['registry']->nlsconfig['encodings']), 'desc' => _("Your default charset for sending messages:") ); @@ -835,14 +835,14 @@ $_prefs['mail_hdr'] = array( // default message character set $_prefs['default_msg_charset'] = array( - 'value' => isset($GLOBALS['nls']['emails'][$GLOBALS['language']]) - ? $GLOBALS['nls']['emails'][$GLOBALS['language']] - : (isset($GLOBALS['nls']['charsets'][$GLOBALS['language']]) - ? $GLOBALS['nls']['charsets'][$GLOBALS['language']] + 'value' => isset($GLOBALS['registry']->nlsconfig['emails'][$GLOBALS['language']]) + ? $GLOBALS['registry']->nlsconfig['emails'][$GLOBALS['language']] + : (isset($GLOBALS['registry']->nlsconfig['charsets'][$GLOBALS['language']]) + ? $GLOBALS['registry']->nlsconfig['charsets'][$GLOBALS['language']] : ''), 'type' => 'enum', 'enum' => array_merge( - array('' => _("Default (US-ASCII)")), Horde_Nls::$config['encodings'] + array('' => _("Default (US-ASCII)")), $GLOBALS['registry']->nlsconfig['encodings'] ), 'desc' => _("The default charset for messages with no charset information:"), 'help' => 'prefs-default_msg_charset' diff --git a/imp/contacts.php b/imp/contacts.php index cd765519b..51930adfd 100644 --- a/imp/contacts.php +++ b/imp/contacts.php @@ -65,7 +65,7 @@ if ($vars->searched || $prefs->getValue('display_contact')) { $selected_addresses = array(); foreach (explode('|', $vars->sa) as $addr) { if (strlen(trim($addr))) { - $selected_addresses[] = @htmlspecialchars($addr, ENT_QUOTES, Horde_Nls::getCharset()); + $selected_addresses[] = @htmlspecialchars($addr, ENT_QUOTES, $registry->getCharset()); } } @@ -92,11 +92,11 @@ $a_list = array(); foreach ($addresses as $addr) { if (!empty($addr['email'])) { if (strpos($addr['email'], ',') !== false) { - $a_list[] = @htmlspecialchars(Horde_Mime_Address::encode($addr['name'], 'personal') . ': ' . $addr['email'] . ';', ENT_QUOTES, Horde_Nls::getCharset()); + $a_list[] = @htmlspecialchars(Horde_Mime_Address::encode($addr['name'], 'personal') . ': ' . $addr['email'] . ';', ENT_QUOTES, $registry->getCharset()); } else { $mbox_host = explode('@', $addr['email']); if (isset($mbox_host[1])) { - $a_list[] = @htmlspecialchars(Horde_Mime_Address::writeAddress($mbox_host[0], $mbox_host[1], $addr['name']), ENT_QUOTES, Horde_Nls::getCharset()); + $a_list[] = @htmlspecialchars(Horde_Mime_Address::writeAddress($mbox_host[0], $mbox_host[1], $addr['name']), ENT_QUOTES, $registry->getCharset()); } } } diff --git a/imp/folders.php b/imp/folders.php index 777af0eda..d14165b31 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -31,7 +31,7 @@ if (!$conf['user']['allow_folders']) { $subscribe = $prefs->getValue('subscribe'); $showAll = (!$subscribe || $_SESSION['imp']['showunsub']); -$charset = Horde_Nls::getCharset(); +$charset = $registry->getCharset(); /* Get the base URL for this page. */ $folders_url = Horde::selfUrl(); @@ -403,7 +403,7 @@ if ($a_template->get('javascript')) { $a_template->set('go', _("Go")); } -$a_template->set('create_folder', !empty($GLOBALS['conf']['hooks']['permsdenied']) || ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('create_folders') && $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders'))); +$a_template->set('create_folder', !empty($conf['hooks']['permsdenied']) || ($injector->getInstance('Horde_Perms')->hasAppPermission('create_folders') && $injector->getInstance('Horde_Perms')->hasAppPermission('max_folders'))); if ($prefs->getValue('subscribe')) { $a_template->set('subscribe', true); $subToggleText = ($showAll) ? _("Hide Unsubscribed") : _("Show Unsubscribed"); diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index f19373bfc..9bc0336ce 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -72,7 +72,7 @@ class IMP_Ajax_Application extends Horde_Ajax_Application_Base $imptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree'); $imptree->eltDiffStart(); - $new = Horde_String::convertCharset($this->_vars->mbox, Horde_Nls::getCharset(), 'UTF7-IMAP'); + $new = Horde_String::convertCharset($this->_vars->mbox, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'); try { $new = $imptree->createMailboxName($this->_vars->parent, $new); @@ -165,7 +165,7 @@ class IMP_Ajax_Application extends Horde_Ajax_Application_Base $result = false; try { - $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), Horde_Nls::getCharset(), 'UTF7-IMAP'); + $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'); if (($this->_vars->old_name != $new) && $GLOBALS['injector']->getInstance('IMP_Folder')->rename($this->_vars->old_name, $new)) { @@ -1447,7 +1447,7 @@ class IMP_Ajax_Application extends Horde_Ajax_Application_Base try { // TODO: Use 'sending_charset' - $sent = $imp_compose->buildAndSendMessage($this->_vars->message, $headers, Horde_Nls::getEmailCharset(), $this->_vars->html, $options); + $sent = $imp_compose->buildAndSendMessage($this->_vars->message, $headers, $GLOBALS['registry']->getEmailCharset(), $this->_vars->html, $options); } catch (IMP_Compose_Exception $e) { $result->success = 0; @@ -1655,7 +1655,7 @@ class IMP_Ajax_Application extends Horde_Ajax_Application_Base } try { - $res = $imp_compose->saveDraft($headers, $this->_vars->message, Horde_Nls::getCharset(), $this->_vars->html); + $res = $imp_compose->saveDraft($headers, $this->_vars->message, $GLOBALS['registry']->getCharset(), $this->_vars->html); if ($this->_action == 'autoSaveDraft') { $GLOBALS['notification']->push(_("Draft automatically saved."), 'horde.message'); } else { diff --git a/imp/lib/Ajax/Imple/ContactAutoCompleter.php b/imp/lib/Ajax/Imple/ContactAutoCompleter.php index 102bdb2c2..373b658a1 100644 --- a/imp/lib/Ajax/Imple/ContactAutoCompleter.php +++ b/imp/lib/Ajax/Imple/ContactAutoCompleter.php @@ -66,7 +66,7 @@ class IMP_Ajax_Imple_ContactAutoCompleter extends Horde_Ajax_Imple_AutoCompleter if (!isset($addrlist)) { $addrlist = IMP_Compose::getAddressList(); } - Horde::addInlineScript('if (!window.IMP) window.IMP = {}; IMP.ac_list = '. Horde_Serialize::serialize($addrlist, Horde_Serialize::JSON, Horde_Nls::getCharset())); + Horde::addInlineScript('if (!window.IMP) window.IMP = {}; IMP.ac_list = '. Horde_Serialize::serialize($addrlist, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())); self::$_listOutput = true; } diff --git a/imp/lib/Block/Newmail.php b/imp/lib/Block/Newmail.php index 3ac6d5ce3..9ad062882 100644 --- a/imp/lib/Block/Newmail.php +++ b/imp/lib/Block/Newmail.php @@ -33,7 +33,7 @@ class IMP_Block_Newmail extends Horde_Block if (empty($indices)) { $html .= '' . _("No unread messages") . ''; } else { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $imp_ui = new IMP_Ui_Mailbox('INBOX'); $shown = empty($this->_params['msgs_shown']) ? 3 diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index a9a56305a..277d6f589 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -537,7 +537,7 @@ class IMP_Compose $mdn->addMDNRequestHeaders($headers, $barefrom); } - $browser_charset = Horde_Nls::getCharset(); + $browser_charset = $GLOBALS['registry']->getCharset(); $headers->addHeader('From', Horde_String::convertCharset($header['from'], $browser_charset, $charset)); @@ -571,7 +571,7 @@ class IMP_Compose $headers_result = Horde::loadConfiguration('header.php', '_header'); if (is_array($headers_result)) { foreach ($headers_result as $key => $val) { - $headers->addHeader(trim($key), Horde_String::convertCharset(trim($val), Horde_Nls::getCharset(), $charset)); + $headers->addHeader(trim($key), Horde_String::convertCharset(trim($val), $GLOBALS['registry']->getCharset(), $charset)); } } } catch (Horde_Exception $e) {} @@ -675,7 +675,7 @@ class IMP_Compose } try { - $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], Horde_Nls::getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags))); + $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], $GLOBALS['registry']->getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags))); } catch (Horde_Imap_Client_Exception $e) { $notification->push(sprintf(_("Message sent successfully, but not saved to %s"), IMP::displayFolder($opts['sent_folder']))); $sent_saved = false; @@ -770,7 +770,7 @@ class IMP_Compose try { $error = Horde::callHook('perms_denied', array('imp:max_timelimit')); } catch (Horde_Exception_HookNotSet $e) { - $error = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients within %d hours."), $timelimit, $GLOBALS['conf']['sentmail']['params']['limit_period']), ENT_COMPAT, Horde_Nls::getCharset()); + $error = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients within %d hours."), $timelimit, $GLOBALS['conf']['sentmail']['params']['limit_period']), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } throw new IMP_Compose_Exception($error); } @@ -956,7 +956,7 @@ class IMP_Compose try { $message = Horde::callHook('perms_denied', array('imp:max_recipients')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients."), $max_recipients), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients."), $max_recipients), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } throw new IMP_Compose_Exception($message); } @@ -980,7 +980,7 @@ class IMP_Compose // Convert IDN hosts to ASCII. if (Horde_Util::extensionExists('idn')) { $old_error = error_reporting(0); - $host = idn_to_ascii(Horde_String::convertCharset($host, Horde_Nls::getCharset(), 'UTF-8')); + $host = idn_to_ascii(Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8')); error_reporting($old_error); } elseif (Horde_Mime::is8bit($ob['mailbox'])) { throw new IMP_Compose_Exception(sprintf(_("Invalid character in e-mail address: %s."), $email)); @@ -1017,7 +1017,7 @@ class IMP_Compose protected function _createMimeMessage($to, $body, $charset, $options = array()) { - $nls_charset = Horde_Nls::getCharset(); + $nls_charset = $GLOBALS['registry']->getCharset(); $body = Horde_String::convertCharset($body, $nls_charset, $charset); if (!empty($options['html'])) { @@ -1582,7 +1582,7 @@ class IMP_Compose return array( 'body' => $msg, - 'encoding' => isset($msg_text) ? $msg_text['encoding'] : Horde_Nls::getCharset(), + 'encoding' => isset($msg_text) ? $msg_text['encoding'] : $GLOBALS['registry']->getCharset(), 'format' => $format, 'headers' => $header, 'identity' => $this->_getMatchingIdentity($h), @@ -1629,10 +1629,10 @@ class IMP_Compose $resent_headers->addHeader('Resent-To', $recip['header']['to']); $resent_headers->addHeader('Resent-Message-ID', Horde_Mime::generateMessageId()); - $header_text = trim($resent_headers->toString(array('encode' => Horde_Nls::getCharset()))) . "\n" . trim($contents->getHeaderOb(false)); + $header_text = trim($resent_headers->toString(array('encode' => $GLOBALS['registry']->getCharset()))) . "\n" . trim($contents->getHeaderOb(false)); $to = $this->_prepSendMessage($recipients); - $hdr_array = $headers->toArray(array('charset' => Horde_Nls::getCharset())); + $hdr_array = $headers->toArray(array('charset' => $GLOBALS['registry']->getCharset())); $hdr_array['_raw'] = $header_text; try { @@ -1691,7 +1691,7 @@ class IMP_Compose $headerob = $contents->getHeaderOb(); $part = new Horde_Mime_Part(); - $part->setCharset(Horde_Nls::getCharset()); + $part->setCharset($GLOBALS['registry']->getCharset()); $part->setType('message/rfc822'); $part->setName(_("Forwarded Message")); $part->setContents($contents->fullMessageText(array('stream' => true))); @@ -1806,12 +1806,12 @@ class IMP_Compose if ($part->getPrimaryType() == 'text') { if ($analyzetype = Horde_Mime_Magic::analyzeFile($tempfile, empty($conf['mime']['magic_db']) ? null : $conf['mime']['magic_db'], array('nostrip' => true))) { $analyzetype = Horde_Mime::decodeParam('Content-Type', $analyzetype); - $part->setCharset(isset($analyzetype['params']['charset']) ? $analyzetype['params']['charset'] : Horde_Nls::getCharset()); + $part->setCharset(isset($analyzetype['params']['charset']) ? $analyzetype['params']['charset'] : $GLOBALS['registry']->getCharset()); } else { - $part->setCharset(Horde_Nls::getCharset()); + $part->setCharset($GLOBALS['registry']->getCharset()); } } else { - $part->setHeaderCharset(Horde_Nls::getCharset()); + $part->setHeaderCharset($GLOBALS['registry']->getCharset()); } $part->setName($filename); $part->setBytes($_FILES[$name]['size']); @@ -2156,13 +2156,13 @@ class IMP_Compose '/%r/' => $h->getValue('date'), /* Date as ddd, dd mmm yyyy. */ - '/%d/' => Horde_String::convertCharset(strftime("%a, %d %b %Y", $udate), Horde_Nls::getExternalCharset()), + '/%d/' => Horde_String::convertCharset(strftime("%a, %d %b %Y", $udate), $GLOBALS['registry']->getExternalCharset()), /* Date in locale's default. */ - '/%x/' => Horde_String::convertCharset(strftime("%x", $udate), Horde_Nls::getExternalCharset()), + '/%x/' => Horde_String::convertCharset(strftime("%x", $udate), $GLOBALS['registry']->getExternalCharset()), /* Date and time in locale's default. */ - '/%c/' => Horde_String::convertCharset(strftime("%c", $udate), Horde_Nls::getExternalCharset()), + '/%c/' => Horde_String::convertCharset(strftime("%c", $udate), $GLOBALS['registry']->getExternalCharset()), /* Message-ID. */ '/%m/' => $message_id, @@ -2354,14 +2354,14 @@ class IMP_Compose $fullpath = sprintf('%s/%s/%d', self::VFS_LINK_ATTACH_PATH, $auth, $ts); $charset = $part->getCharset(); - $trailer = Horde_String::convertCharset(_("Attachments"), Horde_Nls::getCharset(), $charset); + $trailer = Horde_String::convertCharset(_("Attachments"), $GLOBALS['registry']->getCharset(), $charset); if ($prefs->getValue('delete_attachments_monthly')) { /* Determine the first day of the month in which the current * attachments will be ripe for deletion, then subtract 1 second * to obtain the last day of the previous month. */ $del_time = mktime(0, 0, 0, date('n') + $prefs->getValue('delete_attachments_monthly_keep') + 1, 1, date('Y')) - 1; - $trailer .= Horde_String::convertCharset(' (' . sprintf(_("Links will expire on %s"), strftime('%x', $del_time)) . ')', Horde_Nls::getCharset(), $charset); + $trailer .= Horde_String::convertCharset(' (' . sprintf(_("Links will expire on %s"), strftime('%x', $del_time)) . ')', $GLOBALS['registry']->getCharset(), $charset); } foreach ($this->getAttachments() as $att) { @@ -2446,7 +2446,7 @@ class IMP_Compose $part = $contents->getMIMEPart($body_id); $type = $part->getType(); $part_charset = $part->getCharset(); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $msg = Horde_String::convertCharset($part->getContents(), $part_charset); /* Enforce reply limits. */ @@ -2491,7 +2491,7 @@ class IMP_Compose } /* Determine default encoding. */ - $encoding = Horde_Nls::getEmailCharset(); + $encoding = $GLOBALS['registry']->getEmailCharset(); if (($charset == 'UTF-8') && (strcasecmp($part_charset, 'US-ASCII') !== 0) && (strcasecmp($part_charset, $encoding) !== 0)) { @@ -2539,7 +2539,7 @@ class IMP_Compose $part = new Horde_Mime_Part(); $part->setType('text/x-vcard'); - $part->setCharset(Horde_Nls::getCharset()); + $part->setCharset($GLOBALS['registry']->getCharset()); $part->setContents($vcard); $part->setName((strlen($name) ? $name : 'vcard') . '.vcf'); $this->_attachVCard = $part; diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 9526ee9d8..b7ded3d0a 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -417,7 +417,7 @@ class IMP_Contents 'text' => $status ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -462,7 +462,7 @@ class IMP_Contents /* If this is a text/* part, AND the browser does not support * UTF-8, give the user a link to open the part in a new window * with the correct character set. */ - $default_charset = Horde_String::upper(Horde_Nls::getCharset()); + $default_charset = Horde_String::upper($GLOBALS['registry']->getCharset()); if ($default_charset !== 'UTF-8') { $charset_upper = Horde_String::upper($mime_part->getCharset()); if (($charset_upper != 'US-ASCII') && @@ -527,7 +527,7 @@ class IMP_Contents $ptext = $pmime->getContents(); $ptext = Horde_String::convertCharset($ptext, $pmime->getCharset()); if ($pmime->getType() == 'text/html') { - $ptext = Horde_Text_Filter::filter($ptext, 'Html2text', array('charset' => Horde_Nls::getCharset())); + $ptext = Horde_Text_Filter::filter($ptext, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset())); } $this->_build = $oldbuild; diff --git a/imp/lib/Crypt/Pgp.php b/imp/lib/Crypt/Pgp.php index 095d024e7..af87e04fb 100644 --- a/imp/lib/Crypt/Pgp.php +++ b/imp/lib/Crypt/Pgp.php @@ -613,7 +613,7 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp */ public function textWindowOutput($name, $msg) { - $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . Horde_Nls::getCharset(), true, strlen($msg)); + $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($msg)); echo $msg; } diff --git a/imp/lib/Crypt/Smime.php b/imp/lib/Crypt/Smime.php index 0e9be8733..64cee41d5 100644 --- a/imp/lib/Crypt/Smime.php +++ b/imp/lib/Crypt/Smime.php @@ -451,7 +451,7 @@ class IMP_Crypt_Smime extends Horde_Crypt_Smime */ public function textWindowOutput($name, $msg, $html = false) { - $GLOBALS['browser']->downloadHeaders($name, $html ? 'text/html' : 'text/plain; charset=' . Horde_Nls::getCharset(), true, strlen($msg)); + $GLOBALS['browser']->downloadHeaders($name, $html ? 'text/html' : 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($msg)); echo $msg; } diff --git a/imp/lib/Folder.php b/imp/lib/Folder.php index d32fb604d..8ae34e87e 100644 --- a/imp/lib/Folder.php +++ b/imp/lib/Folder.php @@ -224,7 +224,7 @@ class IMP_Folder try { $message = Horde::callHook('perms_denied', array('imp:create_folders')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(_("You are not allowed to create folders."), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(_("You are not allowed to create folders."), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); return false; @@ -232,7 +232,7 @@ class IMP_Folder try { $message = Horde::callHook('perms_denied', array('imp:max_folders')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); return false; diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 9b79f4051..1489917fa 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -143,7 +143,7 @@ class IMP $result = $registry->call('contacts/import', array(array('name' => $newName, 'email' => $newAddress), 'array', $prefs->getValue('add_source'))); - $escapeName = @htmlspecialchars($newName, ENT_COMPAT, Horde_Nls::getCharset()); + $escapeName = @htmlspecialchars($newName, ENT_COMPAT, $GLOBALS['registry']->getCharset()); try { if ($contact_link = $registry->link('contacts/show', array('uid' => $result, 'source' => $prefs->getValue('add_source')))) { @@ -221,7 +221,7 @@ class IMP : $mbox['abbrev']; $mbox_list[] = array( - 'l' => Horde_Text_Filter::filter($label, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), + 'l' => Horde_Text_Filter::filter($label, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), 'sel' => (!empty($options['selected']) && ($mbox['val'] === $options['selected'])), 'v' => htmlspecialchars($mbox['val']) ); @@ -238,7 +238,7 @@ class IMP $vfolder_sel = $imp_search->searchMboxID(); foreach ($vfolders as $id => $val) { $vfolder_list[] = array( - 'l' => Horde_Text_Filter::filter($val, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), + 'l' => Horde_Text_Filter::filter($val, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), 'sel' => ($vfolder_sel == $id), 'v' => htmlspecialchars($imp_search->createSearchID($id)) ); @@ -257,7 +257,7 @@ class IMP $tasklist_list = array(); foreach ($tasklists as $id => $tasklist) { $tasklist_list[] = array( - 'l' => Horde_Text_Filter::filter($tasklist->get('name'), 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), + 'l' => Horde_Text_Filter::filter($tasklist->get('name'), 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), 'v' => '\0tasklist_' . $id ); } @@ -276,7 +276,7 @@ class IMP $notepad_list[] = array(); foreach ($notepads as $id => $notepad) { $notepad_list[] = array( - 'l' => Horde_Text_Filter::filter($notepad->get('name'), 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), + 'l' => Horde_Text_Filter::filter($notepad->get('name'), 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), 'v' => '\0notepad_' . $id ); } @@ -494,7 +494,7 @@ class IMP stripos($out, $key) === 0) { $len = strlen($key); if ((strlen($out) == $len) || ($out[$len] == $delimiter)) { - $out = substr_replace($out, Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'UTF7-IMAP'), 0, $len); + $out = substr_replace($out, Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), 0, $len); break; } } diff --git a/imp/lib/Imap/Flags.php b/imp/lib/Imap/Flags.php index 3ec6b4a3a..5386d635c 100644 --- a/imp/lib/Imap/Flags.php +++ b/imp/lib/Imap/Flags.php @@ -181,7 +181,7 @@ class IMP_Imap_Flags /* IMAP keywords must conform to RFC 3501 [9] (flag-keyword). Convert * whitespace to underscore. */ - $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), Horde_Nls::getCharset(), 'UTF7-IMAP')); + $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP')); if (!isset($this->_flags[$key])) { $entry = $this->_createEntry($label); diff --git a/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php b/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php index 229537914..aa66df67f 100644 --- a/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php +++ b/imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php @@ -46,7 +46,7 @@ class IMP_LoginTasks_Task_DeleteSentmailMonthly extends Horde_LoginTasks_Task foreach (array_keys($old_folders) as $k) { foreach ($sent_mail_folders as $folder) { if (preg_match('/^' . str_replace('/', '\/', $folder) . '-([^-]+)-([0-9]{4})$/i', $k, $regs)) { - $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), Horde_Nls::getCharset(), 'UTF7-IMAP'); + $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'); } } } diff --git a/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php b/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php index 0329aa9a4..cec5e4bd1 100644 --- a/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php +++ b/imp/lib/LoginTasks/Task/RenameSentmailMonthly.php @@ -101,7 +101,7 @@ class IMP_LoginTasks_Task_RenameSentmailMonthly extends Horde_LoginTasks_Task $text = (substr($GLOBALS['language'], 0, 2) == 'en') ? strtolower(strftime('-%b-%Y', $last_maintenance)) : strftime('-%m-%Y', $last_maintenance); - return $folder . Horde_String::convertCharset($text, Horde_Nls::getExternalCharset(), 'UTF7-IMAP'); + return $folder . Horde_String::convertCharset($text, $GLOBALS['registry']->getExternalCharset(), 'UTF7-IMAP'); } } diff --git a/imp/lib/Message.php b/imp/lib/Message.php index 56b698d89..5241763bb 100644 --- a/imp/lib/Message.php +++ b/imp/lib/Message.php @@ -337,7 +337,7 @@ class IMP_Message /* TODO: When Horde_iCalendar supports setting of charsets * we need to set it there instead of relying on the fact * that both Nag and IMP use the same charset. */ - $body = Horde_String::convertCharset($body, $body_part->getCharset(), Horde_Nls::getCharset()); + $body = Horde_String::convertCharset($body, $body_part->getCharset(), $GLOBALS['registry']->getCharset()); /* Create a new iCalendar. */ $vCal = new Horde_iCalendar(); @@ -499,7 +499,7 @@ class IMP_Message /* Need to make sure all text is in the correct charset. */ $part_name = $part->getName(true); - $newPart->setCharset(Horde_Nls::getCharset()); + $newPart->setCharset($GLOBALS['registry']->getCharset()); $newPart->setContents(sprintf(_("[Attachment stripped: Original attachment type: %s, name: %s]"), $part->getType(), $part_name ? $part_name : _("unnamed"))); $parts[] = array( diff --git a/imp/lib/Mime/Viewer/Alternative.php b/imp/lib/Mime/Viewer/Alternative.php index d1a628a62..2f9276b06 100644 --- a/imp/lib/Mime/Viewer/Alternative.php +++ b/imp/lib/Mime/Viewer/Alternative.php @@ -107,7 +107,7 @@ class IMP_Horde_Mime_Viewer_Alternative extends Horde_Mime_Viewer_Driver 'type' => 'info' ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ); return $ret; } diff --git a/imp/lib/Mime/Viewer/Appledouble.php b/imp/lib/Mime/Viewer/Appledouble.php index ec065eabf..6d6e8b715 100644 --- a/imp/lib/Mime/Viewer/Appledouble.php +++ b/imp/lib/Mime/Viewer/Appledouble.php @@ -108,7 +108,7 @@ class IMP_Horde_Mime_Viewer_Appledouble extends Horde_Mime_Viewer_Driver ? array( 'data' => '', 'status' => array($status), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset(), + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(), 'wrap' => 'mimePartWrap' ) : null; diff --git a/imp/lib/Mime/Viewer/Html.php b/imp/lib/Mime/Viewer/Html.php index 19951946b..3aae5d3e8 100644 --- a/imp/lib/Mime/Viewer/Html.php +++ b/imp/lib/Mime/Viewer/Html.php @@ -118,7 +118,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html ) ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -166,7 +166,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html ) ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -193,13 +193,13 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html * text. */ if (($_SESSION['imp']['view'] == 'mimp') || (!$inline && Horde_Util::getFormData('convert_text'))) { - $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false)); + $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset(), 'wrap' => false)); // Filter bad language. return array( 'data' => IMP::filterText($data), 'status' => array(), - 'type' => 'text/plain; charset=' . Horde_Nls::getCharset() + 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset() ); } @@ -306,7 +306,7 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html */ protected function _mailtoCallback($m) { - return 'href="' . $GLOBALS['registry']->call('mail/compose', array(Horde_String::convertCharset(html_entity_decode($m[2]), 'ISO-8859-1', Horde_Nls::getCharset()))) . '"'; + return 'href="' . $GLOBALS['registry']->call('mail/compose', array(Horde_String::convertCharset(html_entity_decode($m[2]), 'ISO-8859-1', $GLOBALS['registry']->getCharset()))) . '"'; } /** diff --git a/imp/lib/Mime/Viewer/Images.php b/imp/lib/Mime/Viewer/Images.php index 105426f0c..cc4e23eab 100644 --- a/imp/lib/Mime/Viewer/Images.php +++ b/imp/lib/Mime/Viewer/Images.php @@ -93,7 +93,7 @@ class IMP_Horde_Mime_Viewer_Images extends Horde_Mime_Viewer_Images $this->_mimepart->getMimeId() => array( 'data' => $this->_outputImgTag('data', $this->_mimepart->getName(true)), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } else { @@ -123,7 +123,7 @@ class IMP_Horde_Mime_Viewer_Images extends Horde_Mime_Viewer_Images 'text' => $status ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -161,7 +161,7 @@ class IMP_Horde_Mime_Viewer_Images extends Horde_Mime_Viewer_Images 'text' => $status ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -202,7 +202,7 @@ EOD; $this->_mimepart->getMimeId() => array( 'data' => $str, 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -293,7 +293,7 @@ EOD; */ protected function _outputImgTag($type, $alt) { - return '' . htmlspecialchars($alt, ENT_COMPAT, Horde_Nls::getCharset()) . ''; + return '' . htmlspecialchars($alt, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; } } diff --git a/imp/lib/Mime/Viewer/Itip.php b/imp/lib/Mime/Viewer/Itip.php index 376e49eb5..01a76aade 100644 --- a/imp/lib/Mime/Viewer/Itip.php +++ b/imp/lib/Mime/Viewer/Itip.php @@ -75,7 +75,7 @@ class IMP_Horde_Mime_Viewer_Itip extends Horde_Mime_Viewer_Driver { global $registry; - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $data = $this->_mimepart->getContents(); $mime_id = $this->_mimepart->getMimeId(); @@ -485,7 +485,7 @@ class IMP_Horde_Mime_Viewer_Itip extends Horde_Mime_Viewer_Driver } return array( $mime_id => array( - 'data' => Horde_String::convertCharset(Horde::escapeJson(Horde::prepareResponse(null, true), array('charset' => Horde_Nls::getCharset())), Horde_Nls::getCharset(), 'UTF-8'), + 'data' => Horde_String::convertCharset(Horde::escapeJson(Horde::prepareResponse(null, true), array('charset' => $GLOBALS['registry']->getCharset())), $GLOBALS['registry']->getCharset(), 'UTF-8'), 'status' => array(), 'name' => null, 'type' => 'application/json' diff --git a/imp/lib/Mime/Viewer/Mdn.php b/imp/lib/Mime/Viewer/Mdn.php index 50ca27bb0..b8ea59a46 100644 --- a/imp/lib/Mime/Viewer/Mdn.php +++ b/imp/lib/Mime/Viewer/Mdn.php @@ -109,7 +109,7 @@ class IMP_Horde_Mime_Viewer_Mdn extends Horde_Mime_Viewer_Driver $ret[$mdn_id] = array( 'data' => $data, 'status' => $status, - 'type' => 'text/html; charset=' . Horde_Nls::getCharset(), + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(), 'wrap' => 'mimePartWrap' ); diff --git a/imp/lib/Mime/Viewer/Partial.php b/imp/lib/Mime/Viewer/Partial.php index 8f6929cff..013eb6e31 100644 --- a/imp/lib/Mime/Viewer/Partial.php +++ b/imp/lib/Mime/Viewer/Partial.php @@ -59,7 +59,7 @@ class IMP_Horde_Mime_Viewer_Partial extends Horde_Mime_Viewer_Driver $id => array( 'data' => null, 'status' => array(self::$_statuscache[$id]), - 'type' => 'text/plain; charset=' . Horde_Nls::getCharset() + 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset() ) ); } else { diff --git a/imp/lib/Mime/Viewer/Pdf.php b/imp/lib/Mime/Viewer/Pdf.php index 94cd4a443..2ab3c7b27 100644 --- a/imp/lib/Mime/Viewer/Pdf.php +++ b/imp/lib/Mime/Viewer/Pdf.php @@ -95,7 +95,7 @@ class IMP_Horde_Mime_Viewer_Pdf extends Horde_Mime_Viewer_Pdf 'text' => $status ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -144,7 +144,7 @@ class IMP_Horde_Mime_Viewer_Pdf extends Horde_Mime_Viewer_Pdf */ protected function _outputImgTag() { - return '' . htmlspecialchars(_('; + return '' . htmlspecialchars(_(getCharset()) . '" />'; } } diff --git a/imp/lib/Mime/Viewer/Pgp.php b/imp/lib/Mime/Viewer/Pgp.php index 0244dee9f..cc7ce44b8 100644 --- a/imp/lib/Mime/Viewer/Pgp.php +++ b/imp/lib/Mime/Viewer/Pgp.php @@ -77,7 +77,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver $id => array( 'data' => '', 'status' => array(), - 'type' => 'text/plain; charset=' . Horde_Nls::getCharset() + 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset() ) ); @@ -130,7 +130,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver $id => array( 'data' => null, 'status' => self::$_cache[$id]['status'], - 'type' => 'text/plain; charset=' . Horde_Nls::getCharset(), + 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), 'wrap' => self::$_cache[$id]['wrap'] ) ), self::$_cache[$id]['other']); @@ -313,7 +313,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver $mime_id => array( 'data' => $data, 'status' => array($status), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } @@ -339,7 +339,7 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver 'text' => array() ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset(), + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(), 'wrap' => 'mimePartWrap' ), $sig_id => null diff --git a/imp/lib/Mime/Viewer/Plain.php b/imp/lib/Mime/Viewer/Plain.php index 87501b0b7..994c3cfc4 100644 --- a/imp/lib/Mime/Viewer/Plain.php +++ b/imp/lib/Mime/Viewer/Plain.php @@ -79,7 +79,7 @@ class IMP_Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain // Convert to the local charset. if ($inline) { $text = Horde_String::convertCharset($text, $charset); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); } $type = 'text/html; charset=' . $charset; @@ -317,7 +317,7 @@ class IMP_Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain $text_part = new Horde_Mime_Part(); $text_part->setType('text/plain'); - $text_part->setCharset(Horde_Nls::getCharset()); + $text_part->setCharset($GLOBALS['registry']->getCharset()); $text_part->setContents(preg_replace("/begin [0-7]{3} .+\r?\n.+\r?\nend/Us", "\n", $text)); $new_part->addPart($text_part); @@ -347,7 +347,7 @@ class IMP_Horde_Mime_Viewer_Plain extends Horde_Mime_Viewer_Plain // Escape text $filters = array( 'text2html' => array( - 'charset' => Horde_Nls::getCharset(), + 'charset' => $GLOBALS['registry']->getCharset(), 'parselevel' => Horde_Text_Filter_Text2html::MICRO ), 'tabs2spaces' => array(), diff --git a/imp/lib/Mime/Viewer/Smime.php b/imp/lib/Mime/Viewer/Smime.php index 71e03e557..ac1747431 100644 --- a/imp/lib/Mime/Viewer/Smime.php +++ b/imp/lib/Mime/Viewer/Smime.php @@ -118,7 +118,7 @@ class IMP_Horde_Mime_Viewer_Smime extends Horde_Mime_Viewer_Driver $id => array( 'data' => null, 'status' => self::$_cache[$id]['status'], - 'type' => 'text/plain; charset=' . Horde_Nls::getCharset(), + 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), 'wrap' => self::$_cache[$id]['wrap'] ) ); @@ -363,7 +363,7 @@ class IMP_Horde_Mime_Viewer_Smime extends Horde_Mime_Viewer_Driver $this->_mimepart->getMimeId() => array( 'data' => $this->_impsmime->certToHTML($sig_result->cert), 'status' => array(), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/imp/lib/Mime/Viewer/Status.php b/imp/lib/Mime/Viewer/Status.php index 1958d689a..9483f5b91 100644 --- a/imp/lib/Mime/Viewer/Status.php +++ b/imp/lib/Mime/Viewer/Status.php @@ -152,7 +152,7 @@ class IMP_Horde_Mime_Viewer_Status extends Horde_Mime_Viewer_Driver $ret[$this->_mimepart->getMimeId()] = array( 'data' => $data, 'status' => $status, - 'type' => 'text/html; charset=' . Horde_Nls::getCharset(), + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(), 'wrap' => 'mimePartWrap' ); diff --git a/imp/lib/Mime/Viewer/Tnef.php b/imp/lib/Mime/Viewer/Tnef.php index 58dd32bc3..1a490366f 100644 --- a/imp/lib/Mime/Viewer/Tnef.php +++ b/imp/lib/Mime/Viewer/Tnef.php @@ -132,7 +132,7 @@ class IMP_Horde_Mime_Viewer_Tnef extends Horde_Mime_Viewer_Tnef 'text' => array(_("The following files were attached to this part:")) ) ), - 'type' => 'text/html; charset=' . Horde_Nls::getCharset() + 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset() ) ); } diff --git a/imp/lib/Prefs/Ui.php b/imp/lib/Prefs/Ui.php index f7ff0121b..8a0797458 100644 --- a/imp/lib/Prefs/Ui.php +++ b/imp/lib/Prefs/Ui.php @@ -105,7 +105,7 @@ class IMP_Prefs_Ui case 'display': /* Set the timezone on this page so the 'time_format' output uses * the configured time zone's time, not the system's time zone. */ - Horde_Nls::setTimeZone(); + $registry->setTimeZone(); if ($pop3) { $ui->suppress[] = 'nav_expanded'; $ui->suppress[] = 'tree_view'; @@ -224,7 +224,7 @@ class IMP_Prefs_Ui if (!empty($code)) { Horde::addScriptFile('folderprefs.js', 'imp'); Horde::addInlineScript(array( - 'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); } break; @@ -540,7 +540,7 @@ class IMP_Prefs_Ui $ui->nobuttons = true; Horde::addInlineScript(array( - 'ImpAccountsPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this account?"), Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'ImpAccountsPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this account?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); @@ -864,8 +864,8 @@ class IMP_Prefs_Ui protected function _flagManagement() { Horde::addInlineScript(array( - 'ImpFlagPrefs.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, Horde_Nls::getCharset()), - 'ImpFlagPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'ImpFlagPrefs.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), + 'ImpFlagPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); $msgflags_locked = $GLOBALS['prefs']->isLocked('msgflags'); @@ -1189,8 +1189,8 @@ class IMP_Prefs_Ui Horde::addInlineScript(array( 'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize(array( 'sent_mail_folder' => _("Create a new sent-mail folder") - ), Horde_Serialize::JSON, Horde_Nls::getCharset()), - 'ImpFolderPrefs.sentmail = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset()) + ), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), + 'ImpFolderPrefs.sentmail = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); @@ -1223,7 +1223,7 @@ class IMP_Prefs_Ui $sent_mail_folder = $ui->vars->sent_mail_folder; if (empty($sent_mail_folder)) { - $sent_mail_new = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace(Horde_String::convertCharset($ui->vars->sent_mail_folder_new, Horde_Nls::getCharset(), 'UTF7-IMAP')); + $sent_mail_new = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace(Horde_String::convertCharset($ui->vars->sent_mail_folder_new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP')); } elseif (($sent_mail_folder == '-1') && ($sm_default = $prefs->getDefault('sent_mail_folder'))) { $sent_mail_folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($sm_default); @@ -1392,7 +1392,7 @@ class IMP_Prefs_Ui }; Horde::addInlineScript(array( - 'ImpHtmlSignaturePrefs.sigs = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'ImpHtmlSignaturePrefs.sigs = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); $t = $GLOBALS['injector']->createInstance('Horde_Template'); @@ -1558,7 +1558,7 @@ class IMP_Prefs_Ui } if ($updated) { - $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset(array_values($ob->stationery_list), Horde_Nls::getCharset(), $GLOBALS['prefs']->getCharset())), false); + $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset(array_values($ob->stationery_list), $GLOBALS['registry']->getCharset(), $GLOBALS['prefs']->getCharset())), false); $GLOBALS['notification']->push($updated, 'horde.success'); } } @@ -1595,7 +1595,7 @@ class IMP_Prefs_Ui if ($ui->vars->last_type != $type) { $content = ($type == 'plain') - ? Horde_Text_Filter::filter($content, 'Html2text', array('charset' => Horde_Nls::getCharset())) + ? Horde_Text_Filter::filter($content, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset())) : nl2br(htmlspecialchars(htmlspecialchars($content))); } @@ -1688,7 +1688,7 @@ class IMP_Prefs_Ui return false; } - $new = Horde_String::convertCharset($new, Horde_Nls::getCharset(), 'UTF7-IMAP'); + $new = Horde_String::convertCharset($new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'); if ($folder == IMP::PREF_NO_FOLDER) { $prefs->setValue($pref, ''); diff --git a/imp/lib/Spam.php b/imp/lib/Spam.php index cef418a97..b9ad898dd 100644 --- a/imp/lib/Spam.php +++ b/imp/lib/Spam.php @@ -140,7 +140,7 @@ class IMP_Spam /* Send the message. */ try { - $imp_compose->sendMessage($to, $spam_headers, $mime, Horde_Nls::getCharset()); + $imp_compose->sendMessage($to, $spam_headers, $mime, $GLOBALS['registry']->getCharset()); $report_flag = true; } catch (IMP_Compose_Exception $e) { Horde::logMessage($e, 'ERR'); diff --git a/imp/lib/Ui/Compose.php b/imp/lib/Ui/Compose.php index 79d15a447..5a81fb0f6 100644 --- a/imp/lib/Ui/Compose.php +++ b/imp/lib/Ui/Compose.php @@ -354,7 +354,7 @@ class IMP_Ui_Compose } } - $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false)); + $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset(), 'wrap' => false)); $sig = $txt_sig; break; } diff --git a/imp/lib/Ui/Mailbox.php b/imp/lib/Ui/Mailbox.php index 2b98bfcdf..4a8edf22d 100644 --- a/imp/lib/Ui/Mailbox.php +++ b/imp/lib/Ui/Mailbox.php @@ -252,7 +252,7 @@ class IMP_Ui_Mailbox $new_subject = $subject = IMP::filterText(preg_replace("/\s+/", ' ', $subject)); if ($htmlspaces) { - $new_subject = Horde_Text_Filter::filter($subject, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)); + $new_subject = Horde_Text_Filter::filter($subject, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)); if (empty($new_subject)) { $new_subject = htmlspecialchars($subject); } diff --git a/imp/lib/Views/ListMessages.php b/imp/lib/Views/ListMessages.php index 8313e5d99..295f1fedb 100644 --- a/imp/lib/Views/ListMessages.php +++ b/imp/lib/Views/ListMessages.php @@ -77,7 +77,7 @@ class IMP_Views_ListMessages } /* Set the current time zone. */ - Horde_Nls::setTimeZone(); + $GLOBALS['registry']->setTimeZone(); /* Run filters now. */ if (!$is_search && @@ -367,7 +367,7 @@ class IMP_Views_ListMessages /* Get mailbox information. */ $overview = $imp_mailbox->getMailboxArray($msglist, array('headers' => true, 'structure' => $GLOBALS['prefs']->getValue('atc_flag'))); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $imp_ui = new IMP_Ui_Mailbox($folder); $no_flags_hook = false; diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index 89fbc86ca..cb2655c80 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -104,7 +104,7 @@ class IMP_Views_ShowMessage ); /* Set the current time zone. */ - Horde_Nls::setTimeZone(); + $GLOBALS['registry']->setTimeZone(); /* Get envelope/header information. We don't use flags in this * view. */ diff --git a/imp/mailbox-mimp.php b/imp/mailbox-mimp.php index f84db2694..bcafdc372 100644 --- a/imp/mailbox-mimp.php +++ b/imp/mailbox-mimp.php @@ -23,9 +23,10 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -Horde_Registry::appInit('imp', array('impmode' => 'mimp')); - -Horde_Nls::setTimeZone(); +Horde_Registry::appInit('imp', array( + 'impmode' => 'mimp', + 'timezone' => true +)); $imp_search = $injector->getInstance('IMP_Search'); $imp_ui_mimp = $injector->getInstance('IMP_Ui_Mimp'); diff --git a/imp/mailbox.php b/imp/mailbox.php index 8dfafeee0..cdc4336c9 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -36,7 +36,7 @@ function _outputSummaries($msgs) require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('imp'); -Horde_Nls::setTimeZone(); +$registry->setTimeZone(); /* Call the mailbox redirection hook, if requested. */ try { @@ -241,7 +241,7 @@ if ($readonly) { /* Generate paging links. */ if ($pageOb['pagecount']) { - $rtl = !empty(Horde_Nls::$config['rtl'][$language]); + $rtl = !empty($registry->nlsconfig['rtl'][$language]); if ($pageOb['page'] == 1) { $pages_first = Horde::img($rtl ? 'nav/last-grey.png' : 'nav/first-grey.png'); $pages_prev = Horde::img($rtl ? 'nav/right-grey.png' : 'nav/left-grey.png'); @@ -767,7 +767,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { } /* Format the From: Header. */ - $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => Horde_Nls::getCharset())); + $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => $registry->getCharset())); $msg['from'] = $getfrom['from']; $msg['fullfrom'] = $getfrom['fullfrom']; switch ($fromlinkstyle) { diff --git a/imp/message-mimp.php b/imp/message-mimp.php index 4c1e59ae2..a702cedf5 100644 --- a/imp/message-mimp.php +++ b/imp/message-mimp.php @@ -21,13 +21,15 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -Horde_Registry::appInit('imp', array('impmode' => 'mimp')); +Horde_Registry::appInit('imp', array( + 'impmode' => 'mimp', + 'timezone' => true +)); -Horde_Nls::setTimeZone(); $vars = Horde_Variables::getDefaultVariables(); /* Make sure we have a valid index. */ -$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid)); +$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid)); if (!$imp_mailbox->isValidIndex(false)) { header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->setRaw(true)->add('a', 'm')); exit; @@ -256,7 +258,7 @@ if ($prefs->getValue('mimp_preview_msg') && $t->set('fullmsg_link', $self_link->copy()->add('fullmsg', 1)); } -$t->set('msg', nl2br(Horde_Text_Filter::filter($msg_text, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)))); +$t->set('msg', nl2br(Horde_Text_Filter::filter($msg_text, 'space2html', array('charset' => $registry->getCharset(), 'encode' => true)))); $compose_params = array( 'identity' => $identity, diff --git a/imp/message.php b/imp/message.php index 2620360f7..c783f811f 100644 --- a/imp/message.php +++ b/imp/message.php @@ -24,7 +24,7 @@ function _returnToMailbox($startIndex = null, $actID = null) require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('imp'); -Horde_Nls::setTimeZone(); +$registry->setTimeZone(); /* We know we are going to be exclusively dealing with this mailbox, so * select it on the IMAP server (saves some STATUS calls). Open R/W to clear @@ -34,7 +34,7 @@ if (!($search_mbox = $injector->getInstance('IMP_Search')->isSearchMbox(IMP::$ma } /* Make sure we have a valid index. */ -$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid)); +$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid)); if (!$imp_mailbox->isValidIndex(false)) { _returnToMailbox(null, 'message_missing'); require IMP_BASE . '/mailbox.php'; @@ -249,14 +249,14 @@ if ($origin_host) { $origin_host = array($origin_host); } foreach ($origin_host as $host) { - $from_img .= Horde_Nls::generateFlagImageByHost($host, $injector->getInstance('Net_DNS_Resolver')) . ' '; + $from_img .= Horde_Ui_FlagImage::generateFlagImageByHost($host) . ' '; } trim($from_img); } if (empty($from_img) && !empty($envelope['from'])) { $from_ob = reset($envelope['from']); - $from_img .= Horde_Nls::generateFlagImageByHost($from_ob['host'], $injector->getInstance('Net_DNS_Resolver')) . ' '; + $from_img .= Horde_Ui_FlagImage::generateFlagImageByHost($from_ob['host']) . ' '; } if (!empty($from_img)) { @@ -443,7 +443,7 @@ if (!$use_pop) { $n_template->set('back_to', Horde::widget($mailbox_url, sprintf(_("Back to %s"), $h_page_label), 'widget', '', '', sprintf(_("Bac_k to %s"), $h_page_label), true)); -$rtl = !empty(Horde_Nls::$config['rtl'][$language]); +$rtl = !empty($registry->nlsconfig['rtl'][$language]); if (Horde_Util::nonInputVar('prev_url')) { $n_template->set('prev', Horde::link($prev_url, _("Previous Message"))); $n_template->set('prev_img', Horde::img($rtl ? 'nav/right.png' : 'nav/left.png', $rtl ? '>' : '<')); diff --git a/imp/rss.php b/imp/rss.php index eb1b2286f..1f2b68b95 100644 --- a/imp/rss.php +++ b/imp/rss.php @@ -84,7 +84,7 @@ $description = ($total_num == 0) : sprintf(_("%u of %u messages in %s unread."), $unseen_num, $total_num, IMP::getLabel($mailbox)); $t = $injector->createInstance('Horde_Template'); -$t->set('charset', Horde_Nls::getCharset()); +$t->set('charset', $registry->getCharset()); $t->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl'); $t->set('pubDate', htmlspecialchars(date('r'))); $t->set('desc', htmlspecialchars($description)); diff --git a/imp/search-basic.php b/imp/search-basic.php index 7b2fae8c9..768a3c612 100644 --- a/imp/search-basic.php +++ b/imp/search-basic.php @@ -26,7 +26,7 @@ if ($_SESSION['imp']['protocol'] == 'pop') { exit; } -$imp_search = $GLOBALS['injector']->getInstance('IMP_Search'); +$imp_search = $injector->getInstance('IMP_Search'); /* If search_basic_mbox is set, we are processing the search query. */ $search_mailbox = Horde_Util::getFormData('search_basic_mbox'); diff --git a/imp/search.php b/imp/search.php index aa69f8a05..69e747cd0 100644 --- a/imp/search.php +++ b/imp/search.php @@ -41,9 +41,9 @@ if (!$browser->hasFeature('javascript') || exit; } -$imp_search = $GLOBALS['injector']->getInstance('IMP_Search'); +$imp_search = $injector->getInstance('IMP_Search'); -$charset = Horde_Nls::getCharset(); +$charset = $registry->getCharset(); $criteria = Horde_Util::getFormData('criteria_form'); $dimp_view = ($_SESSION['imp']['view'] == 'dimp'); $search_fields = $imp_search->searchFields(); diff --git a/imp/templates/common-header.inc b/imp/templates/common-header.inc index 72b9aa560..99112bd16 100644 --- a/imp/templates/common-header.inc +++ b/imp/templates/common-header.inc @@ -19,7 +19,7 @@ default: } if (isset($GLOBALS['language'])) { - header('Content-type: text/html; charset=' . Horde_Nls::getCharset()); + header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/imp/templates/dimp/javascript_defs_dimp.php b/imp/templates/dimp/javascript_defs_dimp.php index b2c0c74b1..f3f6398fb 100644 --- a/imp/templates/dimp/javascript_defs_dimp.php +++ b/imp/templates/dimp/javascript_defs_dimp.php @@ -211,5 +211,5 @@ if (in_array(basename($_SERVER['PHP_SELF']), array('compose-dimp.php', 'message- } Horde::addInlineScript(array( - 'var DIMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'var DIMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) ), null, true); diff --git a/imp/templates/imp/javascript_defs.php b/imp/templates/imp/javascript_defs.php index 6b26710c4..de5030c32 100644 --- a/imp/templates/imp/javascript_defs.php +++ b/imp/templates/imp/javascript_defs.php @@ -71,5 +71,5 @@ $code = array( ); Horde::addInlineScript(array( - 'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) ), null, true); diff --git a/imp/thread.php b/imp/thread.php index b87ab4462..2dc2736c8 100644 --- a/imp/thread.php +++ b/imp/thread.php @@ -14,15 +14,18 @@ */ require_once dirname(__FILE__) . '/lib/Application.php'; -Horde_Registry::appInit('imp'); - -Horde_Nls::setTimeZone(); +Horde_Registry::appInit('imp', array( + 'timezone' => true +)); /* What mode are we in? * DEFAULT/'thread' - Thread mode * 'msgview' - Multiple message view */ -$mode = Horde_Util::getFormData('mode', 'thread'); +$vars = Horde_Variables::getDefaultVariables(); +$mode = $vars->mode + ? $vars->mode + : 'thread'; $imp_imap = $injector->getInstance('IMP_Imap')->getOb(); $imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid)); @@ -35,7 +38,7 @@ if ($mode == 'thread') { } } else { /* MSGVIEW MODE: Make sure we have a valid list of messages. */ - $imp_indices = new IMP_Indices(Horde_Util::getFormData('msglist')); + $imp_indices = new IMP_Indices($vars->msglist); if (!$imp_indices->count()) { $error = true; } @@ -50,11 +53,11 @@ if ($error) { } /* Run through action handlers. */ -$actionID = Horde_Util::getFormData('actionID'); +$actionID = $vars->actionID; switch ($actionID) { case 'add_address': try { - $contact_link = IMP::addAddress(Horde_Util::getFormData('address'), Horde_Util::getFormData('name')); + $contact_link = IMP::addAddress($vars->address, $vars->name); $notification->push(sprintf(_("Entry \"%s\" was successfully added to the address book"), $contact_link), 'horde.success', array('content.raw')); } catch (Horde_Exception $e) { $notification->push($e); @@ -78,7 +81,7 @@ if ($mode == 'thread') { $imp_indices = new IMP_Indices(IMP::$mailbox, $thread); } -$charset = Horde_Nls::getCharset(); +$charset = $registry->getCharset(); $imp_ui = new IMP_Ui_Message(); foreach ($imp_indices->indices() as $mbox => $idxlist) { diff --git a/imp/view.php b/imp/view.php index bb5314a1d..bf5b7b467 100644 --- a/imp/view.php +++ b/imp/view.php @@ -41,7 +41,7 @@ function _sanitizeName($name) { - return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, Horde_Nls::getCharset(), 'UTF-8')), ' _'), 'UTF-8'); + return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF-8')), ' _'), 'UTF-8'); } require_once dirname(__FILE__) . '/lib/Application.php'; diff --git a/ingo/filters.php b/ingo/filters.php index 183a4e8fa..685dde6ec 100644 --- a/ingo/filters.php +++ b/ingo/filters.php @@ -64,7 +64,7 @@ case 'rule_enable': try { $message = Horde::callHook('perms_denied', array('ingo:allow_rules')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); break 2; @@ -73,7 +73,7 @@ case 'rule_enable': try { $message = Horde::callHook('perms_denied', array('ingo:max_rules')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); break 2; @@ -215,7 +215,7 @@ if (count($filter_list) == 0) { /* Create description. */ if (!$edit_allowed) { - $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset()); + $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()); } elseif (!empty($filter['conditions'])) { $descrip = ''; $condition_size = count($filter['conditions']) - 1; @@ -244,9 +244,9 @@ if (count($filter_list) == 0) { $descrip .= "\n[stop]"; } - $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $descrip) . @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset()) . ''; + $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $descrip) . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; } else { - $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset()) . ''; + $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; } /* Create edit link. */ diff --git a/ingo/lib/Ingo.php b/ingo/lib/Ingo.php index 6fbab1679..cf7258b57 100644 --- a/ingo/lib/Ingo.php +++ b/ingo/lib/Ingo.php @@ -139,7 +139,7 @@ class Ingo $label = $mbox['abbrev']; $text .= sprintf('%s%s', $disabled, $val, $sel, - Horde_Text_Filter::filter($label, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), "\n"); + Horde_Text_Filter::filter($label, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), "\n"); } return $text . ''; @@ -160,7 +160,7 @@ class Ingo static public function createFolder($folder) { return $GLOBALS['registry']->hasMethod('mail/createFolder') - ? $GLOBALS['registry']->call('mail/createFolder', array('folder' => Horde_String::convertCharset($folder, Horde_Nls::getCharset(), 'UTF7-IMAP'))) + ? $GLOBALS['registry']->call('mail/createFolder', array('folder' => Horde_String::convertCharset($folder, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'))) : false; } @@ -508,7 +508,7 @@ class Ingo if ($GLOBALS['registry']->hasMethod('mail/createFolder')) { Horde::addScriptFile('new_folder.js', 'ingo'); Horde::addInlineScript(array( - 'IngoNewFolder.folderprompt = ' . Horde_Serialize::serialize(_("Please enter the name of the new folder:"), Horde_Serialize::JSON, Horde_Nls::getCharset()) + 'IngoNewFolder.folderprompt = ' . Horde_Serialize::serialize(_("Please enter the name of the new folder:"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); } } diff --git a/ingo/lib/Script.php b/ingo/lib/Script.php index b64b2c1d6..ce10adab7 100644 --- a/ingo/lib/Script.php +++ b/ingo/lib/Script.php @@ -127,7 +127,7 @@ class Ingo_Script $params['spam_char'] = $GLOBALS['conf']['spam']['char']; } if (!isset($params['charset'])) { - $params['charset'] = Horde_Nls::getCharset(); + $params['charset'] = $GLOBALS['registry']->getCharset(); } if ($script == 'Sieve') { if (!isset($params['date_format'])) { diff --git a/ingo/lib/Storage/Filters/Sql.php b/ingo/lib/Storage/Filters/Sql.php index 75ad33775..0270a0a1a 100644 --- a/ingo/lib/Storage/Filters/Sql.php +++ b/ingo/lib/Storage/Filters/Sql.php @@ -123,11 +123,11 @@ class Ingo_Storage_Filters_Sql extends Ingo_Storage_Filters { */ protected function _ruleToBackend($rule) { - return array(Horde_String::convertCharset($rule['name'], Horde_Nls::getCharset(), $this->_params['charset']), + return array(Horde_String::convertCharset($rule['name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$rule['action'], - isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], Horde_Nls::getCharset(), $this->_params['charset']) : null, + isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null, isset($rule['flags']) ? (int)$rule['flags'] : null, - isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], Horde_Nls::getCharset(), $this->_params['charset'])) : null, + isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], $GLOBALS['registry']->getCharset(), $this->_params['charset'])) : null, isset($rule['combine']) ? (int)$rule['combine'] : null, isset($rule['stop']) ? (int)$rule['stop'] : null, isset($rule['disable']) ? (int)(!$rule['disable']) : 1); diff --git a/ingo/lib/Storage/Prefs.php b/ingo/lib/Storage/Prefs.php index 6a03166dd..42fcbfc59 100644 --- a/ingo/lib/Storage/Prefs.php +++ b/ingo/lib/Storage/Prefs.php @@ -64,7 +64,7 @@ class Ingo_Storage_Prefs extends Ingo_Storage /* Convert rules from the old format. */ $data = @unserialize($prefs->getValue('rules')); } else { - $data = Horde_String::convertCharset($data, $prefs->getCharset(), Horde_Nls::getCharset()); + $data = Horde_String::convertCharset($data, $prefs->getCharset(), $GLOBALS['registry']->getCharset()); } if ($data) { $ob->setFilterlist($data); @@ -87,7 +87,7 @@ class Ingo_Storage_Prefs extends Ingo_Storage /* Convert vacation from the old format. */ $data = unserialize($prefs->getValue('vacation')); } elseif (is_array($data)) { - $data = $prefs->convertFromDriver($data, Horde_Nls::getCharset()); + $data = $prefs->convertFromDriver($data, $GLOBALS['registry']->getCharset()); } if ($data) { $ob->setVacationAddresses($data['addresses'], false); @@ -145,7 +145,7 @@ class Ingo_Storage_Prefs extends Ingo_Storage return $prefs->setValue('blacklist', serialize($data)); case self::ACTION_FILTERS: - return $prefs->setValue('rules', serialize(Horde_String::convertCharset($ob->getFilterList(), Horde_Nls::getCharset(), $prefs->getCharset())), false); + return $prefs->setValue('rules', serialize(Horde_String::convertCharset($ob->getFilterList(), $GLOBALS['registry']->getCharset(), $prefs->getCharset())), false); case self::ACTION_FORWARD: $data = array( @@ -165,7 +165,7 @@ class Ingo_Storage_Prefs extends Ingo_Storage 'start' => $ob->getVacationStart(), 'end' => $ob->getVacationEnd(), ); - return $prefs->setValue('vacation', serialize($prefs->convertToDriver($data, Horde_Nls::getCharset())), false); + return $prefs->setValue('vacation', serialize($prefs->convertToDriver($data, $GLOBALS['registry']->getCharset())), false); case self::ACTION_WHITELIST: return $prefs->setValue('whitelist', serialize($ob->getWhitelist())); diff --git a/ingo/lib/Storage/Sql.php b/ingo/lib/Storage/Sql.php index b3e69de73..5284f7c87 100644 --- a/ingo/lib/Storage/Sql.php +++ b/ingo/lib/Storage/Sql.php @@ -334,10 +334,10 @@ class Ingo_Storage_Sql extends Ingo_Storage $values = array( implode("\n", $ob->getVacationAddresses()), Horde_String::convertCharset($ob->getVacationSubject(), - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), $this->_params['charset']), Horde_String::convertCharset($ob->getVacationReason(), - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$ob->getVacationDays(), (int)$ob->getVacationStart(), diff --git a/ingo/rule.php b/ingo/rule.php index 96f409aa8..a0f53660c 100644 --- a/ingo/rule.php +++ b/ingo/rule.php @@ -20,7 +20,7 @@ if (!$perms->hasAppPermission('allow_rules')) { try { $message = Horde::callHook('perms_denied', array('ingo:allow_rules')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); header('Location: ' . Horde::applicationUrl('filters.php', true)); @@ -173,7 +173,7 @@ default: try { $message = Horde::callHook('perms_denied', array('ingo:max_rules')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); header('Location: ' . Horde::applicationUrl('filters.php', true)); diff --git a/ingo/templates/common-header.inc b/ingo/templates/common-header.inc index 17e8f5f9e..31c804e96 100644 --- a/ingo/templates/common-header.inc +++ b/ingo/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } $page_title = $GLOBALS['registry']->get('name'); diff --git a/ingo/templates/rule/header.inc b/ingo/templates/rule/header.inc index 88f11e398..2758f6c2c 100644 --- a/ingo/templates/rule/header.inc +++ b/ingo/templates/rule/header.inc @@ -18,7 +18,7 @@ - + attendees): ?> diff --git a/kronolith/templates/javascript_defs.php b/kronolith/templates/javascript_defs.php index b5bd91c8e..3d9d4a51e 100644 --- a/kronolith/templates/javascript_defs.php +++ b/kronolith/templates/javascript_defs.php @@ -3,7 +3,7 @@ * JavaScript variables for the traditional interface. */ -$charset = Horde_Nls::getCharset(); +$charset = $GLOBALS['registry']->getCharset(); /* Variables used in core javascript files. */ $var = array( diff --git a/kronolith/templates/view/view.inc b/kronolith/templates/view/view.inc index 9d3941007..0ed31b618 100644 --- a/kronolith/templates/view/view.inc +++ b/kronolith/templates/view/view.inc @@ -26,7 +26,7 @@ - + @@ -74,14 +74,14 @@ if ($this->event->initialized && $this->event->alarm > 0): - + - + diff --git a/luxor/lib/Lang/Generic.php b/luxor/lib/Lang/Generic.php index acb852638..1aee6cfbf 100644 --- a/luxor/lib/Lang/Generic.php +++ b/luxor/lib/Lang/Generic.php @@ -170,7 +170,7 @@ class Luxor_Lang_Generic extends Luxor_Lang global $index, $sourceid; // Make sure spacing is correct. - $code = Horde_Text_Filter::filter($code, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)); + $code = Horde_Text_Filter::filter($code, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)); // Split all the symbols. preg_match_all('/(^|[^\w\#&])([\w~][\w]*)\b/', $code, $match); diff --git a/luxor/lib/Luxor.php b/luxor/lib/Luxor.php index 1c6e912f6..b8667b047 100644 --- a/luxor/lib/Luxor.php +++ b/luxor/lib/Luxor.php @@ -360,7 +360,7 @@ class Luxor $res = ''; foreach ($lines as $line) { $res .= !empty($res) ? "\n" : ''; - $res .= $pre . Horde_Text_Filter::filter($line, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)) . $post; + $res .= $pre . Horde_Text_Filter::filter($line, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)) . $post; } return $res; } diff --git a/luxor/templates/common-header.inc b/luxor/templates/common-header.inc index f6830d85e..07a341fa2 100644 --- a/luxor/templates/common-header.inc +++ b/luxor/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/mnemo/data.php b/mnemo/data.php index d41acc77c..7fa7fcb21 100644 --- a/mnemo/data.php +++ b/mnemo/data.php @@ -34,7 +34,7 @@ $templates = array( ); if ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true && $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message); } @@ -120,7 +120,7 @@ if (is_array($next_step)) { $num_memos = Mnemo::countMemos(); foreach ($next_step as $row) { if ($max_memos !== true && $num_memos >= $max_memos) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message); } diff --git a/mnemo/lib/Driver/sql.php b/mnemo/lib/Driver/sql.php index a829963f2..f26629a5b 100644 --- a/mnemo/lib/Driver/sql.php +++ b/mnemo/lib/Driver/sql.php @@ -233,10 +233,10 @@ class Mnemo_Driver_sql extends Mnemo_Driver { ' VALUES (?, ?, ?, ?, ?, ?)'; $values = array($this->_notepad, $noteId, - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($body, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($uid, Horde_Nls::getCharset(), $this->_params['charset'])); + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($body, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($uid, $GLOBALS['registry']->getCharset(), $this->_params['charset'])); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('Mnemo_Driver_sql::add(): %s', $query), 'DEBUG'); @@ -278,13 +278,13 @@ class Mnemo_Driver_sql extends Mnemo_Driver { $query = 'UPDATE ' . $this->_params['table'] . ' SET memo_desc = ?, memo_body = ?'; - $values = array(Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($body, Horde_Nls::getCharset(), $this->_params['charset'])); + $values = array(Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($body, $GLOBALS['registry']->getCharset(), $this->_params['charset'])); // Don't change the category if it isn't provided. if (!is_null($category)) { $query .= ', memo_category = ?'; - $values[] = Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']); + $values[] = Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']); } $query .= ' WHERE memo_owner = ? AND memo_id = ?'; array_push($values, $this->_notepad, $noteId); diff --git a/mnemo/memo.php b/mnemo/memo.php index bde5856b2..767f986e8 100644 --- a/mnemo/memo.php +++ b/mnemo/memo.php @@ -73,7 +73,7 @@ case 'add_memo': /* Check permissions. */ if ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true && $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), Mnemo::hasPermission('max_notes')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), Mnemo::hasPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message); } diff --git a/mnemo/note/pdf.php b/mnemo/note/pdf.php index 04b7057bb..6f73d6a5d 100644 --- a/mnemo/note/pdf.php +++ b/mnemo/note/pdf.php @@ -63,8 +63,8 @@ if (!$note || !isset($note['memo_id'])) { /* Let's assume that the note content can be converted to ISO-8859-1 if this * is the current language's charset, as long as we don't have UTF-8 support * in File_PDF. */ -if (Horde_Nls::getCharset(true) == 'ISO-8859-1') { - $note = String::convertCharset($note, Horde_Nls::getCharset(), 'ISO-8859-1'); +if ($GLOBALS['registry']->getCharset(true) == 'ISO-8859-1') { + $note = String::convertCharset($note, $GLOBALS['registry']->getCharset(), 'ISO-8859-1'); } /* Set up the PDF object. */ diff --git a/mnemo/templates/common-header.inc b/mnemo/templates/common-header.inc index 6aef95a5f..1bae2f81b 100644 --- a/mnemo/templates/common-header.inc +++ b/mnemo/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/mnemo/templates/view/memo.inc b/mnemo/templates/view/memo.inc index 431d4aae2..bac661f39 100644 --- a/mnemo/templates/view/memo.inc +++ b/mnemo/templates/view/memo.inc @@ -30,14 +30,14 @@ if (!$print_view) { - + - + diff --git a/nag/data.php b/nag/data.php index 6ced13e5b..729e1f1a6 100644 --- a/nag/data.php +++ b/nag/data.php @@ -41,7 +41,7 @@ if ($perms->hasAppPermission('max_tasks') !== true && try { $message = Horde::callHook('perms_denied', array('nag:max_tasks')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.warning', array('content.raw')); $templates[Horde_Data::IMPORT_FILE] = array(NAG_TEMPLATES . '/data/export.inc'); @@ -168,7 +168,7 @@ if (is_array($next_step)) { try { $message = Horde::callHook('perms_denied', array('nag:max_tasks')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); break; diff --git a/nag/lib/Api.php b/nag/lib/Api.php index e8aca6375..72c3e1970 100644 --- a/nag/lib/Api.php +++ b/nag/lib/Api.php @@ -1060,7 +1060,7 @@ class Nag_Api extends Horde_Registry_Api $share = $GLOBALS['nag_shares']->getShare($tasklist); $iCal = new Horde_iCalendar($version); - $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'utf-8')); + $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'utf-8')); $tasks->reset(); while ($task = $tasks->each()) { @@ -1455,7 +1455,7 @@ class Nag_Api extends Horde_Registry_Api } foreach ($users as $alarm_user) { $prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'nag', $alarm_user, null, null, false); - Horde_Nls::setLanguageEnvironment($prefs->getValue('language')); + $GLOBALS['registry']->setLanguageEnvironment($prefs->getValue('language')); $alarm_list[] = $alarm->toAlarm($alarm_user, $prefs); } } diff --git a/nag/lib/Application.php b/nag/lib/Application.php index 1475e35e7..38fb261d1 100644 --- a/nag/lib/Application.php +++ b/nag/lib/Application.php @@ -48,7 +48,7 @@ class Nag_Application extends Horde_Registry_Application protected function _init() { // Set the timezone variable. - Horde_Nls::setTimeZone(); + $GLOBALS['registry']->setTimeZone(); // Create a share instance. $GLOBALS['nag_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); diff --git a/nag/lib/Driver/Sql.php b/nag/lib/Driver/Sql.php index 7d6b1fd21..6a1f2307f 100644 --- a/nag/lib/Driver/Sql.php +++ b/nag/lib/Driver/Sql.php @@ -178,17 +178,17 @@ class Nag_Driver_Sql extends Nag_Driver { $owner, $assignee, $taskId, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($uid, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($uid, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$start, (int)$due, (int)$priority, number_format($estimate, 2), (int)$completed, - Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$alarm, - serialize(Horde_String::convertCharset($methods, Horde_Nls::getCharset(), $this->_params['charset'])), + serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])), (int)$private, $parent); @@ -254,17 +254,17 @@ class Nag_Driver_Sql extends Nag_Driver { $this->_params['table']); $values = array($owner, $assignee, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$start, (int)$due, (int)$priority, number_format($estimate, 2), (int)$completed, (int)$completed_date, - Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$alarm, - serialize(Horde_String::convertCharset($methods, Horde_Nls::getCharset(), $this->_params['charset'])), + serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])), $parent, (int)$private, $this->_tasklist, diff --git a/nag/lib/Forms/task.php b/nag/lib/Forms/task.php index 4dc5a0634..4d6b4e57d 100644 --- a/nag/lib/Forms/task.php +++ b/nag/lib/Forms/task.php @@ -46,7 +46,7 @@ class Nag_TaskForm extends Horde_Form { if ($vars->get('task_id') == $task->id) { continue; } - $task_enums[htmlspecialchars($task->id)] = str_repeat(' ', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, Horde_Nls::getCharset()); + $task_enums[htmlspecialchars($task->id)] = str_repeat(' ', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $users = array(); $share = $GLOBALS['nag_shares']->getShare($tasklist); diff --git a/nag/lib/Nag.php b/nag/lib/Nag.php index d2bf3465a..de89b72c5 100644 --- a/nag/lib/Nag.php +++ b/nag/lib/Nag.php @@ -673,11 +673,11 @@ class Nag 'mail/compose', array(array('to' => $email)))) . @htmlspecialchars($fullname . ' <' . $email . '>', - ENT_COMPAT, Horde_Nls::getCharset()) + ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; - } else { - return @htmlspecialchars($fullname, ENT_COMPAT, Horde_Nls::getCharset()); } + + return @htmlspecialchars($fullname, ENT_COMPAT, $GLOBALS['registry']->getCharset()); } /** @@ -909,7 +909,7 @@ class Nag $mail->addHeader('From', $from); foreach ($addresses as $lang => $twentyFour) { - Horde_Nls::setLanguageEnvironment($lang); + $GLOBALS['registry']->setLanguageEnvironment($lang); $view_link = Horde_Util::addParameter(Horde::applicationUrl('view.php', true), array('tasklist' => $task->tasklist, @@ -1030,7 +1030,7 @@ class Nag break; } - $mail->addHeader('Subject', $subject . ' ' . $task->name, Horde_Nls::getCharset()); + $mail->addHeader('Subject', $subject . ' ' . $task->name, $GLOBALS['registry']->getCharset()); foreach ($twentyFour as $tf => $dateFormat) { foreach ($dateFormat as $df => $df_recipients) { @@ -1042,7 +1042,7 @@ class Nag $message .= "\n\n" . _("Task description:") . "\n\n" . $task->desc; } - $mail->setBody($message, Horde_Nls::getCharset()); + $mail->setBody($message, $GLOBALS['registry']->getCharset()); $mail->clearRecipients(); $mail->addRecipients($df_recipients); diff --git a/nag/lib/Task.php b/nag/lib/Task.php index 33595e5e6..cc81591b5 100644 --- a/nag/lib/Task.php +++ b/nag/lib/Task.php @@ -800,11 +800,11 @@ class Nag_Task { } if (!empty($this->name)) { - $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, Horde_Nls::getCharset(), 'utf-8')); + $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8')); } if (!empty($this->desc)) { - $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, Horde_Nls::getCharset(), 'utf-8')); + $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, $GLOBALS['registry']->getCharset(), 'utf-8')); } if (isset($this->priority)) { @@ -850,7 +850,7 @@ class Nag_Task { } if (!empty($this->category)) { - $vTodo->setAttribute('CATEGORIES', $v1 ? $this->category : Horde_String::convertCharset($this->category, Horde_Nls::getCharset(), 'utf-8')); + $vTodo->setAttribute('CATEGORIES', $v1 ? $this->category : Horde_String::convertCharset($this->category, $GLOBALS['registry']->getCharset(), 'utf-8')); } /* Get the task's history. */ @@ -891,8 +891,8 @@ class Nag_Task { $message = new Horde_ActiveSync_Message_Task(); /* Notes and Title */ - $message->setBody(Horde_String::convertCharset($this->desc, Horde_Nls::getCharset(), 'utf-8')); - $message->setSubject(Horde_String::convertCharset($this->name, Horde_Nls::getCharset(), 'utf-8')); + $message->setBody(Horde_String::convertCharset($this->desc, $GLOBALS['registry']->getCharset(), 'utf-8')); + $message->setSubject(Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8')); /* Completion */ if ($this->completed) { @@ -1043,8 +1043,8 @@ class Nag_Task { function fromASTask(Horde_ActiveSync_Message_Task $message) { /* Notes and Title */ - $this->desc = Horde_String::convertCharset($message->getBody(), 'utf-8', Horde_Nls::getCharset()); - $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', Horde_Nls::getCharset()); + $this->desc = Horde_String::convertCharset($message->getBody(), 'utf-8', $GLOBALS['registry']->getCharset()); + $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', $GLOBALS['registry']->getCharset()); /* Completion */ if ($this->completed = $message->getComplete()) { diff --git a/nag/task.php b/nag/task.php index 51bf747b4..6566656ce 100644 --- a/nag/task.php +++ b/nag/task.php @@ -73,7 +73,7 @@ case 'add_task': try { $message = Horde::callHook('perms_denied', array('nag:max_tasks')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); header('Location: ' . Horde::applicationUrl('list.php', true)); diff --git a/nag/templates/common-header.inc b/nag/templates/common-header.inc index 7b41c5991..af76d1b78 100644 --- a/nag/templates/common-header.inc +++ b/nag/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/nag/templates/view/task.inc b/nag/templates/view/task.inc index 8a4a8e69c..ce449dc87 100644 --- a/nag/templates/view/task.inc +++ b/nag/templates/view/task.inc @@ -59,14 +59,14 @@ - + - + diff --git a/news/lib/Block/category.php b/news/lib/Block/category.php index 5925fb2f2..b16c8f254 100755 --- a/news/lib/Block/category.php +++ b/news/lib/Block/category.php @@ -48,7 +48,7 @@ class Horde_Block_News_category extends Horde_Block { 'ORDER BY n.publish DESC ' . 'LIMIT 0, ' . $this->_params['limit']; - $params = array(News::CONFIRMED, $this->_params['category'], $this->_params['category'], Horde_Nls::select()); + $params = array(News::CONFIRMED, $this->_params['category'], $this->_params['category'], $GLOBALS['registry']->preferredLang()); $rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC); if ($rows instanceof PEAR_Error) { return $rows->getDebugInfo(); diff --git a/news/lib/Block/last.php b/news/lib/Block/last.php index e731e5fe2..32cec810b 100755 --- a/news/lib/Block/last.php +++ b/news/lib/Block/last.php @@ -33,7 +33,7 @@ class Horde_Block_News_last extends Horde_Block { { require_once dirname(__FILE__) . '/../base.php'; - $params = array(News::CONFIRMED, Horde_Nls::select()); + $params = array(News::CONFIRMED, $GLOBALS['registry']->preferredLang()); $query = 'SELECT n.id, n.publish, n.comments, n.picture, n.category1, nl.title, nl.abbreviation ' . 'FROM ' . $GLOBALS['news']->prefix . ' AS n, ' . $GLOBALS['news']->prefix . '_body AS nl WHERE ' . 'n.status = ? AND n.publish <= NOW() ' . @@ -58,4 +58,4 @@ class Horde_Block_News_last extends Horde_Block { return $view->render('/block/news.php'); } -} \ No newline at end of file +} diff --git a/news/lib/Block/last_blogs.php b/news/lib/Block/last_blogs.php index 8f4f648db..4521f7120 100755 --- a/news/lib/Block/last_blogs.php +++ b/news/lib/Block/last_blogs.php @@ -33,7 +33,7 @@ class Horde_Block_News_last_blogs extends Horde_Block { 'ORDER BY n.publish DESC ' . 'LIMIT 0, ' . $this->_params['limit']; - $params = array(News::CONFIRMED, 0, Horde_Nls::select()); + $params = array(News::CONFIRMED, 0, $GLOBALS['registry']->preferredLang()); $rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC); if ($rows instanceof PEAR_Error) { return $rows->getDebugInfo(); diff --git a/news/lib/Block/most_commented.php b/news/lib/Block/most_commented.php index cc5fca9a7..89779bc94 100755 --- a/news/lib/Block/most_commented.php +++ b/news/lib/Block/most_commented.php @@ -39,7 +39,7 @@ class Horde_Block_News_most_commented extends Horde_Block { 'LIMIT 0, ' . $this->_params['limit']; $younger = $_SERVER['REQUEST_TIME'] - $this->_params['days'] * 86400; - $params = array(News::CONFIRMED, date('Y-m-d', $younger), Horde_Nls::select()); + $params = array(News::CONFIRMED, date('Y-m-d', $younger), $GLOBALS['registry']->preferredLang()); $rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC); if ($rows instanceof PEAR_Error) { return $rows->getDebugInfo(); @@ -50,4 +50,4 @@ class Horde_Block_News_most_commented extends Horde_Block { return $view->render('/block/titles.php'); } -} \ No newline at end of file +} diff --git a/news/lib/Block/most_read.php b/news/lib/Block/most_read.php index 2f2201cb5..163d9df42 100755 --- a/news/lib/Block/most_read.php +++ b/news/lib/Block/most_read.php @@ -39,7 +39,7 @@ class Horde_Block_News_most_read extends Horde_Block { 'LIMIT 0, ' . $this->_params['limit']; $younger = $_SERVER['REQUEST_TIME'] - $this->_params['days'] * 86400; - $params = array(News::CONFIRMED, date('Y-m-d', $younger), Horde_Nls::select()); + $params = array(News::CONFIRMED, date('Y-m-d', $younger), $GLOBALS['registry']->preferredLang()); $rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC); if ($rows instanceof PEAR_Error) { return $rows->getDebugInfo(); @@ -50,4 +50,4 @@ class Horde_Block_News_most_read extends Horde_Block { return $view->render('/block/titles.php'); } -} \ No newline at end of file +} diff --git a/news/lib/Driver/sql.php b/news/lib/Driver/sql.php index 4cefb370d..c694df560 100644 --- a/news/lib/Driver/sql.php +++ b/news/lib/Driver/sql.php @@ -449,7 +449,7 @@ class News_Driver_sql extends News_Driver { $sql = 'FROM ' . $GLOBALS['news']->prefix . ' AS n, ' . $GLOBALS['news']->prefix . '_body AS l ' . ' WHERE n.id = l.id AND l.lang = ?'; - $params = array('_lang' => Horde_Nls::select()); + $params = array('_lang' => $GLOBALS['registry']->preferredLang()); if ($perms == Horde_Perms::READ) { $sql .= ' AND n.publish <= ? '; @@ -588,7 +588,7 @@ class News_Driver_sql extends News_Driver { . $this->prefix . ' AS n WHERE l.lang = ? AND n.id = l.id AND n.status = ? ORDER BY n.publish DESC LIMIT 0, ' . ($minimize ? '100' : '500'); - $result = $this->db->query($sql, array(Horde_Nls::select(), News::CONFIRMED)); + $result = $this->db->query($sql, array($GLOBALS['registry']->preferredLang(), News::CONFIRMED)); if ($result instanceof PEAR_Error) { return $result; } diff --git a/news/lib/News.php b/news/lib/News.php index a4a88fc25..10e702ae9 100644 --- a/news/lib/News.php +++ b/news/lib/News.php @@ -32,7 +32,7 @@ class News { static $lang; if ($lang === null) { - $lang = Horde_Nls::Select(); + $lang = $GLOBALS['registry']->preferredLang(); if (!empty($conf['attributes']['languages']) && !in_array($lang, $conf['attributes']['languages'])) { $lang = $conf['attributes']['languages'][0]; diff --git a/news/lib/View.php b/news/lib/View.php index ce1f22070..20ba0f5c5 100644 --- a/news/lib/View.php +++ b/news/lib/View.php @@ -21,7 +21,7 @@ class News_View extends Horde_View { { /* Set parents defualt data */ parent::__construct(array('templatePath' => NEWS_TEMPLATES, - 'encoding' => Horde_Nls::select())); + 'encoding' => $GLOBALS['registry']->preferredLang())); } /** diff --git a/news/mail.php b/news/mail.php index 1d93e9151..7202734b5 100644 --- a/news/mail.php +++ b/news/mail.php @@ -53,7 +53,7 @@ $body = sprintf(_("%s would you like to invite you to read the news\n Title: %s\ $row['publish'], News::getUrlFor('news', $id, true, -1)); -$mail = new Horde_Mime_Mail(array('subject' => $row['title'], 'body' => $body, 'to' => $to, 'from' => $from, 'charset' => Horde_Nls::getCharset())); +$mail = new Horde_Mime_Mail(array('subject' => $row['title'], 'body' => $body, 'to' => $to, 'from' => $from, 'charset' => $GLOBALS['registry']->getCharset())); try { $mail->send($injector->getInstance('Horde_Mail')); $notification->push(sprintf(_("News succesfully send to %s"), $to), 'horde.success'); diff --git a/news/pdf.php b/news/pdf.php index 6a200759d..bc4a252c7 100644 --- a/news/pdf.php +++ b/news/pdf.php @@ -55,7 +55,7 @@ $pdf->newLine(4); $pdf->write(12, _("On") . ': ' . News::dateFormat($row['publish']) . "\n"); $pdf->write(12, _("Link") . ': ' . News::getUrlFor('news', $id, true) . "\n\n", News::getUrlFor('news', $id, true)); -$pdf->multiCell(0, 12, Horde_String::convertCharset(strip_tags($row['content']), Horde_Nls::getCharset(), 'UTF-8')); +$pdf->multiCell(0, 12, Horde_String::convertCharset(strip_tags($row['content']), $GLOBALS['registry']->getCharset(), 'UTF-8')); $browser->downloadHeaders($id . '.pdf', 'application/pdf'); echo $pdf->getOutput(); diff --git a/news/rss/comments.php b/news/rss/comments.php index 21a96cb10..9f7af6ecf 100644 --- a/news/rss/comments.php +++ b/news/rss/comments.php @@ -16,15 +16,14 @@ require_once dirname(__FILE__) . '/../lib/base.php'; $cache_key = 'news_rss_comments'; $rss = $cache->get($cache_key, $conf['cache']['default_lifetime']); if (!$rss) { - $list = News::getLastComments(50); $title = _("Last comments"); - $rss = ' + $rss = 'getCharset() . '" ?> ' . htmlspecialchars($title) . ' - ' . str_replace('_', '-', strtolower(Horde_Nls::select())) . ' + ' . str_replace('_', '-', strtolower($registry->preferredLang())) . ' ' . date('r') . ' ' . htmlspecialchars($title) . ' ' . Horde::applicationUrl('index.php', true, -1) . ' @@ -48,5 +47,5 @@ if (!$rss) { $cache->set($cache_key, $rss); } -header('Content-type: text/xml; charset=' . Horde_Nls::getCharset()); +header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset()); echo $rss; diff --git a/news/rss/index.php b/news/rss/index.php index a083e58fc..2ae262d74 100644 --- a/news/rss/index.php +++ b/news/rss/index.php @@ -22,11 +22,11 @@ if (!$rss) { $title = $registry->get('name', 'horde'); $read_url = Horde::applicationUrl('read.php', true, -1); - $rss = ' + $rss = 'getCharset() . '" ?> ' . htmlspecialchars($title) . ' - ' . str_replace('_', '-', strtolower(Horde_Nls::select())) . ' + ' . str_replace('_', '-', strtolower($registry->preferredLang())) . ' ' . date('r') . ' ' . htmlspecialchars($title) . ' ' . Horde::applicationUrl('index.php', true, -1) . ' diff --git a/news/rss/news.php b/news/rss/news.php index 803c7d74c..3dba99040 100755 --- a/news/rss/news.php +++ b/news/rss/news.php @@ -24,7 +24,7 @@ if (empty($rss)) { 'nl.title, nl.abbreviation ' . 'FROM ' . $news->prefix . ' AS n, ' . $news->prefix . '_body AS nl ' . 'WHERE n.status="' . News::CONFIRMED . '" AND n.publish<=NOW() ' . - 'AND nl.lang="' . Horde_Nls::select() . '" AND n.id=nl.id ORDER BY publish DESC'; + 'AND nl.lang="' . $registry->preferredLang() . '" AND n.id=nl.id ORDER BY publish DESC'; $rssbody = ''; $query = $news->db->modifyLimitQuery($query, 0, 10); $list = $news->db->getAssoc($query, true, array(), DB_FETCHMODE_ASSOC); @@ -53,14 +53,14 @@ if (empty($rss)) { } // Wee need the last published news time - $rssheader = ' + $rssheader = 'getCharset() . '" ?> ' . htmlspecialchars($title) . ' - ' . str_replace('_', '-', strtolower(Horde_Nls::select())) . ' + ' . str_replace('_', '-', strtolower($registry->preferredLang())) . ' ' . date('r', $lastnewstime) . ' ' . htmlspecialchars($title) . ' ' . Horde::applicationUrl('index.php', true, -1) . ' diff --git a/news/templates/common-header.inc b/news/templates/common-header.inc index 193c0acf0..079b5151f 100644 --- a/news/templates/common-header.inc +++ b/news/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/operator/graphgen.php b/operator/graphgen.php index 72d71cf4c..4a75c1993 100644 --- a/operator/graphgen.php +++ b/operator/graphgen.php @@ -18,8 +18,8 @@ $cache = &$GLOBALS['cache']; //error_reporting(E_NONE); //ini_set("display_errors", 0); -#setlocale(LC_ALL, Horde_Nls::select()); -#setlocale(LC_ALL, 'en_US'); +//setlocale(LC_ALL, $registry->preferredLang()); +//setlocale(LC_ALL, 'en_US'); $graphtype = Horde_Util::getFormData('graph'); $graphinfo = Operator::getGraphInfo($graphtype); diff --git a/operator/templates/common-header.inc b/operator/templates/common-header.inc index a15e4f3a3..a91471912 100644 --- a/operator/templates/common-header.inc +++ b/operator/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/pastie/templates/common-header.inc b/pastie/templates/common-header.inc index e6b62df0b..563c6c45b 100644 --- a/pastie/templates/common-header.inc +++ b/pastie/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/shout/templates/common-header.inc b/shout/templates/common-header.inc index fda1826fa..dcd0d515b 100644 --- a/shout/templates/common-header.inc +++ b/shout/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/shout/templates/dialplan/edit.inc b/shout/templates/dialplan/edit.inc index 12fff22b1..d5ef834f7 100644 --- a/shout/templates/dialplan/edit.inc +++ b/shout/templates/dialplan/edit.inc @@ -94,10 +94,10 @@ var ajax_url = ''; var curmenu = null; var menuInfo = $H(); -var menuActions = $H(); -var destinations = $H(); -var conferences = $H(); -var recordings = $H(); +var menuActions = $H(getCharset()); ?>); +var destinations = $H(getCharset()); ?>); +var conferences = $H(getCharset()); ?>); +var recordings = $H(getCharset()); ?>); function empty(p) { diff --git a/skeleton/templates/common-header.inc b/skeleton/templates/common-header.inc index e6b62df0b..563c6c45b 100644 --- a/skeleton/templates/common-header.inc +++ b/skeleton/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/skoli/templates/common-header.inc b/skoli/templates/common-header.inc index 3103145ee..62794cda3 100644 --- a/skoli/templates/common-header.inc +++ b/skoli/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/trean/add.php b/trean/add.php index 9958b1226..39fddd75d 100644 --- a/trean/add.php +++ b/trean/add.php @@ -20,7 +20,7 @@ case 'add_bookmark': /* Check permissions. */ if (Trean::hasPermission('max_bookmarks') !== true && Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks()) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message); } @@ -83,7 +83,7 @@ case 'add_folder': /* Check permissions. */ if (Trean::hasPermission('max_folders') !== true && Trean::hasPermission('max_folders') <= Trean::countFolders()) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message); } diff --git a/trean/data.php b/trean/data.php index f6f46c100..e544b0be5 100644 --- a/trean/data.php +++ b/trean/data.php @@ -53,7 +53,7 @@ Horde_Registry::appInit('trean'); $folders_exceeded = Trean::hasPermission('max_folders') !== true && Trean::hasPermission('max_folders') <= Trean::countFolders(); if ($folders_exceeded) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message); } @@ -62,7 +62,7 @@ if ($folders_exceeded) { $bookmarks_exceeded = Trean::hasPermission('max_bookmarks') !== true && Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks(); if ($bookmarks_exceeded) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message); } @@ -104,7 +104,7 @@ case 'import': continue; } if ($max_folders !== true && $num_folders >= $max_folders) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message); } @@ -129,7 +129,7 @@ case 'import': $line, $temp)) { /* A bookmark. */ if ($max_bookmarks !== true && $num_bookmarks >= $max_bookmarks) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (!empty($conf['hooks']['permsdenied'])) { $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message); } diff --git a/trean/lib/Application.php b/trean/lib/Application.php index fccf5deed..53b52ada3 100644 --- a/trean/lib/Application.php +++ b/trean/lib/Application.php @@ -48,7 +48,7 @@ class Trean_Application extends Horde_Registry_Application protected function _init() { // Set the timezone variable. - Horde_Nls::setTimeZone(); + $GLOBALS['registry']->setTimeZone(); // Create db and share instances. $GLOBALS['trean_db'] = Trean::getDb(); diff --git a/trean/lib/Bookmarks.php b/trean/lib/Bookmarks.php index 0dfb84e83..f7b178fe3 100644 --- a/trean/lib/Bookmarks.php +++ b/trean/lib/Bookmarks.php @@ -1015,9 +1015,9 @@ class Trean_Bookmark { return $update; } $result = $update->execute(array($this->folder, - Horde_String::convertCharset($this->url, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), - Horde_String::convertCharset($this->title, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), - Horde_String::convertCharset($this->description, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($this->url, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($this->title, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), $this->clicks, $this->rating, $this->id)); @@ -1051,9 +1051,9 @@ class Trean_Bookmark { $result = $insert->execute(array($bookmark_id, $this->folder, - Horde_String::convertCharset($this->url, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), - Horde_String::convertCharset($this->title, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), - Horde_String::convertCharset($this->description, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($this->url, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($this->title, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), + Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']), $this->clicks, $this->rating, )); diff --git a/trean/rss.php b/trean/rss.php index d84cbcbab..f710968c6 100644 --- a/trean/rss.php +++ b/trean/rss.php @@ -59,12 +59,12 @@ $cache = $GLOBALS['injector']->getInstance('Horde_Cache'); $cache_key = 'trean_rss_' . Horde_Auth::getAuth() . '_' . ($folderId === null ? 'all' : $folderId); $rss = $cache->get($cache_key, $conf['cache']['default_lifetime']); if (!$rss) { - $rss = ' + $rss = 'getCharset() . '" ?> ' . htmlspecialchars($folderId == null ? $registry->get('name') : $folder->get('name')) . ' - ' . Horde_Nls::select() . ' - ' . Horde_Nls::getCharset() . ' + ' . $registry->preferredLang() . ' + ' . $GLOBALS['registry']->getCharset() . ' ' . date('Y-m-d H:i:s') . ' http://' . $_SERVER['SERVER_NAME'] . $registry->get('webroot') . '/themes/graphics/favicon.ico diff --git a/trean/templates/common-header.inc b/trean/templates/common-header.inc index c8b82d677..435aaf9f3 100644 --- a/trean/templates/common-header.inc +++ b/trean/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/turba/add.php b/turba/add.php index 3e1196355..4cbbc5d5a 100644 --- a/turba/add.php +++ b/turba/add.php @@ -45,7 +45,7 @@ if ($source) { try { $message = Horde::callHook('perms_denied', array('turba:max_contacts')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); $url = $url diff --git a/turba/config/sources.php.dist b/turba/config/sources.php.dist index bad2156ae..cf384a4ca 100644 --- a/turba/config/sources.php.dist +++ b/turba/config/sources.php.dist @@ -591,7 +591,7 @@ $cfgSources['localsql'] = array( // 'type' => 'prefs', // 'params' => array( // 'name' => 'prefs', -// 'charset' => Horde_Nls::getCharset() +// 'charset' => $GLOBALS['registry']->getCharset() // ), // 'map' => array( // '__key' => 'id', diff --git a/turba/data.php b/turba/data.php index 12f9b865f..b4bed9559 100644 --- a/turba/data.php +++ b/turba/data.php @@ -281,7 +281,7 @@ case 'export': } elseif ($attributes[$field]['type'] == 'datetime') { $row[$field] = strftime('%Y-%m-%d %R', $attribute); } else { - $row[$field] = Horde_String::convertCharset($attribute, Horde_Nls::getCharset(), $params['charset']); + $row[$field] = Horde_String::convertCharset($attribute, $GLOBALS['registry']->getCharset(), $params['charset']); } } } @@ -351,7 +351,7 @@ case Horde_Data::IMPORT_FILE: try { $message = Horde::callHook('perms_denied', array('turba:max_contacts')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $driver->title), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $driver->title), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); $error = true; @@ -540,7 +540,7 @@ if ($next_step == Horde_Data::IMPORT_FILE) { $charsets[$charset] = $charset; } } - $my_charset = Horde_Nls::getCharset(true); + $my_charset = $GLOBALS['registry']->getCharset(true); } foreach ($templates[$next_step] as $template) { diff --git a/turba/lib/Driver.php b/turba/lib/Driver.php index f737d1c93..d0823d30f 100644 --- a/turba/lib/Driver.php +++ b/turba/lib/Driver.php @@ -988,7 +988,7 @@ class Turba_Driver $hash = $object->getAttributes(); $vcard = new Horde_iCalendar_vcard($version); $formattedname = false; - $charset = $version == '2.1' ? array('CHARSET' => Horde_Nls::getCharset()) : array(); + $charset = $version == '2.1' ? array('CHARSET' => $GLOBALS['registry']->getCharset()) : array(); foreach ($hash as $key => $val) { if ($skipEmpty && !strlen($val)) { @@ -996,7 +996,7 @@ class Turba_Driver } if ($version != '2.1') { - $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8'); + $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8'); } switch ($key) { @@ -1656,8 +1656,8 @@ class Turba_Driver ); $val = implode(';', $a); if ($version != '2.1') { - $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8'); - $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8'); + $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8'); + $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8'); } if (!$fields || isset($fields['N'])) { $vcard->setAttribute('N', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $a); @@ -1687,8 +1687,8 @@ class Turba_Driver if (count($org) && (!$fields || isset($fields['ORG']))) { $val = implode(';', $org); if ($version != '2.1') { - $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8'); - $org = Horde_String::convertCharset($org, Horde_Nls::getCharset(), 'utf-8'); + $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8'); + $org = Horde_String::convertCharset($org, $GLOBALS['registry']->getCharset(), 'utf-8'); } $vcard->setAttribute('ORG', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $org); } @@ -1740,12 +1740,12 @@ class Turba_Driver if ($version == '2.1') { $params = array(); if (Horde_Mime::is8bit($val)) { - $params['CHARSET'] = Horde_Nls::getCharset(); + $params['CHARSET'] = $GLOBALS['registry']->getCharset(); } } else { $params = array('TYPE' => ''); - $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8'); - $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8'); + $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8'); + $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8'); } $vcard->setAttribute('ADR', $val, $params, true, $a); } @@ -1795,12 +1795,12 @@ class Turba_Driver if ($version == '2.1') { $params = array('HOME' => null); if (Horde_Mime::is8bit($val)) { - $params['CHARSET'] = Horde_Nls::getCharset(); + $params['CHARSET'] = $GLOBALS['registry']->getCharset(); } } else { $params = array('TYPE' => 'HOME'); - $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8'); - $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8'); + $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8'); + $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8'); } $vcard->setAttribute('ADR', $val, $params, true, $a); } @@ -1850,12 +1850,12 @@ class Turba_Driver if ($version == '2.1') { $params = array('WORK' => null); if (Horde_Mime::is8bit($val)) { - $params['CHARSET'] = Horde_Nls::getCharset(); + $params['CHARSET'] = $GLOBALS['registry']->getCharset(); } } else { $params = array('TYPE' => 'WORK'); - $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8'); - $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8'); + $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8'); + $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8'); } $vcard->setAttribute('ADR', $val, $params, true, $a); } @@ -2318,7 +2318,7 @@ class Turba_Driver public function toASContact(Turba_Object $object) { $message = new Horde_ActiveSync_Message_Contact(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger'))); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $hash = $object->getAttributes(); foreach ($hash as $field => $value) { switch ($field) { @@ -2456,7 +2456,7 @@ class Turba_Driver public function fromASContact($message) { $hash = array(); - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $formattedname = false; $textMap = array( diff --git a/turba/lib/Driver/Ldap.php b/turba/lib/Driver/Ldap.php index 43493d1b3..02c790c7d 100644 --- a/turba/lib/Driver/Ldap.php +++ b/turba/lib/Driver/Ldap.php @@ -233,7 +233,7 @@ class Turba_Driver_Ldap extends Turba_Driver if (is_array($ids)) { $results = array(); foreach ($ids as $d) { - $res = @ldap_read($this->_ds, Horde_String::convertCharset($d, Horde_Nls::getCharset(), $this->_params['charset']), $filter, $attr); + $res = @ldap_read($this->_ds, Horde_String::convertCharset($d, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr); if ($res) { if (!is_a($result = $this->_getResults($fields, $res), 'PEAR_Error')) { $results = array_merge($results, $result); @@ -247,7 +247,7 @@ class Turba_Driver_Ldap extends Turba_Driver return $results; } - $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, Horde_Nls::getCharset(), $this->_params['charset']), $filter, $attr); + $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr); if (!$res) { return PEAR::raiseError(sprintf(_("Read failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds))); } @@ -303,8 +303,8 @@ class Turba_Driver_Ldap extends Turba_Driver $this->_encodeAttributes($attributes); - if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, Horde_Nls::getCharset(), $this->_params['charset']), $attributes)) { - return PEAR::raiseError('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . Horde_Nls::getCharset()); + if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) { + return PEAR::raiseError('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . $GLOBALS['registry']->getCharset()); } else { return true; } @@ -324,7 +324,7 @@ class Turba_Driver_Ldap extends Turba_Driver return PEAR::raiseError(_("Invalid key specified.")); } - if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']))) { + if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']))) { return PEAR::raiseError(sprintf(_("Delete failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds))); } else { return true; @@ -345,7 +345,7 @@ class Turba_Driver_Ldap extends Turba_Driver * values. These are needed so that we can delete any * attributes that have been removed by using ldap_mod_del. */ $filter = $this->_buildObjectclassFilter(); - $oldres = @ldap_read($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']), $filter, array_merge(array_keys($attributes), array('objectclass'))); + $oldres = @ldap_read($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, array_merge(array_keys($attributes), array('objectclass'))); $info = ldap_get_attributes($this->_ds, ldap_first_entry($this->_ds, $oldres)); if ($this->_params['version'] == 3 && @@ -357,8 +357,8 @@ class Turba_Driver_Ldap extends Turba_Driver return PEAR::raiseError(_("Missing DN in LDAP source configuration.")); } - if (ldap_rename($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($newrdn, Horde_Nls::getCharset(), $this->_params['charset']), $this->_params['root'], true)) { + if (ldap_rename($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($newrdn, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $this->_params['root'], true)) { $object_id = $newrdn . ',' . $this->_params['root']; } else { return PEAR::raiseError(sprintf(_("Failed to change name: (%s) %s; Old DN = %s, New DN = %s, Root = %s"), @@ -382,7 +382,7 @@ class Turba_Driver_Ldap extends Turba_Driver $attributes[$key] == '') { $oldval[$key] = $var[0]; - if (!@ldap_mod_del($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']), $oldval)) { + if (!@ldap_mod_del($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $oldval)) { return PEAR::raiseError(sprintf(_("Modify failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds))); } unset($attributes[$key]); @@ -398,7 +398,7 @@ class Turba_Driver_Ldap extends Turba_Driver unset($attributes['objectclass']['count']); $attributes['objectclass'] = array_values($attributes['objectclass']); - if (!@ldap_modify($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']), $attributes)) { + if (!@ldap_modify($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) { return PEAR::raiseError(sprintf(_("Modify failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds))); } else { return $object_id; @@ -460,7 +460,7 @@ class Turba_Driver_Ldap extends Turba_Driver $clause .= '(&' . $this->_buildSearchQuery($vals) . ')'; } else { if (isset($vals['field'])) { - $rhs = Horde_String::convertCharset($vals['test'], Horde_Nls::getCharset(), $this->_params['charset']); + $rhs = Horde_String::convertCharset($vals['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']); $clause .= Horde_Ldap::buildClause($vals['field'], $vals['op'], $rhs, array('begin' => !empty($vals['begin']))); } else { foreach ($vals as $test) { @@ -469,7 +469,7 @@ class Turba_Driver_Ldap extends Turba_Driver } elseif (!empty($test['AND'])) { $clause .= '(&' . $this->_buildSearchQuery($test) . ')'; } else { - $rhs = Horde_String::convertCharset($test['test'], Horde_Nls::getCharset(), $this->_params['charset']); + $rhs = Horde_String::convertCharset($test['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']); $clause .= Horde_Ldap::buildClause($test['field'], $test['op'], $rhs, array('begin' => !empty($vals['begin']))); } } @@ -586,7 +586,7 @@ class Turba_Driver_Ldap extends Turba_Driver } if (!is_array($val)) { - $attributes[$key] = Horde_String::convertCharset($val, Horde_Nls::getCharset(), $this->_params['charset']); + $attributes[$key] = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), $this->_params['charset']); } } } diff --git a/turba/lib/Driver/Sql.php b/turba/lib/Driver/Sql.php index 94e5c5107..321797d50 100644 --- a/turba/lib/Driver/Sql.php +++ b/turba/lib/Driver/Sql.php @@ -680,7 +680,7 @@ class Turba_Driver_Sql extends Turba_Driver */ function _convertToDriver($value) { - return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']); + return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']); } /** diff --git a/turba/lib/Object.php b/turba/lib/Object.php index 268eb10d1..8851f10b8 100644 --- a/turba/lib/Object.php +++ b/turba/lib/Object.php @@ -267,7 +267,7 @@ class Turba_Object { . ' ' . date($GLOBALS['prefs']->getValue('twentyFour') ? 'G:i' : 'g:i a', $entry['ts']) . ' ' - . @htmlspecialchars($by, ENT_COMPAT, Horde_Nls::getCharset()); + . @htmlspecialchars($by, ENT_COMPAT, $GLOBALS['registry']->getCharset()); } } } catch (Exception $e) { diff --git a/turba/lib/View/Browse.php b/turba/lib/View/Browse.php index 50f414040..a82af2c72 100644 --- a/turba/lib/View/Browse.php +++ b/turba/lib/View/Browse.php @@ -148,7 +148,7 @@ class Turba_View_Browse { try { $message = Horde::callHook('perms_denied', array('turba:max_contacts')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$targetSource]['title']), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$targetSource]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); break; @@ -288,7 +288,7 @@ class Turba_View_Browse { try { $message = Horde::callHook('perms_denied', array('turba:max_contacts')); } catch (Horde_Exception $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); break; diff --git a/turba/templates/common-header.inc b/turba/templates/common-header.inc index b331ce00d..269649ba3 100644 --- a/turba/templates/common-header.inc +++ b/turba/templates/common-header.inc @@ -1,7 +1,7 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/turba/vcard.php b/turba/vcard.php index 285592ed7..0a5a46914 100644 --- a/turba/vcard.php +++ b/turba/vcard.php @@ -43,4 +43,4 @@ if (!$filename) { $filename = _("contact"); } -$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), Horde_Nls::getCharset()); +$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), $GLOBALS['registry']->getCharset()); diff --git a/vilma/templates/common-header.inc b/vilma/templates/common-header.inc index afbc18f7b..af209be4d 100644 --- a/vilma/templates/common-header.inc +++ b/vilma/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/whups/lib/Driver.php b/whups/lib/Driver.php index e21b581ee..f144e6b5d 100644 --- a/whups/lib/Driver.php +++ b/whups/lib/Driver.php @@ -391,14 +391,14 @@ class Whups_Driver { } elseif (!empty($conf['mail']['from_addr'])) { $mail->addHeader('From', $conf['mail']['from_addr']); } else { - $mail->addHeader('From', Whups::formatUser($from), Horde_Nls::getCharset()); + $mail->addHeader('From', Whups::formatUser($from), $GLOBALS['registry']->getCharset()); } $subject = (is_null($ticket_id) ? '' : '[' . $registry->get('name') . ' #' . $ticket_id . '] ') . $subject; - $mail->addHeader('Subject', $subject, Horde_Nls::getCharset()); + $mail->addHeader('Subject', $subject, $GLOBALS['registry']->getCharset()); /* Get our array of comments, sorted in the appropriate order. */ if (!is_null($ticket_id)) { @@ -474,7 +474,7 @@ class Whups_Driver { array('@@comment@@', '@@full_name@@'), array("\n\n" . $formattedComment, $full_name), $message); - $mail->setBody($body, Horde_Nls::getCharset()); + $mail->setBody($body, $GLOBALS['registry']->getCharset()); $mail->addHeader('Message-ID', Horde_Mime::generateMessageId()); if ($ticket_id) { @@ -488,7 +488,7 @@ class Whups_Driver { } $mail->clearRecipients(); - $mail->addHeader('To', $to, Horde_Nls::getCharset()); + $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset()); try { $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'), true); diff --git a/whups/lib/Driver/sql.php b/whups/lib/Driver/sql.php index 148cee094..e36acac48 100644 --- a/whups/lib/Driver/sql.php +++ b/whups/lib/Driver/sql.php @@ -83,9 +83,9 @@ class Whups_Driver_sql extends Whups_Driver { . 'VALUES (?, ?, ?, ?, ?)'; $values = array( $new_id, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $slug, $email); @@ -113,9 +113,9 @@ class Whups_Driver_sql extends Whups_Driver { $query = 'INSERT INTO whups_types' . ' (type_id, type_name, type_description) VALUES (?, ?, ?)'; $values = array($new_id, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset'])); Horde::logMessage( sprintf('Whups_Driver_sql::addType(): query="%s"; values="%s"', @@ -142,11 +142,11 @@ class Whups_Driver_sql extends Whups_Driver { . 'state_description, state_category) VALUES (?, ?, ?, ?, ?)'; $values = array($new_id, $typeId, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($category, Horde_Nls::getCharset(), + Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset'])); Horde::logMessage( sprintf('Whups_Driver_sql::addState(): query="%s"; values="%s"', @@ -173,9 +173,9 @@ class Whups_Driver_sql extends Whups_Driver { . 'priority_name, priority_description) VALUES (?, ?, ?, ?)'; $values = array($new_id, $typeId, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset'])); Horde::logMessage( sprintf('Whups_Driver_sql::addPriority(): query="%s"; values="%s"', @@ -212,9 +212,9 @@ class Whups_Driver_sql extends Whups_Driver { . 'version_name, version_description, version_active) VALUES (?, ?, ?, ?, ?)'; $values = array((int)$new_id, (int)$queueId, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$active); Horde::logMessage( @@ -251,9 +251,9 @@ class Whups_Driver_sql extends Whups_Driver { . 'reply_name, reply_text) VALUES (?, ?, ?, ?)'; $values = array($type, $new_id, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($text, Horde_Nls::getCharset(), + Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(), $this->_params['charset'])); Horde::logMessage( sprintf('Whups_Driver_sql::addReply(): query="%s"; values="%s"', @@ -296,7 +296,7 @@ class Whups_Driver_sql extends Whups_Driver { . 'ticket_timestamp, ticket_due, version_id)' . ' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; $values = array($ticketId, - Horde_String::convertCharset($summary, Horde_Nls::getCharset(), + Horde_String::convertCharset($summary, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $requester, $type, @@ -407,7 +407,7 @@ class Whups_Driver_sql extends Whups_Driver { array((int)$id, (int)$ticket_id, $creator, - Horde_String::convertCharset($comment, Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($comment, $GLOBALS['registry']->getCharset(), $this->_params['charset']), time())); if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, 'ERR'); @@ -458,7 +458,7 @@ class Whups_Driver_sql extends Whups_Driver { } $query .= $this->_map[$field] . ' = ?, '; - $values[] = Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']); + $values[] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']); } /* Don't try to execute an empty query (if we didn't find any updates @@ -1389,10 +1389,10 @@ class Whups_Driver_sql extends Whups_Driver { . 'queue_description = ?, queue_versioned = ?, ' . 'queue_slug = ?, queue_email = ? WHERE queue_id = ?'; $values = array(Horde_String::convertCharset($name, - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), $this->_params['charset']), Horde_String::convertCharset($description, - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), $this->_params['charset']), (empty($versioned) ? 0 : 1), $slug, @@ -1679,9 +1679,9 @@ class Whups_Driver_sql extends Whups_Driver { { $query = 'UPDATE whups_types' . ' SET type_name = ?, type_description = ? WHERE type_id = ?'; - $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(), + $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $typeId); Horde::logMessage( @@ -1827,11 +1827,11 @@ class Whups_Driver_sql extends Whups_Driver { { $query = 'UPDATE whups_states SET state_name = ?, ' . 'state_description = ?, state_category = ? WHERE state_id = ?'; - $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(), + $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($category, Horde_Nls::getCharset(), + Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $stateId); Horde::logMessage( @@ -1934,7 +1934,7 @@ class Whups_Driver_sql extends Whups_Driver { $values = array($query->id, serialize($query->parameters), serialize($query->query)); } - $values = Horde_String::convertCharset($values, Horde_Nls::getCharset(), + $values = Horde_String::convertCharset($values, $GLOBALS['registry']->getCharset(), $this->_params['charset']); Horde::logMessage( sprintf('Whups_Driver_sql::saveQuery(): query="%s"; values="%s"', @@ -2052,9 +2052,9 @@ class Whups_Driver_sql extends Whups_Driver { $query = 'UPDATE whups_priorities' . ' SET priority_name = ?, priority_description = ?' . ' WHERE priority_id = ?'; - $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(), + $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $priorityId); Horde::logMessage( @@ -2156,9 +2156,9 @@ class Whups_Driver_sql extends Whups_Driver { $query = 'UPDATE whups_versions SET version_name = ?, ' . 'version_description = ?, version_active = ? ' . 'WHERE version_id = ?'; - $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(), + $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($description, Horde_Nls::getCharset(), + Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$active, (int)$versionId); @@ -2238,9 +2238,9 @@ class Whups_Driver_sql extends Whups_Driver { { $query = 'UPDATE whups_replies SET reply_name = ?, ' . 'reply_text = ? WHERE reply_id = ?'; - $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(), + $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($text, Horde_Nls::getCharset(), + Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $reply); Horde::logMessage( @@ -2381,13 +2381,13 @@ class Whups_Driver_sql extends Whups_Driver { . ' VALUES (?, ?, ?, ?, ?, ?, ?)'; $values = array($new_id, $type_id, - Horde_String::convertCharset($name, Horde_Nls::getCharset(), + Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($desc, Horde_Nls::getCharset(), + Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $type, serialize( - Horde_String::convertCharset($params, Horde_Nls::getCharset(), + Horde_String::convertCharset($params, $GLOBALS['registry']->getCharset(), $this->_params['charset'])), (int)($required == 'on')); @@ -2410,14 +2410,14 @@ class Whups_Driver_sql extends Whups_Driver { . 'SET attribute_name = ?, attribute_description = ?, ' . 'attribute_type = ?, attribute_params = ?, ' . 'attribute_required = ? WHERE attribute_id = ?'; - $values = array(Horde_String::convertCharset($newname, Horde_Nls::getCharset(), + $values = array(Horde_String::convertCharset($newname, $GLOBALS['registry']->getCharset(), $this->_params['charset']), - Horde_String::convertCharset($newdesc, Horde_Nls::getCharset(), + Horde_String::convertCharset($newdesc, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $newtype, serialize( Horde_String::convertCharset($newparams, - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), $this->_params['charset'])), (int)($newrequired == 'on'), $attribute_id); @@ -2612,7 +2612,7 @@ class Whups_Driver_sql extends Whups_Driver { function _setAttributeValue($ticket_id, $attribute_id, $attribute_value) { $db_attribute_value = Horde_String::convertCharset((string)$attribute_value, - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), $this->_params['charset']); $this->_write_db->autoCommit(false); @@ -2813,7 +2813,7 @@ class Whups_Driver_sql extends Whups_Driver { time(), (string)$user, $type, - Horde_String::convertCharset((string)$value, Horde_Nls::getCharset(), + Horde_String::convertCharset((string)$value, $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$value); Horde::logMessage( diff --git a/whups/opensearch.php b/whups/opensearch.php index f53887508..dc4eff9e7 100644 --- a/whups/opensearch.php +++ b/whups/opensearch.php @@ -20,7 +20,7 @@ $name = $registry->get('name', 'whups') . ' (' . $url . ')'; $icon = base64_encode(file_get_contents($registry->get('themesfs', 'whups') . '/graphics/whups.png')); // Charset. -$charset = Horde_Nls::getCharset(); +$charset = $GLOBALS['registry']->getCharset(); header('Content-Type: text/xml; charset=' . $charset); echo <<createInstance('Horde_Template'); -$template->set('charset', Horde_Nls::getCharset()); +$template->set('charset', $GLOBALS['registry']->getCharset()); $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl'); $template->set('pubDate', htmlspecialchars(date('r'))); $template->set('title', htmlspecialchars($whups_query->name ? $whups_query->name : _("Query Results"))); diff --git a/whups/queue/rss.php b/whups/queue/rss.php index bbc82566d..16666cffd 100644 --- a/whups/queue/rss.php +++ b/whups/queue/rss.php @@ -86,7 +86,7 @@ foreach (array_keys($tickets) as $i) { } $template = $injector->createInstance('Horde_Template'); -$template->set('charset', Horde_Nls::getCharset()); +$template->set('charset', $GLOBALS['registry']->getCharset()); $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl'); $template->set('pubDate', htmlspecialchars(date('r'))); if (isset($type) && isset($queue['name'])) { diff --git a/whups/scripts/mail-filter.php b/whups/scripts/mail-filter.php index 34284bd07..e212dc203 100755 --- a/whups/scripts/mail-filter.php +++ b/whups/scripts/mail-filter.php @@ -156,7 +156,7 @@ if (empty($info['ticket'])) { // Set charset to UTF-8 for most flexible conversion between email charset and // backend charset. -Horde_Nls::setCharsetEnvironment('UTF-8'); +$registry->setCharsetEnvironment('UTF-8'); // Read and parse the message. if (empty($mail['user'])) { diff --git a/whups/search/rss.php b/whups/search/rss.php index fe949c554..8cd3d30ed 100644 --- a/whups/search/rss.php +++ b/whups/search/rss.php @@ -47,7 +47,7 @@ foreach (array_keys($tickets) as $i) { } $template = $injector->createInstance('Horde_Template'); -$template->set('charset', Horde_Nls::getCharset()); +$template->set('charset', $GLOBALS['registry']->getCharset()); $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl'); $template->set('pubDate', htmlspecialchars(date('r'))); $template->set('title', _("Search Results")); diff --git a/whups/templates/common-header.inc b/whups/templates/common-header.inc index 6ab785e9c..b323d682c 100644 --- a/whups/templates/common-header.inc +++ b/whups/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/whups/ticket/rss.php b/whups/ticket/rss.php index e1d69f457..a07a11b5c 100644 --- a/whups/ticket/rss.php +++ b/whups/ticket/rss.php @@ -42,7 +42,7 @@ foreach (array_keys($history) as $i) { } $template = $injector->createInstance('Horde_Template'); -$template->set('charset', Horde_Nls::getCharset()); +$template->set('charset', $GLOBALS['registry']->getCharset()); $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl'); $template->set('pubDate', htmlspecialchars(date('r'))); $template->set('title', htmlspecialchars($details['summary'])); diff --git a/wicked/lib/Driver.php b/wicked/lib/Driver.php index b4ba0c16b..b1bf5a47a 100644 --- a/wicked/lib/Driver.php +++ b/wicked/lib/Driver.php @@ -462,7 +462,7 @@ class Wicked_Driver { */ function getCharset() { - return Horde_Nls::getCharset(); + return $GLOBALS['registry']->getCharset(); } /** diff --git a/wicked/lib/Driver/sql.php b/wicked/lib/Driver/sql.php index 1f83df1ef..f3373fa3d 100644 --- a/wicked/lib/Driver/sql.php +++ b/wicked/lib/Driver/sql.php @@ -947,7 +947,7 @@ class Wicked_Driver_sql extends Wicked_Driver { */ function _convertToDriver($value) { - return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->getCharset()); + return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->getCharset()); } /** diff --git a/wicked/lib/Page.php b/wicked/lib/Page.php index 785cba967..87616fdad 100644 --- a/wicked/lib/Page.php +++ b/wicked/lib/Page.php @@ -458,7 +458,7 @@ class Page { $this->_proc->deleteRule('Embed'); } - $this->_proc->setFormatConf('Xhtml', 'charset', Horde_Nls::getCharset()); + $this->_proc->setFormatConf('Xhtml', 'charset', $GLOBALS['registry']->getCharset()); $this->_proc->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS); $create = $this->allows(WICKED_MODE_CREATE) ? 1 : 0; $linkConf = array('pages' => $wicked->getPages(), diff --git a/wicked/lib/Page/MergeOrRename.php b/wicked/lib/Page/MergeOrRename.php index 62fa95f34..f92d6f524 100644 --- a/wicked/lib/Page/MergeOrRename.php +++ b/wicked/lib/Page/MergeOrRename.php @@ -107,8 +107,8 @@ class MergeOrRename extends Page { } foreach ($references as $key => $page) { - $references[$key]['page_url'] = @htmlspecialchars(Wicked::url($page['page_name']), ENT_QUOTES, Horde_Nls::getCharset()); - $references[$key]['page_name'] = @htmlspecialchars($page['page_name'], ENT_QUOTES, Horde_Nls::getCharset()); + $references[$key]['page_url'] = @htmlspecialchars(Wicked::url($page['page_name']), ENT_QUOTES, $GLOBALS['registry']->getCharset()); + $references[$key]['page_name'] = @htmlspecialchars($page['page_name'], ENT_QUOTES, $GLOBALS['registry']->getCharset()); // Since the page name can have [ and ] and other special // characters in it, and we don't want the browser or PHP decoding diff --git a/wicked/lib/Wicked.php b/wicked/lib/Wicked.php index d792c17f5..d344e6654 100644 --- a/wicked/lib/Wicked.php +++ b/wicked/lib/Wicked.php @@ -179,7 +179,7 @@ class Wicked { $conf['wicked']['notify_address'], 'from' => $from . '<' . $from_addr . '>', - 'charset' => Horde_Nls::getCharset())); + 'charset' => $GLOBALS['registry']->getCharset())); $mail->addHeader('User-Agent', 'Wicked ' . $GLOBALS['registry']->getVersion()); $mail->addHeader('Precedence', 'bulk'); $mail->addHeader('Auto-Submitted', 'auto-replied'); diff --git a/wicked/opensearch.php b/wicked/opensearch.php index 2cf324315..64f97d98a 100644 --- a/wicked/opensearch.php +++ b/wicked/opensearch.php @@ -24,7 +24,7 @@ $name = $registry->get('name', 'wicked') . ' (' . $url . ')'; $icon = base64_encode(file_get_contents($registry->get('themesfs', 'wicked') . '/graphics/wicked.png')); // Charset. -$charset = Horde_Nls::getCharset(); +$charset = $GLOBALS['registry']->getCharset(); header('Content-Type: text/xml; charset=' . $charset); echo <<getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/wicked/templates/edit/new.inc b/wicked/templates/edit/new.inc index 0b1ea11a4..d36c17270 100644 --- a/wicked/templates/edit/new.inc +++ b/wicked/templates/edit/new.inc @@ -26,7 +26,7 @@ function preview()
    - +
    diff --git a/wicked/templates/edit/standard.inc b/wicked/templates/edit/standard.inc index 12c02106d..2b69b831f 100644 --- a/wicked/templates/edit/standard.inc +++ b/wicked/templates/edit/standard.inc @@ -45,7 +45,7 @@ if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getA
    - +
    diff --git a/wicked/templates/history/summary.inc b/wicked/templates/history/summary.inc index 6ede924a2..4278964c5 100644 --- a/wicked/templates/history/summary.inc +++ b/wicked/templates/history/summary.inc @@ -40,5 +40,5 @@ if ($show_restore) {
    - +
    - +   diff --git a/jeta/templates/common-header.inc b/jeta/templates/common-header.inc index a377c5c83..4ce99b381 100644 --- a/jeta/templates/common-header.inc +++ b/jeta/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/jonah/delivery/rss.php b/jonah/delivery/rss.php index 7d0a61992..68da83abb 100644 --- a/jonah/delivery/rss.php +++ b/jonah/delivery/rss.php @@ -62,22 +62,22 @@ if (is_a($stories, 'PEAR_Error')) { $template = new Horde_Template(); -$template->set('charset', Horde_Nls::getCharset()); +$template->set('charset', $GLOBALS['registry']->getCharset()); $template->set('jonah', 'Jonah ' . $registry->getVersion() . ' (http://www.horde.org/jonah/)'); $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl'); if (!empty($criteria['tag_id'])) { - $template->set('channel_name', sprintf(_("Stories tagged with %s in %s"), $tag_name, @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset()))); + $template->set('channel_name', sprintf(_("Stories tagged with %s in %s"), $tag_name, @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()))); } else { - $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset())); + $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())); } -$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, Horde_Nls::getCharset())); +$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset())); $template->set('channel_updated', htmlspecialchars(date('r', $channel['channel_updated']))); $template->set('channel_official', htmlspecialchars($channel['channel_official'])); $template->set('channel_rss', htmlspecialchars(Horde_Util::addParameter(Horde::applicationUrl('delivery/rss.php', true, -1), array('type' => 'rss', 'channel_id' => $channel['channel_id'])))); $template->set('channel_rss2', htmlspecialchars(Horde_Util::addParameter(Horde::applicationUrl('delivery/rss.php', true, -1), array('type' => 'rss2', 'channel_id' => $channel['channel_id'])))); foreach ($stories as &$story) { - $story['story_title'] = @htmlspecialchars($story['story_title'], ENT_COMPAT, Horde_Nls::getCharset()); - $story['story_desc'] = @htmlspecialchars($story['story_desc'], ENT_COMPAT, Horde_Nls::getCharset()); + $story['story_title'] = @htmlspecialchars($story['story_title'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); + $story['story_desc'] = @htmlspecialchars($story['story_desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); $story['story_link'] = htmlspecialchars($story['story_link']); $story['story_permalink'] = (isset($story['story_permalink']) ? htmlspecialchars($story['story_permalink']) : ''); $story['story_published'] = htmlspecialchars(date('r', $story['story_published'])); diff --git a/jonah/lib/Block/latest.php b/jonah/lib/Block/latest.php index 9b0a3a63d..4781c5b39 100644 --- a/jonah/lib/Block/latest.php +++ b/jonah/lib/Block/latest.php @@ -57,11 +57,11 @@ class Horde_Block_Jonah_latest extends Horde_Block { $story = $this->_fetch(); return is_a($story, 'PEAR_Error') - ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, Horde_Nls::getCharset()) + ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) : ' ' - . @htmlspecialchars($story['story_title'], ENT_COMPAT, Horde_Nls::getCharset()); + . @htmlspecialchars($story['story_title'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); } /** diff --git a/jonah/lib/Block/news.php b/jonah/lib/Block/news.php index 50e5690f9..4bd45c543 100644 --- a/jonah/lib/Block/news.php +++ b/jonah/lib/Block/news.php @@ -60,15 +60,15 @@ class Horde_Block_Jonah_news extends Horde_Block { $news = Jonah_News::factory(); $channel = $news->getChannel($this->_params['source']); if (is_a($channel, 'PEAR_Error')) { - return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, Horde_Nls::getCharset()); + return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } if (!empty($channel['channel_link'])) { $title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank') - . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset()) + . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; } else { - $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset()); + $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); } return $title; diff --git a/jonah/lib/Block/news_popular.php b/jonah/lib/Block/news_popular.php index af29ef874..0c34b8074 100644 --- a/jonah/lib/Block/news_popular.php +++ b/jonah/lib/Block/news_popular.php @@ -57,15 +57,15 @@ class Horde_Block_Jonah_news_popular extends Horde_Block { $news = Jonah_News::factory(); $channel = $news->getChannel($this->_params['source']); if (is_a($channel, 'PEAR_Error')) { - return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, Horde_Nls::getCharset()); + return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } if (!empty($channel['channel_link'])) { $title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank') - . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset()) + . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()) . _(" - Most read stories") . ''; } else { - $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset()) + $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()) . _(" - Most read stories"); } diff --git a/jonah/lib/Block/story.php b/jonah/lib/Block/story.php index ad2c1fb09..a3ea14af3 100644 --- a/jonah/lib/Block/story.php +++ b/jonah/lib/Block/story.php @@ -57,11 +57,11 @@ class Horde_Block_Jonah_story extends Horde_Block { $story = $this->_fetch(); return is_a($story, 'PEAR_Error') - ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, Horde_Nls::getCharset()) + ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) : ' ' - . @htmlspecialchars($story['story_title'], ENT_COMPAT, Horde_Nls::getCharset()); + . @htmlspecialchars($story['story_title'], ENT_COMPAT, $GLOBALS['registry']->getCharset()); } /** diff --git a/jonah/lib/Driver.php b/jonah/lib/Driver.php index 37095727c..4a5004c98 100644 --- a/jonah/lib/Driver.php +++ b/jonah/lib/Driver.php @@ -477,18 +477,18 @@ class Jonah_Driver $body_text = Horde_Text_Filter::filter($body_html, 'html2text'); /* Add description. */ - $body_html = '

    ' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => Horde_Nls::getCharset(), 'class' => null, 'callback' => null)) . "

    \n" . $body_html; + $body_html = '

    ' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "

    \n" . $body_html; $body_text = Horde_String::wrap(' ' . $story['story_desc'], 70) . "\n\n" . $body_text; /* Add the text version of the story to the base message. */ $message_text = new MIME_Part('text/plain'); - $message_text->setCharset(Horde_Nls::getCharset()); + $message_text->setCharset($GLOBALS['registry']->getCharset()); $message_text->setContents($message_text->replaceEOL($body_text)); $message_text->setDescription(_("Plaintext Version of Story")); /* Add an HTML version of the story to the base message. */ $message_html = new MIME_Part('text/html', Horde_String::wrap($body_html), - Horde_Nls::getCharset(), 'inline'); + $GLOBALS['registry']->getCharset(), 'inline'); $message_html->setDescription(_("HTML Version of Story")); /* Add the two parts as multipart/alternative. */ @@ -502,7 +502,7 @@ class Jonah_Driver /* This is just a plain text story. */ $message_text = new MIME_Part('text/plain'); $message_text->setContents($message_text->replaceEOL($story['story_desc'] . "\n\n" . $story['story_body'])); - $message_text->setCharset(Horde_Nls::getCharset()); + $message_text->setCharset($GLOBALS['registry']->getCharset()); return $message_text; } diff --git a/jonah/lib/Driver/Sql.php b/jonah/lib/Driver/Sql.php index 71338d5c7..504f14679 100644 --- a/jonah/lib/Driver/Sql.php +++ b/jonah/lib/Driver/Sql.php @@ -93,7 +93,7 @@ class Jonah_Driver_Sql extends Jonah_Driver array_unshift($values, (int)$info['channel_id'], - Horde_String::convertCharset($info['channel_name'], Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($info['channel_name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']), (int)$info['channel_type'], isset($info['channel_desc']) ? $info['channel_desc'] : null, isset($info['channel_interval']) ? (int)$info['channel_interval'] : null, @@ -273,10 +273,10 @@ class Jonah_Driver_Sql extends Jonah_Driver array_unshift($values, (int)$info['story_id'], (int)$info['channel_id'], - Horde_String::convertCharset($info['story_title'], Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($info['story_desc'], Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($info['story_title'], $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($info['story_desc'], $GLOBALS['registry']->getCharset(), $this->_params['charset']), $info['story_body_type'], - isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], Horde_Nls::getCharset(), $this->_params['charset']) : null, + isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null, isset($info['story_url']) ? $info['story_url'] : null, isset($info['story_published']) ? (int)$info['story_published'] : null, time(), @@ -303,13 +303,13 @@ class Jonah_Driver_Sql extends Jonah_Driver */ protected function _convertFromBackend($story) { - $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], Horde_Nls::getCharset()); - $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], Horde_Nls::getCharset()); + $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); + $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); if (isset($story['story_body'])) { - $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], Horde_Nls::getCharset()); + $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); } if (isset($story['story_tags'])) { - $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], Horde_Nls::getCharset()); + $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); } return $story; } diff --git a/jonah/lib/News.php b/jonah/lib/News.php index e849727ee..12bf8fbbc 100644 --- a/jonah/lib/News.php +++ b/jonah/lib/News.php @@ -400,10 +400,10 @@ class Jonah_News $cache = $GLOBALS['injector']->getInstance('Horde_Cache'); $timestamp = time(); if (is_a($cache, 'Horde_Cache') && ($stories = $cache->get($url, $interval))) { - $stories = Horde_Serialize::unserialize($stories, Horde_Serialize::UTF7_BASIC, Horde_Nls::getCharset()); + $stories = Horde_Serialize::unserialize($stories, Horde_Serialize::UTF7_BASIC, $GLOBALS['registry']->getCharset()); } else { $stories = Jonah_News::_fetchExternalStories($url, $timestamp); - $cache->set($url, Horde_Serialize::serialize($stories, Horde_Serialize::UTF7_BASIC, Horde_Nls::getCharset())); + $cache->set($url, Horde_Serialize::serialize($stories, Horde_Serialize::UTF7_BASIC, $GLOBALS['registry']->getCharset())); } /* If the stories from cache return the same timestamp as @@ -630,18 +630,18 @@ class Jonah_News $body_text = Horde_Text_Filter::filter($body_html, 'html2text'); /* Add description. */ - $body_html = '

    ' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => Horde_Nls::getCharset(), 'class' => null, 'callback' => null)) . "

    \n" . $body_html; + $body_html = '

    ' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "

    \n" . $body_html; $body_text = Horde_String::wrap(' ' . $story['story_desc'], 70) . "\n\n" . $body_text; /* Add the text version of the story to the base message. */ $message_text = new MIME_Part('text/plain'); - $message_text->setCharset(Horde_Nls::getCharset()); + $message_text->setCharset($GLOBALS['registry']->getCharset()); $message_text->setContents($message_text->replaceEOL($body_text)); $message_text->setDescription(_("Plaintext Version of Story")); /* Add an HTML version of the story to the base message. */ $message_html = new MIME_Part('text/html', Horde_String::wrap($body_html), - Horde_Nls::getCharset(), 'inline'); + $GLOBALS['registry']->getCharset(), 'inline'); $message_html->setDescription(_("HTML Version of Story")); /* Add the two parts as multipart/alternative. */ @@ -655,7 +655,7 @@ class Jonah_News /* This is just a plain text story. */ $message_text = new MIME_Part('text/plain'); $message_text->setContents($message_text->replaceEOL($story['story_desc'] . "\n\n" . $story['story_body'])); - $message_text->setCharset(Horde_Nls::getCharset()); + $message_text->setCharset($GLOBALS['registry']->getCharset()); return $message_text; } diff --git a/jonah/lib/News/sql.php b/jonah/lib/News/sql.php index c7f258d7e..8937990d5 100644 --- a/jonah/lib/News/sql.php +++ b/jonah/lib/News/sql.php @@ -91,7 +91,7 @@ class Jonah_News_sql extends Jonah_News { array_unshift($values, (int)$info['channel_id'], - Horde_String::convertCharset($info['channel_name'], Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($info['channel_name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']), isset($info['channel_slug']) ? $info['channel_slug'] : '', (int)$info['channel_type'], (int)$info['channel_full_feed'], @@ -288,10 +288,10 @@ class Jonah_News_sql extends Jonah_News { array_unshift($values, (int)$info['story_id'], (int)$info['channel_id'], - Horde_String::convertCharset($info['story_title'], Horde_Nls::getCharset(), $this->_params['charset']), - Horde_String::convertCharset($info['story_desc'], Horde_Nls::getCharset(), $this->_params['charset']), + Horde_String::convertCharset($info['story_title'], $GLOBALS['registry']->getCharset(), $this->_params['charset']), + Horde_String::convertCharset($info['story_desc'], $GLOBALS['registry']->getCharset(), $this->_params['charset']), $info['story_body_type'], - isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], Horde_Nls::getCharset(), $this->_params['charset']) : null, + isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null, isset($info['story_url']) ? $info['story_url'] : null, isset($info['story_published']) ? (int)$info['story_published'] : null, time(), @@ -318,13 +318,13 @@ class Jonah_News_sql extends Jonah_News { */ function _convertFromBackend($story) { - $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], Horde_Nls::getCharset()); - $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], Horde_Nls::getCharset()); + $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); + $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); if (isset($story['story_body'])) { - $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], Horde_Nls::getCharset()); + $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); } if (isset($story['story_tags'])) { - $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], Horde_Nls::getCharset()); + $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], $GLOBALS['registry']->getCharset()); } return $story; } diff --git a/jonah/stories/share.php b/jonah/stories/share.php index 2005c820f..5e5389857 100644 --- a/jonah/stories/share.php +++ b/jonah/stories/share.php @@ -16,12 +16,12 @@ function _mail($story_part, $from, $recipients, $subject, $note) $mail = new Horde_Mime_Mail(array('subject' => $subject, 'to' => $recipients, 'from' => $from, - 'charset' => Horde_Nls::getCharset())); + 'charset' => $GLOBALS['registry']->getCharset())); $mail->addHeader('User-Agent', 'Jonah ' . $GLOBALS['registry']->getVersion()); /* If a note has been provided, add it to the message as a text part. */ if (strlen($note) > 0) { - $message_note = new MIME_Part('text/plain', null, Horde_Nls::getCharset()); + $message_note = new MIME_Part('text/plain', null, $GLOBALS['registry']->getCharset()); $message_note->setContents($message_note->replaceEOL($note)); $message_note->setDescription(_("Note")); $mail->addMIMEPart($message_note); diff --git a/jonah/templates/common-header.inc b/jonah/templates/common-header.inc index dfbbe6fab..669b955ff 100644 --- a/jonah/templates/common-header.inc +++ b/jonah/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/kastalia/templates/common-header.inc b/kastalia/templates/common-header.inc index 63bc89934..4f3571c73 100755 --- a/kastalia/templates/common-header.inc +++ b/kastalia/templates/common-header.inc @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/koward/lib/Koward/View/shared/_header.html.php b/koward/lib/Koward/View/shared/_header.html.php index 470ed65d9..a5f9cdfa1 100644 --- a/koward/lib/Koward/View/shared/_header.html.php +++ b/koward/lib/Koward/View/shared/_header.html.php @@ -1,6 +1,6 @@ getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/kronolith/data.php b/kronolith/data.php index 4bda27d22..78750e9ae 100644 --- a/kronolith/data.php +++ b/kronolith/data.php @@ -40,7 +40,7 @@ if ($perms->hasAppPermission('max_events') !== true && try { $message = Horde::callHook('perms_denied', array('kronolith:max_events')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.warning', array('content.raw')); $templates[Horde_Data::IMPORT_FILE] = array(KRONOLITH_TEMPLATES . '/data/export.inc'); @@ -168,7 +168,7 @@ case 'export': $calNames[] = $share->get('name'); } - $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), Horde_Nls::getCharset(), 'utf-8')); + $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), $GLOBALS['registry']->getCharset(), 'utf-8')); $data = $iCal->exportvCalendar(); $browser->downloadHeaders(_("events.ics"), 'text/calendar', false, strlen($data)); echo $data; @@ -250,7 +250,7 @@ if (is_array($next_step)) { try { $message = Horde::callHook('perms_denied', array('kronolith:max_events')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); break; @@ -326,7 +326,7 @@ if (is_array($next_step)) { if (Horde_Util::getFormData('import_ajax')) { $stack = $notification->notify(array('listeners' => 'status', 'raw' => true)); if ($stack) { - Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, Horde_Nls::getCharset()) . '));'); + Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . '));'); } Horde::addInlineScript('window.parent.$(window.name).remove();'); Horde::outputInlineScript(); diff --git a/kronolith/edit.php b/kronolith/edit.php index 00e710bd1..d68e194f9 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -31,7 +31,7 @@ function _check_max() try { $message = Horde::callHook('perms_denied', array('kronolith:max_events')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $GLOBALS['notification']->push($message, 'horde.error', array('content.raw')); return false; diff --git a/kronolith/fb.php b/kronolith/fb.php index 666abd589..a6dee72f5 100644 --- a/kronolith/fb.php +++ b/kronolith/fb.php @@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'session_control' => 'none')); // We want to always generate UTF-8 iCalendar data. -Horde_Nls::setCharset('UTF-8'); +$registry->setCharset('UTF-8'); // Determine the username to show free/busy time for. $cal = Horde_Util::getFormData('c'); @@ -33,7 +33,7 @@ if (!$fb) { if ($user) { $prefs = Horde_Prefs::singleton($conf['prefs']['driver'], 'kronolith', $user, '', null, false); $prefs->retrieve(); - Horde_Nls::setTimeZone(); + $registry->setTimeZone(); $cal = @unserialize($prefs->getValue('fb_cals')); if (is_array($cal)) { $cal = implode('|', $cal); @@ -60,7 +60,7 @@ if (!$fb) { } $browser->downloadHeaders(($user ? $user : $cal) . '.vfb', - 'text/calendar; charset=' . Horde_Nls::getCharset(), + 'text/calendar; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($fb)); echo $fb; diff --git a/kronolith/feed/index.php b/kronolith/feed/index.php index f38476939..7fff2fc00 100644 --- a/kronolith/feed/index.php +++ b/kronolith/feed/index.php @@ -91,17 +91,17 @@ $history = $injector->getInstance('Horde_History'); $now = new Horde_Date(time()); $template = $injector->createInstance('Horde_Template'); -$template->set('charset', Horde_Nls::getCharset()); +$template->set('charset', $GLOBALS['registry']->getCharset()); $template->set('updated', $now->format(DATE_ATOM)); $template->set('kronolith_name', 'Kronolith'); $template->set('kronolith_version', $registry->getVersion()); $template->set('kronolith_uri', 'http://www.horde.org/kronolith/'); $template->set('kronolith_icon', Horde::url(Horde_Themes::img('kronolith.png'), true, -1)); $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl'); -$template->set('calendar_name', @htmlspecialchars($share->get('name'), ENT_COMPAT, Horde_Nls::getCharset())); -$template->set('calendar_desc', @htmlspecialchars($share->get('desc'), ENT_COMPAT, Horde_Nls::getCharset()), true); -$template->set('calendar_owner', @htmlspecialchars($identity->getValue('fullname'), ENT_COMPAT, Horde_Nls::getCharset())); -$template->set('calendar_email', @htmlspecialchars($identity->getValue('from_addr'), ENT_COMPAT, Horde_Nls::getCharset()), true); +$template->set('calendar_name', @htmlspecialchars($share->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset())); +$template->set('calendar_desc', @htmlspecialchars($share->get('desc'), ENT_COMPAT, $GLOBALS['registry']->getCharset()), true); +$template->set('calendar_owner', @htmlspecialchars($identity->getValue('fullname'), ENT_COMPAT, $GLOBALS['registry']->getCharset())); +$template->set('calendar_email', @htmlspecialchars($identity->getValue('from_addr'), ENT_COMPAT, $GLOBALS['registry']->getCharset()), true); $template->set('self_url', $self_url); $twentyFour = $prefs->getValue('twentyFor'); @@ -117,7 +117,7 @@ foreach ($events as $day_events) { } $modified = new Horde_Date($modified); /* Description. */ - $desc = @htmlspecialchars($event->description, ENT_COMPAT, Horde_Nls::getCharset()); + $desc = @htmlspecialchars($event->description, ENT_COMPAT, $GLOBALS['registry']->getCharset()); if (strlen($desc)) { $desc .= '

    '; } @@ -134,15 +134,15 @@ foreach ($events as $day_events) { $attendees[] = empty($status['name']) ? $attendee : Horde_Mime_Address::trimAddress($status['name'] . (strpos($attendee, '@') === false ? '' : ' <' . $attendee . '>')); } if (count($attendees)) { - $desc .= '
    ' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, Horde_Nls::getCharset()); + $desc .= '
    ' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } if (strlen($event->location)) { - $desc .= '
    ' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, Horde_Nls::getCharset()); + $desc .= '
    ' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $desc .= '
    ' . _("Event Status:") . ' ' . Kronolith::statusToString($event->status); - $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, Horde_Nls::getCharset()); - $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, Horde_Nls::getCharset()); + $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()); + $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, $GLOBALS['registry']->getCharset()); $entries[$id]['url'] = htmlspecialchars(Horde::url($event->getViewUrl(), true, -1)); $entries[$id]['modified'] = $modified->format(DATE_ATOM); } diff --git a/kronolith/lib/Ajax/Application.php b/kronolith/lib/Ajax/Application.php index 54a8d36b6..a9356b616 100644 --- a/kronolith/lib/Ajax/Application.php +++ b/kronolith/lib/Ajax/Application.php @@ -100,7 +100,7 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base try { $message = Horde::callHook('perms_denied', array('kronolith:max_events')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $GLOBALS['notification']->push($message, 'horde.error', array('content.raw')); return $result; diff --git a/kronolith/lib/Api.php b/kronolith/lib/Api.php index acb5ea939..3c31ccf2e 100644 --- a/kronolith/lib/Api.php +++ b/kronolith/lib/Api.php @@ -775,7 +775,7 @@ class Kronolith_Api extends Horde_Registry_Api $share = $kronolith_shares->getShare($event->calendar); $iCal = new Horde_iCalendar($version); - $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'utf-8')); + $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'utf-8')); // Create a new vEvent. $iCal->addComponent($event->toiCalendar($iCal)); @@ -825,9 +825,9 @@ class Kronolith_Api extends Horde_Registry_Api $share = $kronolith_shares->getShare($calendar); $iCal = new Horde_iCalendar($version); - $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'UTF-8')); + $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'UTF-8')); if (strlen($share->get('desc'))) { - $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), Horde_Nls::getCharset(), 'UTF-8')); + $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), $GLOBALS['registry']->getCharset(), 'UTF-8')); } foreach ($events as $dayevents) { @@ -1215,7 +1215,7 @@ class Kronolith_Api extends Horde_Registry_Api if (($reminder == 'owner' && $alarm_user == $owner) || ($reminder == 'show' && in_array($calendar, $shown_calendars)) || $reminder == 'read') { - Horde_Nls::setLanguageEnvironment($prefs->getValue('language')); + $GLOBALS['registry']->setLanguageEnvironment($prefs->getValue('language')); $alarm = $event->toAlarm($time, $alarm_user, $prefs); if ($alarm) { $alarm_list[] = $alarm; diff --git a/kronolith/lib/Application.php b/kronolith/lib/Application.php index 5eb1e7c33..fce6980a8 100644 --- a/kronolith/lib/Application.php +++ b/kronolith/lib/Application.php @@ -65,7 +65,7 @@ class Kronolith_Application extends Horde_Registry_Application } /* Set the timezone variable, if available. */ - Horde_Nls::setTimeZone(); + $GLOBALS['registry']->setTimeZone(); /* Create a share instance. */ $GLOBALS['kronolith_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope(); diff --git a/kronolith/lib/Block/tree_alarms.php b/kronolith/lib/Block/tree_alarms.php index 994f35e06..f4c0dea12 100644 --- a/kronolith/lib/Block/tree_alarms.php +++ b/kronolith/lib/Block/tree_alarms.php @@ -30,7 +30,7 @@ class Horde_Block_kronolith_tree_alarms extends Horde_Block { $alarmCount++; $tree->addNode($parent . $calId . $event->id, $parent, - htmlspecialchars($event->getTitle(), ENT_COMPAT, Horde_Nls::getCharset()), + htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()), $indent + 1, false, array('icon' => 'alarm.png', diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index a0b32f4e2..5d0a07804 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -984,7 +984,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver */ public function convertToDriver($value) { - return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']); + return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']); } /** diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 8d670c8eb..19cb5a1a0 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -567,17 +567,17 @@ abstract class Kronolith_Event $vEvent->setAttribute('LAST-MODIFIED', $modified); } - $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), Horde_Nls::getCharset(), 'utf-8')); + $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), $GLOBALS['registry']->getCharset(), 'utf-8')); $name = Kronolith::getUserName($this->creator); if (!$v1) { - $name = Horde_String::convertCharset($name, Horde_Nls::getCharset(), 'utf-8'); + $name = Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'utf-8'); } $vEvent->setAttribute('ORGANIZER', 'mailto:' . Kronolith::getUserEmail($this->creator), array('CN' => $name)); if (!$this->private || $this->creator == $GLOBALS['registry']->getAuth()) { if (!empty($this->description)) { - $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, Horde_Nls::getCharset(), 'utf-8')); + $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), 'utf-8')); } // Tags @@ -586,12 +586,12 @@ abstract class Kronolith_Event $tags = implode(', ', $tags); } if (!empty($tags)) { - $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, Horde_Nls::getCharset(), 'utf-8')); + $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, $GLOBALS['registry']->getCharset(), 'utf-8')); } // Location if (!empty($this->location)) { - $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, Horde_Nls::getCharset(), 'utf-8')); + $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, $GLOBALS['registry']->getCharset(), 'utf-8')); } if ($this->geoLocation) { $vEvent->setAttribute('GEO', array('latitude' => $this->geoLocation['lat'], 'longitude' => $this->geoLocation['lon'])); @@ -709,7 +709,7 @@ abstract class Kronolith_Event } } else { if (!empty($status['name'])) { - $params['CN'] = Horde_String::convertCharset($status['name'], Horde_Nls::getCharset(), 'utf-8'); + $params['CN'] = Horde_String::convertCharset($status['name'], $GLOBALS['registry']->getCharset(), 'utf-8'); } if (!empty($email)) { $email = 'mailto:' . $email; @@ -1085,7 +1085,7 @@ abstract class Kronolith_Event */ public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message) { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); /* New event? */ if ($this->id === null) { @@ -1212,7 +1212,7 @@ abstract class Kronolith_Event */ public function toASAppointment() { - $charset = Horde_Nls::getCharset(); + $charset = $GLOBALS['registry']->getCharset(); $message = new Horde_ActiveSync_Message_Appointment(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger'))); $message->setSubject(Horde_String::convertCharset($this->getTitle(), $charset, 'utf-8')); @@ -2001,7 +2001,7 @@ abstract class Kronolith_Event // Convert IDN hosts to ASCII. if (Horde_Util::extensionExists('idn')) { $old_error = error_reporting(0); - $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], Horde_Nls::getCharset(), 'UTF-8')); + $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8')); error_reporting($old_error); } elseif (Horde_Mime::is8bit($url['host'])) { //throw new Kronolith_Exception(_("Invalid character in URL.")); @@ -2654,7 +2654,7 @@ abstract class Kronolith_Event '', array('style' => $this->getCSSColors(false))); } - $link .= @htmlspecialchars($event_title, ENT_QUOTES, Horde_Nls::getCharset()); + $link .= @htmlspecialchars($event_title, ENT_QUOTES, $GLOBALS['registry']->getCharset()); if ($read_permission && $view_url) { $link .= ''; } diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 628afd023..cbc71995c 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -79,7 +79,7 @@ class Kronolith Horde_Ui_JsCalendar::init(array('short_weekdays' => true)); if (isset($GLOBALS['language'])) { - header('Content-type: text/html; charset=' . Horde_Nls::getCharset()); + header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset()); header('Vary: Accept-Language'); } @@ -396,7 +396,7 @@ class Kronolith // Maps $code['conf']['maps'] = $GLOBALS['conf']['maps']; - return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ';'); + return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $registry->getCharset()) . ';'); } /** @@ -1653,7 +1653,7 @@ class Kronolith $userName = $identity->getName(); $mail = new Horde_Mime_Mail( array('from' => $identity->getDefaultFromAddress(true), - 'charset' => Horde_Nls::getCharset()) + 'charset' => $GLOBALS['registry']->getCharset()) ); $mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion()); } @@ -1684,7 +1684,7 @@ class Kronolith } $mail->addHeader('Subject', _("Ownership assignment")); $mail->addHeader('To', $to); - $mail->setBody($message, Horde_Nls::getCharset()); + $mail->setBody($message, $GLOBALS['registry']->getCharset()); $mail->send($GLOBALS['injector']->getInstance('Horde_Mail')); } } @@ -1838,7 +1838,7 @@ class Kronolith $share->get('name')); } $mail->addHeader('To', $to); - $mail->setBody($message, Horde_Nls::getCharset()); + $mail->setBody($message, $GLOBALS['registry']->getCharset()); $mail->send($GLOBALS['injector']->getInstance('Horde_Mail')); } } @@ -1894,7 +1894,7 @@ class Kronolith $share->get('name')); } $mail->addHeader('To', $groupOb->getName() . ' <' . $groupOb->data['email'] . '>'); - $mail->setBody($message, Horde_Nls::getCharset()); + $mail->setBody($message, $GLOBALS['registry']->getCharset()); $mail->send($GLOBALS['injector']->getInstance('Horde_Mail')); } } @@ -2160,7 +2160,7 @@ class Kronolith public static function sendITipNotifications($event, $notification, $action, $instance = null) { - global $conf; + global $conf, $registry; if (!$event->attendees) { return; @@ -2239,7 +2239,7 @@ class Kronolith /* Build the iCalendar data */ $iCal = new Horde_iCalendar(); $iCal->setAttribute('METHOD', $method); - $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'utf-8')); + $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $registry->getCharset(), 'utf-8')); $vevent = $event->toiCalendar($iCal); if ($action == self::ITIP_CANCEL && !empty($instance)) { // Recurring event instance deletion, need to specify the @@ -2256,18 +2256,18 @@ class Kronolith $ics->setContents($iCal->exportvCalendar()); $ics->setName($filename); $ics->setContentTypeParameter('METHOD', $method); - $ics->setCharset(Horde_Nls::getCharset()); + $ics->setCharset($registry->getCharset()); $multipart = new Horde_Mime_Part(); $multipart->setType('multipart/alternative'); $bodyText = new Horde_Mime_Part(); $bodyText->setType('text/plain'); - $bodyText->setCharset(Horde_Nls::getCharset()); + $bodyText->setCharset($registry->getCharset()); $bodyText->setContents($view->render('notification.plain.php')); $multipart->addPart($bodyText); $bodyHtml = new Horde_Mime_Part(); $bodyHtml->setType('text/html'); - $bodyHtml->setCharset(Horde_Nls::getCharset()); + $bodyHtml->setCharset($registry->getCharset()); $bodyHtml->setContents($view->render('notification.html.php')); $multipart->addPart($bodyHtml); $multipart->addPart($ics); @@ -2275,7 +2275,7 @@ class Kronolith $mail = new Horde_Mime_Mail(array('subject' => $view->subject, 'to' => $recipient, 'from' => $ident->getDefaultFromAddress(true), - 'charset' => Horde_Nls::getCharset())); + 'charset' => $registry->getCharset())); $mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion()); $mail->setBasePart($multipart); @@ -2373,7 +2373,7 @@ class Kronolith } foreach ($addresses as $lang => $twentyFour) { - Horde_Nls::setLanguageEnvironment($lang); + $GLOBALS['registry']->setLanguageEnvironment($lang); switch ($action) { case 'add': @@ -2405,9 +2405,9 @@ class Kronolith $mime_mail = new Horde_Mime_Mail(array('subject' => $subject . ' ' . $event->title, 'to' => implode(',', $df_recipients), 'from' => $identity->getDefaultFromAddress(true), - 'charset' => Horde_Nls::getCharset())); + 'charset' => $GLOBALS['registry']->getCharset())); $mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion()); - $mime_mail->setBody($message, Horde_Nls::getCharset(), true); + $mime_mail->setBody($message, $GLOBALS['registry']->getCharset(), true); Horde::logMessage(sprintf('Sending event notifications for %s to %s', $event->title, implode(', ', $df_recipients)), 'DEBUG'); $mime_mail->send($GLOBALS['injector']->getInstance('Horde_Mail'), false, false); } diff --git a/kronolith/lib/View/ExportEvent.php b/kronolith/lib/View/ExportEvent.php index ffe4edb3c..ac5443453 100644 --- a/kronolith/lib/View/ExportEvent.php +++ b/kronolith/lib/View/ExportEvent.php @@ -30,7 +30,7 @@ class Kronolith_View_ExportEvent { $iCal->setAttribute( 'X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), - Horde_Nls::getCharset(), + $GLOBALS['registry']->getCharset(), 'utf-8')); } catch (Exception $e) { } @@ -41,7 +41,7 @@ class Kronolith_View_ExportEvent { $GLOBALS['browser']->downloadHeaders( $event->getTitle() . '.ics', - 'text/calendar; charset=' . Horde_Nls::getCharset(), + 'text/calendar; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($content)); echo $content; exit; diff --git a/kronolith/new.php b/kronolith/new.php index 200856d07..157cc3121 100644 --- a/kronolith/new.php +++ b/kronolith/new.php @@ -22,7 +22,7 @@ if ($perms->hasAppPermission('max_events') !== true && try { $message = Horde::callHook('perms_denied', array('kronolith:max_events')); } catch (Horde_Exception_HookNotSet $e) { - $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset()); + $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset()); } $notification->push($message, 'horde.error', array('content.raw')); header('Location: ' . $url); diff --git a/kronolith/scripts/agenda.php b/kronolith/scripts/agenda.php index d260db56a..d8f79b430 100755 --- a/kronolith/scripts/agenda.php +++ b/kronolith/scripts/agenda.php @@ -130,11 +130,11 @@ function send_agendas() $lang = $prefs->getValue('language'); $twentyFour = $prefs->getValue('twentyFour'); $dateFormat = $prefs->getValue('date_format'); - Horde_Nls::setLanguageEnvironment($lang); + $GLOBALS['registry']->setLanguageEnvironment($lang); $mime_mail = new Horde_Mime_Mail(array('subject' => sprintf(_("Your daily agenda for %s"), $runtime->strftime($dateFormat)), 'to' => $email, 'from' => $GLOBALS['conf']['reminder']['from_addr'], - 'charset' => Horde_Nls::getCharset())); + 'charset' => $GLOBALS['registry']->getCharset())); $mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion()); $pad = max(Horde_String::length(_("All day")) + 2, $twentyFour ? 6 : 8); @@ -151,7 +151,7 @@ function send_agendas() $message .= $event->title . "\n"; } - $mime_mail->setBody($message, Horde_Nls::getCharset(), true); + $mime_mail->setBody($message, $GLOBALS['registry']->getCharset(), true); try { $mime_mail->addRecipients($email); } catch (Horde_Mime_Exception $e) {} diff --git a/kronolith/templates/common-header.inc b/kronolith/templates/common-header.inc index 125a8b992..f78aa19fa 100644 --- a/kronolith/templates/common-header.inc +++ b/kronolith/templates/common-header.inc @@ -5,7 +5,7 @@ Horde::addScriptFile('views.js', 'kronolith'); Horde::addScriptFile('stripe.js', 'horde'); if (isset($language)) { - header('Content-type: text/html; charset=' . Horde_Nls::getCharset()); + header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset()); header('Vary: Accept-Language'); } ?> diff --git a/kronolith/templates/itip/notification.html.php b/kronolith/templates/itip/notification.html.php index 6391a8dc1..12fea806d 100644 --- a/kronolith/templates/itip/notification.html.php +++ b/kronolith/templates/itip/notification.html.php @@ -22,7 +22,7 @@ event->description)): ?>
    event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => Horde_Nls::getCharset())) ?>event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => $GLOBALS['registry']->getCharset())) ?>
       getCharset()) ?>
      strftime($dateFormat) . ' ' . $created->format($timeFormat) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, Horde_Nls::getCharset()) ?>strftime($dateFormat) . ' ' . $created->format($timeFormat) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
      strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, Horde_Nls::getCharset()) ?>strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
     getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, Horde_Nls::getCharset()) ?>getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
     getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, Horde_Nls::getCharset()) ?>getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
    getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, Horde_Nls::getCharset()) ?>getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
    getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, Horde_Nls::getCharset()) ?>getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
    changeLog(), ENT_COMPAT, Horde_Nls::getcharset()) ?>changeLog(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>