Remove getCharset().
authorJan Schneider <jan@horde.org>
Sun, 3 Oct 2010 01:22:39 +0000 (03:22 +0200)
committerJan Schneider <jan@horde.org>
Sun, 3 Oct 2010 16:51:08 +0000 (18:51 +0200)
245 files changed:
agora/lib/Agora.php
agora/lib/Messages.php
agora/lib/View.php
agora/messages/abuse.php
agora/rss/index.php
agora/rss/messages.php
agora/rss/threads.php
agora/templates/common-header.inc
ansel/gallery/sort.php
ansel/img/ecard.php
ansel/lib/Ansel.php
ansel/lib/Block/gallery.php
ansel/lib/Block/my_galleries.php
ansel/lib/Block/recent_comments.php
ansel/lib/Block/recent_faces.php
ansel/lib/Block/recently_added.php
ansel/lib/GalleryMode/Date.php
ansel/lib/Image.php
ansel/lib/Storage.php
ansel/lib/Tile/DateGallery.php
ansel/lib/Tile/Gallery.php
ansel/lib/View/Base.php
ansel/lib/Widget/Links.php
ansel/rss.php
ansel/templates/captions/captions.inc
ansel/templates/common-header.inc
ansel/templates/faces/gallery.inc
ansel/templates/image/crop_image.inc
ansel/templates/image/edit_image.inc
ansel/templates/image/preview_cropimage.inc
ansel/templates/image/preview_image.inc
ansel/templates/image/resize_image.inc
ansel/templates/list/header.inc
ansel/templates/view/results.inc
ansel/templates/xppublish/new.inc
ansel/xppublish.php
babel/lib/Display.php [new file with mode: 0644]
babel/templates/common-header.inc [new file with mode: 0644]
chora/templates/common-header.inc
crumb/templates/common-header.inc [new file with mode: 0644]
drag_n_drop_portal/block.php [new file with mode: 0644]
drag_n_drop_portal/lib/Block/Layout/View/js.php [new file with mode: 0644]
fima/data.php [new file with mode: 0644]
fima/lib/Driver/sql.php [new file with mode: 0644]
fima/postings.php [new file with mode: 0644]
fima/templates/common-header.inc [new file with mode: 0644]
folks/config/hooks.php.dist
folks/lib/Folks.php
folks/lib/Notification/mail.php
folks/scripts/mail.php
folks/templates/common-header.inc
folks/templates/feed/activities.php
folks/templates/feed/feed.php
framework/Alarm/lib/Horde/Alarm/Sql.php
framework/Block/lib/Horde/Block/Layout/Manager.php
framework/Core/lib/Horde.php
framework/Core/lib/Horde/Config.php
framework/Core/lib/Horde/Core/Ajax/Imple/SpellChecker.php
framework/Core/lib/Horde/Core/Auth/Signup/Base.php
framework/Core/lib/Horde/Core/Factory/Alarm.php
framework/Core/lib/Horde/Core/Factory/Auth.php
framework/Core/lib/Horde/Core/Factory/Crypt.php
framework/Core/lib/Horde/Core/Factory/Data.php
framework/Core/lib/Horde/Core/Factory/MimeViewer.php
framework/Core/lib/Horde/Core/Factory/Prefs.php
framework/Core/lib/Horde/Core/Factory/TextFilter.php
framework/Core/lib/Horde/Core/Notification/Status.php
framework/Core/lib/Horde/Core/Prefs/Identity.php
framework/Core/lib/Horde/Core/Prefs/Ui.php
framework/Core/lib/Horde/Core/Tree/Javascript.php
framework/Core/lib/Horde/Core/Ui/VarRenderer.php
framework/Core/lib/Horde/Registry.php
framework/DataTree/DataTree/sql.php
framework/Form/Form/Renderer.php
framework/Group/lib/Horde/Group/Kolab.php
framework/Group/lib/Horde/Group/Ldap.php
framework/Icalendar/lib/Horde/Icalendar.php
framework/Kolab/Kolab.php
framework/Kolab_Format/lib/Horde/Kolab/Format/Xml.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/Driver/Namespace.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder/Base.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/FolderTest.php
framework/Model/lib/Horde/Form/Renderer/Xhtml.php
framework/Model/lib/Horde/Form/VarRenderer/Xhtml.php
framework/Rampage/scripts/Horde/Rampage/rampage.php
framework/Rpc/lib/Horde/Rpc/Webdav.php
framework/Share/lib/Horde/Share/Sql.php
framework/SpellChecker/lib/Horde/SpellChecker/Aspell.php
gollem/templates/common-header.inc
gollem/templates/javascript_defs.php
hermes/start.php
hermes/templates/common-header.inc
horde/admin/config/config.php
horde/admin/config/scripts.php
horde/admin/sqlshell.php
horde/config/hooks.php.dist
horde/lib/Block/twitter_timeline.php
horde/scripts/upgrades/convert_datatree_groups_to_sql.php
horde/services/portal/index.php
horde/services/problem.php
horde/services/resetpassword.php
horde/services/sidebar.php
horde/services/twitter.php
horde/templates/admin/groups/edit.inc
horde/templates/common-header.inc
hylax/templates/common-header.inc
imp/attachment.php
imp/compose-mimp.php
imp/compose.php
imp/config/hooks.php.dist
imp/contacts.php
imp/folders.php
imp/lib/Ajax/Application.php
imp/lib/Application.php
imp/lib/Block/Newmail.php
imp/lib/Compose.php
imp/lib/Compose/Stationery.php
imp/lib/Contents.php
imp/lib/Crypt/Pgp.php
imp/lib/Crypt/Smime.php
imp/lib/Dimp.php
imp/lib/Folder.php
imp/lib/IMP.php
imp/lib/Imap/Flags.php
imp/lib/LoginTasks/Task/DeleteSentmailMonthly.php
imp/lib/Message.php
imp/lib/Prefs/Ui.php
imp/lib/Spam.php
imp/lib/Ui/Compose.php
imp/lib/Ui/Mailbox.php
imp/lib/Ui/Message.php
imp/lib/Views/Compose.php
imp/lib/Views/ListMessages.php
imp/lib/Views/ShowMessage.php
imp/mailbox-mimp.php
imp/mailbox.php
imp/message-mimp.php
imp/message.php
imp/rss.php
imp/templates/common-header.inc
imp/templates/dimp/javascript_defs_dimp.php
imp/templates/imp/javascript_defs.php
imp/thread.php
imp/view.php
ingo/filters.php
ingo/lib/Ingo.php
ingo/lib/Script.php
ingo/lib/Storage/Filters/Sql.php
ingo/lib/Storage/Prefs.php
ingo/lib/Storage/Sql.php
ingo/rule.php
ingo/templates/common-header.inc
ingo/templates/rule/header.inc
jeta/templates/common-header.inc [new file with mode: 0644]
jonah/delivery/rss.php
jonah/lib/Block/latest.php
jonah/lib/Block/news.php
jonah/lib/Block/news_popular.php
jonah/lib/Block/story.php
jonah/lib/Driver.php
jonah/lib/Driver/Sql.php
jonah/stories/share.php
jonah/templates/common-header.inc
kastalia/templates/common-header.inc [new file with mode: 0755]
koward/lib/Koward/View/shared/_header.html.php
kronolith/add.php
kronolith/data.php
kronolith/edit.php
kronolith/fb.php
kronolith/feed/index.php
kronolith/lib/Ajax/Application.php
kronolith/lib/Api.php
kronolith/lib/Application.php
kronolith/lib/Driver/Sql.php
kronolith/lib/Event.php
kronolith/lib/Kronolith.php
kronolith/lib/View/ExportEvent.php
kronolith/new.php
kronolith/scripts/agenda.php
kronolith/templates/common-header.inc
kronolith/templates/javascript_defs.php
kronolith/templates/view/view.inc
luxor/templates/common-header.inc
mnemo/data.php
mnemo/lib/Driver/sql.php
mnemo/memo.php
mnemo/note/pdf.php
mnemo/templates/common-header.inc
mnemo/templates/view/memo.inc
nag/data.php
nag/lib/Api.php
nag/lib/Driver/Sql.php
nag/lib/Forms/task.php
nag/lib/Nag.php
nag/lib/Task.php
nag/task.php
nag/templates/common-header.inc
nag/templates/view/task.inc
news/mail.php [new file with mode: 0644]
news/pdf.php [new file with mode: 0644]
news/rss/comments.php [new file with mode: 0644]
news/rss/index.php [new file with mode: 0644]
news/rss/news.php [new file with mode: 0755]
news/templates/common-header.inc [new file with mode: 0644]
operator/templates/common-header.inc
pastie/templates/common-header.inc
shout/templates/common-header.inc
shout/templates/dialplan/edit.inc
skeleton/templates/common-header.inc
skoli/templates/common-header.inc [new file with mode: 0644]
trean/add.php
trean/data.php
trean/lib/Bookmarks.php
trean/rss.php
trean/templates/common-header.inc
turba/add.php
turba/config/backends.php.dist
turba/data.php
turba/lib/Driver.php
turba/lib/Driver/Ldap.php
turba/lib/Driver/Sql.php
turba/lib/Object.php
turba/lib/View/Browse.php
turba/templates/common-header.inc
turba/vcard.php
vilma/templates/common-header.inc
whups/lib/Driver.php
whups/lib/Driver/sql.php
whups/opensearch.php
whups/query/rss.php
whups/queue/rss.php
whups/search/rss.php
whups/templates/common-header.inc
whups/ticket/rss.php
wicked/lib/Driver.php
wicked/lib/Driver/sql.php
wicked/lib/Page.php
wicked/lib/Page/MergeOrRename.php
wicked/lib/Text_Wiki/Render/Xhtml/Code2.php
wicked/lib/Wicked.php
wicked/opensearch.php
wicked/templates/common-header.inc
wicked/templates/edit/new.inc
wicked/templates/edit/standard.inc
wicked/templates/history/summary.inc

index 174a12a..23443d9 100644 (file)
@@ -364,7 +364,7 @@ class Agora {
 
         $body = new Horde_Mime_Part();
         $body->setType('text/plain');
-        $body->setCharset($GLOBALS['registry']->getCharset());
+        $body->setCharset('UTF-8');
         $body->setContents($message['body']);
 
         $body->send($forum['forum_distribution_address'], $msg_headers, $conf['mailer']['type'], $conf['mailer']['params']);
index 2214fce..d450a80 100644 (file)
@@ -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> ", $GLOBALS['registry']->getCharset());
+        $message['body'] = "\n> " . Horde_String::wrap($message['body'], 60, "\n> ", 'UTF-8');
 
         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, $GLOBALS['registry']->getCharset());
+            $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, 'UTF-8');
             $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, $GLOBALS['registry']->getCharset());
+            $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, 'UTF-8');
             $message['message_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')filter($this->convertFromDriver($message['body']), 'highlightquotes');
             if ($message['attachments']) {
                 $message['message_attachment'] = $this->getAttachmentLink($id);
@@ -2121,7 +2121,7 @@ class Agora_Messages {
         }
 
         if (!empty($filter['author'])) {
-            $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], $GLOBALS['registry']->getCharset()));
+            $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], 'UTF-8'));
         }
 
         /* Sort by result column. */
@@ -2222,7 +2222,7 @@ class Agora_Messages {
      */
     public function convertToDriver($value)
     {
-        return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+        return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
     }
 
     /**
index d530acd..d1c3d08 100644 (file)
@@ -19,7 +19,7 @@ class Agora_View extends Horde_View {
     {
         /* Set default data. */
         parent::__construct(array('templatePath' => AGORA_TEMPLATES . '/',
-                                  'encoding' => $GLOBALS['registry']->getCharset()));
+                                  'encoding' => 'UTF-8'));
     }
 
 }
index d1e4f44..24740b4 100644 (file)
@@ -72,7 +72,7 @@ if ($form->validate()) {
         'body' => $url . "\n\n" . $registry->getAuth() . "\n\n" . $_SERVER["REMOTE_ADDR"],
         'to' => $emails,
         'from' => $emails[0],
-        'charset' => $GLOBALS['registry']->getCharset()));
+        'charset' => 'UTF-8'));
     $mail->addHeader('User-Agent', 'Agora ' . $registry->getVersion());
     $mail->send($injector->getInstance('Horde_Mail'));
 
index 6f5ed9e..441ac1a 100644 (file)
@@ -24,7 +24,7 @@ if (!$rss) {
     $forums = Agora_Messages::singleton($scope);
     $forums_list = $forums->getForums(0, true, 'forum_name', 0);
 
-    $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+    $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
     <rss version="2.0">
         <channel>
         <title>' . htmlspecialchars($title) . '</title>
@@ -50,5 +50,5 @@ if (!$rss) {
     $cache->set($cache_key, $rss);
 }
 
-header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
+header('Content-type: text/xml; charset=' . 'UTF-8');
 echo $rss;
index 1b35d37..a643241 100644 (file)
@@ -31,7 +31,7 @@ if (!$rss) {
         exit;
     }
 
-    $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+    $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
     <rss version="2.0">
         <channel>
         <title>' . htmlspecialchars($message['message_subject']) . '</title>
@@ -59,5 +59,5 @@ if (!$rss) {
     $cache->set($cache_key, $rss);
 }
 
-header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
+header('Content-type: text/xml; charset=' . 'UTF-8');
 echo $rss;
index 8138433..5e9b37a 100644 (file)
@@ -59,7 +59,7 @@ if (!$rss) {
 
     $threads_list = $threads->getThreads(0, false, 'message_modifystamp', 1, true, '', null, 0, 10);
 
-    $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+    $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
     <rss version="2.0">
         <channel>
         <title>' . htmlspecialchars($title) . '</title>
@@ -98,5 +98,5 @@ if (!$rss) {
     $cache->set($cache_key, $rss);
 }
 
-header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
+header('Content-type: text/xml; charset=' . 'UTF-8');
 echo $rss;
index f9041ec..d8a3bc7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index d386cd4..2a5c600 100644 (file)
@@ -69,7 +69,7 @@ require ANSEL_TEMPLATES . '/common-header.inc';
 echo Horde::menu();
 $notification->notify(array('listeners' => 'status'));
 ?>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
 <div class="instructions">
  <form action="sort.php" method="post">
   <?php echo Horde_Util::formInput() ?>
@@ -91,7 +91,7 @@ $notification->notify(array('listeners' => 'status'));
 <?php
 $images = $gallery->getImages();
 foreach ($images as $image) {
-    $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) : htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+    $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8') : htmlspecialchars($image->caption, ENT_COMPAT, 'UTF-8');
     echo '<div id="o_' . (int)$image->id . '"><a title="'
         . $caption . '" href="#">'
         . '<img src="' . Ansel::getImageUrl($image->id, 'thumb', false, $style) . '" alt="' . htmlspecialchars($image->filename) . '" />'
index 1b38050..d0ec980 100644 (file)
@@ -35,7 +35,7 @@ case 'send':
         break;
     }
 
-    $charset = $GLOBALS['registry']->getCharset();
+    $charset = 'UTF-8';
 
     /* Create the text part. */
     $textpart = new Horde_Mime_Part();
@@ -59,7 +59,7 @@ case 'send':
     $img_tag = '<img src="cid:' . $imgpart->setContentID() . '" /><p />';
     $comments = $htmlpart->replaceEOL(Horde_Util::getFormData('ecard_comments'));
     if (!Horde_Util::getFormData('rtemode')) {
-        $comments = '<pre>' . htmlspecialchars($comments, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</pre>';
+        $comments = '<pre>' . htmlspecialchars($comments, ENT_COMPAT, 'UTF-8') . '</pre>';
     }
     $htmlpart->setContents('<html>' . $img_tag . $comments . '</html>');
     $related->setContentTypeParameter('start', $htmlpart->setContentID());
index 7582ea3..b8a27a7 100644 (file)
@@ -610,7 +610,7 @@ class Ansel
 
         // Check for an active image
         if (!empty($image_id)) {
-            $text = '<span class="thiscrumb" id="PhotoName">' . htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</span>';
+            $text = '<span class="thiscrumb" id="PhotoName">' . htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8') . '</span>';
             $nav = $separator . $text . $nav;
             $levels++;
         }
@@ -635,7 +635,7 @@ class Ansel
         }
 
         if (!empty($owner_title)) {
-            $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, 'UTF-8');
             $levels++;
             if ($gallery) {
                 $nav = $separator . Ansel::getUrlFor('view', array('view' => 'List', 'groupby' => 'owner', 'owner' => $owner, 'havesearch' => $haveSearch))->link() . $owner_title . '</a>' . $nav;
index 9095a0e..73e7209 100644 (file)
@@ -85,7 +85,7 @@ class Horde_Block_ansel_gallery extends Horde_Block
             true);
 
         return $viewurl->link()
-               . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset())
+               . @htmlspecialchars($name, ENT_COMPAT, 'UTF-8')
                . '</a>';
     }
 
index f154dae..62985af 100644 (file)
@@ -98,7 +98,7 @@ HEADER;
             $html .= '<tr><td>'
                 . $url->link(array('onmouseout' => '$("ansel_preview").hide();$("ansel_preview").update("");',
                                    'onmouseover' => 'previewImageMg(event, ' . $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) . ');'))
-                . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a></td><td>'
+                . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8') . '</a></td><td>'
                 . strftime($GLOBALS['prefs']->getValue('date_format'), $gallery->get('last_modified'))
                 . '</td><td>' . (int)$gallery->countImages(true) . '</td></tr>';
         }
index 5efb862..301f3ed 100644 (file)
@@ -64,7 +64,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, $GLOBALS['registry']->getCharset());
+                $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8');
             }
             $viewurl = Ansel::getUrlFor('view',
                                         array('gallery' => $gallery->id,
index 762dd61..c400aa8 100644 (file)
@@ -52,7 +52,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, $GLOBALS['registry']->getCharset());
+            $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, 'UTF-8');
             $html .= '<a href="' . Ansel_Faces::getLink($face) . '" title="' . $facename . '">'
                     . '<img src="' . $faces->getFaceUrl($face['image_id'], $face_id)
                     . '" style="padding-bottom: 5px; padding-left: 5px" alt="' . $facename  . '" /></a>';
index cd20dae..793daf1 100644 (file)
@@ -68,7 +68,7 @@ class Horde_Block_ansel_recently_added extends Horde_Block
                 return Ansel::getUrlFor('view', array('view' => 'List'), true)->link() . _("Gallery") . '</a>';
             }
 
-            $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8');
             $style = $gallery->getStyle();
             $viewurl = Ansel::getUrlFor('view',
                                         array('slug' => $gallery->get('slug'),
@@ -145,7 +145,7 @@ HEADER;
                 true);
             $galleryLink = $galleryLink->link()
                 . @htmlspecialchars($gallery->get('name'), ENT_COMPAT,
-                                    $GLOBALS['registry']->getCharset())
+                                    'UTF-8')
                 . '</a>';
 
             $caption = substr($image->caption, 0, 30);
@@ -168,7 +168,7 @@ HEADER;
                           'onmouseover' => 'previewImage(event, ' . $image->id . ');'))
                 . @htmlspecialchars(
                     strlen($caption) ? $caption : $image->filename,
-                    ENT_COMPAT, $GLOBALS['registry']->getCharset())
+                    ENT_COMPAT, 'UTF-8')
                 . '</a></td><td class="nowrap">' . $galleryLink . '</td></tr>';
         }
         $html .= '</tbody></table>';
index 7684d4a..54bd0a2 100644 (file)
@@ -111,7 +111,7 @@ class Ansel_GalleryMode_Date extends Ansel_GalleryMode_Base
             $trail[] = array('title' => _("All dates"), 'navdata' => $navdata);
         }
 
-        $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+        $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, 'UTF-8');
         $navdata = array('view' => 'Gallery',
                          'gallery' => $this->_gallery->id,
                          'slug' => $this->_gallery->get('slug'));
index da77f7c..5684c55 100644 (file)
@@ -1206,7 +1206,7 @@ class Ansel_Image Implements Iterator
                 $output[$field] = $value;
             } else {
                 $description = isset($data['description']) ? $data['description'] : $field;
-                $output[] = '<td><strong>' . $description . '</strong></td><td>' . htmlspecialchars($value, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</td>';
+                $output[] = '<td><strong>' . $description . '</strong></td><td>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</td>';
             }
         }
 
index fc9ae21..442203f 100644 (file)
@@ -496,9 +496,9 @@ class Ansel_Storage
                 Horde::logMessage($update, 'ERR');
                 throw new Ansel_Exception($update);
             }
-            $result = $update->execute(array(Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+            $result = $update->execute(array(Horde_String::convertCharset($image->filename, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
                                              $image->type,
-                                             Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+                                             Horde_String::convertCharset($image->caption, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
                                              $image->sort,
                                              $image->originalDate,
                                              $image->lat,
@@ -536,9 +536,9 @@ class Ansel_Storage
         /* Perform the INSERT */
         $result = $insert->execute(array($image_id,
                                          $image->gallery,
-                                         Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+                                         Horde_String::convertCharset($image->filename, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
                                          $image->type,
-                                         Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+                                         Horde_String::convertCharset($image->caption, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
                                          $image->uploaded,
                                          $image->sort,
                                          $image->originalDate,
@@ -571,7 +571,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, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset'])));
+        $result = $insert->execute(array($image_id, $attribute, Horde_String::convertCharset($value, 'UTF-8', $GLOBALS['conf']['sql']['charset'])));
         if ($result instanceof PEAR_Error) {
             throw new Ansel_Exception($result);
         }
@@ -899,7 +899,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, $GLOBALS['registry']->getCharset()),
+                    htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8'),
                     $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)),
                     $image->id,
                     0);
@@ -925,7 +925,7 @@ class Ansel_Storage
         }
 
         if (count($json)) {
-            return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
+            return Horde_Serialize::serialize($json, Horde_Serialize::JSON, 'UTF-8');
         } else {
             return '';
         }
index 54a361a..8873b59 100644 (file)
@@ -104,7 +104,7 @@ class Ansel_Tile_DateGallery
 
         /* Variables used in the template file */
         $image_link = $view_link . $gallery_image . '</a>';
-        $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
+        $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, 'UTF-8') . '</a>';
         $gallery_count = $dgallery->countImages(true);
 
         /* Background color is needed if displaying a mini tile */
index ef3188e..4e5217d 100644 (file)
@@ -77,7 +77,7 @@ class Ansel_Tile_Gallery
         }
 
         $image_link = $view_link . $gallery_image . '</a>';
-        $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset())
+        $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8')
                      . '</a>';
 
         if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT) && !$mini) {
@@ -101,7 +101,7 @@ class Ansel_Tile_Gallery
             if (empty($owner_string)) {
                 $owner_string = $gallery->get('owner');
             }
-            $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
+            $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, 'UTF-8') . '</a>';
         }
 
         $gallery_count = $gallery->countImages(true);
index feb8c1b..edb21eb 100644 (file)
@@ -264,7 +264,7 @@ abstract class Ansel_View_Base
             }
 
             $data = array((string)Ansel::getImageUrl($image->id, $params['image_view'], $params['full'], $style),
-                          htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()),
+                          htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8'),
                           $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)),
                           $image->id,
                           $curpage);
@@ -286,7 +286,7 @@ abstract class Ansel_View_Base
             $json[] = $data;
         }
 
-        return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
+        return Horde_Serialize::serialize($json, Horde_Serialize::JSON, 'UTF-8');
     }
 
     /**
index 36e67bb..167a278 100644 (file)
@@ -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")) . '</a>';
         $slug = $this->_view->gallery->get('slug');
-        $html .= '<br />' . 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())) . '</a>';
+        $html .= '<br />' . 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, 'UTF-8')) . '</a>';
 
         /* Embed html */
         if (empty($this->_view->_params['image_id'])) {
index ae6d828..70f18e9 100644 (file)
@@ -263,10 +263,10 @@ if (empty($rss)) {
         }
     }
 
-    $charset = $GLOBALS['registry']->getCharset();
+    $charset = 'UTF-8';
     $xsl = $registry->get('themesuri') . '/feed-rss.xsl';
-    $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
-    $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+    $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, 'UTF-8');
+    $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, 'UTF-8');
     $stream_updated = htmlspecialchars(date('r', $params['last_modified']));
     $stream_official = htmlspecialchars($params['link']);
     $image_url = htmlspecialchars($params['image_url']);
index ad48c75..39f2755 100644 (file)
@@ -7,7 +7,7 @@
 <input type="hidden" name="day" value="<?php echo (empty($date['day']) ? 0 : $date['day']) ?>" />
 
 <h1 class="header">
- <?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
+ <?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?>
 </h1>
 
 <?php if ($gallery->get('desc')): ?>
@@ -33,7 +33,7 @@ if ($gallery->countImages()) {
         echo '<td width="10%" align="right" valign="top">';
         echo '<img src="' . $thumb_url . '" alt="' . htmlspecialchars($image->filename) . '" />' .
             '</td><td width="40%" valign="top"><textarea name="img' . $image->id . '" rows="5" cols="25">' .
-            htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</textarea></td>';
+            htmlspecialchars($image->caption, ENT_COMPAT, 'UTF-8') . '</textarea></td>';
 
         $count++;
         if (($count % 2) == 0) {
index 6615acf..72c02d3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
@@ -21,7 +21,7 @@ Horde::outputMetaTags();
 Horde::includeScriptFiles();
 
 ?>
-<title><?php echo htmlspecialchars($page_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></title>
+<title><?php echo htmlspecialchars($page_title, ENT_COMPAT, 'UTF-8') ?></title>
 <link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
 <?php echo Ansel::stylesheetLinks() ?>
 <?php echo Horde::wrapInlineScript(Ansel::initJSVars());?>
index acbaf34..12a6c14 100644 (file)
@@ -32,7 +32,7 @@
 <?php echo $pager->render() ?>
 <script type="text/javascript">
 //<![CDATA[
-var imgids = <?php echo Horde_Serialize::serialize($imageids, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>;
+var imgids = <?php echo Horde_Serialize::serialize($imageids, Horde_Serialize::JSON, 'UTF-8'); ?>;
 
 function proccessImageFaces(image_id, reget) {
     var url = '<?php echo Horde::url('faces/image.php'); ?>';
index b8cdade..44957f5 100644 (file)
@@ -83,7 +83,7 @@ function changeRatio()
 }
 </script>
 
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
 <div class="control anselActions" style="text-align: center">
 <?php
 $image_src = Ansel::getImageUrl($image_id, 'full');
index 1869993..aa3d0b5 100644 (file)
@@ -1,4 +1,4 @@
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
 <div class="control anselActions" style="text-align: center">
 <div id="prevDiv"></div>
 <?php
index 1bc06b1..227561e 100644 (file)
@@ -1,4 +1,4 @@
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
 <?php
 $base_url = Horde::url('image.php');
 $base_url = $base_url->copy()->add(array_merge(
index 10cb18d..d4063b1 100644 (file)
@@ -1,4 +1,4 @@
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
 <?php
 $base_url = Horde::url('image.php')->add(
         array_merge(
index bfce02a..0e6ef7b 100644 (file)
@@ -29,7 +29,7 @@ function resetImage()
     document.slider.setValue(<?php echo $geometry['height'] ?>);
 }
 </script>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
 <div class="control anselActions" style="text-align: center">
 <?php
 $image_src = Ansel::getImageUrl($image_id, 'full');
index ba63c29..ae75fe3 100644 (file)
@@ -2,6 +2,6 @@
  <span class="rightFloat">
   <?php ($galleries_perpage < $num_galleries) ? printf(_("%d to %d of %d Galleries"), $start, $end, $num_galleries) : printf(ngettext("%d Gallery", "%d Galleries", $num_galleries), $num_galleries) ?>
  </span>
- <?php echo @htmlspecialchars($list_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ' ' . Horde::url($refresh_link)->link(array('title' => _("Refresh List"))) . Horde::img('reload.png', _("Refresh List")) . '</a>' ?>
+ <?php echo @htmlspecialchars($list_title, ENT_COMPAT, 'UTF-8') . ' ' . Horde::url($refresh_link)->link(array('title' => _("Refresh List"))) . Horde::img('reload.png', _("Refresh List")) . '</a>' ?>
 </div>
 <table width="100%" style="background:<?php echo $styleDef->background ?>;"><tr>
index b967198..e7d9c89 100644 (file)
@@ -66,7 +66,7 @@ $allLink = (!empty($this->_owner)) ? Horde::selfUrl()->add(array('view' => 'Resu
 if ($total) {
     echo '<span class="rightFloat">' . ($total > $this->_perPage ? sprintf(_("%d to %d of %d Items"), $this->_pagestart, $this->_pageend, $total) : sprintf(ngettext("%d Item", "%d Items", $total), $total)) . '<small>' . $allLink . '</small></span>';
 }
-echo htmlspecialchars($this->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . $this->_search->getTagTrail();
+echo htmlspecialchars($this->getTitle(), ENT_COMPAT, 'UTF-8') . $this->_search->getTagTrail();
 ?>
 </div>
 
index 4e9a16f..f42255d 100755 (executable)
@@ -21,7 +21,7 @@
     <?php echo _("New Gallery Description") ?>
   </td>
   <td align="left">
-    <textarea name="gallery_desc" cols="33" rows="5"><?php echo htmlspecialchars($gallery_desc, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
+    <textarea name="gallery_desc" cols="33" rows="5"><?php echo htmlspecialchars($gallery_desc, ENT_COMPAT, 'UTF-8') ?></textarea>
   </td>
 </tr>
 </table>
index cc6a9f9..64e0a3e 100644 (file)
@@ -17,7 +17,7 @@ if (empty($cmd)) {
     $publisher->sendRegFile(
         $registry->getApp() . '-' . $conf['server']['name'],
         $registry->get('name'),
-        Horde_String::convertCharset(sprintf(_("Publish your photos to %s on %s."), $registry->get('name'), $conf['server']['name']), $registry->getCharset(), $registry->getCharset(true)),
+        Horde_String::convertCharset(sprintf(_("Publish your photos to %s on %s."), $registry->get('name'), $conf['server']['name']), 'UTF-8', $registry->getLanguageCharset()),
         Horde::url('xppublish.php', true, -1)->add('cmd', 'publish'),
         Horde::url(Horde_Themes::img('favicon.ico'), true, -1));
     exit;
diff --git a/babel/lib/Display.php b/babel/lib/Display.php
new file mode 100644 (file)
index 0000000..e8ba4df
--- /dev/null
@@ -0,0 +1,136 @@
+<?php
+/**
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Joel Vandal <joel@scopserv.com>
+ * @package Babel
+ */
+
+class Translate_Display {
+
+    function header($msg, $msg2 = '') {
+       global $cnt_i, $registry;
+       $select_img = Horde::img('alerts/message.png');
+       print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="header">%s</td><td align="right" class="header">%s</td><td  class="header" width="20">%s</td></tr></table>', $msg, $msg2, $select_img);
+       flush();
+    }
+
+    function warning($msg, $bold = true) {
+       global $cnt_i, $registry;
+       $item = ($cnt_i++ % 2);
+       $select_img = Horde::img('alerts/warning.png');
+       if ($bold) {
+           print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d" style="color: #ff0000">%s</td><td  class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+       } else {
+           print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d small" style="color: #ff0000">%s</td><td  class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+       }
+       flush();
+    }
+
+    function error($msg) {
+       global $cnt_i, $registry;
+       $item = ($cnt_i++ % 2);
+       $select_img = Horde::img('alerts/error.png');
+       print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d" style="color: #ff0000"><b>%s</b></td><td  class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+       flush();
+    }
+
+    function info($msg = "", $bold = true) {
+
+       global $cnt_i, $registry;
+
+       if (empty($msg)) {
+           echo "<br />";
+       } else {
+
+           $item = ($cnt_i++ % 2);
+
+       $select_img = Horde::img('alerts/select.png');
+           if ($bold) {
+               print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d"><b>%s</b></td><td  class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+           } else {
+               print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d small">%s</td><td  class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, '');
+           }
+           flush();
+       }
+    }
+
+    function parseCharset($headers)
+    {
+        if (preg_match('/charset=(.*)/i', $headers, $m)) {
+            return $m[1];
+        }
+       return 'UTF-8';
+    }
+
+    function convert_string($msg) {
+       global $po;
+
+       $f = array('/&lt;/', '/&gt;/');
+       $t = array('<', '>');
+       $msg = preg_replace($f, $t, $msg);
+       return Horde_String::convertCharset(html_entity_decode($msg), 'UTF-8', Translate_Display::parseCharset($po->meta['Content-Type']));
+    }
+
+    function display_string($msg) {
+       global $po;
+
+       $f = array('/</', '/>/');
+       $t = array('&lt;', '&gt;');
+       $msg = preg_replace($f, $t, $msg);
+       return Horde_String::convertCharset($msg, Translate_Display::parseCharset($po->meta['Content-Type']), 'UTF-8');
+    }
+
+    function get_percent($used, $total) {
+       if ($total > 0) {
+           $percent = sprintf("%2.2f", (($used * 100) / $total));
+       } else {
+           $percent = 0;
+       }
+
+       return $percent;
+    }
+
+    function create_bargraph ($used, $total, $text = true, $reverse = false, $small = false) {
+       if ($total > 0) {
+           $percent = round(($used * 100) / $total);
+       } else {
+           $percent = 0;
+       }
+
+       $html = '<table border="0" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap">';
+       $html .= '<table border="0" width="100" cellpadding="0" cellspacing="0">';
+       $html .= '<tr height="10">';
+
+       if ($percent > 0) {
+           $html .= '<td nowrap="nowrap" width="' . ($percent) . '" bgcolor="#00FF00"></td>';
+       }
+
+       if ($percent != 100) {
+           $html .= '<td nowrap="nowrap" width="' . (100 - $percent) . '" ';
+           if ($reverse) {
+               $html .= ' bgcolor="#FFFFFF"></td>';
+           } else {
+               $html .= ' bgcolor="#006699"></td>';
+           }
+       }
+
+       $html .= '</tr></table></td>';
+
+       if ($text) {
+           if ($small) {
+               $html .= '<td class="small"> ' . $percent .'% </td>';
+           } else {
+               $html .= '<td> ' . $percent .'% </td>';
+           }
+       }
+
+       $html .= '</tr></table>';
+
+       return $html;
+    }
+
+}
diff --git a/babel/templates/common-header.inc b/babel/templates/common-header.inc
new file mode 100644 (file)
index 0000000..bd2626d
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+if (isset($language)) {
+    header('Content-type: text/html; charset=' . 'UTF-8');
+    header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $GLOBALS['registry']->get('name');
+if (!empty($title)) {
+    $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo $page_title ?></title>
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
index 9540fd3..7be23e4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
@@ -16,7 +16,7 @@ if (!empty($title)) {
 Horde::outputMetaTags();
 
 if (Horde_Util::nonInputVar('js_vars')) {
-    Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()));
+    Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, 'UTF-8'));
 }
 
 Horde::includeScriptFiles();
diff --git a/crumb/templates/common-header.inc b/crumb/templates/common-header.inc
new file mode 100644 (file)
index 0000000..1ad6d39
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+if (isset($language)) {
+    header('Content-type: text/html; charset=' . 'UTF-8');
+    header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Skeleton: Copyright 2004-2010 The Horde Project.  Skeleton is under a Horde license. -->
+<!--     Horde Project: http://www.horde.org/ | Skeleton: http://www.horde.org/horde/     -->
+<!--                 Horde Licenses: http://www.horde.org/licenses/                       -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+    $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
diff --git a/drag_n_drop_portal/block.php b/drag_n_drop_portal/block.php
new file mode 100644 (file)
index 0000000..e27b2ae
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * $Id: block.php 219 2008-01-11 09:45:33Z duck $
+ *
+ * Copyright Obala d.o.o. (www.obala.si)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ * @package Folks
+ */
+define('HORDE_BASE', dirname(__FILE__) . '/..');
+require_once HORDE_BASE . '/lib/base.php';
+require_once 'Horde/Loader.php';
+
+// Block to load
+$block_id = Horde_Util::getFormData('block');
+list($app, $name) = explode(':', $block_id);
+
+$block_data = array();
+$block = Horde_Block_Collection::getBlock($app, $name, Horde_Util::getFormData('defaults'));
+if ($block instanceof PEAR_Error) {
+    $block_data['title'] = $block->getMessage();
+    $block_data['content'] = $block->getDebugInfo();
+} else {
+    $block_data['title'] = @$block->getTitle();
+    if ($block_data['title'] instanceof PEAR_Error) {
+        $block_data['title'] = $block_data['title']->getMessage();
+    }
+    $block_data['content'] = @$block->getContent();
+    if ($block_data['content'] instanceof PEAR_Error) {
+        $block_data['content'] = $block_data['content']->getDebugInfo();
+    }
+}
+
+echo Horde_Serialize::serialize($block_data, Horde_Serialize::JSON, 'UTF-8');
diff --git a/drag_n_drop_portal/lib/Block/Layout/View/js.php b/drag_n_drop_portal/lib/Block/Layout/View/js.php
new file mode 100644 (file)
index 0000000..39a6684
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+/**
+ * The Horde_Block_Layout_View class represents the user defined portal layout.
+ *
+ * Copyright 2008-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  Duck <duck@obala.net>
+ * @package Horde_Block
+ */
+class Horde_Block_Layout_View_Js extends Horde_Block_Layout_View {
+
+    /**
+     * Render the current layout as HTML.
+     *
+     * @return string HTML layout.
+     */
+    function toHtml()
+    {
+        $html = '<div id="page">';
+        $js = '<script type="text/javascript">' . "\n";
+        $js .= 'var confirm_remove = "' . _("Are sure to remove this block?") . '";' . "\n";
+        $js .= 'var edit_url = "' . Horde::url('dragdrop/params.php') . '";' . "\n";
+        $js .= 'var load_url = "' . Horde::url('dragdrop/block.php') . '";' . "\n";
+        $js .= 'var list_url = "' . Horde::url('dragdrop/select.php') . '";' . "\n";
+        $js .= 'var save_url = "' . Horde::url('dragdrop/save.php') . '";' . "\n";
+
+        $js_init = '<script type="text/javascript">'
+                . ' function init() {'
+                . ' portal = new Xilinus.Portal("#page div", {onOverWidget: onOverWidget, onOutWidget: onOutWidget});';
+
+        $js_id = 0;
+        $widget_col = 0;
+        $columns = 0;
+        foreach ($this->_layout as $row_num => $row) {
+            foreach ($row as $col_num => $item) {
+                if ($col_num > $columns) {
+                    $columns = $col_num;
+                }
+                if (is_array($item)) {
+                    $js .= $this->_serializeBlock($js_id, $item['app'], $item['params']['type'],
+                                                $item['params']['params'], $js_init, $col_num);
+                    $js_id++;
+                }
+            }
+        }
+
+        $columns = max($columns, 2); // FOR TESTING ADD AT KEAST 3 COLUMNS
+        for ($col_num = 0; $col_num <= $columns; $col_num++) {
+            $html .= '<div id="widget_col_' . $col_num . '"></div>';
+        }
+
+        $js .= '</script>';
+
+        $js_init .= 'portal.addWidgetControls("control_buttons");'
+                . '}'
+                . 'document.observe("dom:loaded", init);
+'
+                . '</script>';
+
+        $html .= '</div>' . "\n" . $js . "\n" . $js_init;
+
+        // Strip any CSS <link> tags out of the returned content so
+        // they can be handled seperately.
+        if (preg_match_all('/<link .*?rel="stylesheet".*?\/>/', $html, $links)) {
+            $html = str_replace($links[0], '', $html);
+            $this->_linkTags = $links[0];
+        }
+
+        return $html;
+    }
+
+    function _serializeBlock($js_id, $app, $name, $params, &$js_init, $col_num)
+    {
+        $block = Horde_Block_Collection::getBlock($app, $name, $params);
+        if ($block instanceof PEAR_Error) {
+            $title = $block->getMessage();
+            $content = $block->getDebugInfo();
+            $params = array();
+        } else {
+            $content = @$block->getContent();
+            if ($content instanceof PEAR_Error) {
+                $content = $content->getDebugInfo();
+            }
+            $title = @$block->getTitle();
+            if ($title instanceof PEAR_Error) {
+                $title = $title->getMessage();
+            } else {
+                $title = strip_tags($title);
+            }
+        }
+
+        $content = Horde_Serialize::serialize($content, Horde_Serialize::JSON, 'UTF-8');
+        $title = Horde_Serialize::serialize($title, Horde_Serialize::JSON, 'UTF-8');
+        $params = Horde_Serialize::serialize($params, Horde_Serialize::JSON, 'UTF-8');
+
+        $js_init .= 'portal.add(new Xilinus.Widget().'
+                    . 'setTitle(title_' . $js_id .').'
+                    . ' setContent(content_' . $js_id .'), ' . $col_num . ');'
+                    . '_widgets_blocks[' . $js_id . '] = "' . $app . ':' . $name . '";'
+                    . '_layout_params[' . $js_id . '] = \'' . $params . '\'.evalJSON();'
+                    . 'delete title_' . $js_id .';'
+                    . 'delete content_' . $js_id .';' . "\n";
+
+        return 'var content_' . $js_id . ' = ' . $content . ';' . "\n"
+                . 'var title_' . $js_id . ' = ' . $title . ';' . "\n";
+    }
+}
diff --git a/fima/data.php b/fima/data.php
new file mode 100644 (file)
index 0000000..e16630c
--- /dev/null
@@ -0,0 +1,227 @@
+<?php
+/**
+ * Copyright 2008 Thomas Trethan <thomas@trethan.net>
+ *
+ * See the enclosed file LICENSE for license information (ASL).  If you
+ * did not receive this file, see http://www.horde.org/licenses/asl.php.
+ */
+
+function _cleanupData()
+{
+    $GLOBALS['import_step'] = 1;
+    return Horde_Data::IMPORT_FILE;
+}
+
+@define('FIMA_BASE', dirname(__FILE__));
+require_once FIMA_BASE . '/lib/base.php';
+
+$ledger = Fima::getActiveLedger();
+
+/* Importable file types. */
+$file_types = array('csv'      => _("CSV"),
+                    'tsv'      => _("TSV"));
+
+/* Templates for the different import steps. */
+$templates = array(
+    Horde_Data::IMPORT_CSV => array($registry->get('templates', 'horde') . '/data/csvinfo.inc'),
+    Horde_Data::IMPORT_TSV => array($registry->get('templates', 'horde') . '/data/tsvinfo.inc'),
+    Horde_Data::IMPORT_MAPPED => array($registry->get('templates', 'horde') . '/data/csvmap.inc'),
+    Horde_Data::IMPORT_DATETIME => array($registry->get('templates', 'horde') . '/data/datemap.inc'),
+    Horde_Data::IMPORT_FILE => array(FIMA_TEMPLATES . '/data/import.inc', FIMA_TEMPLATES . '/data/export.inc'),
+);
+
+/* Field/clear name mapping. */
+$app_fields = array('date'     => _("Date"),
+                    'asset'    => _("Asset Account"),
+                    'account'  => _("Account"),
+                    'desc'     => _("Description"),
+                    'amount'   => _("Amount"),
+                    'eo'       => _("e.o."));
+
+/* Date/time fields. */
+$time_fields = array('date' => 'date');
+
+/* Initial values. */
+$param = array('time_fields' => $time_fields,
+               'file_types'  => $file_types);
+$import_format = Horde_Util::getFormData('import_format', '');
+$import_step   = Horde_Util::getFormData('import_step', 0) + 1;
+$next_step     = Horde_Data::IMPORT_FILE;
+$actionID      = Horde_Util::getFormData('actionID');
+$error         = false;
+
+/* Loop through the action handlers. */
+switch ($actionID) {
+case 'export':
+    $data = array();
+
+    /* Create a Fima storage instance. */
+    $storage = &Fima_Driver::singleton($ledger);
+    if (is_a($storage, 'PEAR_Error')) {
+        $notification->push(sprintf(_("Failed to access the ledger: %s"), $storage->getMessage()), 'horde.error');
+        $error = true;
+        break;
+    }
+    $params = $storage->getParams();
+
+    $filters = array(array('type', $prefs->getValue('active_postingtype')));
+
+    /* Get accounts and postings. */
+    $accounts = Fima::listAccounts();
+    $postings = Fima::listPostings($filters);
+
+    foreach ($postings as $postingId => $posting) {
+        $row = array();
+        foreach ($posting as $key => $value) {
+            switch ($key) {
+            case 'date':
+                $row[$key] = strftime(Fima::convertDateFormat($prefs->getValue('date_format')), $value);
+                break;
+            case 'asset':
+            case 'account':
+                $row[$key] = isset($accounts[$value]) ? $accounts[$value]['number'] : '';
+                break;
+            case 'amount':
+                $row[$key] = Fima::convertValueToAmount($value);
+                break;
+            case 'eo':
+            case 'desc':
+                $row[$key] = Horde_String::convertCharset($value, 'UTF-8', $params['charset']);
+                break;
+            default:
+                break;
+            }
+        }
+        $data[] = $row;
+    }
+
+    if (!count($data)) {
+        $notification->push(_("There were no postings to export."), 'horde.message');
+        $error = true;
+        break;
+    }
+
+    switch (Horde_Util::getFormData('exportID')) {
+    case EXPORT_CSV:
+        $injector->getInstance('Horde_Data')->getData('Csv', array('cleanup' => '_cleanupData'))->exportFile(_("postings.csv"), $data, true);
+        exit;
+
+    case EXPORT_TSV:
+        $injector->getInstance('Horde_Data')->getData('Tsv', array('cleanup' => '_cleanupData'))->exportFile(_("postings.tsv"), $data, true);
+        exit;
+    }
+    break;
+
+case Horde_Data::IMPORT_FILE:
+    $storage = &Fima_Driver::singleton($ledger);
+    if (is_a($storage, 'PEAR_Error')) {
+        $notification->push(sprintf(_("Failed to access the ledger: %s"), $storage->getMessage()), 'horde.error');
+        $error = true;
+        break;
+    }
+
+    $_SESSION['import_data']['target'] = $ledger;
+    $_SESSION['import_data']['purge'] = Horde_Util::getFormData('purge');
+    break;
+}
+
+if (!$error) {
+    try {
+        $data = $injector->getInstance('Horde_Data')->getData($import_format, array('cleanup' => '_cleanupData'));
+        $next_step = $data->nextStep($actionID, $param);
+    } catch (Horde_Data_Exception $e) {
+        if ($data) {
+            $notification->push($e, 'horde.error');
+            $next_step = $data->cleanup();
+        } else {
+            $notification->push(_("This file format is not supported."), 'horde.error');
+            $next_step = Horde_Data::IMPORT_FILE;
+        }
+    }
+}
+
+/* We have a final result set. */
+if (is_array($next_step)) {
+    /* Create a Fima storage instance. */
+    $storage = &Fima_Driver::singleton($ledger);
+    if (is_a($storage, 'PEAR_Error')) {
+        $notification->push(sprintf(_("Failed to access the ledger: %s"), $storage->getMessage()), 'horde.error');
+    }
+
+    $params = $storage->getParams();
+
+    /* Purge old postings if requested. */
+    if ($_SESSION['import_data']['purge']) {
+        $result = $storage->deleteAll(false, $prefs->getValue('active_postingtype'));
+        if (is_a($result, 'PEAR_Error')) {
+            $notification->push(sprintf(_("The postings could not be purged: %s"), $result->getMessage()), 'horde.error');
+        } else {
+            $notification->push(_("Postings successfully purged."), 'horde.success');
+        }
+    }
+
+    /* Get accounts and postings. */
+    $accounts = Fima::listAccounts();
+    $accounts_indices = array();
+    foreach ($accounts as $account) {
+        $accounts_indices[$account['number']] = $account['account_id'];
+    }
+
+    foreach ($next_step as $row) {
+        $row['type'] = $prefs->getValue('active_postingtype');
+        $row['asset'] = sprintf('%\'04d', $row['asset']);
+        $row['asset'] = isset($accounts_indices[$row['asset']]) ? $accounts_indices[$row['asset']] : null;
+        $row['account'] = sprintf('%\'04d', $row['account']);
+        $row['account'] = isset($accounts_indices[$row['account']]) ? $accounts_indices[$row['account']] : null;
+        $row['date'] = Fima::convertDateToStamp($row['date'], Fima::convertDateFormat($prefs->getValue('date_format')));
+        $row['amount'] = Fima::convertAmountToValue($row['amount']);
+        if ($prefs->getValue('expenses_sign') == 0) {
+            if ($row['account'] !== null) {
+                if ($accounts[$row['account']]['type'] == FIMA_ACCOUNTTYPE_EXPENSE) {
+                    $row['amount'] *= -1;
+                }
+            } else {
+                $row['amount'] *= -1;
+            }
+        }
+        $row['desc'] = isset($row['desc']) ? trim($row['desc']) : '';
+        $row['eo'] = isset($row['eo']) ? (bool)trim($row['eo']) : false;
+        $result = $storage->addPosting($row['type'], $row['date'], $row['asset'], $row['account'], $row['eo'], $row['amount'], $row['desc']);
+        if (is_a($result, 'PEAR_Error')) {
+            break;
+        }
+    }
+
+    if (!count($next_step)) {
+        $notification->push(sprintf(_("The %s file didn't contain any postings."),
+                                    $file_types[$_SESSION['import_data']['format']]), 'horde.error');
+    } else {
+        $notification->push(sprintf(_("%s successfully imported"),
+                                    $file_types[$_SESSION['import_data']['format']]), 'horde.success');
+    }
+    $next_step = $data->cleanup();
+}
+
+$title = _("Import/Export Postings");
+require FIMA_TEMPLATES . '/common-header.inc';
+require FIMA_TEMPLATES . '/menu.inc';
+
+if ($next_step == Horde_Data::IMPORT_FILE) {
+    /* Build the charset options. */
+    $charsets = $registry->nlsconfig['encodings'];
+    asort($charsets);
+    $all_charsets = $registry->nlsconfig['charsets'];
+    natcasesort($all_charsets);
+    foreach ($all_charsets as $charset) {
+        if (!isset($charsets[$charset])) {
+            $charsets[$charset] = $charset;
+        }
+    }
+    $my_charset = $GLOBALS['registry']->getLanguageCharset();
+}
+
+foreach ($templates[$next_step] as $template) {
+    require $template;
+    echo '<br />';
+}
+require $registry->get('templates', 'horde') . '/common-footer.inc';
diff --git a/fima/lib/Driver/sql.php b/fima/lib/Driver/sql.php
new file mode 100644 (file)
index 0000000..6d8fe3c
--- /dev/null
@@ -0,0 +1,1064 @@
+<?php
+/**
+ * Fima storage implementation for PHP's PEAR database abstraction layer.
+ *
+ * Required values for $params:<pre>
+ *      'phptype'       The database type (e.g. 'pgsql', 'mysql', etc.).
+ *      'table'         The name of the foo table in 'database'.
+ *      'charset'       The database's internal charset.</pre>
+ *
+ * Required by some database implementations:<pre>
+ *      'database'      The name of the database.
+ *      'hostspec'      The hostname of the database server.
+ *      'protocol'      The communication protocol ('tcp', 'unix', etc.).
+ *      'username'      The username with which to connect to the database.
+ *      'password'      The password associated with 'username'.
+ *      'options'       Additional options to pass to the database.
+ *      'tty'           The TTY on which to connect to the database.
+ *      'port'          The port on which to connect to the database.</pre>
+ *
+ * The table structure can be created by the scripts/sql/fima.sql
+ * script.
+ *
+ * Copyright 2007-2008 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Thomas Trethan <thomas@trethan.net>
+ * @package Fima
+ */
+class Fima_Driver_sql extends Fima_Driver {
+
+    /**
+     * Handle for the current database connection.
+     *
+     * @var DB
+     */
+    var $_db;
+
+    /**
+     * Constructs a new SQL storage object.
+     *
+     * @param string $ledger  The ledger to load.
+     * @param array $params   A hash containing connection parameters.
+     */
+    function Fima_Driver_sql($ledger, $params = array())
+    {
+        $this->_ledger = $ledger;
+        $this->_params = $params;
+    }
+
+    /**
+     * Retrieves accounts from the database.
+     *
+     * @param array $filters  Any filters for restricting the retrieved accounts.
+     *
+     * @return mixed  True on success, PEAR_Error on failure.
+     */
+    function retrieveAccounts($filters = array())
+    {
+        /* Build the SQL query. */
+        $query = sprintf('SELECT * FROM %s WHERE account_owner = ?', $this->_params['table_accounts']);
+        $values = array($this->_ledger);
+
+        /* Add filters. */
+        $this->_addFilters($filters, $query, $values, 'account_');
+
+        /* Sorting. */
+        $query .= ' ORDER BY account_number ASC';
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::retrieveAccounts(): %s', $query), 'DEBUG');
+
+        /* Execute the query. */
+        $this->_accounts = array();
+        $result = $this->_db->query($query, $values);
+
+        if (isset($result) && !is_a($result, 'PEAR_Error')) {
+            $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            if (is_a($row, 'PEAR_Error')) {
+                return $row;
+            }
+
+            /* Store the retrieved values in the accounts variable. */
+            $this->_accounts = array();
+            while ($row && !is_a($row, 'PEAR_Error')) {
+                /* Add this new account to the $_account list. */
+                $this->_accounts[$row['account_id']] = $this->_buildAccount($row);
+
+                /* Advance to the new row in the result set. */
+                $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            }
+            $result->free();
+        } else {
+            return $result;
+        }
+
+        return true;
+    }
+
+    /**
+     * Retrieves one account from the database.
+     *
+     * @param string $accountId  The ID of the account to retrieve.
+     *
+     * @return array  The array of account attributes.
+     */
+    function getAccount($accountId)
+    {
+        /* Build the SQL query. */
+        $query = sprintf('SELECT * FROM %s WHERE account_owner = ? AND account_id = ?',
+                         $this->_params['table_accounts']);
+        $values = array($this->_ledger, $accountId);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::getAccount(): %s', $query), 'DEBUG');
+
+        /* Execute the query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            return $result;
+        }
+
+        $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+        if (is_a($row, 'PEAR_Error')) {
+            return $row;
+        }
+        if ($row === null) {
+            return PEAR::raiseError(_("Not found"));
+        }
+
+        /* Decode and return the account. */
+        return $this->_buildAccount($row);
+    }
+
+    /**
+     * Retrieves one account from the database by number.
+     *
+     * @param string $number  The number of the account to retrieve.
+     *
+     * @return array  The array of account attributes.
+     */
+    function getAccountByNumber($number)
+    {
+        /* Build the SQL query. */
+        $query = sprintf('SELECT * FROM %s WHERE account_owner = ? AND account_number = ?',
+                         $this->_params['table_accounts']);
+        $values = array($this->_ledger, sprintf('%\'04s', $number));
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::getAccountByNumber(): %s', $query), 'DEBUG');
+
+        /* Execute the query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            return $result;
+        }
+
+        $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+        if (is_a($row, 'PEAR_Error')) {
+            return $row;
+        }
+        if ($row === null) {
+            return PEAR::raiseError(_("Not found"));
+        }
+
+        /* Decode and return the account. */
+        return $this->_buildAccount($row);
+    }
+
+    /**
+     * Retrieves postings from the database.
+     *
+     * @param array $filters  Any filters for restricting the retrieved postings.
+     * @param array $sorting  Sort order of retrieved postings.
+     * @param array $limit       Limit of the retrieved postings, array(page, postings/page).
+     *
+     * @return mixed  True on success, PEAR_Error on failure.
+     */
+    function retrievePostings($filters = array(), $sorting = array(), $limit = array())
+    {
+        /* Build the SQL query filter. */
+        $queryfilter = ' WHERE posting_owner = ?';
+        $values = array($this->_ledger);
+
+        /* Add filters. */
+        $this->_addFilters($filters, $queryfilter, $values, 'posting_');
+
+        $query = sprintf('SELECT count(p.posting_id) posting_count, SUM(p.posting_amount) posting_result FROM %s p',
+                         $this->_params['table_postings']);
+        $query .= $queryfilter;
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::retrievePostings(): %s', $query), 'DEBUG');
+
+        /* Execute the query. */
+        $result = $this->_db->query($query, $values);
+        if (isset($result) && !is_a($result, 'PEAR_Error')) {
+            $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            if (is_a($row, 'PEAR_Error')) {
+                return $row;
+            }
+            $this->_postingsCount = (int)$row['posting_count'];
+            $this->_postingsResult = $row['posting_result'];
+            $result->free();
+
+            // correct result when account is an asset account too
+            if ($this->_postingsCount > 0) {
+                $query = sprintf('SELECT SUM(p.posting_amount) posting_result ' .
+                                 'FROM %s p JOIN %s a ON a.account_id = p.posting_account ' .
+                                 $queryfilter . ' AND a.account_type = ?',
+                                 $this->_params['table_postings'], $this->_params['table_accounts']);
+                $values2 = $values;
+                $values2[] = FIMA_ACCOUNTTYPE_ASSET;
+                $result = $this->_db->query($query, $values2);
+                if (isset($result) && !is_a($result, 'PEAR_Error')) {
+                    $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+                    if (is_a($row, 'PEAR_Error')) {
+                        return $row;
+                    }
+                }
+                $this->_postingsResult -= $row['posting_result'];
+                $result->free();
+            }
+        } else {
+            return $result;
+        }
+
+        /* Fetch the postings if necessary. */
+        $this->_postings = array();
+        if ($this->_postingsCount == 0) {
+            return true;
+        }
+
+        $query = sprintf('SELECT p.*, asset.account_number posting_asset_number, account.account_number posting_account_number ' .
+                         'FROM %s p LEFT OUTER JOIN %s asset ON p.posting_asset = asset.account_id LEFT OUTER JOIN %s account ON p.posting_account = account.account_id',
+                         $this->_params['table_postings'], $this->_params['table_accounts'], $this->_params['table_accounts']);
+        $query .= $queryfilter;
+
+        /* Sorting. */
+        if (!is_array($sorting)) {
+            $sorting = array($sorting);
+        }
+        if (count($sorting) == 0) {
+            $sorting = array('posting_date ASC');
+        }
+        $query .= ' ORDER BY ' . implode(', ', $sorting);
+
+        /* Limit. */
+        if (count($limit) > 0) {
+            if ($limit[0] < 0) {
+                $limit[0] += ceil($this->_postingsCount / $limit[1]) + 1;
+            }
+            $limit[0] = ($limit[0] - 1) * $limit[1];
+            /* Log the query at a DEBUG log level. */
+            Horde::logMessage(sprintf('Fima_Driver_sql::retrievePostings() limitQuery: %s', $query), 'DEBUG');
+            $result = $this->_db->queryLimit($query, $limit[0], $limit[1], $values);
+        } else {
+            /* Log the query at a DEBUG log level. */
+            Horde::logMessage(sprintf('Fima_Driver_sql::retrievePostings(): %s', $query), 'DEBUG');
+            $result = $this->_db->query($query, $values);
+        }
+
+        /* Execute the query. */
+        $result = $this->_db->query($query, $values);
+        if (isset($result) && !is_a($result, 'PEAR_Error')) {
+            $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            if (is_a($row, 'PEAR_Error')) {
+                return $row;
+            }
+
+            /* Store the retrieved values in the accounts variable. */
+            while ($row && !is_a($row, 'PEAR_Error')) {
+                /* Add this new posting to the $_posting list. */
+                $this->_postings[$row['posting_id']] = $this->_buildPosting($row);
+
+                /* Advance to the new row in the result set. */
+                $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            }
+            $result->free();
+        } else {
+            return $result;
+        }
+
+        return true;
+    }
+
+    /**
+     * Retrieves one posting from the database.
+     *
+     * @param string $postingId  The ID of the posting to retrieve.
+     *
+     * @return array  The array of posting attributes.
+     */
+    function getPosting($postingId)
+    {
+        /* Build the SQL query. */
+        $query = sprintf('SELECT * FROM %s WHERE posting_owner = ? AND posting_id = ?',
+                         $this->_params['table_postings']);
+        $values = array($this->_ledger, $postingId);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::getPosting(): %s', $query), 'DEBUG');
+
+        /* Execute the query. */
+        $result = $this->_db->query($query, $values);
+
+        if (is_a($result, 'PEAR_Error')) {
+            return $result;
+        }
+
+        $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+        if (is_a($row, 'PEAR_Error')) {
+            return $row;
+        }
+        if ($row === null) {
+            return PEAR::raiseError(_("Not found"));
+        }
+
+        /* Decode and return the posting. */
+        return $this->_buildPosting($row);
+    }
+
+    /**
+     * Get grouped results.
+     *
+     * @param array $groups     Fields to group.
+     * @param boolean $filters  Filters for postings.
+     *
+     * @return array            A matrix of the grouped results.
+     */
+    function getResults($groups, $filters = array()) {
+        $matrix = array();
+
+        /* Fix grouping. */
+        if (!is_array($groups)) {
+            $groups = array($groups);
+        }
+        if (!isset($groups[1])) {
+            $groups[1] = 'owner';
+        }
+        foreach ($groups as $groupId => $group) {
+            switch($group) {
+            case 'date_month':     $groups[$groupId] = 'FROM_UNIXTIME(posting_date, \'%Y%m\')'; break;
+            case 'date_year':      $groups[$groupId] = 'FROM_UNIXTIME(posting_date, \'%Y\')'; break;
+            case 'asset_number':   $groups[$groupId] = 'asset.account_number'; break;
+            case 'asset_parent':   $groups[$groupId] = 'CONCAT(LEFT(asset.account_number, 2), \'00\')'; break;
+            case 'asset_type':     $groups[$groupId] = 'asset.account_type'; break;
+            case 'account_number': $groups[$groupId] = 'account.account_number'; break;
+            case 'account_parent': $groups[$groupId] = 'CONCAT(LEFT(account.account_number, 2), \'00\')'; break;
+            case 'account_type':   $groups[$groupId] = 'account.account_type'; break;
+            default:               $groups[$groupId] = 'posting_'.$group; break;
+            }
+        }
+
+        /* Build the SQL query filter. */
+        $query = sprintf('SELECT %s x, %s y, sum(posting_amount) result ' .
+                         'FROM %s p LEFT OUTER JOIN %s asset ON p.posting_asset = asset.account_id AND p.posting_owner = asset.account_owner LEFT OUTER JOIN %s account ON p.posting_account = account.account_id AND p.posting_owner = account.account_owner ' .
+                         'WHERE posting_owner = ?',
+                         $groups[0], $groups[1], $this->_params['table_postings'], $this->_params['table_accounts'], $this->_params['table_accounts']);
+        $values = array($this->_ledger);
+
+        /* Add filters. */
+        foreach ($filters as $filterId => $filter) {
+            switch($filter[0]) {
+            case 'date_month':     $filters[$filterId][0] = 'FROM_UNIXTIME(posting_date, \'%Y%m\')'; break;
+            case 'date_year':      $filters[$filterId][0] = 'FROM_UNIXTIME(posting_date, \'%Y%m\')'; break;
+            case 'asset_number':   $filters[$filterId][0] = 'asset.account_number'; break;
+            case 'asset_parent':   $filters[$filterId][0] = 'LEFT(asset.account_number, 2)'; break;
+            case 'asset_type':     $filters[$filterId][0] = 'asset.account_type'; break;
+            case 'account_number': $filters[$filterId][0] = 'account.account_number'; break;
+            case 'account_parent': $filters[$filterId][0] = 'LEFT(account.account_number, 2)'; break;
+            case 'account_type':   $filters[$filterId][0] = 'account.account_type'; break;
+            default:               $filters[$filterId][0] = 'posting_'.$filter[0]; break;
+            }
+        }
+        $this->_addFilters($filters, $query, $values);
+
+        /* Add grouping. */
+        $query .= ' GROUP BY ' . implode(', ', $groups);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::getResults(): %s', $query), 'DEBUG');
+
+        /* Execute the query. */
+        $result = $this->_db->query($query, $values);
+        if (isset($result) && !is_a($result, 'PEAR_Error')) {
+            $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            if (is_a($row, 'PEAR_Error')) {
+                return $row;
+            }
+
+            /* Store the retrieved values in the accounts variable. */
+            while ($row && !is_a($row, 'PEAR_Error')) {
+                /* Add this new posting to the $_posting list. */
+                if (!isset($matrix[$row['y']])) {
+                    $matrix[$row['y']] = array();
+                }
+                $matrix[$row['y']][$row['x']] = $row['result'];
+
+                /* Advance to the new row in the result set. */
+                $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            }
+            $result->free();
+        }
+
+        return $matrix;
+    }
+
+    /**
+     * Get the results of all asset accounts.
+     *
+     * @param string $postingtype  Type of postings.
+     * @param boolean $perdate     Date of asset results.
+     *
+     * @return array  Array of asset accounts and results
+     */
+    function getAssetResults($postingtype, $perdate = null)
+    {
+        $perdate = ($perdate === null) ? mktime() : (int)$perdate;
+
+        /* Build the SQL query. */
+        $query = sprintf('SELECT account_id, SUM(account_result) account_result FROM ( ' .
+                         ' SELECT a1.account_id, SUM(p1.posting_amount) account_result ' .
+                         ' FROM %s a1 LEFT OUTER JOIN %s p1 ON a1.account_id = p1.posting_asset AND p1.posting_owner = ? AND p1.posting_type = ? ' .
+                         ' WHERE a1.account_owner = ? AND a1.account_type = ? and p1.posting_date <= ?' .
+                         ' GROUP BY a1.account_id ' .
+                         '  UNION ' .
+                         ' SELECT a2.account_id, SUM(p2.posting_amount) * -1 account_result ' .
+                         ' FROM %s a2 LEFT OUTER JOIN %s p2 ON a2.account_id = p2.posting_account AND p2.posting_owner = ? AND p2.posting_type = ? ' .
+                         ' WHERE a2.account_owner = ? AND a2.account_type = ? and p2.posting_date <= ?' .
+                         ' GROUP BY a2.account_id ' .
+                         ') x ' .
+                         'GROUP BY account_id ',
+                         $this->_params['table_accounts'], $this->_params['table_postings'],
+                         $this->_params['table_accounts'], $this->_params['table_postings']);
+        $values = array($this->_ledger, $postingtype, $this->_ledger, FIMA_ACCOUNTTYPE_ASSET, $perdate,
+                        $this->_ledger, $postingtype, $this->_ledger, FIMA_ACCOUNTTYPE_ASSET, $perdate);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::getAssetResults(): %s', $query), 'DEBUG');
+
+        /* Execute the query. */
+        $assetresults = array();
+        $result = $this->_db->query($query, $values);
+        if (isset($result) && !is_a($result, 'PEAR_Error')) {
+            $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            if (is_a($row, 'PEAR_Error')) {
+                return $row;
+            }
+
+            /* Store the retrieved values in the accounts variable. */
+            while ($row && !is_a($row, 'PEAR_Error')) {
+                /* Add this new posting to the $_posting list. */
+                $assetresults[] = $row;
+
+                /* Advance to the new row in the result set. */
+                $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+            }
+            $result->free();
+        } else {
+            return $result;
+        }
+
+        return $assetresults;
+    }
+
+    /**
+     * Build an account.
+     *
+     * @param array $row          Datasbase row holding account attributes.
+     * @param boolean $getparent  Also get parent account.
+     *
+     * @return array  The array of account attributes.
+     */
+    function _buildAccount($row, $getparent = true)
+    {
+        $parent = null;
+        if ($getparent) {
+            if (($parent_number = Fima::getAccountParent($row['account_number'])) !== null) {
+                if (isset($this->_accounts[$parent_number])) {
+                    $parent = $this->_accounts[$parent_number];
+                } else {
+                    $parent = $this->getAccountByNumber($parent_number);
+                    if (is_a($parent, 'PEAR_Error')) {
+                        $parent = null;
+                    }
+                }
+            }
+        }
+
+        /* Create a new account based on $row's values. */
+        return array('account_id' => $row['account_id'],
+                     'owner' => $row['account_owner'],
+                     'number' => sprintf('%\'04d', $row['account_number']),
+                     'type' => $row['account_type'],
+                     'name' => Horde_String::convertCharset($row['account_name'], $this->_params['charset']),
+                     'eo' => $row['account_eo'],
+                     'desc' => Horde_String::convertCharset($row['account_desc'], $this->_params['charset']),
+                     'closed' => $row['account_closed'],
+                     'label' => trim($row['account_number'] . ' ' .
+                                (($parent === null) ? '' : $parent['name'] . ' - ') .
+                                Horde_String::convertCharset($row['account_name'], $this->_params['charset'])),
+                     'parent_id' => ($parent === null) ? null : $parent['account_id'],
+                     'parent_number' => ($parent === null) ? '' : $parent['number'],
+                     'parent_name' => ($parent === null) ? '' : $parent['name']);
+    }
+
+    /**
+     * Adds an account to the backend storage.
+     *
+     * @param string $number     The number of the account.
+     * @param string $type       The type of the account.
+     * @param string $name       The name (short) of the account.
+     * @param boolean $eo           Extraordinary account.
+     * @param string $desc       The description (long) of the account.
+     * @param boolean $closed    Close account.
+     *
+     * @return mixed             ID of the new account or PEAR_Error
+     */
+    function _addAccount($number, $type, $name, $eo, $desc, $closed)
+    {
+        $accountId = strval(new Horde_Support_Uuid());
+
+        $query = sprintf(
+            'INSERT INTO %s (account_id, account_owner, account_number, account_type, ' .
+            'account_name, account_eo, account_desc, account_closed) ' .
+            'VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
+            $this->_params['table_accounts']);
+        $values = array($accountId,
+                        $this->_ledger,
+                        sprintf('%\'04d', $number),
+                        $type,
+                        Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+                        (int)(bool)$eo,
+                        Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+                        (int)(bool)$closed);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::_addAccount(): %s', $query), 'DEBUG');
+
+        /* Attempt the insertion query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage($result, 'ERR');
+            return $result;
+        }
+
+        return $accountId;
+    }
+
+    /**
+     * Modifies an existing account.
+     *
+     * @param string $accountId  The account to modify.
+     * @param string $number     The number of the account.
+     * @param string $type       The type of the account.
+     * @param string $name       The name (short) of the account.
+     * @param boolean $eo           Extraordinary account.
+     * @param string $desc       The description (long) of the account.
+     * @param boolean $closed    Close account.
+     *
+     * @return mixed             True or PEAR_Error
+     */
+    function _modifyAccount($accountId, $number, $type, $name, $eo, $desc, $closed)
+    {
+        $query = sprintf('UPDATE %s SET' .
+                         ' account_number = ?, ' .
+                         ' account_type = ?, ' .
+                         ' account_name = ?, ' .
+                         ' account_eo = ?, ' .
+                         ' account_desc = ?, ' .
+                         ' account_closed = ? ' .
+                         'WHERE account_owner = ? AND account_id = ?',
+                         $this->_params['table_accounts']);
+        $values = array(sprintf('%\'04d', $number),
+                        $type,
+                        Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+                        (int)(bool)$eo,
+                        Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+                        (int)(bool)$closed,
+                        $this->_ledger,
+                        $accountId);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::_modifyAccount(): %s', $query), 'DEBUG');
+
+        /* Attempt the update query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage($result, 'ERR');
+            return $result;
+        }
+
+        return true;
+    }
+
+    /**
+     * Deletes an account from the backend.
+     *
+     * @param string $accountId     The account to delete.
+     * @param mixed $dsSubaccounts  True/false when deleting subaccounts,
+     *                                                                 accountId when shifting subaccounts
+     * @param mixed $dsPostings     True/false when deleting postings,
+     *                                                                 accountId when shifting postings
+     *
+     * @return mixed                True or PEAR_Error
+     */
+    function _deleteAccount($accountId, $dsSubaccounts = false, $dsPostings = true)
+    {
+        /* Get the account's details for use later. */
+        $account = $this->getAccount($accountId);
+
+        /* Handle subaccounts. */
+        if ($dsSubaccounts !== false) {
+            /* Delete subaccounts. */
+            $parent = (int)($account['number'] / 100) . '%';
+            $this->retrieveAccounts(array(array('number', $parent, 'LIKE'),
+                                          array('number', (string)$account['number'], '!=')));
+
+            foreach ($this->_accounts as $subaccountId => $subaccount) {
+                $delete = $this->_deleteAccount($subaccountId, false, $dsSubaccounts);
+                if (is_a($delete, 'PEAR_Error')) {
+                    return $delete;
+                }
+            }
+        }
+
+        /* Handle postings. */
+        if ($dsPostings !== false) {
+            if ($dsPostings === true) {
+                /* Delete account postings. */
+                $query = sprintf('DELETE FROM %s WHERE posting_owner = ? AND (posting_asset = ? OR posting_account = ?)',
+                                 $this->_params['table_postings']);
+                $values = array($this->_ledger, $accountId, $accountId);
+
+                /* Log the query at a DEBUG log level. */
+                Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAccount(): %s', $query), 'DEBUG');
+
+                /* Attempt the delete query. */
+                $result = $this->_db->query($query, $values);
+                if (is_a($result, 'PEAR_Error')) {
+                    Horde::logMessage($result, 'ERR');
+                    return $result;
+                }
+            } else {
+                /* Shift account postings. */
+                $shift = $this->_shiftPostings($accountId, $dsPostings);
+                if (is_a($shift, 'PEAR_Error')) {
+                    return $shift;
+                }
+            }
+        }
+
+        /* Delete account. */
+        $query = sprintf('DELETE FROM %s WHERE account_owner = ? AND account_id = ?',
+                         $this->_params['table_accounts']);
+        $values = array($this->_ledger, $accountId);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAccount(): %s', $query), 'DEBUG');
+
+        /* Attempt the delete query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage($result, 'ERR');
+            return $result;
+        }
+
+        return true;
+    }
+
+    /**
+     * Build a posting.
+     *
+     * @param array $row  Datasbase row holding posting attributes;
+     *
+     * @return array  The array of posting attributes.
+     */
+    function _buildPosting($row)
+    {
+        /* Create a new account based on $row's values. */
+        return array('posting_id' => $row['posting_id'],
+                     'owner' => $row['posting_owner'],
+                     'type' => $row['posting_type'],
+                     'date' => $row['posting_date'],
+                     'asset' => $row['posting_asset'],
+                     'account' => $row['posting_account'],
+                     'desc' => Horde_String::convertCharset($row['posting_desc'], $this->_params['charset']),
+                     'amount' => $row['posting_amount'],
+                     'eo' => (int)(bool)$row['posting_eo']);
+    }
+
+    /**
+     * Adds a posting to the backend storage.
+     *
+     * @param string $type     The posting type.
+     * @param integer $date    The posting date.
+     * @param string $asset    The ID of the asset account.
+     * @param string $account  The ID of the account.
+     * @param boolean $eo         Extraordinary posting.
+     * @param float $amount    The posting amount.
+     * @param string $desc     The posting description.
+     *
+     * @return mixed           ID of the new posting or PEAR_Error
+     */
+    function _addPosting($type, $date, $asset, $account, $eo, $amount, $desc)
+    {
+        $postingId = strval(new Horde_Support_Uuid());
+
+        $query = sprintf(
+            'INSERT INTO %s (posting_id, posting_owner, posting_type, posting_date, ' .
+            'posting_asset, posting_account, posting_eo, posting_amount, posting_desc) ' .
+            'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
+            $this->_params['table_postings']);
+        $values = array($postingId,
+                        $this->_ledger,
+                        $type,
+                        (int)$date,
+                        $asset,
+                        $account,
+                        (int)(bool)$eo,
+                        (float)$amount,
+                        Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']));
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::_addPosting(): %s', $query), 'DEBUG');
+
+        /* Attempt the insertion query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage($result, 'ERR');
+            return $result;
+        }
+
+        return $postingId;
+    }
+
+    /**
+     * Modifies an existing posting.
+     *
+     * @param string $postingId  The posting to modify.
+     * @param string $type       The posting type.
+     * @param integer $date      The posting date.
+     * @param string $asset      The ID of the asset account.
+     * @param string $account    The ID of the account.
+     * @param boolean $eo           Extraordinary posting.
+     * @param float $amount      The posting amount.
+     * @param string $desc       The posting description.
+     *
+     * @return mixed             True or PEAR_Error
+     */
+    function _modifyPosting($postingId, $type, $date, $asset, $account, $eo, $amount, $desc)
+    {
+        $query = sprintf('UPDATE %s SET' .
+                         ' posting_type = ?, ' .
+                         ' posting_date = ?, ' .
+                         ' posting_asset = ?, ' .
+                         ' posting_account = ?, ' .
+                         ' posting_eo = ?, ' .
+                         ' posting_amount = ?, ' .
+                         ' posting_desc = ? ' .
+                         'WHERE posting_owner = ? AND posting_id = ?',
+                         $this->_params['table_postings']);
+        $values = array($type,
+                        (int)$date,
+                        $asset,
+                        $account,
+                        (int)(bool)$eo,
+                        (float)$amount,
+                        Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+                        $this->_ledger,
+                        $postingId);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::_modifyPosting(): %s', $query), 'DEBUG');
+
+        /* Attempt the update query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage($result, 'ERR');
+            return $result;
+        }
+
+        return true;
+    }
+
+    /**
+     * Deletes a posting from the backend.
+     *
+     * @param string $postingId     The posting to delete.
+     *
+     * @return mixed                True or PEAR_Error
+     */
+    function _deletePosting($postingId)
+    {
+        /* Get the task's details for use later. */
+        $posting = $this->getPosting($postingId);
+
+        $query = sprintf('DELETE FROM %s WHERE posting_owner = ? AND posting_id = ?',
+                         $this->_params['table_postings']);
+        $values = array($this->_ledger, $postingId);
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::_deletePosting(): %s', $query), 'DEBUG');
+
+        /* Attempt the delete query. */
+        $result = $this->_db->query($query, $values);
+
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage($result, 'ERR');
+            return $result;
+        }
+
+        return true;
+    }
+
+    /**
+     * Shift an existing posting.
+     *
+     * @param string $postingId  The posting to shift.
+     * @param string $type              The posting type shifting to.
+     * @param string $asset      The ID of the asset account.
+     * @param string $account    The ID of the account.
+     *
+     * @return mixed             True or PEAR_Error
+     */
+    function _shiftPosting($postingId, $type, $asset, $account)
+    {
+        if (!$type && !$asset && !$account) {
+            return true;
+        }
+
+        $query = sprintf('UPDATE %s SET' .
+                         ($type ? ' posting_type = ?, ' : '') .
+                         ($asset ? ' posting_asset = ?, ' : '') .
+                         ($account ? ' posting_account = ?, ' : '').
+                         ' posting_eo = posting_eo ' .
+                         'WHERE posting_owner = ? AND posting_id = ?',
+                         $this->_params['table_postings']);
+        $values = array();
+        if ($type)    { $values[] = $type; }
+        if ($asset)   { $values[] = $asset; }
+        if ($account) { $values[] = $account; }
+        $values[] = $this->_ledger;
+        $values[] = $postingId;
+
+        /* Log the query at a DEBUG log level. */
+        Horde::logMessage(sprintf('Fima_Driver_sql::_shiftPosting(): %s', $query), 'DEBUG');
+
+        /* Attempt the update query. */
+        $result = $this->_db->query($query, $values);
+        if (is_a($result, 'PEAR_Error')) {
+            Horde::logMessage($result, 'ERR');
+            return $result;
+        }
+
+        return true;
+    }
+
+    /**
+     * Shift postings in the backend.
+     *
+     * @param mixed $accountIdFrom  The account(s) to shift postings from.
+     * @param string $accountIdTo   The account to shift postings to.
+     *
+     * @return mixed                True or PEAR_Error
+     */
+    function _shiftPostings($accountIdFrom, $accountIdTo)
+    {
+        if (!is_array($accountIdFrom)) {
+            $accountIdFrom = array($accountIdFrom);
+        }
+
+        foreach ($accountIdFrom as $key => $value) {
+            $accountIdFrom[$key] = $this->_db->quoteSmart($value);
+        }
+
+        $fields = array('posting_asset', 'posting_account');
+        foreach ($fields as $field) {
+            $query = sprintf('UPDATE %s SET' .
+                             ' %s = ? ' .
+                             'WHERE posting_owner = ? AND %s IN (!)',
+                             $this->_params['table_postings'], $field, $field);
+            $values = array($accountIdTo, $this->_ledger, implode(',', $accountIdFrom));
+
+            /* Log the query at a DEBUG log level. */
+            Horde::logMessage(sprintf('Fima_Driver_sql::_shiftPostings(): %s', $query), 'DEBUG');
+
+            /* Attempt the update query. */
+            $result = $this->_db->query($query, $values);
+
+            if (is_a($result, 'PEAR_Error')) {
+                Horde::logMessage($result, 'ERR');
+                return $result;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Deletes all postings and accounts.
+     *
+     * @param mixed $accounts  boolean or account_type
+     * @param mixed $accounts  boolean or posting_type.
+     *
+     * @return mixed                True or PEAR_Error
+     */
+    function _deleteAll($accounts, $postings)
+    {
+        /* Delete postings. */
+        if ($postings) {
+            $query = sprintf('DELETE FROM %s WHERE posting_owner = ?',
+                             $this->_params['table_postings']);
+            $values = array($this->_ledger);
+
+            /* Filter. */
+            if ($postings !== true) {
+                $query .= ' AND posting_type = ?';
+                $values[] = $postings;
+            }
+
+            /* Log the query at a DEBUG log level. */
+            Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAll(): %s', $query), 'DEBUG');
+
+            /* Attempt the delete query. */
+            $result = $this->_db->query($query, $values);
+
+            if (is_a($result, 'PEAR_Error')) {
+                Horde::logMessage($result, 'ERR');
+                return $result;
+            }
+        } else {
+            /* If postings aren't deleted, don't delete accounts. */
+            return false;
+        }
+
+        /* Delete Accounts */
+        if ($accounts) {
+            $query = sprintf('DELETE FROM %s WHERE account_owner = ?',
+                             $this->_params['table_accounts']);
+            $values = array($this->_ledger);
+
+            /* Filter. */
+            if ($accounts !== true) {
+                $query .= ' AND account_type = ?';
+                $values[] = $accounts;
+            }
+
+            /* Log the query at a DEBUG log level. */
+            Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAll(): %s', $query), 'DEBUG');
+
+            /* Attempt the delete query. */
+            $result = $this->_db->query($query, $values);
+
+            if (is_a($result, 'PEAR_Error')) {
+                Horde::logMessage($result, 'ERR');
+                return $result;
+            }
+        }
+
+        return true;
+    }
+
+
+    /**
+     * Build the where clause for a query using the passed filters
+     * Attention: does not include the WHERE keyword, add WHERE 1=1 manually in the query
+     *
+     * @param array $filters  Array of filters, syntax: array(field, value [, operator = '=' [, andor = 'AND']])
+     * @param array $prefix   optional prefix for fields
+     *
+     * @return integer   number of added filters
+     */
+    function _addFilters($filters, &$query, &$values, $prefix = '')
+    {
+        $filtercnt = 0;
+
+        foreach ($filters as $filter) {
+            // and/or
+            if (!isset($filter[3])) {
+                $filter[3] = 'AND';
+            } else {
+                $filter[3] = strtoupper($filter[3]);
+                if (!in_array($filter[3], array('AND', 'OR'))) {
+                    $filter[3] = 'AND';
+                }
+            }
+
+            // subfilter
+            if (is_array($filter[0])) {
+                $query .= ' ' . $filter[3] . ' (1=1';
+                $filtercnt += $this->_addFilters($filter[0], $query, $values, $prefix);
+                $query .= ')';
+                continue;
+            }
+
+            // fix operator
+            if (!isset($filter[2])) {
+                $filter[2] = '=';
+            } else {
+                $filter[2] = strtoupper($filter[2]);
+                if (!in_array($filter[2], array('<', '>', '<=', '>=', '=', '<>', '!=', 'IN', 'NOT IN', 'IS', 'IS NOT', 'LIKE', 'NOT LIKE'))) {
+                    $filter[2] = '=';
+                }
+            }
+
+            // fix operator for null values
+            if ($filter[1] === null) {
+                if (!in_array($filter[2], array('IS', 'IS NOT'))) {
+                    $filter[2] = in_array($filter[2], array('=', 'IN', 'LIKE')) ? 'IS' : 'IS NOT';
+                }
+            } elseif (in_array($filter[2], array('IS', 'IS NOT'))) {
+                $filter[2] = ($filter[2] == 'IS') ? '=' : '!=';
+            }
+
+            // fix operator for array value + prepare values
+            if (is_array($filter[1])) {
+                if (!in_array($filter[2], array('IN', 'NOT IN'))) {
+                   $filter[2] = in_array($filter[2], array('=', 'IS', 'LIKE')) ? 'IN' : 'NOT IN';
+                }
+                $filterph = '(!)';
+                foreach ($filter[1] as $key => $value) {
+                    $filter[1][$key] = $this->_db->quoteSmart($value);
+                }
+                $filter[1] = implode(',', $filter[1]);
+            } else {
+                if (in_array($filter[2], array('IN', 'NOT IN'))) {
+                    $filter[2] = ($filter[2] == 'IN') ? '=' : '!=';
+                }
+                $filterph = '?';
+            }
+
+            // fix != operator
+            if ($filter[2] == '!=') {
+                $filter[2] = '<>';
+            }
+
+            $query .= sprintf(' ' . $filter[3] . ' ' . $prefix . '%s %s %s', $filter[0], $filter[2], $filterph);
+            $values[] = $filter[1];
+            $filtercnt++;
+        }
+
+        return $filtercnt;
+    }
+
+    /**
+     * Attempts to open a connection to the SQL server.
+     *
+     * @return boolean  True on success; PEAR_Error on failure.
+     */
+    function initialize()
+    {
+        try {
+            $this->_db = $GLOBALS['injector']->getInstance('Horde_Db_Pear')->getDb('rw', 'fima', 'storage');
+        } catch (Horde_Exception $e) {
+            return PEAR::raiseError($e->getMessage());
+        }
+
+        return true;
+    }
+
+}
diff --git a/fima/postings.php b/fima/postings.php
new file mode 100644 (file)
index 0000000..5766c36
--- /dev/null
@@ -0,0 +1,733 @@
+<?php
+/**
+ * Copyright 2008 Thomas Trethan <thomas@trethan.net>
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Thomas Trethan <thomas@trethan.net>
+ */
+
+@define('FIMA_BASE', dirname(__FILE__));
+require_once FIMA_BASE . '/lib/base.php';
+
+$vars = Horde_Variables::getDefaultVariables();
+
+/* Get the current action ID. */
+$actionID = Horde_Util::getFormData('actionID');
+
+/* Change posting type. */
+if (($postingtype = Horde_Util::getFormData('postingtype')) !== null) {
+    $postingtypeold = $prefs->getValue('active_postingtype');
+    $prefs->setValue('active_postingtype', $postingtype);
+}
+
+/* Get closed period. */
+$closedperiod = (int)$prefs->getValue('closed_period');
+
+/* Create page array. */
+$pageOb = array();
+$pageOb['url'] = Horde::url('postings.php');
+if (($pageOb['page'] = Horde_Util::getFormData('page')) === null) {
+    $pageOb['page'] = $prefs->getValue('startpage');
+}
+$pageOb['mode'] = 'list';
+
+$title = _("My Postings");
+$ledger = Fima::getActiveLedger();
+$filters = array();
+
+switch ($actionID) {
+case 'change_sort':
+    /* Sort out the sorting values. */
+    if (($sortby = Horde_Util::getFormData('sortby')) !== null) {
+        $prefs->setValue('sortby', $sortby);
+    }
+    if (($sortdir = Horde_Util::getFormData('sortdir')) !== null) {
+        $prefs->setValue('sortdir', $sortdir);
+    }
+    break;
+
+case 'search_postings':
+    /* If we're searching, only list those postings that match the search result. */
+    $_SESSION['fima_search'] = array('type'         => Horde_Util::getFormData('search_type'),
+                                     'date_start'   => Horde_Util::getFormData('search_date_start'),
+                                     'date_end'     => Horde_Util::getFormData('search_date_end'),
+                                     'asset'        => Horde_Util::getFormData('search_asset'),
+                                     'account'      => Horde_Util::getFormData('search_account'),
+                                     'desc'         => Horde_Util::getFormData('search_desc'),
+                                     'amount_start' => Horde_Util::getFormData('search_amount_start'),
+                                     'amount_end'   => Horde_Util::getFormData('search_amount_end'),
+                                     'eo'           => Horde_Util::getFormData('search_eo'));
+
+    /* Build filters. */
+    if ($_SESSION['fima_search']['type'] !== null) {
+        $prefs->setValue('active_postingtype', $_SESSION['fima_search']['type']);
+    }
+    if ($_SESSION['fima_search']['date_start'] !== null) {
+        if (is_array($_SESSION['fima_search']['date_start'])) {
+            $_SESSION['fima_search']['date_start'] = mktime(0, 0, 0, $_SESSION['fima_search']['date_start']['month'],
+                                                                     $_SESSION['fima_search']['date_start']['day'],
+                                                                     $_SESSION['fima_search']['date_start']['year']);
+        } else {
+            $_SESSION['fima_search']['date_start'] = (int)$_SESSION['fima_search']['date_start'];
+        }
+    }
+    if ($_SESSION['fima_search']['date_end'] !== null) {
+        if (is_array($_SESSION['fima_search']['date_end'])) {
+            $_SESSION['fima_search']['date_end']   = mktime(0, 0, 0, $_SESSION['fima_search']['date_end']['month'],
+                                                                     $_SESSION['fima_search']['date_end']['day'],
+                                                                     $_SESSION['fima_search']['date_end']['year']);
+        } else {
+            $_SESSION['fima_search']['date_end'] = (int)$_SESSION['fima_search']['date_end'];
+        }
+    }
+    if ($_SESSION['fima_search']['asset'] !== null) {
+        if (count($_SESSION['fima_search']['asset']) == 0) {
+            unset($_SESSION['fima_search']['asset']);
+        }
+    }
+    if ($_SESSION['fima_search']['account'] !== null) {
+        if (count($_SESSION['fima_search']['account']) == 0) {
+            unset($_SESSION['fima_search']['account']);
+        }
+    }
+    if ($_SESSION['fima_search']['desc'] !== null) {
+        if ($_SESSION['fima_search']['desc'] === '') {
+            unset($_SESSION['fima_search']['desc']);
+        }
+    }
+    if ($_SESSION['fima_search']['amount_start'] !== null) {
+        if ($_SESSION['fima_search']['amount_start'] === '') {
+            unset($_SESSION['fima_search']['amount_start']);
+        }
+    }
+    if ($_SESSION['fima_search']['amount_end'] !== null) {
+        if ($_SESSION['fima_search']['amount_end'] === '') {
+            unset($_SESSION['fima_search']['amount_end']);
+        }
+    }
+    if (isset($_SESSION['fima_search']['amount_start']) && isset($_SESSION['fima_search']['amount_end'])) {
+        if ((double)$_SESSION['fima_search']['amount_start'] > (double)$_SESSION['fima_search']['amount_end']) {
+            $tmp = $_SESSION['fima_search']['amount_start'];
+            $_SESSION['fima_search']['amount_start'] = $_SESSION['fima_search']['amount_end'];
+            $_SESSION['fima_search']['amount_end'] = $tmp;
+        }
+    }
+    if ($_SESSION['fima_search']['eo'] !== null) {
+        if ($_SESSION['fima_search']['eo'] == -1) {
+            unset($_SESSION['fima_search']['eo']);
+        }
+    }
+
+    break;
+
+case 'clear_search':
+    unset($_SESSION['fima_search']);
+    break;
+
+case 'add_postings':
+    $pageOb['mode'] = 'edit';
+    $pageOb['url'] = Horde_Util::addParameter($pageOb['url'], 'actionID', 'add_postings');
+    $actionID = 'save_postings';
+    $postings = array();
+    $title = _("Add Postings");
+    break;
+
+case 'edit_postings':
+    $postingset = Horde_Util::getFormData('indices');
+    if ($postingset !== null) {
+        $pageOb['mode'] = 'edit';
+        $pageOb['url'] = Horde_Util::addParameter($pageOb['url'], 'actionID', 'add_postings');
+        $actionID = 'save_postings';
+        $filters[] = array('id', $postingset);
+        $title = _("Edit Postings");
+    }
+    break;
+
+case 'shift_postings':
+    $postingset = Horde_Util::getFormData('indices');
+    if ($postingset !== null) {
+        $pageOb['mode'] = 'shift';
+        $actionID = 'update_postings';
+        $filters[] = array('id', $postingset);
+        $title = _("Shift Postings");
+    }
+    break;
+
+case 'transfer_postings':
+    $pageOb['mode'] = 'transfer';
+    $actionID = 'copymove_postings';
+    $postings = array();
+    $title = _("Transfer Postings");
+    break;
+
+case 'save_postings':
+    /* Get the form values. */
+    $postingset = Horde_Util::getFormData('posting_id');
+
+    $share = &$GLOBALS['fima_shares']->getShare($ledger);
+    if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
+        $notification->push(sprintf(_("Access denied saving postings to %s."), $share->get('name')), 'horde.error');
+        Horde::url('postings.php', true)->redirect();
+    }
+    if ($postingset !== null) {
+        $pageOb['mode'] = 'edit';
+        $title = _("Edit Postings");
+        $posting_owner = $ledger;
+        $posting_type = $prefs->getValue('active_postingtype');
+
+        $posting_dates = Horde_Util::getFormData('date');
+        $posting_assets = Horde_Util::getFormData('asset');
+        $posting_accounts = Horde_Util::getFormData('account');
+        $posting_eos = Horde_Util::getFormData('eo');
+        $posting_amounts = Horde_Util::getFormData('amount');
+        $posting_descs = Horde_Util::getFormData('desc');
+
+        $postings = array();
+        $savecount = 0;
+
+        $storage = &Fima_Driver::singleton($ledger);
+        foreach($postingset as $index => $posting_id) {
+            $posting_valid = true;
+
+            if ($posting_dates[$index] !== '' || $posting_assets[$index] !== '' || $posting_accounts[$index] !== '' ||
+                $posting_amounts[$index] !== '' || $posting_descs[$index] !== '') {
+
+                $posting_date = Fima::convertDateToStamp($posting_dates[$index], Fima::convertDateFormat($prefs->getValue('date_format')));
+                $posting_asset = $posting_assets[$index];
+                $posting_account = $posting_accounts[$index];
+                $posting_eo = (int)(bool)$posting_eos[$index];
+                $posting_amount = Fima::convertAmountToValue($posting_amounts[$index]);
+                $posting_desc = $posting_descs[$index];
+
+                /* Check posting date. */
+                if ($posting_date === false) {
+                    $posting_valid = false;
+                } elseif ($posting_date <= $closedperiod) {
+                    $posting_valid = false;
+                }
+
+                /* Check asset account and account. */
+                if ($posting_asset === '' || $posting_account === '') {
+                    $posting_valid = false;
+                } elseif ($posting_asset === $posting_account) {
+                    continue;
+                }
+
+                /* Fix amount sign. */
+                if ($prefs->getValue('expenses_sign') == 0) {
+                    $account = Fima::getAccount($posting_account);
+                    if (!is_a($account, 'PEAR_Error') && $account !== null) {
+                        if ($account['type'] == FIMA_ACCOUNTTYPE_EXPENSE) {
+                            $posting_amount *= -1;
+                        }
+                    }
+                }
+
+                /* If $posting_id is set, we're modifying an existing account. Otherwise,
+                 * we're adding a new posting with the provided attributes. */
+                if ($posting_valid) {
+                    if ($posting_id != null) {
+                        $result = $storage->modifyPosting($posting_id, $posting_type, $posting_date, $posting_asset,
+                                                          $posting_account, $posting_eo, $posting_amount, $posting_desc);
+                    } else {
+                        $result = $storage->addPosting($posting_type, $posting_date, $posting_asset, $posting_account,
+                                                       $posting_eo, $posting_amount, $posting_desc);
+                    }
+
+                    // Check our results.
+                    if (is_a($result, 'PEAR_Error')) {
+                        $notification->push(sprintf(_("There was a problem saving the posting: %s."), $result->getMessage()), 'horde.error');
+                        $posting_valid = false;
+                    } else {
+                        $savecount++;
+                    }
+                }
+
+                /* Reload invalid or unsaved postings. */
+                if (!$posting_valid) {
+                    $postings[] = array('posting_id' => $posting_id,
+                                        'owner' => $ledger,
+                                        'type' => $posting_type,
+                                        'date' => $posting_date,
+                                        'asset' => $posting_asset,
+                                        'account' => $posting_account,
+                                        'eo' => $posting_eo,
+                                        'amount' => $posting_amount,
+                                        'desc' => $posting_desc);
+                }
+            }
+        }
+
+        if ($savecount > 0) {
+            $notification->push(sprintf(_("Saved %d postings."), $savecount), 'horde.success');
+        }
+        if (count($postings) > 0) {
+            $notification->push(sprintf(_("%d postings not saved."), count($postings)), 'horde.error');
+        } else {
+            /* Return to the posting list. */
+            Horde::url('postings.php', true)->redirect();
+        }
+    } else {
+        /* Return to the posting list. */
+        Horde::url('postings.php', true)->redirect();
+    }
+    break;
+
+case 'delete_postings':
+    /* Delete postings if we're provided with valid account IDs. */
+    $postingset = Horde_Util::getFormData('indices');
+
+    $share = &$GLOBALS['fima_shares']->getShare($ledger);
+    if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
+        $notification->push(sprintf(_("Access denied deleting postings from %s."), $share->get('name')), 'horde.error');
+        Horde::url('postings.php', true)->redirect();
+    }
+    if ($postingset !== null) {
+        $storage = &Fima_Driver::singleton($ledger);
+        $delcount = 0;
+        foreach($postingset as $index => $posting_id) {
+            $result = $storage->deletePosting($posting_id);
+            if (is_a($result, 'PEAR_Error')) {
+                $notification->push(sprintf(_("There was a problem deleting posting #%d: %s"),
+                                            $index, $result->getMessage()), 'horde.error');
+            } else {
+                $delcount++;
+            }
+        }
+        if ($delcount > 0) {
+            $notification->push(sprintf(_("Deleted %d postings."), $delcount), 'horde.success');
+        }
+    }
+
+    /* Return to the posting list. */
+    Horde::url('postings.php', true)->redirect();
+
+case 'update_postings':
+    /* Get the form values. */
+    $postingset = Horde_Util::getFormData('posting_id');
+
+    $share = &$GLOBALS['fima_shares']->getShare($ledger);
+    if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
+        $notification->push(sprintf(_("Access denied shifting postings in %s."), $share->get('name')), 'horde.error');
+        Horde::url('postings.php', true)->redirect();
+    }
+    if ($postingset !== null) {
+        $posting_type = Horde_Util::getFormData('type');
+        $posting_asset = Horde_Util::getFormData('asset');
+        $posting_account = Horde_Util::getFormData('account');
+
+        if ($posting_type || $posting_asset || $posting_account) {
+            $storage = &Fima_Driver::singleton($ledger);
+            $shiftcount = 0;
+
+            foreach($postingset as $index => $posting_id) {
+                $result = $storage->ShiftPosting($posting_id, $posting_type, $posting_asset, $posting_account);
+                if (is_a($result, 'PEAR_Error')) {
+                    $notification->push(sprintf(_("There was a problem shifting posting #%d: %s"),
+                                                  $index, $result->getMessage()), 'horde.error');
+                } else {
+                    $shiftcount++;
+                }
+            }
+            if ($shiftcount > 0) {
+                $notification->push(sprintf(_("Shifted %d postings."), $shiftcount), 'horde.success');
+            }
+        }
+    }
+
+    /* Return to the posting list. */
+    Horde::url('postings.php', true)->redirect();
+
+case 'copymove_postings':
+    $share = &$GLOBALS['fima_shares']->getShare($ledger);
+    if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
+        $notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
+        Horde::url('postings.php', true)->redirect();
+    }
+    if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE) && (!Horde_Util::getFormData('keep') || Horde_Util::getFormData('delete'))) {
+        $notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
+        Horde::url('postings.php', true)->redirect();
+    }
+    $type_from = Horde_Util::getFormData('type_from');
+    $period_from = Horde_Util::getFormData('period_from');
+    $keep = Horde_Util::getFormData('keep');
+    $summarize = Horde_Util::getFormData('summarize');
+    $summarize_account = Horde_Util::getFormData('summarize_post_account');
+    $type_to = Horde_Util::getFormData('type_to');
+    $period_to = Horde_Util::getFormData('period_to');
+    $delete = Horde_Util::getFormData('delete');
+
+    $period_from_start = mktime(0, 0, 0, ($period_from['month'] === '') ? 1 : $period_from['month'], 1, (int)$period_from['year']);
+    $period_from_end = mktime(0, 0, 0, ($period_from['month'] === '') ? 12 : $period_from['month'] + 1, ($period_from['month'] === '') ? 31 : 0, (int)$period_from['year']);
+    $period_to_start = mktime(0, 0, 0, ($period_to['month'] === '') ? 1 : $period_to['month'], 1, (int)$period_to['year']);
+    $period_to_end = mktime(0, 0, 0, ($period_to['month'] === '') ? 12 : $period_to['month'] + 1, ($period_to['month'] === '') ? 31 : 0, (int)$period_to['year']);
+
+    $storage = &Fima_Driver::singleton($ledger);
+
+    /* Delete existing. */
+    if ($delete) {
+        $transferfilters = array(array('type', $type_to),
+                                 array('date', $period_to_start, '>='),
+                                 array('date', $period_to_end, '<='));
+        $postings = Fima::listPostings($transferfilters);
+        $delcount = 0;
+        foreach ($postings as $postingId => $posting) {
+            $result = $storage->deletePosting($postingId);
+            if (is_a($result, 'PEAR_Error')) {
+                $notification->push(sprintf(_("There was a problem deleting an existing posting: %s"),
+                                            $result->getMessage()), 'horde.error');
+            } else {
+                $delcount++;
+            }
+        }
+        if ($delcount > 0) {
+            $notification->push(sprintf(_("Deleted %d existing postings."), $delcount), 'horde.success');
+        }
+    }
+
+    /* Copy postings. */
+    $transferfilters = array(array('type', $type_from),
+                             array('date', $period_from_start, '>='),
+                             array('date', $period_from_end, '<='));
+    $postings = Fima::listPostings($transferfilters);
+
+    if ($summarize != 'none') {
+        $accounts = Fima::listAccounts();
+        $postingscopy = array();
+
+        foreach ($postings as $postingId => $posting) {
+            $asset = (isset($accounts[$posting['asset']]))
+                ? (($accounts[$posting['asset']]['parent_id'] !== null) ? $accounts[$posting['asset']]['parent_id'] : $accounts[$posting['asset']]['account_id'])
+                : $posting['asset'];
+            $account = (isset($accounts[$posting['account']]))
+                ? (($accounts[$posting['account']]['parent_id'] !== null) ? $accounts[$posting['account']]['parent_id'] : $accounts[$posting['account']]['account_id'])
+                : $posting['account'];
+
+            if ($summarize == 'combine') {
+                $copyId = $asset . '_' . $account . '_' . strftime('%Y%m', $posting['date']);
+
+                if (isset($postingscopy[$copyId])) {
+                    $postingscopy[$copyId]['amount'] += $posting['amount'];
+                } else {
+                    $postingscopy[$copyId] = $posting;
+                    $postingscopy[$copyId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+                    $postingscopy[$copyId]['asset'] = $asset;
+                    $postingscopy[$copyId]['account'] = $account;
+                    $postingscopy[$copyId]['eo'] = 0;
+                    $postingscopy[$copyId]['desc'] = _("Summarized");
+                }
+            } elseif ($summarize == 'post') {
+                $copyIdAsset = $asset . '_' . strftime('%Y%m', $posting['date']);
+                $copyIdAccount = $account . '_' . strftime('%Y%m', $posting['date']);
+
+                if (isset($postingscopy[$copyIdAsset])) {
+                    $postingscopy[$copyIdAsset]['amount'] += $posting['amount'];
+                } else {
+                    $postingscopy[$copyIdAsset] = $posting;
+                    $postingscopy[$copyIdAsset]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+                    $postingscopy[$copyIdAsset]['asset'] = $asset;
+                    $postingscopy[$copyIdAsset]['account'] = $summarize_account;
+                    $postingscopy[$copyIdAsset]['eo'] = 0;
+                    $postingscopy[$copyIdAsset]['desc'] = _("Summarized");
+                }
+
+                if (isset($postingscopy[$copyIdAccount])) {
+                    $postingscopy[$copyIdAccount]['amount'] += $posting['amount'];
+                } else {
+                    $postingscopy[$copyIdAccount] = $posting;
+                    $postingscopy[$copyIdAccount]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+                    $postingscopy[$copyIdAccount]['asset'] = $summarize_account;
+                    $postingscopy[$copyIdAccount]['account'] = $account;
+                    $postingscopy[$copyIdAccount]['eo'] = 0;
+                    $postingscopy[$copyIdAccount]['desc'] = _("Summarized");
+                }
+            }
+        }
+    } else {
+        $postingscopy = &$postings;
+        foreach ($postingscopy as $postingId => $posting) {
+            $postingscopy[$postingId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], strftime('%d', $posting['date']), (int)$period_to['year']);
+        }
+    }
+
+    $addcount = 0;
+    foreach ($postingscopy as $postingId => $posting) {
+        $result = $storage->addPosting($type_to, $posting['date'], $posting['asset'], $posting['account'],
+                                       $posting['eo'], $posting['amount'], $posting['desc']);
+
+        // Check our results.
+        if (is_a($result, 'PEAR_Error')) {
+            $notification->push(sprintf(_("There was a problem saving the posting: %s."), $result->getMessage()), 'horde.error');
+        } else {
+            $addcount++;
+        }
+    }
+    if ($addcount > 0) {
+        $notification->push(sprintf($summarize ? _("Summarized %d postings.") : _("Transfered %d postings."), $addcount), 'horde.success');
+    }
+
+    /* Delete original postings. */
+    if (!$keep) {
+        $delcount = 0;
+        foreach ($postings as $postingId => $posting) {
+            $result = $storage->deletePosting($postingId);
+            if (is_a($result, 'PEAR_Error')) {
+                $notification->push(sprintf(_("There was a problem deleting an original posting: %s"),
+                                            $result->getMessage()), 'horde.error');
+            } else {
+                $delcount++;
+            }
+        }
+        if ($delcount > 0) {
+            $notification->push(sprintf(_("Deleted %d original postings."), $delcount), 'horde.success');
+        }
+    }
+
+    /* Return to the posting list. */
+    Horde::url('postings.php', true)->redirect();
+
+default:
+    break;
+}
+
+/* Print. */
+$print_view = (bool)Horde_Util::getFormData('print');
+if (!$print_view && $pageOb['mode'] == 'list') {
+    $print_link = Horde_Util::addParameter(Horde::url('postings.php'), array('print' => 1));
+}
+
+/* Filters. */
+$postingtype = $prefs->getValue('active_postingtype');
+$filters[] = array('type', $postingtype);
+if (isset($_SESSION['fima_search'])) {
+    $title = _("Search Results");
+    foreach ($_SESSION['fima_search'] as $searchId => $search) {
+        if ($search === null) {
+            continue;
+        }
+        switch ($searchId) {
+        case 'date_start':   $filters[] = array('date', $search, '>='); break;
+        case 'date_end':     $filters[] = array('date', $search, '<='); break;
+        case 'asset':           $filters[] = array(array(array('asset', $search), array('account', $search, '=', 'OR'))); break;
+        case 'account':      $filters[] = array('account', $search); break;
+        case 'desc':         $filters[] = array('desc', Fima::convertWildcards($search), 'LIKE'); break;
+        case 'amount_start': $filters[] = array('amount', Fima::convertAmountToValue($search), '>='); break;
+        case 'amount_end':   $filters[] = array('amount', Fima::convertAmountToValue($search), '<='); break;
+        case 'eo':           $filters[] = array('eo', (int)(bool)$search);
+        default:             break;
+        }
+    }
+}
+
+/* Retrieve accounts, accounttypes and postings (if not set before). */
+$accounts = Fima::listAccounts();
+$accounttypes = Fima::getAccountTypes();
+if (!isset($postings)) {
+    $postings = Fima::listPostings($filters, ($pageOb['mode'] != 'list' || $print_view) ? null : $pageOb['page']);
+}
+
+$pageOb['postings_perpage'] = $prefs->getValue('max_postings');
+$pageOb['postings_total'] = Fima::getPostingsCount();
+
+if ($pageOb['mode'] == 'edit') {
+    /* Fix amount sign. */
+    if ($prefs->getValue('expenses_sign') == 0) {
+        foreach ($postings as $postingId => $posting) {
+            if ($accounts[$posting['account']]['type'] == FIMA_ACCOUNTTYPE_EXPENSE) {
+                $postings[$postingId]['amount'] *= -1;
+            }
+        }
+    }
+    /* Add blank postings. */
+    for ($i = count($postings); $i < max($pageOb['postings_perpage'], 12); $i++) {
+        $postings[] = array('posting_id' => null,
+                            'owner' => $ledger,
+                            'type' => $postingtype,
+                            'date' => null,
+                            'asset' => null,
+                            'account' => null,
+                            'eo' => null,
+                            'amount' => null,
+                            'desc' => null);
+    }
+}
+
+/* Add account information to postings and create flags list. */
+if ($pageOb['mode'] == 'list') {
+    $flags = array();
+    foreach ($postings as $postingId => $posting) {
+        $postings[$postingId]['desc'] = htmlspecialchars($posting['desc']);
+
+        if (isset($accounts[$posting['asset']])) {
+            $postings[$postingId]['asset_label'] = htmlspecialchars($accounts[$posting['asset']]['label']);
+            $postings[$postingId]['asset_closed'] = $accounts[$posting['asset']]['closed'];
+        } else {
+            $postings[$postingId]['asset_label'] = _("Unknown");
+            $postings[$postingId]['asset_closed'] = false;
+        }
+        if (isset($accounts[$posting['account']])) {
+            $postings[$postingId]['account_label'] = htmlspecialchars($accounts[$posting['account']]['label']);
+            $postings[$postingId]['account_type'] = $accounts[$posting['account']]['type'];
+            $postings[$postingId]['account_type_eo'] = sprintf($posting['eo'] ? _("e.o. %s") : _("%s") , $accounttypes[$accounts[$posting['account']]['type']]);
+            $postings[$postingId]['account_closed'] = $accounts[$posting['account']]['closed'];
+        } else {
+            $postings[$postingId]['account_label'] = _("Unknown");
+            $postings[$postingId]['account_type'] = '';
+            $postings[$postingId]['account_type_eo'] = '';
+            $postings[$postingId]['account_closed'] = false;
+        }
+
+        $flag = 0;
+        $flagpos = 0;
+        foreach ($accounttypes as $typeId => $typeLabel) {
+            if ($postings[$postingId]['account_type'] == $typeId) {
+                $flag |= pow(2, $flagpos);
+            }
+            $flagpos++;
+        }
+        $flags[] = $flag;
+    }
+}
+
+/* Set up page information. */
+$pageOb['page_count'] = ceil($pageOb['postings_total'] / $pageOb['postings_perpage']);
+if ($pageOb['page'] < 0) {
+    $pageOb['page'] += $pageOb['page_count'] + 1;
+}
+if ($pageOb['mode'] == 'list') {
+    if ($pageOb['postings_total'] == 0) {
+        $pageOb['postings_count'] = _("No Postings");
+    } else {
+        $pageOb['postings_count'] = sprintf(_("%s to %s of %s Postings"),
+                                            ($pageOb['page'] - 1) * $pageOb['postings_perpage'] + 1,
+                                            min($pageOb['page'] * $pageOb['postings_perpage'], $pageOb['postings_total']),
+                                            $pageOb['postings_total']);
+    }
+}
+
+/* Get sorting. */
+if ($pageOb['mode'] == 'list' || $pageOb['mode'] == 'edit') {
+    $sortby = $prefs->getValue('sortby');
+    $sortdir = $prefs->getValue('sortdir');
+    $sorturl = Horde_Util::addParameter($pageOb['url'], 'sortdir', ($sortdir) ? 0 : 1);
+}
+
+/* Generate page links. */
+if ($pageOb['mode'] == 'list') {
+    $graphicsdir = Horde_Themes::img(null, 'horde');
+    if ($pageOb['page'] == 1) {
+        $pageOb['pages_first'] = Horde::img('nav/first-grey.png', null, null, $graphicsdir);
+        $pageOb['pages_prev'] = Horde::img('nav/left-grey.png', null, null, $graphicsdir);
+    } else {
+        $first_url = Horde_Util::addParameter($pageOb['url'], 'page', 1);
+        $pageOb['pages_first'] = Horde::link($first_url, _("First Page")) . Horde::img('nav/first.png', '<<', null, $graphicsdir) . '</a>';
+        $prev_url = Horde_Util::addParameter($pageOb['url'], 'page', $pageOb['page'] - 1);
+        $pageOb['pages_prev'] = Horde::link($prev_url, _("Previous Page"), '', '', '', '', '', array('id' => 'prev')) . Horde::img('nav/left.png', '<', null, $graphicsdir) . '</a>';
+    }
+    if ($pageOb['page'] == $pageOb['page_count']) {
+        $pageOb['pages_last'] = Horde::img('nav/last-grey.png', null, null, $graphicsdir);
+        $pageOb['pages_next'] = Horde::img('nav/right-grey.png', null, null, $graphicsdir);
+    } else {
+        $next_url = Horde_Util::addParameter($pageOb['url'], 'page', $pageOb['page'] + 1);
+        $pageOb['pages_next'] = Horde::link($next_url, _("Next Page"), '', '', '', '', '', array('id' => 'next')) . Horde::img('nav/right.png', '>', null, $graphicsdir) . '</a>';
+        $last_url = Horde_Util::addParameter($pageOb['url'], 'page', $pageOb['page_count']);
+        $pageOb['pages_last'] = Horde::link($last_url, _("Last Page")) . Horde::img('nav/last.png', '>>', null, $graphicsdir) . '</a>';
+    }
+}
+
+/* Some browsers have trouble with hidden overflow in table cells but not in divs. */
+if ($GLOBALS['browser']->hasQuirk('no_hidden_overflow_tables')) {
+    $overflow_begin = '<div class="ohide">';
+    $overflow_end = '</div>';
+} else {
+    $overflow_begin = '';
+    $overflow_end = '';
+}
+
+/* Set up row Ids. */
+$rowId = 0;
+
+/* Get date and amount format. */
+$datefmt = $prefs->getValue('date_format');
+$amountfmt = $prefs->getValue('amount_format');
+
+$js_onload = array();
+
+if ($pageOb['mode'] == 'edit') {
+    /* Fix date format. */
+    $datefmt = Fima::convertDateFormat($datefmt);
+
+    /* Add current date in first field if no postings. */
+    foreach ($postings as $key => $value) {
+        if ($value['date'] == '') {
+            $js_onload[] = '$("date1").setValue(' . Horde_Serialize::serialize(strftime($datefmt), Horde_Serialize::JSON, 'UTF-8') . ')';
+        }
+        break;
+    }
+
+    /* Select first date field. */
+    $js_onload[] = 'updateResult()';
+    $js_onload[] = 'updateAssetResult(_getall("asset[]")[0])';
+    $js_onload[] = '$("date1").focus().select()';
+}
+
+Horde::addInlineScript($js_onload, 'dom');
+
+require FIMA_TEMPLATES . '/common-header.inc';
+if ($print_view) {
+    require_once $registry->get('templates', 'horde') . '/javascript/print.js';
+} else {
+    require FIMA_TEMPLATES . '/menu.inc';
+}
+if ($browser->hasFeature('javascript')) {
+    require FIMA_TEMPLATES . '/postings/javascript_' . $pageOb['mode'] . '.inc';
+}
+
+/* Get current asset results. */
+if ($pageOb['mode'] == 'edit') {
+    $assetresults = Fima::getAssetResults($prefs->getValue('active_postingtype'));
+}
+
+/* Generate tabs. */
+if ($pageOb['mode'] != 'transfer' && !$print_view) {
+    $tabs = new Horde_Core_Ui_Tabs('postingtype', $vars);
+    $postingtypes = Fima::getPostingTypes();
+    foreach ($postingtypes as $typeValue => $typeLabel) {
+        $tabs->addTab($typeLabel, $pageOb['url'], $typeValue);
+    }
+    echo $tabs->render($prefs->getValue('active_postingtype'));
+}
+
+/* Generate list. */
+if (!$print_view) {
+    require FIMA_TEMPLATES . '/postings/header.inc';
+}
+
+if ($pageOb['mode'] == 'list' && $pageOb['page_count'] == 0) {
+    require FIMA_TEMPLATES . '/postings/empty.inc';
+} else {
+    $form = 1;
+    if (!$print_view) {
+        require FIMA_TEMPLATES . '/postings/navbar.inc';
+        require FIMA_TEMPLATES . '/postings/actions.inc';
+    }
+
+    require FIMA_TEMPLATES . '/postings/posting_headers.inc';
+    require FIMA_TEMPLATES . '/postings/' . $pageOb['mode'] . '.inc';
+    require FIMA_TEMPLATES . '/postings/posting_footers.inc';
+
+    /* If there are 20 postings or less, don't show the actions/navbar again. */
+    if ((count($postings) > 20 || $pageOb['mode'] != 'list') && !$print_view) {
+        $form = 2;
+        require FIMA_TEMPLATES . '/postings/actions.inc';
+        require FIMA_TEMPLATES . '/postings/navbar.inc';
+    } else {
+        /* TODO */
+        echo '<tr><td class="control" colspan="6"></td></tr>';
+    }
+}
+require FIMA_TEMPLATES . '/postings/footer.inc';
+
+require $registry->get('templates', 'horde') . '/common-footer.inc';
diff --git a/fima/templates/common-header.inc b/fima/templates/common-header.inc
new file mode 100644 (file)
index 0000000..1dc19c1
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+if (isset($language)) {
+    header('Content-type: text/html; charset=' . 'UTF-8');
+    header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Fima: Copyright 2007-2008 The Horde Project. Fima is under the GPL.          -->
+<!--     Horde Project: http://www.horde.org/ | Fima: http://www.horde.org/fima/  -->
+<!--                 Horde Licenses: http://www.horde.org/licenses/               -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+    $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
index 9501887..4661051 100644 (file)
@@ -309,7 +309,7 @@ class Folks_Hooks
                 $value = hash('md5', $value);
             }
             $fields[] = 'user_' . Horde_String::lower($field);
-            $values[] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']);
+            $values[] = Horde_String::convertCharset($value, 'UTF-8', $conf['sql']['charset']);
         }
 
         $values[] = $userID;
index 591e656..0225279 100644 (file)
@@ -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' => $GLOBALS['registry']->getCharset()));
+        $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => 'UTF-8'));
 
         $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, $GLOBALS['registry']->getCharset());
+                $mail->addAttachment($file, null, null, 'UTF-8');
             }
         }
 
index e921cd2..e2da33d 100644 (file)
@@ -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' => $GLOBALS['registry']->getCharset()));
+                                          'charset' => 'UTF-8'));
 
         $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, $GLOBALS['registry']->getCharset());
+                $mail->addAttachment($file, null, null, 'UTF-8');
             }
         }
 
@@ -78,7 +78,7 @@ class Folks_Notification_mail extends Folks_Notification {
             if (empty($to)) {
                 continue;
             }
-            $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset(), true);
+            $mail->addHeader('To', $to, 'UTF-8', true);
             $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
         }
 
index a17d8e5..20c3d4d 100644 (file)
@@ -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'], $GLOBALS['registry']->getCharset());
+    $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], 'UTF-8');
     $mail->addHeader('User-Agent', 'Folks' . $registry->getVersion());
     $sent = $mail->send($conf['mailer']['type'], $conf['mailer']['params']);
     if ($sent instanceof PEAR_Error) {
index 0a2ca34..b35638e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 731f5c5..6c7d321 100644 (file)
@@ -1,4 +1,4 @@
-<?php echo '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '"?>' ?>
+<?php echo '<?xml version="1.0" encoding="' . 'UTF-8' . '"?>' ?>
 
 <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
index 5c53ee7..d98eae0 100644 (file)
@@ -1,4 +1,4 @@
-<?php echo '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '"?>' ?>
+<?php echo '<?xml version="1.0" encoding="' . 'UTF-8' . '"?>' ?>
 
 <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
index dfe994e..aabe49b 100644 (file)
@@ -419,7 +419,7 @@ class Horde_Alarm_Sql extends Horde_Alarm
      */
     protected function _toDriver($value)
     {
-        return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+        return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
     }
 
 }
index 36de35e..0be4f4e 100644 (file)
@@ -241,7 +241,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.", $max_blocks), $max_blocks), ENT_COMPAT, $GLOBALS['registry']->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.", $max_blocks), $max_blocks), ENT_COMPAT, 'UTF-8');
                     }
                     $GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
                     break;
index 2d07375..745db8d 100644 (file)
@@ -555,7 +555,7 @@ HTML;
      */
     static public function sendHTTPResponse($data, $ct)
     {
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         // Output headers and encoded response.
         switch ($ct) {
@@ -618,7 +618,7 @@ HTML;
      */
     static public function escapeJson($data, array $options = array())
     {
-        $json = Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? $GLOBALS['registry']->getCharset() : $options['charset']);
+        $json = Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? 'UTF-8' : $options['charset']);
         if (empty($options['nodelimit'])) {
             $json = '/*-secure-' . $json . '*/';
         }
@@ -1135,7 +1135,7 @@ HTML;
         }
         if (!empty($title)) {
             if ($escape) {
-                $charset = $GLOBALS['registry']->getCharset();
+                $charset = 'UTF-8';
                 $old_error = error_reporting(0);
                 $title = str_replace(
                     array("\r", "\n"), '',
@@ -1176,7 +1176,7 @@ HTML;
                                        $attributes = array())
     {
         if (!empty($title)) {
-            $charset = $GLOBALS['registry']->getCharset();
+            $charset = 'UTF-8';
             $old_error = error_reporting(0);
             $title = '&lt;pre&gt;' . preg_replace(array('/\n/', '/((?<!<br)\s{1,}(?<!\/>))/em', '/<br \/><br \/>/', '/<br \/>/'), array('', 'str_repeat("&nbsp;", strlen("$1"))', '&lt;br /&gt; &lt;br /&gt;', '&lt;br /&gt;'), nl2br(htmlspecialchars(htmlspecialchars($title, ENT_QUOTES, $charset), ENT_QUOTES, $charset))) . '&lt;/pre&gt;';
             error_reporting($old_error);
@@ -1276,7 +1276,7 @@ HTML;
      */
     static public function img($src, $alt = '', $attr = '')
     {
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         /* If browser does not support images, simply return the ALT text. */
         if (!$GLOBALS['browser']->hasFeature('images')) {
@@ -1319,7 +1319,7 @@ HTML;
      */
     static public function fullSrcImg($src, $options = array())
     {
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         /* If browser does not support images, simply return the ALT text. */
         if (!$GLOBALS['browser']->hasFeature('images')) {
@@ -1575,7 +1575,7 @@ HTML;
      */
     static public function stripAccessKey($label)
     {
-        $multibyte = isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)]);
+        $multibyte = isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getLanguageCharset()]);
         return preg_replace('/_([A-Za-z])/',
                             $multibyte && preg_match('/[\x80-\xff]/', $label) ? '' : '\1',
                             $label);
@@ -1598,10 +1598,10 @@ HTML;
             return $stripped_label;
         }
 
-        if (isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)])) {
+        if (isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getLanguageCharset()])) {
             /* Prefix parenthesis with the UTF-8 representation of the LRO
              * (Left-to-Right-Override) Unicode codepoint U+202D. */
-            $prefix = ($GLOBALS['registry']->getCharset() == 'UTF-8')
+            $prefix = ('UTF-8' == 'UTF-8')
                 ? "\xe2\x80\xad"
                 : '';
             return $stripped_label . $prefix . '(<span class="accessKey">'
@@ -1801,7 +1801,7 @@ HTML;
      */
     static public function addInlineJsVars($data, $ret = false, $onload = null)
     {
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $out = array();
 
         foreach ($data as $key => $val) {
index b3e528c..f303a26 100644 (file)
@@ -1604,7 +1604,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\", \"' . $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']);
+            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\", \"' . 'UTF-8' . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . 'UTF-8' . '\")"), $val);'), $GLOBALS['registry']->nlsconfig['languages']);
 
         case 'list-blocks':
             $collection = Horde_Block_Collection::singleton();
index baab9ab..32c5c46 100644 (file)
@@ -73,7 +73,7 @@ class Horde_Core_Ajax_Imple_SpellChecker extends Horde_Core_Ajax_Imple
         }
 
         Horde::addInlineScript(array(
-            $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')'
+            $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, 'UTF-8') . ')'
         ), 'dom');
     }
 
index 4ae78bb..016f7fa 100644 (file)
@@ -89,7 +89,7 @@ abstract class Horde_Core_Auth_Signup_Base
                 'body' => $message,
                 'to' => $conf['signup']['email'],
                 'from' => $conf['signup']['email'],
-                'subject' => $GLOBALS['registry']->getCharset()));
+                'subject' => 'UTF-8'));
             $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
         }
     }
index 8cc3ba8..a8bbc47 100644 (file)
@@ -70,7 +70,7 @@ class Horde_Core_Factory_Alarm
         $handler_params = array(
             'identity' => $injector->getInstance('Horde_Prefs_Identity'),
             'mail' => $injector->getInstance('Horde_Mail'),
-            'charset' => $GLOBALS['registry']->getCharset()
+            'charset' => 'UTF-8'
         );
         $alarm->addHandler('mail', new Horde_Alarm_Handler_Mail($handler_params));
 
index d417b4a..178d090 100644 (file)
@@ -126,7 +126,7 @@ class Horde_Core_Factory_Auth
                     $params['backend'] = $this->getOb($params['backend']['driver'], $params['backend']['params']);
                 }
 
-                $params['charset'] = $GLOBALS['registry']->getCharset();
+                $params['charset'] = 'UTF-8';
                 break;
 
             case 'http_remote':
@@ -136,7 +136,7 @@ class Horde_Core_Factory_Auth
                 break;
 
             case 'imap':
-                $params['charset'] = $GLOBALS['registry']->getCharset();
+                $params['charset'] = 'UTF-8';
                 break;
 
             case 'kolab':
index 58b7cfc..14d2b0a 100644 (file)
@@ -58,7 +58,7 @@ class Horde_Core_Factory_Crypt
         global $registry;
 
         $params = array_merge(array(
-            'charset' => $registry->getCharset(),
+            'charset' => 'UTF-8',
             'email_charset' => $registry->getEmailCharset(),
             'temp' => Horde::getTempDir()
         ), $params);
index 7221368..c20cc8f 100644 (file)
@@ -59,7 +59,7 @@ class Horde_Core_Factory_Data
         $params['vars'] = Horde_Variables::getDefaultVariables();
 
         if (strcasecmp($driver, 'csv') === 0) {
-            $params['charset'] = $GLOBALS['registry']->getCharset();
+            $params['charset'] = 'UTF-8';
         }
 
         return Horde_Data::factory($driver, $params);
index b8f08fc..2c5d7ea 100644 (file)
@@ -100,7 +100,7 @@ class Horde_Core_Factory_MimeViewer
             : $config['app'] . '_Mime_Viewer_' . $config['driver'];
 
         $params = array_merge($config, array(
-            'charset' => $GLOBALS['registry']->getCharset(),
+            'charset' => 'UTF-8',
             // TODO: Logging
             // 'logger' => $this->_injector->getInstance('Horde_Log_Logger'),
             'temp_file' => array('Horde', 'getTempFile'),
index 3646125..f3cf750 100644 (file)
@@ -77,11 +77,11 @@ class Horde_Core_Factory_Prefs
 
         $opts = array_merge(array(
             'cache' => true,
-            'charset' => $GLOBALS['registry']->getCharset(),
+            'charset' => 'UTF-8',
             'logger' => $this->_injector->getInstance('Horde_Log_Logger'),
             'password' => '',
             'sizecallback' => ((isset($GLOBALS['conf']['prefs']['maxsize'])) ? array($this, 'sizeCallback') : null),
-            'uicharset' => $GLOBALS['registry']->getCharset(),
+            'uicharset' => 'UTF-8',
             'user' => ''
         ), $opts);
         ksort($opts);
index ee846ab..cdc8355 100644 (file)
@@ -145,7 +145,7 @@ class Horde_Core_Factory_TextFilter
             case 'html2text':
             case 'space2html':
             case 'text2html':
-                $params['charset'] = $GLOBALS['registry']->getCharset();
+                $params['charset'] = 'UTF-8';
                 break;
             }
         }
index 2a8f3c9..55ce913 100644 (file)
@@ -29,7 +29,7 @@ class Horde_Core_Notification_Status extends Horde_Notification_Event_Status
                 : (is_string($data) ? 'horde.message' : 'horde.error');
         }
 
-        $this->charset = $GLOBALS['registry']->getCharset();
+        $this->charset = 'UTF-8';
 
         parent::__construct($data, $type, $flags);
     }
index 25aa7f7..ab66ec8 100644 (file)
@@ -56,7 +56,7 @@ class Horde_Core_Prefs_Identity extends Horde_Prefs_Identity
         $body = new Horde_Mime_Part();
         $body->setType('text/plain');
         $body->setContents(Horde_String::wrap($message, 76, "\n"));
-        $body->setCharset($GLOBALS['registry']->getCharset());
+        $body->setCharset('UTF-8');
 
         $body->send($new_addr, $msg_headers, $GLOBALS['injector']->getInstance('Horde_Mail'));
 
index 6b2c208..46e7ae6 100644 (file)
@@ -774,7 +774,7 @@ class Horde_Core_Prefs_Ui
                     // Fall-through
 
                 default:
-                    $val2 = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'UTF-8');
+                    $val2 = Horde_String::convertCharset($val, 'UTF-8', 'UTF-8');
                 }
 
                 // [0] = pref name
index b65d9b3..52201d1 100644 (file)
@@ -103,7 +103,7 @@ class Horde_Core_Tree_Javascript extends Horde_Core_Tree_Html
         }
 
         Horde::addInlineScript(array(
-            'window.' . $js_var . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')'
+            'window.' . $js_var . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, 'UTF-8') . ')'
         ), 'dom');
 
         return '<div id="' . $this->_instance . '"></div>';
index e96840b..2bf8d84 100644 (file)
@@ -38,7 +38,7 @@ class Horde_Core_Ui_VarRenderer
     public function __construct($params = array())
     {
         $this->_params = $params;
-        $this->_charset = $GLOBALS['registry']->getCharset();
+        $this->_charset = 'UTF-8';
     }
 
     /**
index 33b1d7c..dff0bcd 100644 (file)
@@ -2152,20 +2152,14 @@ class Horde_Registry
     /**
      * 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)
+    public function getLanguageCharset()
     {
-        if ($original) {
-            return empty($this->nlsconfig['charsets'][$GLOBALS['language']])
-                ? 'ISO-8859-1'
-                : $this->nlsconfig['charsets'][$GLOBALS['language']];
-        }
-        return 'UTF-8';
+        return empty($this->nlsconfig['charsets'][$GLOBALS['language']])
+            ? 'ISO-8859-1'
+            : $this->nlsconfig['charsets'][$GLOBALS['language']];
     }
 
     /**
@@ -2325,15 +2319,11 @@ class Horde_Registry
      *                           LC_MESSAGES directory resides.
      * @param string $charset    The charset.
      */
-    public function setTextdomain($app, $directory, $charset = null)
+    public function setTextdomain($app, $directory, $charset = 'UTF-8')
     {
         bindtextdomain($app, $directory);
         textdomain($app);
 
-        if (is_null($charset)) {
-            $charset = $this->getCharset();
-        }
-
         $this->_cachedCharset(0, bind_textdomain_codeset($app, $charset));
 
         if (!Horde::contentSent()) {
index dd0a0a3..004619a 100644 (file)
@@ -451,7 +451,7 @@ class DataTree_sql extends DataTree {
             return null;
         } else {
             $name = Horde_String::convertCharset($name, $this->_params['charset'],
-                                           $GLOBALS['registry']->getCharset());
+                                           'UTF-8');
             // 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, $GLOBALS['registry']->getCharset());
+                $data = Horde_Serialize::serialize($object->getData(), $ser, 'UTF-8');
             }
         } else {
             $fullname = $object;
@@ -599,7 +599,7 @@ class DataTree_sql extends DataTree {
                  ' VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
         $values = array((int)$id,
                         $this->_params['group'],
-                        Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+                        Horde_String::convertCharset($name, 'UTF-8', $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, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+        $values = array(Horde_String::convertCharset($new_object_name, 'UTF-8', $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],
-                                                          $GLOBALS['registry']->getCharset());
+                                                          'UTF-8');
                 /* Convert old data to the new format. */
                 if ($row[1] == Horde_Serialize::BASIC) {
                     $data[$id] = Horde_String::convertCharset($data[$id],
-                                                        $GLOBALS['registry']->getCharset(true));
+                                                        $GLOBALS['registry']->getLanguageCharset());
                 }
 
                 $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'],
-                                                 $GLOBALS['registry']->getCharset());
+                                                 'UTF-8');
             /* Convert old data to the new format. */
             if ($row['datatree_serialized'] == Horde_Serialize::BASIC) {
-                $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getCharset(true));
+                $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getLanguageCharset());
             }
             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'], $GLOBALS['registry']->getCharset()));
+                                                     'value' => Horde_String::convertCharset($row['value'], $this->_params['charset'], 'UTF-8'));
             }
             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'],
-                                                            $GLOBALS['registry']->getCharset());
+                                                            'UTF-8');
             }
             return $rows;
         }
@@ -1808,7 +1808,7 @@ class DataTree_sql extends DataTree {
                 $values = array((int)$id,
                                 $attr['name'],
                                 $attr['key'],
-                                Horde_String::convertCharset($attr['value'], $GLOBALS['registry']->getCharset(), $this->_params['charset']));
+                                Horde_String::convertCharset($attr['value'], 'UTF-8', $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, $GLOBALS['registry']->getCharset());
+            $data = Horde_Serialize::serialize($object->getData(), $ser, 'UTF-8');
 
             $query = 'UPDATE ' . $this->_params['table'] .
                      ' SET datatree_data = ?, datatree_serialized = ?' .
index 8984417..667a772 100644 (file)
@@ -213,7 +213,7 @@ try {
                 }
             }
         }
-        echo '<input type="hidden" name="_formvars" value="' . @htmlspecialchars(serialize($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '" />';
+        echo '<input type="hidden" name="_formvars" value="' . @htmlspecialchars(serialize($vars), ENT_QUOTES, 'UTF-8') . '" />';
     }
 
     function renderFormActive(&$form, &$vars)
index 8d7ba73..1fcd03b 100644 (file)
@@ -304,7 +304,7 @@ class Horde_Group_Kolab extends Horde_Group_Ldap
             }
 
             $groups = array();
-            $current_charset = $GLOBALS['registry']->getCharset();
+            $current_charset = 'UTF-8';
             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);
index 69c1feb..f91cec5 100644 (file)
@@ -280,7 +280,7 @@ class Horde_Group_Ldap extends Horde_Group
      */
     public function getGroupName($dn)
     {
-        $dn = Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), 'UTF-8');
+        $dn = Horde_String::convertCharset($dn, 'UTF-8', 'UTF-8');
         $result = @ldap_explode_dn($dn, 1);
         if ($result === false) {
             throw new Horde_Group_Exception('Invalid group ID passed (bad DN syntax)');
@@ -530,7 +530,7 @@ class Horde_Group_Ldap extends Horde_Group
         }
 
         $this->_userCache[$user] = array();
-        $current_charset = $GLOBALS['registry']->getCharset();
+        $current_charset = 'UTF-8';
         foreach ($search as $dn => $entry) {
             $utf8_dn = Horde_String::convertCharset($dn, 'UTF-8', $current_charset);
             $this->_userCache[$user][$utf8_dn] = $this->getGroupName($utf8_dn);
index 853bb15..655c7a5 100644 (file)
@@ -1049,7 +1049,7 @@ class Horde_Icalendar
                         // Add CHARSET as well. At least the synthesis client
                         // gets confused otherwise
                         if (empty($params['CHARSET'])) {
-                            $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+                            $params['CHARSET'] = 'UTF-8';
                             $params_str .= ';CHARSET=' . $params['CHARSET'];
                         }
                     }
index ad3628b..784c84a 100644 (file)
@@ -526,7 +526,7 @@ class Kolab {
 
     function &setElemStr(&$parent, $name, $value = '')
     {
-        return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), 'utf-8'));
+        return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, 'UTF-8', 'utf-8'));
     }
 
     function &setVal($name, $value = '')
@@ -553,7 +553,7 @@ class Kolab {
      */
     function encodeImapFolderName($name)
     {
-        return Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+        return Horde_String::convertCharset($name, 'UTF-8', 'UTF7-IMAP');
     }
 
     /**
index d2a78de..a7d46bc 100644 (file)
@@ -775,7 +775,7 @@ class Horde_Kolab_Format_Xml
      */
     protected function _createTextNode($parent, $name, $value)
     {
-        $value = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(),
+        $value = Horde_String::convertCharset($value, 'UTF-8',
                                               'utf-8');
 
         $node = $this->_xmldoc->createElement($name);
index 67a7c11..a5780e9 100644 (file)
@@ -84,7 +84,7 @@ implements Iterator
      */
     public function __construct()
     {
-        $this->_charset = $GLOBALS['registry']->getCharset();
+        $this->_charset = 'UTF-8';
         if (empty($this->_primaryPersonalNamespace)) {
             $personal = null;
             foreach ($this->_namespaces as $namespace) {
index d77c657..e493429 100644 (file)
@@ -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($GLOBALS['registry']->getCharset());
+                $part->setCharset('UTF-8');
                 $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($GLOBALS['registry']->getCharset());
+            $part->setCharset('UTF-8');
             $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", $GLOBALS['registry']->getCharset()));
-        $part->setCharset($GLOBALS['registry']->getCharset());
+        $part->setContents(Horde_String::wrap($kolab_text, 76, "\r\n", 'UTF-8'));
+        $part->setCharset('UTF-8');
 
         $part->setTransferEncoding('quoted-printable');
         $mime_message->addPart($part);
index 2e24a98..b757e78 100644 (file)
@@ -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ÖÜ', $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), $folder->new_name);
+        $this->assertEquals(Horde_String::convertCharset('INBOX/TestAÖÜ', 'UTF-8', 'UTF7-IMAP'), $folder->new_name);
     }
 
     /**
index 3944323..f3bf168 100644 (file)
@@ -131,7 +131,7 @@ if (document.getElementById(%1$s)){
             }
         }
         echo '<input type="hidden" name="_formvars" value="'
-            . htmlspecialchars(serialize($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset())
+            . htmlspecialchars(serialize($vars), ENT_QUOTES, 'UTF-8')
             . '" />';
     }
 
index 0810929..5f7ea30 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset()),
+            htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'),
             ($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(
             '<input type="text" class="form-input-phone" name="%1$s" id="%1$s" value="%2$s" %3$s%4$s />',
             $var->getVarName(),
-            htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
+            htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'),
             ($var->isDisabled() ? ' disabled="disabled" ' : ''),
             $this->_getActionScripts($form, $var)
         );
@@ -128,7 +128,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer
     {
         return sprintf('    <input type="text" class="form-input-ipaddress" name="%1$s" id="%1$s" value="%2$s" %3$s%4$s />',
                        $var->getVarName(),
-                       htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
+                       htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'),
                        $var->isDisabled() ? ' disabled="disabled" ' : '',
                        $this->_getActionScripts($form, $var)
                );
@@ -459,7 +459,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer
         $prompt = $var->type->prompt;
         $htmlchars = $var->getOption('htmlchars');
         if ($prompt) {
-            $prompt = '<option value="">' . ($htmlchars ? htmlspecialchars($prompt, ENT_QUOTES, $GLOBALS['registry']->getCharset()) : $prompt) . '</option>';
+            $prompt = '<option value="">' . ($htmlchars ? htmlspecialchars($prompt, ENT_QUOTES, 'UTF-8') : $prompt) . '</option>';
         }
         return sprintf('    <select name="%1$s" id="%1$s"%2$s>%3$s%4$s    </select>',
                $var->getVarName(),
@@ -488,7 +488,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer
         /* Hidden tag to store the current first level. */
         $html = sprintf('    <input type="hidden" name="%1$s[old]" id="%1$s[old]" value="%2$s" />',
                         $varname,
-                        htmlspecialchars($selected['1'], ENT_QUOTES, $GLOBALS['registry']->getCharset()));
+                        htmlspecialchars($selected['1'], ENT_QUOTES, 'UTF-8'));
 
         /* First level. */
         $values_1 = Horde_Array::valuesToKeys(array_keys($values));
@@ -497,7 +497,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 .= '<option value="">' . htmlspecialchars($prompts[0], ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '</option>';
+            $html .= '<option value="">' . htmlspecialchars($prompts[0], ENT_QUOTES, 'UTF-8') . '</option>';
         }
         $html .= $this->_selectOptions($values_1, $selected['1']);
         $html .= '    </select>';
@@ -507,7 +507,7 @@ class Horde_Form_VarRenderer_Xhtml extends Horde_Form_VarRenderer
                          $varname,
                          ($var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : ''));
         if (!empty($prompts)) {
-            $html .= '<option value="">' . htmlspecialchars($prompts[1], ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '</option>';
+            $html .= '<option value="">' . htmlspecialchars($prompts[1], ENT_QUOTES, 'UTF-8') . '</option>';
         }
         $values_2 = array();
         if (!empty($selected['1'])) {
@@ -779,7 +779,7 @@ EOT;
     function _renderVarDisplayDefault($form, $var, $vars)
     {
         return nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES,
-            $GLOBALS['registry']->getCharset()));
+            'UTF-8'));
     }
 
     function _renderVarDisplay_html($form, $var, $vars)
@@ -823,7 +823,7 @@ EOT;
             return Horde::link($mail_link, $email_val)
                 . htmlspecialchars($display_email) . '</a>';
         } else {
-            return nl2br(htmlspecialchars($display_email, ENT_QUOTES, $GLOBALS['registry']->getCharset()));
+            return nl2br(htmlspecialchars($display_email, ENT_QUOTES, 'UTF-8'));
         }
     }
 
@@ -854,7 +854,7 @@ EOT;
         if (count($values) == 0) {
             return _("No values");
         } elseif (isset($values[$value]) && $value != '') {
-            return htmlspecialchars($values[$value], ENT_QUOTES, $GLOBALS['registry']->getCharset());
+            return htmlspecialchars($values[$value], ENT_QUOTES, 'UTF-8');
         }
     }
 
@@ -864,7 +864,7 @@ EOT;
         if (count($values) == 0) {
             return _("No values");
         } elseif (isset($values[$var->getValue($vars)])) {
-            return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, $GLOBALS['registry']->getCharset());
+            return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, 'UTF-8');
         }
     }
 
@@ -881,7 +881,7 @@ EOT;
                     $display[] = $name;
                 }
             }
-            return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset());
+            return htmlspecialchars(implode(', ', $display), ENT_QUOTES, 'UTF-8');
         }
     }
 
@@ -898,7 +898,7 @@ EOT;
                     $display[] = $name;
                 }
             }
-            return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset());
+            return htmlspecialchars(implode(', ', $display), ENT_QUOTES, 'UTF-8');
         }
     }
 
@@ -1069,7 +1069,7 @@ EOT;
             }
         }
 
-        $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()));
+        $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'));
         if (!empty($mapurl)) {
             $html .= '&nbsp;&nbsp;' . Horde::link(Horde::externalUrl($mapurl), $desc, null, '_blank') . Horde::img($icon, $desc) . '</a>';
         }
@@ -1107,7 +1107,7 @@ EOT;
     function _renderVarDisplay_invalid($form, $var, $vars)
     {
         return '<p class="form-error form-inline">'
-                . htmlspecialchars($var->type->message, ENT_QUOTES, $GLOBALS['registry']->getCharset())
+                . htmlspecialchars($var->type->message, ENT_QUOTES, 'UTF-8')
                 . '</p>';
     }
 
@@ -1226,7 +1226,7 @@ EOT;
                 $selected = '';
             }
             $result .= '        <option value="';
-            $result .= ($htmlchars) ? htmlspecialchars($value, ENT_QUOTES, $GLOBALS['registry']->getCharset()) : $value;
+            $result .= ($htmlchars) ? htmlspecialchars($value, ENT_QUOTES, 'UTF-8') : $value;
             $result .= '"' . $selected . '>';
             $result .= ($htmlchars) ? htmlspecialchars($display) : $display;
             $result .= "</option>\n";
@@ -1246,7 +1246,7 @@ EOT;
                 $selected = '';
             }
             $result .= " <option value=\""
-                . htmlspecialchars($value, ENT_QUOTES, $GLOBALS['registry']->getCharset())
+                . htmlspecialchars($value, ENT_QUOTES, 'UTF-8')
                 . "\"$selected>" . htmlspecialchars($display) . "</option>\n";
         }
 
index 8d850f0..86fa6e3 100644 (file)
@@ -1214,7 +1214,7 @@ function field_get_quoted($field)
     case 'mediumtext':
     case 'longblob':
     case 'longtext':
-        return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), $GLOBALS['registry']->getCharset(), \$this->_params['charset'])";
+        return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), 'UTF-8', \$this->_params['charset'])";
 
     // Integer types
     case 'bit':
index b41e109..afad383 100644 (file)
@@ -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'], $GLOBALS['registry']->getCharset(), 'UTF-8'));
+            $props[] = $this->mkprop('displayname', Horde_String::convertCharset($item['name'], 'UTF-8', 'UTF-8'));
             unset($properties['DAV:']['displayname']);
         }
         if (in_array('getlastmodified', $properties['DAV:'])) {
index 2a2e5cc..06f59ed 100644 (file)
@@ -917,7 +917,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], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+                    $data[$key], 'UTF-8', $this->_params['charset']);
             }
         }
 
index 32c900f..5fca5b6 100644 (file)
@@ -46,7 +46,7 @@ class Horde_SpellChecker_Aspell extends Horde_SpellChecker
             throw new Horde_Exception('Spellcheck failed. Command line: ' . $this->_cmd());
         }
 
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         // Write to stdin.
         if ($this->_encoding) {
index b2b6173..eb11677 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index fa1f02d..f93207b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-$charset = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
 
 /* Variables used in core javascript files. */
 $var = array(
index 1d99cc1..95d9d3e 100644 (file)
@@ -29,7 +29,7 @@ if ($form->validate($vars)) {
     }
     $now = time();
     $timers[$now] = array('name' => Horde_String::convertCharset($vars->get('description'),
-                                                       $GLOBALS['registry']->getCharset(),
+                                                       'UTF-8',
                                                        $prefs->getCharset()),
                           'time' => $now);
     $prefs->setValue('running_timers', serialize($timers), false);
index b294549..73b6003 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index dafcb81..c3a055b 100644 (file)
@@ -55,7 +55,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, $GLOBALS['registry']->getCharset(), 'iso-8859-1'));
+        fwrite($fp, Horde_String::convertCharset($php, 'UTF-8', 'iso-8859-1'));
         fclose($fp);
         $notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
         $registry->clearCache();
index b09777f..b4c4ed5 100644 (file)
@@ -60,7 +60,7 @@ if ($setup == 'conf' && $type == 'php') {
         $data .= Horde_String::convertCharset(str_replace(array('\\', '\''),
                                                     array('\\\\', '\\\''),
                                                     $php),
-                                        $GLOBALS['registry']->getCharset(), 'iso-8859-1');
+                                        'UTF-8', 'iso-8859-1');
         $data .= '\');' . "\n";
         $data .= '    fclose($fp);' . "\n";
         $data .= '    echo \'' . sprintf('Saved %s configuration.', $app) . '\' . "\n";' . "\n";
index 2beb4cc..65cbf9b 100644 (file)
@@ -44,7 +44,7 @@ if (Horde_Util::getFormData('list-tables')) {
     }
 
     // Parse out the query results.
-    $result = $db->execute(Horde_String::convertCharset($command, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']));
+    $result = $db->execute(Horde_String::convertCharset($command, 'UTF-8', $conf['sql']['charset']));
 }
 
 if (isset($result)) {
index 4f1c09e..cca20f6 100644 (file)
@@ -288,7 +288,7 @@ class Horde_Hooks
 //        $ldapPort = '389';
 //        $searchBase = 'ou=people,o=example.com';
 //        $ldapcharset = 'utf-8';
-//        $outputcharset = $GLOBALS['registry']->getCharset();
+//        $outputcharset = 'UTF-8';
 //
 //        $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, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']));
+//            $values[] = $db->quote(Horde_String::convertCharset($value, 'UTF-8', $GLOBALS['conf']['sql']['charset']));
 //        }
 //        $fields[] = 'object_id';
 //        $values[] = $db->quote($userId);
index 3c2695f..0c4ff09 100644 (file)
@@ -158,7 +158,7 @@ EOT;
         Horde::addInlineScript($script, 'dom');
 
         /* Get the user's most recent tweet */
-        $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+        $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, 'UTF-8');
 
         /* Build the UI */
         $html = '<div style="padding: 0 8px 8px">'
index cc408b2..0ed5fe5 100755 (executable)
@@ -40,9 +40,9 @@ foreach ($g->listGroups(true) as $id => $name) {
     $parents = implode(':', array_keys($parents));
 
     $params = array($id,
-                    Horde_String::convertCharset($object->name, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']),
-                    Horde_String::convertCharset($parents, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']),
-                    Horde_String::convertCharset($object->get('email'), $GLOBALS['registry']->getCharset(), $conf['sql']['charset']),
+                    Horde_String::convertCharset($object->name, 'UTF-8', $conf['sql']['charset']),
+                    Horde_String::convertCharset($parents, 'UTF-8', $conf['sql']['charset']),
+                    Horde_String::convertCharset($object->get('email'), 'UTF-8', $conf['sql']['charset']),
     );
     $result = $db->query($group_query, $params);
     if (is_a($result, 'PEAR_Error')) {
index e2eb0c7..7de0e80 100644 (file)
@@ -29,7 +29,7 @@ if (!count($layout_pref)) {
 // If we're serving a request to the JS update client, just return the blocks
 // updated HTML content.
 if (Horde_Util::getFormData('httpclient')) {
-    header('Content-Type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-Type: text/html; charset=' . 'UTF-8');
     $row = Horde_Util::getFormData('row');
     $col = Horde_Util::getFormData('col');
     if (!is_null($row) && !is_null($col) && !empty($layout_pref[$row][$col])) {
index 2a822fd..a822938 100644 (file)
@@ -108,7 +108,7 @@ case 'send_problem_report':
                                               'body' => $body,
                                               'to' => $conf['problems']['email'],
                                               'from' => $email,
-                                              'charset' => $GLOBALS['registry']->getCharset()));
+                                              'charset' => 'UTF-8'));
             $mail->addHeader('Sender', 'horde-problem@' . $conf['problems']['maildomain']);
 
             /* Add attachment. */
index 93e9257..374cc1f 100644 (file)
@@ -76,7 +76,7 @@ if ($can_validate && $form->validate($vars)) {
                                                             $password),
                                           'to' => $email,
                                           'from' => $email,
-                                          'charset' => $GLOBALS['registry']->getCharset()));
+                                          'charset' => 'UTF-8'));
         try {
             $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
             $notification->push(_("Your password has been reset, check your email and log in with your new password."), 'horde.success');
index 1a148f7..30d22dd 100644 (file)
@@ -31,7 +31,7 @@ if (!Horde_Util::getFormData('ajaxui') &&
     $ajax_url = Horde::getServiceLink('ajax', 'horde');
     $ajax_url->pathInfo = 'sidebarUpdate';
 
-    $charset = $registry->getCharset();
+    $charset = 'UTF-8';
     $rtl = intval(isset($registry->nlsconfig['rtl'][$language]));
     $show_sidebar = !isset($_COOKIE['horde_sidebar_expanded']) || $_COOKIE['horde_sidebar_expanded'];
     $width = intval($prefs->getValue('sidebar_width'));
index acd61b9..854907e 100644 (file)
@@ -97,8 +97,8 @@ case 'getPage':
         /* These are all referencing the *original* tweet */
         $view->profileLink = Horde::externalUrl('http://twitter.com/' . htmlspecialchars($tweetObj->user->screen_name), true);
         $view->profileImg = $tweetObj->user->profile_image_url;
-        $view->authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
-        $view->authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+        $view->authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, 'UTF-8');
+        $view->authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, 'UTF-8');
         $view->createdAt = $tweetObj->created_at;
         $view->clientText = $filter->filter($tweet->source, 'xss');
         $view->tweet = $tweet;
index d91f3c1..2e555cd 100644 (file)
@@ -60,7 +60,7 @@
 <label for="new_user" class="hidden"><?php echo _("User") ?></label>
 <input type="text" id="new_user" name="new_user" />
 <?php endif; ?>
-<input type="submit" class="button" value="<?php echo htmlspecialchars(sprintf(_("Save \"%s\""), $group->getShortName()), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>" />
+<input type="submit" class="button" value="<?php echo htmlspecialchars(sprintf(_("Save \"%s\""), $group->getShortName()), ENT_COMPAT, 'UTF-8') ?>" />
 </p>
 <br />
 
index afb74f6..cf665bf 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($GLOBALS['language'])) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 348944a..93ea201 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 35a2d67..72ba93b 100644 (file)
@@ -99,7 +99,7 @@ if ($conf['compose']['link_attachments_notify']) {
 
                 $msg = new Horde_Mime_Part();
                 $msg->setType('text/plain');
-                $msg->setCharset($registry->getCharset());
+                $msg->setCharset('UTF-8');
 
                 $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))));
index 718b911..a36aa0c 100644 (file)
@@ -257,7 +257,7 @@ case _("Send"):
     switch ($vars->a) {
     case _("Save Draft"):
         try {
-            $notification->push($imp_compose->saveDraft($header, $message, $registry->getCharset(), false), 'horde.success');
+            $notification->push($imp_compose->saveDraft($header, $message, 'UTF-8', false), 'horde.success');
             if ($prefs->getValue('close_draft')) {
                 $imp_compose->destroy('save_draft');
                 require IMP_BASE . '/mailbox-mimp.php';
index a82de6e..a1cbee6 100644 (file)
@@ -202,8 +202,8 @@ case 'mailto':
         $header['to'] = $imp_headers->getValue('to');
     }
     if (empty($header['to'])) {
-        ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('from'), array('charset' => $registry->getCharset()))) ||
-        ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('reply-to'), array('charset' => $registry->getCharset())));
+        ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('from'), array('charset' => 'UTF-8'))) ||
+        ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('reply-to'), array('charset' => 'UTF-8')));
     }
     break;
 
@@ -367,7 +367,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, $registry->getCharset(), $rtemode);
+                $result = $imp_compose->saveDraft($header, $message, 'UTF-8', $rtemode);
 
                 /* Closing draft if requested by preferences. */
                 if ($vars->actionID == 'save_draft') {
@@ -618,7 +618,7 @@ if (!is_null($oldrtemode) && ($oldrtemode != $rtemode)) {
 /* If this is the first page load for this compose item, add auto BCC
  * addresses. */
 if (!$vars->compose_formToken && ($vars->actionID != 'draft')) {
-    $header['bcc'] = Horde_Mime_Address::addrArray2String($identity->getBccAddresses(), array('charset' => $registry->getCharset()));
+    $header['bcc'] = Horde_Mime_Address::addrArray2String($identity->getBccAddresses(), array('charset' => 'UTF-8'));
 }
 
 foreach (array('to', 'cc', 'bcc', 'subject') as $val) {
index e2520ec..21aa174 100644 (file)
@@ -197,7 +197,7 @@ class IMP_Hooks
 //    public function pre_sent($message, $headers)
 //    {
 //        // Example: Add custom headers to outgoing message.
-//        $charset = $GLOBALS['registry']->getCharset();
+//        $charset = 'UTF-8';
 //        $custom_hdrs = array();
 //        $hdr_charset = $message->getHeaderCharset();
 //
@@ -287,7 +287,7 @@ class IMP_Hooks
 //        // the same domain.
 //        $flags = array();
 //
-//        $from_ob = Horde_Mime_Address::getAddressesFromObject($data['envelope']['from'], array('charset' => $GLOBALS['registry']->getCharset()));
+//        $from_ob = Horde_Mime_Address::getAddressesFromObject($data['envelope']['from'], array('charset' => 'UTF-8'));
 //        if (!empty($from_ob) &&
 //            (strcasecmp($from_ob[0]['host'], 'example.com') === 0)) {
 //            /* The '$indomain' flag in this example must have already been
index 1ea3170..5770865 100644 (file)
@@ -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, $registry->getCharset());
+        $selected_addresses[] = @htmlspecialchars($addr, ENT_QUOTES, 'UTF-8');
     }
 }
 
@@ -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, $registry->getCharset());
+            $a_list[] = @htmlspecialchars(Horde_Mime_Address::encode($addr['name'], 'personal') . ': ' . $addr['email'] . ';', ENT_QUOTES, 'UTF-8');
         } 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, $registry->getCharset());
+                $a_list[] = @htmlspecialchars(Horde_Mime_Address::writeAddress($mbox_host[0], $mbox_host[1], $addr['name']), ENT_QUOTES, 'UTF-8');
             }
         }
     }
index 412d585..fe9deda 100644 (file)
@@ -30,7 +30,7 @@ if (!$conf['user']['allow_folders']) {
 $subscribe = $prefs->getValue('subscribe');
 $showAll = (!$subscribe || $_SESSION['imp']['showunsub']);
 
-$charset = $registry->getCharset();
+$charset = 'UTF-8';
 $vars = Horde_Variables::getDefaultVariables();
 
 /* Get the base URL for this page. */
index ab4a675..870a344 100644 (file)
@@ -72,7 +72,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         $imptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree');
         $imptree->eltDiffStart();
 
-        $new = Horde_String::convertCharset($this->_vars->mbox, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+        $new = Horde_String::convertCharset($this->_vars->mbox, 'UTF-8', 'UTF7-IMAP');
         try {
             $new = $imptree->createMailboxName($this->_vars->parent, $new);
 
@@ -165,7 +165,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         $result = false;
 
         try {
-            $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+            $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), 'UTF-8', 'UTF7-IMAP');
 
             if (($this->_vars->old_name != $new) &&
                 $GLOBALS['injector']->getInstance('IMP_Folder')->rename($this->_vars->old_name, $new)) {
@@ -1847,7 +1847,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         }
 
         try {
-            $res = $imp_compose->saveDraft($headers, $this->_vars->message, $GLOBALS['registry']->getCharset(), $this->_vars->html);
+            $res = $imp_compose->saveDraft($headers, $this->_vars->message, 'UTF-8', $this->_vars->html);
             if ($this->_action == 'autoSaveDraft') {
                 $GLOBALS['notification']->push(_("Draft automatically saved."), 'horde.message');
             } else {
index 7443a13..26b81b4 100644 (file)
@@ -250,7 +250,7 @@ class IMP_Application extends Horde_Registry_Application
                     $menu->addArray(array(
                         'class' => '__noselection',
                         'icon' => 'empty_trash.png',
-                        'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, $registry->getCharset()) . ')',
+                        'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, 'UTF-8') . ')',
                         'text' => _("Empty _Trash"),
                         'url' => IMP::generateIMPUrl($menu_mailbox_url, $trash_folder)->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')))
                     ));
@@ -263,7 +263,7 @@ class IMP_Application extends Horde_Registry_Application
                 $menu->addArray(array(
                     'class' => '__noselection',
                     'icon' =>  'empty_spam.png',
-                    'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, $registry->getCharset()) . ')',
+                    'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, 'UTF-8') . ')',
                     'text' => _("Empty _Spam"),
                     'url' => IMP::generateIMPUrl($menu_mailbox_url, IMP::folderPref($spam_folder, true))->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')))
                 ));
index f70521f..83a2098 100644 (file)
@@ -32,7 +32,7 @@ class IMP_Block_Newmail extends Horde_Block
         if (empty($indices)) {
             $html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
         } else {
-            $charset = $GLOBALS['registry']->getCharset();
+            $charset = 'UTF-8';
             $imp_ui = new IMP_Ui_Mailbox('INBOX');
             $shown = empty($this->_params['msgs_shown'])
                 ? 3
index 1f30282..b157651 100644 (file)
@@ -382,7 +382,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             $identity_id = $identity->getMatchingIdentity($fromaddr);
         }
 
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $header = array(
             'to' => Horde_Mime_Address::addrArray2String($headers->getOb('to'), array('charset' => $charset)),
             'cc' => Horde_Mime_Address::addrArray2String($headers->getOb('cc'), array('charset' => $charset)),
@@ -556,7 +556,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             $mdn->addMdnRequestHeaders($barefrom);
         }
 
-        $browser_charset = $GLOBALS['registry']->getCharset();
+        $browser_charset = 'UTF-8';
 
         $headers->addHeader('From', Horde_String::convertCharset($header['from'], $browser_charset, $charset));
 
@@ -687,7 +687,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             }
 
             try {
-                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], $GLOBALS['registry']->getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags)));
+                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], 'UTF-8', '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;
@@ -787,7 +787,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
                 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, $GLOBALS['registry']->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, 'UTF-8');
                 }
                 throw new IMP_Compose_Exception($error);
             }
@@ -802,7 +802,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
 
         /* Properly encode the addresses we're sending to. */
         try {
-            $email = Horde_Mime::encodeAddress($email, is_null($message) ? $GLOBALS['registry']->getCharset() : $message->getHeaderCharset(), $_SESSION['imp']['maildomain']);
+            $email = Horde_Mime::encodeAddress($email, is_null($message) ? 'UTF-8' : $message->getHeaderCharset(), $_SESSION['imp']['maildomain']);
 
             /* Validate the recipient addresses. */
             Horde_Mime_Address::parseAddressList($email, array(
@@ -837,7 +837,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         }
 
         try {
-            $r_array = Horde_Mime::encodeAddress($recipients, $GLOBALS['registry']->getCharset(), $_SESSION['imp']['maildomain']);
+            $r_array = Horde_Mime::encodeAddress($recipients, 'UTF-8', $_SESSION['imp']['maildomain']);
             $r_array = Horde_Mime_Address::parseAddressList($r_array, array('validate' => true));
         } catch (Horde_Mime_Exception $e) {}
 
@@ -972,7 +972,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
                     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, $GLOBALS['registry']->getCharset());
+                        $message = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients."), $max_recipients), ENT_COMPAT, 'UTF-8');
                     }
                     throw new IMP_Compose_Exception($message);
                 }
@@ -996,9 +996,9 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         // Convert IDN hosts to ASCII.
         if (function_exists('idn_to_ascii')) {
             $old_error = error_reporting(0);
-            $host = idn_to_ascii(Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8'));
+            $host = idn_to_ascii(Horde_String::convertCharset($host, 'UTF-8', 'UTF-8'));
             error_reporting($old_error);
-        } elseif (Horde_Mime::is8bit($ob['mailbox'], $GLOBALS['registry']->getCharset())) {
+        } elseif (Horde_Mime::is8bit($ob['mailbox'], 'UTF-8')) {
             throw new IMP_Compose_Exception(sprintf(_("Invalid character in e-mail address: %s."), $email));
         }
 
@@ -1033,7 +1033,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
     protected function _createMimeMessage($to, $body, $charset,
                                           $options = array())
     {
-        $nls_charset = $GLOBALS['registry']->getCharset();
+        $nls_charset = 'UTF-8';
         $body = Horde_String::convertCharset($body, $nls_charset, $charset);
 
         if (!empty($options['html'])) {
@@ -1293,7 +1293,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             'subject' => ''
         );
 
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $h = $contents->getHeaderOb();
         $match_identity = $this->_getMatchingIdentity($h);
         $reply_type = 'reply';
@@ -1487,7 +1487,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             );
         }
 
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $h = $contents->getHeaderOb();
 
         $from = Horde_Mime_Address::addrArray2String($h->getOb('from'), array('charset' => $charset));
@@ -1655,7 +1655,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $h = $contents->getHeaderOb();
 
         $from = Horde_Mime_Address::addrArray2String($h->getOb('from'), array(
-            'charset' => $GLOBALS['registry']->getCharset()
+            'charset' => 'UTF-8'
         ));
 
         $msg_pre = "\n----- " .
@@ -1733,10 +1733,10 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $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' => $GLOBALS['registry']->getCharset()))) . "\n" . trim($contents->getHeaderOb(false));
+        $header_text = trim($resent_headers->toString(array('encode' => 'UTF-8'))) . "\n" . trim($contents->getHeaderOb(false));
 
         $to = $this->_prepSendMessage($recipients);
-        $hdr_array = $headers->toArray(array('charset' => $GLOBALS['registry']->getCharset()));
+        $hdr_array = $headers->toArray(array('charset' => 'UTF-8'));
         $hdr_array['_raw'] = $header_text;
 
         try {
@@ -1800,7 +1800,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
              $headerob = $contents->getHeaderOb();
 
              $part = new Horde_Mime_Part();
-             $part->setCharset($GLOBALS['registry']->getCharset());
+             $part->setCharset('UTF-8');
              $part->setType('message/rfc822');
              $part->setName(_("Forwarded Message"));
              $part->setContents($contents->fullMessageText(array('stream' => true)));
@@ -1830,7 +1830,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
      */
     protected function _getMsgHeaders($h)
     {
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $tmp = array();
 
         if (($ob = $h->getValue('date'))) {
@@ -1912,12 +1912,12 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         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'] : $GLOBALS['registry']->getCharset());
+                $part->setCharset(isset($analyzetype['params']['charset']) ? $analyzetype['params']['charset'] : 'UTF-8');
             } else {
-                $part->setCharset($GLOBALS['registry']->getCharset());
+                $part->setCharset('UTF-8');
             }
         } else {
-            $part->setHeaderCharset($GLOBALS['registry']->getCharset());
+            $part->setHeaderCharset('UTF-8');
         }
         $part->setName($filename);
         $part->setBytes($_FILES[$name]['size']);
@@ -2373,14 +2373,14 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $fullpath = sprintf('%s/%s/%d', self::VFS_LINK_ATTACH_PATH, $auth, $ts);
         $charset = $part->getCharset();
 
-        $trailer = Horde_String::convertCharset(_("Attachments"), $GLOBALS['registry']->getCharset(), $charset);
+        $trailer = Horde_String::convertCharset(_("Attachments"), 'UTF-8', $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)) . ')', $GLOBALS['registry']->getCharset(), $charset);
+            $trailer .= Horde_String::convertCharset(' (' . sprintf(_("Links will expire on %s"), strftime('%x', $del_time)) . ')', 'UTF-8', $charset);
         }
 
         foreach ($this as $att) {
@@ -2464,7 +2464,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $part = $contents->getMIMEPart($body_id);
         $type = $part->getType();
         $part_charset = $part->getCharset();
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         $msg = Horde_String::convertCharset($part->getContents(), $part_charset, $charset);
 
@@ -2560,7 +2560,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
 
         $part = new Horde_Mime_Part();
         $part->setType('text/x-vcard');
-        $part->setCharset($GLOBALS['registry']->getCharset());
+        $part->setCharset('UTF-8');
         $part->setContents($vcard);
         $part->setName((strlen($name) ? $name : 'vcard') . '.vcf');
         $this->_attachVCard = $part;
index 1a4f52c..30de050 100644 (file)
@@ -34,7 +34,7 @@ class IMP_Compose_Stationery implements ArrayAccess, Countable, Iterator
     {
         $slist = @unserialize($GLOBALS['prefs']->getValue('stationery', false));
         $this->_stationery = is_array($slist)
-            ? Horde_String::convertCharset($slist, $GLOBALS['prefs']->getCharset(), $GLOBALS['registry']->getCharset())
+            ? Horde_String::convertCharset($slist, $GLOBALS['prefs']->getCharset(), 'UTF-8')
             : array();
     }
 
@@ -59,7 +59,7 @@ class IMP_Compose_Stationery implements ArrayAccess, Countable, Iterator
             switch ($this[$id]['t']) {
             case 'html':
                 if (!$html) {
-                    $s_content = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($s_content, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset()));
+                    $s_content = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($s_content, 'Html2text', array('charset' => 'UTF-8'));
                 }
                 break;
 
@@ -84,7 +84,7 @@ class IMP_Compose_Stationery implements ArrayAccess, Countable, Iterator
      */
     protected function _save()
     {
-        $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset($this->_stationery, $GLOBALS['registry']->getCharset(), $GLOBALS['prefs']->getCharset())), false);
+        $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset($this->_stationery, 'UTF-8', $GLOBALS['prefs']->getCharset())), false);
     }
 
     /* ArrayAccess methods. */
index 9131021..f6dbffd 100644 (file)
@@ -420,7 +420,7 @@ class IMP_Contents
                                 'text' => $status
                             )
                         ),
-                        'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
+                        'type' => 'text/html; charset=' . 'UTF-8'
                     )
                 );
             }
@@ -471,7 +471,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($GLOBALS['registry']->getCharset());
+            $default_charset = Horde_String::upper('UTF-8');
             if ($default_charset !== 'UTF-8') {
                 $charset_upper = Horde_String::upper($mime_part->getCharset());
                 if (($charset_upper != 'US-ASCII') &&
@@ -533,7 +533,7 @@ class IMP_Contents
         // Retrieve 3x the size of $maxlen of bodytext data. This should
         // account for any content-encoding & HTML tags.
         $pmime = $this->getMIMEPart($mimeid, array('length' => $maxlen * 3));
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         $ptext = Horde_String::convertCharset($pmime->getContents(), $pmime->getCharset(), $charset);
 
@@ -711,7 +711,7 @@ class IMP_Contents
             (strpos($id, '.') === false)) {
             if ($mask & self::SUMMARY_STRIP_LINK) {
                 $url = Horde::selfUrl(true)->remove(array('actionID', 'imapid', 'uid'))->add(array('actionID' => 'strip_attachment', 'imapid' => $id, 'uid' => $this->_uid, 'message_token' => Horde::getRequestToken('imp.impcontents')));
-                $part['strip'] = Horde::link($url, _("Strip Attachment"), 'deleteImg', null, 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to PERMANENTLY delete this attachment?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')') . '</a>';
+                $part['strip'] = Horde::link($url, _("Strip Attachment"), 'deleteImg', null, 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to PERMANENTLY delete this attachment?"), Horde_Serialize::JSON, 'UTF-8') . ')') . '</a>';
             } else {
                 $part['strip'] = Horde::link('#', _("Strip Attachment"), 'deleteImg stripAtc', null, null, null, null, array('mimeid' => $id)) . '</a>';
             }
index f860c15..b014e1a 100644 (file)
@@ -616,7 +616,7 @@ class IMP_Crypt_Pgp extends Horde_Crypt_Pgp
      */
     public function textWindowOutput($name, $msg)
     {
-        $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($msg));
+        $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . 'UTF-8', true, strlen($msg));
         echo $msg;
     }
 
index 1cee6b1..9442340 100644 (file)
@@ -450,7 +450,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=' . $GLOBALS['registry']->getCharset(), true, strlen($msg));
+        $GLOBALS['browser']->downloadHeaders($name, $html ? 'text/html' : 'text/plain; charset=' . 'UTF-8', true, strlen($msg));
         echo $msg;
     }
 
index 0eba4f2..e389908 100644 (file)
@@ -170,7 +170,7 @@ class IMP_Dimp
     static public function returnToDimp($mailbox = '')
     {
         print '<html><head>' .
-            Horde::wrapInlineScript(array('window.parent.DimpBase.go(' . Horde_Serialize::serialize('folder:' . strval($mailbox), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')')) .
+            Horde::wrapInlineScript(array('window.parent.DimpBase.go(' . Horde_Serialize::serialize('folder:' . strval($mailbox), Horde_Serialize::JSON, 'UTF-8') . ')')) .
             '</head></html>';
         exit;
     }
index 944cd4f..9ca4050 100644 (file)
@@ -114,7 +114,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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(_("You are not allowed to create folders."), ENT_COMPAT, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             return false;
@@ -122,7 +122,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, $GLOBALS['registry']->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, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             return false;
index 34b566b..3628040 100644 (file)
@@ -138,7 +138,7 @@ class IMP
 
         $result = $registry->call('contacts/import', array(array('name' => $newName, 'email' => $newAddress), 'array', $prefs->getValue('add_source')));
 
-        $escapeName = @htmlspecialchars($newName, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+        $escapeName = @htmlspecialchars($newName, ENT_COMPAT, 'UTF-8');
 
         try {
             if ($contact_link = $registry->link('contacts/show', array('uid' => $result, 'source' => $prefs->getValue('add_source')))) {
@@ -387,7 +387,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, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), 0, $len);
+                    $out = substr_replace($out, Horde_String::convertCharset($val, 'UTF-8', 'UTF7-IMAP'), 0, $len);
                     break;
                 }
             }
@@ -1026,7 +1026,7 @@ class IMP
     static public function formMbox($mbox, $to)
     {
         return $to
-            ? htmlspecialchars(rawurlencode($mbox), ENT_COMPAT, $GLOBALS['registry']->getCharset())
+            ? htmlspecialchars(rawurlencode($mbox), ENT_COMPAT, 'UTF-8')
             : rawurldecode($mbox);
     }
 
index 219d0ac..5104177 100644 (file)
@@ -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, ' ', '_'), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'));
+        $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), 'UTF-8', 'UTF7-IMAP'));
         if (!isset($this->_flags[$key])) {
             $entry = $this->_createEntry($label);
 
index 4c2b8e1..ca84d0d 100644 (file)
@@ -48,7 +48,7 @@ class IMP_LoginTasks_Task_DeleteSentmailMonthly extends Horde_LoginTasks_Task
         foreach ($imaptree as $k => $v) {
             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]"), $GLOBALS['registry']->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]"), 'UTF-8', 'UTF7-IMAP');
                 }
             }
         }
index 4093d78..56e254c 100644 (file)
@@ -362,7 +362,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(), $GLOBALS['registry']->getCharset());
+            $body = Horde_String::convertCharset($body, $body_part->getCharset(), 'UTF-8');
 
             /* Create a new iCalendar. */
             $vCal = new Horde_iCalendar();
@@ -529,7 +529,7 @@ class IMP_Message
 
                 /* Need to make sure all text is in the correct charset. */
                 $part_name = $part->getName(true);
-                $newPart->setCharset($GLOBALS['registry']->getCharset());
+                $newPart->setCharset('UTF-8');
                 $newPart->setContents(sprintf(_("[Attachment stripped: Original attachment type: %s, name: %s]"), $part->getType(), $part_name ? $part_name : _("unnamed")));
 
                 $parts[] = array(
index 0ef32ee..e80d515 100644 (file)
@@ -1095,7 +1095,7 @@ class IMP_Prefs_Ui
                 $t->set('personalkey-delete-help', Horde_Help::link('imp', 'pgp-personalkey-delete'));
 
                 Horde::addInlineScript(array(
-                    '$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')) { e.stop(); } })'
+                    '$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
                 ), 'dom');
             } else {
                 $imp_identity = $GLOBALS['injector']->getInstance('IMP_Identity');
@@ -1108,7 +1108,7 @@ class IMP_Prefs_Ui
                 $t->set('personalkey-create-passphrase-help', Horde_Help::link('imp', 'pgp-personalkey-create-passphrase'));
 
                 Horde::addInlineScript(array(
-                    '$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Key generation may take a long time to complete.  Continue with key generation?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')) { e.stop(); } })'
+                    '$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Key generation may take a long time to complete.  Continue with key generation?"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
                 ), 'dom');
 
                 if ($_SESSION['imp']['file_upload']) {
@@ -1432,7 +1432,7 @@ class IMP_Prefs_Ui
 
         $sent_mail_folder = IMP::formMbox($ui->vars->sent_mail_folder, false);
         if (empty($sent_mail_folder) && $ui->vars->sent_mail_folder_new) {
-            $sent_mail_folder = Horde_String::convertCharset($ui->vars->sent_mail_folder_new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+            $sent_mail_folder = Horde_String::convertCharset($ui->vars->sent_mail_folder_new, 'UTF-8', 'UTF7-IMAP');
         } elseif (strpos($sent_mail_folder, self::PREF_SPECIALUSE) === 0) {
             $sent_mail_folder = substr($folder, strlen(self::PREF_SPECIALUSE));
         } elseif (($sent_mail_folder == self::PREF_DEFAULT) &&
@@ -1491,7 +1491,7 @@ class IMP_Prefs_Ui
                 $t->set('personalkey-delete-help', Horde_Help::link('imp', 'smime-delete-personal-certs'));
 
                 Horde::addInlineScript(array(
-                    '$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')) { e.stop(); } })'
+                    '$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
                 ), 'dom');
             } elseif ($_SESSION['imp']['file_upload']) {
                 $cacheSess = $GLOBALS['injector']->getInstance('Horde_SessionObjects');
@@ -1928,7 +1928,7 @@ class IMP_Prefs_Ui
         if (strpos($folder, self::PREF_SPECIALUSE) === 0) {
             $folder = substr($folder, strlen(self::PREF_SPECIALUSE));
         } elseif (!empty($new)) {
-            $new = Horde_String::convertCharset($new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+            $new = Horde_String::convertCharset($new, 'UTF-8', 'UTF7-IMAP');
             $folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($new);
             if (!$GLOBALS['injector']->getInstance('IMP_Folder')->create($folder, $prefs->getValue('subscribe'), array($type => true))) {
                 $folder = null;
index 3e23bb7..335f0d1 100644 (file)
@@ -147,7 +147,7 @@ class IMP_Spam
 
                     /* Send the message. */
                     try {
-                        $imp_compose->sendMessage($to, $spam_headers, $mime, $GLOBALS['registry']->getCharset());
+                        $imp_compose->sendMessage($to, $spam_headers, $mime, 'UTF-8');
                         $report_flag = true;
                     } catch (IMP_Compose_Exception $e) {
                         Horde::logMessage($e, 'ERR');
index 7538b2f..af94651 100644 (file)
@@ -344,7 +344,7 @@ class IMP_Ui_Compose
                 // Sent mail display name
                 'smf_display' => IMP::displayFolder($identity->getValue('sent_mail_folder', $ident)),
                 // Bcc addresses to add
-                'bcc' => Horde_Mime_Address::addrArray2String($identity->getBccAddresses($ident), array('charset' => $GLOBALS['registry']->getCharset()))
+                'bcc' => Horde_Mime_Address::addrArray2String($identity->getBccAddresses($ident), array('charset' => 'UTF-8'))
             );
         }
 
index f2a7bfd..0d6cbdb 100644 (file)
@@ -76,7 +76,7 @@ class IMP_Ui_Mailbox
             $this->_cache['drafts_sm_folder'] = IMP::isSpecialFolder($this->_mailbox);
         }
 
-        $from = Horde_Mime_Address::getAddressesFromObject($ob['from'], array('charset' => $GLOBALS['registry']->getCharset()));
+        $from = Horde_Mime_Address::getAddressesFromObject($ob['from'], array('charset' => 'UTF-8'));
         $from = reset($from);
 
         if (empty($from)) {
@@ -90,7 +90,7 @@ class IMP_Ui_Mailbox
                     $ret['from'] = _("Undisclosed Recipients");
                     $ret['error'] = true;
                 } else {
-                    $to = Horde_Mime_Address::getAddressesFromObject($ob['to'], array('charset' => $GLOBALS['registry']->getCharset()));
+                    $to = Horde_Mime_Address::getAddressesFromObject($ob['to'], array('charset' => 'UTF-8'));
                     $first_to = reset($to);
                     if (empty($first_to)) {
                         $ret['from'] = _("Undisclosed Recipients");
@@ -257,7 +257,7 @@ class IMP_Ui_Mailbox
      */
     public function getSubject($subject, $htmlspaces = false)
     {
-        $subject = Horde_Mime::decode($subject, $GLOBALS['registry']->getCharset());
+        $subject = Horde_Mime::decode($subject, 'UTF-8');
         if (empty($subject)) {
             return _("[No Subject]");
         }
index 3d9a3da..a2be22a 100644 (file)
@@ -132,7 +132,7 @@ class IMP_Ui_Message
                 $GLOBALS['conf']['server']['name'],
                 $GLOBALS['injector']->getInstance('IMP_Mail'),
                 array(
-                    'charset' => $GLOBALS['registry']->getCharset(),
+                    'charset' => 'UTF-8',
                     'from_addr' => $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getIdentity()->getDefaultFromAddress()
                 )
             );
@@ -329,7 +329,7 @@ class IMP_Ui_Message
             } catch (Horde_Exception $e) {}
         }
 
-        foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => $registry->getCharset())) as $ob) {
+        foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => 'UTF-8')) as $ob) {
             if (isset($ob['groupname'])) {
                 $group_array = array();
                 foreach ($ob['addresses'] as $ad) {
index 3bee373..a84d421 100644 (file)
@@ -66,7 +66,7 @@ class IMP_Views_Compose
                         'num' => intval($num),
                         'size' => $mime->getSize(),
                         'type' => $mime->getType()
-                    ), Horde_Serialize::JSON, $registry->getCharset());
+                    ), Horde_Serialize::JSON, 'UTF-8');
                     $result['jsonload'][] = 'DimpCompose.addAttach(' . $opts . ')';
                 }
             }
index aa2d80c..53b0f9a 100644 (file)
@@ -400,7 +400,7 @@ class IMP_Views_ListMessages
 
         /* Get mailbox information. */
         $overview = $imp_mailbox->getMailboxArray($msglist, array('headers' => true, 'structure' => $GLOBALS['prefs']->getValue('atc_flag')));
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $imp_ui = new IMP_Ui_Mailbox($folder);
         $no_flags_hook = false;
 
index 11a9fb7..289ad70 100644 (file)
@@ -30,7 +30,7 @@ class IMP_Views_ShowMessage
 
         $addr_array = array();
 
-        foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => $GLOBALS['registry']->getCharset())) as $ob) {
+        foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => 'UTF-8')) as $ob) {
             if (!empty($ob['inner'])) {
                 try {
                     $tmp = array('raw' => Horde::callHook('dimp_addressformatting', array($ob), 'imp'));
index 0163b5e..3027c5f 100644 (file)
@@ -180,7 +180,7 @@ while (list(,$ob) = each($mbox_info['overview'])) {
     /* Get flag information. */
     $flag_parse = $injector->getInstance('IMP_Imap_Flags')->parse(array(
         'flags' => $ob['flags'],
-        'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => $registry->getCharset())),
+        'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => 'UTF-8')),
         'priority' => $ob['headers']
     ));
 
index f210344..10ad07f 100644 (file)
@@ -744,7 +744,7 @@ while (list(,$ob) = each($mbox_info['overview'])) {
         'atc' => isset($ob['structure']) ? $ob['structure'] : null,
         'div' => true,
         'flags' => $ob['flags'],
-        'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => $registry->getCharset())),
+        'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => 'UTF-8')),
         'priority' => $ob['headers']
     ));
 
@@ -791,7 +791,7 @@ while (list(,$ob) = each($mbox_info['overview'])) {
     }
 
     /* Format the From: Header. */
-    $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => $registry->getCharset()));
+    $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => 'UTF-8'));
     $msg['from'] = $getfrom['from'];
     $msg['fullfrom'] = $getfrom['fullfrom'];
     switch ($fromlinkstyle) {
index e82db7e..5774950 100644 (file)
@@ -274,7 +274,7 @@ if (IMP::canCompose()) {
         $menu[] = array(_("Reply to List"), IMP::composeLink(array(), array('a' => 'rl') + $compose_params));
     }
 
-    if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => $registry->getCharset(), 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
+    if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => 'UTF-8', 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
         $menu[] = array(_("Reply All"), IMP::composeLink(array(), array('a' => 'ra') + $compose_params));
     }
 
index 78189ba..ffaaa26 100644 (file)
@@ -327,8 +327,8 @@ case 'low':
 
 /* Build Reply-To address link. */
 if (!empty($envelope['reply-to']) &&
-    (Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['from']), array('charset' => $registry->getCharset()))) !=
-     Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['reply-to']), array('charset' => $registry->getCharset())))) &&
+    (Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['from']), array('charset' => 'UTF-8'))) !=
+     Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['reply-to']), array('charset' => 'UTF-8')))) &&
     ($reply_to = $imp_ui->buildAddressLinks($envelope['reply-to'], $self_link))) {
     $display_headers['reply-to'] = $reply_to;
 }
@@ -509,7 +509,7 @@ if (!$disable_compose) {
         $a_template->set('reply_list', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply_list') + $compose_params), _("To List"), 'widget', '', '', _("To _List"), true));
     }
 
-    if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => $registry->getCharset(), 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
+    if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => 'UTF-8', 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
         $a_template->set('show_reply_all', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply_all') + $compose_params), _("To All"), 'widget', '', '', _("To _All"), true));
     }
 
index 6107ce2..88f49f7 100644 (file)
@@ -74,7 +74,7 @@ if (count($ids)) {
             'description' => isset($ob['preview']) ? $ob['preview'] : '',
             'url' => Horde::url(IMP::generateIMPUrl('message.php', $mailbox, $ob['uid'], $mailbox), true, array('append_session' => -1)),
             'fromAddr' => $from_addr['fullfrom'],
-            'toAddr' => Horde_Mime_Address::addrArray2String(isset($ob['envelope']['to']) ? $ob['envelope']['to'] : array(), array('charset' => $registry->getCharset()))
+            'toAddr' => Horde_Mime_Address::addrArray2String(isset($ob['envelope']['to']) ? $ob['envelope']['to'] : array(), array('charset' => 'UTF-8'))
         ));
     }
 }
@@ -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', $registry->getCharset());
+$t->set('charset', 'UTF-8');
 $t->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
 $t->set('pubDate', htmlspecialchars(date('r')));
 $t->set('desc', htmlspecialchars($description));
index 986cbb6..b4ffa1d 100644 (file)
@@ -19,7 +19,7 @@ default:
 }
 
 if (isset($GLOBALS['language'])) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 4752f8c..7cefe8e 100644 (file)
@@ -240,5 +240,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, $GLOBALS['registry']->getCharset())
+    'var DIMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, 'UTF-8')
 ), null, true);
index de5030c..b7e61ca 100644 (file)
@@ -71,5 +71,5 @@ $code = array(
 );
 
 Horde::addInlineScript(array(
-    'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+    'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, 'UTF-8')
 ), null, true);
index ea4e541..6b0acb9 100644 (file)
@@ -81,7 +81,7 @@ if ($mode == 'thread') {
     $imp_indices = new IMP_Indices(IMP::$mailbox, $thread);
 }
 
-$charset = $registry->getCharset();
+$charset = 'UTF-8';
 $imp_ui = new IMP_Ui_Message();
 
 foreach ($imp_indices->indices() as $mbox => $idxlist) {
index b933bc5..e62d83b 100644 (file)
@@ -41,7 +41,7 @@
 
 function _sanitizeName($name)
 {
-    return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF-8')), ' _'), 'UTF-8');
+    return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, 'UTF-8', 'UTF-8')), ' _'), 'UTF-8');
 }
 
 require_once dirname(__FILE__) . '/lib/Application.php';
index b1b9c01..31fcfe6 100644 (file)
@@ -62,7 +62,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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             break 2;
@@ -71,7 +71,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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             break 2;
@@ -210,7 +210,7 @@ if (count($filter_list) == 0) {
 
         /* Create description. */
         if (!$edit_allowed) {
-            $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, 'UTF-8');
         } elseif (!empty($filter['conditions'])) {
             $descrip = '';
             $condition_size = count($filter['conditions']) - 1;
@@ -239,9 +239,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, $GLOBALS['registry']->getCharset()) . '</a>';
+            $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $descrip) . @htmlspecialchars($name, ENT_COMPAT, 'UTF-8') . '</a>';
         } else {
-            $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
+            $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, 'UTF-8') . '</a>';
         }
 
         /* Create edit link. */
index 6c6e223..47dfaa3 100644 (file)
@@ -153,7 +153,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, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP')))
+            ? $GLOBALS['registry']->call('mail/createFolder', array('folder' => Horde_String::convertCharset($folder, 'UTF-8', 'UTF7-IMAP')))
             : false;
     }
 
@@ -457,7 +457,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, $GLOBALS['registry']->getCharset())
+                'IngoNewFolder.folderprompt = ' . Horde_Serialize::serialize(_("Please enter the name of the new folder:"), Horde_Serialize::JSON, 'UTF-8')
             ));
         }
     }
index ce10ada..b5bd739 100644 (file)
@@ -127,7 +127,7 @@ class Ingo_Script
             $params['spam_char'] = $GLOBALS['conf']['spam']['char'];
         }
         if (!isset($params['charset'])) {
-            $params['charset'] = $GLOBALS['registry']->getCharset();
+            $params['charset'] = 'UTF-8';
         }
         if ($script == 'Sieve') {
             if (!isset($params['date_format'])) {
index 0270a0a..ad54d6e 100644 (file)
@@ -123,11 +123,11 @@ class Ingo_Storage_Filters_Sql extends Ingo_Storage_Filters {
      */
     protected function _ruleToBackend($rule)
     {
-        return array(Horde_String::convertCharset($rule['name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+        return array(Horde_String::convertCharset($rule['name'], 'UTF-8', $this->_params['charset']),
                      (int)$rule['action'],
-                     isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null,
+                     isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], 'UTF-8', $this->_params['charset']) : null,
                      isset($rule['flags']) ? (int)$rule['flags'] : null,
-                     isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], $GLOBALS['registry']->getCharset(), $this->_params['charset'])) : null,
+                     isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], 'UTF-8', $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);
index 3c1354c..729b54f 100644 (file)
@@ -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(), $GLOBALS['registry']->getCharset());
+                $data = Horde_String::convertCharset($data, $prefs->getCharset(), 'UTF-8');
             }
             if ($data) {
                 $ob->setFilterlist($data);
@@ -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(), $GLOBALS['registry']->getCharset(), $prefs->getCharset())), false);
+            return $prefs->setValue('rules', serialize(Horde_String::convertCharset($ob->getFilterList(), 'UTF-8', $prefs->getCharset())), false);
 
         case self::ACTION_FORWARD:
             $data = array(
index 9593297..434e56b 100644 (file)
@@ -272,10 +272,10 @@ class Ingo_Storage_Sql extends Ingo_Storage
             $values = array(
                 implode("\n", $ob->getVacationAddresses()),
                 Horde_String::convertCharset($ob->getVacationSubject(),
-                                       $GLOBALS['registry']->getCharset(),
+                                       'UTF-8',
                                        $this->_params['charset']),
                 Horde_String::convertCharset($ob->getVacationReason(),
-                                       $GLOBALS['registry']->getCharset(),
+                                       'UTF-8',
                                        $this->_params['charset']),
                 (int)$ob->getVacationDays(),
                 (int)$ob->getVacationStart(),
index b2347fe..b7be022 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset());
+        $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, 'UTF-8');
     }
     $notification->push($message, 'horde.error', array('content.raw'));
     Horde::url('filters.php', true)->redirect();
@@ -171,7 +171,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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             header('Location: ' . Horde::url('filters.php', true));
index 31c804e..0580182 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 $page_title = $GLOBALS['registry']->get('name');
index d226f5d..129de55 100644 (file)
@@ -18,7 +18,7 @@
 <table width="100%" cellspacing="0">
   <tr class="control">
     <td>
-      <?php echo Horde::label('name', _("Rule Name:")) ?> <input class="input" id="name" name="name" size="50" value="<?php echo (isset($rule['name'])) ? @htmlspecialchars($rule['name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()) : '' ?>" />
+      <?php echo Horde::label('name', _("Rule Name:")) ?> <input class="input" id="name" name="name" size="50" value="<?php echo (isset($rule['name'])) ? @htmlspecialchars($rule['name'], ENT_COMPAT, 'UTF-8') : '' ?>" />
     </td>
     <td width="40" class="rightAlign">
       <?php echo Horde_Help::link('ingo', 'rule-name') ?>&nbsp;
diff --git a/jeta/templates/common-header.inc b/jeta/templates/common-header.inc
new file mode 100644 (file)
index 0000000..4c9a507
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+if (isset($language)) {
+    header('Content-type: text/html; charset=' . 'UTF-8');
+    header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<title><?php echo htmlspecialchars($registry->get('name')) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
index e6bfd90..01bd5d8 100644 (file)
@@ -65,22 +65,22 @@ try {
 
 // Build the template (@TODO: Use Horde_View)
 $template = new Horde_Template();
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
 $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, $GLOBALS['registry']->getCharset())));
+    $template->set('channel_name', sprintf(_("Stories tagged with %s in %s"), $tag_name, @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')));
 } else {
-    $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()));
+    $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8'));
 }
-$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset()));
+$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, 'UTF-8'));
 $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::url('delivery/rss.php', true, -1), array('type' => 'rss', 'channel_id' => $channel['channel_id']))));
 $template->set('channel_rss2', htmlspecialchars(Horde_Util::addParameter(Horde::url('delivery/rss.php', true, -1), array('type' => 'rss2', 'channel_id' => $channel['channel_id']))));
 foreach ($stories as &$story) {
-    $story['title'] = @htmlspecialchars($story['title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
-    $story['description'] = @htmlspecialchars($story['description'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+    $story['title'] = @htmlspecialchars($story['title'], ENT_COMPAT, 'UTF-8');
+    $story['description'] = @htmlspecialchars($story['description'], ENT_COMPAT, 'UTF-8');
     $story['permalink'] = htmlspecialchars($story['permalink']);
     $story['published'] = htmlspecialchars(date('r', $story['published']));
     if (!empty($story['body_type']) && $story['body_type'] == 'text') {
index beae9b7..cd1b19c 100644 (file)
@@ -56,13 +56,13 @@ class Horde_Block_Jonah_latest extends Horde_Block
         try {
             $story = $this->_fetch();
         } catch (Exception $e) {
-            return @htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            return @htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
         }
 
         return '<span class="storyDate">'
-               . @htmlspecialchars($story['updated_date'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+               . @htmlspecialchars($story['updated_date'], ENT_COMPAT, 'UTF-8')
                . '</span> '
-               . @htmlspecialchars($story['title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+               . @htmlspecialchars($story['title'], ENT_COMPAT, 'UTF-8');
     }
 
     /**
index 744db8b..4aa0962 100644 (file)
@@ -59,15 +59,15 @@ class Horde_Block_Jonah_news extends Horde_Block {
         try {
             $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($this->_params['source']);
         } catch (Jonah_Exception $e) {
-            return @htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            return @htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
         }
 
         if (!empty($channel['channel_link'])) {
             $title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank')
-                . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+                . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')
                 . '</a>';
         } else {
-            $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8');
         }
 
         return $title;
index 87db935..40cfbbd 100644 (file)
@@ -56,15 +56,15 @@ class Horde_Block_Jonah_news_popular extends Horde_Block {
         try {
             $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($this->_params['source']);
         } catch (Exception $e) {
-            return @htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            return @htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
         }
 
         if (!empty($channel['channel_link'])) {
             $title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank')
-                . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+                . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')
                 . _(" - Most read stories") . '</a>';
         } else {
-            $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+            $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')
                 . _(" - Most read stories");
         }
 
index 093a4a1..d5d32c5 100644 (file)
@@ -57,12 +57,12 @@ class Horde_Block_Jonah_story extends Horde_Block {
         try {
             $story = $this->_fetch();
         } catch (Jonah_Exception $e) {
-            return htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            return htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
         }
         return '<span class="storyDate">'
-                . htmlspecialchars($story['updated_date'], ENT_COMPAT,$GLOBALS['registry']->getCharset())
+                . htmlspecialchars($story['updated_date'], ENT_COMPAT,'UTF-8')
                 . '</span> '
-                . htmlspecialchars($story['title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+                . htmlspecialchars($story['title'], ENT_COMPAT, 'UTF-8');
     }
 
     /**
index b15529e..f9fedb8 100644 (file)
@@ -406,13 +406,13 @@ class Jonah_Driver
 
             /* Add the text version of the story to the base message. */
             $message_text = new MIME_Part('text/plain');
-            $message_text->setCharset($GLOBALS['registry']->getCharset());
+            $message_text->setCharset('UTF-8');
             $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),
-                                          $GLOBALS['registry']->getCharset(), 'inline');
+                                          'UTF-8', 'inline');
             $message_html->setDescription(_("HTML Version of Story"));
 
             /* Add the two parts as multipart/alternative. */
@@ -426,7 +426,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['description'] . "\n\n" . $story['body']));
-            $message_text->setCharset($GLOBALS['registry']->getCharset());
+            $message_text->setCharset('UTF-8');
 
             return $message_text;
         }
index 0bf257a..bb97d90 100644 (file)
@@ -83,7 +83,7 @@ class Jonah_Driver_Sql extends Jonah_Driver
 
         array_unshift($values,
                       (int)$info['channel_id'],
-                      Horde_String::convertCharset($info['channel_name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+                      Horde_String::convertCharset($info['channel_name'], 'UTF-8', $this->_params['charset']),
                       (int)$info['channel_type'],
                       isset($info['channel_desc']) ? $info['channel_desc'] : null,
                       isset($info['channel_interval']) ? (int)$info['channel_interval'] : null,
@@ -253,10 +253,10 @@ class Jonah_Driver_Sql extends Jonah_Driver
         array_unshift($values,
                       (int)$info['id'],
                       (int)$info['channel_id'],
-                      Horde_String::convertCharset($info['title'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
-                      Horde_String::convertCharset($info['description'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+                      Horde_String::convertCharset($info['title'], 'UTF-8', $this->_params['charset']),
+                      Horde_String::convertCharset($info['description'], 'UTF-8', $this->_params['charset']),
                       $info['body_type'],
-                      isset($info['body']) ? Horde_String::convertCharset($info['body'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null,
+                      isset($info['body']) ? Horde_String::convertCharset($info['body'], 'UTF-8', $this->_params['charset']) : null,
                       isset($info['url']) ? $info['url'] : null,
                       isset($info['published']) ? (int)$info['published'] : null,
                       time(),
@@ -283,13 +283,13 @@ class Jonah_Driver_Sql extends Jonah_Driver
      */
     protected function _convertFromBackend($story)
     {
-        $story['title'] = Horde_String::convertCharset($story['title'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
-        $story['description'] = Horde_String::convertCharset($story['description'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+        $story['title'] = Horde_String::convertCharset($story['title'], $this->_params['charset'], 'UTF-8');
+        $story['description'] = Horde_String::convertCharset($story['description'], $this->_params['charset'], 'UTF-8');
         if (isset($story['body'])) {
-            $story['body'] = Horde_String::convertCharset($story['body'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+            $story['body'] = Horde_String::convertCharset($story['body'], $this->_params['charset'], 'UTF-8');
         }
         if (isset($story['tags'])) {
-            $story['tags'] = Horde_String::convertCharset($story['tags'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+            $story['tags'] = Horde_String::convertCharset($story['tags'], $this->_params['charset'], 'UTF-8');
         }
 
         return $story;
index b84c585..16de655 100644 (file)
@@ -26,12 +26,12 @@ function _mail($story_part, $from, $recipients, $subject, $note)
     $mail = new Horde_Mime_Mail(array('subject' => $subject,
                                       'to' => $recipients,
                                       'from' => $from,
-                                      'charset' => $GLOBALS['registry']->getCharset()));
+                                      'charset' => 'UTF-8'));
     $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, $GLOBALS['registry']->getCharset());
+        $message_note = new MIME_Part('text/plain', null, 'UTF-8');
         $message_note->setContents($message_note->replaceEOL($note));
         $message_note->setDescription(_("Note"));
         $mail->addMIMEPart($message_note);
index 36618df..dd26f7d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
diff --git a/kastalia/templates/common-header.inc b/kastalia/templates/common-header.inc
new file mode 100755 (executable)
index 0000000..1a7d8d1
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+if (isset($language)) {
+    header('Content-type: text/html; charset=' . 'UTF-8');
+    header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Kastalia: Copyright 2009 Andre Pawlowski  -->
+<!--     Horde Project: http://www.horde.org/ | Kastalia: http://h4des.org/index.php?inhalt=kastalia     -->
+<!--                 Horde Licenses: http://www.horde.org/licenses/                       -->
+<?php echo !empty($language) ? '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . strtr($language, '_', '-') . '" lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+
+
+<head>
+
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+    $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
index a5f9cdf..9735801 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 199da4b..05ad79e 100644 (file)
@@ -54,7 +54,7 @@ do {
             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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
             }
             $GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
             break;
index 17a083f..5b54759 100644 (file)
@@ -46,7 +46,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, $GLOBALS['registry']->getCharset());
+        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
     }
     $notification->push($message, 'horde.warning', array('content.raw'));
     $templates[Horde_Data::IMPORT_FILE] = array(KRONOLITH_TEMPLATES . '/data/export.inc');
@@ -182,7 +182,7 @@ case 'export':
             $calNames[] = $share->get('name');
         }
 
-        $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), $GLOBALS['registry']->getCharset(), 'utf-8'));
+        $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), 'UTF-8', 'utf-8'));
         $data = $iCal->exportvCalendar();
         $browser->downloadHeaders(_("events.ics"), 'text/calendar', false, strlen($data));
         echo $data;
@@ -264,7 +264,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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             break;
@@ -340,7 +340,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, $GLOBALS['registry']->getCharset()) . '));');
+        Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, 'UTF-8') . '));');
     }
     Horde::addInlineScript('window.parent.$(window.name).remove();');
     Horde::outputInlineScript();
index 2f92f21..c32e76d 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset());
+            $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
         }
         $GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
         return false;
index 19dc288..ce2384f 100644 (file)
@@ -59,7 +59,7 @@ if (!$fb) {
 }
 
 $browser->downloadHeaders(($user ? $user : $cal) . '.vfb',
-                          'text/calendar; charset=' . $GLOBALS['registry']->getCharset(),
+                          'text/calendar; charset=' . 'UTF-8',
                           true,
                           strlen($fb));
 echo $fb;
index 7ce6178..fcb499e 100644 (file)
@@ -91,17 +91,17 @@ $history = $injector->getInstance('Horde_History');
 $now = new Horde_Date(time());
 
 $template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
 $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, $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('calendar_name', @htmlspecialchars($share->get('name'), ENT_COMPAT, 'UTF-8'));
+$template->set('calendar_desc', @htmlspecialchars($share->get('desc'), ENT_COMPAT, 'UTF-8'), true);
+$template->set('calendar_owner', @htmlspecialchars($identity->getValue('fullname'), ENT_COMPAT, 'UTF-8'));
+$template->set('calendar_email', @htmlspecialchars($identity->getValue('from_addr'), ENT_COMPAT, 'UTF-8'), 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, $GLOBALS['registry']->getCharset());
+        $desc = @htmlspecialchars($event->description, ENT_COMPAT, 'UTF-8');
         if (strlen($desc)) {
             $desc .= '<br /><br />';
         }
@@ -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 .= '<br />' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            $desc .= '<br />' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, 'UTF-8');
         }
         if (strlen($event->location)) {
-            $desc .= '<br />' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            $desc .= '<br />' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, 'UTF-8');
         }
         $desc .= '<br />' . _("Event Status:") . ' ' . Kronolith::statusToString($event->status);
 
-        $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
-        $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+        $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, 'UTF-8');
+        $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, 'UTF-8');
         $entries[$id]['url'] = htmlspecialchars(Horde::url($event->getViewUrl(), true, -1));
         $entries[$id]['modified'] = $modified->format(DATE_ATOM);
     }
index 62cf4ef..7b075dd 100644 (file)
@@ -100,7 +100,7 @@ class Kronolith_Ajax_Application extends Horde_Core_Ajax_Application
                 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, $GLOBALS['registry']->getCharset());
+                    $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
                 }
                 $GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
                 return $result;
index f15ee95..2a5245f 100644 (file)
@@ -785,7 +785,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'), $GLOBALS['registry']->getCharset(), 'utf-8'));
+            $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'utf-8'));
 
             // Create a new vEvent.
             $iCal->addComponent($event->toiCalendar($iCal));
@@ -835,9 +835,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'), $GLOBALS['registry']->getCharset(), 'UTF-8'));
+            $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'UTF-8'));
             if (strlen($share->get('desc'))) {
-                $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), $GLOBALS['registry']->getCharset(), 'UTF-8'));
+                $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), 'UTF-8', 'UTF-8'));
             }
 
             foreach ($events as $dayevents) {
index 3425e6e..d84ca63 100644 (file)
@@ -523,7 +523,7 @@ class Kronolith_Application extends Horde_Registry_Application
                     $tree->addNode(
                         $parent . $calId . $event->id,
                         $parent,
-                        htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()),
+                        htmlspecialchars($event->getTitle(), ENT_COMPAT, 'UTF-8'),
                         1,
                         false,
                         array(
index 557941a..8df6d2d 100644 (file)
@@ -942,7 +942,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
      */
     public function convertToDriver($value)
     {
-        return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+        return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
     }
 
     /**
index 2349d7b..4aa4d89 100644 (file)
@@ -560,17 +560,17 @@ abstract class Kronolith_Event
             $vEvent->setAttribute('LAST-MODIFIED', $modified);
         }
 
-        $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), $GLOBALS['registry']->getCharset(), 'utf-8'));
+        $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), 'UTF-8', 'utf-8'));
         $name = Kronolith::getUserName($this->creator);
         if (!$v1) {
-            $name = Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'utf-8');
+            $name = Horde_String::convertCharset($name, 'UTF-8', '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, $GLOBALS['registry']->getCharset(), 'utf-8'));
+                $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, 'UTF-8', 'utf-8'));
             }
 
             // Tags
@@ -579,12 +579,12 @@ abstract class Kronolith_Event
                 $tags = implode(', ', $tags);
             }
             if (!empty($tags)) {
-                $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, $GLOBALS['registry']->getCharset(), 'utf-8'));
+                $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, 'UTF-8', 'utf-8'));
             }
 
             // Location
             if (!empty($this->location)) {
-                $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, $GLOBALS['registry']->getCharset(), 'utf-8'));
+                $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, 'UTF-8', 'utf-8'));
             }
             if ($this->geoLocation) {
                 $vEvent->setAttribute('GEO', array('latitude' => $this->geoLocation['lat'], 'longitude' => $this->geoLocation['lon']));
@@ -702,7 +702,7 @@ abstract class Kronolith_Event
                 }
             } else {
                 if (!empty($status['name'])) {
-                    $params['CN'] = Horde_String::convertCharset($status['name'], $GLOBALS['registry']->getCharset(), 'utf-8');
+                    $params['CN'] = Horde_String::convertCharset($status['name'], 'UTF-8', 'utf-8');
                 }
                 if (!empty($email)) {
                     $email = 'mailto:' . $email;
@@ -1104,7 +1104,7 @@ abstract class Kronolith_Event
      */
     public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message)
     {
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         /* New event? */
         if ($this->id === null) {
@@ -1231,7 +1231,7 @@ abstract class Kronolith_Event
      */
     public function toASAppointment()
     {
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
 
         $message = new Horde_ActiveSync_Message_Appointment(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger')));
         $message->setSubject(Horde_String::convertCharset($this->getTitle(), $charset, 'utf-8'));
@@ -2023,7 +2023,7 @@ abstract class Kronolith_Event
                         // Convert IDN hosts to ASCII.
                         if (function_exists('idn_to_ascii')) {
                             $old_error = error_reporting(0);
-                            $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8'));
+                            $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], 'UTF-8', 'UTF-8'));
                             error_reporting($old_error);
                         } elseif (Horde_Mime::is8bit($url['host'])) {
                             //throw new Kronolith_Exception(_("Invalid character in URL."));
@@ -2639,7 +2639,7 @@ abstract class Kronolith_Event
                                        '',
                                        array('style' => $this->getCSSColors(false)));
         }
-        $link .= @htmlspecialchars($event_title, ENT_QUOTES, $GLOBALS['registry']->getCharset());
+        $link .= @htmlspecialchars($event_title, ENT_QUOTES, 'UTF-8');
         if ($read_permission && $view_url) {
             $link .= '</a>';
         }
index 2a7daa3..b62a3e5 100644 (file)
@@ -79,7 +79,7 @@ class Kronolith
         Horde_Core_Ui_JsCalendar::init(array('short_weekdays' => true));
 
         if (isset($GLOBALS['language'])) {
-            header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+            header('Content-type: text/html; charset=' . 'UTF-8');
             header('Vary: Accept-Language');
         }
 
@@ -333,7 +333,7 @@ class Kronolith
         // Maps
         $code['conf']['maps'] = $GLOBALS['conf']['maps'];
 
-        return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $registry->getCharset()) . ';');
+        return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, 'UTF-8') . ';');
     }
 
     /**
@@ -1732,7 +1732,7 @@ class Kronolith
             $userName = $identity->getName();
             $mail = new Horde_Mime_Mail(
                 array('from' => $identity->getDefaultFromAddress(true),
-                      'charset' => $GLOBALS['registry']->getCharset())
+                      'charset' => 'UTF-8')
                 );
             $mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
         }
@@ -1763,7 +1763,7 @@ class Kronolith
                     }
                     $mail->addHeader('Subject', _("Ownership assignment"));
                     $mail->addHeader('To', $to);
-                    $mail->setBody($message, $GLOBALS['registry']->getCharset());
+                    $mail->setBody($message, 'UTF-8');
                     $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
                 }
             }
@@ -1917,7 +1917,7 @@ class Kronolith
                                        $share->get('name'));
                 }
                 $mail->addHeader('To', $to);
-                $mail->setBody($message, $GLOBALS['registry']->getCharset());
+                $mail->setBody($message, 'UTF-8');
                 $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
             }
         }
@@ -1973,7 +1973,7 @@ class Kronolith
                                            $share->get('name'));
                     }
                     $mail->addHeader('To', $groupOb->getName() . ' <' . $groupOb->data['email'] . '>');
-                    $mail->setBody($message, $GLOBALS['registry']->getCharset());
+                    $mail->setBody($message, 'UTF-8');
                     $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
                 }
             }
@@ -2166,7 +2166,7 @@ class Kronolith
                     : $newAttendeeParsedPart->personal;
 
                 try {
-                    $newAttendeeParsedPartNew = Horde_Mime::encodeAddress(Horde_Mime_Address::writeAddress($newAttendeeParsedPart->mailbox, $newAttendeeParsedPart->host, $name), $GLOBALS['registry']->getCharset());
+                    $newAttendeeParsedPartNew = Horde_Mime::encodeAddress(Horde_Mime_Address::writeAddress($newAttendeeParsedPart->mailbox, $newAttendeeParsedPart->host, $name), 'UTF-8');
                     $newAttendeeParsedPartValidated = $parser->parseAddressList($newAttendeeParsedPartNew, array(
                         'default_domain' => null
                     ));
@@ -2316,7 +2316,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'), $registry->getCharset(), 'utf-8'));
+            $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'utf-8'));
             $vevent = $event->toiCalendar($iCal);
             if ($action == self::ITIP_CANCEL && !empty($instance)) {
                 // Recurring event instance deletion, need to specify the
@@ -2333,18 +2333,18 @@ class Kronolith
             $ics->setContents($iCal->exportvCalendar());
             $ics->setName($filename);
             $ics->setContentTypeParameter('METHOD', $method);
-            $ics->setCharset($registry->getCharset());
+            $ics->setCharset('UTF-8');
 
             $multipart = new Horde_Mime_Part();
             $multipart->setType('multipart/alternative');
             $bodyText = new Horde_Mime_Part();
             $bodyText->setType('text/plain');
-            $bodyText->setCharset($registry->getCharset());
+            $bodyText->setCharset('UTF-8');
             $bodyText->setContents($view->render('notification.plain.php'));
             $multipart->addPart($bodyText);
             $bodyHtml = new Horde_Mime_Part();
             $bodyHtml->setType('text/html');
-            $bodyHtml->setCharset($registry->getCharset());
+            $bodyHtml->setCharset('UTF-8');
             $bodyHtml->setContents($view->render('notification.html.php'));
             $multipart->addPart($bodyHtml);
             $multipart->addPart($ics);
@@ -2352,7 +2352,7 @@ class Kronolith
             $mail = new Horde_Mime_Mail(array('subject' => $view->subject,
                                               'to' => $recipient,
                                               'from' => $ident->getDefaultFromAddress(true),
-                                              'charset' => $registry->getCharset()));
+                                              'charset' => 'UTF-8'));
             $mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
             $mail->setBasePart($multipart);
 
@@ -2482,9 +2482,9 @@ class Kronolith
                     $mime_mail = new Horde_Mime_Mail(array('subject' => $subject . ' ' . $event->title,
                                                            'to' => implode(',', $df_recipients),
                                                            'from' => $identity->getDefaultFromAddress(true),
-                                                           'charset' => $GLOBALS['registry']->getCharset()));
+                                                           'charset' => 'UTF-8'));
                     $mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
-                    $mime_mail->setBody($message, $GLOBALS['registry']->getCharset(), true);
+                    $mime_mail->setBody($message, 'UTF-8', 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);
                 }
index 1e62fad..856986a 100644 (file)
@@ -30,7 +30,7 @@ class Kronolith_View_ExportEvent {
                 $iCal->setAttribute(
                     'X-WR-CALNAME',
                     Horde_String::convertCharset($share->get('name'),
-                                                 $GLOBALS['registry']->getCharset(),
+                                                 'UTF-8',
                                                  'utf-8'));
             } catch (Exception $e) {
             }
@@ -41,7 +41,7 @@ class Kronolith_View_ExportEvent {
 
         $GLOBALS['browser']->downloadHeaders(
             $event->getTitle() . '.ics',
-            'text/calendar; charset=' . $GLOBALS['registry']->getCharset(),
+            'text/calendar; charset=' . 'UTF-8',
             true, strlen($content));
         echo $content;
         exit;
index e1ebd52..a8aaf70 100644 (file)
@@ -26,7 +26,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, $GLOBALS['registry']->getCharset());
+        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
     }
     $notification->push($message, 'horde.error', array('content.raw'));
     $url->redirect();
index 38987e8..ad9a623 100755 (executable)
@@ -54,7 +54,7 @@ function send_agendas()
     $runtime = new Horde_Date($runtime);
     $default_timezone = date_default_timezone_get();
     $kronolith_driver = Kronolith::getDriver();
-    $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/agenda', 'encoding' => $GLOBALS['registry']->getCharset()));
+    $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/agenda', 'encoding' => 'UTF-8'));
     new Horde_View_Helper_Text($view);
 
     // Loop through the users and generate an agenda for them
@@ -135,7 +135,7 @@ function send_agendas()
             array('subject' => sprintf(_("Your daily agenda for %s"), $view->date),
                   'to' => $email,
                   'from' => $GLOBALS['conf']['reminder']['from_addr'],
-                  'charset' => $GLOBALS['registry']->getCharset()));
+                  'charset' => 'UTF-8'));
         $mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
         try {
             $mime_mail->addRecipients($email);
@@ -145,12 +145,12 @@ function send_agendas()
         $multipart->setType('multipart/alternative');
         $bodyText = new Horde_Mime_Part();
         $bodyText->setType('text/plain');
-        $bodyText->setCharset($GLOBALS['registry']->getCharset());
+        $bodyText->setCharset('UTF-8');
         $bodyText->setContents($view->render('notification.plain.php'));
         $multipart->addPart($bodyText);
         $bodyHtml = new Horde_Mime_Part();
         $bodyHtml->setType('text/html');
-        $bodyHtml->setCharset($GLOBALS['registry']->getCharset());
+        $bodyHtml->setCharset('UTF-8');
         $bodyHtml->setContents($view->render('notification.html.php'));
         $multipart->addPart($bodyHtml);
         $mime_mail->setBasePart($multipart);
index c763729..168fef5 100644 (file)
@@ -5,7 +5,7 @@ Horde::addScriptFile('views.js', 'kronolith');
 Horde::addScriptFile('stripe.js', 'horde');
 
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 50e40ca..ae86648 100644 (file)
@@ -3,7 +3,7 @@
  * JavaScript variables for the traditional interface.
  */
 
-$charset = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
 $currentDate = Kronolith::currentDate();
 
 /* Variables used in core javascript files. */
index 97d4ffb..5d2a308 100644 (file)
@@ -26,7 +26,7 @@
 <!-- owner -->
 <tr>
  <td class="rightAlign"><strong><?php echo _("Owner") ?>&nbsp;&nbsp;</strong></td>
- <td><?php echo @htmlspecialchars($owner, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?> </td>
+ <td><?php echo @htmlspecialchars($owner, ENT_COMPAT, 'UTF-8') ?> </td>
 </tr>
 <?php endif; ?>
 
@@ -74,14 +74,14 @@ if ($this->event->initialized && $this->event->alarm > 0):
 <?php if (isset($created)): ?>
 <tr>
   <td class="nowrap rightAlign"><strong><?php echo _("Created") ?></strong>&nbsp;&nbsp;</td>
-  <td class="nowrap"><?php  echo $created->strftime($dateFormat) . ' ' . $created->format($timeFormat) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+  <td class="nowrap"><?php  echo $created->strftime($dateFormat) . ' ' . $created->format($timeFormat) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, 'UTF-8') ?></td>
 </tr>
 <?php endif; ?>
 
 <?php if (isset($modified)): ?>
 <tr>
   <td class="nowrap rightAlign"><strong><?php echo _("Last Modified") ?></strong>&nbsp;&nbsp;</td>
-  <td class="nowrap"><?php echo $modified->strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+  <td class="nowrap"><?php echo $modified->strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, 'UTF-8') ?></td>
 </tr>
 <?php endif; ?>
 
index 07a341f..83626c7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 93239ec..88ed5e8 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset());
+    $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, 'UTF-8');
     if (!empty($conf['hooks']['permsdenied'])) {
         $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
     }
@@ -121,7 +121,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, $GLOBALS['registry']->getCharset());
+            $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, 'UTF-8');
             if (!empty($conf['hooks']['permsdenied'])) {
                 $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
             }
index cf58f79..abc009e 100644 (file)
@@ -163,10 +163,10 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
                  ' VALUES (?, ?, ?, ?, ?, ?)';
         $values = array($this->_notepad,
                         $noteId,
-                        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']));
+                        Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+                        Horde_String::convertCharset($body, 'UTF-8', $this->_params['charset']),
+                        Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']),
+                        Horde_String::convertCharset($uid, 'UTF-8', $this->_params['charset']));
 
         /* Log the query at a DEBUG log level. */
         Horde::logMessage(sprintf('Mnemo_Driver_sql::add(): %s', $query), 'DEBUG');
@@ -208,13 +208,13 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
 
         $query  = 'UPDATE ' . $this->_params['table'] .
                   ' SET memo_desc = ?, memo_body = ?';
-        $values = array(Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
-                        Horde_String::convertCharset($body, $GLOBALS['registry']->getCharset(), $this->_params['charset']));
+        $values = array(Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+                        Horde_String::convertCharset($body, 'UTF-8', $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, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+            $values[] = Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']);
         }
         $query .= ' WHERE memo_owner = ? AND memo_id = ?';
         array_push($values, $this->_notepad, $noteId);
index 3a5b47d..310b43a 100644 (file)
@@ -72,7 +72,7 @@ case 'add_memo':
     /* Check permissions. */
     if ($injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
         $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
-        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $registry->getCharset());
+        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, 'UTF-8');
         if (!empty($conf['hooks']['permsdenied'])) {
             $message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
         }
index bc3efcc..1602249 100644 (file)
@@ -58,8 +58,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 ($GLOBALS['registry']->getCharset(true) == 'ISO-8859-1') {
-    $note = String::convertCharset($note, $GLOBALS['registry']->getCharset(), 'ISO-8859-1');
+if ($GLOBALS['registry']->getLanguageCharset() == 'ISO-8859-1') {
+    $note = String::convertCharset($note, 'UTF-8', 'ISO-8859-1');
 }
 
 /* Set up the PDF object. */
index 5a446f9..a329b56 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index e238a5b..91f47d9 100644 (file)
@@ -30,14 +30,14 @@ if (!$print_view) {
 <?php if (isset($created)): ?>
 <tr>
   <td align="right"><strong><?php echo _("Created") ?></strong>&nbsp;</td>
-  <td><?php echo strftime($prefs->getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+  <td><?php echo strftime($prefs->getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, 'UTF-8') ?></td>
 </tr>
 <?php endif; ?>
 
 <?php if (isset($modified)): ?>
 <tr>
   <td align="right"><strong><?php echo _("Last Modified") ?></strong>&nbsp;</td>
-  <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+  <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, 'UTF-8') ?></td>
 </tr>
 <?php endif; ?>
 
index e75eb60..afb9e4b 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset());
+        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, 'UTF-8');
     }
     $notification->push($message, 'horde.warning', array('content.raw'));
     $templates[Horde_Data::IMPORT_FILE] = array(NAG_TEMPLATES . '/data/export.inc');
@@ -169,7 +169,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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             break;
index 1edd00c..02e1872 100644 (file)
@@ -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'), $GLOBALS['registry']->getCharset(), 'utf-8'));
+            $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'utf-8'));
 
             $tasks->reset();
             while ($task = $tasks->each()) {
index c5715a6..18ded45 100644 (file)
@@ -131,17 +131,17 @@ class Nag_Driver_Sql extends Nag_Driver {
                         $owner,
                         $assignee,
                         $taskId,
-                        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']),
+                        Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+                        Horde_String::convertCharset($uid, 'UTF-8', $this->_params['charset']),
+                        Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
                         (int)$start,
                         (int)$due,
                         (int)$priority,
                         number_format($estimate, 2),
                         (int)$completed,
-                        Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+                        Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']),
                         (int)$alarm,
-                        serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])),
+                        serialize(Horde_String::convertCharset($methods, 'UTF-8', $this->_params['charset'])),
                         (int)$private,
                         $parent);
 
@@ -201,17 +201,17 @@ class Nag_Driver_Sql extends Nag_Driver {
                          $this->_params['table']);
         $values = array($owner,
                         $assignee,
-                        Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
-                        Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+                        Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+                        Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
                         (int)$start,
                         (int)$due,
                         (int)$priority,
                         number_format($estimate, 2),
                         (int)$completed,
                         (int)$completed_date,
-                        Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+                        Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']),
                         (int)$alarm,
-                        serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])),
+                        serialize(Horde_String::convertCharset($methods, 'UTF-8', $this->_params['charset'])),
                         $parent,
                         (int)$private,
                         $this->_tasklist,
index 801959f..b76b9f4 100644 (file)
@@ -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('&nbsp;', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+            $task_enums[htmlspecialchars($task->id)] = str_repeat('&nbsp;', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, 'UTF-8');
         }
         $users = array();
         $share = $GLOBALS['nag_shares']->getShare($tasklist);
index 18aa919..c6117dc 100644 (file)
@@ -673,11 +673,11 @@ class Nag
                                    'mail/compose',
                                    array(array('to' => $email))))
                 . @htmlspecialchars($fullname . ' <' . $email . '>',
-                                    ENT_COMPAT, $GLOBALS['registry']->getCharset())
+                                    ENT_COMPAT, 'UTF-8')
                 . '</a>';
         }
 
-        return @htmlspecialchars($fullname, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+        return @htmlspecialchars($fullname, ENT_COMPAT, 'UTF-8');
     }
 
     /**
@@ -1003,7 +1003,7 @@ class Nag
                 break;
             }
 
-            $mail->addHeader('Subject', $subject . ' ' . $task->name, $GLOBALS['registry']->getCharset());
+            $mail->addHeader('Subject', $subject . ' ' . $task->name, 'UTF-8');
 
             foreach ($twentyFour as $tf => $dateFormat) {
                 foreach ($dateFormat as $df => $df_recipients) {
@@ -1015,7 +1015,7 @@ class Nag
                         $message .= "\n\n" . _("Task description:") . "\n\n" . $task->desc;
                     }
 
-                    $mail->setBody($message, $GLOBALS['registry']->getCharset());
+                    $mail->setBody($message, 'UTF-8');
                     $mail->clearRecipients();
                     $mail->addRecipients($df_recipients);
 
index 0a88bdf..01c84b1 100644 (file)
@@ -800,11 +800,11 @@ class Nag_Task {
         }
 
         if (!empty($this->name)) {
-            $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8'));
+            $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, 'UTF-8', 'utf-8'));
         }
 
         if (!empty($this->desc)) {
-            $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, $GLOBALS['registry']->getCharset(), 'utf-8'));
+            $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, 'UTF-8', '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, $GLOBALS['registry']->getCharset(), 'utf-8'));
+            $vTodo->setAttribute('CATEGORIES', $v1 ? $this->category : Horde_String::convertCharset($this->category, 'UTF-8', '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, $GLOBALS['registry']->getCharset(), 'utf-8'));
-        $message->setSubject(Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8'));
+        $message->setBody(Horde_String::convertCharset($this->desc, 'UTF-8', 'utf-8'));
+        $message->setSubject(Horde_String::convertCharset($this->name, 'UTF-8', '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', $GLOBALS['registry']->getCharset());
-        $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', $GLOBALS['registry']->getCharset());
+        $this->desc = Horde_String::convertCharset($message->getBody(), 'utf-8', 'UTF-8');
+        $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', 'UTF-8');
 
         /* Completion */
         if ($this->completed = $message->getComplete()) {
index d5d9d3c..92e5334 100644 (file)
@@ -71,7 +71,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, $GLOBALS['registry']->getCharset());
+            $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, 'UTF-8');
         }
         $notification->push($message, 'horde.error', array('content.raw'));
         Horde::url('list.php', true)->redirect();
index 2abfc8c..5d7a22d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index cdb4a6e..3eece03 100644 (file)
 <?php if (isset($created)): ?>
  <tr>
   <td class="rightAlign"><strong><?php echo _("Created") ?></strong></td>
-  <td><?php echo strftime($prefs->getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+  <td><?php echo strftime($prefs->getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, 'UTF-8') ?></td>
  </tr>
 <?php endif; ?>
 
 <?php if (isset($modified)): ?>
  <tr>
   <td class="rightAlign"><strong><?php echo _("Last Modified") ?></strong></td>
-  <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+  <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, 'UTF-8') ?></td>
  </tr>
 <?php endif; ?>
 
diff --git a/news/mail.php b/news/mail.php
new file mode 100644 (file)
index 0000000..292cf6b
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/**
+ * News
+ *
+ * $Id: mail.php 1174 2009-01-19 15:11:03Z duck $
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Duck <duck@obala.net>
+ * @package News
+ */
+
+require_once dirname(__FILE__) . '/lib/base.php';
+
+$id = Horde_Util::getFormData('id');
+$row = $news->get($id);
+if ($row instanceof PEAR_Error) {
+    $notification->push($row);
+    Horde::url('browse.php')->redirect();
+}
+
+/* Error handler */
+function _error($msg)
+{
+    $GLOBALS['notification']->push($msg, 'horde.error');
+    News::getUrlFor('news', $GLOBALS['id'])->redirect();
+}
+
+if (!$registry->isAuthenticated()) {
+    _error(_("Only authenticated users can send mails."));
+}
+
+$to = Horde_Util::getFormData('email');
+if (empty($to)) {
+    _error(_("No mail entered."));
+    exit;
+}
+
+$from = $prefs->getValue('from_addr');
+if (empty($from)) {
+    _error(_("You have no email set."));
+    exit;
+}
+
+$body = sprintf(_("%s would you like to invite you to read the news\n Title: %s\n\n Published: %s \nLink: %s"),
+                $GLOBALS['registry']->getAuth(),
+                $row['title'],
+                $row['publish'],
+                News::getUrlFor('news', $id, true, -1));
+
+$mail = new Horde_Mime_Mail(array('subject' => $row['title'], 'body' => $body, 'to' => $to, 'from' => $from, 'charset' => 'UTF-8'));
+try {
+    $mail->send($injector->getInstance('Horde_Mail'));
+    $notification->push(sprintf(_("News succesfully send to %s"), $to), 'horde.success');
+} catch (Horde_Mime_Exception $e) {
+    $notification->push($e);
+}
+
+News::getUrlFor('news', $id)->redirect();
diff --git a/news/pdf.php b/news/pdf.php
new file mode 100644 (file)
index 0000000..d5fd9c9
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * News
+ *
+ * $Id: pdf.php 1191 2009-01-21 16:45:21Z duck $
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Duck <duck@obala.net>
+ * @package News
+ */
+
+$no_compress = true;
+require_once dirname(__FILE__) . '/lib/base.php';
+
+$id = Horde_Util::getFormData('id');
+$row = $news->get($id);
+
+// Check if the news exists
+if ($row instanceof PEAR_Error) {
+    $notification->push($row);
+    Horde::url('browse.php')->redirect();
+}
+
+// Set up the PDF object.
+$pdf = new Horde_Pdf_Writer();
+
+$pdf->setInfo('title', $row['title']);
+$pdf->setInfo('author', $row['user']);
+$pdf->setInfo('CreationDate', 'D:' . date('Ymdhis'));
+
+$pdf->open();
+$pdf->addPage();
+$pdf->setAutoPageBreak(true);
+$pdf->setFont('Arial', '', 12);
+
+if ($row['picture']) {
+    $file = $conf['vfs']['params']['vfsroot'] . '/'
+            . News::VFS_PATH . '/images/news/big/'
+            . $id . '.' . $conf['images']['image_type'];
+    try {
+        $pdf->image($file, 120, 20);
+    } catch (Horde_Pdf_Exception $e) {
+        Horde::logMessage($e, 'INFO');
+    }
+}
+
+$pdf->setFillColor('rgb', 200/255, 220/255, 255/255);
+$pdf->cell(0, 6, $row['title'], 0, 1, 'L', 1);
+$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']), 'UTF-8', 'UTF-8'));
+
+$browser->downloadHeaders($id . '.pdf', 'application/pdf');
+echo $pdf->getOutput();
diff --git a/news/rss/comments.php b/news/rss/comments.php
new file mode 100644 (file)
index 0000000..3844b8f
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * $Id: comments.php 1263 2009-02-01 23:25:56Z duck $
+ *
+ * Copyright 2007 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ */
+
+$news_authentication = 'none';
+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 = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
+<rss version="2.0">
+<channel>
+    <title>' . htmlspecialchars($title) . '</title>
+    <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
+    <lastBuildDate>' . date('r') . '</lastBuildDate>
+    <description>' . htmlspecialchars($title) . '</description>
+    <link>' . Horde::url('index.php', true, -1) . '</link>
+    <generator>' . htmlspecialchars($registry->get('name')) . '</generator>';
+
+    foreach ($list as $comment) {
+        $rss .= '
+    <item>
+        <title>' . htmlspecialchars($comment['message_subject']) . ' </title>
+        <link>' . $comment['read_url'] . '</link>
+        <guid isPermaLink="true">' . $comment['read_url'] . '</guid>
+        <pubDate>' . date('r', strtotime($comment['message_date'])) . '</pubDate>
+        <description><![CDATA[' . $comment['message_author'] . ': ' . strip_tags($comment['body']) . ']]></description>
+    </item>';
+    }
+
+    $rss .= '
+</channel>
+</rss>';
+
+    $cache->set($cache_key, $rss);
+}
+
+header('Content-type: text/xml; charset=' . 'UTF-8');
+echo $rss;
diff --git a/news/rss/index.php b/news/rss/index.php
new file mode 100644 (file)
index 0000000..be6ba6c
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/**
+ * $Id: index.php 183 2008-01-06 17:39:50Z duck $
+ *
+ * Copyright 2007 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ */
+
+$news_authentication = 'none';
+require_once dirname(__FILE__) . '/../lib/base.php';
+
+// Show a specific user?
+$cache_key = 'news_rss_index';
+
+$rss = $cache->get($cache_key, $conf['cache']['default_lifetime']);
+if (!$rss) {
+
+    $title = $registry->get('name', 'horde');
+
+    $read_url = Horde::url('read.php', true, -1);
+    $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
+    <rss version="2.0">
+        <channel>
+        <title>' . htmlspecialchars($title) . '</title>
+        <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
+        <lastBuildDate>' . date('r') . '</lastBuildDate>
+        <description>' . htmlspecialchars($title) . '</description>
+        <link>' . Horde::url('index.php', true, -1) . '</link>
+        <generator>' . htmlspecialchars($registry->get('name')) . '</generator>';
+
+    $rss .= '
+    <item>
+        <title>' . _("Last news") . ' </title>
+        <link>' . Horde::url('rss/news.php', true, -1) . '</link>
+    </item>';
+
+    $rss .= '
+    <item>
+        <title>' . _("Last comments") . ' </title>
+        <link>' . Horde::url('rss/comments.php', true, -1) . '</link>
+    </item>';
+
+    $rss .= '
+    </channel>
+    </rss>';
+
+    $cache->set($cache_key, $rss);
+}
+
+header('Content-type: text/xml');
+echo $rss;
diff --git a/news/rss/news.php b/news/rss/news.php
new file mode 100755 (executable)
index 0000000..5df939e
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ * $Id: news.php 1263 2009-02-01 23:25:56Z duck $
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ * @author McLion <mclion@obala.net>
+ */
+
+$news_authentication = 'none';
+require_once dirname(__FILE__) . '/../lib/base.php';
+
+$cache_key = 'news_rss_news';
+$rss = $cache->get($cache_key, $conf['cache']['default_lifetime']);
+if (empty($rss)) {
+
+    /* query preparation */
+    $query = 'SELECT n.id, publish, n.user, n.source, n.sourcelink, ' .
+             'n.category1, n.category2, n.comments, n.picture, n.chars, nl.content, ' .
+             '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="' . $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);
+    $categories = $news_cat->getCategories(false);
+    $title = sprintf(_("Last news"), $registry->get('name', 'horde'));
+
+    $lastnewstime = 0;
+    foreach ($list as $news_id => $news) {
+        $news_link = News::getUrlFor('news', $news_id, true);
+        $rssbody .= '
+    <item>
+        <enclosure url="http://' . $_SERVER['SERVER_NAME']  . News::getImageUrl($news_id) . '" type="image/jpg" />
+        <title>' . htmlspecialchars($news['title']) . ' </title>
+        <dc:creator>' . htmlspecialchars($news['user']). '</dc:creator>
+        <link>' . $news_link . '</link>
+        <guid isPermaLink="true">' . $news_link . '</guid>
+        <comments>' . $news_link . '#comments</comments>
+        <description><![CDATA[' . trim(substr(htmlspecialchars(strip_tags($news['content'])), 0, 512)) . ']]></description>
+        <pubDate>' . date('r', strtotime($news['publish'])) . '</pubDate>
+        <category><![CDATA[' . $categories[$news['category1']]['category_name'] . ']]></category>
+    </item>';
+
+        if (strtotime($news['publish']) > $lastnewstime) {
+            $lastnewstime = strtotime($news['publish']);
+        }
+    }
+
+    // Wee need the last published news time
+    $rssheader = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
+<rss version="2.0"
+    xmlns:content="http://purl.org/rss/1.0/modules/content/"
+    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+    xmlns:dc="http://purl.org/dc/elements/1.1/" >
+<channel>
+    <title>' . htmlspecialchars($title) . '</title>
+    <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
+    <lastBuildDate>' . date('r', $lastnewstime) . '</lastBuildDate>
+    <description>' . htmlspecialchars($title) . '</description>
+    <link>' . Horde::url('index.php', true, -1) . '</link>
+    <generator>' . htmlspecialchars($registry->get('name')) . '</generator>';
+
+    $rssfooter = '
+</channel>
+</rss>';
+
+    // build rss
+    $rss = $rssheader . $rssbody . $rssfooter;
+
+    $cache->set($cache_key, $rss);
+}
+
+header('Content-type: text/xml;  charset=utf-8');
+echo $rss;
diff --git a/news/templates/common-header.inc b/news/templates/common-header.inc
new file mode 100644 (file)
index 0000000..991f28d
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+if (isset($language)) {
+    header('Content-type: text/html; charset=' . 'UTF-8');
+    header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- news: Copyright 2004-2010 The Horde Project. news is under a Horde license. -->
+<!--     Horde Project: http://www.horde.org/ | news: http://www.horde.org/horde/     -->
+<!--                 Horde Licenses: http://www.horde.org/licenses/                       -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+    $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<link rel="alternate" title="<?php echo _("Last news") ?>" href="<?php echo Horde::url('rss/news.php', true, -1) ?>" type="application/rss+xml" />
+<link rel="alternate" title="<?php echo _("Last comments") ?>" href="<?php echo Horde::url('rss/comments.php', true, -1) ?>" type="application/rss+xml" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
index a914719..3d3d06c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 563c6c4..90f306b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index dcd0d51..a278cfa 100644 (file)
@@ -1,6 +1,6 @@
 <?php
      if (isset($language)) {
-         header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+         header('Content-type: text/html; charset=' . 'UTF-8');
          header('Vary: Accept-Language');
      }
 ?>
index 9f6a527..216fef7 100644 (file)
 var ajax_url = '<?php echo Horde::getServiceLink('ajax', 'shout') ?>';
 var curmenu = null;
 var menuInfo = $H();
-var menuActions = $H(<?php echo Horde_Serialize::serialize(Shout::getMenuActions(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
-var destinations = $H(<?php echo Horde_Serialize::serialize($destinations, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
-var conferences = $H(<?php echo Horde_Serialize::serialize($conferences, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
-var recordings = $H(<?php echo Horde_Serialize::serialize($recordings, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
+var menuActions = $H(<?php echo Horde_Serialize::serialize(Shout::getMenuActions(), Horde_Serialize::JSON, 'UTF-8'); ?>);
+var destinations = $H(<?php echo Horde_Serialize::serialize($destinations, Horde_Serialize::JSON, 'UTF-8'); ?>);
+var conferences = $H(<?php echo Horde_Serialize::serialize($conferences, Horde_Serialize::JSON, 'UTF-8'); ?>);
+var recordings = $H(<?php echo Horde_Serialize::serialize($recordings, Horde_Serialize::JSON, 'UTF-8'); ?>);
 
 function empty(p)
 {
index 563c6c4..90f306b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
diff --git a/skoli/templates/common-header.inc b/skoli/templates/common-header.inc
new file mode 100644 (file)
index 0000000..df35f6c
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+if (isset($language)) {
+    header('Content-type: text/html; charset=' . 'UTF-8');
+    header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Skoli: Copyright 2004-2008 The Horde Project.  Skoli is under a Horde license. -->
+<!--    Horde Project: http://www.horde.org/ | Skoli: http://www.horde.org/horde/   -->
+<!--                Horde Licenses: http://www.horde.org/licenses/                  -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+    $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+$bc = $prefs->getValue('show_panel')
+    ? 'rightPanel'
+    : '';
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+<link href="<?php echo Horde::url('themes/categoryCSS.php') ?>" rel="stylesheet" type="text/css" />
+</head>
+
+<body<?php if ($bc) echo ' class="' . $bc . '"' ?>>
index 787c32b..95a1b9d 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset());
+        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, 'UTF-8');
         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, $GLOBALS['registry']->getCharset());
+        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, 'UTF-8');
         if (!empty($conf['hooks']['permsdenied'])) {
             $message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
         }
index c2d27a7..88a14ea 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset());
+    $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, 'UTF-8');
     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, $GLOBALS['registry']->getCharset());
+    $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, 'UTF-8');
     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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, 'UTF-8');
                 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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, 'UTF-8');
                 if (!empty($conf['hooks']['permsdenied'])) {
                     $message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
                 }
index cdbc127..e705fac 100644 (file)
@@ -1012,9 +1012,9 @@ class Trean_Bookmark {
                 return $update;
             }
             $result = $update->execute(array($this->folder,
-                                             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']),
+                                             Horde_String::convertCharset($this->url, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+                                             Horde_String::convertCharset($this->title, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+                                             Horde_String::convertCharset($this->description, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
                                              $this->clicks,
                                              $this->rating,
                                              $this->id));
@@ -1048,9 +1048,9 @@ class Trean_Bookmark {
 
         $result = $insert->execute(array($bookmark_id,
                                          $this->folder,
-                                         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']),
+                                         Horde_String::convertCharset($this->url, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+                                         Horde_String::convertCharset($this->title, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+                                         Horde_String::convertCharset($this->description, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
                                          $this->clicks,
                                          $this->rating,
         ));
index f710968..929fd29 100644 (file)
@@ -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 = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+    $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
     <rss version="2.0">
         <channel>
         <title>' . htmlspecialchars($folderId == null ? $registry->get('name') : $folder->get('name')) . '</title>
         <language>' . $registry->preferredLang() . '</language>
-        <charset>' . $GLOBALS['registry']->getCharset() . '</charset>
+        <charset>' . 'UTF-8' . '</charset>
         <lastBuildDate>' . date('Y-m-d H:i:s') . '</lastBuildDate>
         <image>
             <url>http://' . $_SERVER['SERVER_NAME'] . $registry->get('webroot') . '/themes/graphics/favicon.ico</url>
index bec332a..2d302e1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index da3b00d..8f2b375 100644 (file)
@@ -48,7 +48,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, $GLOBALS['registry']->getCharset());
+                $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, 'UTF-8');
             }
             $notification->push($message, 'horde.error', array('content.raw'));
             $url = $url
index 883c9bc..e2f87e1 100644 (file)
@@ -591,7 +591,7 @@ $cfgSources['localsql'] = array(
 //     'type' => 'prefs',
 //     'params' => array(
 //         'name' => 'prefs',
-//         'charset' => $GLOBALS['registry']->getCharset()
+//         'charset' => 'UTF-8'
 //     ),
 //     'map' => array(
 //         '__key' => 'id',
index d0784d2..754ddf3 100644 (file)
@@ -278,7 +278,7 @@ case 'export':
                         } elseif ($attributes[$field]['type'] == 'datetime') {
                             $row[$field] = strftime('%Y-%m-%d %R', $attribute);
                         } else {
-                        $row[$field] = Horde_String::convertCharset($attribute, $GLOBALS['registry']->getCharset(), $params['charset']);
+                        $row[$field] = Horde_String::convertCharset($attribute, 'UTF-8', $params['charset']);
                         }
                     }
                 }
@@ -349,7 +349,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, $GLOBALS['registry']->getCharset());
+            $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $driver->title), ENT_COMPAT, 'UTF-8');
         }
         $notification->push($message, 'horde.error', array('content.raw'));
         $error = true;
@@ -552,7 +552,7 @@ if ($next_step == Horde_Data::IMPORT_FILE) {
             $charsets[$charset] = $charset;
         }
     }
-    $my_charset = $GLOBALS['registry']->getCharset(true);
+    $my_charset = $GLOBALS['registry']->getLanguageCharset();
 }
 
 foreach ($templates[$next_step] as $template) {
index 0d04120..e499993 100644 (file)
@@ -964,7 +964,7 @@ class Turba_Driver implements Countable
         $vcard = new Horde_Icalendar_Vcard($version);
         $formattedname = false;
         $charset = ($version == '2.1')
-            ? array('CHARSET' => $GLOBALS['registry']->getCharset())
+            ? array('CHARSET' => 'UTF-8')
             : array();
 
         foreach ($hash as $key => $val) {
@@ -973,7 +973,7 @@ class Turba_Driver implements Countable
             }
 
             if ($version != '2.1') {
-                $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+                $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
             }
 
             switch ($key) {
@@ -1642,8 +1642,8 @@ class Turba_Driver implements Countable
         );
         $val = implode(';', $a);
         if ($version != '2.1') {
-            $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
-            $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+            $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+            $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
         }
         if (!$fields || isset($fields['N'])) {
             $vcard->setAttribute('N', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $a);
@@ -1659,7 +1659,7 @@ class Turba_Driver implements Countable
                 $val = '';
             }
             if ($version != '2.1') {
-                $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+                $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
             }
             $vcard->setAttribute('FN', $val, Horde_Mime::is8bit($val) ? $charset : array());
         }
@@ -1676,8 +1676,8 @@ class Turba_Driver implements Countable
         if (count($org) && (!$fields || isset($fields['ORG']))) {
             $val = implode(';', $org);
             if ($version != '2.1') {
-                $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
-                $org = Horde_String::convertCharset($org, $GLOBALS['registry']->getCharset(), 'utf-8');
+                $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+                $org = Horde_String::convertCharset($org, 'UTF-8', 'utf-8');
             }
             $vcard->setAttribute('ORG', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $org);
         }
@@ -1729,12 +1729,12 @@ class Turba_Driver implements Countable
             if ($version == '2.1') {
                 $params = array();
                 if (Horde_Mime::is8bit($val)) {
-                    $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+                    $params['CHARSET'] = 'UTF-8';
                 }
             } else {
                 $params = array('TYPE' => '');
-                $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
-                $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+                $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+                $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
             }
             $vcard->setAttribute('ADR', $val, $params, true, $a);
         }
@@ -1784,12 +1784,12 @@ class Turba_Driver implements Countable
             if ($version == '2.1') {
                 $params = array('HOME' => null);
                 if (Horde_Mime::is8bit($val)) {
-                    $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+                    $params['CHARSET'] = 'UTF-8';
                 }
             } else {
                 $params = array('TYPE' => 'HOME');
-                $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
-                $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+                $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+                $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
             }
             $vcard->setAttribute('ADR', $val, $params, true, $a);
         }
@@ -1839,12 +1839,12 @@ class Turba_Driver implements Countable
             if ($version == '2.1') {
                 $params = array('WORK' => null);
                 if (Horde_Mime::is8bit($val)) {
-                    $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+                    $params['CHARSET'] = 'UTF-8';
                 }
             } else {
                 $params = array('TYPE' => 'WORK');
-                $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
-                $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+                $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+                $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
             }
             $vcard->setAttribute('ADR', $val, $params, true, $a);
         }
@@ -2287,7 +2287,7 @@ class Turba_Driver implements Countable
     public function toASContact(Turba_Object $object)
     {
         $message = new Horde_ActiveSync_Message_Contact(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger')));
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $hash = $object->getAttributes();
         foreach ($hash as $field => $value) {
             switch ($field) {
@@ -2446,7 +2446,7 @@ class Turba_Driver implements Countable
     public function fromASContact($message)
     {
         $hash = array();
-        $charset = $GLOBALS['registry']->getCharset();
+        $charset = 'UTF-8';
         $formattedname = false;
 
         $textMap = array(
index bd9918b..247e3c9 100644 (file)
@@ -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, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr);
+                $res = @ldap_read($this->_ds, Horde_String::convertCharset($d, 'UTF-8', $this->_params['charset']), $filter, $attr);
                 if ($res) {
                     $results = array_merge($results, $this->_getResults($fields, $res));
                 } else {
@@ -244,7 +244,7 @@ class Turba_Driver_Ldap extends Turba_Driver
             return $results;
         }
 
-        $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr);
+        $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, 'UTF-8', $this->_params['charset']), $filter, $attr);
         if (!$res) {
             throw new Turba_Exception(sprintf(_("Read failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
         }
@@ -298,8 +298,8 @@ class Turba_Driver_Ldap extends Turba_Driver
 
         $this->_encodeAttributes($attributes);
 
-        if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) {
-            throw new Turba_Exception('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . $GLOBALS['registry']->getCharset());
+        if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, 'UTF-8', $this->_params['charset']), $attributes)) {
+            throw new Turba_Exception('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . 'UTF-8');
         }
     }
 
@@ -326,7 +326,7 @@ class Turba_Driver_Ldap extends Turba_Driver
             throw new Turba_Exception(_("Invalid key specified."));
         }
 
-        if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']))) {
+        if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']))) {
             throw new Turba_Exception(sprintf(_("Delete failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
         }
     }
@@ -346,7 +346,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, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, array_merge(array_keys($attributes), array('objectclass')));
+        $oldres = @ldap_read($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $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 &&
@@ -358,8 +358,8 @@ class Turba_Driver_Ldap extends Turba_Driver
                 throw new Turba_Exception(_("Missing DN in LDAP source configuration."));
             }
 
-            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)) {
+            if (ldap_rename($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']),
+                            Horde_String::convertCharset($newrdn, 'UTF-8', $this->_params['charset']), $this->_params['root'], true)) {
                 $object_id = $newrdn . ',' . $this->_params['root'];
             } else {
                 throw new Turba_Exception(sprintf(_("Failed to change name: (%s) %s; Old DN = %s, New DN = %s, Root = %s"), ldap_errno($this->_ds), ldap_error($this->_ds), $object_id, $newrdn, $this->_params['root']));
@@ -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, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $oldval)) {
+                if (!@ldap_mod_del($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']), $oldval)) {
                     throw new Turba_Exception(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, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) {
+        if (!@ldap_modify($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']), $attributes)) {
             throw new Turba_Exception(sprintf(_("Modify failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
         }
 
@@ -462,7 +462,7 @@ class Turba_Driver_Ldap extends Turba_Driver
                 $clause .= '(&' . $this->_buildSearchQuery($vals) . ')';
             } else {
                 if (isset($vals['field'])) {
-                    $rhs = Horde_String::convertCharset($vals['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+                    $rhs = Horde_String::convertCharset($vals['test'], 'UTF-8', $this->_params['charset']);
                     $clause .= Horde_Ldap::buildClause($vals['field'], $vals['op'], $rhs, array('begin' => !empty($vals['begin'])));
                 } else {
                     foreach ($vals as $test) {
@@ -471,7 +471,7 @@ class Turba_Driver_Ldap extends Turba_Driver
                         } elseif (!empty($test['AND'])) {
                             $clause .= '(&' . $this->_buildSearchQuery($test) . ')';
                         } else {
-                            $rhs = Horde_String::convertCharset($test['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+                            $rhs = Horde_String::convertCharset($test['test'], 'UTF-8', $this->_params['charset']);
                             $clause .= Horde_Ldap::buildClause($test['field'], $test['op'], $rhs, array('begin' => !empty($vals['begin'])));
                         }
                     }
@@ -591,7 +591,7 @@ class Turba_Driver_Ldap extends Turba_Driver
             }
 
             if (!is_array($val)) {
-                $attributes[$key] = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+                $attributes[$key] = Horde_String::convertCharset($val, 'UTF-8', $this->_params['charset']);
             }
         }
     }
index 6784f1b..3f63b18 100644 (file)
@@ -659,7 +659,7 @@ class Turba_Driver_Sql extends Turba_Driver
      */
     protected function _convertToDriver($value)
     {
-        return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+        return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
     }
 
     /**
index cb9463c..7994780 100644 (file)
@@ -248,7 +248,7 @@ class Turba_Object {
                         . ' '
                         . date($GLOBALS['prefs']->getValue('twentyFour') ? 'G:i' : 'g:i a', $entry['ts'])
                         . ' '
-                        . @htmlspecialchars($by, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+                        . @htmlspecialchars($by, ENT_COMPAT, 'UTF-8');
                 }
             }
         } catch (Exception $e) {
index 773bc6f..8acdba6 100644 (file)
@@ -153,7 +153,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, $GLOBALS['registry']->getCharset());
+                        $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$targetSource]['title']), ENT_COMPAT, 'UTF-8');
                     }
                     $notification->push($message, 'horde.error', array('content.raw'));
                     break;
@@ -305,7 +305,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, $GLOBALS['registry']->getCharset());
+                            $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, 'UTF-8');
                         }
                         $notification->push($message, 'horde.error', array('content.raw'));
                         break;
index 269649b..566030a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 global $language;
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index 9b00073..489d770 100644 (file)
@@ -40,4 +40,4 @@ if (!$filename) {
     $filename = _("contact");
 }
 
-$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), $GLOBALS['registry']->getCharset());
+$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), 'UTF-8');
index af209be..1f6b144 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index f144e6b..5b33207 100644 (file)
@@ -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), $GLOBALS['registry']->getCharset());
+            $mail->addHeader('From', Whups::formatUser($from), 'UTF-8');
         }
 
         $subject = (is_null($ticket_id)
                     ? ''
                     : '[' . $registry->get('name') . ' #' . $ticket_id . '] ')
             . $subject;
-        $mail->addHeader('Subject', $subject, $GLOBALS['registry']->getCharset());
+        $mail->addHeader('Subject', $subject, 'UTF-8');
 
         /* 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, $GLOBALS['registry']->getCharset());
+            $mail->setBody($body, 'UTF-8');
 
             $mail->addHeader('Message-ID', Horde_Mime::generateMessageId());
             if ($ticket_id) {
@@ -488,7 +488,7 @@ class Whups_Driver {
             }
 
             $mail->clearRecipients();
-            $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset());
+            $mail->addHeader('To', $to, 'UTF-8');
 
             try {
                 $mail->send($GLOBALS['injector']->getInstance('Horde_Mail'), true);
index d40ef42..ed4b586 100644 (file)
@@ -83,9 +83,9 @@ class Whups_Driver_sql extends Whups_Driver {
             . 'VALUES (?, ?, ?, ?, ?)';
         $values = array(
             $new_id,
-            Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+            Horde_String::convertCharset($name, 'UTF-8',
                                    $this->_params['charset']),
-            Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+            Horde_String::convertCharset($description, 'UTF-8',
                                    $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, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                $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, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($category, 'UTF-8',
                                                $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, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                $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, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($name, 'UTF-8',
                                                      $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                      $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, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($text, 'UTF-8',
                                                $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, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($summary, 'UTF-8',
                                                $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, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+                                          Horde_String::convertCharset($comment, 'UTF-8', $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, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+            $values[] = Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
         }
 
         /* Don't try to execute an empty query (if we didn't find any updates
@@ -1384,10 +1384,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,
-                                                   $GLOBALS['registry']->getCharset(),
+                                                   'UTF-8',
                                                    $this->_params['charset']),
                             Horde_String::convertCharset($description,
-                                                   $GLOBALS['registry']->getCharset(),
+                                                   'UTF-8',
                                                    $this->_params['charset']),
                             (empty($versioned) ? 0 : 1),
                             $slug,
@@ -1674,9 +1674,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, $GLOBALS['registry']->getCharset(),
+        $values = array(Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                $this->_params['charset']),
                         $typeId);
         Horde::logMessage(
@@ -1822,11 +1822,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, $GLOBALS['registry']->getCharset(),
+        $values = array(Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($category, 'UTF-8',
                                                $this->_params['charset']),
                         $stateId);
         Horde::logMessage(
@@ -1929,7 +1929,7 @@ class Whups_Driver_sql extends Whups_Driver {
             $values = array($query->id, serialize($query->parameters),
                             serialize($query->query));
         }
-        $values = Horde_String::convertCharset($values, $GLOBALS['registry']->getCharset(),
+        $values = Horde_String::convertCharset($values, 'UTF-8',
                                          $this->_params['charset']);
         Horde::logMessage(
             sprintf('Whups_Driver_sql::saveQuery(): query="%s"; values="%s"',
@@ -2047,9 +2047,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, $GLOBALS['registry']->getCharset(),
+        $values = array(Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                $this->_params['charset']),
                         $priorityId);
         Horde::logMessage(
@@ -2151,9 +2151,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, $GLOBALS['registry']->getCharset(),
+        $values = array(Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($description, 'UTF-8',
                                                $this->_params['charset']),
                         (int)$active,
                         (int)$versionId);
@@ -2233,9 +2233,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, $GLOBALS['registry']->getCharset(),
+        $values = array(Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($text, 'UTF-8',
                                                $this->_params['charset']),
                         $reply);
         Horde::logMessage(
@@ -2376,13 +2376,13 @@ class Whups_Driver_sql extends Whups_Driver {
             . ' VALUES (?, ?, ?, ?, ?, ?, ?)';
         $values = array($new_id,
                         $type_id,
-                        Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($name, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($desc, 'UTF-8',
                                                $this->_params['charset']),
                         $type,
                         serialize(
-                            Horde_String::convertCharset($params, $GLOBALS['registry']->getCharset(),
+                            Horde_String::convertCharset($params, 'UTF-8',
                                                    $this->_params['charset'])),
                         (int)($required == 'on'));
 
@@ -2405,14 +2405,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, $GLOBALS['registry']->getCharset(),
+        $values = array(Horde_String::convertCharset($newname, 'UTF-8',
                                                $this->_params['charset']),
-                        Horde_String::convertCharset($newdesc, $GLOBALS['registry']->getCharset(),
+                        Horde_String::convertCharset($newdesc, 'UTF-8',
                                                $this->_params['charset']),
                         $newtype,
                         serialize(
                             Horde_String::convertCharset($newparams,
-                                                   $GLOBALS['registry']->getCharset(),
+                                                   'UTF-8',
                                                    $this->_params['charset'])),
                         (int)($newrequired == 'on'),
                         $attribute_id);
@@ -2607,7 +2607,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,
-                                                     $GLOBALS['registry']->getCharset(),
+                                                     'UTF-8',
                                                      $this->_params['charset']);
 
         $this->_write_db->autoCommit(false);
@@ -2808,7 +2808,7 @@ class Whups_Driver_sql extends Whups_Driver {
                 time(),
                 (string)$user,
                 $type,
-                Horde_String::convertCharset((string)$value, $GLOBALS['registry']->getCharset(),
+                Horde_String::convertCharset((string)$value, 'UTF-8',
                                        $this->_params['charset']),
                 (int)$value);
             Horde::logMessage(
index 16e849c..5c05026 100644 (file)
@@ -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 = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
 
 header('Content-Type: text/xml; charset=' . $charset);
 echo <<<PAYLOAD
index 47282d9..0c13675 100644 (file)
@@ -55,7 +55,7 @@ foreach (array_keys($tickets) as $i) {
 }
 
 $template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
 $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")));
index 2fd4307..22e1f5d 100644 (file)
@@ -86,7 +86,7 @@ foreach (array_keys($tickets) as $i) {
 }
 
 $template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
 $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
 $template->set('pubDate', htmlspecialchars(date('r')));
 if (isset($type) && isset($queue['name'])) {
index 38dd462..9575160 100644 (file)
@@ -47,7 +47,7 @@ foreach (array_keys($tickets) as $i) {
 }
 
 $template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
 $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
 $template->set('pubDate', htmlspecialchars(date('r')));
 $template->set('title', _("Search Results"));
index 2fa8b20..12b58f8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index a07a11b..c329306 100644 (file)
@@ -42,7 +42,7 @@ foreach (array_keys($history) as $i) {
 }
 
 $template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
 $template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
 $template->set('pubDate', htmlspecialchars(date('r')));
 $template->set('title', htmlspecialchars($details['summary']));
index b1bf5a4..67687f9 100644 (file)
@@ -462,7 +462,7 @@ class Wicked_Driver {
      */
     function getCharset()
     {
-        return $GLOBALS['registry']->getCharset();
+        return 'UTF-8';
     }
 
     /**
index 84e1881..b4c2268 100644 (file)
@@ -850,7 +850,7 @@ class Wicked_Driver_sql extends Wicked_Driver {
      */
     function _convertToDriver($value)
     {
-        return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->getCharset());
+        return Horde_String::convertCharset($value, 'UTF-8', $this->getCharset());
     }
 
     /**
index 4a15e74..b1dbd4c 100644 (file)
@@ -458,7 +458,7 @@ class Wicked_Page {
                 $this->_proc->deleteRule('Embed');
             }
 
-            $this->_proc->setFormatConf('Xhtml', 'charset', $GLOBALS['registry']->getCharset());
+            $this->_proc->setFormatConf('Xhtml', 'charset', 'UTF-8');
             $this->_proc->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS);
             $create = $this->allows(Wicked::MODE_CREATE) ? 1 : 0;
             $linkConf = array(
index 0d9e508..e47f8a0 100644 (file)
@@ -107,8 +107,8 @@ class MergeOrRename extends Wicked_Page {
         }
 
         foreach ($references as $key => $page) {
-            $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());
+            $references[$key]['page_url'] = @htmlspecialchars(Wicked::url($page['page_name']), ENT_QUOTES, 'UTF-8');
+            $references[$key]['page_name'] = @htmlspecialchars($page['page_name'], ENT_QUOTES, 'UTF-8');
 
             // Since the page name can have [ and ] and other special
             // characters in it, and we don't want the browser or PHP decoding
index f4aeeca..0b31989 100644 (file)
@@ -20,7 +20,7 @@ class Text_Wiki_Render_Xhtml_Code2 extends Text_Wiki_Render_Xhtml_Code
         $part->setContents($options['text']);
         $part->setType("x-extension/$type");
 
-        $viewer = new Horde_Core_Mime_Viewer_Syntaxhighlighter($part, array('registry' => $GLOBALS['registry'], 'charset' => $GLOBALS['registry']->getCharset()));
+        $viewer = new Horde_Core_Mime_Viewer_Syntaxhighlighter($part, array('registry' => $GLOBALS['registry'], 'charset' => 'UTF-8'));
         $data = $viewer->render('inline');
         $data = reset($data);
         return $data['data'];
index 0140fdb..f4e5efb 100644 (file)
@@ -179,7 +179,7 @@ class Wicked
                                           $conf['wicked']['notify_address'],
                                           'from' => $from . '<' . $from_addr
                                           . '>',
-                                          'charset' => $GLOBALS['registry']->getCharset()));
+                                          'charset' => 'UTF-8'));
         $mail->addHeader('User-Agent', 'Wicked ' . $GLOBALS['registry']->getVersion());
         $mail->addHeader('Precedence', 'bulk');
         $mail->addHeader('Auto-Submitted', 'auto-replied');
index 9a6b5f6..80dd36e 100644 (file)
@@ -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 = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
 
 header('Content-Type: text/xml; charset=' . $charset);
 echo <<<PAYLOAD
index 9038763..314679e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if (isset($language)) {
-    header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+    header('Content-type: text/html; charset=' . 'UTF-8');
     header('Vary: Accept-Language');
 }
 ?>
index d36c172..1abee72 100644 (file)
@@ -26,7 +26,7 @@ function preview()
 </div>
 
 <div style="padding:8px">
- <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
+ <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, 'UTF-8') ?></textarea>
 </div>
 
 </form>
index 2b69b83..621cb08 100644 (file)
@@ -45,7 +45,7 @@ if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getA
 <?php endif; endif; ?>
 
 <div style="padding:8px">
- <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
+ <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, 'UTF-8') ?></textarea>
 </div>
 
 </form>
index 8d7efe9..9565005 100644 (file)
@@ -40,5 +40,5 @@ if ($show_restore) {
  <td style="text-align:center"><input type="submit" class="button" value="<?php echo htmlspecialchars($page->version()) ?>" onclick="if (document.diff.v1[<?php echo $i ?>].checked) return false; document.diff.v2.value = '<?php echo htmlspecialchars($pversion) ?>';" /></td>
 <?php endif; ?>
 
- <td><?php echo @htmlspecialchars($page->changeLog(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+ <td><?php echo @htmlspecialchars($page->changeLog(), ENT_COMPAT, 'UTF-8') ?></td>
 </tr>