$body = new Horde_Mime_Part();
$body->setType('text/plain');
- $body->setCharset(Horde_Nls::getCharset());
+ $body->setCharset($GLOBALS['registry']->getCharset());
$body->setContents($message['body']);
$body->send($forum['forum_distribution_address'], $msg_headers, $conf['mailer']['type'], $conf['mailer']['params']);
strftime($GLOBALS['prefs']->getValue('date_format'), $message['message_timestamp']))
. "\n-------------------------------------------------------\n"
. $message['body'];
- $message['body'] = "\n> " . Horde_String::wrap($message['body'], 60, "\n> ", Horde_Nls::getCharset());
+ $message['body'] = "\n> " . Horde_String::wrap($message['body'], 60, "\n> ", $GLOBALS['registry']->getCharset());
return $message;
}
foreach ($messages as $id => &$message) {
$message['message_id'] = $id;
$message['message_author'] = htmlspecialchars($message['message_author']);
- $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, Horde_Nls::getCharset());
+ $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
$message['message_date'] = $this->dateFormat($message['message_timestamp']);
if ($format) {
$message['body'] = $this->formatBody($this->convertFromDriver($message['body']));
$message['forum_name'] = $this->convertFromDriver($forums_list[$message['forum_id']]);
$message['message_id'] = $id;
$message['message_author'] = htmlspecialchars($message['message_author']);
- $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, Horde_Nls::getCharset());
+ $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
$message['message_body'] = Horde_Text_Filter::filter($this->convertFromDriver($message['body']), 'highlightquotes');
if ($message['attachments']) {
$message['message_attachment'] = $this->getAttachmentLink($id);
}
if (!empty($filter['author'])) {
- $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], Horde_Nls::getCharset()));
+ $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], $GLOBALS['registry']->getCharset()));
}
/* Sort by result column. */
*/
public function convertToDriver($value)
{
- return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
/**
{
/* Set default data. */
parent::__construct(array('templatePath' => AGORA_TEMPLATES . '/',
- 'encoding' => Horde_Nls::getCharset()));
+ 'encoding' => $GLOBALS['registry']->getCharset()));
}
}
'body' => $url . "\n\n" . $registry->getAuth() . "\n\n" . $_SERVER["REMOTE_ADDR"],
'to' => $emails,
'from' => $emails[0],
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
$mail->addHeader('User-Agent', 'Agora ' . $registry->getVersion());
$mail->send($injector->getInstance('Horde_Mail'));
$rss = $cache->get($cache_key, $conf['cache']['default_lifetime']);
if (!$rss) {
-
$title = sprintf(_("Forums in %s"), $registry->get('name', $scope));
$forums = Agora_Messages::singleton($scope);
$forums_list = $forums->getForums(0, true, 'forum_name', 0);
- $rss = '<?xml version="1.0" encoding="' . Horde_Nls::getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($title) . '</title>
- <language>' . str_replace('_', '-', strtolower(Horde_Nls::select())) . '</language>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
<lastBuildDate>' . date('r') . '</lastBuildDate>
<description>' . htmlspecialchars($title) . '</description>
<link>' . Horde::applicationUrl('index.php', true, -1) . '</link>
$cache->set($cache_key, $rss);
}
-header('Content-type: text/xml; charset=' . Horde_Nls::getCharset());
+header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
echo $rss;
exit;
}
- $rss = '<?xml version="1.0" encoding="' . Horde_Nls::getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($message['message_subject']) . '</title>
- <language>' . str_replace('_', '-', strtolower(Horde_Nls::select())) . '</language>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
<lastBuildDate>' . date('r') . '</lastBuildDate>
<description>' . htmlspecialchars($message['message_subject']) . '</description>
<link>' . Horde::applicationUrl('index.php', true, -1) . '</link>
$cache->set($cache_key, $rss);
}
-header('Content-type: text/xml; charset=' . Horde_Nls::getCharset());
+header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
echo $rss;
$threads_list = $threads->getThreads(0, false, 'message_modifystamp', 1, true, '', null, 0, 10);
- $rss = '<?xml version="1.0" encoding="' . Horde_Nls::getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($title) . '</title>
- <language>' . str_replace('_', '-', strtolower(Horde_Nls::select())) . '</language>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
<lastBuildDate>' . date('r') . '</lastBuildDate>
<description>' . htmlspecialchars($title) . '</description>
<link>' . Horde::applicationUrl('index.php', true, -1) . '</link>
$cache->set($cache_key, $rss);
}
-header('Content-type: text/xml; charset=' . Horde_Nls::getCharset());
+header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
echo $rss;
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
require ANSEL_TEMPLATES . '/common-header.inc';
require ANSEL_TEMPLATES . '/menu.inc';
?>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
<div class="instructions">
<form action="sort.php" method="post">
<?php echo Horde_Util::formInput() ?>
<?php
$images = $gallery->getImages();
foreach ($images as $image) {
- $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()) : htmlspecialchars($image->caption, ENT_COMPAT, Horde_Nls::getCharset());
+ $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) : htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset());
echo '<div id="o_' . (int)$image->id . '"><a title="'
. $caption . '" href="#">'
. '<img src="' . Ansel::getImageUrl($image->id, 'thumb', false, $style['name']) . '" alt="' . htmlspecialchars($image->filename) . '" />'
break;
}
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
/* Create the text part. */
$textpart = new Horde_Mime_Part();
$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, Horde_Nls::getCharset()) . '</pre>';
+ $comments = '<pre>' . htmlspecialchars($comments, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</pre>';
}
$htmlpart->setContents('<html>' . $img_tag . $comments . '</html>');
$related->setContentTypeParameter('start', $htmlpart->setContentID());
// Check for an active image
if (!empty($image_id)) {
- $text = '<span class="thiscrumb" id="PhotoName">' . htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()) . '</span>';
+ $text = '<span class="thiscrumb" id="PhotoName">' . htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</span>';
$nav = $separator . $text . $nav;
$levels++;
}
}
if (!empty($owner_title)) {
- $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, Horde_Nls::getCharset());
+ $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, $GLOBALS['registry']->getCharset());
$levels++;
if ($gallery) {
$nav = $separator . Ansel::getUrlFor('view', array('view' => 'List', 'groupby' => 'owner', 'owner' => $owner, 'havesearch' => $haveSearch))->link() . $owner_title . '</a>' . $nav;
'slug' => $gallery->get('slug')),
true);
return $viewurl->link()
- . @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset())
+ . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset())
. '</a>';
}
$html .= '<tr><td>'
. $url->link(array('onmouseout' => '$("ansel_preview").hide();$("ansel_preview").update("");',
'onmouseover' => 'previewImageMg(event, ' . $gallery->getDefaultImage('ansel_default') . ');'))
- . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset()) . '</a></td><td>'
+ . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a></td><td>'
. strftime($GLOBALS['prefs']->getValue('date_format'), $gallery->get('last_modified'))
. '</td><td>' . (int)$gallery->countImages(true) . '</td></tr>';
}
}
// Build the gallery name.
if (isset($this->_params['gallery'])) {
- $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset());
+ $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$style = $gallery->getStyle();
$viewurl = Ansel::getUrlFor('view',
$results = $faces->allFaces(0, $this->_params['limit']);
$html = '';
foreach ($results as $face_id => $face) {
- $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, Horde_Nls::getCharset());
+ $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
$html .= '<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="' . $facenane . '" /></a>';
// Build the gallery name.
if (isset($this->_params['gallery'])) {
$name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT,
- Horde_Nls::getCharset());
+ $GLOBALS['registry']->getCharset());
}
$style = $gallery->getStyle();
true);
$galleryLink = $galleryLink->link()
. @htmlspecialchars($gallery->get('name'), ENT_COMPAT,
- Horde_Nls::getCharset())
+ $GLOBALS['registry']->getCharset())
. '</a>';
$caption = substr($image->caption, 0, 30);
'onmouseover' => 'previewImage(event, ' . $image->id . ');'))
. @htmlspecialchars(
strlen($caption) ? $caption : $image->filename,
- ENT_COMPAT, Horde_Nls::getCharset())
+ ENT_COMPAT, $GLOBALS['registry']->getCharset())
. '</a></td><td class="nowrap">' . $galleryLink . '</td></tr>';
}
// Build the gallery name.
if (isset($this->_params['gallery'])) {
- $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset());
+ $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$style = $gallery->getStyle();
$trail[] = array('title' => _("All dates"), 'navdata' => $navdata);
}
- $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset());
+ $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
$navdata = array('view' => 'Gallery',
'gallery' => $this->_gallery->id,
'slug' => $this->_gallery->get('slug'));
$output[$field] = $value;
} else {
$description = isset($data['description']) ? $data['description'] : $field;
- $output[] = '<td><strong>' . $description . '</strong></td><td>' . htmlspecialchars($value, ENT_COMPAT, Horde_Nls::getCharset()) . '</td>';
+ $output[] = '<td><strong>' . $description . '</strong></td><td>' . htmlspecialchars($value, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</td>';
}
}
Horde::logMessage($update, 'ERR');
throw new Ansel_Exception($update);
}
- $result = $update->execute(array(Horde_String::convertCharset($image->filename, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
+ $result = $update->execute(array(Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
$image->type,
- Horde_String::convertCharset($image->caption, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
$image->sort,
$image->originalDate,
$image->lat,
/* Perform the INSERT */
$result = $insert->execute(array($image_id,
$image->gallery,
- Horde_String::convertCharset($image->filename, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
$image->type,
- Horde_String::convertCharset($image->caption, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
$image->uploaded,
$image->sort,
$image->originalDate,
public function saveImageAttribute($image_id, $attribute, $value)
{
$insert = $this->_db->prepare('INSERT INTO ansel_image_attributes (image_id, attr_name, attr_value) VALUES (?, ?, ?)');
- $result = $insert->execute(array($image_id, $attribute, Horde_String::convertCharset($value, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset'])));
+ $result = $insert->execute(array($image_id, $attribute, Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset'])));
if ($result instanceof PEAR_Error) {
throw new Ansel_Exception($result);
}
if ($galleries[$gallery_id]['perm']) {
$data = array((string)Ansel::getImageUrl($image->id, $image_view, $full, $style),
- htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()),
+ htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()),
Horde_Text_Filter::filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)),
$image->id,
0);
}
if (count($json)) {
- return Horde_Serialize::serialize($json, Horde_Serialize::JSON, Horde_Nls::getCharset());
+ return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
} else {
return '';
}
}
$tag = Horde_String::lower(trim($tag));
$sql = $GLOBALS['ansel_db']->prepare('SELECT tag_id FROM ansel_tags WHERE tag_name = ?');
- $result = $sql->execute(Horde_String::convertCharset($tag, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']));
+ $result = $sql->execute(Horde_String::convertCharset($tag, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']));
$results = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
$result->free();
if (empty($results)) {
$id = $GLOBALS['ansel_db']->nextId('ansel_tags');
- $result = $insert->execute(array($id, Horde_String::convertCharset($tag, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset'])));
+ $result = $insert->execute(array($id, Horde_String::convertCharset($tag, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset'])));
$tagkeys[] = $id;
} elseif ($results instanceof PEAR_Error) {
Horde::logMessage($results->getMessage(), 'ERR');
/* Variables used in the template file */
$image_link = $view_link . $gallery_image . '</a>';
- $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, Horde_Nls::getCharset()) . '</a>';
+ $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
$gallery_count = $dgallery->countImages(true);
/* Background color is needed if displaying a mini tile */
}
$image_link = $view_link . $gallery_image . '</a>';
- $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, Horde_Nls::getCharset())
+ $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset())
. '</a>';
if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT) && !$mini) {
if (empty($owner_string)) {
$owner_string = $gallery->get('owner');
}
- $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, Horde_Nls::getCharset()) . '</a>';
+ $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
}
$gallery_count = $gallery->countImages(true);
}
$data = array((string)Ansel::getImageUrl($image->id, $params['image_view'], $params['full'], $style['name']),
- htmlspecialchars($image->filename, ENT_COMPAT, Horde_Nls::getCharset()),
+ htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()),
Horde_Text_Filter::filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)),
$image->id,
$curpage);
$json[] = $data;
}
- return Horde_Serialize::serialize($json, Horde_Serialize::JSON, Horde_Nls::getCharset());
+ return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
}
/**
$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, Horde_Nls::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, $GLOBALS['registry']->getCharset())) . '</a>';
/* Embed html */
if (empty($this->_view->_params['image_id'])) {
}
}
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$xsl = $registry->get('themesuri') . '/feed-rss.xsl';
- $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, Horde_Nls::getCharset());
- $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, Horde_Nls::getCharset());
+ $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
$stream_updated = htmlspecialchars(date('r', $params['last_modified']));
$stream_official = htmlspecialchars($params['link']);
$image_url = htmlspecialchars($params['image_url']);
$cli->fatal(_("You must specify a valid directory."));
}
-Horde_Nls::setCharset('utf-8');
+$registry->setCharset('utf-8');
$gallery_id = processDirectory($dir);
if (!$keepEmpties) {
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($gallery_id);
<input type="hidden" name="day" value="<?php echo (empty($date['day']) ? 0 : $date['day']) ?>" />
<h1 class="header">
- <?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?>
+ <?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
</h1>
<?php if ($gallery->get('desc')): ?>
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, Horde_Nls::getCharset()) . '</textarea></td>';
+ htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</textarea></td>';
$count++;
if (($count % 2) == 0) {
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
Horde::includeScriptFiles();
?>
-<title><?php echo htmlspecialchars($page_title, ENT_COMPAT, Horde_Nls::getCharset()) ?></title>
+<title><?php echo htmlspecialchars($page_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></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());?>
<?php echo $pager->render() ?>
<script type="text/javascript">
//<![CDATA[
-var imgids = <?php echo Horde_Serialize::serialize($imageids, Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>;
+var imgids = <?php echo Horde_Serialize::serialize($imageids, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>;
function proccessImageFaces(image_id, reget) {
var url = '<?php echo Horde::applicationUrl('faces/image.php'); ?>';
<input type="hidden" name="url" value="<?php echo htmlspecialchars(Horde_Util::getFormData('url')) ?>" />
<h1 class="header">
- <?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?>
+ <?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
</h1>
<table cellspacing="0" width="100%" class="striped headerbox">
}
</script>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
<div class="control anselActions" style="text-align: center">
<?php
$style = $gallery->getStyle();
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
<div class="control anselActions" style="text-align: center">
<div id="prevDiv"></div>
<?php
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
<?php
$base_url = Horde::applicationUrl('image.php');
$base_url = $base_url->copy()->add(array_merge(
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
<?php
$base_url = Horde::applicationUrl('image.php')->add(
array_merge(
document.slider.setValue(<?php echo $geometry['height'] ?>);
}
</script>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, Horde_Nls::getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
<div class="control anselActions" style="text-align: center">
<?php
<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, Horde_Nls::getCharset()) . ' ' . Horde::link(Horde::applicationUrl($refresh_link), _("Refresh List")) . Horde::img('reload.png', _("Refresh List")) . '</a>' ?>
+ <?php echo @htmlspecialchars($list_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ' ' . Horde::link(Horde::applicationUrl($refresh_link), _("Refresh List")) . Horde::img('reload.png', _("Refresh List")) . '</a>' ?>
</div>
<table width="100%" style="background:<?php echo $styleDef['background'] ?>;"><tr>
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, Horde_Nls::getCharset()) . $this->_search->getTagTrail();
+echo htmlspecialchars($this->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . $this->_search->getTagTrail();
?>
</div>
<?php echo _("New Gallery Description") ?>
</td>
<td align="left">
- <textarea name="gallery_desc" cols="33" rows="5"><?php echo htmlspecialchars($gallery_desc, ENT_COMPAT, Horde_Nls::getCharset()) ?></textarea>
+ <textarea name="gallery_desc" cols="33" rows="5"><?php echo htmlspecialchars($gallery_desc, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
</td>
</tr>
</table>
if (preg_match('/charset=(.*)/i', $headers, $m)) {
return $m[1];
}
- return Horde_Nls::getCharset();
+ return $GLOBALS['registry']->getCharset();
}
function convert_string($msg) {
$f = array('/</', '/>/');
$t = array('<', '>');
$msg = preg_replace($f, $t, $msg);
- return Horde_String::convertCharset(html_entity_decode($msg), Horde_Nls::getCharset(), Translate_Display::parseCharset($po->meta['Content-Type']));
+ return Horde_String::convertCharset(html_entity_decode($msg), $GLOBALS['registry']->getCharset(), Translate_Display::parseCharset($po->meta['Content-Type']));
}
function display_string($msg) {
$f = array('/</', '/>/');
$t = array('<', '>');
$msg = preg_replace($f, $t, $msg);
- return Horde_String::convertCharset($msg, Translate_Display::parseCharset($po->meta['Content-Type']), Horde_Nls::getCharset());
+ return Horde_String::convertCharset($msg, Translate_Display::parseCharset($po->meta['Content-Type']), $GLOBALS['registry']->getCharset());
}
function get_percent($used, $total) {
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
Chora::fatal($e);
}
-$title = sprintf(_("Source Annotation of %s (revision %s)"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)), $rev);
+$title = sprintf(_("Source Annotation of %s (revision %s)"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)), $rev);
$extraLink = sprintf('<a href="%s">%s</a> | <a href="%s">%s</a>',
Chora::url('co', $where, array('r' => $rev)), _("View"),
Chora::url('co', $where, array('r' => $rev, 'p' => 1)), _("Download"));
}
$prev = $fl->queryPreviousRevision($rev);
- $line = Horde_Text_Filter::filter($line['line'], 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true));
+ $line = Horde_Text_Filter::filter($line['line'], 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true));
include CHORA_TEMPLATES . '/annotate/line.inc';
}
continue;
}
$url = Chora::url('browsedir', $where . '/' . $currentDir . '/', array('onb' => $onb));
- $currDir = Horde_Text_Filter::filter($currentDir, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true));
+ $currDir = Horde_Text_Filter::filter($currentDir, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true));
require CHORA_TEMPLATES . '/directory/dir.inc';
}
echo '</tbody>';
$log = $lg->queryLog();
$attic = $currFile->isDeleted();
$fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname;
- $name = Horde_Text_Filter::filter($realname, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true));
+ $name = Horde_Text_Filter::filter($realname, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true));
$url = Chora::url('browsefile', $fileName, array('onb' => $onb));
$readableDate = Chora::readableTime($date);
if ($log) {
passthru($conf['paths']['cvsgraph'] . ' ' . $argstr . ' ' . $file);
} else {
// Display the wrapper page for the image.
- $title = sprintf(_("Graph for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)));
+ $title = sprintf(_("Graph for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)));
$extraLink = Chora::getFileViews($where, 'cvsgraph');
require CHORA_TEMPLATES . '/common-header.inc';
$abbrev_r1 = $VC->abbrev($r1);
$abbrev_r2 = $VC->abbrev($r2);
$title = sprintf(_("Diff for %s between version %s and %s"),
- Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)), $abbrev_r1, $abbrev_r2);
+ Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)), $abbrev_r1, $abbrev_r2);
/* Format log entries. */
$log_messages = array();
$maxCol = max($val, $maxCol);
}
-$title = sprintf(_("Source Branching View for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)));
+$title = sprintf(_("Source Branching View for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)));
$extraLink = Chora::getFileViews($where, 'history');
require CHORA_TEMPLATES . '/common-header.inc';
if (!empty($onb)) {
$url = Horde_Util::addParameter($url, array('onb' => $onb));
}
- $bar .= '/ <a href="' . $url . '">'. Horde_Text_Filter::filter($dir, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)) . '</a> ';
+ $bar .= '/ <a href="' . $url . '">'. Horde_Text_Filter::filter($dir, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)) . '</a> ';
}
}
*/
static public function formatLogMessage($log)
{
- $log = Horde_Text_Filter::filter($log, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => Horde_Nls::getCharset(), 'class' => ''));
+ $log = Horde_Text_Filter::filter($log, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => ''));
return (empty($GLOBALS['conf']['tickets']['regexp']) || empty($GLOBALS['conf']['tickets']['replacement']))
? $log
}
arsort($stats);
-$title = sprintf(_("Statistics for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)));
+$title = sprintf(_("Statistics for %s"), Horde_Text_Filter::filter($where, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)));
Horde::addScriptFile('tables.js', 'horde');
require CHORA_TEMPLATES . '/common-header.inc';
require CHORA_TEMPLATES . '/menu.inc';
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html><head>';
Horde::outputMetaTags();
if (Horde_Util::nonInputVar('js_vars')) {
- Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, Horde_Nls::getCharset()));
+ Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()));
}
Horde::includeScriptFiles();
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
}
}
-echo Horde_Serialize::serialize($block_data, Horde_Serialize::JSON, Horde_Nls::getCharset());
+echo Horde_Serialize::serialize($block_data, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
}
}
- $content = Horde_Serialize::serialize($content, Horde_Serialize::JSON, Horde_Nls::getCharset());
- $title = Horde_Serialize::serialize($title, Horde_Serialize::JSON, Horde_Nls::getCharset());
- $params = Horde_Serialize::serialize($params, Horde_Serialize::JSON, Horde_Nls::getCharset());
+ $content = Horde_Serialize::serialize($content, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
+ $title = Horde_Serialize::serialize($title, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
+ $params = Horde_Serialize::serialize($params, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
$js_init .= 'portal.add(new Xilinus.Widget().'
. 'setTitle(title_' . $js_id .').'
break;
case 'eo':
case 'desc':
- $row[$key] = Horde_String::convertCharset($value, Horde_Nls::getCharset(), $params['charset']);
+ $row[$key] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $params['charset']);
break;
default:
break;
$charsets[$charset] = $charset;
}
}
- $my_charset = Horde_Nls::getCharset(true);
+ $my_charset = $GLOBALS['registry']->getCharset(true);
}
foreach ($templates[$next_step] as $template) {
$this->_ledger,
sprintf('%\'04d', $number),
$type,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)(bool)$eo,
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)(bool)$closed);
/* Log the query at a DEBUG log level. */
$this->_params['table_accounts']);
$values = array(sprintf('%\'04d', $number),
$type,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)(bool)$eo,
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)(bool)$closed,
$this->_ledger,
$accountId);
$account,
(int)(bool)$eo,
(float)$amount,
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']));
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']));
/* Log the query at a DEBUG log level. */
Horde::logMessage(sprintf('Fima_Driver_sql::_addPosting(): %s', $query), 'DEBUG');
$account,
(int)(bool)$eo,
(float)$amount,
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
$this->_ledger,
$postingId);
Horde::compressOutput();
// Set the timezone variable.
-Horde_Nls::setTimeZone();
+$registry->setTimeZone();
// Create a share instance.
$GLOBALS['fima_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
$value = hash('md5', $value);
}
$fields[] = 'user_' . Horde_String::lower($field);
- $values[] = Horde_String::convertCharset($value, Horde_Nls::getCharset(), $conf['sql']['charset']);
+ $values[] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']);
}
$values[] = $userID;
*/
static public function sendMail($to, $subject, $body, $attaches = array())
{
- $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => Horde_Nls::getCharset()));
+ $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => $GLOBALS['registry']->getCharset()));
$mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion());
$mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']);
foreach ($attaches as $file) {
if (file_exists($file)) {
- $mail->addAttachment($file, null, null, Horde_Nls::getCharset());
+ $mail->addAttachment($file, null, null, $GLOBALS['registry']->getCharset());
}
}
$mail = new Horde_Mime_Mail(array('subject' => $subject,
'body' => $body,
'from' => $this->_params['from_addr'],
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
$mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion());
$mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']);
foreach ($attachments as $file) {
if (file_exists($file)) {
- $mail->addAttachment($file, null, null, Horde_Nls::getCharset());
+ $mail->addAttachment($file, null, null, $GLOBALS['registry']->getCharset());
}
}
if (empty($to)) {
continue;
}
- $mail->addHeader('To', $to, Horde_Nls::getCharset(), true);
+ $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset(), true);
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
// Set charset to UTF-8 for most flexible conversion between email charset and
// backend charset.
-Horde_Nls::setCharsetEnvironment('UTF-8');
+$registry->setCharsetEnvironment('UTF-8');
// Read and parse the message.
$messages = array();
$body2 = sprintf($body, $row[0], $registry->get('name', 'horde'), Folks::getUrlFor('user', $row[0], true, -1));
// Send mail
- $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], Horde_Nls::getCharset());
+ $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], $GLOBALS['registry']->getCharset());
$mail->addHeader('User-Agent', 'Folks' . $registry->getVersion());
$sent = $mail->send($conf['mailer']['type'], $conf['mailer']['params']);
if ($sent instanceof PEAR_Error) {
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
-<?php echo '<?xml version="1.0" encoding="' . Horde_Nls::getCharset() . '"?>' ?>
+<?php echo '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '"?>' ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
-<?php echo '<?xml version="1.0" encoding="' . Horde_Nls::getCharset() . '"?>' ?>
+<?php echo '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '"?>' ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
}
Horde::addInlineScript(array(
- $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ')'
+ $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')'
), 'dom');
}
*/
protected function _toDriver($value)
{
- return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
}
}
try {
- $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap');
+ $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap');
$this->_imap->createMailbox($mailbox);
$this->_imap->setACL($mailbox, $this->_params['cyradm'], 'lrswipcda');
} catch (Horde_Imap_Client_Exception $e) {
($this->_params['domain_field'] != 'none')) {
list($userName, $domain) = explode('@', $userName);
$tmp = $userName . $this->_separator . $value . '@' . $domain;
-Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $domain, Horde_Nls::getCharset(), 'utf7-imap');
+Horde_String::convertCharset($userName . $this->_separator . $value . '@' . $domain, $GLOBALS['registry']->getCharset(), 'utf7-imap');
} else {
$tmp = $userName . $this->_separator . $value;
}
- $tmp = Horde_String::convertCharset($tmp, Horde_Nls::getCharset(), 'utf7-imap');
+ $tmp = Horde_String::convertCharset($tmp, $GLOBALS['registry']->getCharset(), 'utf7-imap');
$this->_imap->createMailbox($tmp);
$this->_oimap>setACL($tmp, $this->_params['cyradm'], 'lrswipcda');
}
{
$this->_backend->addUser($userId, $credentials);
- $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, Horde_Nls::getCharset(), 'utf7-imap');
+ $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap');
try {
$this->_imap->createMailbox($mailbox);
is_array($this->_params['folders'])) {
foreach ($this->_params['folders'] as $folder) {
try {
- $this->_imap->createMailbox($mailbox . Horde_String::convertCharset($this->_params['separator'] . $folder, Horde_Nls::getCharset(), 'utf7-imap'));
+ $this->_imap->createMailbox($mailbox . Horde_String::convertCharset($this->_params['separator'] . $folder, $GLOBALS['registry']->getCharset(), 'utf7-imap'));
} catch (Horde_Imap_Client_Exception $e) {}
}
}
{
$this->_backend->removeUser($userId);
- $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, Horde_Nls::getCharset(), 'utf7-imap');
+ $mailbox = Horde_String::convertCharset('user' . $this->_params['separator'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap');
/* Set ACL for mailbox deletion. */
list($admin) = explode('@', $this->_params['cyradmin']);
{
try {
$ob = $this->_getOb($this->_params['admin_user'], $this->_params['admin_password']);
- $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap');
+ $mailbox = Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap');
$ob->createMailbox($mailbox);
$ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda');
} catch (Horde_Imap_Client_Exception $e) {
try {
$ob = $this->_getOb($this->_params['admin_user'], $this->_params['admin_password']);
$ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda');
- $ob->deleteMailbox(Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap'));
+ $ob->deleteMailbox(Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, $GLOBALS['registry']->getCharset(), 'utf7-imap'));
} catch (Horde_Imap_Client_Exception $e) {
throw new Horde_Auth_Exception($e);
}
try {
$message = Horde::callHook('perms_denied', array('horde:max_blocks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", Horde::hasPermission('max_blocks')), Horde::hasPermission('max_blocks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", Horde::hasPermission('max_blocks')), Horde::hasPermission('max_blocks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
break;
*/
static public function sendHTTPResponse($data, $ct)
{
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
// Output headers and encoded response.
switch ($ct) {
* @param array $options Additional options:
* <pre>
* 'charset' - (string) The charset of $data.
- * DEFAULT: Horde_Nls::getCharset()
+ * DEFAULT: Horde_Registry::getCharset()
* 'urlencode' - (boolean) URL encode the json string
* DEFAULT: No
* </pre>
*/
static public function escapeJson($data, $options = array())
{
- $json = '/*-secure-' . Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? Horde_Nls::getCharset() : $options['charset']) . '*/';
+ $json = '/*-secure-' . Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? $GLOBALS['registry']->getCharset() : $options['charset']) . '*/';
return empty($options['urlencode'])
? $json
: '\'' . rawurlencode($json) . '\'';
}
if (!empty($title)) {
if ($escape) {
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$old_error = error_reporting(0);
$title = str_replace(
array("\r", "\n"), '',
$attributes = array())
{
if (!empty($title)) {
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$old_error = error_reporting(0);
$title = '<pre>' . preg_replace(array('/\n/', '/((?<!<br)\s{1,}(?<!\/>))/em', '/<br \/><br \/>/', '/<br \/>/'), array('', 'str_repeat(" ", strlen("$1"))', '<br /> <br />', '<br />'), nl2br(htmlspecialchars(htmlspecialchars($title, ENT_QUOTES, $charset), ENT_QUOTES, $charset))) . '</pre>';
error_reporting($old_error);
*/
static public function img($src, $alt = '', $attr = '')
{
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
/* If browser does not support images, simply return the ALT text. */
if (!$GLOBALS['browser']->hasFeature('images')) {
*/
static public function fullSrcImg($src, $options = array())
{
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
/* If browser does not support images, simply return the ALT text. */
if (!$GLOBALS['browser']->hasFeature('images')) {
*/
static public function stripAccessKey($label)
{
- if (!isset(Horde_Nls::$config['multibyte'])) {
- self::loadConfiguration('nls.php', null, 'horde');
- }
-
- $multibyte = isset(Horde_Nls::$config['multibyte'][Horde_Nls::getCharset(true)]);
+ $multibyte = isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)]);
return preg_replace('/_([A-Za-z])/',
$multibyte && preg_match('/[\x80-\xff]/', $label) ? '' : '\1',
$label);
return $stripped_label;
}
- if (isset($GLOBALS['nls']['multibyte'][Horde_Nls::getCharset(true)])) {
+ if (isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)])) {
/* Prefix parenthesis with the UTF-8 representation of the LRO
* (Left-to-Right-Override) Unicode codepoint U+202D. */
- $prefix = Horde_Nls::getCharset() == 'UTF-8' ? "\xe2\x80\xad" : '';
+ $prefix = ($GLOBALS['registry']->getCharset() == 'UTF-8')
+ ? "\xe2\x80\xad"
+ : '';
return $stripped_label . $prefix . '(<span class="accessKey">'
. strtoupper($accessKey) . '</span>' . ')';
- } else {
- return str_replace('_' . $accessKey, '<span class="accessKey">' . $accessKey . '</span>', $label);
}
+
+ return str_replace('_' . $accessKey, '<span class="accessKey">' . $accessKey . '</span>', $label);
}
/**
return $apps;
case 'list-horde-languages':
- return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"' . Horde_Nls::getCharset() . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . Horde_Nls::getCharset() . '\")"), $val);'), Horde_Nls::$config['languages']);
+ return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"' . $GLOBALS['registry']->getCharset() . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . $GLOBALS['registry']->getCharset() . '\")"), $val);'), $GLOBALS['registry']->nlsconfig['languages']);
case 'list-blocks':
$collection = Horde_Block_Collection::singleton('portal');
'body' => $message,
'to' => $conf['signup']['email'],
'from' => $conf['signup']['email'],
- 'subject' => Horde_Nls::getCharset()));
+ 'subject' => $GLOBALS['registry']->getCharset()));
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
--- /dev/null
+<?php
+/**
+ * @category Horde
+ * @package Core
+ */
+class Horde_Core_Autoloader_Callback_Nls
+{
+ /**
+ * TODO
+ */
+ static public function callback()
+ {
+ Horde_Nls::$dnsResolver = $GLOBALS['injector']->getInstance('Net_DNS_Resolver');
+ }
+
+}
$handler_params = array(
'identity' => $injector->getInstance('Horde_Prefs_Identity'),
'mail' => $injector->getInstance('Horde_Mail'),
- 'charset' => Horde_Nls::getCharset()
+ 'charset' => $GLOBALS['registry']->getCharset()
);
$alarm->addHandler('mail', new Horde_Alarm_Handler_Mail($handler_params));
// Fall-through
default:
- $val2 = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'UTF-8');
+ $val2 = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'UTF-8');
}
// [0] = pref name
);
}
Horde::addInlineScript(array(
- 'HordeSourceSelectPrefs.source_list = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'HordeSourceSelectPrefs.source_list = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
}
}
Horde::addInlineScript(array(
- 'HordeAddressbooksPrefs.fields = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset()),
- 'HordeAddressbooksPrefs.nonetext = ' . Horde_Serialize::serialize(_("No address book selected."), Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'HordeAddressbooksPrefs.fields = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
+ 'HordeAddressbooksPrefs.nonetext = ' . Horde_Serialize::serialize(_("No address book selected."), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
}
protected $_cache = array();
/**
+ * NLS cached information.
+ *
+ * @var array
+ */
+ protected $_nlscache = array();
+
+ /**
* The last modified time of the newest modified registry file.
*
* @var integer
public $applications = array();
/**
- * The session handler object.
+ * The application that called appInit().
*
- * @var Horde_SessionHandler
+ * @var string
*/
- public $sessionHandler = null;
+ public $initialApp;
/**
- * The application that called appInit().
+ * NLS configuration.
*
- * @var string
+ * @var array
*/
- public $initialApp;
+ public $nlsconfig = array();
+
+ /**
+ * The session handler object.
+ *
+ * @var Horde_SessionHandler
+ */
+ public $sessionHandler = null;
/**
* Application bootstrap initialization.
*
* Global variables defined:
* $cli - Horde_Cli object (if 'cli' is true)
+ * $language - Language
* $registry - Horde_Registry object
*
* @param string $app The application to initialize.
* 'none' - Do not start a session
* 'readonly' - Start session readonly
* [DEFAULT] - Start read/write session
+ * 'timezone' - (boolean) Set the time zone?
+ * DEFAULT: false
* 'user_admin' - (boolean) Set authentication to an admin user?
* DEFAULT: false
* </pre>
'nologintasks' => false,
'session_cache_limiter' => null,
'session_control' => null,
+ 'timezone' => false,
'user_admin' => null
), $args);
$registry->initialApp = $app;
+ if ($args['timezone']) {
+ $registry->setTimeZone();
+ }
+
if (!$args['nocompress']) {
Horde::compressOutput();
}
{
/* Define autoloader callbacks. */
$callbacks = array(
- 'Horde_Mime' => 'Horde_Core_Autoloader_Callback_Mime'
+ 'Horde_Mime' => 'Horde_Core_Autoloader_Callback_Mime',
+ 'Horde_Nls' => 'Horde_Core_Autoloader_Callback_Nls'
);
/* Define binders. */
$GLOBALS['__autoloader']->addCallback($key, array($val, 'callback'));
}
-
/* Initialize browser object. */
$GLOBALS['browser'] = $injector->getInstance('Horde_Browser');
* and egg issue - since loadConfiguration() uses registry in certain
* instances. However, if HORDE_BASE is defined, and app is
* 'horde', registry is not used in the method so we are free to
- * call it here (prevents us from duplicating a bunch of code
- * here. */
+ * call it here (prevents us from duplicating a bunch of code). */
$this->_cache['conf-horde'] = Horde::loadConfiguration('conf.php', 'conf', 'horde');
$conf = $GLOBALS['conf'] = &$this->_cache['conf-horde'];
/* Always need to load applications information. */
$this->_loadApplicationsCache($vhost);
- /* Initialize the localization routines and variables. We can't use
- * Horde_Nls::setLanguageEnvironment() here because that depends on the
- * registry to be already initialized. */
- Horde_Nls::setLanguage();
- Horde_Nls::setTextdomain('horde', HORDE_BASE . '/locale', Horde_Nls::getCharset());
- Horde_String::setDefaultCharset(Horde_Nls::getCharset());
+ /* Load the language configuration. */
+ $this->nlsconfig = Horde::loadConfiguration('nls.php', 'horde_nls_config', 'horde');
+
+ /* Initialize the localization routines and variables. */
+ $this->setLanguageEnvironment(null, 'horde');
$this->_regmtime = max(filemtime(HORDE_BASE . '/config/registry.php'),
filemtime(HORDE_BASE . '/config/registry.d'));
/* Chicken and egg problem: the language environment has to be loaded
* before loading the configuration file, because it might contain
* gettext strings. Though the preferences can specify a different
- * language for this app, the have to be loaded after the
+ * language for this app, they have to be loaded after the
* configuration, because they rely on configuration settings. So try
* with the current language, and reset the language later. */
- Horde_Nls::setLanguageEnvironment($GLOBALS['language'], $app);
+ $this->setLanguageEnvironment($GLOBALS['language'], $app);
/* Load config and prefs and set proper language from the prefs. */
$this->_onAppSwitch($app);
* preferences. */
$language = $GLOBALS['prefs']->getValue('language');
if ($language != $GLOBALS['language']) {
- Horde_Nls::setLanguageEnvironment($language, $app);
+ $this->setLanguageEnvironment($language, $app);
}
}
$_SESSION['horde_auth'] = array(
'app' => array(),
'authId' => $authId,
- 'browser' => $GLOBALS['injector']->getInstance('Horde_Browser')->getAgentString(),
+ 'browser' => $GLOBALS['browser']->getAgentString(),
'change' => !empty($options['change']),
'credentials' => $app,
'remoteAddr' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null,
/* Reload preferences for the new user. */
$this->loadPrefs();
- Horde_Nls::setLanguageEnvironment($GLOBALS['prefs']->getValue('language'), $app);
+ $this->setLanguageEnvironment($GLOBALS['prefs']->getValue('language'), $app);
}
/**
}
if (!empty($GLOBALS['conf']['auth']['checkbrowser']) &&
- ($_SESSION['horde_auth']['browser'] != $GLOBALS['injector']->getInstance('Horde_Browser')->getAgentString())) {
+ ($_SESSION['horde_auth']['browser'] != $GLOBALS['browser']->getAgentString())) {
$auth->setError(Horde_Core_Auth_Application::REASON_BROWSER);
return false;
}
return $auth->validateAuth();
}
+ /* NLS functions. */
+
+ /**
+ * Returns the charset for the current language.
+ *
+ * @param boolean $original If true returns the original charset of the
+ * translation, the actually used one otherwise.
+ *
+ * @return string The character set that should be used with the current
+ * locale settings.
+ */
+ public function getCharset($original = false)
+ {
+ /* Get cached results. */
+ $cacheKey = intval($original);
+ $charset = $this->_cachedCharset($cacheKey);
+ if (!is_null($charset)) {
+ return $charset;
+ }
+
+ if ($original) {
+ $charset = empty($this->nlsconfig['charsets'][$GLOBALS['language']])
+ ? 'ISO-8859-1'
+ : $this->nlsconfig['charsets'][$GLOBALS['language']];
+ } elseif ($GLOBALS['browser']->hasFeature('utf') &&
+ (Horde_Util::extensionExists('iconv') ||
+ Horde_Util::extensionExists('mbstring'))) {
+ $charset = 'UTF-8';
+ }
+
+ if (is_null($charset)) {
+ $charset = $this->getExternalCharset();
+ }
+
+ $this->_cachedCharset($cacheKey, $charset);
+
+ return $charset;
+ }
+
+ /**
+ * Returns the current charset of the environment
+ *
+ * @return string The character set that should be used with the current
+ * locale settings.
+ */
+ public function getExternalCharset()
+ {
+ /* Get cached results. */
+ $charset = $this->_cachedCharset(2);
+ if (!is_null($charset)) {
+ return $charset;
+ }
+
+ $lang_charset = setlocale(LC_ALL, 0);
+ if ((strpos($lang_charset, ';') === false) &&
+ (strpos($lang_charset, '/') === false)) {
+ $lang_charset = explode('.', $lang_charset);
+ if ((count($lang_charset) == 2) && !empty($lang_charset[1])) {
+ $this->_cachedCharset(2, $lang_charset[1]);
+ return $lang_charset[1];
+ }
+ }
+
+ return empty($this->nlsconfig['charsets'][$GLOBALS['language']])
+ ? 'ISO-8859-1'
+ : $this->nlsconfig['charsets'][$GLOBALS['language']];
+ }
+
+ /**
+ * Returns the charset to use for outgoing emails.
+ *
+ * @return string The preferred charset for outgoing mails based on
+ * the user's preferences and the current language.
+ */
+ public function getEmailCharset()
+ {
+ $charset = $GLOBALS['prefs']->getValue('sending_charset');
+ if (!empty($charset)) {
+ return $charset;
+ }
+
+ return isset($this->nlsconfig['emails'][$GLOBALS['language']])
+ ? $this->nlsconfig['emails'][$GLOBALS['language']]
+ : (isset($this->nlsconfig['charsets'][$GLOBALS['language']]) ? $this->nlsconfig['charsets'][$GLOBALS['language']] : 'ISO-8859-1');
+ }
+
+ /**
+ * Selects the most preferred language for the current client session.
+ *
+ * @param string $lang Force to use this language.
+ *
+ * @return string The selected language abbreviation.
+ */
+ public function preferredLang($lang = null)
+ {
+ /* First, check if language pref is locked and, if so, set it to its
+ * value */
+ if (isset($GLOBALS['prefs']) &&
+ $GLOBALS['prefs']->isLocked('language')) {
+ $language = $GLOBALS['prefs']->getValue('language');
+ /* Check if the user selected a language from the login screen */
+ } elseif (!empty($lang) && $this->isValidLang($lang)) {
+ $language = $lang;
+ /* Check if we have a language set in the session */
+ } elseif (isset($_SESSION['horde_language'])) {
+ $language = $_SESSION['horde_language'];
+ /* Use site-wide default, if one is defined */
+ } elseif (!empty($this->nlsconfig['defaults']['language'])) {
+ $language = $this->nlsconfig['defaults']['language'];
+ /* Try browser-accepted languages. */
+ } elseif (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+ /* The browser supplies a list, so return the first valid one. */
+ $browser_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+ foreach ($browser_langs as $lang) {
+ /* Strip quality value for language */
+ if (($pos = strpos($lang, ';')) !== false) {
+ $lang = substr($lang, 0, $pos);
+ }
+ $lang = $this->_mapLang(trim($lang));
+ if ($this->isValidLang($lang)) {
+ $language = $lang;
+ break;
+ }
+
+ /* In case there's no full match, save our best guess. Try
+ * ll_LL, followed by just ll. */
+ if (!isset($partial_lang)) {
+ $ll_LL = Horde_String::lower(substr($lang, 0, 2)) . '_' . Horde_String::upper(substr($lang, 0, 2));
+ if ($this->isValidLang($ll_LL)) {
+ $partial_lang = $ll_LL;
+ } else {
+ $ll = $this->_mapLang(substr($lang, 0, 2));
+ if ($this->isValidLang($ll)) {
+ $partial_lang = $ll;
+ }
+ }
+ }
+ }
+ }
+
+ if (!isset($language)) {
+ $language = isset($partial_lang)
+ ? $partial_lang
+ /* No dice auto-detecting, default to US English. */
+ : 'en_US';
+ }
+
+ return basename($language);
+ }
+
+ /**
+ * Determines whether the supplied language is valid.
+ *
+ * @param string $language The abbreviated name of the language.
+ *
+ * @return boolean True if the language is valid, false if it's not
+ * valid or unknown.
+ */
+ public function isValidLang($language)
+ {
+ return !empty($this->nlsconfig['languages'][$language]);
+ }
+
+ /**
+ * Sets the UI charset.
+ *
+ * In general, the applied charset is automatically determined by browser
+ * language and browser capabilities and there's no need to manually call
+ * setCharset. However for headless (RPC) operations the charset may be
+ * set manually to ensure correct character conversion in the backend.
+ *
+ * @param string $charset The new UI charset.
+ */
+ public function setCharset($charset)
+ {
+ $this->_cachedCharset(0, $charset);
+ }
+
+ /**
+ * Sets the charset and reloads the whole NLS environment.
+ *
+ * When setting the charset, the gettext catalogs have to be reloaded too,
+ * to match the new charset, among other things. This method takes care of
+ * all this.
+ *
+ * @param string $charset The new UI charset.
+ */
+ public function setCharsetEnvironment($charset)
+ {
+ unset($GLOBALS['language']);
+ $this->setCharset($charset);
+ $this->setLanguageEnvironment();
+ }
+
+ /**
+ * Sets the language.
+ *
+ * @param string $lang The language abbreviation.
+ *
+ * @throws Horde_Exception
+ */
+ public function setLanguage($lang = null)
+ {
+ if (empty($lang) || !$this->isValidLang($lang)) {
+ $lang = $this->preferredLang();
+ }
+
+ $_SESSION['horde_language'] = $lang;
+
+ if (isset($GLOBALS['language'])) {
+ if ($GLOBALS['language'] == $lang) {
+ return;
+ }
+ $this->clearCache();
+ }
+ $GLOBALS['language'] = $lang;
+
+ /* First try language with the current charset. */
+ $lang_charset = $lang . '.' . $this->getCharset();
+ if ($lang_charset != setlocale(LC_ALL, $lang_charset)) {
+ /* Next try language with its default charset. */
+ $charset = empty($this->nlsconfig['charsets'][$lang])
+ ? 'ISO-8859-1'
+ : $this->nlsconfig['charsets'][$lang];
+ $lang_charset = $lang . '.' . $charset;
+ $this->_cachedCharset(0, $charset);
+ if ($lang_charset != setlocale(LC_ALL, $lang_charset)) {
+ /* At last try language solely. */
+ $lang_charset = $lang;
+ setlocale(LC_ALL, $lang_charset);
+ }
+ }
+
+ @putenv('LC_ALL=' . $lang_charset);
+ @putenv('LANG=' . $lang_charset);
+ @putenv('LANGUAGE=' . $lang_charset);
+ }
+
+ /**
+ * Sets the language and reloads the whole NLS environment.
+ *
+ * When setting the language, the gettext catalogs have to be reloaded
+ * too, charsets have to be updated etc. This method takes care of all
+ * this.
+ *
+ * @param string $language The new language.
+ * @param string $app The application for reloading the gettext
+ * catalog. The current application if empty.
+ */
+ public function setLanguageEnvironment($lang = null, $app = null)
+ {
+ if (empty($app)) {
+ $app = $this->getApp();
+ }
+
+ $this->setLanguage($lang);
+ $this->setTextdomain(
+ $app,
+ $this->get('fileroot', $app) . '/locale'
+ );
+ Horde_String::setDefaultCharset($this->getCharset());
+ }
+
+ /**
+ * Sets the gettext domain.
+ *
+ * @param string $app The application name.
+ * @param string $directory The directory where the application's
+ * LC_MESSAGES directory resides.
+ * @param string $charset The charset.
+ */
+ public function setTextdomain($app, $directory, $charset = null)
+ {
+ bindtextdomain($app, $directory);
+ textdomain($app);
+
+ if (is_null($charset)) {
+ $charset = $this->getCharset();
+ }
+
+ /* The existence of this function depends on the platform. */
+ if (function_exists('bind_textdomain_codeset')) {
+ $this->_cachedCharset(0, bind_textdomain_codeset($app, $charset));
+ }
+
+ if (!Horde::contentSent()) {
+ header('Content-Type: text/html; charset=' . $charset);
+ }
+ }
+
+ /**
+ * Sets the current timezone, if available.
+ */
+ public function setTimeZone()
+ {
+ $tz = $GLOBALS['prefs']->getValue('timezone');
+ if (!empty($tz)) {
+ @date_default_timezone_set($tz);
+ }
+ }
+
+ /**
+ * Maps languages with common two-letter codes (such as nl) to the
+ * full gettext code (in this case, nl_NL). Returns the language
+ * unmodified if it isn't an alias.
+ *
+ * @param string $language The language code to map.
+ *
+ * @return string The mapped language code.
+ */
+ protected function _mapLang($language)
+ {
+ // Translate the $language to get broader matches.
+ // (eg. de-DE should match de_DE)
+ $trans_lang = str_replace('-', '_', $language);
+ $lang_parts = explode('_', $trans_lang);
+ $trans_lang = Horde_String::lower($lang_parts[0]);
+ if (isset($lang_parts[1])) {
+ $trans_lang .= '_' . Horde_String::upper($lang_parts[1]);
+ }
+
+ return empty($this->nlsconfig['aliases'][$trans_lang])
+ ? $trans_lang
+ : $this->nlsconfig['aliases'][$trans_lang];
+ }
+
+
+ /**
+ * Sets or returns the charset used under certain conditions.
+ *
+ * @param integer $index The ID of a cache slot. 0 for the UI charset, 1
+ * for the translation charset and 2 for the
+ * external charset.
+ * @param string $charset If specified, this charset will be stored in
+ * the given cache slot. Otherwise the content of
+ * the specified cache slot will be returned.
+ */
+ protected function _cachedCharset($index, $charset = null)
+ {
+ if (is_null($charset)) {
+ return isset($this->_nlscache['charset'][$index])
+ ? $this->_nlscache['charset'][$index]
+ : null;
+ }
+
+ $this->_nlscache['charset'][$index] = $charset;
+ }
+
}
<dir name="Autoloader">
<dir name="Callback">
<file name="Mime.php" role="php" />
+ <file name="Nls.php" role="php" />
</dir> <!-- /lib/Horde/Core/Autoloader/Callback -->
</dir> <!-- /lib/Horde/Core/Autoloader -->
<dir name="Binder">
<channel>pear.horde.org</channel>
</package>
<package>
+ <name>Nls</name>
+ <channel>pear.horde.org</channel>
+ </package>
+ <package>
<name>Text_Filter</name>
<channel>pear.horde.org</channel>
</package>
<install as="Horde/Core/Auth/Signup/Sql.php" name="lib/Horde/Core/Auth/Signup/Sql.php" />
<install as="Horde/Core/Auth/Signup/SqlObject.php" name="lib/Horde/Core/Auth/Signup/SqlObject.php" />
<install as="Horde/Core/Autoloader/Callback/Mime.php" name="lib/Horde/Core/Autoloader/Callback/Mime.php" />
+ <install as="Horde/Core/Autoloader/Callback/Nls.php" name="lib/Horde/Core/Autoloader/Callback/Nls.php" />
<install as="Horde/Core/Binder/Alarm.php" name="lib/Horde/Core/Binder/Alarm.php" />
<install as="Horde/Core/Binder/Auth.php" name="lib/Horde/Core/Binder/Auth.php" />
<install as="Horde/Core/Binder/AuthSignup.php" name="lib/Horde/Core/Binder/AuthSignup.php" />
if ($errno == 0) {
throw new Horde_Exception(_("Connection refused to the public keyserver."));
} else {
- throw new Horde_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, Horde_Nls::getExternalCharset()), $errno));
+ throw new Horde_Exception(sprintf(_("Connection refused to the public keyserver. Reason: %s (%s)"), Horde_String::convertCharset($errstr, $GLOBALS['registry']->getExternalCharset()), $errno));
}
}
'--armor',
'--always-trust',
'--batch',
- '--charset ' . Horde_Nls::getCharset(),
+ '--charset ' . $GLOBALS['registry']->getCharset(),
$keyring,
'--verify'
);
$msg_sign = $this->encrypt($mime_part->toString(array('headers' => true, 'canonical' => true, 'encode' => Horde_Mime_Part::ENCODE_7BIT)), $params);
/* Add the PGP signature. */
- $charset = Horde_Nls::getEmailCharset();
+ $charset = $GLOBALS['registry']->getEmailCharset();
$pgp_sign = new Horde_Mime_Part();
$pgp_sign->setType('application/pgp-signature');
$pgp_sign->setCharset($charset);
$pgp_sign->setDisposition('inline');
- $pgp_sign->setDescription(Horde_String::convertCharset(_("PGP Digital Signature"), Horde_Nls::getCharset(), $charset));
+ $pgp_sign->setDescription(Horde_String::convertCharset(_("PGP Digital Signature"), $GLOBALS['registry']->getCharset(), $charset));
$pgp_sign->setContents($msg_sign);
/* Get the algorithim information from the signature. Since we are
$message_encrypt = $this->encrypt($signenc_body, $params);
/* Set up MIME Structure according to RFC 3156. */
- $charset = Horde_Nls::getEmailCharset();
+ $charset = $GLOBALS['registry']->getEmailCharset();
$part = new Horde_Mime_Part();
$part->setType('multipart/encrypted');
$part->setCharset($charset);
$part->setContentTypeParameter('protocol', 'application/pgp-encrypted');
- $part->setDescription(Horde_String::convertCharset(_("PGP Encrypted Data"), Horde_Nls::getCharset(), $charset));
+ $part->setDescription(Horde_String::convertCharset(_("PGP Encrypted Data"), $GLOBALS['registry']->getCharset(), $charset));
$part->setContents("This message is in MIME format and has been PGP encrypted.\n");
$part1 = new Horde_Mime_Part();
$part = $this->encryptMIMEPart($part, $encrypt_params);
$part->setContents("This message is in MIME format and has been PGP signed and encrypted.\n");
- $charset = Horde_Nls::getEmailCharset();
+ $charset = $GLOBALS['registry']->getEmailCharset();
$part->setCharset($charset);
- $part->setDescription(Horde_String::convertCharset(_("PGP Signed/Encrypted Data"), Horde_Nls::getCharset(), $charset));
+ $part->setDescription(Horde_String::convertCharset(_("PGP Signed/Encrypted Data"), $GLOBALS['registry']->getCharset(), $charset));
return $part;
}
*/
public function publicKeyMIMEPart($key)
{
- $charset = Horde_Nls::getEmailCharset();
+ $charset = $GLOBALS['registry']->getEmailCharset();
$part = new Horde_Mime_Part();
$part->setType('application/pgp-keys');
$part->setCharset($charset);
- $part->setDescription(Horde_String::convertCharset(_("PGP Public Key"), Horde_Nls::getCharset(), $charset));
+ $part->setDescription(Horde_String::convertCharset(_("PGP Public Key"), $GLOBALS['registry']->getCharset(), $charset));
$part->setContents($key);
return $part;
$message = $this->encrypt($mime_part->toString(array('headers' => true, 'canonical' => true)), $params);
/* Get charset for mime part description. */
- $charset = Horde_Nls::getEmailCharset();
+ $charset = $GLOBALS['registry']->getEmailCharset();
$msg = new Horde_Mime_Part();
$msg->setCharset($charset);
- $msg->setDescription(Horde_String::convertCharset(_("S/MIME Encrypted Message"), Horde_Nls::getCharset(), $charset));
+ $msg->setDescription(Horde_String::convertCharset(_("S/MIME Encrypted Message"), $GLOBALS['registry']->getCharset(), $charset));
$msg->setDisposition('inline');
$msg->setType('application/pkcs7-mime');
$msg->setContentTypeParameter('smime-type', 'enveloped-data');
--FILE--
<?php
-// Fake preferences class to set the timezone to a consistent value.
-class mock_prefs {
- function getValue($key)
- {
- return 'GMT';
- }
-}
-$GLOBALS['prefs'] = new mock_prefs();
+@date_default_timezone_set('GMT');
-require_once 'Horde/Nls.php';
-Horde_Nls::setTimezone();
require 'pgp.inc';
echo $pgp->pgpPrettyKey(file_get_contents(dirname(__FILE__) . '/fixtures/bug_6601.asc'));
--FILE--
<?php
-// Fake preferences class to set the timezone to a consistent value.
-class mock_prefs {
- function getValue($key)
- {
- return 'GMT';
- }
-}
-$GLOBALS['prefs'] = new mock_prefs();
+date_default_timezone_set('GMT');
-require_once 'Horde/Nls.php';
-Horde_Nls::setTimezone();
require 'pgp.inc';
echo $pgp->decrypt(file_get_contents(dirname(__FILE__) . '/fixtures/clear.txt'),
if ($header) {
$head = Horde_File_Csv::read($filename, $conf);
if (!empty($charset)) {
- $head = Horde_String::convertCharset($head, $charset, Horde_Nls::getCharset());
+ $head = Horde_String::convertCharset($head, $charset, $GLOBALS['registry']->getCharset());
}
}
$data = array();
while ($line = Horde_File_Csv::read($filename, $conf)) {
if (!empty($charset)) {
- $line = Horde_String::convertCharset($line, $charset, Horde_Nls::getCharset());
+ $line = Horde_String::convertCharset($line, $charset, $GLOBALS['registry']->getCharset());
}
if (!isset($head)) {
$data[] = $line;
$line_no = 1;
while ($line_no < 3 && $line = fgets($fp)) {
if (!empty($_SESSION['import_data']['charset'])) {
- $line = Horde_String::convertCharset($line, $_SESSION['import_data']['charset'], Horde_Nls::getCharset());
+ $line = Horde_String::convertCharset($line, $_SESSION['import_data']['charset'], $GLOBALS['registry']->getCharset());
}
$newline = Horde_String::length($line) > 100 ? "\n" : '';
$_SESSION['import_data']['first_lines'] .= substr($line, 0, 100) . $newline;
return null;
} else {
$name = Horde_String::convertCharset($name, $this->_params['charset'],
- Horde_Nls::getCharset());
+ $GLOBALS['registry']->getCharset());
// Get the parent names, if any.
$parent = $this->getParentById($id);
if ($parent && !is_a($parent, 'PEAR_Error') &&
} else {
require_once 'Horde/Serialize.php';
$ser = Horde_Serialize::UTF7_BASIC;
- $data = Horde_Serialize::serialize($object->getData(), $ser, Horde_Nls::getCharset());
+ $data = Horde_Serialize::serialize($object->getData(), $ser, $GLOBALS['registry']->getCharset());
}
} else {
$fullname = $object;
' VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
$values = array((int)$id,
$this->_params['group'],
- Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
is_null($order) ? NULL : (int)$order,
$data,
(string)$GLOBALS['registry']->getAuth(),
$id = $this->getId($old_object);
$query = 'UPDATE ' . $this->_params['table'] .
' SET datatree_name = ? WHERE datatree_id = ?';
- $values = array(Horde_String::convertCharset($new_object_name, Horde_Nls::getCharset(), $this->_params['charset']),
+ $values = array(Horde_String::convertCharset($new_object_name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)$id);
Horde::logMessage('SQL Query by DataTree_sql::rename(): ' . $query . ', ' . var_export($values, true), 'DEBUG');
$data = array();
foreach ($result as $id => $row) {
$data[$id] = Horde_Serialize::unserialize($row[0], $row[1],
- Horde_Nls::getCharset());
+ $GLOBALS['registry']->getCharset());
/* Convert old data to the new format. */
if ($row[1] == Horde_Serialize::BASIC) {
$data[$id] = Horde_String::convertCharset($data[$id],
- Horde_Nls::getCharset(true));
+ $GLOBALS['registry']->getCharset(true));
}
$data[$id] = (is_null($data[$id]) || !is_array($data[$id]))
$data = Horde_Serialize::unserialize($row['datatree_data'],
$row['datatree_serialized'],
- Horde_Nls::getCharset());
+ $GLOBALS['registry']->getCharset());
/* Convert old data to the new format. */
if ($row['datatree_serialized'] == Horde_Serialize::BASIC) {
- $data = Horde_String::convertCharset($data, Horde_Nls::getCharset(true));
+ $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getCharset(true));
}
return (is_null($data) || !is_array($data)) ? array() : $data;
}
}
$data[$row['datatree_id']][] = array('name' => $row['name'],
'key' => $row['key'],
- 'value' => Horde_String::convertCharset($row['value'], $this->_params['charset'], Horde_Nls::getCharset()));
+ 'value' => Horde_String::convertCharset($row['value'], $this->_params['charset'], $GLOBALS['registry']->getCharset()));
}
return $data;
} else {
for ($i = 0; $i < count($rows); $i++) {
$rows[$i]['value'] = Horde_String::convertCharset($rows[$i]['value'],
$this->_params['charset'],
- Horde_Nls::getCharset());
+ $GLOBALS['registry']->getCharset());
}
return $rows;
}
$values = array((int)$id,
$attr['name'],
$attr['key'],
- Horde_String::convertCharset($attr['value'], Horde_Nls::getCharset(), $this->_params['charset']));
+ Horde_String::convertCharset($attr['value'], $GLOBALS['registry']->getCharset(), $this->_params['charset']));
Horde::logMessage('SQL Query by DataTree_sql::updateData(): ' . $query . ', ' . var_export($values, true), 'DEBUG');
/* Write to the datatree_data field. */
require_once 'Horde/Serialize.php';
$ser = Horde_Serialize::UTF7_BASIC;
- $data = Horde_Serialize::serialize($object->getData(), $ser, Horde_Nls::getCharset());
+ $data = Horde_Serialize::serialize($object->getData(), $ser, $GLOBALS['registry']->getCharset());
$query = 'UPDATE ' . $this->_params['table'] .
' SET datatree_data = ?, datatree_serialized = ?' .
}
}
}
- echo '<input type="hidden" name="_formvars" value="' . @htmlspecialchars(serialize($vars), ENT_QUOTES, Horde_Nls::getCharset()) . '" />';
+ echo '<input type="hidden" name="_formvars" value="' . @htmlspecialchars(serialize($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '" />';
}
function renderFormActive(&$form, &$vars)
}
$groups = array();
- $current_charset = Horde_Nls::getCharset();
+ $current_charset = $GLOBALS['registry']->getCharset();
for ($i = 0; $i < $result['count']; $i++) {
$utf8_dn = Horde_String::convertCharset($result[$i]['dn'], 'UTF-8', $current_charset);
$groups[$utf8_dn] = $this->getGroupName($utf8_dn);
*/
public function getGroupName($dn)
{
- $dn = Horde_String::convertCharset($dn, Horde_Nls::getCharset(), 'UTF-8');
+ $dn = Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), 'UTF-8');
$result = @ldap_explode_dn($dn, 1);
if ($result === false) {
throw new Horde_Group_Exception('Invalid group ID passed (bad DN syntax)');
}
$groups = array();
- $current_charset = Horde_Nls::getCharset();
+ $current_charset = $GLOBALS['registry']->getCharset();
for ($i = 0; $i < $result['count']; $i++) {
$utf8_dn = Horde_String::convertCharset($result[$i]['dn'], 'UTF-8', $current_charset);
$groups[$utf8_dn] = $this->getGroupName($utf8_dn);
function &setElemStr(&$parent, $name, $value = '')
{
- return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, Horde_Nls::getCharset(), 'utf-8'));
+ return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), 'utf-8'));
}
function &setVal($name, $value = '')
*/
function encodeImapFolderName($name)
{
- return Horde_String::convertCharset($name, Horde_Nls::getCharset(), 'UTF7-IMAP');
+ return Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
}
/**
Horde::logMessage(sprintf("Arguments: %s", print_r($values, true)), 'DEBUG');
- Horde_Nls::setCharset('utf-8');
+ $GLOBALS['registry']->setCharset('utf-8');
if (!empty($conf['kolab']['filter']['locale_path'])
&& !empty($conf['kolab']['filter']['locale'])) {
- Horde_Nls::setTextdomain('Kolab_Filter', $conf['kolab']['filter']['locale_path'], Horde_Nls::getCharset());
+ $GLOBALS['registry']->setTextdomain('Kolab_Filter', $conf['kolab']['filter']['locale_path']);
setlocale(LC_ALL, $conf['kolab']['filter']['locale']);
}
*/
require_once 'Horde/Autoloader.php';
-Horde_Nls::setCharset('utf-8');
+$registry->setCharset('utf-8');
/** Generate the format handler */
$format = Horde_Kolab_Format::factory('Xml', 'Event');
}
}
-Horde_Nls::setCharset('utf-8');
+$registry->setCharset('utf-8');
/** Generate the format handler */
$format = Horde_Kolab_Format::factory('Xml', 'String');
*/
protected function _createTextNode($parent, $name, $value)
{
- $value = Horde_String::convertCharset($value, Horde_Nls::getCharset(),
+ $value = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(),
'utf-8');
$node = $this->_xmldoc->createElement($name);
*/
protected function setUp()
{
- Horde_Nls::setCharset('utf-8');
+ $GLOBALS['registry']->setCharset('utf-8');
}
/**
*/
protected function setUp()
{
- Horde_Nls::setCharset('utf-8');
+ $GLOBALS['registry']->setCharset('utf-8');
Horde_String::setDefaultCharset('iso-8859-1');
}
*/
protected function setUp()
{
- Horde_Nls::setCharset('utf-8');
+ $GLOBALS['registry']->setCharset('utf-8');
}
/**
*/
protected function setUp()
{
- Horde_Nls::setCharset('utf-8');
+ $GLOBALS['registry']->setCharset('utf-8');
}
/**
0,
array('type' => self::TYPE_DATETIME));
}
-}
\ No newline at end of file
+}
$this->markTestSkipped('The Horde_Date_Recurrence class is missing.');
}
- Horde_Nls::setCharset('utf-8');
+ $GLOBALS['registry']->setCharset('utf-8');
$this->_oldTimezone = date_default_timezone_get();
date_default_timezone_set('Europe/Berlin');
*/
protected function setUp()
{
- Horde_Nls::setCharset('utf-8');
+ $GLOBALS['registry']->setCharset('utf-8');
}
*/
public function __construct()
{
- $this->_charset = Horde_Nls::getCharset();
+ $this->_charset = $GLOBALS['registry']->getCharset();
if (empty($this->_primaryPersonalNamespace)) {
$personal = null;
foreach ($this->_namespaces as $namespace) {
$part = new Horde_Mime_Part();
$part->setType(isset($data['type']) ? $data['type'] : null);
$part->setContents(isset($data['content']) ? $data['content'] : file_get_contents($data['path']));
- $part->setCharset(Horde_Nls::getCharset());
+ $part->setCharset($GLOBALS['registry']->getCharset());
$part->setTransferEncoding('quoted-printable');
$part->setDisposition('attachment');
$part->setName($attachment);
$part = new Horde_Mime_Part();
$part->setType($handlers[$type]->getMimeType());
$part->setContents($new_content);
- $part->setCharset(Horde_Nls::getCharset());
+ $part->setCharset($GLOBALS['registry']->getCharset());
$part->setTransferEncoding('quoted-printable');
$part->setDisposition($handlers[$type]->getDisposition());
$part->setDispositionParameter('x-kolab-type', $type);
$part = new Horde_Mime_Part();
$part->setType('text/plain');
$part->setName('Kolab Groupware Information');
- $part->setContents(Horde_String::wrap($kolab_text, 76, "\r\n", Horde_Nls::getCharset()));
- $part->setCharset(Horde_Nls::getCharset());
+ $part->setContents(Horde_String::wrap($kolab_text, 76, "\r\n", $GLOBALS['registry']->getCharset()));
+ $part->setCharset($GLOBALS['registry']->getCharset());
$part->setTransferEncoding('quoted-printable');
$mime_message->addPart($part);
public function testGetNamespaceReturnsNamespaceHandler()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Cclient(
$this->group,
array()
public function testGetNamespaceReturnsExpectedNamespaces()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Cclient(
$this->group,
array()
public function testGetNamespaceReturnsNamespaceHandler()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Imap(
$this->_getNamespaceMock(),
$this->group,
public function testGetNamespaceReturnsExpectedNamespaces()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Imap(
$this->_getNamespaceMock(),
$this->group,
public function testGetNamespaceReturnsNamespaceHandler()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Mock(
$this->group,
array()
public function testGetNamespaceReturnsExpectedNamespaces()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Mock(
$this->group,
array()
public function testGetNamespaceReturnsNamespaceHandler()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Pear(
$this->_getNamespaceMock(),
$this->group,
public function testGetNamespaceReturnsExpectedNamespaces()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
$driver = new Horde_Kolab_Storage_Driver_Pear(
$this->_getNamespaceMock(),
$this->group,
$folder = new Horde_Kolab_Storage_Folder_Base('INBOX/Contacts');
$folder->restore($storage, $connection);
$folder->setName('TestAÖÜ');
- $this->assertEquals(Horde_String::convertCharset('INBOX/TestAÖÜ', Horde_Nls::getCharset(), 'UTF7-IMAP'), $folder->new_name);
+ $this->assertEquals(Horde_String::convertCharset('INBOX/TestAÖÜ', $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), $folder->new_name);
}
/**
public function testFolderTitleConvertsUtf7()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
foreach ($this->_getNamespaces() as $namespace) {
$name = Horde_String::convertCharset('äöü', 'UTF8', 'UTF7-IMAP');
$folder = $this->_getFolder('INBOX/' . $name, $namespace);
public function testSetnameConvertsToUtf7()
{
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
foreach ($this->_getNamespaces() as $namespace) {
$folder = $this->_getFolder(null, $namespace);
$folder->restore($this->_storage, $this->_connection);
}
/** @todo: FIXME -> required for namespace handling */
- Horde_Nls::setCharset('UTF8');
+ $GLOBALS['registry']->setCharset('UTF8');
/** Setup group handler */
require_once 'Horde/Group.php';
static public function encode($text, $charset = null)
{
if (is_null($charset)) {
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
}
$charset = Horde_String::lower($charset);
$rest = substr($string, (strlen($preceding . $charset . $encoding . $encoded_text) + 6));
if (is_null($to_charset)) {
- $to_charset = Horde_Nls::getCharset();
+ $to_charset = $GLOBALS['registry']->getCharset();
}
switch ($encoding) {
$msg->setType('multipart/report');
$msg->setContentTypeParameter('report-type', 'disposition-notification');
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
/* The first part is a human readable message. */
$part_one = new Horde_Mime_Part('text/plain');
$this->_mimepart->getMimeId() => array(
'data' => $this->_lineNumber(trim($css)),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => '<pre>' . htmlspecialchars($data) . '</pre>',
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => Horde_String::convertCharset($this->_toHTML(true), $this->_mimepart->getCharset()),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $this->_toHTML(),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $this->_toHTML(),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => Horde_String::convertCharset($html['data'], $this->_mimepart->getCharset()),
'status' => $html['status'],
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => file_get_contents($tmp_out),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $data,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $data,
'status' => array(),
- 'type' => $type . '; charset=' . Horde_Nls::getCharset()
+ 'type' => $type . '; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $text,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $data,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$rar = Horde_Compress::factory('rar');
$rarData = $rar->decompress($contents);
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$fileCount = count($rarData);
$name = $this->_mimepart->getName(true);
$this->_mimepart->getMimeId() => array(
'data' => $this->_mimepart->getContents(),
'status' => array(),
- 'type' => 'text/plain; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => empty($header_output) ? '' : ('<div class="fixed mimeHeaders">' . Horde_Text_Filter::filter(implode("<br />\n", $header_output), 'emails') . '</div>'),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => Horde_String::convertCharset($this->_toHTML(), $this->_mimepart->getCharset()),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => '<pre>' . htmlentities($data) . '</pre>',
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $data,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $this->_content,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $this->_lineNumber($results),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$tar = Horde_Compress::factory('tar');
$tarData = $tar->decompress($contents);
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$fileCount = count($tarData);
$name = $this->_mimepart->getName(true);
$this->_mimepart->getMimeId() => array(
'data' => $data,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => Horde::endBuffer() . $html,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $results,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $data,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
Horde_String::pad(_("Ratio"), 10, ' ', STR_PAD_LEFT) .
"\n",
'space2html',
- array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)
+ array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)
) . str_repeat('-', 59 + $maxlen) . "\n";
foreach ($zipInfo as $key => $val) {
reset($val);
while (list($k, $v) = each($val)) {
- $val[$k] = Horde_Text_Filter::filter($v, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true));
+ $val[$k] = Horde_Text_Filter::filter($v, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true));
}
if (!is_null($this->_callback)) {
$this->_mimepart->getMimeId() => array(
'data' => nl2br($text . str_repeat('-', 59 + $maxlen) . "\n</span></td></tr></table>"),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
}
}
echo '<input type="hidden" name="_formvars" value="'
- . htmlspecialchars(serialize($vars), ENT_QUOTES, Horde_Nls::getCharset())
+ . htmlspecialchars(serialize($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset())
. '" />';
}
. 'id="%2$s" value="%3$s"%4$s%5$s%6$s />',
($var->isDisabled() ? ' form-input-disabled" ' : ''),
$var->getVarName(),
- htmlspecialchars($var->getValue($vars), ENT_QUOTES, Horde_Nls::getCharset()),
+ htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
($var->isDisabled() ? ' disabled="disabled" ' : ''),
($var->type->maxlength ? ' maxlength="' . $var->type->maxlength . '"' : ''),
$this->_getActionScripts($form, $var)
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, Horde_Nls::getCharset()),
+ htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
($var->isDisabled() ? ' disabled="disabled" ' : ''),
$this->_getActionScripts($form, $var)
);
{
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, Horde_Nls::getCharset()),
+ htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
$var->isDisabled() ? ' disabled="disabled" ' : '',
$this->_getActionScripts($form, $var)
);
$prompt = $var->type->prompt;
$htmlchars = $var->getOption('htmlchars');
if ($prompt) {
- $prompt = '<option value="">' . ($htmlchars ? htmlspecialchars($prompt, ENT_QUOTES, Horde_Nls::getCharset()) : $prompt) . '</option>';
+ $prompt = '<option value="">' . ($htmlchars ? htmlspecialchars($prompt, ENT_QUOTES, $GLOBALS['registry']->getCharset()) : $prompt) . '</option>';
}
return sprintf(' <select name="%1$s" id="%1$s"%2$s>%3$s%4$s </select>',
$var->getVarName(),
/* 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, Horde_Nls::getCharset()));
+ htmlspecialchars($selected['1'], ENT_QUOTES, $GLOBALS['registry']->getCharset()));
/* First level. */
$values_1 = Horde_Array::valuesToKeys(array_keys($values));
'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, Horde_Nls::getCharset()) . '</option>';
+ $html .= '<option value="">' . htmlspecialchars($prompts[0], ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '</option>';
}
$html .= $this->_selectOptions($values_1, $selected['1']);
$html .= ' </select>';
$varname,
($var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : ''));
if (!empty($prompts)) {
- $html .= '<option value="">' . htmlspecialchars($prompts[1], ENT_QUOTES, Horde_Nls::getCharset()) . '</option>';
+ $html .= '<option value="">' . htmlspecialchars($prompts[1], ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '</option>';
}
$values_2 = array();
if (!empty($selected['1'])) {
function _renderVarDisplayDefault($form, $var, $vars)
{
return nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES,
- Horde_Nls::getCharset()));
+ $GLOBALS['registry']->getCharset()));
}
function _renderVarDisplay_html($form, $var, $vars)
return Horde::link($mail_link, $email_val)
. htmlspecialchars($display_email) . '</a>';
} else {
- return nl2br(htmlspecialchars($display_email, ENT_QUOTES, Horde_Nls::getCharset()));
+ return nl2br(htmlspecialchars($display_email, ENT_QUOTES, $GLOBALS['registry']->getCharset()));
}
}
if (count($values) == 0) {
return _("No values");
} elseif (isset($values[$value]) && $value != '') {
- return htmlspecialchars($values[$value], ENT_QUOTES, Horde_Nls::getCharset());
+ return htmlspecialchars($values[$value], ENT_QUOTES, $GLOBALS['registry']->getCharset());
}
}
if (count($values) == 0) {
return _("No values");
} elseif (isset($values[$var->getValue($vars)])) {
- return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, Horde_Nls::getCharset());
+ return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, $GLOBALS['registry']->getCharset());
}
}
$display[] = $name;
}
}
- return htmlspecialchars(implode(', ', $display), ENT_QUOTES, Horde_Nls::getCharset());
+ return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset());
}
}
$display[] = $name;
}
}
- return htmlspecialchars(implode(', ', $display), ENT_QUOTES, Horde_Nls::getCharset());
+ return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset());
}
}
}
}
- $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, Horde_Nls::getCharset()));
+ $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()));
if (!empty($mapurl)) {
$html .= ' ' . Horde::link(Horde::externalUrl($mapurl), $desc, null, '_blank') . Horde::img($icon, $desc) . '</a>';
}
function _renderVarDisplay_invalid($form, $var, $vars)
{
return '<p class="form-error form-inline">'
- . htmlspecialchars($var->type->message, ENT_QUOTES, Horde_Nls::getCharset())
+ . htmlspecialchars($var->type->message, ENT_QUOTES, $GLOBALS['registry']->getCharset())
. '</p>';
}
$selected = '';
}
$result .= ' <option value="';
- $result .= ($htmlchars) ? htmlspecialchars($value, ENT_QUOTES, Horde_Nls::getCharset()) : $value;
+ $result .= ($htmlchars) ? htmlspecialchars($value, ENT_QUOTES, $GLOBALS['registry']->getCharset()) : $value;
$result .= '"' . $selected . '>';
$result .= ($htmlchars) ? htmlspecialchars($display) : $display;
$result .= "</option>\n";
$selected = '';
}
$result .= " <option value=\""
- . htmlspecialchars($value, ENT_QUOTES, Horde_Nls::getCharset())
+ . htmlspecialchars($value, ENT_QUOTES, $GLOBALS['registry']->getCharset())
. "\"$selected>" . htmlspecialchars($display) . "</option>\n";
}
<?php
/**
* The Horde_Nls:: class provides Native Language Support. This includes
- * common methods for handling language detection and selection, timezones,
- * and hostname->country lookups.
+ * common methods for handling language data, timezones, and hostname->country
+ * lookups.
*
* Copyright 1999-2010 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Jon Parise <jon@horde.org>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @author Jan Schneider <jan@horde.org>
- * @author Michael Slusarz <slusarz@horde.org>
- * @package Nls
+ * @author Jon Parise <jon@horde.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Jan Schneider <jan@horde.org>
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @package Nls
*/
class Horde_Nls
{
/**
- * Config values.
+ * DNS resolver.
*
- * @var array
+ * @var Net_DNS_Resolver
*/
- static public $config = array();
+ static public $dnsResolver;
/**
* Cached values.
static protected $_cache = array();
/**
- * Selects the most preferred language for the current client session.
- *
- * @return string The selected language abbreviation.
- */
- static public function select()
- {
- $lang = Horde_Util::getFormData('new_lang');
-
- /* First, check if language pref is locked and, if so, set it to its
- * value */
- if (isset($GLOBALS['prefs']) &&
- $GLOBALS['prefs']->isLocked('language')) {
- $language = $GLOBALS['prefs']->getValue('language');
- /* Check if the user selected a language from the login screen */
- } elseif (!empty($lang) && self::isValid($lang)) {
- $language = $lang;
- /* Check if we have a language set in the session */
- } elseif (isset($_SESSION['horde_language'])) {
- $language = $_SESSION['horde_language'];
- /* Use site-wide default, if one is defined */
- } elseif (!empty(self::$config['defaults']['language'])) {
- $language = self::$config['defaults']['language'];
- /* Try browser-accepted languages. */
- } elseif (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
- /* The browser supplies a list, so return the first valid one. */
- $browser_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
- foreach ($browser_langs as $lang) {
- /* Strip quality value for language */
- if (($pos = strpos($lang, ';')) !== false) {
- $lang = substr($lang, 0, $pos);
- }
- $lang = self::_map(trim($lang));
- if (self::isValid($lang)) {
- $language = $lang;
- break;
- }
-
- /* In case there's no full match, save our best guess. Try
- * ll_LL, followed by just ll. */
- if (!isset($partial_lang)) {
- $ll_LL = Horde_String::lower(substr($lang, 0, 2)) . '_' . Horde_String::upper(substr($lang, 0, 2));
- if (self::isValid($ll_LL)) {
- $partial_lang = $ll_LL;
- } else {
- $ll = self::_map(substr($lang, 0, 2));
- if (self::isValid($ll)) {
- $partial_lang = $ll;
- }
- }
- }
- }
- }
-
- if (!isset($language)) {
- $language = isset($partial_lang)
- ? $partial_lang
- /* No dice auto-detecting, default to US English. */
- : 'en_US';
- }
-
- return basename($language);
- }
-
- /**
- * Sets the language.
- *
- * @param string $lang The language abbreviation.
- *
- * @throws Horde_Exception
- */
- static public function setLanguage($lang = null)
- {
- Horde::loadConfiguration('nls.php', null, 'horde');
-
- if (empty($lang) || !self::isValid($lang)) {
- $lang = self::select();
- }
-
- $_SESSION['horde_language'] = $lang;
-
- if (isset($GLOBALS['language'])) {
- if ($GLOBALS['language'] == $lang) {
- return;
- } elseif (isset($GLOBALS['registry'])) {
- $GLOBALS['registry']->clearCache();
- }
- }
- $GLOBALS['language'] = $lang;
-
- /* First try language with the current charset. */
- $lang_charset = $lang . '.' . self::getCharset();
- if ($lang_charset != setlocale(LC_ALL, $lang_charset)) {
- /* Next try language with its default charset. */
- $charset = empty(self::$config['charsets'][$lang])
- ? 'ISO-8859-1'
- : self::$config['charsets'][$lang];
- $lang_charset = $lang . '.' . $charset;
- self::_cachedCharset(0, $charset);
- if ($lang_charset != setlocale(LC_ALL, $lang_charset)) {
- /* At last try language solely. */
- $lang_charset = $lang;
- setlocale(LC_ALL, $lang_charset);
- }
- }
-
- @putenv('LC_ALL=' . $lang_charset);
- @putenv('LANG=' . $lang_charset);
- @putenv('LANGUAGE=' . $lang_charset);
- }
-
- /**
- * Sets the gettext domain.
- *
- * @param string $app The application name.
- * @param string $directory The directory where the application's
- * LC_MESSAGES directory resides.
- * @param string $charset The charset.
- */
- static public function setTextdomain($app, $directory, $charset)
- {
- bindtextdomain($app, $directory);
- textdomain($app);
-
- /* The existence of this function depends on the platform. */
- if (function_exists('bind_textdomain_codeset')) {
- self::_cachedCharset(0, bind_textdomain_codeset($app, $charset));
- }
-
- if (!headers_sent()) {
- header('Content-Type: text/html; charset=' . $charset);
- }
- }
-
- /**
- * Sets the language and reloads the whole NLS environment.
- *
- * When setting the language, the gettext catalogs have to be reloaded
- * too, charsets have to be updated etc. This method takes care of all
- * this.
- *
- * @param string $language The new language.
- * @param string $app The application for reloading the gettext
- * catalog. The current application if empty.
- */
- static public function setLanguageEnvironment($language = null, $app = null)
- {
- if (empty($app)) {
- $app = $GLOBALS['registry']->getApp();
- }
- self::setLanguage($language);
- self::setTextdomain(
- $app,
- $GLOBALS['registry']->get('fileroot', $app) . '/locale',
- self::getCharset()
- );
- Horde_String::setDefaultCharset(self::getCharset());
- }
-
- /**
- * Determines whether the supplied language is valid.
- *
- * @param string $language The abbreviated name of the language.
- *
- * @return boolean True if the language is valid, false if it's not
- * valid or unknown.
- */
- static public function isValid($language)
- {
- return !empty(self::$config['languages'][$language]);
- }
-
- /**
- * Maps languages with common two-letter codes (such as nl) to the
- * full gettext code (in this case, nl_NL). Returns the language
- * unmodified if it isn't an alias.
- *
- * @param string $language The language code to map.
- *
- * @return string The mapped language code.
- */
- static protected function _map($language)
- {
- // Translate the $language to get broader matches.
- // (eg. de-DE should match de_DE)
- $trans_lang = str_replace('-', '_', $language);
- $lang_parts = explode('_', $trans_lang);
- $trans_lang = Horde_String::lower($lang_parts[0]);
- if (isset($lang_parts[1])) {
- $trans_lang .= '_' . Horde_String::upper($lang_parts[1]);
- }
-
- // See if we get a match for this
- if (!empty(self::$config['aliases'][$trans_lang])) {
- return self::$config['aliases'][$trans_lang];
- }
-
- // If we get that far down, the language cannot be found.
- // Return $trans_lang.
- return $trans_lang;
- }
-
- /**
- * Returns the charset for the current language.
- *
- * @param boolean $original If true returns the original charset of the
- * translation, the actually used one otherwise.
- *
- * @return string The character set that should be used with the current
- * locale settings.
- */
- static public function getCharset($original = false)
- {
- /* Get cached results. */
- $cacheKey = intval($original);
- $charset = self::_cachedCharset($cacheKey);
- if (!is_null($charset)) {
- return $charset;
- }
-
- if ($original) {
- $charset = empty(self::$config['charsets'][$GLOBALS['language']])
- ? 'ISO-8859-1'
- : self::$config['charsets'][$GLOBALS['language']];
- } else {
- $browser = new Horde_Browser();
- if ($browser->hasFeature('utf') &&
- (Horde_Util::extensionExists('iconv') ||
- Horde_Util::extensionExists('mbstring'))) {
- $charset = 'UTF-8';
- }
- }
-
- if (is_null($charset)) {
- $charset = self::getExternalCharset();
- }
-
- self::_cachedCharset($cacheKey, $charset);
-
- return $charset;
- }
-
- /**
- * Returns the current charset of the environment
- *
- * @return string The character set that should be used with the current
- * locale settings.
- */
- static public function getExternalCharset()
- {
- /* Get cached results. */
- $charset = self::_cachedCharset(2);
- if (!is_null($charset)) {
- return $charset;
- }
-
- $lang_charset = setlocale(LC_ALL, 0);
- if (strpos($lang_charset, ';') === false &&
- strpos($lang_charset, '/') === false) {
- $lang_charset = explode('.', $lang_charset);
- if ((count($lang_charset) == 2) && !empty($lang_charset[1])) {
- self::_cachedCharset(2, $lang_charset[1]);
- return $lang_charset[1];
- }
- }
-
- return empty(self::$config['charsets'][$GLOBALS['language']])
- ? 'ISO-8859-1'
- : self::$config['charsets'][$GLOBALS['language']];
- }
-
- /**
- * Sets or returns the charset used under certain conditions.
- *
- * @param integer $index The ID of a cache slot. 0 for the UI charset, 1
- * for the translation charset and 2 for the
- * external charset.
- * @param string $charset If specified, this charset will be stored in the
- * given cache slot. Otherwise the content of the
- * specified cache slot will be returned.
- */
- static public function _cachedCharset($index, $charset = null)
- {
- if (is_null($charset)) {
- return isset(self::$_cache['charset'][$index])
- ? self::$_cache['charset'][$index]
- : null;
- } else {
- self::$_cache['charset'][$index] = $charset;
- }
- }
-
- /**
- * Returns the charset to use for outgoing emails.
- *
- * @return string The preferred charset for outgoing mails based on
- * the user's preferences and the current language.
- */
- static public function getEmailCharset()
- {
- $charset = $GLOBALS['prefs']->getValue('sending_charset');
- if (!empty($charset)) {
- return $charset;
- }
-
- return isset(self::$config['emails'][$GLOBALS['language']])
- ? self::$config['emails'][$GLOBALS['language']]
- : (isset(self::$config['charsets'][$GLOBALS['language']]) ? self::$config['charsets'][$GLOBALS['language']] : 'ISO-8859-1');
- }
-
- /**
* Check to see if character set is valid for htmlspecialchars() calls.
*
* @param string $charset The character set to check.
return false;
}
- if (isset(self::$_cache['check'][$charset])) {
- return self::$_cache['check'][$charset];
- } elseif (!isset($check)) {
- $check = array();
- }
-
$valid = true;
ini_set('track_errors', 1);
}
ini_restore('track_errors');
- self::$_cache['check'][$charset] = $valid;
-
return $valid;
}
/**
- * Sets the charset.
- *
- * In general, the applied charset is automatically determined by browser
- * language and browser capabilities and there's no need to manually call
- * setCharset. However for headless (RPC) operations the charset may be
- * set manually to ensure correct character conversion in the backend.
- *
- * @param string $charset If specified, this charset will be stored in the
- * given cache slot.
- * @param integer $index The ID of a cache slot. 0 for the UI charset, 1
- * for the translation charset and 2 for the
- * external charset. Defaults to 0: this is the
- * charset returned by getCharset and used for
- * conversion.
- */
- static public function setCharset($charset, $index = 0)
- {
- self::_cachedCharset($index, $charset);
- }
-
- /**
- * Sets the charset and reloads the whole NLS environment.
- *
- * When setting the charset, the gettext catalogs have to be reloaded too,
- * to match the new charset, among other things. This method takes care of
- * all this.
- *
- * @param string $charset The new charset.
- */
- static public function setCharsetEnvironment($charset)
- {
- unset($GLOBALS['language']);
- self::setCharset($charset);
- self::setLanguageEnvironment();
- }
-
- /**
* Returns a list of available timezones.
*
* @return array List of timezones.
}
/**
- * Sets the current timezone, if available.
- */
- static public function setTimeZone()
- {
- $tz = $GLOBALS['prefs']->getValue('timezone');
- if (!empty($tz)) {
- @date_default_timezone_set($tz);
- }
- }
-
- /**
* Get the locale info returned by localeconv(), but cache it, to
* avoid repeated calls.
*
if (!isset(self::$_cache['nl_info'])) {
self::$_cache['nl_info'] = array();
}
+
if (!isset(self::$_cache['nl_info'][$item])) {
self::$_cache['nl_info'][$item] = nl_langinfo($item);
}
+
return self::$_cache['nl_info'][$item];
}
/**
* Get country information from a hostname or IP address.
*
- * @param string $host The hostname or IP address.
- * @param Net_DNS_Resolver $dns A DNS resolver object used to look up the
- * hostname.
+ * @param string $host The hostname or IP address.
*
* @return mixed On success, return an array with the following entries:
* 'code' => Country Code
* 'name' => Country Name
* On failure, return false.
*/
- static public function getCountryByHost($host, $dns = null)
+ static public function getCountryByHost($host)
{
/* List of generic domains that we know is not in the country TLD
list. See: http://www.iana.org/gtld/gtld.htm */
$checkHost = $host;
if (preg_match('/^\d+\.\d+\.\d+\.\d+$/', $host)) {
- if (is_null($dns)) {
- $checkHost = @gethostbyaddr($host);
- } elseif ($response = $dns->query($host, 'PTR')) {
+ if (isset(self::$dnsResolver) &&
+ ($response = self::$dnsResolver->query($host, 'PTR'))) {
foreach ($response->answer as $val) {
if (isset($val->ptrdname)) {
$checkHost = $val->ptrdname;
break;
}
}
+ } else {
+ $checkHost = @gethostbyaddr($host);
}
}
}
/**
- * Returns a Horde image link to the country flag.
- *
- * @param string $host The hostname or IP address.
- * @param Net_DNS_Resolver $dns A DNS resolver object used to look up the
- * hostname.
- *
- * @return string The image URL, or the empty string on error.
- */
- static public function generateFlagImageByHost($host, $dns = null)
- {
- $data = self::getCountryByHost($host, $dns);
- if ($data === false) {
- return '';
- }
-
- $img = $data['code'] . '.png';
- return file_exists($GLOBALS['registry']->get('themesfs', 'horde') . '/graphics/flags/' . $img)
- ? Horde::img('flags/' . $img, $data['name'], array('title' => $data['name']))
- : '[' . $data['name'] . ']';
- }
-
- /**
* Returns either a specific or all ISO-3166 country names.
*
* @param string $code The ISO 3166 country code.
http://pear.php.net/dtd/package-2.0.xsd">
<name>Nls</name>
<channel>pear.horde.org</channel>
- <summary>Localization Package</summary>
- <description>TODO
+ <summary>This package provides Native Language Support (NLS).
+ </summary>
+ <description>Provide common methods for handling language data, timezones, and hostname->country lookups.
</description>
<lead>
<name>Chuck Hagenbuch</name>
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Initial Horde 4 package.
+ <notes>* Eliminate dependency on horde/Browser and horde/Core.
+ * Initial Horde 4 package.
</notes>
<contents>
<dir name="/">
<min>1.5.4</min>
</pearinstaller>
<package>
- <name>Browser</name>
- <channel>pear.horde.org</channel>
- </package>
- <package>
- <name>Core</name>
- <channel>pear.horde.org</channel>
- </package>
- <package>
<name>Util</name>
<channel>pear.horde.org</channel>
</package>
$text = $this->message;
if (!in_array('content.raw', $this->flags) && class_exists('Horde_Nls')) {
- $text = htmlspecialchars($text, ENT_COMPAT, Horde_Nls::getCharset());
+ $text = htmlspecialchars($text, ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
return $text;
if (!class_exists('Horde_Nls')) {
$this->markTestSkipped('The Horde_Nls class is not available!');
}
- Horde_Nls::setCharset('ISO-8859-1');
+ $GLOBALS['registry']->setCharset('ISO-8859-1');
$event = new Horde_Notification_Event_Status('<b>test</b>');
$this->assertEquals('<b>test</b>', (string) $event);
}
*/
public function getCharset()
{
- return Horde_Nls::getCharset();
+ return $GLOBALS['registry']->getCharset();
}
/**
global $conf;
if ($convert) {
- $val = $this->convertToDriver($val, Horde_Nls::getCharset());
+ $val = $this->convertToDriver($val, $GLOBALS['registry']->getCharset());
}
// If the preference's value is already equal to $val, don't
/* Default values have the current UI charset.
* Stored values have the backend charset. */
$value = $this->isDefault($pref)
- ? Horde_String::convertCharset($this->_prefs[$pref]['v'], Horde_Nls::getCharset(), Horde_Nls::getCharset())
- : $this->convertFromDriver($this->_prefs[$pref]['v'], Horde_Nls::getCharset());
+ ? Horde_String::convertCharset($this->_prefs[$pref]['v'], $GLOBALS['registry']->getCharset(), $GLOBALS['registry']->getCharset())
+ : $this->convertFromDriver($this->_prefs[$pref]['v'], $GLOBALS['registry']->getCharset());
} else {
$value = $this->_prefs[$pref]['v'];
}
if ($this->_scopes[$pref_scope][$name]['m'] & self::PREFS_DEFAULT) {
$this->_scopes[$pref_scope][$name]['v'] = $val;
} else {
- $this->_scopes[$pref_scope][$name]['v'] = $this->convertToDriver($val, Horde_Nls::getCharset());
+ $this->_scopes[$pref_scope][$name]['v'] = $this->convertToDriver($val, $GLOBALS['registry']->getCharset());
}
if (!($this->_scopes[$pref_scope][$name]['m'] & self::LOCKED)) {
$this->_scopes[$pref_scope][$name]['m'] |= self::DIRTY;
if (!($this->_identities = @unserialize($this->_prefs->getValue('identities', false)))) {
$this->_identities = $this->_prefs->getDefault('identities');
} else {
- $this->_identities = $this->_prefs->convertFromDriver($this->_identities, Horde_Nls::getCharset());
+ $this->_identities = $this->_prefs->convertFromDriver($this->_identities, $GLOBALS['registry']->getCharset());
}
$this->setDefault($this->_prefs->getValue('default_identity'));
{
$identities = $this->_identities;
if (is_array($identities)) {
- $identities = $this->_prefs->convertToDriver($identities, Horde_Nls::getCharset());
+ $identities = $this->_prefs->convertToDriver($identities, $GLOBALS['registry']->getCharset());
}
$this->_prefs->setValue('identities', serialize($identities), false);
$pref = @unserialize($this->_prefs->getValue('confirm_email', false));
$pref = $pref
- ? $this->_prefs->convertFromDriver($pref, Horde_Nls::getCharset())
+ ? $this->_prefs->convertFromDriver($pref, $GLOBALS['registry']->getCharset())
: array();
$pref[$hash] = $this->get($id);
- $pref = $this->_prefs->convertToDriver($pref, Horde_Nls::getCharset());
+ $pref = $this->_prefs->convertToDriver($pref, $GLOBALS['registry']->getCharset());
$this->_prefs->setValue('confirm_email', serialize($pref), false);
$new_addr = $this->getValue('from_addr', $id);
$body = new Horde_Mime_Part();
$body->setType('text/plain');
$body->setContents(Horde_String::wrap($message, 76, "\n"));
- $body->setCharset(Horde_Nls::getCharset());
+ $body->setCharset($GLOBALS['registry']->getCharset());
$body->send($new_addr, $msg_headers, $GLOBALS['injector']->getInstance('Horde_Mail'));
return array(_("Email addresses to confirm not found."), 'horde.message');
}
- $identity = $this->_prefs->convertFromDriver($confirm[$hash], Horde_Nls::getCharset());
+ $identity = $this->_prefs->convertFromDriver($confirm[$hash], $GLOBALS['registry']->getCharset());
$id = array_search($identity['id'], $this->getAll('id'));
if ($id === false) {
/* Adding a new identity. */
case 'mediumtext':
case 'longblob':
case 'longtext':
- return "nl2br(Horde_Text::linkUrls(Horde_Text_Filter::filter(\$zitem['$n'], 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), false, 'text'))";
+ return "nl2br(Horde_Text::linkUrls(Horde_Text_Filter::filter(\$zitem['$n'], 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), false, 'text'))";
case 'bool':
case 'boolean':
case 'mediumtext':
case 'longblob':
case 'longtext':
- return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), Horde_Nls::getCharset(), \$this->_params['charset'])";
+ return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), $GLOBALS['registry']->getCharset(), \$this->_params['charset'])";
// Integer types
case 'bit':
function __construct($request, $params = array())
{
parent::__construct($request, $params);
- Horde_Nls::setCharsetEnvironment('UTF-8');
+ $GLOBALS['registry']->setCharsetEnvironment('UTF-8');
}
/**
*/
public function __construct($request, $params = array())
{
- Horde_Nls::setCharset('UTF-8');
+ $GLOBALS['registry']->setCharset('UTF-8');
parent::__construct($request, $params);
// Handle certain standard properties specially
if (in_array('displayname', $properties['DAV:'])) {
- $props[] = $this->mkprop('displayname', Horde_String::convertCharset($item['name'], Horde_Nls::getCharset(), 'UTF-8'));
+ $props[] = $this->mkprop('displayname', Horde_String::convertCharset($item['name'], $GLOBALS['registry']->getCharset(), 'UTF-8'));
unset($properties['DAV:']['displayname']);
}
if (in_array('getlastmodified', $properties['DAV:'])) {
foreach ($data as $key => $value) {
if (substr($key, 0, 9) == 'attribute') {
$data[$key] = Horde_String::convertCharset(
- $data[$key], Horde_Nls::getCharset(), $this->_params['charset']);
+ $data[$key], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
}
throw new Horde_Exception('Spellcheck failed. Command line: ' . $this->_cmd());
}
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
// Write to stdin.
if ($this->_encoding) {
{
parent::setCharset($charset);
- Horde_Nls::setCharset($this->getCharset());
+ $GLOBALS['registry']->setCharset($this->getCharset());
Horde_String::setDefaultCharset($this->getCharset());
}
require_once dirname(__FILE__) . '/../../../lib/Application.php';
Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true, 'session_control' => 'none'));
Horde_String::setDefaultCharset('UTF-8');
- Horde_Nls::setCharset('UTF-8');
+ $registry->setCharset('UTF-8');
}
if (!empty($testsetuponly)) {
);
Horde::addInlineScript(array(
- 'window.' . $this->_instance . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ')',
+ 'window.' . $this->_instance . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')',
$this->renderNodeDefinitions()
), 'dom');
{
$this->_buildIndents($this->_root_nodes);
- return 'window.' . $this->_instance . '.renderTree(' . Horde_Serialize::serialize($this->_nodes, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ',' . Horde_Serialize::serialize($this->_root_nodes, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ',' . ($this->_static ? 'true' : 'false') . ');';
+ return 'window.' . $this->_instance . '.renderTree(' . Horde_Serialize::serialize($this->_nodes, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ',' . Horde_Serialize::serialize($this->_root_nodes, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ',' . ($this->_static ? 'true' : 'false') . ');';
}
}
--- /dev/null
+<?php
+/**
+ * The Horde_Ui_FlagImage:: class provides a widget for linking to a flag
+ * image.
+ *
+ * Copyright 2003-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 Michael Slusarz <slusarz@horde.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @package Ui
+ */
+class Horde_Ui_FlagImage
+{
+ /**
+ * Render the language selection.
+ *
+ * @param boolean $form Return the selection box as a complete standalone
+ * form.
+ *
+ * @return string The HTML selection box.
+ */
+ static public function generateFlagImageByHost($host)
+ {
+ $data = Horde_Nls::getCountryByHost($host);
+ if ($data === false) {
+ return '';
+ }
+
+ $img = $data['code'] . '.png';
+ return file_exists($GLOBALS['registry']->get('themesfs', 'horde') . '/graphics/flags/' . $img)
+ ? Horde::img('flags/' . $img, $data['name'], array('title' => $data['name']))
+ : '[' . $data['name'] . ']';
+ }
+
+}
Horde::addScriptFile('calendar.js', 'horde');
Horde::addInlineScript(array(
'Horde_Calendar.firstDayOfWeek = ' . (isset($GLOBALS['prefs']) ? intval($GLOBALS['prefs']->getValue('first_week_day')) : 1),
- 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, Horde_Nls::getCharset()),
- 'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, Horde_Nls::getCharset()),
+ 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
+ 'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
));
}
$html = '';
if (!$GLOBALS['prefs']->isLocked('language')) {
- $_SESSION['horde_language'] = Horde_Nls::select();
+ $_SESSION['horde_language'] = $GLOBALS['registry']->preferredLang();
$html = sprintf('<form name="language" action="%s">',
Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/language.php', false, -1));
$html .= '<input type="hidden" name="url" value="' . @htmlspecialchars(Horde::selfUrl(false, false, true)) . '" />';
public function __construct($params = array())
{
$this->_params = $params;
- $this->_charset = Horde_Nls::getCharset();
+ $this->_charset = $GLOBALS['registry']->getCharset();
}
/**
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Initial Horde 4 package.
+ <notes>* Added Horde_Ui_FlagImage::.
+ * Initial Horde 4 package.
</notes>
<contents>
<dir name="/">
<file name="Html.php" role="php" />
<file name="TablesetHtml.php" role="php" />
</dir> <!-- /lib/Horde/Ui/VarRenderer -->
+ <file name="FlagImage.php" role="php" />
<file name="JsCalendar.php" role="php" />
<file name="Language.php" role="php" />
<file name="Pager.php" role="php" />
<pearinstaller>
<min>1.7.0</min>
</pearinstaller>
+ <package>
+ <name>Core</name>
+ <channel>pear.horde.org</channel>
+ </package>
+ <package>
+ <name>Nls</name>
+ <channel>pear.horde.org</channel>
+ </package>
</required>
</dependencies>
<phprelease>
<filelist>
<install name="lib/Horde/Ui/VarRenderer/Html.php" as="Horde/Ui/VarRenderer/Html.php" />
<install name="lib/Horde/Ui/VarRenderer/TablesetHtml.php" as="Horde/Ui/VarRenderer/TablesetHtml.php" />
+ <install name="lib/Horde/Ui/FlagImage.php" as="Horde/Ui/FlagImage.php" />
<install name="lib/Horde/Ui/JsCalendar.php" as="Horde/Ui/JsCalendar.php" />
<install name="lib/Horde/Ui/Language.php" as="Horde/Ui/Language.php" />
<install name="lib/Horde/Ui/Pager.php" as="Horde/Ui/Pager.php" />
// Add CHARSET as well. At least the synthesis client
// gets confused otherwise
if (empty($params['CHARSET'])) {
- $params['CHARSET'] = Horde_Nls::getCharset();
+ $params['CHARSET'] = $GLOBALS['registry']->getCharset();
$params_str .= ';CHARSET=' . $params['CHARSET'];
}
}
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php
-$charset = Horde_Nls::getCharset();
+$charset = $GLOBALS['registry']->getCharset();
/* Variables used in core javascript files. */
$var = array(
}
$now = time();
$timers[$now] = array('name' => Horde_String::convertCharset($vars->get('description'),
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
$prefs->getCharset()),
'time' => $now);
$prefs->setValue('running_timers', serialize($timers), false);
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
} else {
$host = @gethostbyaddr($data['remoteAddr']);
}
- $entry[_("Remote Host:")] = $host . ' [' . $data['remoteAddr'] . '] ' . Horde_Nls::generateFlagImageByHost($host, $injector->getInstance('Net_DNS_Resolver'));
+ $entry[_("Remote Host:")] = $host . ' [' . $data['remoteAddr'] . '] ' . Horde_Ui_FlagImage::generateFlagImageByHost($host);
}
echo '<li><div class="sesstoggle">' . $plus . $minus . htmlspecialchars($data['userid']) . ' [' . htmlspecialchars($id) . ']'
}
if ($fp = @fopen($path . '/conf.php', 'w')) {
/* Can write, so output to file. */
- fwrite($fp, Horde_String::convertCharset($php, Horde_Nls::getCharset(), 'iso-8859-1'));
+ fwrite($fp, Horde_String::convertCharset($php, $GLOBALS['registry']->getCharset(), 'iso-8859-1'));
fclose($fp);
$notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
$registry->clearCache();
$data .= Horde_String::convertCharset(str_replace(array('\\', '\''),
array('\\\\', '\\\''),
$php),
- Horde_Nls::getCharset(), 'iso-8859-1');
+ $GLOBALS['registry']->getCharset(), 'iso-8859-1');
$data .= '\');' . "\n";
$data .= ' fclose($fp);' . "\n";
$data .= ' echo \'' . sprintf('Saved %s configuration.', $app) . '\' . "\n";' . "\n";
}
// Parse out the query results.
- $result = $dbh->query(Horde_String::convertCharset($command, Horde_Nls::getCharset(), $conf['sql']['charset']));
+ $result = $dbh->query(Horde_String::convertCharset($command, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']));
}
if (isset($result)) {
// $ldapPort = '389';
// $searchBase = 'ou=people,o=example.com';
// $ldapcharset = 'utf-8';
-// $outputcharset = Horde_Nls::getCharset();
+// $outputcharset = $GLOBALS['registry']->getCharset();
//
// $ds = @ldap_connect($ldapServer, $ldapPort);
//
// $fields = $values = array();
// foreach ($extra as $field => $value) {
// $fields[] = 'object_' . Horde_String::lower($field);
-// $values[] = $db->quote(Horde_String::convertCharset($value, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']));
+// $values[] = $db->quote(Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']));
// }
// $fields[] = 'object_id';
// $values[] = $db->quote($userId);
<?php
/**
* NLS (National Language Support) configuration file.
+ *
+ * Local overrides should be placed in config/nls.local.php.
+ *
+ * $Id$
*/
-Horde_Nls::$config = array(
+$horde_nls_config = array(
/* Defaults */
'defaults' => array(
/* The language to fall back on if we cannot determine one any other
);
/* Sort encodings. */
-asort(Horde_Nls::$config['encodings']);
+asort($horde_nls_config['encodings']);
/* BSD charsets. */
if (strpos(PHP_OS, 'BSD') !== false) {
- Horde_Nls::$config['charsets'] = array_merge(Horde_Nls::$config['charsets'], array(
+ $horde_nls_config['charsets'] = array_merge($horde_nls_config['charsets'], array(
'bs_BA' => 'ISO8859-2',
'cs_CZ' => 'ISO8859-2',
'el_GR' => 'ISO8859-7',
/* Turkish locales. */
if (version_compare(PHP_VERSION, '6', 'ge')) {
- Horde_Nls::$config['aliases']['tr'] = 'tr_TR';
- Horde_Nls::$config['charsets']['tr_TR'] = (strpos(PHP_OS, 'BSD') === false) ? 'ISO-8859-9' : 'ISO8859-9';
- Horde_Nls::$config['languages']['tr_TR'] = 'Türkçe';
- Horde_Nls::$config['spelling']['tr_TR'] = '-d tr';
+ $horde_nls_config['aliases']['tr'] = 'tr_TR';
+ $horde_nls_config['charsets']['tr_TR'] = (strpos(PHP_OS, 'BSD') === false) ? 'ISO-8859-9' : 'ISO8859-9';
+ $horde_nls_config['languages']['tr_TR'] = 'Türkçe';
+ $horde_nls_config['spelling']['tr_TR'] = '-d tr';
}
/* Local overrides. */
}
// Set the timezone variable, if available.
- Horde_Nls::setTimeZone();
+ $GLOBALS['registry']->setTimeZone();
list($lat, $long) = explode(':', $this->_params['location']);
$rise = $this->_calculateSunset(time(), $lat, $long, false, floor(date('Z') / 3600));
}
// Set the timezone variable, if available.
- Horde_Nls::setTimeZone();
+ $GLOBALS['registry']->setTimeZone();
$html = '<div style="font-size:200%; font-weight:bold; text-align:center">' .
strftime('%A, %B %d, %Y ');
Horde::addInlineScript($script, 'dom');
/* Get the user's most recent tweet */
- $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, Horde_Nls::getCharset());
+ $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, $GLOBALS['registry']->getCharset());
// Bring in the Facebook CSS
$csslink = $GLOBALS['registry']->get('themesuri', 'horde') . '/facebook.css';
case 'language':
if (!$prefs->isLocked('language')) {
- $ui->override['language'] = Horde_Nls::$config['languages'];
+ $ui->override['language'] = $registry->nlsconfig['languages'];
array_unshift($ui->override['language'], _("Default"));
}
if ($prefs->isDirty('language')) {
if ($prefs->isDirty('language')) {
- Horde_Nls::setLanguageEnvironment($prefs->getValue('language'));
+ $registry->setLanguageEnvironment($prefs->getValue('language'));
foreach ($registry->listAPIs() as $api) {
if ($registry->hasMethod($api . '/changeLanguage')) {
$registry->call($api . '/changeLanguage');
* frame. */
if ($old_sidebar) {
Horde::addInlineScript(
- 'window.parent.frames.location = ' . Horde_Serialize::serialize((string)$url, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ';'
+ 'window.parent.frames.location = ' . Horde_Serialize::serialize((string)$url, Horde_Serialize::JSON, $registry->getCharset()) . ';'
);
} else {
Horde::redirect($url);
}
$registry->setupSessionHandler();
-
- Horde_Nls::setLanguageEnvironment($language, $vars->app);
+ $registry->setLanguageEnvironment($language, $vars->app);
/* Hook to preselect the correct language in the widget. */
$_GET['new_lang'] = $language;
} else {
$new_lang = Horde_Util::getGet('new_lang');
if ($new_lang) {
- Horde_Nls::setLanguageEnvironment($new_lang);
+ $registry->setLanguageEnvironment($new_lang);
}
}
/* Build the <select> widget containing the available languages. */
if (!$is_auth && !$prefs->isLocked('language')) {
- $_SESSION['horde_language'] = Horde_Nls::select();
+ $_SESSION['horde_language'] = $registry->preferredLang($vars->new_lang);
$langs = array();
- foreach (Horde_Nls::$config['languages'] as $key => $val) {
+ foreach ($registry->nlsconfig['languages'] as $key => $val) {
$langs[] = array(
'sel' => ($key == $_SESSION['horde_language']),
'val' => $key,
$parents = implode(':', array_keys($parents));
$params = array($id,
- Horde_String::convertCharset($object->name, Horde_Nls::getCharset(), $conf['sql']['charset']),
- Horde_String::convertCharset($parents, Horde_Nls::getCharset(), $conf['sql']['charset']),
- Horde_String::convertCharset($object->get('email'), Horde_Nls::getCharset(), $conf['sql']['charset']),
+ 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']),
);
$result = $db->query($group_query, $params);
if (is_a($result, 'PEAR_Error')) {
Horde_Registry::appInit('horde');
/* Set the language. */
-$_SESSION['horde_language'] = Horde_Nls::select();
+$_SESSION['horde_language'] = $registry->preferredLanguage(Horde_Util::getForm('new_lang'));
$prefs->setValue('language', $_SESSION['horde_language']);
/* Update apps language */
// 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=' . Horde_Nls::getCharset());
+ header('Content-Type: text/html; charset=' . $GLOBALS['registry']->getCharset());
$row = Horde_Util::getFormData('row');
$col = Horde_Util::getFormData('col');
if (!is_null($row) && !is_null($col) && !empty($layout_pref[$row][$col])) {
// If we're serving a request to the JS update client, just render the
// updated node javascript.
if (Horde_Util::getFormData('httpclient')) {
- header('Content-Type: application/json; charset=' . Horde_Nls::getCharset());
+ header('Content-Type: application/json; charset=' . $GLOBALS['registry']->getCharset());
$scripts = array(
$tree->renderNodeDefinitions(),
'$(\'horde_menu\').setStyle({ width: \'auto\', height: \'auto\' });');
'body' => $body,
'to' => $conf['problems']['email'],
'from' => $email,
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
$mail->addHeader('Sender', 'horde-problem@' . $conf['problems']['maildomain']);
/* Add attachment. */
$password),
'to' => $email,
'from' => $email,
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
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');
/* These are all referencing the *original* tweet */
$profileLink = Horde::externalUrl('http://twitter.com/' . htmlspecialchars($tweetObj->user->screen_name), true);
$profileImg = $tweetObj->user->profile_image_url;
- $authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, Horde_Nls::getCharset());
- $authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, Horde_Nls::getCharset());
+ $authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
$createdAt = $tweetObj->created_at;
$appText = Horde_Text_Filter::filter($tweet->source, 'xss', array());
<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, Horde_Nls::getCharset()) ?>" />
+<input type="submit" class="button" value="<?php echo htmlspecialchars(sprintf(_("Save \"%s\""), $group->getShortName()), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>" />
</p>
<br />
<?php
if (isset($GLOBALS['language'])) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
/* Ignore missing addresses, which are returned as <>. */
if (strlen($mail_address) > 2) {
$mail_address_full = $mail_identity->getDefaultFromAddress(true);
- Horde_Nls::setTimeZone();
- Horde_Nls::setLanguageEnvironment();
+ $registry->setTimeZone();
+ $registry->setLanguageEnvironment();
/* Set up the mail headers and read the log file. */
$msg_headers = new Horde_Mime_Headers();
$msg = new Horde_Mime_Part();
$msg->setType('text/plain');
- $msg->setCharset(Horde_Nls::getCharset());
+ $msg->setCharset($registry->getCharset());
$d_url = new Horde_Url(Horde::selfUrl(true, false, true));
$msg->setContents(Horde_String::wrap(sprintf(_("Your linked attachment has been downloaded by at least one user.\n\nAttachment name: %s\nAttachment date: %s\n\nClick on the following link to permanently delete the attachment:\n%s"), $file_name, date('r', $time_stamp), $d_url->add('d', $id))));
*/
require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('imp', array('impmode' => 'dimp'));
+Horde_Registry::appInit('imp', array(
+ 'impmode' => 'dimp',
+ 'timezone' => true
+));
-Horde_Nls::setTimeZone();
$vars = Horde_Variables::getDefaultVariables();
/* Determine if compose mode is disabled. */
*/
require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('imp', array('impmode' => 'mimp'));
+Horde_Registry::appInit('imp', array(
+ 'impmode' => 'mimp',
+ 'timezone' => true
+));
-Horde_Nls::setTimeZone();
$vars = Horde_Variables::getDefaultVariables();
/* The message text and headers. */
switch ($vars->a) {
case _("Save Draft"):
try {
- $notification->push($imp_compose->saveDraft($header, $message, Horde_Nls::getCharset(), false), 'horde.success');
+ $notification->push($imp_compose->saveDraft($header, $message, $registry->getCharset(), false), 'horde.success');
if ($prefs->getValue('close_draft')) {
$imp_compose->destroy('save_draft');
require IMP_BASE . '/mailbox-mimp.php';
);
try {
- if ($imp_compose->buildAndSendMessage($message, $header, Horde_Nls::getEmailCharset(), false, $options)) {
+ if ($imp_compose->buildAndSendMessage($message, $header, $GLOBALS['registry']->getEmailCharset(), false, $options)) {
$imp_compose->destroy('send');
$notification->push(_("Message sent successfully."), 'horde.success');
require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('imp', array('session_control' => 'netscape'));
-Horde_Nls::setTimeZone();
+$registry->setTimeZone();
/* The message headers and text. */
$header = array();
* $encoding - best guessed charset offered to the user as the default value
* in the charset dropdown list. */
$charset = $prefs->isLocked('sending_charset')
- ? Horde_Nls::getEmailCharset()
+ ? $registry->getEmailCharset()
: $vars->charset;
$encoding = empty($charset)
- ? Horde_Nls::getEmailCharset()
+ ? $registry->getEmailCharset()
: $charset;
/* Is this a popup window? */
if (in_array($vars->actionID, array('auto_save_draft', 'save_draft'))) {
if (!$readonly_drafts) {
try {
- $result = $imp_compose->saveDraft($header, $message, Horde_Nls::getCharset(), $rtemode);
+ $result = $imp_compose->saveDraft($header, $message, $registry->getCharset(), $rtemode);
/* Closing draft if requested by preferences. */
if ($vars->actionID == 'save_draft') {
$t->set('charset_label', Horde::label('charset', _("C_harset")));
$t->set('charset_tabindex', ++$tabindex);
$charset_array = array();
- foreach (Horde_Nls::$config['encodings'] as $charset => $label) {
+ foreach ($registry->nlsconfig['encodings'] as $charset => $label) {
$charset_array[] = array('value' => $charset, 'selected' => (strtolower($charset) == strtolower($encoding)), 'label' => $label);
}
$t->set('charset_array', $charset_array);
'value' => '',
'shared' => true,
'type' => 'enum',
- 'enum' => array_merge(array('' => _("Default")), Horde_Nls::$config['encodings']),
+ 'enum' => array_merge(array('' => _("Default")), $GLOBALS['registry']->nlsconfig['encodings']),
'desc' => _("Your default charset for sending messages:")
);
// default message character set
$_prefs['default_msg_charset'] = array(
- 'value' => isset($GLOBALS['nls']['emails'][$GLOBALS['language']])
- ? $GLOBALS['nls']['emails'][$GLOBALS['language']]
- : (isset($GLOBALS['nls']['charsets'][$GLOBALS['language']])
- ? $GLOBALS['nls']['charsets'][$GLOBALS['language']]
+ 'value' => isset($GLOBALS['registry']->nlsconfig['emails'][$GLOBALS['language']])
+ ? $GLOBALS['registry']->nlsconfig['emails'][$GLOBALS['language']]
+ : (isset($GLOBALS['registry']->nlsconfig['charsets'][$GLOBALS['language']])
+ ? $GLOBALS['registry']->nlsconfig['charsets'][$GLOBALS['language']]
: ''),
'type' => 'enum',
'enum' => array_merge(
- array('' => _("Default (US-ASCII)")), Horde_Nls::$config['encodings']
+ array('' => _("Default (US-ASCII)")), $GLOBALS['registry']->nlsconfig['encodings']
),
'desc' => _("The default charset for messages with no charset information:"),
'help' => 'prefs-default_msg_charset'
$selected_addresses = array();
foreach (explode('|', $vars->sa) as $addr) {
if (strlen(trim($addr))) {
- $selected_addresses[] = @htmlspecialchars($addr, ENT_QUOTES, Horde_Nls::getCharset());
+ $selected_addresses[] = @htmlspecialchars($addr, ENT_QUOTES, $registry->getCharset());
}
}
foreach ($addresses as $addr) {
if (!empty($addr['email'])) {
if (strpos($addr['email'], ',') !== false) {
- $a_list[] = @htmlspecialchars(Horde_Mime_Address::encode($addr['name'], 'personal') . ': ' . $addr['email'] . ';', ENT_QUOTES, Horde_Nls::getCharset());
+ $a_list[] = @htmlspecialchars(Horde_Mime_Address::encode($addr['name'], 'personal') . ': ' . $addr['email'] . ';', ENT_QUOTES, $registry->getCharset());
} else {
$mbox_host = explode('@', $addr['email']);
if (isset($mbox_host[1])) {
- $a_list[] = @htmlspecialchars(Horde_Mime_Address::writeAddress($mbox_host[0], $mbox_host[1], $addr['name']), ENT_QUOTES, Horde_Nls::getCharset());
+ $a_list[] = @htmlspecialchars(Horde_Mime_Address::writeAddress($mbox_host[0], $mbox_host[1], $addr['name']), ENT_QUOTES, $registry->getCharset());
}
}
}
$subscribe = $prefs->getValue('subscribe');
$showAll = (!$subscribe || $_SESSION['imp']['showunsub']);
-$charset = Horde_Nls::getCharset();
+$charset = $registry->getCharset();
/* Get the base URL for this page. */
$folders_url = Horde::selfUrl();
$a_template->set('go', _("Go"));
}
-$a_template->set('create_folder', !empty($GLOBALS['conf']['hooks']['permsdenied']) || ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('create_folders') && $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders')));
+$a_template->set('create_folder', !empty($conf['hooks']['permsdenied']) || ($injector->getInstance('Horde_Perms')->hasAppPermission('create_folders') && $injector->getInstance('Horde_Perms')->hasAppPermission('max_folders')));
if ($prefs->getValue('subscribe')) {
$a_template->set('subscribe', true);
$subToggleText = ($showAll) ? _("Hide Unsubscribed") : _("Show Unsubscribed");
$imptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree');
$imptree->eltDiffStart();
- $new = Horde_String::convertCharset($this->_vars->mbox, Horde_Nls::getCharset(), 'UTF7-IMAP');
+ $new = Horde_String::convertCharset($this->_vars->mbox, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
try {
$new = $imptree->createMailboxName($this->_vars->parent, $new);
$result = false;
try {
- $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), Horde_Nls::getCharset(), 'UTF7-IMAP');
+ $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
if (($this->_vars->old_name != $new) &&
$GLOBALS['injector']->getInstance('IMP_Folder')->rename($this->_vars->old_name, $new)) {
try {
// TODO: Use 'sending_charset'
- $sent = $imp_compose->buildAndSendMessage($this->_vars->message, $headers, Horde_Nls::getEmailCharset(), $this->_vars->html, $options);
+ $sent = $imp_compose->buildAndSendMessage($this->_vars->message, $headers, $GLOBALS['registry']->getEmailCharset(), $this->_vars->html, $options);
} catch (IMP_Compose_Exception $e) {
$result->success = 0;
}
try {
- $res = $imp_compose->saveDraft($headers, $this->_vars->message, Horde_Nls::getCharset(), $this->_vars->html);
+ $res = $imp_compose->saveDraft($headers, $this->_vars->message, $GLOBALS['registry']->getCharset(), $this->_vars->html);
if ($this->_action == 'autoSaveDraft') {
$GLOBALS['notification']->push(_("Draft automatically saved."), 'horde.message');
} else {
if (!isset($addrlist)) {
$addrlist = IMP_Compose::getAddressList();
}
- Horde::addInlineScript('if (!window.IMP) window.IMP = {}; IMP.ac_list = '. Horde_Serialize::serialize($addrlist, Horde_Serialize::JSON, Horde_Nls::getCharset()));
+ Horde::addInlineScript('if (!window.IMP) window.IMP = {}; IMP.ac_list = '. Horde_Serialize::serialize($addrlist, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()));
self::$_listOutput = true;
}
if (empty($indices)) {
$html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
} else {
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$imp_ui = new IMP_Ui_Mailbox('INBOX');
$shown = empty($this->_params['msgs_shown'])
? 3
$mdn->addMDNRequestHeaders($headers, $barefrom);
}
- $browser_charset = Horde_Nls::getCharset();
+ $browser_charset = $GLOBALS['registry']->getCharset();
$headers->addHeader('From', Horde_String::convertCharset($header['from'], $browser_charset, $charset));
$headers_result = Horde::loadConfiguration('header.php', '_header');
if (is_array($headers_result)) {
foreach ($headers_result as $key => $val) {
- $headers->addHeader(trim($key), Horde_String::convertCharset(trim($val), Horde_Nls::getCharset(), $charset));
+ $headers->addHeader(trim($key), Horde_String::convertCharset(trim($val), $GLOBALS['registry']->getCharset(), $charset));
}
}
} catch (Horde_Exception $e) {}
}
try {
- $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], Horde_Nls::getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags)));
+ $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], $GLOBALS['registry']->getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags)));
} catch (Horde_Imap_Client_Exception $e) {
$notification->push(sprintf(_("Message sent successfully, but not saved to %s"), IMP::displayFolder($opts['sent_folder'])));
$sent_saved = false;
try {
$error = Horde::callHook('perms_denied', array('imp:max_timelimit'));
} catch (Horde_Exception_HookNotSet $e) {
- $error = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients within %d hours."), $timelimit, $GLOBALS['conf']['sentmail']['params']['limit_period']), ENT_COMPAT, Horde_Nls::getCharset());
+ $error = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients within %d hours."), $timelimit, $GLOBALS['conf']['sentmail']['params']['limit_period']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
throw new IMP_Compose_Exception($error);
}
try {
$message = Horde::callHook('perms_denied', array('imp:max_recipients'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients."), $max_recipients), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients."), $max_recipients), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
throw new IMP_Compose_Exception($message);
}
// Convert IDN hosts to ASCII.
if (Horde_Util::extensionExists('idn')) {
$old_error = error_reporting(0);
- $host = idn_to_ascii(Horde_String::convertCharset($host, Horde_Nls::getCharset(), 'UTF-8'));
+ $host = idn_to_ascii(Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8'));
error_reporting($old_error);
} elseif (Horde_Mime::is8bit($ob['mailbox'])) {
throw new IMP_Compose_Exception(sprintf(_("Invalid character in e-mail address: %s."), $email));
protected function _createMimeMessage($to, $body, $charset,
$options = array())
{
- $nls_charset = Horde_Nls::getCharset();
+ $nls_charset = $GLOBALS['registry']->getCharset();
$body = Horde_String::convertCharset($body, $nls_charset, $charset);
if (!empty($options['html'])) {
return array(
'body' => $msg,
- 'encoding' => isset($msg_text) ? $msg_text['encoding'] : Horde_Nls::getCharset(),
+ 'encoding' => isset($msg_text) ? $msg_text['encoding'] : $GLOBALS['registry']->getCharset(),
'format' => $format,
'headers' => $header,
'identity' => $this->_getMatchingIdentity($h),
$resent_headers->addHeader('Resent-To', $recip['header']['to']);
$resent_headers->addHeader('Resent-Message-ID', Horde_Mime::generateMessageId());
- $header_text = trim($resent_headers->toString(array('encode' => Horde_Nls::getCharset()))) . "\n" . trim($contents->getHeaderOb(false));
+ $header_text = trim($resent_headers->toString(array('encode' => $GLOBALS['registry']->getCharset()))) . "\n" . trim($contents->getHeaderOb(false));
$to = $this->_prepSendMessage($recipients);
- $hdr_array = $headers->toArray(array('charset' => Horde_Nls::getCharset()));
+ $hdr_array = $headers->toArray(array('charset' => $GLOBALS['registry']->getCharset()));
$hdr_array['_raw'] = $header_text;
try {
$headerob = $contents->getHeaderOb();
$part = new Horde_Mime_Part();
- $part->setCharset(Horde_Nls::getCharset());
+ $part->setCharset($GLOBALS['registry']->getCharset());
$part->setType('message/rfc822');
$part->setName(_("Forwarded Message"));
$part->setContents($contents->fullMessageText(array('stream' => true)));
if ($part->getPrimaryType() == 'text') {
if ($analyzetype = Horde_Mime_Magic::analyzeFile($tempfile, empty($conf['mime']['magic_db']) ? null : $conf['mime']['magic_db'], array('nostrip' => true))) {
$analyzetype = Horde_Mime::decodeParam('Content-Type', $analyzetype);
- $part->setCharset(isset($analyzetype['params']['charset']) ? $analyzetype['params']['charset'] : Horde_Nls::getCharset());
+ $part->setCharset(isset($analyzetype['params']['charset']) ? $analyzetype['params']['charset'] : $GLOBALS['registry']->getCharset());
} else {
- $part->setCharset(Horde_Nls::getCharset());
+ $part->setCharset($GLOBALS['registry']->getCharset());
}
} else {
- $part->setHeaderCharset(Horde_Nls::getCharset());
+ $part->setHeaderCharset($GLOBALS['registry']->getCharset());
}
$part->setName($filename);
$part->setBytes($_FILES[$name]['size']);
'/%r/' => $h->getValue('date'),
/* Date as ddd, dd mmm yyyy. */
- '/%d/' => Horde_String::convertCharset(strftime("%a, %d %b %Y", $udate), Horde_Nls::getExternalCharset()),
+ '/%d/' => Horde_String::convertCharset(strftime("%a, %d %b %Y", $udate), $GLOBALS['registry']->getExternalCharset()),
/* Date in locale's default. */
- '/%x/' => Horde_String::convertCharset(strftime("%x", $udate), Horde_Nls::getExternalCharset()),
+ '/%x/' => Horde_String::convertCharset(strftime("%x", $udate), $GLOBALS['registry']->getExternalCharset()),
/* Date and time in locale's default. */
- '/%c/' => Horde_String::convertCharset(strftime("%c", $udate), Horde_Nls::getExternalCharset()),
+ '/%c/' => Horde_String::convertCharset(strftime("%c", $udate), $GLOBALS['registry']->getExternalCharset()),
/* Message-ID. */
'/%m/' => $message_id,
$fullpath = sprintf('%s/%s/%d', self::VFS_LINK_ATTACH_PATH, $auth, $ts);
$charset = $part->getCharset();
- $trailer = Horde_String::convertCharset(_("Attachments"), Horde_Nls::getCharset(), $charset);
+ $trailer = Horde_String::convertCharset(_("Attachments"), $GLOBALS['registry']->getCharset(), $charset);
if ($prefs->getValue('delete_attachments_monthly')) {
/* Determine the first day of the month in which the current
* attachments will be ripe for deletion, then subtract 1 second
* to obtain the last day of the previous month. */
$del_time = mktime(0, 0, 0, date('n') + $prefs->getValue('delete_attachments_monthly_keep') + 1, 1, date('Y')) - 1;
- $trailer .= Horde_String::convertCharset(' (' . sprintf(_("Links will expire on %s"), strftime('%x', $del_time)) . ')', Horde_Nls::getCharset(), $charset);
+ $trailer .= Horde_String::convertCharset(' (' . sprintf(_("Links will expire on %s"), strftime('%x', $del_time)) . ')', $GLOBALS['registry']->getCharset(), $charset);
}
foreach ($this->getAttachments() as $att) {
$part = $contents->getMIMEPart($body_id);
$type = $part->getType();
$part_charset = $part->getCharset();
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$msg = Horde_String::convertCharset($part->getContents(), $part_charset);
/* Enforce reply limits. */
}
/* Determine default encoding. */
- $encoding = Horde_Nls::getEmailCharset();
+ $encoding = $GLOBALS['registry']->getEmailCharset();
if (($charset == 'UTF-8') &&
(strcasecmp($part_charset, 'US-ASCII') !== 0) &&
(strcasecmp($part_charset, $encoding) !== 0)) {
$part = new Horde_Mime_Part();
$part->setType('text/x-vcard');
- $part->setCharset(Horde_Nls::getCharset());
+ $part->setCharset($GLOBALS['registry']->getCharset());
$part->setContents($vcard);
$part->setName((strlen($name) ? $name : 'vcard') . '.vcf');
$this->_attachVCard = $part;
'text' => $status
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
/* If this is a text/* part, AND the browser does not support
* UTF-8, give the user a link to open the part in a new window
* with the correct character set. */
- $default_charset = Horde_String::upper(Horde_Nls::getCharset());
+ $default_charset = Horde_String::upper($GLOBALS['registry']->getCharset());
if ($default_charset !== 'UTF-8') {
$charset_upper = Horde_String::upper($mime_part->getCharset());
if (($charset_upper != 'US-ASCII') &&
$ptext = $pmime->getContents();
$ptext = Horde_String::convertCharset($ptext, $pmime->getCharset());
if ($pmime->getType() == 'text/html') {
- $ptext = Horde_Text_Filter::filter($ptext, 'Html2text', array('charset' => Horde_Nls::getCharset()));
+ $ptext = Horde_Text_Filter::filter($ptext, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset()));
}
$this->_build = $oldbuild;
*/
public function textWindowOutput($name, $msg)
{
- $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . Horde_Nls::getCharset(), true, strlen($msg));
+ $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($msg));
echo $msg;
}
*/
public function textWindowOutput($name, $msg, $html = false)
{
- $GLOBALS['browser']->downloadHeaders($name, $html ? 'text/html' : 'text/plain; charset=' . Horde_Nls::getCharset(), true, strlen($msg));
+ $GLOBALS['browser']->downloadHeaders($name, $html ? 'text/html' : 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($msg));
echo $msg;
}
try {
$message = Horde::callHook('perms_denied', array('imp:create_folders'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(_("You are not allowed to create folders."), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(_("You are not allowed to create folders."), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
return false;
try {
$message = Horde::callHook('perms_denied', array('imp:max_folders'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
return false;
$result = $registry->call('contacts/import', array(array('name' => $newName, 'email' => $newAddress), 'array', $prefs->getValue('add_source')));
- $escapeName = @htmlspecialchars($newName, ENT_COMPAT, Horde_Nls::getCharset());
+ $escapeName = @htmlspecialchars($newName, ENT_COMPAT, $GLOBALS['registry']->getCharset());
try {
if ($contact_link = $registry->link('contacts/show', array('uid' => $result, 'source' => $prefs->getValue('add_source')))) {
: $mbox['abbrev'];
$mbox_list[] = array(
- 'l' => Horde_Text_Filter::filter($label, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)),
+ 'l' => Horde_Text_Filter::filter($label, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)),
'sel' => (!empty($options['selected']) && ($mbox['val'] === $options['selected'])),
'v' => htmlspecialchars($mbox['val'])
);
$vfolder_sel = $imp_search->searchMboxID();
foreach ($vfolders as $id => $val) {
$vfolder_list[] = array(
- 'l' => Horde_Text_Filter::filter($val, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)),
+ 'l' => Horde_Text_Filter::filter($val, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)),
'sel' => ($vfolder_sel == $id),
'v' => htmlspecialchars($imp_search->createSearchID($id))
);
$tasklist_list = array();
foreach ($tasklists as $id => $tasklist) {
$tasklist_list[] = array(
- 'l' => Horde_Text_Filter::filter($tasklist->get('name'), 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)),
+ 'l' => Horde_Text_Filter::filter($tasklist->get('name'), 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)),
'v' => '\0tasklist_' . $id
);
}
$notepad_list[] = array();
foreach ($notepads as $id => $notepad) {
$notepad_list[] = array(
- 'l' => Horde_Text_Filter::filter($notepad->get('name'), 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)),
+ 'l' => Horde_Text_Filter::filter($notepad->get('name'), 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)),
'v' => '\0notepad_' . $id
);
}
stripos($out, $key) === 0) {
$len = strlen($key);
if ((strlen($out) == $len) || ($out[$len] == $delimiter)) {
- $out = substr_replace($out, Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'UTF7-IMAP'), 0, $len);
+ $out = substr_replace($out, Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), 0, $len);
break;
}
}
/* IMAP keywords must conform to RFC 3501 [9] (flag-keyword). Convert
* whitespace to underscore. */
- $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), Horde_Nls::getCharset(), 'UTF7-IMAP'));
+ $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'));
if (!isset($this->_flags[$key])) {
$entry = $this->_createEntry($label);
foreach (array_keys($old_folders) as $k) {
foreach ($sent_mail_folders as $folder) {
if (preg_match('/^' . str_replace('/', '\/', $folder) . '-([^-]+)-([0-9]{4})$/i', $k, $regs)) {
- $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), Horde_Nls::getCharset(), 'UTF7-IMAP');
+ $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
}
}
}
$text = (substr($GLOBALS['language'], 0, 2) == 'en') ? strtolower(strftime('-%b-%Y', $last_maintenance)) : strftime('-%m-%Y', $last_maintenance);
- return $folder . Horde_String::convertCharset($text, Horde_Nls::getExternalCharset(), 'UTF7-IMAP');
+ return $folder . Horde_String::convertCharset($text, $GLOBALS['registry']->getExternalCharset(), 'UTF7-IMAP');
}
}
/* TODO: When Horde_iCalendar supports setting of charsets
* we need to set it there instead of relying on the fact
* that both Nag and IMP use the same charset. */
- $body = Horde_String::convertCharset($body, $body_part->getCharset(), Horde_Nls::getCharset());
+ $body = Horde_String::convertCharset($body, $body_part->getCharset(), $GLOBALS['registry']->getCharset());
/* Create a new iCalendar. */
$vCal = new Horde_iCalendar();
/* Need to make sure all text is in the correct charset. */
$part_name = $part->getName(true);
- $newPart->setCharset(Horde_Nls::getCharset());
+ $newPart->setCharset($GLOBALS['registry']->getCharset());
$newPart->setContents(sprintf(_("[Attachment stripped: Original attachment type: %s, name: %s]"), $part->getType(), $part_name ? $part_name : _("unnamed")));
$parts[] = array(
'type' => 'info'
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
);
return $ret;
}
? array(
'data' => '',
'status' => array($status),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset(),
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(),
'wrap' => 'mimePartWrap'
)
: null;
)
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
)
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
* text. */
if (($_SESSION['imp']['view'] == 'mimp') ||
(!$inline && Horde_Util::getFormData('convert_text'))) {
- $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false));
+ $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset(), 'wrap' => false));
// Filter bad language.
return array(
'data' => IMP::filterText($data),
'status' => array(),
- 'type' => 'text/plain; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset()
);
}
*/
protected function _mailtoCallback($m)
{
- return 'href="' . $GLOBALS['registry']->call('mail/compose', array(Horde_String::convertCharset(html_entity_decode($m[2]), 'ISO-8859-1', Horde_Nls::getCharset()))) . '"';
+ return 'href="' . $GLOBALS['registry']->call('mail/compose', array(Horde_String::convertCharset(html_entity_decode($m[2]), 'ISO-8859-1', $GLOBALS['registry']->getCharset()))) . '"';
}
/**
$this->_mimepart->getMimeId() => array(
'data' => $this->_outputImgTag('data', $this->_mimepart->getName(true)),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
} else {
'text' => $status
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
'text' => $status
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$this->_mimepart->getMimeId() => array(
'data' => $str,
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
*/
protected function _outputImgTag($type, $alt)
{
- return '<img src="' . $this->_params['contents']->urlView($this->_mimepart, 'view_attach', array('params' => array('imp_img_view' => $type))) . '" alt="' . htmlspecialchars($alt, ENT_COMPAT, Horde_Nls::getCharset()) . '" />';
+ return '<img src="' . $this->_params['contents']->urlView($this->_mimepart, 'view_attach', array('params' => array('imp_img_view' => $type))) . '" alt="' . htmlspecialchars($alt, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '" />';
}
}
{
global $registry;
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$data = $this->_mimepart->getContents();
$mime_id = $this->_mimepart->getMimeId();
}
return array(
$mime_id => array(
- 'data' => Horde_String::convertCharset(Horde::escapeJson(Horde::prepareResponse(null, true), array('charset' => Horde_Nls::getCharset())), Horde_Nls::getCharset(), 'UTF-8'),
+ 'data' => Horde_String::convertCharset(Horde::escapeJson(Horde::prepareResponse(null, true), array('charset' => $GLOBALS['registry']->getCharset())), $GLOBALS['registry']->getCharset(), 'UTF-8'),
'status' => array(),
'name' => null,
'type' => 'application/json'
$ret[$mdn_id] = array(
'data' => $data,
'status' => $status,
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset(),
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(),
'wrap' => 'mimePartWrap'
);
$id => array(
'data' => null,
'status' => array(self::$_statuscache[$id]),
- 'type' => 'text/plain; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset()
)
);
} else {
'text' => $status
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
*/
protected function _outputImgTag()
{
- return '<img src="' . $this->_params['contents']->urlView($this->_mimepart, 'view_attach', array('params' => array('pdf_view_thumbnail' => 1))) . '" alt="' . htmlspecialchars(_("View PDF File"), ENT_COMPAT, Horde_Nls::getCharset()) . '" />';
+ return '<img src="' . $this->_params['contents']->urlView($this->_mimepart, 'view_attach', array('params' => array('pdf_view_thumbnail' => 1))) . '" alt="' . htmlspecialchars(_("View PDF File"), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '" />';
}
}
$id => array(
'data' => '',
'status' => array(),
- 'type' => 'text/plain; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset()
)
);
$id => array(
'data' => null,
'status' => self::$_cache[$id]['status'],
- 'type' => 'text/plain; charset=' . Horde_Nls::getCharset(),
+ 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset(),
'wrap' => self::$_cache[$id]['wrap']
)
), self::$_cache[$id]['other']);
$mime_id => array(
'data' => $data,
'status' => array($status),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
'text' => array()
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset(),
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(),
'wrap' => 'mimePartWrap'
),
$sig_id => null
// Convert to the local charset.
if ($inline) {
$text = Horde_String::convertCharset($text, $charset);
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
}
$type = 'text/html; charset=' . $charset;
$text_part = new Horde_Mime_Part();
$text_part->setType('text/plain');
- $text_part->setCharset(Horde_Nls::getCharset());
+ $text_part->setCharset($GLOBALS['registry']->getCharset());
$text_part->setContents(preg_replace("/begin [0-7]{3} .+\r?\n.+\r?\nend/Us", "\n", $text));
$new_part->addPart($text_part);
// Escape text
$filters = array(
'text2html' => array(
- 'charset' => Horde_Nls::getCharset(),
+ 'charset' => $GLOBALS['registry']->getCharset(),
'parselevel' => Horde_Text_Filter_Text2html::MICRO
),
'tabs2spaces' => array(),
$id => array(
'data' => null,
'status' => self::$_cache[$id]['status'],
- 'type' => 'text/plain; charset=' . Horde_Nls::getCharset(),
+ 'type' => 'text/plain; charset=' . $GLOBALS['registry']->getCharset(),
'wrap' => self::$_cache[$id]['wrap']
)
);
$this->_mimepart->getMimeId() => array(
'data' => $this->_impsmime->certToHTML($sig_result->cert),
'status' => array(),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
$ret[$this->_mimepart->getMimeId()] = array(
'data' => $data,
'status' => $status,
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset(),
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset(),
'wrap' => 'mimePartWrap'
);
'text' => array(_("The following files were attached to this part:"))
)
),
- 'type' => 'text/html; charset=' . Horde_Nls::getCharset()
+ 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
)
);
}
case 'display':
/* Set the timezone on this page so the 'time_format' output uses
* the configured time zone's time, not the system's time zone. */
- Horde_Nls::setTimeZone();
+ $registry->setTimeZone();
if ($pop3) {
$ui->suppress[] = 'nav_expanded';
$ui->suppress[] = 'tree_view';
if (!empty($code)) {
Horde::addScriptFile('folderprefs.js', 'imp');
Horde::addInlineScript(array(
- 'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
}
break;
$ui->nobuttons = true;
Horde::addInlineScript(array(
- 'ImpAccountsPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this account?"), Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'ImpAccountsPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this account?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
$t = $GLOBALS['injector']->createInstance('Horde_Template');
protected function _flagManagement()
{
Horde::addInlineScript(array(
- 'ImpFlagPrefs.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, Horde_Nls::getCharset()),
- 'ImpFlagPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'ImpFlagPrefs.new_prompt = ' . Horde_Serialize::serialize(_("Please enter the label for the new flag:"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
+ 'ImpFlagPrefs.confirm_delete = ' . Horde_Serialize::serialize(_("Are you sure you want to delete this flag?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
$msgflags_locked = $GLOBALS['prefs']->isLocked('msgflags');
Horde::addInlineScript(array(
'ImpFolderPrefs.folders = ' . Horde_Serialize::serialize(array(
'sent_mail_folder' => _("Create a new sent-mail folder")
- ), Horde_Serialize::JSON, Horde_Nls::getCharset()),
- 'ImpFolderPrefs.sentmail = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset())
+ ), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()),
+ 'ImpFolderPrefs.sentmail = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
$t = $GLOBALS['injector']->createInstance('Horde_Template');
$sent_mail_folder = $ui->vars->sent_mail_folder;
if (empty($sent_mail_folder)) {
- $sent_mail_new = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace(Horde_String::convertCharset($ui->vars->sent_mail_folder_new, Horde_Nls::getCharset(), 'UTF7-IMAP'));
+ $sent_mail_new = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace(Horde_String::convertCharset($ui->vars->sent_mail_folder_new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'));
} elseif (($sent_mail_folder == '-1') &&
($sm_default = $prefs->getDefault('sent_mail_folder'))) {
$sent_mail_folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($sm_default);
};
Horde::addInlineScript(array(
- 'ImpHtmlSignaturePrefs.sigs = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'ImpHtmlSignaturePrefs.sigs = ' . Horde_Serialize::serialize($js, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
$t = $GLOBALS['injector']->createInstance('Horde_Template');
}
if ($updated) {
- $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset(array_values($ob->stationery_list), Horde_Nls::getCharset(), $GLOBALS['prefs']->getCharset())), false);
+ $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset(array_values($ob->stationery_list), $GLOBALS['registry']->getCharset(), $GLOBALS['prefs']->getCharset())), false);
$GLOBALS['notification']->push($updated, 'horde.success');
}
}
if ($ui->vars->last_type != $type) {
$content = ($type == 'plain')
- ? Horde_Text_Filter::filter($content, 'Html2text', array('charset' => Horde_Nls::getCharset()))
+ ? Horde_Text_Filter::filter($content, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset()))
: nl2br(htmlspecialchars(htmlspecialchars($content)));
}
return false;
}
- $new = Horde_String::convertCharset($new, Horde_Nls::getCharset(), 'UTF7-IMAP');
+ $new = Horde_String::convertCharset($new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
if ($folder == IMP::PREF_NO_FOLDER) {
$prefs->setValue($pref, '');
/* Send the message. */
try {
- $imp_compose->sendMessage($to, $spam_headers, $mime, Horde_Nls::getCharset());
+ $imp_compose->sendMessage($to, $spam_headers, $mime, $GLOBALS['registry']->getCharset());
$report_flag = true;
} catch (IMP_Compose_Exception $e) {
Horde::logMessage($e, 'ERR');
}
}
- $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false));
+ $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset(), 'wrap' => false));
$sig = $txt_sig;
break;
}
$new_subject = $subject = IMP::filterText(preg_replace("/\s+/", ' ', $subject));
if ($htmlspaces) {
- $new_subject = Horde_Text_Filter::filter($subject, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true));
+ $new_subject = Horde_Text_Filter::filter($subject, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true));
if (empty($new_subject)) {
$new_subject = htmlspecialchars($subject);
}
}
/* Set the current time zone. */
- Horde_Nls::setTimeZone();
+ $GLOBALS['registry']->setTimeZone();
/* Run filters now. */
if (!$is_search &&
/* Get mailbox information. */
$overview = $imp_mailbox->getMailboxArray($msglist, array('headers' => true, 'structure' => $GLOBALS['prefs']->getValue('atc_flag')));
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$imp_ui = new IMP_Ui_Mailbox($folder);
$no_flags_hook = false;
);
/* Set the current time zone. */
- Horde_Nls::setTimeZone();
+ $GLOBALS['registry']->setTimeZone();
/* Get envelope/header information. We don't use flags in this
* view. */
*/
require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('imp', array('impmode' => 'mimp'));
-
-Horde_Nls::setTimeZone();
+Horde_Registry::appInit('imp', array(
+ 'impmode' => 'mimp',
+ 'timezone' => true
+));
$imp_search = $injector->getInstance('IMP_Search');
$imp_ui_mimp = $injector->getInstance('IMP_Ui_Mimp');
require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('imp');
-Horde_Nls::setTimeZone();
+$registry->setTimeZone();
/* Call the mailbox redirection hook, if requested. */
try {
/* Generate paging links. */
if ($pageOb['pagecount']) {
- $rtl = !empty(Horde_Nls::$config['rtl'][$language]);
+ $rtl = !empty($registry->nlsconfig['rtl'][$language]);
if ($pageOb['page'] == 1) {
$pages_first = Horde::img($rtl ? 'nav/last-grey.png' : 'nav/first-grey.png');
$pages_prev = Horde::img($rtl ? 'nav/right-grey.png' : 'nav/left-grey.png');
}
/* Format the From: Header. */
- $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => Horde_Nls::getCharset()));
+ $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => $registry->getCharset()));
$msg['from'] = $getfrom['from'];
$msg['fullfrom'] = $getfrom['fullfrom'];
switch ($fromlinkstyle) {
*/
require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('imp', array('impmode' => 'mimp'));
+Horde_Registry::appInit('imp', array(
+ 'impmode' => 'mimp',
+ 'timezone' => true
+));
-Horde_Nls::setTimeZone();
$vars = Horde_Variables::getDefaultVariables();
/* Make sure we have a valid index. */
-$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid));
+$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid));
if (!$imp_mailbox->isValidIndex(false)) {
header('Location: ' . IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->setRaw(true)->add('a', 'm'));
exit;
$t->set('fullmsg_link', $self_link->copy()->add('fullmsg', 1));
}
-$t->set('msg', nl2br(Horde_Text_Filter::filter($msg_text, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true))));
+$t->set('msg', nl2br(Horde_Text_Filter::filter($msg_text, 'space2html', array('charset' => $registry->getCharset(), 'encode' => true))));
$compose_params = array(
'identity' => $identity,
require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('imp');
-Horde_Nls::setTimeZone();
+$registry->setTimeZone();
/* We know we are going to be exclusively dealing with this mailbox, so
* select it on the IMAP server (saves some STATUS calls). Open R/W to clear
}
/* Make sure we have a valid index. */
-$imp_mailbox = $GLOBALS['injector']->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid));
+$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid));
if (!$imp_mailbox->isValidIndex(false)) {
_returnToMailbox(null, 'message_missing');
require IMP_BASE . '/mailbox.php';
$origin_host = array($origin_host);
}
foreach ($origin_host as $host) {
- $from_img .= Horde_Nls::generateFlagImageByHost($host, $injector->getInstance('Net_DNS_Resolver')) . ' ';
+ $from_img .= Horde_Ui_FlagImage::generateFlagImageByHost($host) . ' ';
}
trim($from_img);
}
if (empty($from_img) && !empty($envelope['from'])) {
$from_ob = reset($envelope['from']);
- $from_img .= Horde_Nls::generateFlagImageByHost($from_ob['host'], $injector->getInstance('Net_DNS_Resolver')) . ' ';
+ $from_img .= Horde_Ui_FlagImage::generateFlagImageByHost($from_ob['host']) . ' ';
}
if (!empty($from_img)) {
$n_template->set('back_to', Horde::widget($mailbox_url, sprintf(_("Back to %s"), $h_page_label), 'widget', '', '', sprintf(_("Bac_k to %s"), $h_page_label), true));
-$rtl = !empty(Horde_Nls::$config['rtl'][$language]);
+$rtl = !empty($registry->nlsconfig['rtl'][$language]);
if (Horde_Util::nonInputVar('prev_url')) {
$n_template->set('prev', Horde::link($prev_url, _("Previous Message")));
$n_template->set('prev_img', Horde::img($rtl ? 'nav/right.png' : 'nav/left.png', $rtl ? '>' : '<'));
: sprintf(_("%u of %u messages in %s unread."), $unseen_num, $total_num, IMP::getLabel($mailbox));
$t = $injector->createInstance('Horde_Template');
-$t->set('charset', Horde_Nls::getCharset());
+$t->set('charset', $registry->getCharset());
$t->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$t->set('pubDate', htmlspecialchars(date('r')));
$t->set('desc', htmlspecialchars($description));
exit;
}
-$imp_search = $GLOBALS['injector']->getInstance('IMP_Search');
+$imp_search = $injector->getInstance('IMP_Search');
/* If search_basic_mbox is set, we are processing the search query. */
$search_mailbox = Horde_Util::getFormData('search_basic_mbox');
exit;
}
-$imp_search = $GLOBALS['injector']->getInstance('IMP_Search');
+$imp_search = $injector->getInstance('IMP_Search');
-$charset = Horde_Nls::getCharset();
+$charset = $registry->getCharset();
$criteria = Horde_Util::getFormData('criteria_form');
$dimp_view = ($_SESSION['imp']['view'] == 'dimp');
$search_fields = $imp_search->searchFields();
}
if (isset($GLOBALS['language'])) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
}
Horde::addInlineScript(array(
- 'var DIMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'var DIMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
), null, true);
);
Horde::addInlineScript(array(
- 'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
), null, true);
*/
require_once dirname(__FILE__) . '/lib/Application.php';
-Horde_Registry::appInit('imp');
-
-Horde_Nls::setTimeZone();
+Horde_Registry::appInit('imp', array(
+ 'timezone' => true
+));
/* What mode are we in?
* DEFAULT/'thread' - Thread mode
* 'msgview' - Multiple message view
*/
-$mode = Horde_Util::getFormData('mode', 'thread');
+$vars = Horde_Variables::getDefaultVariables();
+$mode = $vars->mode
+ ? $vars->mode
+ : 'thread';
$imp_imap = $injector->getInstance('IMP_Imap')->getOb();
$imp_mailbox = $injector->getInstance('IMP_Mailbox')->getOb(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid));
}
} else {
/* MSGVIEW MODE: Make sure we have a valid list of messages. */
- $imp_indices = new IMP_Indices(Horde_Util::getFormData('msglist'));
+ $imp_indices = new IMP_Indices($vars->msglist);
if (!$imp_indices->count()) {
$error = true;
}
}
/* Run through action handlers. */
-$actionID = Horde_Util::getFormData('actionID');
+$actionID = $vars->actionID;
switch ($actionID) {
case 'add_address':
try {
- $contact_link = IMP::addAddress(Horde_Util::getFormData('address'), Horde_Util::getFormData('name'));
+ $contact_link = IMP::addAddress($vars->address, $vars->name);
$notification->push(sprintf(_("Entry \"%s\" was successfully added to the address book"), $contact_link), 'horde.success', array('content.raw'));
} catch (Horde_Exception $e) {
$notification->push($e);
$imp_indices = new IMP_Indices(IMP::$mailbox, $thread);
}
-$charset = Horde_Nls::getCharset();
+$charset = $registry->getCharset();
$imp_ui = new IMP_Ui_Message();
foreach ($imp_indices->indices() as $mbox => $idxlist) {
function _sanitizeName($name)
{
- return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, Horde_Nls::getCharset(), 'UTF-8')), ' _'), 'UTF-8');
+ return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF-8')), ' _'), 'UTF-8');
}
require_once dirname(__FILE__) . '/lib/Application.php';
try {
$message = Horde::callHook('perms_denied', array('ingo:allow_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break 2;
try {
$message = Horde::callHook('perms_denied', array('ingo:max_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break 2;
/* Create description. */
if (!$edit_allowed) {
- $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset());
+ $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
} elseif (!empty($filter['conditions'])) {
$descrip = '';
$condition_size = count($filter['conditions']) - 1;
$descrip .= "\n[stop]";
}
- $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $descrip) . @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset()) . '</a>';
+ $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $descrip) . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
} else {
- $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, Horde_Nls::getCharset()) . '</a>';
+ $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
}
/* Create edit link. */
$label = $mbox['abbrev'];
$text .= sprintf('<option%s value="%s"%s>%s</option>%s',
$disabled, $val, $sel,
- Horde_Text_Filter::filter($label, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true)), "\n");
+ Horde_Text_Filter::filter($label, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true)), "\n");
}
return $text . '</select>';
static public function createFolder($folder)
{
return $GLOBALS['registry']->hasMethod('mail/createFolder')
- ? $GLOBALS['registry']->call('mail/createFolder', array('folder' => Horde_String::convertCharset($folder, Horde_Nls::getCharset(), 'UTF7-IMAP')))
+ ? $GLOBALS['registry']->call('mail/createFolder', array('folder' => Horde_String::convertCharset($folder, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP')))
: false;
}
if ($GLOBALS['registry']->hasMethod('mail/createFolder')) {
Horde::addScriptFile('new_folder.js', 'ingo');
Horde::addInlineScript(array(
- 'IngoNewFolder.folderprompt = ' . Horde_Serialize::serialize(_("Please enter the name of the new folder:"), Horde_Serialize::JSON, Horde_Nls::getCharset())
+ 'IngoNewFolder.folderprompt = ' . Horde_Serialize::serialize(_("Please enter the name of the new folder:"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
));
}
}
$params['spam_char'] = $GLOBALS['conf']['spam']['char'];
}
if (!isset($params['charset'])) {
- $params['charset'] = Horde_Nls::getCharset();
+ $params['charset'] = $GLOBALS['registry']->getCharset();
}
if ($script == 'Sieve') {
if (!isset($params['date_format'])) {
*/
protected function _ruleToBackend($rule)
{
- return array(Horde_String::convertCharset($rule['name'], Horde_Nls::getCharset(), $this->_params['charset']),
+ return array(Horde_String::convertCharset($rule['name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)$rule['action'],
- isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], Horde_Nls::getCharset(), $this->_params['charset']) : null,
+ isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null,
isset($rule['flags']) ? (int)$rule['flags'] : null,
- isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], Horde_Nls::getCharset(), $this->_params['charset'])) : null,
+ isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], $GLOBALS['registry']->getCharset(), $this->_params['charset'])) : null,
isset($rule['combine']) ? (int)$rule['combine'] : null,
isset($rule['stop']) ? (int)$rule['stop'] : null,
isset($rule['disable']) ? (int)(!$rule['disable']) : 1);
/* Convert rules from the old format. */
$data = @unserialize($prefs->getValue('rules'));
} else {
- $data = Horde_String::convertCharset($data, $prefs->getCharset(), Horde_Nls::getCharset());
+ $data = Horde_String::convertCharset($data, $prefs->getCharset(), $GLOBALS['registry']->getCharset());
}
if ($data) {
$ob->setFilterlist($data);
/* Convert vacation from the old format. */
$data = unserialize($prefs->getValue('vacation'));
} elseif (is_array($data)) {
- $data = $prefs->convertFromDriver($data, Horde_Nls::getCharset());
+ $data = $prefs->convertFromDriver($data, $GLOBALS['registry']->getCharset());
}
if ($data) {
$ob->setVacationAddresses($data['addresses'], false);
return $prefs->setValue('blacklist', serialize($data));
case self::ACTION_FILTERS:
- return $prefs->setValue('rules', serialize(Horde_String::convertCharset($ob->getFilterList(), Horde_Nls::getCharset(), $prefs->getCharset())), false);
+ return $prefs->setValue('rules', serialize(Horde_String::convertCharset($ob->getFilterList(), $GLOBALS['registry']->getCharset(), $prefs->getCharset())), false);
case self::ACTION_FORWARD:
$data = array(
'start' => $ob->getVacationStart(),
'end' => $ob->getVacationEnd(),
);
- return $prefs->setValue('vacation', serialize($prefs->convertToDriver($data, Horde_Nls::getCharset())), false);
+ return $prefs->setValue('vacation', serialize($prefs->convertToDriver($data, $GLOBALS['registry']->getCharset())), false);
case self::ACTION_WHITELIST:
return $prefs->setValue('whitelist', serialize($ob->getWhitelist()));
$values = array(
implode("\n", $ob->getVacationAddresses()),
Horde_String::convertCharset($ob->getVacationSubject(),
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
Horde_String::convertCharset($ob->getVacationReason(),
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
(int)$ob->getVacationDays(),
(int)$ob->getVacationStart(),
try {
$message = Horde::callHook('perms_denied', array('ingo:allow_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . Horde::applicationUrl('filters.php', true));
try {
$message = Horde::callHook('perms_denied', array('ingo:max_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . Horde::applicationUrl('filters.php', true));
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
$page_title = $GLOBALS['registry']->get('name');
<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, Horde_Nls::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, $GLOBALS['registry']->getCharset()) : '' ?>" />
</td>
<td width="40" class="rightAlign">
<?php echo Horde_Help::link('ingo', 'rule-name') ?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
$template = new Horde_Template();
-$template->set('charset', Horde_Nls::getCharset());
+$template->set('charset', $GLOBALS['registry']->getCharset());
$template->set('jonah', 'Jonah ' . $registry->getVersion() . ' (http://www.horde.org/jonah/)');
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
if (!empty($criteria['tag_id'])) {
- $template->set('channel_name', sprintf(_("Stories tagged with %s in %s"), $tag_name, @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset())));
+ $template->set('channel_name', sprintf(_("Stories tagged with %s in %s"), $tag_name, @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())));
} else {
- $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset()));
+ $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()));
}
-$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, Horde_Nls::getCharset()));
+$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset()));
$template->set('channel_updated', htmlspecialchars(date('r', $channel['channel_updated'])));
$template->set('channel_official', htmlspecialchars($channel['channel_official']));
$template->set('channel_rss', htmlspecialchars(Horde_Util::addParameter(Horde::applicationUrl('delivery/rss.php', true, -1), array('type' => 'rss', 'channel_id' => $channel['channel_id']))));
$template->set('channel_rss2', htmlspecialchars(Horde_Util::addParameter(Horde::applicationUrl('delivery/rss.php', true, -1), array('type' => 'rss2', 'channel_id' => $channel['channel_id']))));
foreach ($stories as &$story) {
- $story['story_title'] = @htmlspecialchars($story['story_title'], ENT_COMPAT, Horde_Nls::getCharset());
- $story['story_desc'] = @htmlspecialchars($story['story_desc'], ENT_COMPAT, Horde_Nls::getCharset());
+ $story['story_title'] = @htmlspecialchars($story['story_title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $story['story_desc'] = @htmlspecialchars($story['story_desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
$story['story_link'] = htmlspecialchars($story['story_link']);
$story['story_permalink'] = (isset($story['story_permalink']) ? htmlspecialchars($story['story_permalink']) : '');
$story['story_published'] = htmlspecialchars(date('r', $story['story_published']));
$story = $this->_fetch();
return is_a($story, 'PEAR_Error')
- ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, Horde_Nls::getCharset())
+ ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset())
: '<span class="storyDate">'
- . @htmlspecialchars($story['story_updated_date'], ENT_COMPAT, Horde_Nls::getCharset())
+ . @htmlspecialchars($story['story_updated_date'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
. '</span> '
- . @htmlspecialchars($story['story_title'], ENT_COMPAT, Horde_Nls::getCharset());
+ . @htmlspecialchars($story['story_title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
/**
$news = Jonah_News::factory();
$channel = $news->getChannel($this->_params['source']);
if (is_a($channel, 'PEAR_Error')) {
- return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, Horde_Nls::getCharset());
+ return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
if (!empty($channel['channel_link'])) {
$title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank')
- . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset())
+ . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
. '</a>';
} else {
- $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset());
+ $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
return $title;
$news = Jonah_News::factory();
$channel = $news->getChannel($this->_params['source']);
if (is_a($channel, 'PEAR_Error')) {
- return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, Horde_Nls::getCharset());
+ return @htmlspecialchars($channel->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
if (!empty($channel['channel_link'])) {
$title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank')
- . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset())
+ . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
. _(" - Most read stories") . '</a>';
} else {
- $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, Horde_Nls::getCharset())
+ $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
. _(" - Most read stories");
}
$story = $this->_fetch();
return is_a($story, 'PEAR_Error')
- ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, Horde_Nls::getCharset())
+ ? @htmlspecialchars($story->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset())
: '<span class="storyDate">'
- . @htmlspecialchars($story['story_updated_date'], ENT_COMPAT, Horde_Nls::getCharset())
+ . @htmlspecialchars($story['story_updated_date'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
. '</span> '
- . @htmlspecialchars($story['story_title'], ENT_COMPAT, Horde_Nls::getCharset());
+ . @htmlspecialchars($story['story_title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
/**
$body_text = Horde_Text_Filter::filter($body_html, 'html2text');
/* Add description. */
- $body_html = '<p>' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => Horde_Nls::getCharset(), 'class' => null, 'callback' => null)) . "</p>\n" . $body_html;
+ $body_html = '<p>' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "</p>\n" . $body_html;
$body_text = Horde_String::wrap(' ' . $story['story_desc'], 70) . "\n\n" . $body_text;
/* Add the text version of the story to the base message. */
$message_text = new MIME_Part('text/plain');
- $message_text->setCharset(Horde_Nls::getCharset());
+ $message_text->setCharset($GLOBALS['registry']->getCharset());
$message_text->setContents($message_text->replaceEOL($body_text));
$message_text->setDescription(_("Plaintext Version of Story"));
/* Add an HTML version of the story to the base message. */
$message_html = new MIME_Part('text/html', Horde_String::wrap($body_html),
- Horde_Nls::getCharset(), 'inline');
+ $GLOBALS['registry']->getCharset(), 'inline');
$message_html->setDescription(_("HTML Version of Story"));
/* Add the two parts as multipart/alternative. */
/* This is just a plain text story. */
$message_text = new MIME_Part('text/plain');
$message_text->setContents($message_text->replaceEOL($story['story_desc'] . "\n\n" . $story['story_body']));
- $message_text->setCharset(Horde_Nls::getCharset());
+ $message_text->setCharset($GLOBALS['registry']->getCharset());
return $message_text;
}
array_unshift($values,
(int)$info['channel_id'],
- Horde_String::convertCharset($info['channel_name'], Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['channel_name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)$info['channel_type'],
isset($info['channel_desc']) ? $info['channel_desc'] : null,
isset($info['channel_interval']) ? (int)$info['channel_interval'] : null,
array_unshift($values,
(int)$info['story_id'],
(int)$info['channel_id'],
- Horde_String::convertCharset($info['story_title'], Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($info['story_desc'], Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['story_title'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['story_desc'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
$info['story_body_type'],
- isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], Horde_Nls::getCharset(), $this->_params['charset']) : null,
+ isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null,
isset($info['story_url']) ? $info['story_url'] : null,
isset($info['story_published']) ? (int)$info['story_published'] : null,
time(),
*/
protected function _convertFromBackend($story)
{
- $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], Horde_Nls::getCharset());
- $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], Horde_Nls::getCharset());
+ $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+ $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
if (isset($story['story_body'])) {
- $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], Horde_Nls::getCharset());
+ $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
}
if (isset($story['story_tags'])) {
- $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], Horde_Nls::getCharset());
+ $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
}
return $story;
}
$cache = $GLOBALS['injector']->getInstance('Horde_Cache');
$timestamp = time();
if (is_a($cache, 'Horde_Cache') && ($stories = $cache->get($url, $interval))) {
- $stories = Horde_Serialize::unserialize($stories, Horde_Serialize::UTF7_BASIC, Horde_Nls::getCharset());
+ $stories = Horde_Serialize::unserialize($stories, Horde_Serialize::UTF7_BASIC, $GLOBALS['registry']->getCharset());
} else {
$stories = Jonah_News::_fetchExternalStories($url, $timestamp);
- $cache->set($url, Horde_Serialize::serialize($stories, Horde_Serialize::UTF7_BASIC, Horde_Nls::getCharset()));
+ $cache->set($url, Horde_Serialize::serialize($stories, Horde_Serialize::UTF7_BASIC, $GLOBALS['registry']->getCharset()));
}
/* If the stories from cache return the same timestamp as
$body_text = Horde_Text_Filter::filter($body_html, 'html2text');
/* Add description. */
- $body_html = '<p>' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => Horde_Nls::getCharset(), 'class' => null, 'callback' => null)) . "</p>\n" . $body_html;
+ $body_html = '<p>' . Horde_Text_Filter::filter($story['story_desc'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $GLOBALS['registry']->getCharset(), 'class' => null, 'callback' => null)) . "</p>\n" . $body_html;
$body_text = Horde_String::wrap(' ' . $story['story_desc'], 70) . "\n\n" . $body_text;
/* Add the text version of the story to the base message. */
$message_text = new MIME_Part('text/plain');
- $message_text->setCharset(Horde_Nls::getCharset());
+ $message_text->setCharset($GLOBALS['registry']->getCharset());
$message_text->setContents($message_text->replaceEOL($body_text));
$message_text->setDescription(_("Plaintext Version of Story"));
/* Add an HTML version of the story to the base message. */
$message_html = new MIME_Part('text/html', Horde_String::wrap($body_html),
- Horde_Nls::getCharset(), 'inline');
+ $GLOBALS['registry']->getCharset(), 'inline');
$message_html->setDescription(_("HTML Version of Story"));
/* Add the two parts as multipart/alternative. */
/* This is just a plain text story. */
$message_text = new MIME_Part('text/plain');
$message_text->setContents($message_text->replaceEOL($story['story_desc'] . "\n\n" . $story['story_body']));
- $message_text->setCharset(Horde_Nls::getCharset());
+ $message_text->setCharset($GLOBALS['registry']->getCharset());
return $message_text;
}
array_unshift($values,
(int)$info['channel_id'],
- Horde_String::convertCharset($info['channel_name'], Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['channel_name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
isset($info['channel_slug']) ? $info['channel_slug'] : '',
(int)$info['channel_type'],
(int)$info['channel_full_feed'],
array_unshift($values,
(int)$info['story_id'],
(int)$info['channel_id'],
- Horde_String::convertCharset($info['story_title'], Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($info['story_desc'], Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['story_title'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['story_desc'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
$info['story_body_type'],
- isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], Horde_Nls::getCharset(), $this->_params['charset']) : null,
+ isset($info['story_body']) ? Horde_String::convertCharset($info['story_body'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null,
isset($info['story_url']) ? $info['story_url'] : null,
isset($info['story_published']) ? (int)$info['story_published'] : null,
time(),
*/
function _convertFromBackend($story)
{
- $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], Horde_Nls::getCharset());
- $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], Horde_Nls::getCharset());
+ $story['story_title'] = Horde_String::convertCharset($story['story_title'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+ $story['story_desc'] = Horde_String::convertCharset($story['story_desc'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
if (isset($story['story_body'])) {
- $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], Horde_Nls::getCharset());
+ $story['story_body'] = Horde_String::convertCharset($story['story_body'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
}
if (isset($story['story_tags'])) {
- $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], Horde_Nls::getCharset());
+ $story['story_tags'] = Horde_String::convertCharset($story['story_tags'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
}
return $story;
}
$mail = new Horde_Mime_Mail(array('subject' => $subject,
'to' => $recipients,
'from' => $from,
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
$mail->addHeader('User-Agent', 'Jonah ' . $GLOBALS['registry']->getVersion());
/* If a note has been provided, add it to the message as a text part. */
if (strlen($note) > 0) {
- $message_note = new MIME_Part('text/plain', null, Horde_Nls::getCharset());
+ $message_note = new MIME_Part('text/plain', null, $GLOBALS['registry']->getCharset());
$message_note->setContents($message_note->replaceEOL($note));
$message_note->setDescription(_("Note"));
$mail->addMIMEPart($message_note);
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.warning', array('content.raw'));
$templates[Horde_Data::IMPORT_FILE] = array(KRONOLITH_TEMPLATES . '/data/export.inc');
$calNames[] = $share->get('name');
}
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), Horde_Nls::getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), $GLOBALS['registry']->getCharset(), 'utf-8'));
$data = $iCal->exportvCalendar();
$browser->downloadHeaders(_("events.ics"), 'text/calendar', false, strlen($data));
echo $data;
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
if (Horde_Util::getFormData('import_ajax')) {
$stack = $notification->notify(array('listeners' => 'status', 'raw' => true));
if ($stack) {
- Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, Horde_Nls::getCharset()) . '));');
+ Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . '));');
}
Horde::addInlineScript('window.parent.$(window.name).remove();');
Horde::outputInlineScript();
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
return false;
Horde_Registry::appInit('kronolith', array('authentication' => 'none', 'session_control' => 'none'));
// We want to always generate UTF-8 iCalendar data.
-Horde_Nls::setCharset('UTF-8');
+$registry->setCharset('UTF-8');
// Determine the username to show free/busy time for.
$cal = Horde_Util::getFormData('c');
if ($user) {
$prefs = Horde_Prefs::singleton($conf['prefs']['driver'], 'kronolith', $user, '', null, false);
$prefs->retrieve();
- Horde_Nls::setTimeZone();
+ $registry->setTimeZone();
$cal = @unserialize($prefs->getValue('fb_cals'));
if (is_array($cal)) {
$cal = implode('|', $cal);
}
$browser->downloadHeaders(($user ? $user : $cal) . '.vfb',
- 'text/calendar; charset=' . Horde_Nls::getCharset(),
+ 'text/calendar; charset=' . $GLOBALS['registry']->getCharset(),
true,
strlen($fb));
echo $fb;
$now = new Horde_Date(time());
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', Horde_Nls::getCharset());
+$template->set('charset', $GLOBALS['registry']->getCharset());
$template->set('updated', $now->format(DATE_ATOM));
$template->set('kronolith_name', 'Kronolith');
$template->set('kronolith_version', $registry->getVersion());
$template->set('kronolith_uri', 'http://www.horde.org/kronolith/');
$template->set('kronolith_icon', Horde::url(Horde_Themes::img('kronolith.png'), true, -1));
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
-$template->set('calendar_name', @htmlspecialchars($share->get('name'), ENT_COMPAT, Horde_Nls::getCharset()));
-$template->set('calendar_desc', @htmlspecialchars($share->get('desc'), ENT_COMPAT, Horde_Nls::getCharset()), true);
-$template->set('calendar_owner', @htmlspecialchars($identity->getValue('fullname'), ENT_COMPAT, Horde_Nls::getCharset()));
-$template->set('calendar_email', @htmlspecialchars($identity->getValue('from_addr'), ENT_COMPAT, Horde_Nls::getCharset()), true);
+$template->set('calendar_name', @htmlspecialchars($share->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()));
+$template->set('calendar_desc', @htmlspecialchars($share->get('desc'), ENT_COMPAT, $GLOBALS['registry']->getCharset()), true);
+$template->set('calendar_owner', @htmlspecialchars($identity->getValue('fullname'), ENT_COMPAT, $GLOBALS['registry']->getCharset()));
+$template->set('calendar_email', @htmlspecialchars($identity->getValue('from_addr'), ENT_COMPAT, $GLOBALS['registry']->getCharset()), true);
$template->set('self_url', $self_url);
$twentyFour = $prefs->getValue('twentyFor');
}
$modified = new Horde_Date($modified);
/* Description. */
- $desc = @htmlspecialchars($event->description, ENT_COMPAT, Horde_Nls::getCharset());
+ $desc = @htmlspecialchars($event->description, ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (strlen($desc)) {
$desc .= '<br /><br />';
}
$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, Horde_Nls::getCharset());
+ $desc .= '<br />' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
if (strlen($event->location)) {
- $desc .= '<br />' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, Horde_Nls::getCharset());
+ $desc .= '<br />' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$desc .= '<br />' . _("Event Status:") . ' ' . Kronolith::statusToString($event->status);
- $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, Horde_Nls::getCharset());
- $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, Horde_Nls::getCharset());
+ $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, $GLOBALS['registry']->getCharset());
$entries[$id]['url'] = htmlspecialchars(Horde::url($event->getViewUrl(), true, -1));
$entries[$id]['modified'] = $modified->format(DATE_ATOM);
}
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
return $result;
$share = $kronolith_shares->getShare($event->calendar);
$iCal = new Horde_iCalendar($version);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'utf-8'));
// Create a new vEvent.
$iCal->addComponent($event->toiCalendar($iCal));
$share = $kronolith_shares->getShare($calendar);
$iCal = new Horde_iCalendar($version);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'UTF-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'UTF-8'));
if (strlen($share->get('desc'))) {
- $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), Horde_Nls::getCharset(), 'UTF-8'));
+ $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), $GLOBALS['registry']->getCharset(), 'UTF-8'));
}
foreach ($events as $dayevents) {
if (($reminder == 'owner' && $alarm_user == $owner) ||
($reminder == 'show' && in_array($calendar, $shown_calendars)) ||
$reminder == 'read') {
- Horde_Nls::setLanguageEnvironment($prefs->getValue('language'));
+ $GLOBALS['registry']->setLanguageEnvironment($prefs->getValue('language'));
$alarm = $event->toAlarm($time, $alarm_user, $prefs);
if ($alarm) {
$alarm_list[] = $alarm;
}
/* Set the timezone variable, if available. */
- Horde_Nls::setTimeZone();
+ $GLOBALS['registry']->setTimeZone();
/* Create a share instance. */
$GLOBALS['kronolith_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
$alarmCount++;
$tree->addNode($parent . $calId . $event->id,
$parent,
- htmlspecialchars($event->getTitle(), ENT_COMPAT, Horde_Nls::getCharset()),
+ htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()),
$indent + 1,
false,
array('icon' => 'alarm.png',
*/
public function convertToDriver($value)
{
- return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
/**
$vEvent->setAttribute('LAST-MODIFIED', $modified);
}
- $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), Horde_Nls::getCharset(), 'utf-8'));
+ $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), $GLOBALS['registry']->getCharset(), 'utf-8'));
$name = Kronolith::getUserName($this->creator);
if (!$v1) {
- $name = Horde_String::convertCharset($name, Horde_Nls::getCharset(), 'utf-8');
+ $name = Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'utf-8');
}
$vEvent->setAttribute('ORGANIZER',
'mailto:' . Kronolith::getUserEmail($this->creator),
array('CN' => $name));
if (!$this->private || $this->creator == $GLOBALS['registry']->getAuth()) {
if (!empty($this->description)) {
- $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, Horde_Nls::getCharset(), 'utf-8'));
+ $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), 'utf-8'));
}
// Tags
$tags = implode(', ', $tags);
}
if (!empty($tags)) {
- $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, Horde_Nls::getCharset(), 'utf-8'));
+ $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, $GLOBALS['registry']->getCharset(), 'utf-8'));
}
// Location
if (!empty($this->location)) {
- $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, Horde_Nls::getCharset(), 'utf-8'));
+ $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, $GLOBALS['registry']->getCharset(), 'utf-8'));
}
if ($this->geoLocation) {
$vEvent->setAttribute('GEO', array('latitude' => $this->geoLocation['lat'], 'longitude' => $this->geoLocation['lon']));
}
} else {
if (!empty($status['name'])) {
- $params['CN'] = Horde_String::convertCharset($status['name'], Horde_Nls::getCharset(), 'utf-8');
+ $params['CN'] = Horde_String::convertCharset($status['name'], $GLOBALS['registry']->getCharset(), 'utf-8');
}
if (!empty($email)) {
$email = 'mailto:' . $email;
*/
public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message)
{
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
/* New event? */
if ($this->id === null) {
*/
public function toASAppointment()
{
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$message = new Horde_ActiveSync_Message_Appointment(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger')));
$message->setSubject(Horde_String::convertCharset($this->getTitle(), $charset, 'utf-8'));
// Convert IDN hosts to ASCII.
if (Horde_Util::extensionExists('idn')) {
$old_error = error_reporting(0);
- $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], Horde_Nls::getCharset(), 'UTF-8'));
+ $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8'));
error_reporting($old_error);
} elseif (Horde_Mime::is8bit($url['host'])) {
//throw new Kronolith_Exception(_("Invalid character in URL."));
'',
array('style' => $this->getCSSColors(false)));
}
- $link .= @htmlspecialchars($event_title, ENT_QUOTES, Horde_Nls::getCharset());
+ $link .= @htmlspecialchars($event_title, ENT_QUOTES, $GLOBALS['registry']->getCharset());
if ($read_permission && $view_url) {
$link .= '</a>';
}
Horde_Ui_JsCalendar::init(array('short_weekdays' => true));
if (isset($GLOBALS['language'])) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
// Maps
$code['conf']['maps'] = $GLOBALS['conf']['maps'];
- return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, Horde_Nls::getCharset()) . ';');
+ return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $registry->getCharset()) . ';');
}
/**
$userName = $identity->getName();
$mail = new Horde_Mime_Mail(
array('from' => $identity->getDefaultFromAddress(true),
- 'charset' => Horde_Nls::getCharset())
+ 'charset' => $GLOBALS['registry']->getCharset())
);
$mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
}
}
$mail->addHeader('Subject', _("Ownership assignment"));
$mail->addHeader('To', $to);
- $mail->setBody($message, Horde_Nls::getCharset());
+ $mail->setBody($message, $GLOBALS['registry']->getCharset());
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
$share->get('name'));
}
$mail->addHeader('To', $to);
- $mail->setBody($message, Horde_Nls::getCharset());
+ $mail->setBody($message, $GLOBALS['registry']->getCharset());
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
$share->get('name'));
}
$mail->addHeader('To', $groupOb->getName() . ' <' . $groupOb->data['email'] . '>');
- $mail->setBody($message, Horde_Nls::getCharset());
+ $mail->setBody($message, $GLOBALS['registry']->getCharset());
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
public static function sendITipNotifications($event, $notification,
$action, $instance = null)
{
- global $conf;
+ global $conf, $registry;
if (!$event->attendees) {
return;
/* Build the iCalendar data */
$iCal = new Horde_iCalendar();
$iCal->setAttribute('METHOD', $method);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $registry->getCharset(), 'utf-8'));
$vevent = $event->toiCalendar($iCal);
if ($action == self::ITIP_CANCEL && !empty($instance)) {
// Recurring event instance deletion, need to specify the
$ics->setContents($iCal->exportvCalendar());
$ics->setName($filename);
$ics->setContentTypeParameter('METHOD', $method);
- $ics->setCharset(Horde_Nls::getCharset());
+ $ics->setCharset($registry->getCharset());
$multipart = new Horde_Mime_Part();
$multipart->setType('multipart/alternative');
$bodyText = new Horde_Mime_Part();
$bodyText->setType('text/plain');
- $bodyText->setCharset(Horde_Nls::getCharset());
+ $bodyText->setCharset($registry->getCharset());
$bodyText->setContents($view->render('notification.plain.php'));
$multipart->addPart($bodyText);
$bodyHtml = new Horde_Mime_Part();
$bodyHtml->setType('text/html');
- $bodyHtml->setCharset(Horde_Nls::getCharset());
+ $bodyHtml->setCharset($registry->getCharset());
$bodyHtml->setContents($view->render('notification.html.php'));
$multipart->addPart($bodyHtml);
$multipart->addPart($ics);
$mail = new Horde_Mime_Mail(array('subject' => $view->subject,
'to' => $recipient,
'from' => $ident->getDefaultFromAddress(true),
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $registry->getCharset()));
$mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
$mail->setBasePart($multipart);
}
foreach ($addresses as $lang => $twentyFour) {
- Horde_Nls::setLanguageEnvironment($lang);
+ $GLOBALS['registry']->setLanguageEnvironment($lang);
switch ($action) {
case 'add':
$mime_mail = new Horde_Mime_Mail(array('subject' => $subject . ' ' . $event->title,
'to' => implode(',', $df_recipients),
'from' => $identity->getDefaultFromAddress(true),
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
$mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
- $mime_mail->setBody($message, Horde_Nls::getCharset(), true);
+ $mime_mail->setBody($message, $GLOBALS['registry']->getCharset(), true);
Horde::logMessage(sprintf('Sending event notifications for %s to %s', $event->title, implode(', ', $df_recipients)), 'DEBUG');
$mime_mail->send($GLOBALS['injector']->getInstance('Horde_Mail'), false, false);
}
$iCal->setAttribute(
'X-WR-CALNAME',
Horde_String::convertCharset($share->get('name'),
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
'utf-8'));
} catch (Exception $e) {
}
$GLOBALS['browser']->downloadHeaders(
$event->getTitle() . '.ics',
- 'text/calendar; charset=' . Horde_Nls::getCharset(),
+ 'text/calendar; charset=' . $GLOBALS['registry']->getCharset(),
true, strlen($content));
echo $content;
exit;
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . $url);
$lang = $prefs->getValue('language');
$twentyFour = $prefs->getValue('twentyFour');
$dateFormat = $prefs->getValue('date_format');
- Horde_Nls::setLanguageEnvironment($lang);
+ $GLOBALS['registry']->setLanguageEnvironment($lang);
$mime_mail = new Horde_Mime_Mail(array('subject' => sprintf(_("Your daily agenda for %s"), $runtime->strftime($dateFormat)),
'to' => $email,
'from' => $GLOBALS['conf']['reminder']['from_addr'],
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
$mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
$pad = max(Horde_String::length(_("All day")) + 2, $twentyFour ? 6 : 8);
$message .= $event->title . "\n";
}
- $mime_mail->setBody($message, Horde_Nls::getCharset(), true);
+ $mime_mail->setBody($message, $GLOBALS['registry']->getCharset(), true);
try {
$mime_mail->addRecipients($email);
} catch (Horde_Mime_Exception $e) {}
Horde::addScriptFile('stripe.js', 'horde');
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php if (strlen($this->event->description)): ?>
<tr>
<td style="font-weight:bold;vertical-align:top"><?php echo _("Description:") ?></td>
- <td><?php echo Horde_Text_Filter::filter($this->event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => Horde_Nls::getCharset())) ?></td>
+ <td><?php echo Horde_Text_Filter::filter($this->event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => $GLOBALS['registry']->getCharset())) ?></td>
</tr>
<?php endif; ?>
<?php if ($this->attendees): ?>
* JavaScript variables for the traditional interface.
*/
-$charset = Horde_Nls::getCharset();
+$charset = $GLOBALS['registry']->getCharset();
/* Variables used in core javascript files. */
$var = array(
<!-- owner -->
<tr>
<td class="rightAlign"><strong><?php echo _("Owner") ?> </strong></td>
- <td><?php echo @htmlspecialchars($owner, ENT_COMPAT, Horde_Nls::getCharset()) ?> </td>
+ <td><?php echo @htmlspecialchars($owner, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?> </td>
</tr>
<?php endif; ?>
<?php if (isset($created)): ?>
<tr>
<td class="nowrap rightAlign"><strong><?php echo _("Created") ?></strong> </td>
- <td class="nowrap"><?php echo $created->strftime($dateFormat) . ' ' . $created->format($timeFormat) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, Horde_Nls::getCharset()) ?></td>
+ <td class="nowrap"><?php echo $created->strftime($dateFormat) . ' ' . $created->format($timeFormat) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
</tr>
<?php endif; ?>
<?php if (isset($modified)): ?>
<tr>
<td class="nowrap rightAlign"><strong><?php echo _("Last Modified") ?></strong> </td>
- <td class="nowrap"><?php echo $modified->strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, Horde_Nls::getCharset()) ?></td>
+ <td class="nowrap"><?php echo $modified->strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
</tr>
<?php endif; ?>
global $index, $sourceid;
// Make sure spacing is correct.
- $code = Horde_Text_Filter::filter($code, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true));
+ $code = Horde_Text_Filter::filter($code, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true));
// Split all the symbols.
preg_match_all('/(^|[^\w\#&])([\w~][\w]*)\b/', $code, $match);
$res = '';
foreach ($lines as $line) {
$res .= !empty($res) ? "\n" : '';
- $res .= $pre . Horde_Text_Filter::filter($line, 'space2html', array('charset' => Horde_Nls::getCharset(), 'encode' => true, 'encode_all' => true)) . $post;
+ $res .= $pre . Horde_Text_Filter::filter($line, 'space2html', array('charset' => $GLOBALS['registry']->getCharset(), 'encode' => true, 'encode_all' => true)) . $post;
}
return $res;
}
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
);
if ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
}
$num_memos = Mnemo::countMemos();
foreach ($next_step as $row) {
if ($max_memos !== true && $num_memos >= $max_memos) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
}
' VALUES (?, ?, ?, ?, ?, ?)';
$values = array($this->_notepad,
$noteId,
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($body, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($uid, Horde_Nls::getCharset(), $this->_params['charset']));
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($body, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($uid, $GLOBALS['registry']->getCharset(), $this->_params['charset']));
/* Log the query at a DEBUG log level. */
Horde::logMessage(sprintf('Mnemo_Driver_sql::add(): %s', $query), 'DEBUG');
$query = 'UPDATE ' . $this->_params['table'] .
' SET memo_desc = ?, memo_body = ?';
- $values = array(Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($body, Horde_Nls::getCharset(), $this->_params['charset']));
+ $values = array(Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($body, $GLOBALS['registry']->getCharset(), $this->_params['charset']));
// Don't change the category if it isn't provided.
if (!is_null($category)) {
$query .= ', memo_category = ?';
- $values[] = Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']);
+ $values[] = Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
$query .= ' WHERE memo_owner = ? AND memo_id = ?';
array_push($values, $this->_notepad, $noteId);
/* Check permissions. */
if ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), Mnemo::hasPermission('max_notes')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), Mnemo::hasPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
}
/* Let's assume that the note content can be converted to ISO-8859-1 if this
* is the current language's charset, as long as we don't have UTF-8 support
* in File_PDF. */
-if (Horde_Nls::getCharset(true) == 'ISO-8859-1') {
- $note = String::convertCharset($note, Horde_Nls::getCharset(), 'ISO-8859-1');
+if ($GLOBALS['registry']->getCharset(true) == 'ISO-8859-1') {
+ $note = String::convertCharset($note, $GLOBALS['registry']->getCharset(), 'ISO-8859-1');
}
/* Set up the PDF object. */
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php if (isset($created)): ?>
<tr>
<td align="right"><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, Horde_Nls::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, $GLOBALS['registry']->getCharset()) ?></td>
</tr>
<?php endif; ?>
<?php if (isset($modified)): ?>
<tr>
<td align="right"><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, Horde_Nls::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, $GLOBALS['registry']->getCharset()) ?></td>
</tr>
<?php endif; ?>
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.warning', array('content.raw'));
$templates[Horde_Data::IMPORT_FILE] = array(NAG_TEMPLATES . '/data/export.inc');
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
$share = $GLOBALS['nag_shares']->getShare($tasklist);
$iCal = new Horde_iCalendar($version);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'utf-8'));
$tasks->reset();
while ($task = $tasks->each()) {
}
foreach ($users as $alarm_user) {
$prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'], 'nag', $alarm_user, null, null, false);
- Horde_Nls::setLanguageEnvironment($prefs->getValue('language'));
+ $GLOBALS['registry']->setLanguageEnvironment($prefs->getValue('language'));
$alarm_list[] = $alarm->toAlarm($alarm_user, $prefs);
}
}
protected function _init()
{
// Set the timezone variable.
- Horde_Nls::setTimeZone();
+ $GLOBALS['registry']->setTimeZone();
// Create a share instance.
$GLOBALS['nag_shares'] = $GLOBALS['injector']->getInstance('Horde_Share')->getScope();
$owner,
$assignee,
$taskId,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($uid, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($uid, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)$start,
(int)$due,
(int)$priority,
number_format($estimate, 2),
(int)$completed,
- Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)$alarm,
- serialize(Horde_String::convertCharset($methods, Horde_Nls::getCharset(), $this->_params['charset'])),
+ serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])),
(int)$private,
$parent);
$this->_params['table']);
$values = array($owner,
$assignee,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)$start,
(int)$due,
(int)$priority,
number_format($estimate, 2),
(int)$completed,
(int)$completed_date,
- Horde_String::convertCharset($category, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
(int)$alarm,
- serialize(Horde_String::convertCharset($methods, Horde_Nls::getCharset(), $this->_params['charset'])),
+ serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])),
$parent,
(int)$private,
$this->_tasklist,
if ($vars->get('task_id') == $task->id) {
continue;
}
- $task_enums[htmlspecialchars($task->id)] = str_repeat(' ', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, Horde_Nls::getCharset());
+ $task_enums[htmlspecialchars($task->id)] = str_repeat(' ', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$users = array();
$share = $GLOBALS['nag_shares']->getShare($tasklist);
'mail/compose',
array(array('to' => $email))))
. @htmlspecialchars($fullname . ' <' . $email . '>',
- ENT_COMPAT, Horde_Nls::getCharset())
+ ENT_COMPAT, $GLOBALS['registry']->getCharset())
. '</a>';
- } else {
- return @htmlspecialchars($fullname, ENT_COMPAT, Horde_Nls::getCharset());
}
+
+ return @htmlspecialchars($fullname, ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
/**
$mail->addHeader('From', $from);
foreach ($addresses as $lang => $twentyFour) {
- Horde_Nls::setLanguageEnvironment($lang);
+ $GLOBALS['registry']->setLanguageEnvironment($lang);
$view_link = Horde_Util::addParameter(Horde::applicationUrl('view.php', true),
array('tasklist' => $task->tasklist,
break;
}
- $mail->addHeader('Subject', $subject . ' ' . $task->name, Horde_Nls::getCharset());
+ $mail->addHeader('Subject', $subject . ' ' . $task->name, $GLOBALS['registry']->getCharset());
foreach ($twentyFour as $tf => $dateFormat) {
foreach ($dateFormat as $df => $df_recipients) {
$message .= "\n\n" . _("Task description:") . "\n\n" . $task->desc;
}
- $mail->setBody($message, Horde_Nls::getCharset());
+ $mail->setBody($message, $GLOBALS['registry']->getCharset());
$mail->clearRecipients();
$mail->addRecipients($df_recipients);
}
if (!empty($this->name)) {
- $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, Horde_Nls::getCharset(), 'utf-8'));
+ $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8'));
}
if (!empty($this->desc)) {
- $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, Horde_Nls::getCharset(), 'utf-8'));
+ $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, $GLOBALS['registry']->getCharset(), 'utf-8'));
}
if (isset($this->priority)) {
}
if (!empty($this->category)) {
- $vTodo->setAttribute('CATEGORIES', $v1 ? $this->category : Horde_String::convertCharset($this->category, Horde_Nls::getCharset(), 'utf-8'));
+ $vTodo->setAttribute('CATEGORIES', $v1 ? $this->category : Horde_String::convertCharset($this->category, $GLOBALS['registry']->getCharset(), 'utf-8'));
}
/* Get the task's history. */
$message = new Horde_ActiveSync_Message_Task();
/* Notes and Title */
- $message->setBody(Horde_String::convertCharset($this->desc, Horde_Nls::getCharset(), 'utf-8'));
- $message->setSubject(Horde_String::convertCharset($this->name, Horde_Nls::getCharset(), 'utf-8'));
+ $message->setBody(Horde_String::convertCharset($this->desc, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $message->setSubject(Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8'));
/* Completion */
if ($this->completed) {
function fromASTask(Horde_ActiveSync_Message_Task $message)
{
/* Notes and Title */
- $this->desc = Horde_String::convertCharset($message->getBody(), 'utf-8', Horde_Nls::getCharset());
- $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', Horde_Nls::getCharset());
+ $this->desc = Horde_String::convertCharset($message->getBody(), 'utf-8', $GLOBALS['registry']->getCharset());
+ $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', $GLOBALS['registry']->getCharset());
/* Completion */
if ($this->completed = $message->getComplete()) {
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . Horde::applicationUrl('list.php', true));
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?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, Horde_Nls::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, $GLOBALS['registry']->getCharset()) ?></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, Horde_Nls::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, $GLOBALS['registry']->getCharset()) ?></td>
</tr>
<?php endif; ?>
'ORDER BY n.publish DESC ' .
'LIMIT 0, ' . $this->_params['limit'];
- $params = array(News::CONFIRMED, $this->_params['category'], $this->_params['category'], Horde_Nls::select());
+ $params = array(News::CONFIRMED, $this->_params['category'], $this->_params['category'], $GLOBALS['registry']->preferredLang());
$rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC);
if ($rows instanceof PEAR_Error) {
return $rows->getDebugInfo();
{
require_once dirname(__FILE__) . '/../base.php';
- $params = array(News::CONFIRMED, Horde_Nls::select());
+ $params = array(News::CONFIRMED, $GLOBALS['registry']->preferredLang());
$query = 'SELECT n.id, n.publish, n.comments, n.picture, n.category1, nl.title, nl.abbreviation ' .
'FROM ' . $GLOBALS['news']->prefix . ' AS n, ' . $GLOBALS['news']->prefix . '_body AS nl WHERE ' .
'n.status = ? AND n.publish <= NOW() ' .
return $view->render('/block/news.php');
}
-}
\ No newline at end of file
+}
'ORDER BY n.publish DESC ' .
'LIMIT 0, ' . $this->_params['limit'];
- $params = array(News::CONFIRMED, 0, Horde_Nls::select());
+ $params = array(News::CONFIRMED, 0, $GLOBALS['registry']->preferredLang());
$rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC);
if ($rows instanceof PEAR_Error) {
return $rows->getDebugInfo();
'LIMIT 0, ' . $this->_params['limit'];
$younger = $_SERVER['REQUEST_TIME'] - $this->_params['days'] * 86400;
- $params = array(News::CONFIRMED, date('Y-m-d', $younger), Horde_Nls::select());
+ $params = array(News::CONFIRMED, date('Y-m-d', $younger), $GLOBALS['registry']->preferredLang());
$rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC);
if ($rows instanceof PEAR_Error) {
return $rows->getDebugInfo();
return $view->render('/block/titles.php');
}
-}
\ No newline at end of file
+}
'LIMIT 0, ' . $this->_params['limit'];
$younger = $_SERVER['REQUEST_TIME'] - $this->_params['days'] * 86400;
- $params = array(News::CONFIRMED, date('Y-m-d', $younger), Horde_Nls::select());
+ $params = array(News::CONFIRMED, date('Y-m-d', $younger), $GLOBALS['registry']->preferredLang());
$rows = $GLOBALS['news']->db->getAll($query, $params, DB_FETCHMODE_ASSOC);
if ($rows instanceof PEAR_Error) {
return $rows->getDebugInfo();
return $view->render('/block/titles.php');
}
-}
\ No newline at end of file
+}
$sql = 'FROM ' . $GLOBALS['news']->prefix . ' AS n, ' . $GLOBALS['news']->prefix . '_body AS l '
. ' WHERE n.id = l.id AND l.lang = ?';
- $params = array('_lang' => Horde_Nls::select());
+ $params = array('_lang' => $GLOBALS['registry']->preferredLang());
if ($perms == Horde_Perms::READ) {
$sql .= ' AND n.publish <= ? ';
. $this->prefix . ' AS n WHERE l.lang = ? AND n.id = l.id AND n.status = ? ORDER BY n.publish DESC LIMIT 0, '
. ($minimize ? '100' : '500');
- $result = $this->db->query($sql, array(Horde_Nls::select(), News::CONFIRMED));
+ $result = $this->db->query($sql, array($GLOBALS['registry']->preferredLang(), News::CONFIRMED));
if ($result instanceof PEAR_Error) {
return $result;
}
static $lang;
if ($lang === null) {
- $lang = Horde_Nls::Select();
+ $lang = $GLOBALS['registry']->preferredLang();
if (!empty($conf['attributes']['languages']) &&
!in_array($lang, $conf['attributes']['languages'])) {
$lang = $conf['attributes']['languages'][0];
{
/* Set parents defualt data */
parent::__construct(array('templatePath' => NEWS_TEMPLATES,
- 'encoding' => Horde_Nls::select()));
+ 'encoding' => $GLOBALS['registry']->preferredLang()));
}
/**
$row['publish'],
News::getUrlFor('news', $id, true, -1));
-$mail = new Horde_Mime_Mail(array('subject' => $row['title'], 'body' => $body, 'to' => $to, 'from' => $from, 'charset' => Horde_Nls::getCharset()));
+$mail = new Horde_Mime_Mail(array('subject' => $row['title'], 'body' => $body, 'to' => $to, 'from' => $from, 'charset' => $GLOBALS['registry']->getCharset()));
try {
$mail->send($injector->getInstance('Horde_Mail'));
$notification->push(sprintf(_("News succesfully send to %s"), $to), 'horde.success');
$pdf->write(12, _("On") . ': ' . News::dateFormat($row['publish']) . "\n");
$pdf->write(12, _("Link") . ': ' . News::getUrlFor('news', $id, true) . "\n\n", News::getUrlFor('news', $id, true));
-$pdf->multiCell(0, 12, Horde_String::convertCharset(strip_tags($row['content']), Horde_Nls::getCharset(), 'UTF-8'));
+$pdf->multiCell(0, 12, Horde_String::convertCharset(strip_tags($row['content']), $GLOBALS['registry']->getCharset(), 'UTF-8'));
$browser->downloadHeaders($id . '.pdf', 'application/pdf');
echo $pdf->getOutput();
$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="' . Horde_Nls::getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($title) . '</title>
- <language>' . str_replace('_', '-', strtolower(Horde_Nls::select())) . '</language>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
<lastBuildDate>' . date('r') . '</lastBuildDate>
<description>' . htmlspecialchars($title) . '</description>
<link>' . Horde::applicationUrl('index.php', true, -1) . '</link>
$cache->set($cache_key, $rss);
}
-header('Content-type: text/xml; charset=' . Horde_Nls::getCharset());
+header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
echo $rss;
$title = $registry->get('name', 'horde');
$read_url = Horde::applicationUrl('read.php', true, -1);
- $rss = '<?xml version="1.0" encoding="' . Horde_Nls::getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($title) . '</title>
- <language>' . str_replace('_', '-', strtolower(Horde_Nls::select())) . '</language>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
<lastBuildDate>' . date('r') . '</lastBuildDate>
<description>' . htmlspecialchars($title) . '</description>
<link>' . Horde::applicationUrl('index.php', true, -1) . '</link>
'nl.title, nl.abbreviation ' .
'FROM ' . $news->prefix . ' AS n, ' . $news->prefix . '_body AS nl ' .
'WHERE n.status="' . News::CONFIRMED . '" AND n.publish<=NOW() ' .
- 'AND nl.lang="' . Horde_Nls::select() . '" AND n.id=nl.id ORDER BY publish DESC';
+ 'AND nl.lang="' . $registry->preferredLang() . '" AND n.id=nl.id ORDER BY publish DESC';
$rssbody = '';
$query = $news->db->modifyLimitQuery($query, 0, 10);
$list = $news->db->getAssoc($query, true, array(), DB_FETCHMODE_ASSOC);
}
// Wee need the last published news time
- $rssheader = '<?xml version="1.0" encoding="' . Horde_Nls::getCharset() . '" ?>
+ $rssheader = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
<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(Horde_Nls::select())) . '</language>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
<lastBuildDate>' . date('r', $lastnewstime) . '</lastBuildDate>
<description>' . htmlspecialchars($title) . '</description>
<link>' . Horde::applicationUrl('index.php', true, -1) . '</link>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
//error_reporting(E_NONE);
//ini_set("display_errors", 0);
-#setlocale(LC_ALL, Horde_Nls::select());
-#setlocale(LC_ALL, 'en_US');
+//setlocale(LC_ALL, $registry->preferredLang());
+//setlocale(LC_ALL, 'en_US');
$graphtype = Horde_Util::getFormData('graph');
$graphinfo = Operator::getGraphInfo($graphtype);
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_NLS::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
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, Horde_Nls::getCharset()); ?>);
-var destinations = $H(<?php echo Horde_Serialize::serialize($destinations, Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
-var conferences = $H(<?php echo Horde_Serialize::serialize($conferences, Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
-var recordings = $H(<?php echo Horde_Serialize::serialize($recordings, Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
+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()); ?>);
function empty(p)
{
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
/* Check permissions. */
if (Trean::hasPermission('max_bookmarks') !== true &&
Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
}
/* Check permissions. */
if (Trean::hasPermission('max_folders') !== true &&
Trean::hasPermission('max_folders') <= Trean::countFolders()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
}
$folders_exceeded = Trean::hasPermission('max_folders') !== true &&
Trean::hasPermission('max_folders') <= Trean::countFolders();
if ($folders_exceeded) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
}
$bookmarks_exceeded = Trean::hasPermission('max_bookmarks') !== true &&
Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks();
if ($bookmarks_exceeded) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
}
continue;
}
if ($max_folders !== true && $num_folders >= $max_folders) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
}
$line, $temp)) {
/* A bookmark. */
if ($max_bookmarks !== true && $num_bookmarks >= $max_bookmarks) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
}
protected function _init()
{
// Set the timezone variable.
- Horde_Nls::setTimeZone();
+ $GLOBALS['registry']->setTimeZone();
// Create db and share instances.
$GLOBALS['trean_db'] = Trean::getDb();
return $update;
}
$result = $update->execute(array($this->folder,
- Horde_String::convertCharset($this->url, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->title, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->description, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->url, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->title, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
$this->clicks,
$this->rating,
$this->id));
$result = $insert->execute(array($bookmark_id,
$this->folder,
- Horde_String::convertCharset($this->url, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->title, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->description, Horde_Nls::getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->url, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->title, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
$this->clicks,
$this->rating,
));
$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="' . Horde_Nls::getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($folderId == null ? $registry->get('name') : $folder->get('name')) . '</title>
- <language>' . Horde_Nls::select() . '</language>
- <charset>' . Horde_Nls::getCharset() . '</charset>
+ <language>' . $registry->preferredLang() . '</language>
+ <charset>' . $GLOBALS['registry']->getCharset() . '</charset>
<lastBuildDate>' . date('Y-m-d H:i:s') . '</lastBuildDate>
<image>
<url>http://' . $_SERVER['SERVER_NAME'] . $registry->get('webroot') . '/themes/graphics/favicon.ico</url>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
$url = $url
// 'type' => 'prefs',
// 'params' => array(
// 'name' => 'prefs',
-// 'charset' => Horde_Nls::getCharset()
+// 'charset' => $GLOBALS['registry']->getCharset()
// ),
// 'map' => array(
// '__key' => 'id',
} elseif ($attributes[$field]['type'] == 'datetime') {
$row[$field] = strftime('%Y-%m-%d %R', $attribute);
} else {
- $row[$field] = Horde_String::convertCharset($attribute, Horde_Nls::getCharset(), $params['charset']);
+ $row[$field] = Horde_String::convertCharset($attribute, $GLOBALS['registry']->getCharset(), $params['charset']);
}
}
}
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $driver->title), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $driver->title), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
$error = true;
$charsets[$charset] = $charset;
}
}
- $my_charset = Horde_Nls::getCharset(true);
+ $my_charset = $GLOBALS['registry']->getCharset(true);
}
foreach ($templates[$next_step] as $template) {
$hash = $object->getAttributes();
$vcard = new Horde_iCalendar_vcard($version);
$formattedname = false;
- $charset = $version == '2.1' ? array('CHARSET' => Horde_Nls::getCharset()) : array();
+ $charset = $version == '2.1' ? array('CHARSET' => $GLOBALS['registry']->getCharset()) : array();
foreach ($hash as $key => $val) {
if ($skipEmpty && !strlen($val)) {
}
if ($version != '2.1') {
- $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
}
switch ($key) {
);
$val = implode(';', $a);
if ($version != '2.1') {
- $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
}
if (!$fields || isset($fields['N'])) {
$vcard->setAttribute('N', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $a);
if (count($org) && (!$fields || isset($fields['ORG']))) {
$val = implode(';', $org);
if ($version != '2.1') {
- $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8');
- $org = Horde_String::convertCharset($org, Horde_Nls::getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $org = Horde_String::convertCharset($org, $GLOBALS['registry']->getCharset(), 'utf-8');
}
$vcard->setAttribute('ORG', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $org);
}
if ($version == '2.1') {
$params = array();
if (Horde_Mime::is8bit($val)) {
- $params['CHARSET'] = Horde_Nls::getCharset();
+ $params['CHARSET'] = $GLOBALS['registry']->getCharset();
}
} else {
$params = array('TYPE' => '');
- $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
}
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
if ($version == '2.1') {
$params = array('HOME' => null);
if (Horde_Mime::is8bit($val)) {
- $params['CHARSET'] = Horde_Nls::getCharset();
+ $params['CHARSET'] = $GLOBALS['registry']->getCharset();
}
} else {
$params = array('TYPE' => 'HOME');
- $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
}
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
if ($version == '2.1') {
$params = array('WORK' => null);
if (Horde_Mime::is8bit($val)) {
- $params['CHARSET'] = Horde_Nls::getCharset();
+ $params['CHARSET'] = $GLOBALS['registry']->getCharset();
}
} else {
$params = array('TYPE' => 'WORK');
- $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, Horde_Nls::getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
}
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
public function toASContact(Turba_Object $object)
{
$message = new Horde_ActiveSync_Message_Contact(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger')));
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$hash = $object->getAttributes();
foreach ($hash as $field => $value) {
switch ($field) {
public function fromASContact($message)
{
$hash = array();
- $charset = Horde_Nls::getCharset();
+ $charset = $GLOBALS['registry']->getCharset();
$formattedname = false;
$textMap = array(
if (is_array($ids)) {
$results = array();
foreach ($ids as $d) {
- $res = @ldap_read($this->_ds, Horde_String::convertCharset($d, Horde_Nls::getCharset(), $this->_params['charset']), $filter, $attr);
+ $res = @ldap_read($this->_ds, Horde_String::convertCharset($d, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr);
if ($res) {
if (!is_a($result = $this->_getResults($fields, $res), 'PEAR_Error')) {
$results = array_merge($results, $result);
return $results;
}
- $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, Horde_Nls::getCharset(), $this->_params['charset']), $filter, $attr);
+ $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr);
if (!$res) {
return PEAR::raiseError(sprintf(_("Read failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
}
$this->_encodeAttributes($attributes);
- if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, Horde_Nls::getCharset(), $this->_params['charset']), $attributes)) {
- return PEAR::raiseError('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . Horde_Nls::getCharset());
+ if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) {
+ return PEAR::raiseError('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . $GLOBALS['registry']->getCharset());
} else {
return true;
}
return PEAR::raiseError(_("Invalid key specified."));
}
- if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']))) {
+ if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']))) {
return PEAR::raiseError(sprintf(_("Delete failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
} else {
return true;
* values. These are needed so that we can delete any
* attributes that have been removed by using ldap_mod_del. */
$filter = $this->_buildObjectclassFilter();
- $oldres = @ldap_read($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']), $filter, array_merge(array_keys($attributes), array('objectclass')));
+ $oldres = @ldap_read($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, array_merge(array_keys($attributes), array('objectclass')));
$info = ldap_get_attributes($this->_ds, ldap_first_entry($this->_ds, $oldres));
if ($this->_params['version'] == 3 &&
return PEAR::raiseError(_("Missing DN in LDAP source configuration."));
}
- if (ldap_rename($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($newrdn, Horde_Nls::getCharset(), $this->_params['charset']), $this->_params['root'], true)) {
+ if (ldap_rename($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($newrdn, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $this->_params['root'], true)) {
$object_id = $newrdn . ',' . $this->_params['root'];
} else {
return PEAR::raiseError(sprintf(_("Failed to change name: (%s) %s; Old DN = %s, New DN = %s, Root = %s"),
$attributes[$key] == '') {
$oldval[$key] = $var[0];
- if (!@ldap_mod_del($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']), $oldval)) {
+ if (!@ldap_mod_del($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $oldval)) {
return PEAR::raiseError(sprintf(_("Modify failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
}
unset($attributes[$key]);
unset($attributes['objectclass']['count']);
$attributes['objectclass'] = array_values($attributes['objectclass']);
- if (!@ldap_modify($this->_ds, Horde_String::convertCharset($object_id, Horde_Nls::getCharset(), $this->_params['charset']), $attributes)) {
+ if (!@ldap_modify($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) {
return PEAR::raiseError(sprintf(_("Modify failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
} else {
return $object_id;
$clause .= '(&' . $this->_buildSearchQuery($vals) . ')';
} else {
if (isset($vals['field'])) {
- $rhs = Horde_String::convertCharset($vals['test'], Horde_Nls::getCharset(), $this->_params['charset']);
+ $rhs = Horde_String::convertCharset($vals['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
$clause .= Horde_Ldap::buildClause($vals['field'], $vals['op'], $rhs, array('begin' => !empty($vals['begin'])));
} else {
foreach ($vals as $test) {
} elseif (!empty($test['AND'])) {
$clause .= '(&' . $this->_buildSearchQuery($test) . ')';
} else {
- $rhs = Horde_String::convertCharset($test['test'], Horde_Nls::getCharset(), $this->_params['charset']);
+ $rhs = Horde_String::convertCharset($test['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
$clause .= Horde_Ldap::buildClause($test['field'], $test['op'], $rhs, array('begin' => !empty($vals['begin'])));
}
}
}
if (!is_array($val)) {
- $attributes[$key] = Horde_String::convertCharset($val, Horde_Nls::getCharset(), $this->_params['charset']);
+ $attributes[$key] = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
}
}
*/
function _convertToDriver($value)
{
- return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
/**
. ' '
. date($GLOBALS['prefs']->getValue('twentyFour') ? 'G:i' : 'g:i a', $entry['ts'])
. ' '
- . @htmlspecialchars($by, ENT_COMPAT, Horde_Nls::getCharset());
+ . @htmlspecialchars($by, ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
}
} catch (Exception $e) {
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$targetSource]['title']), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$targetSource]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, Horde_Nls::getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
<?php
global $language;
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
$filename = _("contact");
}
-$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), Horde_Nls::getCharset());
+$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), $GLOBALS['registry']->getCharset());
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
} elseif (!empty($conf['mail']['from_addr'])) {
$mail->addHeader('From', $conf['mail']['from_addr']);
} else {
- $mail->addHeader('From', Whups::formatUser($from), Horde_Nls::getCharset());
+ $mail->addHeader('From', Whups::formatUser($from), $GLOBALS['registry']->getCharset());
}
$subject = (is_null($ticket_id)
? ''
: '[' . $registry->get('name') . ' #' . $ticket_id . '] ')
. $subject;
- $mail->addHeader('Subject', $subject, Horde_Nls::getCharset());
+ $mail->addHeader('Subject', $subject, $GLOBALS['registry']->getCharset());
/* Get our array of comments, sorted in the appropriate order. */
if (!is_null($ticket_id)) {
array('@@comment@@', '@@full_name@@'),
array("\n\n" . $formattedComment, $full_name),
$message);
- $mail->setBody($body, Horde_Nls::getCharset());
+ $mail->setBody($body, $GLOBALS['registry']->getCharset());
$mail->addHeader('Message-ID', Horde_Mime::generateMessageId());
if ($ticket_id) {
}
$mail->clearRecipients();
- $mail->addHeader('To', $to, Horde_Nls::getCharset());
+ $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset());
try {
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'), true);
. 'VALUES (?, ?, ?, ?, ?)';
$values = array(
$new_id,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$slug,
$email);
$query = 'INSERT INTO whups_types' .
' (type_id, type_name, type_description) VALUES (?, ?, ?)';
$values = array($new_id,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addType(): query="%s"; values="%s"',
. 'state_description, state_category) VALUES (?, ?, ?, ?, ?)';
$values = array($new_id,
$typeId,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($category, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(),
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addState(): query="%s"; values="%s"',
. 'priority_name, priority_description) VALUES (?, ?, ?, ?)';
$values = array($new_id,
$typeId,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addPriority(): query="%s"; values="%s"',
. 'version_name, version_description, version_active) VALUES (?, ?, ?, ?, ?)';
$values = array((int)$new_id,
(int)$queueId,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
(int)$active);
Horde::logMessage(
. 'reply_name, reply_text) VALUES (?, ?, ?, ?)';
$values = array($type,
$new_id,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($text, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(),
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addReply(): query="%s"; values="%s"',
. 'ticket_timestamp, ticket_due, version_id)'
. ' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
$values = array($ticketId,
- Horde_String::convertCharset($summary, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($summary, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$requester,
$type,
array((int)$id,
(int)$ticket_id,
$creator,
- Horde_String::convertCharset($comment, Horde_Nls::getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($comment, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
time()));
if (is_a($result, 'PEAR_Error')) {
Horde::logMessage($result, 'ERR');
}
$query .= $this->_map[$field] . ' = ?, ';
- $values[] = Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->_params['charset']);
+ $values[] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
}
/* Don't try to execute an empty query (if we didn't find any updates
. 'queue_description = ?, queue_versioned = ?, '
. 'queue_slug = ?, queue_email = ? WHERE queue_id = ?';
$values = array(Horde_String::convertCharset($name,
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
Horde_String::convertCharset($description,
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
(empty($versioned) ? 0 : 1),
$slug,
{
$query = 'UPDATE whups_types' .
' SET type_name = ?, type_description = ? WHERE type_id = ?';
- $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$typeId);
Horde::logMessage(
{
$query = 'UPDATE whups_states SET state_name = ?, '
. 'state_description = ?, state_category = ? WHERE state_id = ?';
- $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($category, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$stateId);
Horde::logMessage(
$values = array($query->id, serialize($query->parameters),
serialize($query->query));
}
- $values = Horde_String::convertCharset($values, Horde_Nls::getCharset(),
+ $values = Horde_String::convertCharset($values, $GLOBALS['registry']->getCharset(),
$this->_params['charset']);
Horde::logMessage(
sprintf('Whups_Driver_sql::saveQuery(): query="%s"; values="%s"',
$query = 'UPDATE whups_priorities' .
' SET priority_name = ?, priority_description = ?' .
' WHERE priority_id = ?';
- $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$priorityId);
Horde::logMessage(
$query = 'UPDATE whups_versions SET version_name = ?, '
. 'version_description = ?, version_active = ? '
. 'WHERE version_id = ?';
- $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($description, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
(int)$active,
(int)$versionId);
{
$query = 'UPDATE whups_replies SET reply_name = ?, '
. 'reply_text = ? WHERE reply_id = ?';
- $values = array(Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($text, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$reply);
Horde::logMessage(
. ' VALUES (?, ?, ?, ?, ?, ?, ?)';
$values = array($new_id,
$type_id,
- Horde_String::convertCharset($name, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($desc, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$type,
serialize(
- Horde_String::convertCharset($params, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($params, $GLOBALS['registry']->getCharset(),
$this->_params['charset'])),
(int)($required == 'on'));
. 'SET attribute_name = ?, attribute_description = ?, '
. 'attribute_type = ?, attribute_params = ?, '
. 'attribute_required = ? WHERE attribute_id = ?';
- $values = array(Horde_String::convertCharset($newname, Horde_Nls::getCharset(),
+ $values = array(Horde_String::convertCharset($newname, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
- Horde_String::convertCharset($newdesc, Horde_Nls::getCharset(),
+ Horde_String::convertCharset($newdesc, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
$newtype,
serialize(
Horde_String::convertCharset($newparams,
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
$this->_params['charset'])),
(int)($newrequired == 'on'),
$attribute_id);
function _setAttributeValue($ticket_id, $attribute_id, $attribute_value)
{
$db_attribute_value = Horde_String::convertCharset((string)$attribute_value,
- Horde_Nls::getCharset(),
+ $GLOBALS['registry']->getCharset(),
$this->_params['charset']);
$this->_write_db->autoCommit(false);
time(),
(string)$user,
$type,
- Horde_String::convertCharset((string)$value, Horde_Nls::getCharset(),
+ Horde_String::convertCharset((string)$value, $GLOBALS['registry']->getCharset(),
$this->_params['charset']),
(int)$value);
Horde::logMessage(
$icon = base64_encode(file_get_contents($registry->get('themesfs', 'whups') . '/graphics/whups.png'));
// Charset.
-$charset = Horde_Nls::getCharset();
+$charset = $GLOBALS['registry']->getCharset();
header('Content-Type: text/xml; charset=' . $charset);
echo <<<PAYLOAD
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', Horde_Nls::getCharset());
+$template->set('charset', $GLOBALS['registry']->getCharset());
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
$template->set('title', htmlspecialchars($whups_query->name ? $whups_query->name : _("Query Results")));
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', Horde_Nls::getCharset());
+$template->set('charset', $GLOBALS['registry']->getCharset());
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
if (isset($type) && isset($queue['name'])) {
// Set charset to UTF-8 for most flexible conversion between email charset and
// backend charset.
-Horde_Nls::setCharsetEnvironment('UTF-8');
+$registry->setCharsetEnvironment('UTF-8');
// Read and parse the message.
if (empty($mail['user'])) {
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', Horde_Nls::getCharset());
+$template->set('charset', $GLOBALS['registry']->getCharset());
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
$template->set('title', _("Search Results"));
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', Horde_Nls::getCharset());
+$template->set('charset', $GLOBALS['registry']->getCharset());
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
$template->set('title', htmlspecialchars($details['summary']));
*/
function getCharset()
{
- return Horde_Nls::getCharset();
+ return $GLOBALS['registry']->getCharset();
}
/**
*/
function _convertToDriver($value)
{
- return Horde_String::convertCharset($value, Horde_Nls::getCharset(), $this->getCharset());
+ return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->getCharset());
}
/**
$this->_proc->deleteRule('Embed');
}
- $this->_proc->setFormatConf('Xhtml', 'charset', Horde_Nls::getCharset());
+ $this->_proc->setFormatConf('Xhtml', 'charset', $GLOBALS['registry']->getCharset());
$this->_proc->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS);
$create = $this->allows(WICKED_MODE_CREATE) ? 1 : 0;
$linkConf = array('pages' => $wicked->getPages(),
}
foreach ($references as $key => $page) {
- $references[$key]['page_url'] = @htmlspecialchars(Wicked::url($page['page_name']), ENT_QUOTES, Horde_Nls::getCharset());
- $references[$key]['page_name'] = @htmlspecialchars($page['page_name'], ENT_QUOTES, Horde_Nls::getCharset());
+ $references[$key]['page_url'] = @htmlspecialchars(Wicked::url($page['page_name']), ENT_QUOTES, $GLOBALS['registry']->getCharset());
+ $references[$key]['page_name'] = @htmlspecialchars($page['page_name'], ENT_QUOTES, $GLOBALS['registry']->getCharset());
// Since the page name can have [ and ] and other special
// characters in it, and we don't want the browser or PHP decoding
$conf['wicked']['notify_address'],
'from' => $from . '<' . $from_addr
. '>',
- 'charset' => Horde_Nls::getCharset()));
+ 'charset' => $GLOBALS['registry']->getCharset()));
$mail->addHeader('User-Agent', 'Wicked ' . $GLOBALS['registry']->getVersion());
$mail->addHeader('Precedence', 'bulk');
$mail->addHeader('Auto-Submitted', 'auto-replied');
$icon = base64_encode(file_get_contents($registry->get('themesfs', 'wicked') . '/graphics/wicked.png'));
// Charset.
-$charset = Horde_Nls::getCharset();
+$charset = $GLOBALS['registry']->getCharset();
header('Content-Type: text/xml; charset=' . $charset);
echo <<<PAYLOAD
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . Horde_Nls::getCharset());
+ header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
header('Vary: Accept-Language');
}
?>
</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, Horde_Nls::getCharset()) ?></textarea>
+ <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
</div>
</form>
<?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, Horde_Nls::getCharset()) ?></textarea>
+ <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
</div>
</form>
<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, Horde_Nls::getcharset()) ?></td>
+ <td><?php echo @htmlspecialchars($page->changeLog(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
</tr>