$body = new Horde_Mime_Part();
$body->setType('text/plain');
- $body->setCharset($GLOBALS['registry']->getCharset());
+ $body->setCharset('UTF-8');
$body->setContents($message['body']);
$body->send($forum['forum_distribution_address'], $msg_headers, $conf['mailer']['type'], $conf['mailer']['params']);
strftime($GLOBALS['prefs']->getValue('date_format'), $message['message_timestamp']))
. "\n-------------------------------------------------------\n"
. $message['body'];
- $message['body'] = "\n> " . Horde_String::wrap($message['body'], 60, "\n> ", $GLOBALS['registry']->getCharset());
+ $message['body'] = "\n> " . Horde_String::wrap($message['body'], 60, "\n> ", 'UTF-8');
return $message;
}
foreach ($messages as $id => &$message) {
$message['message_id'] = $id;
$message['message_author'] = htmlspecialchars($message['message_author']);
- $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, 'UTF-8');
$message['message_date'] = $this->dateFormat($message['message_timestamp']);
if ($format) {
$message['body'] = $this->formatBody($this->convertFromDriver($message['body']));
$message['forum_name'] = $this->convertFromDriver($forums_list[$message['forum_id']]);
$message['message_id'] = $id;
$message['message_author'] = htmlspecialchars($message['message_author']);
- $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message['message_subject'] = htmlspecialchars($this->convertFromDriver($message['message_subject']), ENT_COMPAT, 'UTF-8');
$message['message_body'] = $GLOBALS['injector']->getInstance('Horde_Text_Filter')filter($this->convertFromDriver($message['body']), 'highlightquotes');
if ($message['attachments']) {
$message['message_attachment'] = $this->getAttachmentLink($id);
}
if (!empty($filter['author'])) {
- $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], $GLOBALS['registry']->getCharset()));
+ $sql .= ' AND message_author = ' . $this->_db->quote(Horde_String::lower($filter['author'], 'UTF-8'));
}
/* Sort by result column. */
*/
public function convertToDriver($value)
{
- return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
}
/**
{
/* Set default data. */
parent::__construct(array('templatePath' => AGORA_TEMPLATES . '/',
- 'encoding' => $GLOBALS['registry']->getCharset()));
+ 'encoding' => 'UTF-8'));
}
}
'body' => $url . "\n\n" . $registry->getAuth() . "\n\n" . $_SERVER["REMOTE_ADDR"],
'to' => $emails,
'from' => $emails[0],
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
$mail->addHeader('User-Agent', 'Agora ' . $registry->getVersion());
$mail->send($injector->getInstance('Horde_Mail'));
$forums = Agora_Messages::singleton($scope);
$forums_list = $forums->getForums(0, true, 'forum_name', 0);
- $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($title) . '</title>
$cache->set($cache_key, $rss);
}
-header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
+header('Content-type: text/xml; charset=' . 'UTF-8');
echo $rss;
exit;
}
- $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($message['message_subject']) . '</title>
$cache->set($cache_key, $rss);
}
-header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
+header('Content-type: text/xml; charset=' . 'UTF-8');
echo $rss;
$threads_list = $threads->getThreads(0, false, 'message_modifystamp', 1, true, '', null, 0, 10);
- $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($title) . '</title>
$cache->set($cache_key, $rss);
}
-header('Content-type: text/xml; charset=' . $GLOBALS['registry']->getCharset());
+header('Content-type: text/xml; charset=' . 'UTF-8');
echo $rss;
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
echo Horde::menu();
$notification->notify(array('listeners' => 'status'));
?>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
<div class="instructions">
<form action="sort.php" method="post">
<?php echo Horde_Util::formInput() ?>
<?php
$images = $gallery->getImages();
foreach ($images as $image) {
- $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) : htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $caption = empty($image->caption) ? htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8') : htmlspecialchars($image->caption, ENT_COMPAT, 'UTF-8');
echo '<div id="o_' . (int)$image->id . '"><a title="'
. $caption . '" href="#">'
. '<img src="' . Ansel::getImageUrl($image->id, 'thumb', false, $style) . '" alt="' . htmlspecialchars($image->filename) . '" />'
break;
}
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
/* 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, $GLOBALS['registry']->getCharset()) . '</pre>';
+ $comments = '<pre>' . htmlspecialchars($comments, ENT_COMPAT, 'UTF-8') . '</pre>';
}
$htmlpart->setContents('<html>' . $img_tag . $comments . '</html>');
$related->setContentTypeParameter('start', $htmlpart->setContentID());
// Check for an active image
if (!empty($image_id)) {
- $text = '<span class="thiscrumb" id="PhotoName">' . htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</span>';
+ $text = '<span class="thiscrumb" id="PhotoName">' . htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8') . '</span>';
$nav = $separator . $text . $nav;
$levels++;
}
}
if (!empty($owner_title)) {
- $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $owner_title = htmlspecialchars($owner_title, ENT_COMPAT, 'UTF-8');
$levels++;
if ($gallery) {
$nav = $separator . Ansel::getUrlFor('view', array('view' => 'List', 'groupby' => 'owner', 'owner' => $owner, 'havesearch' => $haveSearch))->link() . $owner_title . '</a>' . $nav;
true);
return $viewurl->link()
- . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ . @htmlspecialchars($name, ENT_COMPAT, 'UTF-8')
. '</a>';
}
$html .= '<tr><td>'
. $url->link(array('onmouseout' => '$("ansel_preview").hide();$("ansel_preview").update("");',
'onmouseover' => 'previewImageMg(event, ' . $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) . ');'))
- . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a></td><td>'
+ . @htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8') . '</a></td><td>'
. strftime($GLOBALS['prefs']->getValue('date_format'), $gallery->get('last_modified'))
. '</td><td>' . (int)$gallery->countImages(true) . '</td></tr>';
}
}
// Build the gallery name.
if (isset($this->_params['gallery'])) {
- $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8');
}
$viewurl = Ansel::getUrlFor('view',
array('gallery' => $gallery->id,
$results = $faces->allFaces(0, $this->_params['limit']);
$html = '';
foreach ($results as $face_id => $face) {
- $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, 'UTF-8');
$html .= '<a href="' . Ansel_Faces::getLink($face) . '" title="' . $facename . '">'
. '<img src="' . $faces->getFaceUrl($face['image_id'], $face_id)
. '" style="padding-bottom: 5px; padding-left: 5px" alt="' . $facename . '" /></a>';
return Ansel::getUrlFor('view', array('view' => 'List'), true)->link() . _("Gallery") . '</a>';
}
- $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $name = @htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8');
$style = $gallery->getStyle();
$viewurl = Ansel::getUrlFor('view',
array('slug' => $gallery->get('slug'),
true);
$galleryLink = $galleryLink->link()
. @htmlspecialchars($gallery->get('name'), ENT_COMPAT,
- $GLOBALS['registry']->getCharset())
+ 'UTF-8')
. '</a>';
$caption = substr($image->caption, 0, 30);
'onmouseover' => 'previewImage(event, ' . $image->id . ');'))
. @htmlspecialchars(
strlen($caption) ? $caption : $image->filename,
- ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ ENT_COMPAT, 'UTF-8')
. '</a></td><td class="nowrap">' . $galleryLink . '</td></tr>';
}
$html .= '</tbody></table>';
$trail[] = array('title' => _("All dates"), 'navdata' => $navdata);
}
- $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $text = htmlspecialchars($this->_gallery->get('name'), ENT_COMPAT, 'UTF-8');
$navdata = array('view' => 'Gallery',
'gallery' => $this->_gallery->id,
'slug' => $this->_gallery->get('slug'));
$output[$field] = $value;
} else {
$description = isset($data['description']) ? $data['description'] : $field;
- $output[] = '<td><strong>' . $description . '</strong></td><td>' . htmlspecialchars($value, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</td>';
+ $output[] = '<td><strong>' . $description . '</strong></td><td>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</td>';
}
}
Horde::logMessage($update, 'ERR');
throw new Ansel_Exception($update);
}
- $result = $update->execute(array(Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ $result = $update->execute(array(Horde_String::convertCharset($image->filename, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
$image->type,
- Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($image->caption, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
$image->sort,
$image->originalDate,
$image->lat,
/* Perform the INSERT */
$result = $insert->execute(array($image_id,
$image->gallery,
- Horde_String::convertCharset($image->filename, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($image->filename, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
$image->type,
- Horde_String::convertCharset($image->caption, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($image->caption, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
$image->uploaded,
$image->sort,
$image->originalDate,
public function saveImageAttribute($image_id, $attribute, $value)
{
$insert = $this->_db->prepare('INSERT INTO ansel_image_attributes (image_id, attr_name, attr_value) VALUES (?, ?, ?)');
- $result = $insert->execute(array($image_id, $attribute, Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset'])));
+ $result = $insert->execute(array($image_id, $attribute, Horde_String::convertCharset($value, 'UTF-8', $GLOBALS['conf']['sql']['charset'])));
if ($result instanceof PEAR_Error) {
throw new Ansel_Exception($result);
}
if ($galleries[$gallery_id]['perm']) {
$data = array((string)Ansel::getImageUrl($image->id, $image_view, $full, $style),
- htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()),
+ htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8'),
$GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)),
$image->id,
0);
}
if (count($json)) {
- return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
+ return Horde_Serialize::serialize($json, Horde_Serialize::JSON, 'UTF-8');
} else {
return '';
}
/* Variables used in the template file */
$image_link = $view_link . $gallery_image . '</a>';
- $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
+ $text_link = $view_link . htmlspecialchars($caption, ENT_COMPAT, 'UTF-8') . '</a>';
$gallery_count = $dgallery->countImages(true);
/* Background color is needed if displaying a mini tile */
}
$image_link = $view_link . $gallery_image . '</a>';
- $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ $text_link = $view_link . htmlspecialchars($gallery->get('name'), ENT_COMPAT, 'UTF-8')
. '</a>';
if ($gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT) && !$mini) {
if (empty($owner_string)) {
$owner_string = $gallery->get('owner');
}
- $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
+ $owner_link .= htmlspecialchars($owner_string, ENT_COMPAT, 'UTF-8') . '</a>';
}
$gallery_count = $gallery->countImages(true);
}
$data = array((string)Ansel::getImageUrl($image->id, $params['image_view'], $params['full'], $style),
- htmlspecialchars($image->filename, ENT_COMPAT, $GLOBALS['registry']->getCharset()),
+ htmlspecialchars($image->filename, ENT_COMPAT, 'UTF-8'),
$GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($image->caption, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO_LINKURL)),
$image->id,
$curpage);
$json[] = $data;
}
- return Horde_Serialize::serialize($json, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset());
+ return Horde_Serialize::serialize($json, Horde_Serialize::JSON, 'UTF-8');
}
/**
$html = $this->_htmlBegin();
$html .= Ansel::getUrlFor('rss_user', array('owner' => $owner))->link() . Horde::img('feed.png') . ' ' . ($owner ? sprintf(_("Recent photos by %s"), $owner) : _("Recent system photos")) . '</a>';
$slug = $this->_view->gallery->get('slug');
- $html .= '<br />' . Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $slug))->link() . ' ' . Horde::img('feed.png') . ' ' . sprintf(_("Recent photos in %s"), htmlspecialchars($this->_view->gallery->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset())) . '</a>';
+ $html .= '<br />' . Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $slug))->link() . ' ' . Horde::img('feed.png') . ' ' . sprintf(_("Recent photos in %s"), htmlspecialchars($this->_view->gallery->get('name'), ENT_COMPAT, 'UTF-8')) . '</a>';
/* Embed html */
if (empty($this->_view->_params['image_id'])) {
}
}
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$xsl = $registry->get('themesuri') . '/feed-rss.xsl';
- $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
- $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $stream_name = @htmlspecialchars($params['name'], ENT_COMPAT, 'UTF-8');
+ $stream_desc = @htmlspecialchars($params['desc'], ENT_COMPAT, 'UTF-8');
$stream_updated = htmlspecialchars(date('r', $params['last_modified']));
$stream_official = htmlspecialchars($params['link']);
$image_url = htmlspecialchars($params['image_url']);
<input type="hidden" name="day" value="<?php echo (empty($date['day']) ? 0 : $date['day']) ?>" />
<h1 class="header">
- <?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>
+ <?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?>
</h1>
<?php if ($gallery->get('desc')): ?>
echo '<td width="10%" align="right" valign="top">';
echo '<img src="' . $thumb_url . '" alt="' . htmlspecialchars($image->filename) . '" />' .
'</td><td width="40%" valign="top"><textarea name="img' . $image->id . '" rows="5" cols="25">' .
- htmlspecialchars($image->caption, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</textarea></td>';
+ htmlspecialchars($image->caption, ENT_COMPAT, 'UTF-8') . '</textarea></td>';
$count++;
if (($count % 2) == 0) {
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
Horde::includeScriptFiles();
?>
-<title><?php echo htmlspecialchars($page_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></title>
+<title><?php echo htmlspecialchars($page_title, ENT_COMPAT, 'UTF-8') ?></title>
<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
<?php echo Ansel::stylesheetLinks() ?>
<?php echo Horde::wrapInlineScript(Ansel::initJSVars());?>
<?php echo $pager->render() ?>
<script type="text/javascript">
//<![CDATA[
-var imgids = <?php echo Horde_Serialize::serialize($imageids, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>;
+var imgids = <?php echo Horde_Serialize::serialize($imageids, Horde_Serialize::JSON, 'UTF-8'); ?>;
function proccessImageFaces(image_id, reget) {
var url = '<?php echo Horde::url('faces/image.php'); ?>';
}
</script>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
<div class="control anselActions" style="text-align: center">
<?php
$image_src = Ansel::getImageUrl($image_id, 'full');
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
<div class="control anselActions" style="text-align: center">
<div id="prevDiv"></div>
<?php
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
<?php
$base_url = Horde::url('image.php');
$base_url = $base_url->copy()->add(array_merge(
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
<?php
$base_url = Horde::url('image.php')->add(
array_merge(
document.slider.setValue(<?php echo $geometry['height'] ?>);
}
</script>
-<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></h1>
+<h1 class="header"><?php echo htmlspecialchars($title, ENT_COMPAT, 'UTF-8') ?></h1>
<div class="control anselActions" style="text-align: center">
<?php
$image_src = Ansel::getImageUrl($image_id, 'full');
<span class="rightFloat">
<?php ($galleries_perpage < $num_galleries) ? printf(_("%d to %d of %d Galleries"), $start, $end, $num_galleries) : printf(ngettext("%d Gallery", "%d Galleries", $num_galleries), $num_galleries) ?>
</span>
- <?php echo @htmlspecialchars($list_title, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ' ' . Horde::url($refresh_link)->link(array('title' => _("Refresh List"))) . Horde::img('reload.png', _("Refresh List")) . '</a>' ?>
+ <?php echo @htmlspecialchars($list_title, ENT_COMPAT, 'UTF-8') . ' ' . Horde::url($refresh_link)->link(array('title' => _("Refresh List"))) . Horde::img('reload.png', _("Refresh List")) . '</a>' ?>
</div>
<table width="100%" style="background:<?php echo $styleDef->background ?>;"><tr>
if ($total) {
echo '<span class="rightFloat">' . ($total > $this->_perPage ? sprintf(_("%d to %d of %d Items"), $this->_pagestart, $this->_pageend, $total) : sprintf(ngettext("%d Item", "%d Items", $total), $total)) . '<small>' . $allLink . '</small></span>';
}
-echo htmlspecialchars($this->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) . $this->_search->getTagTrail();
+echo htmlspecialchars($this->getTitle(), ENT_COMPAT, 'UTF-8') . $this->_search->getTagTrail();
?>
</div>
<?php echo _("New Gallery Description") ?>
</td>
<td align="left">
- <textarea name="gallery_desc" cols="33" rows="5"><?php echo htmlspecialchars($gallery_desc, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
+ <textarea name="gallery_desc" cols="33" rows="5"><?php echo htmlspecialchars($gallery_desc, ENT_COMPAT, 'UTF-8') ?></textarea>
</td>
</tr>
</table>
$publisher->sendRegFile(
$registry->getApp() . '-' . $conf['server']['name'],
$registry->get('name'),
- Horde_String::convertCharset(sprintf(_("Publish your photos to %s on %s."), $registry->get('name'), $conf['server']['name']), $registry->getCharset(), $registry->getCharset(true)),
+ Horde_String::convertCharset(sprintf(_("Publish your photos to %s on %s."), $registry->get('name'), $conf['server']['name']), 'UTF-8', $registry->getLanguageCharset()),
Horde::url('xppublish.php', true, -1)->add('cmd', 'publish'),
Horde::url(Horde_Themes::img('favicon.ico'), true, -1));
exit;
--- /dev/null
+<?php
+/**
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Joel Vandal <joel@scopserv.com>
+ * @package Babel
+ */
+
+class Translate_Display {
+
+ function header($msg, $msg2 = '') {
+ global $cnt_i, $registry;
+ $select_img = Horde::img('alerts/message.png');
+ print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="header">%s</td><td align="right" class="header">%s</td><td class="header" width="20">%s</td></tr></table>', $msg, $msg2, $select_img);
+ flush();
+ }
+
+ function warning($msg, $bold = true) {
+ global $cnt_i, $registry;
+ $item = ($cnt_i++ % 2);
+ $select_img = Horde::img('alerts/warning.png');
+ if ($bold) {
+ print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d" style="color: #ff0000">%s</td><td class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+ } else {
+ print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d small" style="color: #ff0000">%s</td><td class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+ }
+ flush();
+ }
+
+ function error($msg) {
+ global $cnt_i, $registry;
+ $item = ($cnt_i++ % 2);
+ $select_img = Horde::img('alerts/error.png');
+ print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d" style="color: #ff0000"><b>%s</b></td><td class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+ flush();
+ }
+
+ function info($msg = "", $bold = true) {
+
+ global $cnt_i, $registry;
+
+ if (empty($msg)) {
+ echo "<br />";
+ } else {
+
+ $item = ($cnt_i++ % 2);
+
+ $select_img = Horde::img('alerts/select.png');
+ if ($bold) {
+ print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d"><b>%s</b></td><td class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, $select_img);
+ } else {
+ print sprintf('<table cellspacing=0 cellpadding=0 width=100%%><tr><td class="item%d small">%s</td><td class="item%1$d" width="20">%s</td></tr></table>', $item, $msg, '');
+ }
+ flush();
+ }
+ }
+
+ function parseCharset($headers)
+ {
+ if (preg_match('/charset=(.*)/i', $headers, $m)) {
+ return $m[1];
+ }
+ return 'UTF-8';
+ }
+
+ function convert_string($msg) {
+ global $po;
+
+ $f = array('/</', '/>/');
+ $t = array('<', '>');
+ $msg = preg_replace($f, $t, $msg);
+ return Horde_String::convertCharset(html_entity_decode($msg), 'UTF-8', Translate_Display::parseCharset($po->meta['Content-Type']));
+ }
+
+ function display_string($msg) {
+ global $po;
+
+ $f = array('/</', '/>/');
+ $t = array('<', '>');
+ $msg = preg_replace($f, $t, $msg);
+ return Horde_String::convertCharset($msg, Translate_Display::parseCharset($po->meta['Content-Type']), 'UTF-8');
+ }
+
+ function get_percent($used, $total) {
+ if ($total > 0) {
+ $percent = sprintf("%2.2f", (($used * 100) / $total));
+ } else {
+ $percent = 0;
+ }
+
+ return $percent;
+ }
+
+ function create_bargraph ($used, $total, $text = true, $reverse = false, $small = false) {
+ if ($total > 0) {
+ $percent = round(($used * 100) / $total);
+ } else {
+ $percent = 0;
+ }
+
+ $html = '<table border="0" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap">';
+ $html .= '<table border="0" width="100" cellpadding="0" cellspacing="0">';
+ $html .= '<tr height="10">';
+
+ if ($percent > 0) {
+ $html .= '<td nowrap="nowrap" width="' . ($percent) . '" bgcolor="#00FF00"></td>';
+ }
+
+ if ($percent != 100) {
+ $html .= '<td nowrap="nowrap" width="' . (100 - $percent) . '" ';
+ if ($reverse) {
+ $html .= ' bgcolor="#FFFFFF"></td>';
+ } else {
+ $html .= ' bgcolor="#006699"></td>';
+ }
+ }
+
+ $html .= '</tr></table></td>';
+
+ if ($text) {
+ if ($small) {
+ $html .= '<td class="small"> ' . $percent .'% </td>';
+ } else {
+ $html .= '<td> ' . $percent .'% </td>';
+ }
+ }
+
+ $html .= '</tr></table>';
+
+ return $html;
+ }
+
+}
--- /dev/null
+<?php
+if (isset($language)) {
+ header('Content-type: text/html; charset=' . 'UTF-8');
+ header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $GLOBALS['registry']->get('name');
+if (!empty($title)) {
+ $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo $page_title ?></title>
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
Horde::outputMetaTags();
if (Horde_Util::nonInputVar('js_vars')) {
- Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()));
+ Horde::addInlineScript('var Chora = ' . Horde_Serialize::serialize($js_vars, Horde_Serialize::JSON, 'UTF-8'));
}
Horde::includeScriptFiles();
--- /dev/null
+<?php
+if (isset($language)) {
+ header('Content-type: text/html; charset=' . 'UTF-8');
+ header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Skeleton: Copyright 2004-2010 The Horde Project. Skeleton is under a Horde license. -->
+<!-- Horde Project: http://www.horde.org/ | Skeleton: http://www.horde.org/horde/ -->
+<!-- Horde Licenses: http://www.horde.org/licenses/ -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+ $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
--- /dev/null
+<?php
+/**
+ * $Id: block.php 219 2008-01-11 09:45:33Z duck $
+ *
+ * Copyright Obala d.o.o. (www.obala.si)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ * @package Folks
+ */
+define('HORDE_BASE', dirname(__FILE__) . '/..');
+require_once HORDE_BASE . '/lib/base.php';
+require_once 'Horde/Loader.php';
+
+// Block to load
+$block_id = Horde_Util::getFormData('block');
+list($app, $name) = explode(':', $block_id);
+
+$block_data = array();
+$block = Horde_Block_Collection::getBlock($app, $name, Horde_Util::getFormData('defaults'));
+if ($block instanceof PEAR_Error) {
+ $block_data['title'] = $block->getMessage();
+ $block_data['content'] = $block->getDebugInfo();
+} else {
+ $block_data['title'] = @$block->getTitle();
+ if ($block_data['title'] instanceof PEAR_Error) {
+ $block_data['title'] = $block_data['title']->getMessage();
+ }
+ $block_data['content'] = @$block->getContent();
+ if ($block_data['content'] instanceof PEAR_Error) {
+ $block_data['content'] = $block_data['content']->getDebugInfo();
+ }
+}
+
+echo Horde_Serialize::serialize($block_data, Horde_Serialize::JSON, 'UTF-8');
--- /dev/null
+<?php
+/**
+ * The Horde_Block_Layout_View class represents the user defined portal layout.
+ *
+ * Copyright 2008-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ * @package Horde_Block
+ */
+class Horde_Block_Layout_View_Js extends Horde_Block_Layout_View {
+
+ /**
+ * Render the current layout as HTML.
+ *
+ * @return string HTML layout.
+ */
+ function toHtml()
+ {
+ $html = '<div id="page">';
+ $js = '<script type="text/javascript">' . "\n";
+ $js .= 'var confirm_remove = "' . _("Are sure to remove this block?") . '";' . "\n";
+ $js .= 'var edit_url = "' . Horde::url('dragdrop/params.php') . '";' . "\n";
+ $js .= 'var load_url = "' . Horde::url('dragdrop/block.php') . '";' . "\n";
+ $js .= 'var list_url = "' . Horde::url('dragdrop/select.php') . '";' . "\n";
+ $js .= 'var save_url = "' . Horde::url('dragdrop/save.php') . '";' . "\n";
+
+ $js_init = '<script type="text/javascript">'
+ . ' function init() {'
+ . ' portal = new Xilinus.Portal("#page div", {onOverWidget: onOverWidget, onOutWidget: onOutWidget});';
+
+ $js_id = 0;
+ $widget_col = 0;
+ $columns = 0;
+ foreach ($this->_layout as $row_num => $row) {
+ foreach ($row as $col_num => $item) {
+ if ($col_num > $columns) {
+ $columns = $col_num;
+ }
+ if (is_array($item)) {
+ $js .= $this->_serializeBlock($js_id, $item['app'], $item['params']['type'],
+ $item['params']['params'], $js_init, $col_num);
+ $js_id++;
+ }
+ }
+ }
+
+ $columns = max($columns, 2); // FOR TESTING ADD AT KEAST 3 COLUMNS
+ for ($col_num = 0; $col_num <= $columns; $col_num++) {
+ $html .= '<div id="widget_col_' . $col_num . '"></div>';
+ }
+
+ $js .= '</script>';
+
+ $js_init .= 'portal.addWidgetControls("control_buttons");'
+ . '}'
+ . 'document.observe("dom:loaded", init);
+'
+ . '</script>';
+
+ $html .= '</div>' . "\n" . $js . "\n" . $js_init;
+
+ // Strip any CSS <link> tags out of the returned content so
+ // they can be handled seperately.
+ if (preg_match_all('/<link .*?rel="stylesheet".*?\/>/', $html, $links)) {
+ $html = str_replace($links[0], '', $html);
+ $this->_linkTags = $links[0];
+ }
+
+ return $html;
+ }
+
+ function _serializeBlock($js_id, $app, $name, $params, &$js_init, $col_num)
+ {
+ $block = Horde_Block_Collection::getBlock($app, $name, $params);
+ if ($block instanceof PEAR_Error) {
+ $title = $block->getMessage();
+ $content = $block->getDebugInfo();
+ $params = array();
+ } else {
+ $content = @$block->getContent();
+ if ($content instanceof PEAR_Error) {
+ $content = $content->getDebugInfo();
+ }
+ $title = @$block->getTitle();
+ if ($title instanceof PEAR_Error) {
+ $title = $title->getMessage();
+ } else {
+ $title = strip_tags($title);
+ }
+ }
+
+ $content = Horde_Serialize::serialize($content, Horde_Serialize::JSON, 'UTF-8');
+ $title = Horde_Serialize::serialize($title, Horde_Serialize::JSON, 'UTF-8');
+ $params = Horde_Serialize::serialize($params, Horde_Serialize::JSON, 'UTF-8');
+
+ $js_init .= 'portal.add(new Xilinus.Widget().'
+ . 'setTitle(title_' . $js_id .').'
+ . ' setContent(content_' . $js_id .'), ' . $col_num . ');'
+ . '_widgets_blocks[' . $js_id . '] = "' . $app . ':' . $name . '";'
+ . '_layout_params[' . $js_id . '] = \'' . $params . '\'.evalJSON();'
+ . 'delete title_' . $js_id .';'
+ . 'delete content_' . $js_id .';' . "\n";
+
+ return 'var content_' . $js_id . ' = ' . $content . ';' . "\n"
+ . 'var title_' . $js_id . ' = ' . $title . ';' . "\n";
+ }
+}
--- /dev/null
+<?php
+/**
+ * Copyright 2008 Thomas Trethan <thomas@trethan.net>
+ *
+ * See the enclosed file LICENSE for license information (ASL). If you
+ * did not receive this file, see http://www.horde.org/licenses/asl.php.
+ */
+
+function _cleanupData()
+{
+ $GLOBALS['import_step'] = 1;
+ return Horde_Data::IMPORT_FILE;
+}
+
+@define('FIMA_BASE', dirname(__FILE__));
+require_once FIMA_BASE . '/lib/base.php';
+
+$ledger = Fima::getActiveLedger();
+
+/* Importable file types. */
+$file_types = array('csv' => _("CSV"),
+ 'tsv' => _("TSV"));
+
+/* Templates for the different import steps. */
+$templates = array(
+ Horde_Data::IMPORT_CSV => array($registry->get('templates', 'horde') . '/data/csvinfo.inc'),
+ Horde_Data::IMPORT_TSV => array($registry->get('templates', 'horde') . '/data/tsvinfo.inc'),
+ Horde_Data::IMPORT_MAPPED => array($registry->get('templates', 'horde') . '/data/csvmap.inc'),
+ Horde_Data::IMPORT_DATETIME => array($registry->get('templates', 'horde') . '/data/datemap.inc'),
+ Horde_Data::IMPORT_FILE => array(FIMA_TEMPLATES . '/data/import.inc', FIMA_TEMPLATES . '/data/export.inc'),
+);
+
+/* Field/clear name mapping. */
+$app_fields = array('date' => _("Date"),
+ 'asset' => _("Asset Account"),
+ 'account' => _("Account"),
+ 'desc' => _("Description"),
+ 'amount' => _("Amount"),
+ 'eo' => _("e.o."));
+
+/* Date/time fields. */
+$time_fields = array('date' => 'date');
+
+/* Initial values. */
+$param = array('time_fields' => $time_fields,
+ 'file_types' => $file_types);
+$import_format = Horde_Util::getFormData('import_format', '');
+$import_step = Horde_Util::getFormData('import_step', 0) + 1;
+$next_step = Horde_Data::IMPORT_FILE;
+$actionID = Horde_Util::getFormData('actionID');
+$error = false;
+
+/* Loop through the action handlers. */
+switch ($actionID) {
+case 'export':
+ $data = array();
+
+ /* Create a Fima storage instance. */
+ $storage = &Fima_Driver::singleton($ledger);
+ if (is_a($storage, 'PEAR_Error')) {
+ $notification->push(sprintf(_("Failed to access the ledger: %s"), $storage->getMessage()), 'horde.error');
+ $error = true;
+ break;
+ }
+ $params = $storage->getParams();
+
+ $filters = array(array('type', $prefs->getValue('active_postingtype')));
+
+ /* Get accounts and postings. */
+ $accounts = Fima::listAccounts();
+ $postings = Fima::listPostings($filters);
+
+ foreach ($postings as $postingId => $posting) {
+ $row = array();
+ foreach ($posting as $key => $value) {
+ switch ($key) {
+ case 'date':
+ $row[$key] = strftime(Fima::convertDateFormat($prefs->getValue('date_format')), $value);
+ break;
+ case 'asset':
+ case 'account':
+ $row[$key] = isset($accounts[$value]) ? $accounts[$value]['number'] : '';
+ break;
+ case 'amount':
+ $row[$key] = Fima::convertValueToAmount($value);
+ break;
+ case 'eo':
+ case 'desc':
+ $row[$key] = Horde_String::convertCharset($value, 'UTF-8', $params['charset']);
+ break;
+ default:
+ break;
+ }
+ }
+ $data[] = $row;
+ }
+
+ if (!count($data)) {
+ $notification->push(_("There were no postings to export."), 'horde.message');
+ $error = true;
+ break;
+ }
+
+ switch (Horde_Util::getFormData('exportID')) {
+ case EXPORT_CSV:
+ $injector->getInstance('Horde_Data')->getData('Csv', array('cleanup' => '_cleanupData'))->exportFile(_("postings.csv"), $data, true);
+ exit;
+
+ case EXPORT_TSV:
+ $injector->getInstance('Horde_Data')->getData('Tsv', array('cleanup' => '_cleanupData'))->exportFile(_("postings.tsv"), $data, true);
+ exit;
+ }
+ break;
+
+case Horde_Data::IMPORT_FILE:
+ $storage = &Fima_Driver::singleton($ledger);
+ if (is_a($storage, 'PEAR_Error')) {
+ $notification->push(sprintf(_("Failed to access the ledger: %s"), $storage->getMessage()), 'horde.error');
+ $error = true;
+ break;
+ }
+
+ $_SESSION['import_data']['target'] = $ledger;
+ $_SESSION['import_data']['purge'] = Horde_Util::getFormData('purge');
+ break;
+}
+
+if (!$error) {
+ try {
+ $data = $injector->getInstance('Horde_Data')->getData($import_format, array('cleanup' => '_cleanupData'));
+ $next_step = $data->nextStep($actionID, $param);
+ } catch (Horde_Data_Exception $e) {
+ if ($data) {
+ $notification->push($e, 'horde.error');
+ $next_step = $data->cleanup();
+ } else {
+ $notification->push(_("This file format is not supported."), 'horde.error');
+ $next_step = Horde_Data::IMPORT_FILE;
+ }
+ }
+}
+
+/* We have a final result set. */
+if (is_array($next_step)) {
+ /* Create a Fima storage instance. */
+ $storage = &Fima_Driver::singleton($ledger);
+ if (is_a($storage, 'PEAR_Error')) {
+ $notification->push(sprintf(_("Failed to access the ledger: %s"), $storage->getMessage()), 'horde.error');
+ }
+
+ $params = $storage->getParams();
+
+ /* Purge old postings if requested. */
+ if ($_SESSION['import_data']['purge']) {
+ $result = $storage->deleteAll(false, $prefs->getValue('active_postingtype'));
+ if (is_a($result, 'PEAR_Error')) {
+ $notification->push(sprintf(_("The postings could not be purged: %s"), $result->getMessage()), 'horde.error');
+ } else {
+ $notification->push(_("Postings successfully purged."), 'horde.success');
+ }
+ }
+
+ /* Get accounts and postings. */
+ $accounts = Fima::listAccounts();
+ $accounts_indices = array();
+ foreach ($accounts as $account) {
+ $accounts_indices[$account['number']] = $account['account_id'];
+ }
+
+ foreach ($next_step as $row) {
+ $row['type'] = $prefs->getValue('active_postingtype');
+ $row['asset'] = sprintf('%\'04d', $row['asset']);
+ $row['asset'] = isset($accounts_indices[$row['asset']]) ? $accounts_indices[$row['asset']] : null;
+ $row['account'] = sprintf('%\'04d', $row['account']);
+ $row['account'] = isset($accounts_indices[$row['account']]) ? $accounts_indices[$row['account']] : null;
+ $row['date'] = Fima::convertDateToStamp($row['date'], Fima::convertDateFormat($prefs->getValue('date_format')));
+ $row['amount'] = Fima::convertAmountToValue($row['amount']);
+ if ($prefs->getValue('expenses_sign') == 0) {
+ if ($row['account'] !== null) {
+ if ($accounts[$row['account']]['type'] == FIMA_ACCOUNTTYPE_EXPENSE) {
+ $row['amount'] *= -1;
+ }
+ } else {
+ $row['amount'] *= -1;
+ }
+ }
+ $row['desc'] = isset($row['desc']) ? trim($row['desc']) : '';
+ $row['eo'] = isset($row['eo']) ? (bool)trim($row['eo']) : false;
+ $result = $storage->addPosting($row['type'], $row['date'], $row['asset'], $row['account'], $row['eo'], $row['amount'], $row['desc']);
+ if (is_a($result, 'PEAR_Error')) {
+ break;
+ }
+ }
+
+ if (!count($next_step)) {
+ $notification->push(sprintf(_("The %s file didn't contain any postings."),
+ $file_types[$_SESSION['import_data']['format']]), 'horde.error');
+ } else {
+ $notification->push(sprintf(_("%s successfully imported"),
+ $file_types[$_SESSION['import_data']['format']]), 'horde.success');
+ }
+ $next_step = $data->cleanup();
+}
+
+$title = _("Import/Export Postings");
+require FIMA_TEMPLATES . '/common-header.inc';
+require FIMA_TEMPLATES . '/menu.inc';
+
+if ($next_step == Horde_Data::IMPORT_FILE) {
+ /* Build the charset options. */
+ $charsets = $registry->nlsconfig['encodings'];
+ asort($charsets);
+ $all_charsets = $registry->nlsconfig['charsets'];
+ natcasesort($all_charsets);
+ foreach ($all_charsets as $charset) {
+ if (!isset($charsets[$charset])) {
+ $charsets[$charset] = $charset;
+ }
+ }
+ $my_charset = $GLOBALS['registry']->getLanguageCharset();
+}
+
+foreach ($templates[$next_step] as $template) {
+ require $template;
+ echo '<br />';
+}
+require $registry->get('templates', 'horde') . '/common-footer.inc';
--- /dev/null
+<?php
+/**
+ * Fima storage implementation for PHP's PEAR database abstraction layer.
+ *
+ * Required values for $params:<pre>
+ * 'phptype' The database type (e.g. 'pgsql', 'mysql', etc.).
+ * 'table' The name of the foo table in 'database'.
+ * 'charset' The database's internal charset.</pre>
+ *
+ * Required by some database implementations:<pre>
+ * 'database' The name of the database.
+ * 'hostspec' The hostname of the database server.
+ * 'protocol' The communication protocol ('tcp', 'unix', etc.).
+ * 'username' The username with which to connect to the database.
+ * 'password' The password associated with 'username'.
+ * 'options' Additional options to pass to the database.
+ * 'tty' The TTY on which to connect to the database.
+ * 'port' The port on which to connect to the database.</pre>
+ *
+ * The table structure can be created by the scripts/sql/fima.sql
+ * script.
+ *
+ * Copyright 2007-2008 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Thomas Trethan <thomas@trethan.net>
+ * @package Fima
+ */
+class Fima_Driver_sql extends Fima_Driver {
+
+ /**
+ * Handle for the current database connection.
+ *
+ * @var DB
+ */
+ var $_db;
+
+ /**
+ * Constructs a new SQL storage object.
+ *
+ * @param string $ledger The ledger to load.
+ * @param array $params A hash containing connection parameters.
+ */
+ function Fima_Driver_sql($ledger, $params = array())
+ {
+ $this->_ledger = $ledger;
+ $this->_params = $params;
+ }
+
+ /**
+ * Retrieves accounts from the database.
+ *
+ * @param array $filters Any filters for restricting the retrieved accounts.
+ *
+ * @return mixed True on success, PEAR_Error on failure.
+ */
+ function retrieveAccounts($filters = array())
+ {
+ /* Build the SQL query. */
+ $query = sprintf('SELECT * FROM %s WHERE account_owner = ?', $this->_params['table_accounts']);
+ $values = array($this->_ledger);
+
+ /* Add filters. */
+ $this->_addFilters($filters, $query, $values, 'account_');
+
+ /* Sorting. */
+ $query .= ' ORDER BY account_number ASC';
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::retrieveAccounts(): %s', $query), 'DEBUG');
+
+ /* Execute the query. */
+ $this->_accounts = array();
+ $result = $this->_db->query($query, $values);
+
+ if (isset($result) && !is_a($result, 'PEAR_Error')) {
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+
+ /* Store the retrieved values in the accounts variable. */
+ $this->_accounts = array();
+ while ($row && !is_a($row, 'PEAR_Error')) {
+ /* Add this new account to the $_account list. */
+ $this->_accounts[$row['account_id']] = $this->_buildAccount($row);
+
+ /* Advance to the new row in the result set. */
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ }
+ $result->free();
+ } else {
+ return $result;
+ }
+
+ return true;
+ }
+
+ /**
+ * Retrieves one account from the database.
+ *
+ * @param string $accountId The ID of the account to retrieve.
+ *
+ * @return array The array of account attributes.
+ */
+ function getAccount($accountId)
+ {
+ /* Build the SQL query. */
+ $query = sprintf('SELECT * FROM %s WHERE account_owner = ? AND account_id = ?',
+ $this->_params['table_accounts']);
+ $values = array($this->_ledger, $accountId);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::getAccount(): %s', $query), 'DEBUG');
+
+ /* Execute the query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
+
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+ if ($row === null) {
+ return PEAR::raiseError(_("Not found"));
+ }
+
+ /* Decode and return the account. */
+ return $this->_buildAccount($row);
+ }
+
+ /**
+ * Retrieves one account from the database by number.
+ *
+ * @param string $number The number of the account to retrieve.
+ *
+ * @return array The array of account attributes.
+ */
+ function getAccountByNumber($number)
+ {
+ /* Build the SQL query. */
+ $query = sprintf('SELECT * FROM %s WHERE account_owner = ? AND account_number = ?',
+ $this->_params['table_accounts']);
+ $values = array($this->_ledger, sprintf('%\'04s', $number));
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::getAccountByNumber(): %s', $query), 'DEBUG');
+
+ /* Execute the query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
+
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+ if ($row === null) {
+ return PEAR::raiseError(_("Not found"));
+ }
+
+ /* Decode and return the account. */
+ return $this->_buildAccount($row);
+ }
+
+ /**
+ * Retrieves postings from the database.
+ *
+ * @param array $filters Any filters for restricting the retrieved postings.
+ * @param array $sorting Sort order of retrieved postings.
+ * @param array $limit Limit of the retrieved postings, array(page, postings/page).
+ *
+ * @return mixed True on success, PEAR_Error on failure.
+ */
+ function retrievePostings($filters = array(), $sorting = array(), $limit = array())
+ {
+ /* Build the SQL query filter. */
+ $queryfilter = ' WHERE posting_owner = ?';
+ $values = array($this->_ledger);
+
+ /* Add filters. */
+ $this->_addFilters($filters, $queryfilter, $values, 'posting_');
+
+ $query = sprintf('SELECT count(p.posting_id) posting_count, SUM(p.posting_amount) posting_result FROM %s p',
+ $this->_params['table_postings']);
+ $query .= $queryfilter;
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::retrievePostings(): %s', $query), 'DEBUG');
+
+ /* Execute the query. */
+ $result = $this->_db->query($query, $values);
+ if (isset($result) && !is_a($result, 'PEAR_Error')) {
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+ $this->_postingsCount = (int)$row['posting_count'];
+ $this->_postingsResult = $row['posting_result'];
+ $result->free();
+
+ // correct result when account is an asset account too
+ if ($this->_postingsCount > 0) {
+ $query = sprintf('SELECT SUM(p.posting_amount) posting_result ' .
+ 'FROM %s p JOIN %s a ON a.account_id = p.posting_account ' .
+ $queryfilter . ' AND a.account_type = ?',
+ $this->_params['table_postings'], $this->_params['table_accounts']);
+ $values2 = $values;
+ $values2[] = FIMA_ACCOUNTTYPE_ASSET;
+ $result = $this->_db->query($query, $values2);
+ if (isset($result) && !is_a($result, 'PEAR_Error')) {
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+ }
+ $this->_postingsResult -= $row['posting_result'];
+ $result->free();
+ }
+ } else {
+ return $result;
+ }
+
+ /* Fetch the postings if necessary. */
+ $this->_postings = array();
+ if ($this->_postingsCount == 0) {
+ return true;
+ }
+
+ $query = sprintf('SELECT p.*, asset.account_number posting_asset_number, account.account_number posting_account_number ' .
+ 'FROM %s p LEFT OUTER JOIN %s asset ON p.posting_asset = asset.account_id LEFT OUTER JOIN %s account ON p.posting_account = account.account_id',
+ $this->_params['table_postings'], $this->_params['table_accounts'], $this->_params['table_accounts']);
+ $query .= $queryfilter;
+
+ /* Sorting. */
+ if (!is_array($sorting)) {
+ $sorting = array($sorting);
+ }
+ if (count($sorting) == 0) {
+ $sorting = array('posting_date ASC');
+ }
+ $query .= ' ORDER BY ' . implode(', ', $sorting);
+
+ /* Limit. */
+ if (count($limit) > 0) {
+ if ($limit[0] < 0) {
+ $limit[0] += ceil($this->_postingsCount / $limit[1]) + 1;
+ }
+ $limit[0] = ($limit[0] - 1) * $limit[1];
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::retrievePostings() limitQuery: %s', $query), 'DEBUG');
+ $result = $this->_db->queryLimit($query, $limit[0], $limit[1], $values);
+ } else {
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::retrievePostings(): %s', $query), 'DEBUG');
+ $result = $this->_db->query($query, $values);
+ }
+
+ /* Execute the query. */
+ $result = $this->_db->query($query, $values);
+ if (isset($result) && !is_a($result, 'PEAR_Error')) {
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+
+ /* Store the retrieved values in the accounts variable. */
+ while ($row && !is_a($row, 'PEAR_Error')) {
+ /* Add this new posting to the $_posting list. */
+ $this->_postings[$row['posting_id']] = $this->_buildPosting($row);
+
+ /* Advance to the new row in the result set. */
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ }
+ $result->free();
+ } else {
+ return $result;
+ }
+
+ return true;
+ }
+
+ /**
+ * Retrieves one posting from the database.
+ *
+ * @param string $postingId The ID of the posting to retrieve.
+ *
+ * @return array The array of posting attributes.
+ */
+ function getPosting($postingId)
+ {
+ /* Build the SQL query. */
+ $query = sprintf('SELECT * FROM %s WHERE posting_owner = ? AND posting_id = ?',
+ $this->_params['table_postings']);
+ $values = array($this->_ledger, $postingId);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::getPosting(): %s', $query), 'DEBUG');
+
+ /* Execute the query. */
+ $result = $this->_db->query($query, $values);
+
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
+
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+ if ($row === null) {
+ return PEAR::raiseError(_("Not found"));
+ }
+
+ /* Decode and return the posting. */
+ return $this->_buildPosting($row);
+ }
+
+ /**
+ * Get grouped results.
+ *
+ * @param array $groups Fields to group.
+ * @param boolean $filters Filters for postings.
+ *
+ * @return array A matrix of the grouped results.
+ */
+ function getResults($groups, $filters = array()) {
+ $matrix = array();
+
+ /* Fix grouping. */
+ if (!is_array($groups)) {
+ $groups = array($groups);
+ }
+ if (!isset($groups[1])) {
+ $groups[1] = 'owner';
+ }
+ foreach ($groups as $groupId => $group) {
+ switch($group) {
+ case 'date_month': $groups[$groupId] = 'FROM_UNIXTIME(posting_date, \'%Y%m\')'; break;
+ case 'date_year': $groups[$groupId] = 'FROM_UNIXTIME(posting_date, \'%Y\')'; break;
+ case 'asset_number': $groups[$groupId] = 'asset.account_number'; break;
+ case 'asset_parent': $groups[$groupId] = 'CONCAT(LEFT(asset.account_number, 2), \'00\')'; break;
+ case 'asset_type': $groups[$groupId] = 'asset.account_type'; break;
+ case 'account_number': $groups[$groupId] = 'account.account_number'; break;
+ case 'account_parent': $groups[$groupId] = 'CONCAT(LEFT(account.account_number, 2), \'00\')'; break;
+ case 'account_type': $groups[$groupId] = 'account.account_type'; break;
+ default: $groups[$groupId] = 'posting_'.$group; break;
+ }
+ }
+
+ /* Build the SQL query filter. */
+ $query = sprintf('SELECT %s x, %s y, sum(posting_amount) result ' .
+ 'FROM %s p LEFT OUTER JOIN %s asset ON p.posting_asset = asset.account_id AND p.posting_owner = asset.account_owner LEFT OUTER JOIN %s account ON p.posting_account = account.account_id AND p.posting_owner = account.account_owner ' .
+ 'WHERE posting_owner = ?',
+ $groups[0], $groups[1], $this->_params['table_postings'], $this->_params['table_accounts'], $this->_params['table_accounts']);
+ $values = array($this->_ledger);
+
+ /* Add filters. */
+ foreach ($filters as $filterId => $filter) {
+ switch($filter[0]) {
+ case 'date_month': $filters[$filterId][0] = 'FROM_UNIXTIME(posting_date, \'%Y%m\')'; break;
+ case 'date_year': $filters[$filterId][0] = 'FROM_UNIXTIME(posting_date, \'%Y%m\')'; break;
+ case 'asset_number': $filters[$filterId][0] = 'asset.account_number'; break;
+ case 'asset_parent': $filters[$filterId][0] = 'LEFT(asset.account_number, 2)'; break;
+ case 'asset_type': $filters[$filterId][0] = 'asset.account_type'; break;
+ case 'account_number': $filters[$filterId][0] = 'account.account_number'; break;
+ case 'account_parent': $filters[$filterId][0] = 'LEFT(account.account_number, 2)'; break;
+ case 'account_type': $filters[$filterId][0] = 'account.account_type'; break;
+ default: $filters[$filterId][0] = 'posting_'.$filter[0]; break;
+ }
+ }
+ $this->_addFilters($filters, $query, $values);
+
+ /* Add grouping. */
+ $query .= ' GROUP BY ' . implode(', ', $groups);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::getResults(): %s', $query), 'DEBUG');
+
+ /* Execute the query. */
+ $result = $this->_db->query($query, $values);
+ if (isset($result) && !is_a($result, 'PEAR_Error')) {
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+
+ /* Store the retrieved values in the accounts variable. */
+ while ($row && !is_a($row, 'PEAR_Error')) {
+ /* Add this new posting to the $_posting list. */
+ if (!isset($matrix[$row['y']])) {
+ $matrix[$row['y']] = array();
+ }
+ $matrix[$row['y']][$row['x']] = $row['result'];
+
+ /* Advance to the new row in the result set. */
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ }
+ $result->free();
+ }
+
+ return $matrix;
+ }
+
+ /**
+ * Get the results of all asset accounts.
+ *
+ * @param string $postingtype Type of postings.
+ * @param boolean $perdate Date of asset results.
+ *
+ * @return array Array of asset accounts and results
+ */
+ function getAssetResults($postingtype, $perdate = null)
+ {
+ $perdate = ($perdate === null) ? mktime() : (int)$perdate;
+
+ /* Build the SQL query. */
+ $query = sprintf('SELECT account_id, SUM(account_result) account_result FROM ( ' .
+ ' SELECT a1.account_id, SUM(p1.posting_amount) account_result ' .
+ ' FROM %s a1 LEFT OUTER JOIN %s p1 ON a1.account_id = p1.posting_asset AND p1.posting_owner = ? AND p1.posting_type = ? ' .
+ ' WHERE a1.account_owner = ? AND a1.account_type = ? and p1.posting_date <= ?' .
+ ' GROUP BY a1.account_id ' .
+ ' UNION ' .
+ ' SELECT a2.account_id, SUM(p2.posting_amount) * -1 account_result ' .
+ ' FROM %s a2 LEFT OUTER JOIN %s p2 ON a2.account_id = p2.posting_account AND p2.posting_owner = ? AND p2.posting_type = ? ' .
+ ' WHERE a2.account_owner = ? AND a2.account_type = ? and p2.posting_date <= ?' .
+ ' GROUP BY a2.account_id ' .
+ ') x ' .
+ 'GROUP BY account_id ',
+ $this->_params['table_accounts'], $this->_params['table_postings'],
+ $this->_params['table_accounts'], $this->_params['table_postings']);
+ $values = array($this->_ledger, $postingtype, $this->_ledger, FIMA_ACCOUNTTYPE_ASSET, $perdate,
+ $this->_ledger, $postingtype, $this->_ledger, FIMA_ACCOUNTTYPE_ASSET, $perdate);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::getAssetResults(): %s', $query), 'DEBUG');
+
+ /* Execute the query. */
+ $assetresults = array();
+ $result = $this->_db->query($query, $values);
+ if (isset($result) && !is_a($result, 'PEAR_Error')) {
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ if (is_a($row, 'PEAR_Error')) {
+ return $row;
+ }
+
+ /* Store the retrieved values in the accounts variable. */
+ while ($row && !is_a($row, 'PEAR_Error')) {
+ /* Add this new posting to the $_posting list. */
+ $assetresults[] = $row;
+
+ /* Advance to the new row in the result set. */
+ $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ }
+ $result->free();
+ } else {
+ return $result;
+ }
+
+ return $assetresults;
+ }
+
+ /**
+ * Build an account.
+ *
+ * @param array $row Datasbase row holding account attributes.
+ * @param boolean $getparent Also get parent account.
+ *
+ * @return array The array of account attributes.
+ */
+ function _buildAccount($row, $getparent = true)
+ {
+ $parent = null;
+ if ($getparent) {
+ if (($parent_number = Fima::getAccountParent($row['account_number'])) !== null) {
+ if (isset($this->_accounts[$parent_number])) {
+ $parent = $this->_accounts[$parent_number];
+ } else {
+ $parent = $this->getAccountByNumber($parent_number);
+ if (is_a($parent, 'PEAR_Error')) {
+ $parent = null;
+ }
+ }
+ }
+ }
+
+ /* Create a new account based on $row's values. */
+ return array('account_id' => $row['account_id'],
+ 'owner' => $row['account_owner'],
+ 'number' => sprintf('%\'04d', $row['account_number']),
+ 'type' => $row['account_type'],
+ 'name' => Horde_String::convertCharset($row['account_name'], $this->_params['charset']),
+ 'eo' => $row['account_eo'],
+ 'desc' => Horde_String::convertCharset($row['account_desc'], $this->_params['charset']),
+ 'closed' => $row['account_closed'],
+ 'label' => trim($row['account_number'] . ' ' .
+ (($parent === null) ? '' : $parent['name'] . ' - ') .
+ Horde_String::convertCharset($row['account_name'], $this->_params['charset'])),
+ 'parent_id' => ($parent === null) ? null : $parent['account_id'],
+ 'parent_number' => ($parent === null) ? '' : $parent['number'],
+ 'parent_name' => ($parent === null) ? '' : $parent['name']);
+ }
+
+ /**
+ * Adds an account to the backend storage.
+ *
+ * @param string $number The number of the account.
+ * @param string $type The type of the account.
+ * @param string $name The name (short) of the account.
+ * @param boolean $eo Extraordinary account.
+ * @param string $desc The description (long) of the account.
+ * @param boolean $closed Close account.
+ *
+ * @return mixed ID of the new account or PEAR_Error
+ */
+ function _addAccount($number, $type, $name, $eo, $desc, $closed)
+ {
+ $accountId = strval(new Horde_Support_Uuid());
+
+ $query = sprintf(
+ 'INSERT INTO %s (account_id, account_owner, account_number, account_type, ' .
+ 'account_name, account_eo, account_desc, account_closed) ' .
+ 'VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
+ $this->_params['table_accounts']);
+ $values = array($accountId,
+ $this->_ledger,
+ sprintf('%\'04d', $number),
+ $type,
+ Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+ (int)(bool)$eo,
+ Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+ (int)(bool)$closed);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_addAccount(): %s', $query), 'DEBUG');
+
+ /* Attempt the insertion query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+
+ return $accountId;
+ }
+
+ /**
+ * Modifies an existing account.
+ *
+ * @param string $accountId The account to modify.
+ * @param string $number The number of the account.
+ * @param string $type The type of the account.
+ * @param string $name The name (short) of the account.
+ * @param boolean $eo Extraordinary account.
+ * @param string $desc The description (long) of the account.
+ * @param boolean $closed Close account.
+ *
+ * @return mixed True or PEAR_Error
+ */
+ function _modifyAccount($accountId, $number, $type, $name, $eo, $desc, $closed)
+ {
+ $query = sprintf('UPDATE %s SET' .
+ ' account_number = ?, ' .
+ ' account_type = ?, ' .
+ ' account_name = ?, ' .
+ ' account_eo = ?, ' .
+ ' account_desc = ?, ' .
+ ' account_closed = ? ' .
+ 'WHERE account_owner = ? AND account_id = ?',
+ $this->_params['table_accounts']);
+ $values = array(sprintf('%\'04d', $number),
+ $type,
+ Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+ (int)(bool)$eo,
+ Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+ (int)(bool)$closed,
+ $this->_ledger,
+ $accountId);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_modifyAccount(): %s', $query), 'DEBUG');
+
+ /* Attempt the update query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+
+ return true;
+ }
+
+ /**
+ * Deletes an account from the backend.
+ *
+ * @param string $accountId The account to delete.
+ * @param mixed $dsSubaccounts True/false when deleting subaccounts,
+ * accountId when shifting subaccounts
+ * @param mixed $dsPostings True/false when deleting postings,
+ * accountId when shifting postings
+ *
+ * @return mixed True or PEAR_Error
+ */
+ function _deleteAccount($accountId, $dsSubaccounts = false, $dsPostings = true)
+ {
+ /* Get the account's details for use later. */
+ $account = $this->getAccount($accountId);
+
+ /* Handle subaccounts. */
+ if ($dsSubaccounts !== false) {
+ /* Delete subaccounts. */
+ $parent = (int)($account['number'] / 100) . '%';
+ $this->retrieveAccounts(array(array('number', $parent, 'LIKE'),
+ array('number', (string)$account['number'], '!=')));
+
+ foreach ($this->_accounts as $subaccountId => $subaccount) {
+ $delete = $this->_deleteAccount($subaccountId, false, $dsSubaccounts);
+ if (is_a($delete, 'PEAR_Error')) {
+ return $delete;
+ }
+ }
+ }
+
+ /* Handle postings. */
+ if ($dsPostings !== false) {
+ if ($dsPostings === true) {
+ /* Delete account postings. */
+ $query = sprintf('DELETE FROM %s WHERE posting_owner = ? AND (posting_asset = ? OR posting_account = ?)',
+ $this->_params['table_postings']);
+ $values = array($this->_ledger, $accountId, $accountId);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAccount(): %s', $query), 'DEBUG');
+
+ /* Attempt the delete query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+ } else {
+ /* Shift account postings. */
+ $shift = $this->_shiftPostings($accountId, $dsPostings);
+ if (is_a($shift, 'PEAR_Error')) {
+ return $shift;
+ }
+ }
+ }
+
+ /* Delete account. */
+ $query = sprintf('DELETE FROM %s WHERE account_owner = ? AND account_id = ?',
+ $this->_params['table_accounts']);
+ $values = array($this->_ledger, $accountId);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAccount(): %s', $query), 'DEBUG');
+
+ /* Attempt the delete query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+
+ return true;
+ }
+
+ /**
+ * Build a posting.
+ *
+ * @param array $row Datasbase row holding posting attributes;
+ *
+ * @return array The array of posting attributes.
+ */
+ function _buildPosting($row)
+ {
+ /* Create a new account based on $row's values. */
+ return array('posting_id' => $row['posting_id'],
+ 'owner' => $row['posting_owner'],
+ 'type' => $row['posting_type'],
+ 'date' => $row['posting_date'],
+ 'asset' => $row['posting_asset'],
+ 'account' => $row['posting_account'],
+ 'desc' => Horde_String::convertCharset($row['posting_desc'], $this->_params['charset']),
+ 'amount' => $row['posting_amount'],
+ 'eo' => (int)(bool)$row['posting_eo']);
+ }
+
+ /**
+ * Adds a posting to the backend storage.
+ *
+ * @param string $type The posting type.
+ * @param integer $date The posting date.
+ * @param string $asset The ID of the asset account.
+ * @param string $account The ID of the account.
+ * @param boolean $eo Extraordinary posting.
+ * @param float $amount The posting amount.
+ * @param string $desc The posting description.
+ *
+ * @return mixed ID of the new posting or PEAR_Error
+ */
+ function _addPosting($type, $date, $asset, $account, $eo, $amount, $desc)
+ {
+ $postingId = strval(new Horde_Support_Uuid());
+
+ $query = sprintf(
+ 'INSERT INTO %s (posting_id, posting_owner, posting_type, posting_date, ' .
+ 'posting_asset, posting_account, posting_eo, posting_amount, posting_desc) ' .
+ 'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
+ $this->_params['table_postings']);
+ $values = array($postingId,
+ $this->_ledger,
+ $type,
+ (int)$date,
+ $asset,
+ $account,
+ (int)(bool)$eo,
+ (float)$amount,
+ Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']));
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_addPosting(): %s', $query), 'DEBUG');
+
+ /* Attempt the insertion query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+
+ return $postingId;
+ }
+
+ /**
+ * Modifies an existing posting.
+ *
+ * @param string $postingId The posting to modify.
+ * @param string $type The posting type.
+ * @param integer $date The posting date.
+ * @param string $asset The ID of the asset account.
+ * @param string $account The ID of the account.
+ * @param boolean $eo Extraordinary posting.
+ * @param float $amount The posting amount.
+ * @param string $desc The posting description.
+ *
+ * @return mixed True or PEAR_Error
+ */
+ function _modifyPosting($postingId, $type, $date, $asset, $account, $eo, $amount, $desc)
+ {
+ $query = sprintf('UPDATE %s SET' .
+ ' posting_type = ?, ' .
+ ' posting_date = ?, ' .
+ ' posting_asset = ?, ' .
+ ' posting_account = ?, ' .
+ ' posting_eo = ?, ' .
+ ' posting_amount = ?, ' .
+ ' posting_desc = ? ' .
+ 'WHERE posting_owner = ? AND posting_id = ?',
+ $this->_params['table_postings']);
+ $values = array($type,
+ (int)$date,
+ $asset,
+ $account,
+ (int)(bool)$eo,
+ (float)$amount,
+ Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+ $this->_ledger,
+ $postingId);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_modifyPosting(): %s', $query), 'DEBUG');
+
+ /* Attempt the update query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+
+ return true;
+ }
+
+ /**
+ * Deletes a posting from the backend.
+ *
+ * @param string $postingId The posting to delete.
+ *
+ * @return mixed True or PEAR_Error
+ */
+ function _deletePosting($postingId)
+ {
+ /* Get the task's details for use later. */
+ $posting = $this->getPosting($postingId);
+
+ $query = sprintf('DELETE FROM %s WHERE posting_owner = ? AND posting_id = ?',
+ $this->_params['table_postings']);
+ $values = array($this->_ledger, $postingId);
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_deletePosting(): %s', $query), 'DEBUG');
+
+ /* Attempt the delete query. */
+ $result = $this->_db->query($query, $values);
+
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+
+ return true;
+ }
+
+ /**
+ * Shift an existing posting.
+ *
+ * @param string $postingId The posting to shift.
+ * @param string $type The posting type shifting to.
+ * @param string $asset The ID of the asset account.
+ * @param string $account The ID of the account.
+ *
+ * @return mixed True or PEAR_Error
+ */
+ function _shiftPosting($postingId, $type, $asset, $account)
+ {
+ if (!$type && !$asset && !$account) {
+ return true;
+ }
+
+ $query = sprintf('UPDATE %s SET' .
+ ($type ? ' posting_type = ?, ' : '') .
+ ($asset ? ' posting_asset = ?, ' : '') .
+ ($account ? ' posting_account = ?, ' : '').
+ ' posting_eo = posting_eo ' .
+ 'WHERE posting_owner = ? AND posting_id = ?',
+ $this->_params['table_postings']);
+ $values = array();
+ if ($type) { $values[] = $type; }
+ if ($asset) { $values[] = $asset; }
+ if ($account) { $values[] = $account; }
+ $values[] = $this->_ledger;
+ $values[] = $postingId;
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_shiftPosting(): %s', $query), 'DEBUG');
+
+ /* Attempt the update query. */
+ $result = $this->_db->query($query, $values);
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+
+ return true;
+ }
+
+ /**
+ * Shift postings in the backend.
+ *
+ * @param mixed $accountIdFrom The account(s) to shift postings from.
+ * @param string $accountIdTo The account to shift postings to.
+ *
+ * @return mixed True or PEAR_Error
+ */
+ function _shiftPostings($accountIdFrom, $accountIdTo)
+ {
+ if (!is_array($accountIdFrom)) {
+ $accountIdFrom = array($accountIdFrom);
+ }
+
+ foreach ($accountIdFrom as $key => $value) {
+ $accountIdFrom[$key] = $this->_db->quoteSmart($value);
+ }
+
+ $fields = array('posting_asset', 'posting_account');
+ foreach ($fields as $field) {
+ $query = sprintf('UPDATE %s SET' .
+ ' %s = ? ' .
+ 'WHERE posting_owner = ? AND %s IN (!)',
+ $this->_params['table_postings'], $field, $field);
+ $values = array($accountIdTo, $this->_ledger, implode(',', $accountIdFrom));
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_shiftPostings(): %s', $query), 'DEBUG');
+
+ /* Attempt the update query. */
+ $result = $this->_db->query($query, $values);
+
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Deletes all postings and accounts.
+ *
+ * @param mixed $accounts boolean or account_type
+ * @param mixed $accounts boolean or posting_type.
+ *
+ * @return mixed True or PEAR_Error
+ */
+ function _deleteAll($accounts, $postings)
+ {
+ /* Delete postings. */
+ if ($postings) {
+ $query = sprintf('DELETE FROM %s WHERE posting_owner = ?',
+ $this->_params['table_postings']);
+ $values = array($this->_ledger);
+
+ /* Filter. */
+ if ($postings !== true) {
+ $query .= ' AND posting_type = ?';
+ $values[] = $postings;
+ }
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAll(): %s', $query), 'DEBUG');
+
+ /* Attempt the delete query. */
+ $result = $this->_db->query($query, $values);
+
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+ } else {
+ /* If postings aren't deleted, don't delete accounts. */
+ return false;
+ }
+
+ /* Delete Accounts */
+ if ($accounts) {
+ $query = sprintf('DELETE FROM %s WHERE account_owner = ?',
+ $this->_params['table_accounts']);
+ $values = array($this->_ledger);
+
+ /* Filter. */
+ if ($accounts !== true) {
+ $query .= ' AND account_type = ?';
+ $values[] = $accounts;
+ }
+
+ /* Log the query at a DEBUG log level. */
+ Horde::logMessage(sprintf('Fima_Driver_sql::_deleteAll(): %s', $query), 'DEBUG');
+
+ /* Attempt the delete query. */
+ $result = $this->_db->query($query, $values);
+
+ if (is_a($result, 'PEAR_Error')) {
+ Horde::logMessage($result, 'ERR');
+ return $result;
+ }
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Build the where clause for a query using the passed filters
+ * Attention: does not include the WHERE keyword, add WHERE 1=1 manually in the query
+ *
+ * @param array $filters Array of filters, syntax: array(field, value [, operator = '=' [, andor = 'AND']])
+ * @param array $prefix optional prefix for fields
+ *
+ * @return integer number of added filters
+ */
+ function _addFilters($filters, &$query, &$values, $prefix = '')
+ {
+ $filtercnt = 0;
+
+ foreach ($filters as $filter) {
+ // and/or
+ if (!isset($filter[3])) {
+ $filter[3] = 'AND';
+ } else {
+ $filter[3] = strtoupper($filter[3]);
+ if (!in_array($filter[3], array('AND', 'OR'))) {
+ $filter[3] = 'AND';
+ }
+ }
+
+ // subfilter
+ if (is_array($filter[0])) {
+ $query .= ' ' . $filter[3] . ' (1=1';
+ $filtercnt += $this->_addFilters($filter[0], $query, $values, $prefix);
+ $query .= ')';
+ continue;
+ }
+
+ // fix operator
+ if (!isset($filter[2])) {
+ $filter[2] = '=';
+ } else {
+ $filter[2] = strtoupper($filter[2]);
+ if (!in_array($filter[2], array('<', '>', '<=', '>=', '=', '<>', '!=', 'IN', 'NOT IN', 'IS', 'IS NOT', 'LIKE', 'NOT LIKE'))) {
+ $filter[2] = '=';
+ }
+ }
+
+ // fix operator for null values
+ if ($filter[1] === null) {
+ if (!in_array($filter[2], array('IS', 'IS NOT'))) {
+ $filter[2] = in_array($filter[2], array('=', 'IN', 'LIKE')) ? 'IS' : 'IS NOT';
+ }
+ } elseif (in_array($filter[2], array('IS', 'IS NOT'))) {
+ $filter[2] = ($filter[2] == 'IS') ? '=' : '!=';
+ }
+
+ // fix operator for array value + prepare values
+ if (is_array($filter[1])) {
+ if (!in_array($filter[2], array('IN', 'NOT IN'))) {
+ $filter[2] = in_array($filter[2], array('=', 'IS', 'LIKE')) ? 'IN' : 'NOT IN';
+ }
+ $filterph = '(!)';
+ foreach ($filter[1] as $key => $value) {
+ $filter[1][$key] = $this->_db->quoteSmart($value);
+ }
+ $filter[1] = implode(',', $filter[1]);
+ } else {
+ if (in_array($filter[2], array('IN', 'NOT IN'))) {
+ $filter[2] = ($filter[2] == 'IN') ? '=' : '!=';
+ }
+ $filterph = '?';
+ }
+
+ // fix != operator
+ if ($filter[2] == '!=') {
+ $filter[2] = '<>';
+ }
+
+ $query .= sprintf(' ' . $filter[3] . ' ' . $prefix . '%s %s %s', $filter[0], $filter[2], $filterph);
+ $values[] = $filter[1];
+ $filtercnt++;
+ }
+
+ return $filtercnt;
+ }
+
+ /**
+ * Attempts to open a connection to the SQL server.
+ *
+ * @return boolean True on success; PEAR_Error on failure.
+ */
+ function initialize()
+ {
+ try {
+ $this->_db = $GLOBALS['injector']->getInstance('Horde_Db_Pear')->getDb('rw', 'fima', 'storage');
+ } catch (Horde_Exception $e) {
+ return PEAR::raiseError($e->getMessage());
+ }
+
+ return true;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Copyright 2008 Thomas Trethan <thomas@trethan.net>
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Thomas Trethan <thomas@trethan.net>
+ */
+
+@define('FIMA_BASE', dirname(__FILE__));
+require_once FIMA_BASE . '/lib/base.php';
+
+$vars = Horde_Variables::getDefaultVariables();
+
+/* Get the current action ID. */
+$actionID = Horde_Util::getFormData('actionID');
+
+/* Change posting type. */
+if (($postingtype = Horde_Util::getFormData('postingtype')) !== null) {
+ $postingtypeold = $prefs->getValue('active_postingtype');
+ $prefs->setValue('active_postingtype', $postingtype);
+}
+
+/* Get closed period. */
+$closedperiod = (int)$prefs->getValue('closed_period');
+
+/* Create page array. */
+$pageOb = array();
+$pageOb['url'] = Horde::url('postings.php');
+if (($pageOb['page'] = Horde_Util::getFormData('page')) === null) {
+ $pageOb['page'] = $prefs->getValue('startpage');
+}
+$pageOb['mode'] = 'list';
+
+$title = _("My Postings");
+$ledger = Fima::getActiveLedger();
+$filters = array();
+
+switch ($actionID) {
+case 'change_sort':
+ /* Sort out the sorting values. */
+ if (($sortby = Horde_Util::getFormData('sortby')) !== null) {
+ $prefs->setValue('sortby', $sortby);
+ }
+ if (($sortdir = Horde_Util::getFormData('sortdir')) !== null) {
+ $prefs->setValue('sortdir', $sortdir);
+ }
+ break;
+
+case 'search_postings':
+ /* If we're searching, only list those postings that match the search result. */
+ $_SESSION['fima_search'] = array('type' => Horde_Util::getFormData('search_type'),
+ 'date_start' => Horde_Util::getFormData('search_date_start'),
+ 'date_end' => Horde_Util::getFormData('search_date_end'),
+ 'asset' => Horde_Util::getFormData('search_asset'),
+ 'account' => Horde_Util::getFormData('search_account'),
+ 'desc' => Horde_Util::getFormData('search_desc'),
+ 'amount_start' => Horde_Util::getFormData('search_amount_start'),
+ 'amount_end' => Horde_Util::getFormData('search_amount_end'),
+ 'eo' => Horde_Util::getFormData('search_eo'));
+
+ /* Build filters. */
+ if ($_SESSION['fima_search']['type'] !== null) {
+ $prefs->setValue('active_postingtype', $_SESSION['fima_search']['type']);
+ }
+ if ($_SESSION['fima_search']['date_start'] !== null) {
+ if (is_array($_SESSION['fima_search']['date_start'])) {
+ $_SESSION['fima_search']['date_start'] = mktime(0, 0, 0, $_SESSION['fima_search']['date_start']['month'],
+ $_SESSION['fima_search']['date_start']['day'],
+ $_SESSION['fima_search']['date_start']['year']);
+ } else {
+ $_SESSION['fima_search']['date_start'] = (int)$_SESSION['fima_search']['date_start'];
+ }
+ }
+ if ($_SESSION['fima_search']['date_end'] !== null) {
+ if (is_array($_SESSION['fima_search']['date_end'])) {
+ $_SESSION['fima_search']['date_end'] = mktime(0, 0, 0, $_SESSION['fima_search']['date_end']['month'],
+ $_SESSION['fima_search']['date_end']['day'],
+ $_SESSION['fima_search']['date_end']['year']);
+ } else {
+ $_SESSION['fima_search']['date_end'] = (int)$_SESSION['fima_search']['date_end'];
+ }
+ }
+ if ($_SESSION['fima_search']['asset'] !== null) {
+ if (count($_SESSION['fima_search']['asset']) == 0) {
+ unset($_SESSION['fima_search']['asset']);
+ }
+ }
+ if ($_SESSION['fima_search']['account'] !== null) {
+ if (count($_SESSION['fima_search']['account']) == 0) {
+ unset($_SESSION['fima_search']['account']);
+ }
+ }
+ if ($_SESSION['fima_search']['desc'] !== null) {
+ if ($_SESSION['fima_search']['desc'] === '') {
+ unset($_SESSION['fima_search']['desc']);
+ }
+ }
+ if ($_SESSION['fima_search']['amount_start'] !== null) {
+ if ($_SESSION['fima_search']['amount_start'] === '') {
+ unset($_SESSION['fima_search']['amount_start']);
+ }
+ }
+ if ($_SESSION['fima_search']['amount_end'] !== null) {
+ if ($_SESSION['fima_search']['amount_end'] === '') {
+ unset($_SESSION['fima_search']['amount_end']);
+ }
+ }
+ if (isset($_SESSION['fima_search']['amount_start']) && isset($_SESSION['fima_search']['amount_end'])) {
+ if ((double)$_SESSION['fima_search']['amount_start'] > (double)$_SESSION['fima_search']['amount_end']) {
+ $tmp = $_SESSION['fima_search']['amount_start'];
+ $_SESSION['fima_search']['amount_start'] = $_SESSION['fima_search']['amount_end'];
+ $_SESSION['fima_search']['amount_end'] = $tmp;
+ }
+ }
+ if ($_SESSION['fima_search']['eo'] !== null) {
+ if ($_SESSION['fima_search']['eo'] == -1) {
+ unset($_SESSION['fima_search']['eo']);
+ }
+ }
+
+ break;
+
+case 'clear_search':
+ unset($_SESSION['fima_search']);
+ break;
+
+case 'add_postings':
+ $pageOb['mode'] = 'edit';
+ $pageOb['url'] = Horde_Util::addParameter($pageOb['url'], 'actionID', 'add_postings');
+ $actionID = 'save_postings';
+ $postings = array();
+ $title = _("Add Postings");
+ break;
+
+case 'edit_postings':
+ $postingset = Horde_Util::getFormData('indices');
+ if ($postingset !== null) {
+ $pageOb['mode'] = 'edit';
+ $pageOb['url'] = Horde_Util::addParameter($pageOb['url'], 'actionID', 'add_postings');
+ $actionID = 'save_postings';
+ $filters[] = array('id', $postingset);
+ $title = _("Edit Postings");
+ }
+ break;
+
+case 'shift_postings':
+ $postingset = Horde_Util::getFormData('indices');
+ if ($postingset !== null) {
+ $pageOb['mode'] = 'shift';
+ $actionID = 'update_postings';
+ $filters[] = array('id', $postingset);
+ $title = _("Shift Postings");
+ }
+ break;
+
+case 'transfer_postings':
+ $pageOb['mode'] = 'transfer';
+ $actionID = 'copymove_postings';
+ $postings = array();
+ $title = _("Transfer Postings");
+ break;
+
+case 'save_postings':
+ /* Get the form values. */
+ $postingset = Horde_Util::getFormData('posting_id');
+
+ $share = &$GLOBALS['fima_shares']->getShare($ledger);
+ if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
+ $notification->push(sprintf(_("Access denied saving postings to %s."), $share->get('name')), 'horde.error');
+ Horde::url('postings.php', true)->redirect();
+ }
+ if ($postingset !== null) {
+ $pageOb['mode'] = 'edit';
+ $title = _("Edit Postings");
+ $posting_owner = $ledger;
+ $posting_type = $prefs->getValue('active_postingtype');
+
+ $posting_dates = Horde_Util::getFormData('date');
+ $posting_assets = Horde_Util::getFormData('asset');
+ $posting_accounts = Horde_Util::getFormData('account');
+ $posting_eos = Horde_Util::getFormData('eo');
+ $posting_amounts = Horde_Util::getFormData('amount');
+ $posting_descs = Horde_Util::getFormData('desc');
+
+ $postings = array();
+ $savecount = 0;
+
+ $storage = &Fima_Driver::singleton($ledger);
+ foreach($postingset as $index => $posting_id) {
+ $posting_valid = true;
+
+ if ($posting_dates[$index] !== '' || $posting_assets[$index] !== '' || $posting_accounts[$index] !== '' ||
+ $posting_amounts[$index] !== '' || $posting_descs[$index] !== '') {
+
+ $posting_date = Fima::convertDateToStamp($posting_dates[$index], Fima::convertDateFormat($prefs->getValue('date_format')));
+ $posting_asset = $posting_assets[$index];
+ $posting_account = $posting_accounts[$index];
+ $posting_eo = (int)(bool)$posting_eos[$index];
+ $posting_amount = Fima::convertAmountToValue($posting_amounts[$index]);
+ $posting_desc = $posting_descs[$index];
+
+ /* Check posting date. */
+ if ($posting_date === false) {
+ $posting_valid = false;
+ } elseif ($posting_date <= $closedperiod) {
+ $posting_valid = false;
+ }
+
+ /* Check asset account and account. */
+ if ($posting_asset === '' || $posting_account === '') {
+ $posting_valid = false;
+ } elseif ($posting_asset === $posting_account) {
+ continue;
+ }
+
+ /* Fix amount sign. */
+ if ($prefs->getValue('expenses_sign') == 0) {
+ $account = Fima::getAccount($posting_account);
+ if (!is_a($account, 'PEAR_Error') && $account !== null) {
+ if ($account['type'] == FIMA_ACCOUNTTYPE_EXPENSE) {
+ $posting_amount *= -1;
+ }
+ }
+ }
+
+ /* If $posting_id is set, we're modifying an existing account. Otherwise,
+ * we're adding a new posting with the provided attributes. */
+ if ($posting_valid) {
+ if ($posting_id != null) {
+ $result = $storage->modifyPosting($posting_id, $posting_type, $posting_date, $posting_asset,
+ $posting_account, $posting_eo, $posting_amount, $posting_desc);
+ } else {
+ $result = $storage->addPosting($posting_type, $posting_date, $posting_asset, $posting_account,
+ $posting_eo, $posting_amount, $posting_desc);
+ }
+
+ // Check our results.
+ if (is_a($result, 'PEAR_Error')) {
+ $notification->push(sprintf(_("There was a problem saving the posting: %s."), $result->getMessage()), 'horde.error');
+ $posting_valid = false;
+ } else {
+ $savecount++;
+ }
+ }
+
+ /* Reload invalid or unsaved postings. */
+ if (!$posting_valid) {
+ $postings[] = array('posting_id' => $posting_id,
+ 'owner' => $ledger,
+ 'type' => $posting_type,
+ 'date' => $posting_date,
+ 'asset' => $posting_asset,
+ 'account' => $posting_account,
+ 'eo' => $posting_eo,
+ 'amount' => $posting_amount,
+ 'desc' => $posting_desc);
+ }
+ }
+ }
+
+ if ($savecount > 0) {
+ $notification->push(sprintf(_("Saved %d postings."), $savecount), 'horde.success');
+ }
+ if (count($postings) > 0) {
+ $notification->push(sprintf(_("%d postings not saved."), count($postings)), 'horde.error');
+ } else {
+ /* Return to the posting list. */
+ Horde::url('postings.php', true)->redirect();
+ }
+ } else {
+ /* Return to the posting list. */
+ Horde::url('postings.php', true)->redirect();
+ }
+ break;
+
+case 'delete_postings':
+ /* Delete postings if we're provided with valid account IDs. */
+ $postingset = Horde_Util::getFormData('indices');
+
+ $share = &$GLOBALS['fima_shares']->getShare($ledger);
+ if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
+ $notification->push(sprintf(_("Access denied deleting postings from %s."), $share->get('name')), 'horde.error');
+ Horde::url('postings.php', true)->redirect();
+ }
+ if ($postingset !== null) {
+ $storage = &Fima_Driver::singleton($ledger);
+ $delcount = 0;
+ foreach($postingset as $index => $posting_id) {
+ $result = $storage->deletePosting($posting_id);
+ if (is_a($result, 'PEAR_Error')) {
+ $notification->push(sprintf(_("There was a problem deleting posting #%d: %s"),
+ $index, $result->getMessage()), 'horde.error');
+ } else {
+ $delcount++;
+ }
+ }
+ if ($delcount > 0) {
+ $notification->push(sprintf(_("Deleted %d postings."), $delcount), 'horde.success');
+ }
+ }
+
+ /* Return to the posting list. */
+ Horde::url('postings.php', true)->redirect();
+
+case 'update_postings':
+ /* Get the form values. */
+ $postingset = Horde_Util::getFormData('posting_id');
+
+ $share = &$GLOBALS['fima_shares']->getShare($ledger);
+ if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
+ $notification->push(sprintf(_("Access denied shifting postings in %s."), $share->get('name')), 'horde.error');
+ Horde::url('postings.php', true)->redirect();
+ }
+ if ($postingset !== null) {
+ $posting_type = Horde_Util::getFormData('type');
+ $posting_asset = Horde_Util::getFormData('asset');
+ $posting_account = Horde_Util::getFormData('account');
+
+ if ($posting_type || $posting_asset || $posting_account) {
+ $storage = &Fima_Driver::singleton($ledger);
+ $shiftcount = 0;
+
+ foreach($postingset as $index => $posting_id) {
+ $result = $storage->ShiftPosting($posting_id, $posting_type, $posting_asset, $posting_account);
+ if (is_a($result, 'PEAR_Error')) {
+ $notification->push(sprintf(_("There was a problem shifting posting #%d: %s"),
+ $index, $result->getMessage()), 'horde.error');
+ } else {
+ $shiftcount++;
+ }
+ }
+ if ($shiftcount > 0) {
+ $notification->push(sprintf(_("Shifted %d postings."), $shiftcount), 'horde.success');
+ }
+ }
+ }
+
+ /* Return to the posting list. */
+ Horde::url('postings.php', true)->redirect();
+
+case 'copymove_postings':
+ $share = &$GLOBALS['fima_shares']->getShare($ledger);
+ if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
+ $notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
+ Horde::url('postings.php', true)->redirect();
+ }
+ if (!$share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE) && (!Horde_Util::getFormData('keep') || Horde_Util::getFormData('delete'))) {
+ $notification->push(sprintf(_("Access denied transfering postings in %s."), $share->get('name')), 'horde.error');
+ Horde::url('postings.php', true)->redirect();
+ }
+ $type_from = Horde_Util::getFormData('type_from');
+ $period_from = Horde_Util::getFormData('period_from');
+ $keep = Horde_Util::getFormData('keep');
+ $summarize = Horde_Util::getFormData('summarize');
+ $summarize_account = Horde_Util::getFormData('summarize_post_account');
+ $type_to = Horde_Util::getFormData('type_to');
+ $period_to = Horde_Util::getFormData('period_to');
+ $delete = Horde_Util::getFormData('delete');
+
+ $period_from_start = mktime(0, 0, 0, ($period_from['month'] === '') ? 1 : $period_from['month'], 1, (int)$period_from['year']);
+ $period_from_end = mktime(0, 0, 0, ($period_from['month'] === '') ? 12 : $period_from['month'] + 1, ($period_from['month'] === '') ? 31 : 0, (int)$period_from['year']);
+ $period_to_start = mktime(0, 0, 0, ($period_to['month'] === '') ? 1 : $period_to['month'], 1, (int)$period_to['year']);
+ $period_to_end = mktime(0, 0, 0, ($period_to['month'] === '') ? 12 : $period_to['month'] + 1, ($period_to['month'] === '') ? 31 : 0, (int)$period_to['year']);
+
+ $storage = &Fima_Driver::singleton($ledger);
+
+ /* Delete existing. */
+ if ($delete) {
+ $transferfilters = array(array('type', $type_to),
+ array('date', $period_to_start, '>='),
+ array('date', $period_to_end, '<='));
+ $postings = Fima::listPostings($transferfilters);
+ $delcount = 0;
+ foreach ($postings as $postingId => $posting) {
+ $result = $storage->deletePosting($postingId);
+ if (is_a($result, 'PEAR_Error')) {
+ $notification->push(sprintf(_("There was a problem deleting an existing posting: %s"),
+ $result->getMessage()), 'horde.error');
+ } else {
+ $delcount++;
+ }
+ }
+ if ($delcount > 0) {
+ $notification->push(sprintf(_("Deleted %d existing postings."), $delcount), 'horde.success');
+ }
+ }
+
+ /* Copy postings. */
+ $transferfilters = array(array('type', $type_from),
+ array('date', $period_from_start, '>='),
+ array('date', $period_from_end, '<='));
+ $postings = Fima::listPostings($transferfilters);
+
+ if ($summarize != 'none') {
+ $accounts = Fima::listAccounts();
+ $postingscopy = array();
+
+ foreach ($postings as $postingId => $posting) {
+ $asset = (isset($accounts[$posting['asset']]))
+ ? (($accounts[$posting['asset']]['parent_id'] !== null) ? $accounts[$posting['asset']]['parent_id'] : $accounts[$posting['asset']]['account_id'])
+ : $posting['asset'];
+ $account = (isset($accounts[$posting['account']]))
+ ? (($accounts[$posting['account']]['parent_id'] !== null) ? $accounts[$posting['account']]['parent_id'] : $accounts[$posting['account']]['account_id'])
+ : $posting['account'];
+
+ if ($summarize == 'combine') {
+ $copyId = $asset . '_' . $account . '_' . strftime('%Y%m', $posting['date']);
+
+ if (isset($postingscopy[$copyId])) {
+ $postingscopy[$copyId]['amount'] += $posting['amount'];
+ } else {
+ $postingscopy[$copyId] = $posting;
+ $postingscopy[$copyId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+ $postingscopy[$copyId]['asset'] = $asset;
+ $postingscopy[$copyId]['account'] = $account;
+ $postingscopy[$copyId]['eo'] = 0;
+ $postingscopy[$copyId]['desc'] = _("Summarized");
+ }
+ } elseif ($summarize == 'post') {
+ $copyIdAsset = $asset . '_' . strftime('%Y%m', $posting['date']);
+ $copyIdAccount = $account . '_' . strftime('%Y%m', $posting['date']);
+
+ if (isset($postingscopy[$copyIdAsset])) {
+ $postingscopy[$copyIdAsset]['amount'] += $posting['amount'];
+ } else {
+ $postingscopy[$copyIdAsset] = $posting;
+ $postingscopy[$copyIdAsset]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+ $postingscopy[$copyIdAsset]['asset'] = $asset;
+ $postingscopy[$copyIdAsset]['account'] = $summarize_account;
+ $postingscopy[$copyIdAsset]['eo'] = 0;
+ $postingscopy[$copyIdAsset]['desc'] = _("Summarized");
+ }
+
+ if (isset($postingscopy[$copyIdAccount])) {
+ $postingscopy[$copyIdAccount]['amount'] += $posting['amount'];
+ } else {
+ $postingscopy[$copyIdAccount] = $posting;
+ $postingscopy[$copyIdAccount]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], 1, (int)$period_to['year']);
+ $postingscopy[$copyIdAccount]['asset'] = $summarize_account;
+ $postingscopy[$copyIdAccount]['account'] = $account;
+ $postingscopy[$copyIdAccount]['eo'] = 0;
+ $postingscopy[$copyIdAccount]['desc'] = _("Summarized");
+ }
+ }
+ }
+ } else {
+ $postingscopy = &$postings;
+ foreach ($postingscopy as $postingId => $posting) {
+ $postingscopy[$postingId]['date'] = mktime(0, 0, 0, ($period_to['month'] === '') ? strftime('%m', $posting['date']) : $period_to['month'], strftime('%d', $posting['date']), (int)$period_to['year']);
+ }
+ }
+
+ $addcount = 0;
+ foreach ($postingscopy as $postingId => $posting) {
+ $result = $storage->addPosting($type_to, $posting['date'], $posting['asset'], $posting['account'],
+ $posting['eo'], $posting['amount'], $posting['desc']);
+
+ // Check our results.
+ if (is_a($result, 'PEAR_Error')) {
+ $notification->push(sprintf(_("There was a problem saving the posting: %s."), $result->getMessage()), 'horde.error');
+ } else {
+ $addcount++;
+ }
+ }
+ if ($addcount > 0) {
+ $notification->push(sprintf($summarize ? _("Summarized %d postings.") : _("Transfered %d postings."), $addcount), 'horde.success');
+ }
+
+ /* Delete original postings. */
+ if (!$keep) {
+ $delcount = 0;
+ foreach ($postings as $postingId => $posting) {
+ $result = $storage->deletePosting($postingId);
+ if (is_a($result, 'PEAR_Error')) {
+ $notification->push(sprintf(_("There was a problem deleting an original posting: %s"),
+ $result->getMessage()), 'horde.error');
+ } else {
+ $delcount++;
+ }
+ }
+ if ($delcount > 0) {
+ $notification->push(sprintf(_("Deleted %d original postings."), $delcount), 'horde.success');
+ }
+ }
+
+ /* Return to the posting list. */
+ Horde::url('postings.php', true)->redirect();
+
+default:
+ break;
+}
+
+/* Print. */
+$print_view = (bool)Horde_Util::getFormData('print');
+if (!$print_view && $pageOb['mode'] == 'list') {
+ $print_link = Horde_Util::addParameter(Horde::url('postings.php'), array('print' => 1));
+}
+
+/* Filters. */
+$postingtype = $prefs->getValue('active_postingtype');
+$filters[] = array('type', $postingtype);
+if (isset($_SESSION['fima_search'])) {
+ $title = _("Search Results");
+ foreach ($_SESSION['fima_search'] as $searchId => $search) {
+ if ($search === null) {
+ continue;
+ }
+ switch ($searchId) {
+ case 'date_start': $filters[] = array('date', $search, '>='); break;
+ case 'date_end': $filters[] = array('date', $search, '<='); break;
+ case 'asset': $filters[] = array(array(array('asset', $search), array('account', $search, '=', 'OR'))); break;
+ case 'account': $filters[] = array('account', $search); break;
+ case 'desc': $filters[] = array('desc', Fima::convertWildcards($search), 'LIKE'); break;
+ case 'amount_start': $filters[] = array('amount', Fima::convertAmountToValue($search), '>='); break;
+ case 'amount_end': $filters[] = array('amount', Fima::convertAmountToValue($search), '<='); break;
+ case 'eo': $filters[] = array('eo', (int)(bool)$search);
+ default: break;
+ }
+ }
+}
+
+/* Retrieve accounts, accounttypes and postings (if not set before). */
+$accounts = Fima::listAccounts();
+$accounttypes = Fima::getAccountTypes();
+if (!isset($postings)) {
+ $postings = Fima::listPostings($filters, ($pageOb['mode'] != 'list' || $print_view) ? null : $pageOb['page']);
+}
+
+$pageOb['postings_perpage'] = $prefs->getValue('max_postings');
+$pageOb['postings_total'] = Fima::getPostingsCount();
+
+if ($pageOb['mode'] == 'edit') {
+ /* Fix amount sign. */
+ if ($prefs->getValue('expenses_sign') == 0) {
+ foreach ($postings as $postingId => $posting) {
+ if ($accounts[$posting['account']]['type'] == FIMA_ACCOUNTTYPE_EXPENSE) {
+ $postings[$postingId]['amount'] *= -1;
+ }
+ }
+ }
+ /* Add blank postings. */
+ for ($i = count($postings); $i < max($pageOb['postings_perpage'], 12); $i++) {
+ $postings[] = array('posting_id' => null,
+ 'owner' => $ledger,
+ 'type' => $postingtype,
+ 'date' => null,
+ 'asset' => null,
+ 'account' => null,
+ 'eo' => null,
+ 'amount' => null,
+ 'desc' => null);
+ }
+}
+
+/* Add account information to postings and create flags list. */
+if ($pageOb['mode'] == 'list') {
+ $flags = array();
+ foreach ($postings as $postingId => $posting) {
+ $postings[$postingId]['desc'] = htmlspecialchars($posting['desc']);
+
+ if (isset($accounts[$posting['asset']])) {
+ $postings[$postingId]['asset_label'] = htmlspecialchars($accounts[$posting['asset']]['label']);
+ $postings[$postingId]['asset_closed'] = $accounts[$posting['asset']]['closed'];
+ } else {
+ $postings[$postingId]['asset_label'] = _("Unknown");
+ $postings[$postingId]['asset_closed'] = false;
+ }
+ if (isset($accounts[$posting['account']])) {
+ $postings[$postingId]['account_label'] = htmlspecialchars($accounts[$posting['account']]['label']);
+ $postings[$postingId]['account_type'] = $accounts[$posting['account']]['type'];
+ $postings[$postingId]['account_type_eo'] = sprintf($posting['eo'] ? _("e.o. %s") : _("%s") , $accounttypes[$accounts[$posting['account']]['type']]);
+ $postings[$postingId]['account_closed'] = $accounts[$posting['account']]['closed'];
+ } else {
+ $postings[$postingId]['account_label'] = _("Unknown");
+ $postings[$postingId]['account_type'] = '';
+ $postings[$postingId]['account_type_eo'] = '';
+ $postings[$postingId]['account_closed'] = false;
+ }
+
+ $flag = 0;
+ $flagpos = 0;
+ foreach ($accounttypes as $typeId => $typeLabel) {
+ if ($postings[$postingId]['account_type'] == $typeId) {
+ $flag |= pow(2, $flagpos);
+ }
+ $flagpos++;
+ }
+ $flags[] = $flag;
+ }
+}
+
+/* Set up page information. */
+$pageOb['page_count'] = ceil($pageOb['postings_total'] / $pageOb['postings_perpage']);
+if ($pageOb['page'] < 0) {
+ $pageOb['page'] += $pageOb['page_count'] + 1;
+}
+if ($pageOb['mode'] == 'list') {
+ if ($pageOb['postings_total'] == 0) {
+ $pageOb['postings_count'] = _("No Postings");
+ } else {
+ $pageOb['postings_count'] = sprintf(_("%s to %s of %s Postings"),
+ ($pageOb['page'] - 1) * $pageOb['postings_perpage'] + 1,
+ min($pageOb['page'] * $pageOb['postings_perpage'], $pageOb['postings_total']),
+ $pageOb['postings_total']);
+ }
+}
+
+/* Get sorting. */
+if ($pageOb['mode'] == 'list' || $pageOb['mode'] == 'edit') {
+ $sortby = $prefs->getValue('sortby');
+ $sortdir = $prefs->getValue('sortdir');
+ $sorturl = Horde_Util::addParameter($pageOb['url'], 'sortdir', ($sortdir) ? 0 : 1);
+}
+
+/* Generate page links. */
+if ($pageOb['mode'] == 'list') {
+ $graphicsdir = Horde_Themes::img(null, 'horde');
+ if ($pageOb['page'] == 1) {
+ $pageOb['pages_first'] = Horde::img('nav/first-grey.png', null, null, $graphicsdir);
+ $pageOb['pages_prev'] = Horde::img('nav/left-grey.png', null, null, $graphicsdir);
+ } else {
+ $first_url = Horde_Util::addParameter($pageOb['url'], 'page', 1);
+ $pageOb['pages_first'] = Horde::link($first_url, _("First Page")) . Horde::img('nav/first.png', '<<', null, $graphicsdir) . '</a>';
+ $prev_url = Horde_Util::addParameter($pageOb['url'], 'page', $pageOb['page'] - 1);
+ $pageOb['pages_prev'] = Horde::link($prev_url, _("Previous Page"), '', '', '', '', '', array('id' => 'prev')) . Horde::img('nav/left.png', '<', null, $graphicsdir) . '</a>';
+ }
+ if ($pageOb['page'] == $pageOb['page_count']) {
+ $pageOb['pages_last'] = Horde::img('nav/last-grey.png', null, null, $graphicsdir);
+ $pageOb['pages_next'] = Horde::img('nav/right-grey.png', null, null, $graphicsdir);
+ } else {
+ $next_url = Horde_Util::addParameter($pageOb['url'], 'page', $pageOb['page'] + 1);
+ $pageOb['pages_next'] = Horde::link($next_url, _("Next Page"), '', '', '', '', '', array('id' => 'next')) . Horde::img('nav/right.png', '>', null, $graphicsdir) . '</a>';
+ $last_url = Horde_Util::addParameter($pageOb['url'], 'page', $pageOb['page_count']);
+ $pageOb['pages_last'] = Horde::link($last_url, _("Last Page")) . Horde::img('nav/last.png', '>>', null, $graphicsdir) . '</a>';
+ }
+}
+
+/* Some browsers have trouble with hidden overflow in table cells but not in divs. */
+if ($GLOBALS['browser']->hasQuirk('no_hidden_overflow_tables')) {
+ $overflow_begin = '<div class="ohide">';
+ $overflow_end = '</div>';
+} else {
+ $overflow_begin = '';
+ $overflow_end = '';
+}
+
+/* Set up row Ids. */
+$rowId = 0;
+
+/* Get date and amount format. */
+$datefmt = $prefs->getValue('date_format');
+$amountfmt = $prefs->getValue('amount_format');
+
+$js_onload = array();
+
+if ($pageOb['mode'] == 'edit') {
+ /* Fix date format. */
+ $datefmt = Fima::convertDateFormat($datefmt);
+
+ /* Add current date in first field if no postings. */
+ foreach ($postings as $key => $value) {
+ if ($value['date'] == '') {
+ $js_onload[] = '$("date1").setValue(' . Horde_Serialize::serialize(strftime($datefmt), Horde_Serialize::JSON, 'UTF-8') . ')';
+ }
+ break;
+ }
+
+ /* Select first date field. */
+ $js_onload[] = 'updateResult()';
+ $js_onload[] = 'updateAssetResult(_getall("asset[]")[0])';
+ $js_onload[] = '$("date1").focus().select()';
+}
+
+Horde::addInlineScript($js_onload, 'dom');
+
+require FIMA_TEMPLATES . '/common-header.inc';
+if ($print_view) {
+ require_once $registry->get('templates', 'horde') . '/javascript/print.js';
+} else {
+ require FIMA_TEMPLATES . '/menu.inc';
+}
+if ($browser->hasFeature('javascript')) {
+ require FIMA_TEMPLATES . '/postings/javascript_' . $pageOb['mode'] . '.inc';
+}
+
+/* Get current asset results. */
+if ($pageOb['mode'] == 'edit') {
+ $assetresults = Fima::getAssetResults($prefs->getValue('active_postingtype'));
+}
+
+/* Generate tabs. */
+if ($pageOb['mode'] != 'transfer' && !$print_view) {
+ $tabs = new Horde_Core_Ui_Tabs('postingtype', $vars);
+ $postingtypes = Fima::getPostingTypes();
+ foreach ($postingtypes as $typeValue => $typeLabel) {
+ $tabs->addTab($typeLabel, $pageOb['url'], $typeValue);
+ }
+ echo $tabs->render($prefs->getValue('active_postingtype'));
+}
+
+/* Generate list. */
+if (!$print_view) {
+ require FIMA_TEMPLATES . '/postings/header.inc';
+}
+
+if ($pageOb['mode'] == 'list' && $pageOb['page_count'] == 0) {
+ require FIMA_TEMPLATES . '/postings/empty.inc';
+} else {
+ $form = 1;
+ if (!$print_view) {
+ require FIMA_TEMPLATES . '/postings/navbar.inc';
+ require FIMA_TEMPLATES . '/postings/actions.inc';
+ }
+
+ require FIMA_TEMPLATES . '/postings/posting_headers.inc';
+ require FIMA_TEMPLATES . '/postings/' . $pageOb['mode'] . '.inc';
+ require FIMA_TEMPLATES . '/postings/posting_footers.inc';
+
+ /* If there are 20 postings or less, don't show the actions/navbar again. */
+ if ((count($postings) > 20 || $pageOb['mode'] != 'list') && !$print_view) {
+ $form = 2;
+ require FIMA_TEMPLATES . '/postings/actions.inc';
+ require FIMA_TEMPLATES . '/postings/navbar.inc';
+ } else {
+ /* TODO */
+ echo '<tr><td class="control" colspan="6"></td></tr>';
+ }
+}
+require FIMA_TEMPLATES . '/postings/footer.inc';
+
+require $registry->get('templates', 'horde') . '/common-footer.inc';
--- /dev/null
+<?php
+if (isset($language)) {
+ header('Content-type: text/html; charset=' . 'UTF-8');
+ header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Fima: Copyright 2007-2008 The Horde Project. Fima is under the GPL. -->
+<!-- Horde Project: http://www.horde.org/ | Fima: http://www.horde.org/fima/ -->
+<!-- Horde Licenses: http://www.horde.org/licenses/ -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+ $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
$value = hash('md5', $value);
}
$fields[] = 'user_' . Horde_String::lower($field);
- $values[] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']);
+ $values[] = Horde_String::convertCharset($value, 'UTF-8', $conf['sql']['charset']);
}
$values[] = $userID;
*/
static public function sendMail($to, $subject, $body, $attaches = array())
{
- $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => $GLOBALS['registry']->getCharset()));
+ $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => 'UTF-8'));
$mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion());
$mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']);
foreach ($attaches as $file) {
if (file_exists($file)) {
- $mail->addAttachment($file, null, null, $GLOBALS['registry']->getCharset());
+ $mail->addAttachment($file, null, null, 'UTF-8');
}
}
$mail = new Horde_Mime_Mail(array('subject' => $subject,
'body' => $body,
'from' => $this->_params['from_addr'],
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
$mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion());
$mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']);
foreach ($attachments as $file) {
if (file_exists($file)) {
- $mail->addAttachment($file, null, null, $GLOBALS['registry']->getCharset());
+ $mail->addAttachment($file, null, null, 'UTF-8');
}
}
if (empty($to)) {
continue;
}
- $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset(), true);
+ $mail->addHeader('To', $to, 'UTF-8', true);
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
$body2 = sprintf($body, $row[0], $registry->get('name', 'horde'), Folks::getUrlFor('user', $row[0], true, -1));
// Send mail
- $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], $GLOBALS['registry']->getCharset());
+ $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], 'UTF-8');
$mail->addHeader('User-Agent', 'Folks' . $registry->getVersion());
$sent = $mail->send($conf['mailer']['type'], $conf['mailer']['params']);
if ($sent instanceof PEAR_Error) {
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
-<?php echo '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '"?>' ?>
+<?php echo '<?xml version="1.0" encoding="' . 'UTF-8' . '"?>' ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
-<?php echo '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '"?>' ?>
+<?php echo '<?xml version="1.0" encoding="' . 'UTF-8' . '"?>' ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
*/
protected function _toDriver($value)
{
- return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
}
}
try {
$message = Horde::callHook('perms_denied', array('horde:max_blocks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", $max_blocks), $max_blocks), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(ngettext("You are not allowed to create more than %d block.", "You are not allowed to create more than %d blocks.", $max_blocks), $max_blocks), ENT_COMPAT, 'UTF-8');
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
break;
*/
static public function sendHTTPResponse($data, $ct)
{
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
// Output headers and encoded response.
switch ($ct) {
*/
static public function escapeJson($data, array $options = array())
{
- $json = Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? $GLOBALS['registry']->getCharset() : $options['charset']);
+ $json = Horde_Serialize::serialize($data, Horde_Serialize::JSON, empty($options['charset']) ? 'UTF-8' : $options['charset']);
if (empty($options['nodelimit'])) {
$json = '/*-secure-' . $json . '*/';
}
}
if (!empty($title)) {
if ($escape) {
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$old_error = error_reporting(0);
$title = str_replace(
array("\r", "\n"), '',
$attributes = array())
{
if (!empty($title)) {
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$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 = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
/* If browser does not support images, simply return the ALT text. */
if (!$GLOBALS['browser']->hasFeature('images')) {
*/
static public function fullSrcImg($src, $options = array())
{
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
/* If browser does not support images, simply return the ALT text. */
if (!$GLOBALS['browser']->hasFeature('images')) {
*/
static public function stripAccessKey($label)
{
- $multibyte = isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)]);
+ $multibyte = isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getLanguageCharset()]);
return preg_replace('/_([A-Za-z])/',
$multibyte && preg_match('/[\x80-\xff]/', $label) ? '' : '\1',
$label);
return $stripped_label;
}
- if (isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getCharset(true)])) {
+ if (isset($GLOBALS['registry']->nlsconfig['multibyte'][$GLOBALS['registry']->getLanguageCharset()])) {
/* Prefix parenthesis with the UTF-8 representation of the LRO
* (Left-to-Right-Override) Unicode codepoint U+202D. */
- $prefix = ($GLOBALS['registry']->getCharset() == 'UTF-8')
+ $prefix = ('UTF-8' == 'UTF-8')
? "\xe2\x80\xad"
: '';
return $stripped_label . $prefix . '(<span class="accessKey">'
*/
static public function addInlineJsVars($data, $ret = false, $onload = null)
{
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$out = array();
foreach ($data as $key => $val) {
return $apps;
case 'list-horde-languages':
- return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"' . $GLOBALS['registry']->getCharset() . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . $GLOBALS['registry']->getCharset() . '\")"), $val);'), $GLOBALS['registry']->nlsconfig['languages']);
+ return array_map(create_function('$val', 'return preg_replace(array("/&#x([0-9a-f]{4});/ie", "/(&[^;]+;)/e"), array("Horde_String::convertCharset(pack(\"H*\", \"$1\"), \"ucs-2\", \"' . 'UTF-8' . '\")", "Horde_String::convertCharset(html_entity_decode(\"$1\", ENT_COMPAT, \"iso-8859-1\"), \"iso-8859-1\", \"' . 'UTF-8' . '\")"), $val);'), $GLOBALS['registry']->nlsconfig['languages']);
case 'list-blocks':
$collection = Horde_Block_Collection::singleton();
}
Horde::addInlineScript(array(
- $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')'
+ $this->_params['id'] . ' = new SpellChecker(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, 'UTF-8') . ')'
), 'dom');
}
'body' => $message,
'to' => $conf['signup']['email'],
'from' => $conf['signup']['email'],
- 'subject' => $GLOBALS['registry']->getCharset()));
+ 'subject' => 'UTF-8'));
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
$handler_params = array(
'identity' => $injector->getInstance('Horde_Prefs_Identity'),
'mail' => $injector->getInstance('Horde_Mail'),
- 'charset' => $GLOBALS['registry']->getCharset()
+ 'charset' => 'UTF-8'
);
$alarm->addHandler('mail', new Horde_Alarm_Handler_Mail($handler_params));
$params['backend'] = $this->getOb($params['backend']['driver'], $params['backend']['params']);
}
- $params['charset'] = $GLOBALS['registry']->getCharset();
+ $params['charset'] = 'UTF-8';
break;
case 'http_remote':
break;
case 'imap':
- $params['charset'] = $GLOBALS['registry']->getCharset();
+ $params['charset'] = 'UTF-8';
break;
case 'kolab':
global $registry;
$params = array_merge(array(
- 'charset' => $registry->getCharset(),
+ 'charset' => 'UTF-8',
'email_charset' => $registry->getEmailCharset(),
'temp' => Horde::getTempDir()
), $params);
$params['vars'] = Horde_Variables::getDefaultVariables();
if (strcasecmp($driver, 'csv') === 0) {
- $params['charset'] = $GLOBALS['registry']->getCharset();
+ $params['charset'] = 'UTF-8';
}
return Horde_Data::factory($driver, $params);
: $config['app'] . '_Mime_Viewer_' . $config['driver'];
$params = array_merge($config, array(
- 'charset' => $GLOBALS['registry']->getCharset(),
+ 'charset' => 'UTF-8',
// TODO: Logging
// 'logger' => $this->_injector->getInstance('Horde_Log_Logger'),
'temp_file' => array('Horde', 'getTempFile'),
$opts = array_merge(array(
'cache' => true,
- 'charset' => $GLOBALS['registry']->getCharset(),
+ 'charset' => 'UTF-8',
'logger' => $this->_injector->getInstance('Horde_Log_Logger'),
'password' => '',
'sizecallback' => ((isset($GLOBALS['conf']['prefs']['maxsize'])) ? array($this, 'sizeCallback') : null),
- 'uicharset' => $GLOBALS['registry']->getCharset(),
+ 'uicharset' => 'UTF-8',
'user' => ''
), $opts);
ksort($opts);
case 'html2text':
case 'space2html':
case 'text2html':
- $params['charset'] = $GLOBALS['registry']->getCharset();
+ $params['charset'] = 'UTF-8';
break;
}
}
: (is_string($data) ? 'horde.message' : 'horde.error');
}
- $this->charset = $GLOBALS['registry']->getCharset();
+ $this->charset = 'UTF-8';
parent::__construct($data, $type, $flags);
}
$body = new Horde_Mime_Part();
$body->setType('text/plain');
$body->setContents(Horde_String::wrap($message, 76, "\n"));
- $body->setCharset($GLOBALS['registry']->getCharset());
+ $body->setCharset('UTF-8');
$body->send($new_addr, $msg_headers, $GLOBALS['injector']->getInstance('Horde_Mail'));
// Fall-through
default:
- $val2 = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'UTF-8');
+ $val2 = Horde_String::convertCharset($val, 'UTF-8', 'UTF-8');
}
// [0] = pref name
}
Horde::addInlineScript(array(
- 'window.' . $js_var . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')'
+ 'window.' . $js_var . ' = new Horde_Tree(' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON, 'UTF-8') . ')'
), 'dom');
return '<div id="' . $this->_instance . '"></div>';
public function __construct($params = array())
{
$this->_params = $params;
- $this->_charset = $GLOBALS['registry']->getCharset();
+ $this->_charset = 'UTF-8';
}
/**
/**
* Returns the charset for the current language.
*
- * @param boolean $original If true returns the original charset of the
- * translation, the actually used one otherwise.
- *
* @return string The character set that should be used with the current
* locale settings.
*/
- public function getCharset($original = false)
+ public function getLanguageCharset()
{
- if ($original) {
- return empty($this->nlsconfig['charsets'][$GLOBALS['language']])
- ? 'ISO-8859-1'
- : $this->nlsconfig['charsets'][$GLOBALS['language']];
- }
- return 'UTF-8';
+ return empty($this->nlsconfig['charsets'][$GLOBALS['language']])
+ ? 'ISO-8859-1'
+ : $this->nlsconfig['charsets'][$GLOBALS['language']];
}
/**
* LC_MESSAGES directory resides.
* @param string $charset The charset.
*/
- public function setTextdomain($app, $directory, $charset = null)
+ public function setTextdomain($app, $directory, $charset = 'UTF-8')
{
bindtextdomain($app, $directory);
textdomain($app);
- if (is_null($charset)) {
- $charset = $this->getCharset();
- }
-
$this->_cachedCharset(0, bind_textdomain_codeset($app, $charset));
if (!Horde::contentSent()) {
return null;
} else {
$name = Horde_String::convertCharset($name, $this->_params['charset'],
- $GLOBALS['registry']->getCharset());
+ 'UTF-8');
// Get the parent names, if any.
$parent = $this->getParentById($id);
if ($parent && !is_a($parent, 'PEAR_Error') &&
} else {
require_once 'Horde/Serialize.php';
$ser = Horde_Serialize::UTF7_BASIC;
- $data = Horde_Serialize::serialize($object->getData(), $ser, $GLOBALS['registry']->getCharset());
+ $data = Horde_Serialize::serialize($object->getData(), $ser, 'UTF-8');
}
} else {
$fullname = $object;
' VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
$values = array((int)$id,
$this->_params['group'],
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
is_null($order) ? NULL : (int)$order,
$data,
(string)$GLOBALS['registry']->getAuth(),
$id = $this->getId($old_object);
$query = 'UPDATE ' . $this->_params['table'] .
' SET datatree_name = ? WHERE datatree_id = ?';
- $values = array(Horde_String::convertCharset($new_object_name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ $values = array(Horde_String::convertCharset($new_object_name, 'UTF-8', $this->_params['charset']),
(int)$id);
Horde::logMessage('SQL Query by DataTree_sql::rename(): ' . $query . ', ' . var_export($values, true), 'DEBUG');
$data = array();
foreach ($result as $id => $row) {
$data[$id] = Horde_Serialize::unserialize($row[0], $row[1],
- $GLOBALS['registry']->getCharset());
+ 'UTF-8');
/* Convert old data to the new format. */
if ($row[1] == Horde_Serialize::BASIC) {
$data[$id] = Horde_String::convertCharset($data[$id],
- $GLOBALS['registry']->getCharset(true));
+ $GLOBALS['registry']->getLanguageCharset());
}
$data[$id] = (is_null($data[$id]) || !is_array($data[$id]))
$data = Horde_Serialize::unserialize($row['datatree_data'],
$row['datatree_serialized'],
- $GLOBALS['registry']->getCharset());
+ 'UTF-8');
/* Convert old data to the new format. */
if ($row['datatree_serialized'] == Horde_Serialize::BASIC) {
- $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getCharset(true));
+ $data = Horde_String::convertCharset($data, $GLOBALS['registry']->getLanguageCharset());
}
return (is_null($data) || !is_array($data)) ? array() : $data;
}
}
$data[$row['datatree_id']][] = array('name' => $row['name'],
'key' => $row['key'],
- 'value' => Horde_String::convertCharset($row['value'], $this->_params['charset'], $GLOBALS['registry']->getCharset()));
+ 'value' => Horde_String::convertCharset($row['value'], $this->_params['charset'], 'UTF-8'));
}
return $data;
} else {
for ($i = 0; $i < count($rows); $i++) {
$rows[$i]['value'] = Horde_String::convertCharset($rows[$i]['value'],
$this->_params['charset'],
- $GLOBALS['registry']->getCharset());
+ 'UTF-8');
}
return $rows;
}
$values = array((int)$id,
$attr['name'],
$attr['key'],
- Horde_String::convertCharset($attr['value'], $GLOBALS['registry']->getCharset(), $this->_params['charset']));
+ Horde_String::convertCharset($attr['value'], 'UTF-8', $this->_params['charset']));
Horde::logMessage('SQL Query by DataTree_sql::updateData(): ' . $query . ', ' . var_export($values, true), 'DEBUG');
/* Write to the datatree_data field. */
require_once 'Horde/Serialize.php';
$ser = Horde_Serialize::UTF7_BASIC;
- $data = Horde_Serialize::serialize($object->getData(), $ser, $GLOBALS['registry']->getCharset());
+ $data = Horde_Serialize::serialize($object->getData(), $ser, 'UTF-8');
$query = 'UPDATE ' . $this->_params['table'] .
' SET datatree_data = ?, datatree_serialized = ?' .
}
}
}
- echo '<input type="hidden" name="_formvars" value="' . @htmlspecialchars(serialize($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '" />';
+ echo '<input type="hidden" name="_formvars" value="' . @htmlspecialchars(serialize($vars), ENT_QUOTES, 'UTF-8') . '" />';
}
function renderFormActive(&$form, &$vars)
}
$groups = array();
- $current_charset = $GLOBALS['registry']->getCharset();
+ $current_charset = 'UTF-8';
for ($i = 0; $i < $result['count']; $i++) {
$utf8_dn = Horde_String::convertCharset($result[$i]['dn'], 'UTF-8', $current_charset);
$groups[$utf8_dn] = $this->getGroupName($utf8_dn);
*/
public function getGroupName($dn)
{
- $dn = Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), 'UTF-8');
+ $dn = Horde_String::convertCharset($dn, 'UTF-8', 'UTF-8');
$result = @ldap_explode_dn($dn, 1);
if ($result === false) {
throw new Horde_Group_Exception('Invalid group ID passed (bad DN syntax)');
}
$this->_userCache[$user] = array();
- $current_charset = $GLOBALS['registry']->getCharset();
+ $current_charset = 'UTF-8';
foreach ($search as $dn => $entry) {
$utf8_dn = Horde_String::convertCharset($dn, 'UTF-8', $current_charset);
$this->_userCache[$user][$utf8_dn] = $this->getGroupName($utf8_dn);
// Add CHARSET as well. At least the synthesis client
// gets confused otherwise
if (empty($params['CHARSET'])) {
- $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+ $params['CHARSET'] = 'UTF-8';
$params_str .= ';CHARSET=' . $params['CHARSET'];
}
}
function &setElemStr(&$parent, $name, $value = '')
{
- return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ return $this->setElemVal($parent, $name, Horde_String::convertCharset($value, 'UTF-8', 'utf-8'));
}
function &setVal($name, $value = '')
*/
function encodeImapFolderName($name)
{
- return Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+ return Horde_String::convertCharset($name, 'UTF-8', 'UTF7-IMAP');
}
/**
*/
protected function _createTextNode($parent, $name, $value)
{
- $value = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(),
+ $value = Horde_String::convertCharset($value, 'UTF-8',
'utf-8');
$node = $this->_xmldoc->createElement($name);
*/
public function __construct()
{
- $this->_charset = $GLOBALS['registry']->getCharset();
+ $this->_charset = 'UTF-8';
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($GLOBALS['registry']->getCharset());
+ $part->setCharset('UTF-8');
$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($GLOBALS['registry']->getCharset());
+ $part->setCharset('UTF-8');
$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", $GLOBALS['registry']->getCharset()));
- $part->setCharset($GLOBALS['registry']->getCharset());
+ $part->setContents(Horde_String::wrap($kolab_text, 76, "\r\n", 'UTF-8'));
+ $part->setCharset('UTF-8');
$part->setTransferEncoding('quoted-printable');
$mime_message->addPart($part);
$folder = new Horde_Kolab_Storage_Folder_Base('INBOX/Contacts');
$folder->restore($storage, $connection);
$folder->setName('TestAÖÜ');
- $this->assertEquals(Horde_String::convertCharset('INBOX/TestAÖÜ', $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), $folder->new_name);
+ $this->assertEquals(Horde_String::convertCharset('INBOX/TestAÖÜ', 'UTF-8', 'UTF7-IMAP'), $folder->new_name);
}
/**
}
}
echo '<input type="hidden" name="_formvars" value="'
- . htmlspecialchars(serialize($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset())
+ . htmlspecialchars(serialize($vars), ENT_QUOTES, 'UTF-8')
. '" />';
}
. 'id="%2$s" value="%3$s"%4$s%5$s%6$s />',
($var->isDisabled() ? ' form-input-disabled" ' : ''),
$var->getVarName(),
- htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
+ htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'),
($var->isDisabled() ? ' disabled="disabled" ' : ''),
($var->type->maxlength ? ' maxlength="' . $var->type->maxlength . '"' : ''),
$this->_getActionScripts($form, $var)
return sprintf(
'<input type="text" class="form-input-phone" name="%1$s" id="%1$s" value="%2$s" %3$s%4$s />',
$var->getVarName(),
- htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
+ htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'),
($var->isDisabled() ? ' disabled="disabled" ' : ''),
$this->_getActionScripts($form, $var)
);
{
return sprintf(' <input type="text" class="form-input-ipaddress" name="%1$s" id="%1$s" value="%2$s" %3$s%4$s />',
$var->getVarName(),
- htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()),
+ htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'),
$var->isDisabled() ? ' disabled="disabled" ' : '',
$this->_getActionScripts($form, $var)
);
$prompt = $var->type->prompt;
$htmlchars = $var->getOption('htmlchars');
if ($prompt) {
- $prompt = '<option value="">' . ($htmlchars ? htmlspecialchars($prompt, ENT_QUOTES, $GLOBALS['registry']->getCharset()) : $prompt) . '</option>';
+ $prompt = '<option value="">' . ($htmlchars ? htmlspecialchars($prompt, ENT_QUOTES, 'UTF-8') : $prompt) . '</option>';
}
return sprintf(' <select name="%1$s" id="%1$s"%2$s>%3$s%4$s </select>',
$var->getVarName(),
/* Hidden tag to store the current first level. */
$html = sprintf(' <input type="hidden" name="%1$s[old]" id="%1$s[old]" value="%2$s" />',
$varname,
- htmlspecialchars($selected['1'], ENT_QUOTES, $GLOBALS['registry']->getCharset()));
+ htmlspecialchars($selected['1'], ENT_QUOTES, 'UTF-8'));
/* First level. */
$values_1 = Horde_Array::valuesToKeys(array_keys($values));
'if (this.value) { document.' . $form->getName() . '.formname.value=\'\';' . 'document.' . $form->getName() . '.submit() }',
($var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : ''));
if (!empty($prompts)) {
- $html .= '<option value="">' . htmlspecialchars($prompts[0], ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '</option>';
+ $html .= '<option value="">' . htmlspecialchars($prompts[0], ENT_QUOTES, 'UTF-8') . '</option>';
}
$html .= $this->_selectOptions($values_1, $selected['1']);
$html .= ' </select>';
$varname,
($var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : ''));
if (!empty($prompts)) {
- $html .= '<option value="">' . htmlspecialchars($prompts[1], ENT_QUOTES, $GLOBALS['registry']->getCharset()) . '</option>';
+ $html .= '<option value="">' . htmlspecialchars($prompts[1], ENT_QUOTES, 'UTF-8') . '</option>';
}
$values_2 = array();
if (!empty($selected['1'])) {
function _renderVarDisplayDefault($form, $var, $vars)
{
return nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES,
- $GLOBALS['registry']->getCharset()));
+ 'UTF-8'));
}
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, $GLOBALS['registry']->getCharset()));
+ return nl2br(htmlspecialchars($display_email, ENT_QUOTES, 'UTF-8'));
}
}
if (count($values) == 0) {
return _("No values");
} elseif (isset($values[$value]) && $value != '') {
- return htmlspecialchars($values[$value], ENT_QUOTES, $GLOBALS['registry']->getCharset());
+ return htmlspecialchars($values[$value], ENT_QUOTES, 'UTF-8');
}
}
if (count($values) == 0) {
return _("No values");
} elseif (isset($values[$var->getValue($vars)])) {
- return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, $GLOBALS['registry']->getCharset());
+ return htmlspecialchars($values[$var->getValue($vars)], ENT_QUOTES, 'UTF-8');
}
}
$display[] = $name;
}
}
- return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset());
+ return htmlspecialchars(implode(', ', $display), ENT_QUOTES, 'UTF-8');
}
}
$display[] = $name;
}
}
- return htmlspecialchars(implode(', ', $display), ENT_QUOTES, $GLOBALS['registry']->getCharset());
+ return htmlspecialchars(implode(', ', $display), ENT_QUOTES, 'UTF-8');
}
}
}
}
- $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, $GLOBALS['registry']->getCharset()));
+ $html = nl2br(htmlspecialchars($var->getValue($vars), ENT_QUOTES, 'UTF-8'));
if (!empty($mapurl)) {
$html .= ' ' . 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, $GLOBALS['registry']->getCharset())
+ . htmlspecialchars($var->type->message, ENT_QUOTES, 'UTF-8')
. '</p>';
}
$selected = '';
}
$result .= ' <option value="';
- $result .= ($htmlchars) ? htmlspecialchars($value, ENT_QUOTES, $GLOBALS['registry']->getCharset()) : $value;
+ $result .= ($htmlchars) ? htmlspecialchars($value, ENT_QUOTES, 'UTF-8') : $value;
$result .= '"' . $selected . '>';
$result .= ($htmlchars) ? htmlspecialchars($display) : $display;
$result .= "</option>\n";
$selected = '';
}
$result .= " <option value=\""
- . htmlspecialchars($value, ENT_QUOTES, $GLOBALS['registry']->getCharset())
+ . htmlspecialchars($value, ENT_QUOTES, 'UTF-8')
. "\"$selected>" . htmlspecialchars($display) . "</option>\n";
}
case 'mediumtext':
case 'longblob':
case 'longtext':
- return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), $GLOBALS['registry']->getCharset(), \$this->_params['charset'])";
+ return "Horde_String::convertCharset(\$this->_db->quote(\$zitem['$n']), 'UTF-8', \$this->_params['charset'])";
// Integer types
case 'bit':
// Handle certain standard properties specially
if (in_array('displayname', $properties['DAV:'])) {
- $props[] = $this->mkprop('displayname', Horde_String::convertCharset($item['name'], $GLOBALS['registry']->getCharset(), 'UTF-8'));
+ $props[] = $this->mkprop('displayname', Horde_String::convertCharset($item['name'], 'UTF-8', 'UTF-8'));
unset($properties['DAV:']['displayname']);
}
if (in_array('getlastmodified', $properties['DAV:'])) {
foreach ($data as $key => $value) {
if (substr($key, 0, 9) == 'attribute') {
$data[$key] = Horde_String::convertCharset(
- $data[$key], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ $data[$key], 'UTF-8', $this->_params['charset']);
}
}
throw new Horde_Exception('Spellcheck failed. Command line: ' . $this->_cmd());
}
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
// Write to stdin.
if ($this->_encoding) {
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
<?php
-$charset = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
/* Variables used in core javascript files. */
$var = array(
}
$now = time();
$timers[$now] = array('name' => Horde_String::convertCharset($vars->get('description'),
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
$prefs->getCharset()),
'time' => $now);
$prefs->setValue('running_timers', serialize($timers), false);
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
}
if ($fp = @fopen($path . '/conf.php', 'w')) {
/* Can write, so output to file. */
- fwrite($fp, Horde_String::convertCharset($php, $GLOBALS['registry']->getCharset(), 'iso-8859-1'));
+ fwrite($fp, Horde_String::convertCharset($php, 'UTF-8', 'iso-8859-1'));
fclose($fp);
$notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
$registry->clearCache();
$data .= Horde_String::convertCharset(str_replace(array('\\', '\''),
array('\\\\', '\\\''),
$php),
- $GLOBALS['registry']->getCharset(), 'iso-8859-1');
+ 'UTF-8', 'iso-8859-1');
$data .= '\');' . "\n";
$data .= ' fclose($fp);' . "\n";
$data .= ' echo \'' . sprintf('Saved %s configuration.', $app) . '\' . "\n";' . "\n";
}
// Parse out the query results.
- $result = $db->execute(Horde_String::convertCharset($command, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']));
+ $result = $db->execute(Horde_String::convertCharset($command, 'UTF-8', $conf['sql']['charset']));
}
if (isset($result)) {
// $ldapPort = '389';
// $searchBase = 'ou=people,o=example.com';
// $ldapcharset = 'utf-8';
-// $outputcharset = $GLOBALS['registry']->getCharset();
+// $outputcharset = 'UTF-8';
//
// $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, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']));
+// $values[] = $db->quote(Horde_String::convertCharset($value, 'UTF-8', $GLOBALS['conf']['sql']['charset']));
// }
// $fields[] = 'object_id';
// $values[] = $db->quote($userId);
Horde::addInlineScript($script, 'dom');
/* Get the user's most recent tweet */
- $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $latestStatus = htmlspecialchars($this->_profile->status->text, ENT_COMPAT, 'UTF-8');
/* Build the UI */
$html = '<div style="padding: 0 8px 8px">'
$parents = implode(':', array_keys($parents));
$params = array($id,
- Horde_String::convertCharset($object->name, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']),
- Horde_String::convertCharset($parents, $GLOBALS['registry']->getCharset(), $conf['sql']['charset']),
- Horde_String::convertCharset($object->get('email'), $GLOBALS['registry']->getCharset(), $conf['sql']['charset']),
+ Horde_String::convertCharset($object->name, 'UTF-8', $conf['sql']['charset']),
+ Horde_String::convertCharset($parents, 'UTF-8', $conf['sql']['charset']),
+ Horde_String::convertCharset($object->get('email'), 'UTF-8', $conf['sql']['charset']),
);
$result = $db->query($group_query, $params);
if (is_a($result, 'PEAR_Error')) {
// If we're serving a request to the JS update client, just return the blocks
// updated HTML content.
if (Horde_Util::getFormData('httpclient')) {
- header('Content-Type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-Type: text/html; charset=' . 'UTF-8');
$row = Horde_Util::getFormData('row');
$col = Horde_Util::getFormData('col');
if (!is_null($row) && !is_null($col) && !empty($layout_pref[$row][$col])) {
'body' => $body,
'to' => $conf['problems']['email'],
'from' => $email,
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
$mail->addHeader('Sender', 'horde-problem@' . $conf['problems']['maildomain']);
/* Add attachment. */
$password),
'to' => $email,
'from' => $email,
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
try {
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
$notification->push(_("Your password has been reset, check your email and log in with your new password."), 'horde.success');
$ajax_url = Horde::getServiceLink('ajax', 'horde');
$ajax_url->pathInfo = 'sidebarUpdate';
- $charset = $registry->getCharset();
+ $charset = 'UTF-8';
$rtl = intval(isset($registry->nlsconfig['rtl'][$language]));
$show_sidebar = !isset($_COOKIE['horde_sidebar_expanded']) || $_COOKIE['horde_sidebar_expanded'];
$width = intval($prefs->getValue('sidebar_width'));
/* These are all referencing the *original* tweet */
$view->profileLink = Horde::externalUrl('http://twitter.com/' . htmlspecialchars($tweetObj->user->screen_name), true);
$view->profileImg = $tweetObj->user->profile_image_url;
- $view->authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
- $view->authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $view->authorName = htmlspecialchars($tweetObj->user->screen_name, ENT_COMPAT, 'UTF-8');
+ $view->authorFullname = htmlspecialchars($tweetObj->user->name, ENT_COMPAT, 'UTF-8');
$view->createdAt = $tweetObj->created_at;
$view->clientText = $filter->filter($tweet->source, 'xss');
$view->tweet = $tweet;
<label for="new_user" class="hidden"><?php echo _("User") ?></label>
<input type="text" id="new_user" name="new_user" />
<?php endif; ?>
-<input type="submit" class="button" value="<?php echo htmlspecialchars(sprintf(_("Save \"%s\""), $group->getShortName()), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?>" />
+<input type="submit" class="button" value="<?php echo htmlspecialchars(sprintf(_("Save \"%s\""), $group->getShortName()), ENT_COMPAT, 'UTF-8') ?>" />
</p>
<br />
<?php
if (isset($GLOBALS['language'])) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
$msg = new Horde_Mime_Part();
$msg->setType('text/plain');
- $msg->setCharset($registry->getCharset());
+ $msg->setCharset('UTF-8');
$d_url = new Horde_Url(Horde::selfUrl(true, false, true));
$msg->setContents(Horde_String::wrap(sprintf(_("Your linked attachment has been downloaded by at least one user.\n\nAttachment name: %s\nAttachment date: %s\n\nClick on the following link to permanently delete the attachment:\n%s"), $file_name, date('r', $time_stamp), $d_url->add('d', $id))));
switch ($vars->a) {
case _("Save Draft"):
try {
- $notification->push($imp_compose->saveDraft($header, $message, $registry->getCharset(), false), 'horde.success');
+ $notification->push($imp_compose->saveDraft($header, $message, 'UTF-8', false), 'horde.success');
if ($prefs->getValue('close_draft')) {
$imp_compose->destroy('save_draft');
require IMP_BASE . '/mailbox-mimp.php';
$header['to'] = $imp_headers->getValue('to');
}
if (empty($header['to'])) {
- ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('from'), array('charset' => $registry->getCharset()))) ||
- ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('reply-to'), array('charset' => $registry->getCharset())));
+ ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('from'), array('charset' => 'UTF-8'))) ||
+ ($header['to'] = Horde_Mime_Address::addrArray2String($imp_headers->getOb('reply-to'), array('charset' => 'UTF-8')));
}
break;
if (in_array($vars->actionID, array('auto_save_draft', 'save_draft'))) {
if (!$readonly_drafts) {
try {
- $result = $imp_compose->saveDraft($header, $message, $registry->getCharset(), $rtemode);
+ $result = $imp_compose->saveDraft($header, $message, 'UTF-8', $rtemode);
/* Closing draft if requested by preferences. */
if ($vars->actionID == 'save_draft') {
/* If this is the first page load for this compose item, add auto BCC
* addresses. */
if (!$vars->compose_formToken && ($vars->actionID != 'draft')) {
- $header['bcc'] = Horde_Mime_Address::addrArray2String($identity->getBccAddresses(), array('charset' => $registry->getCharset()));
+ $header['bcc'] = Horde_Mime_Address::addrArray2String($identity->getBccAddresses(), array('charset' => 'UTF-8'));
}
foreach (array('to', 'cc', 'bcc', 'subject') as $val) {
// public function pre_sent($message, $headers)
// {
// // Example: Add custom headers to outgoing message.
-// $charset = $GLOBALS['registry']->getCharset();
+// $charset = 'UTF-8';
// $custom_hdrs = array();
// $hdr_charset = $message->getHeaderCharset();
//
// // the same domain.
// $flags = array();
//
-// $from_ob = Horde_Mime_Address::getAddressesFromObject($data['envelope']['from'], array('charset' => $GLOBALS['registry']->getCharset()));
+// $from_ob = Horde_Mime_Address::getAddressesFromObject($data['envelope']['from'], array('charset' => 'UTF-8'));
// if (!empty($from_ob) &&
// (strcasecmp($from_ob[0]['host'], 'example.com') === 0)) {
// /* The '$indomain' flag in this example must have already been
$selected_addresses = array();
foreach (explode('|', $vars->sa) as $addr) {
if (strlen(trim($addr))) {
- $selected_addresses[] = @htmlspecialchars($addr, ENT_QUOTES, $registry->getCharset());
+ $selected_addresses[] = @htmlspecialchars($addr, ENT_QUOTES, 'UTF-8');
}
}
foreach ($addresses as $addr) {
if (!empty($addr['email'])) {
if (strpos($addr['email'], ',') !== false) {
- $a_list[] = @htmlspecialchars(Horde_Mime_Address::encode($addr['name'], 'personal') . ': ' . $addr['email'] . ';', ENT_QUOTES, $registry->getCharset());
+ $a_list[] = @htmlspecialchars(Horde_Mime_Address::encode($addr['name'], 'personal') . ': ' . $addr['email'] . ';', ENT_QUOTES, 'UTF-8');
} else {
$mbox_host = explode('@', $addr['email']);
if (isset($mbox_host[1])) {
- $a_list[] = @htmlspecialchars(Horde_Mime_Address::writeAddress($mbox_host[0], $mbox_host[1], $addr['name']), ENT_QUOTES, $registry->getCharset());
+ $a_list[] = @htmlspecialchars(Horde_Mime_Address::writeAddress($mbox_host[0], $mbox_host[1], $addr['name']), ENT_QUOTES, 'UTF-8');
}
}
}
$subscribe = $prefs->getValue('subscribe');
$showAll = (!$subscribe || $_SESSION['imp']['showunsub']);
-$charset = $registry->getCharset();
+$charset = 'UTF-8';
$vars = Horde_Variables::getDefaultVariables();
/* Get the base URL for this page. */
$imptree = $GLOBALS['injector']->getInstance('IMP_Imap_Tree');
$imptree->eltDiffStart();
- $new = Horde_String::convertCharset($this->_vars->mbox, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+ $new = Horde_String::convertCharset($this->_vars->mbox, 'UTF-8', 'UTF7-IMAP');
try {
$new = $imptree->createMailboxName($this->_vars->parent, $new);
$result = false;
try {
- $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+ $new = Horde_String::convertCharset($imptree->createMailboxName($this->_vars->new_parent, $this->_vars->new_name), 'UTF-8', 'UTF7-IMAP');
if (($this->_vars->old_name != $new) &&
$GLOBALS['injector']->getInstance('IMP_Folder')->rename($this->_vars->old_name, $new)) {
}
try {
- $res = $imp_compose->saveDraft($headers, $this->_vars->message, $GLOBALS['registry']->getCharset(), $this->_vars->html);
+ $res = $imp_compose->saveDraft($headers, $this->_vars->message, 'UTF-8', $this->_vars->html);
if ($this->_action == 'autoSaveDraft') {
$GLOBALS['notification']->push(_("Draft automatically saved."), 'horde.message');
} else {
$menu->addArray(array(
'class' => '__noselection',
'icon' => 'empty_trash.png',
- 'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, $registry->getCharset()) . ')',
+ 'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, 'UTF-8') . ')',
'text' => _("Empty _Trash"),
'url' => IMP::generateIMPUrl($menu_mailbox_url, $trash_folder)->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')))
));
$menu->addArray(array(
'class' => '__noselection',
'icon' => 'empty_spam.png',
- 'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, $registry->getCharset()) . ')',
+ 'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash folder?"), Horde_Serialize::JSON, 'UTF-8') . ')',
'text' => _("Empty _Spam"),
'url' => IMP::generateIMPUrl($menu_mailbox_url, IMP::folderPref($spam_folder, true))->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => Horde::getRequestToken('imp.mailbox')))
));
if (empty($indices)) {
$html .= '<tr><td><em>' . _("No unread messages") . '</em></td></tr>';
} else {
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$imp_ui = new IMP_Ui_Mailbox('INBOX');
$shown = empty($this->_params['msgs_shown'])
? 3
$identity_id = $identity->getMatchingIdentity($fromaddr);
}
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$header = array(
'to' => Horde_Mime_Address::addrArray2String($headers->getOb('to'), array('charset' => $charset)),
'cc' => Horde_Mime_Address::addrArray2String($headers->getOb('cc'), array('charset' => $charset)),
$mdn->addMdnRequestHeaders($barefrom);
}
- $browser_charset = $GLOBALS['registry']->getCharset();
+ $browser_charset = 'UTF-8';
$headers->addHeader('From', Horde_String::convertCharset($header['from'], $browser_charset, $charset));
}
try {
- $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], $GLOBALS['registry']->getCharset(), 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags)));
+ $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append(Horde_String::convertCharset($opts['sent_folder'], 'UTF-8', 'UTF-8'), array(array('data' => $fcc, 'flags' => $flags)));
} catch (Horde_Imap_Client_Exception $e) {
$notification->push(sprintf(_("Message sent successfully, but not saved to %s"), IMP::displayFolder($opts['sent_folder'])));
$sent_saved = false;
try {
$error = Horde::callHook('perms_denied', array('imp:max_timelimit'));
} catch (Horde_Exception_HookNotSet $e) {
- $error = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients within %d hours."), $timelimit, $GLOBALS['conf']['sentmail']['params']['limit_period']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $error = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients within %d hours."), $timelimit, $GLOBALS['conf']['sentmail']['params']['limit_period']), ENT_COMPAT, 'UTF-8');
}
throw new IMP_Compose_Exception($error);
}
/* Properly encode the addresses we're sending to. */
try {
- $email = Horde_Mime::encodeAddress($email, is_null($message) ? $GLOBALS['registry']->getCharset() : $message->getHeaderCharset(), $_SESSION['imp']['maildomain']);
+ $email = Horde_Mime::encodeAddress($email, is_null($message) ? 'UTF-8' : $message->getHeaderCharset(), $_SESSION['imp']['maildomain']);
/* Validate the recipient addresses. */
Horde_Mime_Address::parseAddressList($email, array(
}
try {
- $r_array = Horde_Mime::encodeAddress($recipients, $GLOBALS['registry']->getCharset(), $_SESSION['imp']['maildomain']);
+ $r_array = Horde_Mime::encodeAddress($recipients, 'UTF-8', $_SESSION['imp']['maildomain']);
$r_array = Horde_Mime_Address::parseAddressList($r_array, array('validate' => true));
} catch (Horde_Mime_Exception $e) {}
try {
$message = Horde::callHook('perms_denied', array('imp:max_recipients'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients."), $max_recipients), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to send messages to more than %d recipients."), $max_recipients), ENT_COMPAT, 'UTF-8');
}
throw new IMP_Compose_Exception($message);
}
// Convert IDN hosts to ASCII.
if (function_exists('idn_to_ascii')) {
$old_error = error_reporting(0);
- $host = idn_to_ascii(Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8'));
+ $host = idn_to_ascii(Horde_String::convertCharset($host, 'UTF-8', 'UTF-8'));
error_reporting($old_error);
- } elseif (Horde_Mime::is8bit($ob['mailbox'], $GLOBALS['registry']->getCharset())) {
+ } elseif (Horde_Mime::is8bit($ob['mailbox'], 'UTF-8')) {
throw new IMP_Compose_Exception(sprintf(_("Invalid character in e-mail address: %s."), $email));
}
protected function _createMimeMessage($to, $body, $charset,
$options = array())
{
- $nls_charset = $GLOBALS['registry']->getCharset();
+ $nls_charset = 'UTF-8';
$body = Horde_String::convertCharset($body, $nls_charset, $charset);
if (!empty($options['html'])) {
'subject' => ''
);
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$h = $contents->getHeaderOb();
$match_identity = $this->_getMatchingIdentity($h);
$reply_type = 'reply';
);
}
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$h = $contents->getHeaderOb();
$from = Horde_Mime_Address::addrArray2String($h->getOb('from'), array('charset' => $charset));
$h = $contents->getHeaderOb();
$from = Horde_Mime_Address::addrArray2String($h->getOb('from'), array(
- 'charset' => $GLOBALS['registry']->getCharset()
+ 'charset' => 'UTF-8'
));
$msg_pre = "\n----- " .
$resent_headers->addHeader('Resent-To', $recip['header']['to']);
$resent_headers->addHeader('Resent-Message-ID', Horde_Mime::generateMessageId());
- $header_text = trim($resent_headers->toString(array('encode' => $GLOBALS['registry']->getCharset()))) . "\n" . trim($contents->getHeaderOb(false));
+ $header_text = trim($resent_headers->toString(array('encode' => 'UTF-8'))) . "\n" . trim($contents->getHeaderOb(false));
$to = $this->_prepSendMessage($recipients);
- $hdr_array = $headers->toArray(array('charset' => $GLOBALS['registry']->getCharset()));
+ $hdr_array = $headers->toArray(array('charset' => 'UTF-8'));
$hdr_array['_raw'] = $header_text;
try {
$headerob = $contents->getHeaderOb();
$part = new Horde_Mime_Part();
- $part->setCharset($GLOBALS['registry']->getCharset());
+ $part->setCharset('UTF-8');
$part->setType('message/rfc822');
$part->setName(_("Forwarded Message"));
$part->setContents($contents->fullMessageText(array('stream' => true)));
*/
protected function _getMsgHeaders($h)
{
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$tmp = array();
if (($ob = $h->getValue('date'))) {
if ($part->getPrimaryType() == 'text') {
if ($analyzetype = Horde_Mime_Magic::analyzeFile($tempfile, empty($conf['mime']['magic_db']) ? null : $conf['mime']['magic_db'], array('nostrip' => true))) {
$analyzetype = Horde_Mime::decodeParam('Content-Type', $analyzetype);
- $part->setCharset(isset($analyzetype['params']['charset']) ? $analyzetype['params']['charset'] : $GLOBALS['registry']->getCharset());
+ $part->setCharset(isset($analyzetype['params']['charset']) ? $analyzetype['params']['charset'] : 'UTF-8');
} else {
- $part->setCharset($GLOBALS['registry']->getCharset());
+ $part->setCharset('UTF-8');
}
} else {
- $part->setHeaderCharset($GLOBALS['registry']->getCharset());
+ $part->setHeaderCharset('UTF-8');
}
$part->setName($filename);
$part->setBytes($_FILES[$name]['size']);
$fullpath = sprintf('%s/%s/%d', self::VFS_LINK_ATTACH_PATH, $auth, $ts);
$charset = $part->getCharset();
- $trailer = Horde_String::convertCharset(_("Attachments"), $GLOBALS['registry']->getCharset(), $charset);
+ $trailer = Horde_String::convertCharset(_("Attachments"), 'UTF-8', $charset);
if ($prefs->getValue('delete_attachments_monthly')) {
/* Determine the first day of the month in which the current
* attachments will be ripe for deletion, then subtract 1 second
* to obtain the last day of the previous month. */
$del_time = mktime(0, 0, 0, date('n') + $prefs->getValue('delete_attachments_monthly_keep') + 1, 1, date('Y')) - 1;
- $trailer .= Horde_String::convertCharset(' (' . sprintf(_("Links will expire on %s"), strftime('%x', $del_time)) . ')', $GLOBALS['registry']->getCharset(), $charset);
+ $trailer .= Horde_String::convertCharset(' (' . sprintf(_("Links will expire on %s"), strftime('%x', $del_time)) . ')', 'UTF-8', $charset);
}
foreach ($this as $att) {
$part = $contents->getMIMEPart($body_id);
$type = $part->getType();
$part_charset = $part->getCharset();
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$msg = Horde_String::convertCharset($part->getContents(), $part_charset, $charset);
$part = new Horde_Mime_Part();
$part->setType('text/x-vcard');
- $part->setCharset($GLOBALS['registry']->getCharset());
+ $part->setCharset('UTF-8');
$part->setContents($vcard);
$part->setName((strlen($name) ? $name : 'vcard') . '.vcf');
$this->_attachVCard = $part;
{
$slist = @unserialize($GLOBALS['prefs']->getValue('stationery', false));
$this->_stationery = is_array($slist)
- ? Horde_String::convertCharset($slist, $GLOBALS['prefs']->getCharset(), $GLOBALS['registry']->getCharset())
+ ? Horde_String::convertCharset($slist, $GLOBALS['prefs']->getCharset(), 'UTF-8')
: array();
}
switch ($this[$id]['t']) {
case 'html':
if (!$html) {
- $s_content = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($s_content, 'Html2text', array('charset' => $GLOBALS['registry']->getCharset()));
+ $s_content = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($s_content, 'Html2text', array('charset' => 'UTF-8'));
}
break;
*/
protected function _save()
{
- $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset($this->_stationery, $GLOBALS['registry']->getCharset(), $GLOBALS['prefs']->getCharset())), false);
+ $GLOBALS['prefs']->setValue('stationery', serialize(Horde_String::convertCharset($this->_stationery, 'UTF-8', $GLOBALS['prefs']->getCharset())), false);
}
/* ArrayAccess methods. */
'text' => $status
)
),
- 'type' => 'text/html; charset=' . $GLOBALS['registry']->getCharset()
+ 'type' => 'text/html; charset=' . 'UTF-8'
)
);
}
/* If this is a text/* part, AND the browser does not support
* UTF-8, give the user a link to open the part in a new window
* with the correct character set. */
- $default_charset = Horde_String::upper($GLOBALS['registry']->getCharset());
+ $default_charset = Horde_String::upper('UTF-8');
if ($default_charset !== 'UTF-8') {
$charset_upper = Horde_String::upper($mime_part->getCharset());
if (($charset_upper != 'US-ASCII') &&
// Retrieve 3x the size of $maxlen of bodytext data. This should
// account for any content-encoding & HTML tags.
$pmime = $this->getMIMEPart($mimeid, array('length' => $maxlen * 3));
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$ptext = Horde_String::convertCharset($pmime->getContents(), $pmime->getCharset(), $charset);
(strpos($id, '.') === false)) {
if ($mask & self::SUMMARY_STRIP_LINK) {
$url = Horde::selfUrl(true)->remove(array('actionID', 'imapid', 'uid'))->add(array('actionID' => 'strip_attachment', 'imapid' => $id, 'uid' => $this->_uid, 'message_token' => Horde::getRequestToken('imp.impcontents')));
- $part['strip'] = Horde::link($url, _("Strip Attachment"), 'deleteImg', null, 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to PERMANENTLY delete this attachment?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')') . '</a>';
+ $part['strip'] = Horde::link($url, _("Strip Attachment"), 'deleteImg', null, 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to PERMANENTLY delete this attachment?"), Horde_Serialize::JSON, 'UTF-8') . ')') . '</a>';
} else {
$part['strip'] = Horde::link('#', _("Strip Attachment"), 'deleteImg stripAtc', null, null, null, null, array('mimeid' => $id)) . '</a>';
}
*/
public function textWindowOutput($name, $msg)
{
- $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($msg));
+ $GLOBALS['browser']->downloadHeaders($name, 'text/plain; charset=' . 'UTF-8', true, strlen($msg));
echo $msg;
}
*/
public function textWindowOutput($name, $msg, $html = false)
{
- $GLOBALS['browser']->downloadHeaders($name, $html ? 'text/html' : 'text/plain; charset=' . $GLOBALS['registry']->getCharset(), true, strlen($msg));
+ $GLOBALS['browser']->downloadHeaders($name, $html ? 'text/html' : 'text/plain; charset=' . 'UTF-8', true, strlen($msg));
echo $msg;
}
static public function returnToDimp($mailbox = '')
{
print '<html><head>' .
- Horde::wrapInlineScript(array('window.parent.DimpBase.go(' . Horde_Serialize::serialize('folder:' . strval($mailbox), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')')) .
+ Horde::wrapInlineScript(array('window.parent.DimpBase.go(' . Horde_Serialize::serialize('folder:' . strval($mailbox), Horde_Serialize::JSON, 'UTF-8') . ')')) .
'</head></html>';
exit;
}
try {
$message = Horde::callHook('perms_denied', array('imp:create_folders'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(_("You are not allowed to create folders."), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(_("You are not allowed to create folders."), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
return false;
try {
$message = Horde::callHook('perms_denied', array('imp:max_folders'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_folders', array('opts' => array('value' => true)))), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
return false;
$result = $registry->call('contacts/import', array(array('name' => $newName, 'email' => $newAddress), 'array', $prefs->getValue('add_source')));
- $escapeName = @htmlspecialchars($newName, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $escapeName = @htmlspecialchars($newName, ENT_COMPAT, 'UTF-8');
try {
if ($contact_link = $registry->link('contacts/show', array('uid' => $result, 'source' => $prefs->getValue('add_source')))) {
stripos($out, $key) === 0) {
$len = strlen($key);
if ((strlen($out) == $len) || ($out[$len] == $delimiter)) {
- $out = substr_replace($out, Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'), 0, $len);
+ $out = substr_replace($out, Horde_String::convertCharset($val, 'UTF-8', 'UTF7-IMAP'), 0, $len);
break;
}
}
static public function formMbox($mbox, $to)
{
return $to
- ? htmlspecialchars(rawurlencode($mbox), ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ ? htmlspecialchars(rawurlencode($mbox), ENT_COMPAT, 'UTF-8')
: rawurldecode($mbox);
}
/* IMAP keywords must conform to RFC 3501 [9] (flag-keyword). Convert
* whitespace to underscore. */
- $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP'));
+ $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), 'UTF-8', 'UTF7-IMAP'));
if (!isset($this->_flags[$key])) {
$entry = $this->_createEntry($label);
foreach ($imaptree as $k => $v) {
foreach ($sent_mail_folders as $folder) {
if (preg_match('/^' . str_replace('/', '\/', $folder) . '-([^-]+)-([0-9]{4})$/i', $k, $regs)) {
- $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+ $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), 'UTF-8', 'UTF7-IMAP');
}
}
}
/* TODO: When Horde_iCalendar supports setting of charsets
* we need to set it there instead of relying on the fact
* that both Nag and IMP use the same charset. */
- $body = Horde_String::convertCharset($body, $body_part->getCharset(), $GLOBALS['registry']->getCharset());
+ $body = Horde_String::convertCharset($body, $body_part->getCharset(), 'UTF-8');
/* Create a new iCalendar. */
$vCal = new Horde_iCalendar();
/* Need to make sure all text is in the correct charset. */
$part_name = $part->getName(true);
- $newPart->setCharset($GLOBALS['registry']->getCharset());
+ $newPart->setCharset('UTF-8');
$newPart->setContents(sprintf(_("[Attachment stripped: Original attachment type: %s, name: %s]"), $part->getType(), $part_name ? $part_name : _("unnamed")));
$parts[] = array(
$t->set('personalkey-delete-help', Horde_Help::link('imp', 'pgp-personalkey-delete'));
Horde::addInlineScript(array(
- '$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')) { e.stop(); } })'
+ '$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
), 'dom');
} else {
$imp_identity = $GLOBALS['injector']->getInstance('IMP_Identity');
$t->set('personalkey-create-passphrase-help', Horde_Help::link('imp', 'pgp-personalkey-create-passphrase'));
Horde::addInlineScript(array(
- '$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Key generation may take a long time to complete. Continue with key generation?"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')) { e.stop(); } })'
+ '$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Key generation may take a long time to complete. Continue with key generation?"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
), 'dom');
if ($_SESSION['imp']['file_upload']) {
$sent_mail_folder = IMP::formMbox($ui->vars->sent_mail_folder, false);
if (empty($sent_mail_folder) && $ui->vars->sent_mail_folder_new) {
- $sent_mail_folder = Horde_String::convertCharset($ui->vars->sent_mail_folder_new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+ $sent_mail_folder = Horde_String::convertCharset($ui->vars->sent_mail_folder_new, 'UTF-8', 'UTF7-IMAP');
} elseif (strpos($sent_mail_folder, self::PREF_SPECIALUSE) === 0) {
$sent_mail_folder = substr($folder, strlen(self::PREF_SPECIALUSE));
} elseif (($sent_mail_folder == self::PREF_DEFAULT) &&
$t->set('personalkey-delete-help', Horde_Help::link('imp', 'smime-delete-personal-certs'));
Horde::addInlineScript(array(
- '$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . ')) { e.stop(); } })'
+ '$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
), 'dom');
} elseif ($_SESSION['imp']['file_upload']) {
$cacheSess = $GLOBALS['injector']->getInstance('Horde_SessionObjects');
if (strpos($folder, self::PREF_SPECIALUSE) === 0) {
$folder = substr($folder, strlen(self::PREF_SPECIALUSE));
} elseif (!empty($new)) {
- $new = Horde_String::convertCharset($new, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP');
+ $new = Horde_String::convertCharset($new, 'UTF-8', 'UTF7-IMAP');
$folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($new);
if (!$GLOBALS['injector']->getInstance('IMP_Folder')->create($folder, $prefs->getValue('subscribe'), array($type => true))) {
$folder = null;
/* Send the message. */
try {
- $imp_compose->sendMessage($to, $spam_headers, $mime, $GLOBALS['registry']->getCharset());
+ $imp_compose->sendMessage($to, $spam_headers, $mime, 'UTF-8');
$report_flag = true;
} catch (IMP_Compose_Exception $e) {
Horde::logMessage($e, 'ERR');
// Sent mail display name
'smf_display' => IMP::displayFolder($identity->getValue('sent_mail_folder', $ident)),
// Bcc addresses to add
- 'bcc' => Horde_Mime_Address::addrArray2String($identity->getBccAddresses($ident), array('charset' => $GLOBALS['registry']->getCharset()))
+ 'bcc' => Horde_Mime_Address::addrArray2String($identity->getBccAddresses($ident), array('charset' => 'UTF-8'))
);
}
$this->_cache['drafts_sm_folder'] = IMP::isSpecialFolder($this->_mailbox);
}
- $from = Horde_Mime_Address::getAddressesFromObject($ob['from'], array('charset' => $GLOBALS['registry']->getCharset()));
+ $from = Horde_Mime_Address::getAddressesFromObject($ob['from'], array('charset' => 'UTF-8'));
$from = reset($from);
if (empty($from)) {
$ret['from'] = _("Undisclosed Recipients");
$ret['error'] = true;
} else {
- $to = Horde_Mime_Address::getAddressesFromObject($ob['to'], array('charset' => $GLOBALS['registry']->getCharset()));
+ $to = Horde_Mime_Address::getAddressesFromObject($ob['to'], array('charset' => 'UTF-8'));
$first_to = reset($to);
if (empty($first_to)) {
$ret['from'] = _("Undisclosed Recipients");
*/
public function getSubject($subject, $htmlspaces = false)
{
- $subject = Horde_Mime::decode($subject, $GLOBALS['registry']->getCharset());
+ $subject = Horde_Mime::decode($subject, 'UTF-8');
if (empty($subject)) {
return _("[No Subject]");
}
$GLOBALS['conf']['server']['name'],
$GLOBALS['injector']->getInstance('IMP_Mail'),
array(
- 'charset' => $GLOBALS['registry']->getCharset(),
+ 'charset' => 'UTF-8',
'from_addr' => $GLOBALS['injector']->getInstance('Horde_Prefs_Identity')->getIdentity()->getDefaultFromAddress()
)
);
} catch (Horde_Exception $e) {}
}
- foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => $registry->getCharset())) as $ob) {
+ foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => 'UTF-8')) as $ob) {
if (isset($ob['groupname'])) {
$group_array = array();
foreach ($ob['addresses'] as $ad) {
'num' => intval($num),
'size' => $mime->getSize(),
'type' => $mime->getType()
- ), Horde_Serialize::JSON, $registry->getCharset());
+ ), Horde_Serialize::JSON, 'UTF-8');
$result['jsonload'][] = 'DimpCompose.addAttach(' . $opts . ')';
}
}
/* Get mailbox information. */
$overview = $imp_mailbox->getMailboxArray($msglist, array('headers' => true, 'structure' => $GLOBALS['prefs']->getValue('atc_flag')));
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$imp_ui = new IMP_Ui_Mailbox($folder);
$no_flags_hook = false;
$addr_array = array();
- foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => $GLOBALS['registry']->getCharset())) as $ob) {
+ foreach (Horde_Mime_Address::getAddressesFromObject($addrlist, array('charset' => 'UTF-8')) as $ob) {
if (!empty($ob['inner'])) {
try {
$tmp = array('raw' => Horde::callHook('dimp_addressformatting', array($ob), 'imp'));
/* Get flag information. */
$flag_parse = $injector->getInstance('IMP_Imap_Flags')->parse(array(
'flags' => $ob['flags'],
- 'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => $registry->getCharset())),
+ 'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => 'UTF-8')),
'priority' => $ob['headers']
));
'atc' => isset($ob['structure']) ? $ob['structure'] : null,
'div' => true,
'flags' => $ob['flags'],
- 'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => $registry->getCharset())),
+ 'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to'], array('charset' => 'UTF-8')),
'priority' => $ob['headers']
));
}
/* Format the From: Header. */
- $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => $registry->getCharset()));
+ $getfrom = $imp_ui->getFrom($ob['envelope'], array('fullfrom' => true, 'specialchars' => 'UTF-8'));
$msg['from'] = $getfrom['from'];
$msg['fullfrom'] = $getfrom['fullfrom'];
switch ($fromlinkstyle) {
$menu[] = array(_("Reply to List"), IMP::composeLink(array(), array('a' => 'rl') + $compose_params));
}
- if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => $registry->getCharset(), 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
+ if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => 'UTF-8', 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
$menu[] = array(_("Reply All"), IMP::composeLink(array(), array('a' => 'ra') + $compose_params));
}
/* Build Reply-To address link. */
if (!empty($envelope['reply-to']) &&
- (Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['from']), array('charset' => $registry->getCharset()))) !=
- Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['reply-to']), array('charset' => $registry->getCharset())))) &&
+ (Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['from']), array('charset' => 'UTF-8'))) !=
+ Horde_Mime_Address::bareAddress(Horde_Mime_Address::addrObject2String(reset($envelope['reply-to']), array('charset' => 'UTF-8')))) &&
($reply_to = $imp_ui->buildAddressLinks($envelope['reply-to'], $self_link))) {
$display_headers['reply-to'] = $reply_to;
}
$a_template->set('reply_list', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply_list') + $compose_params), _("To List"), 'widget', '', '', _("To _List"), true));
}
- if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => $registry->getCharset(), 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
+ if (Horde_Mime_Address::addrArray2String(array_merge($envelope['to'], $envelope['cc']), array('charset' => 'UTF-8', 'filter' => array_keys($user_identity->getAllFromAddresses(true))))) {
$a_template->set('show_reply_all', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply_all') + $compose_params), _("To All"), 'widget', '', '', _("To _All"), true));
}
'description' => isset($ob['preview']) ? $ob['preview'] : '',
'url' => Horde::url(IMP::generateIMPUrl('message.php', $mailbox, $ob['uid'], $mailbox), true, array('append_session' => -1)),
'fromAddr' => $from_addr['fullfrom'],
- 'toAddr' => Horde_Mime_Address::addrArray2String(isset($ob['envelope']['to']) ? $ob['envelope']['to'] : array(), array('charset' => $registry->getCharset()))
+ 'toAddr' => Horde_Mime_Address::addrArray2String(isset($ob['envelope']['to']) ? $ob['envelope']['to'] : array(), array('charset' => 'UTF-8'))
));
}
}
: sprintf(_("%u of %u messages in %s unread."), $unseen_num, $total_num, IMP::getLabel($mailbox));
$t = $injector->createInstance('Horde_Template');
-$t->set('charset', $registry->getCharset());
+$t->set('charset', 'UTF-8');
$t->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$t->set('pubDate', htmlspecialchars(date('r')));
$t->set('desc', htmlspecialchars($description));
}
if (isset($GLOBALS['language'])) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
}
Horde::addInlineScript(array(
- 'var DIMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+ 'var DIMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, 'UTF-8')
), null, true);
);
Horde::addInlineScript(array(
- 'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+ 'var IMP = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, 'UTF-8')
), null, true);
$imp_indices = new IMP_Indices(IMP::$mailbox, $thread);
}
-$charset = $registry->getCharset();
+$charset = 'UTF-8';
$imp_ui = new IMP_Ui_Message();
foreach ($imp_indices->indices() as $mbox => $idxlist) {
function _sanitizeName($name)
{
- return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'UTF-8')), ' _'), 'UTF-8');
+ return Horde_String::convertCharset(trim(preg_replace('/[^\pL\pN-+_. ]/u', '_', Horde_String::convertCharset($name, 'UTF-8', 'UTF-8')), ' _'), 'UTF-8');
}
require_once dirname(__FILE__) . '/lib/Application.php';
try {
$message = Horde::callHook('perms_denied', array('ingo:allow_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
break 2;
try {
$message = Horde::callHook('perms_denied', array('ingo:max_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
break 2;
/* Create description. */
if (!$edit_allowed) {
- $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $entry['descriplink'] = @htmlspecialchars($name, ENT_COMPAT, 'UTF-8');
} elseif (!empty($filter['conditions'])) {
$descrip = '';
$condition_size = count($filter['conditions']) - 1;
$descrip .= "\n[stop]";
}
- $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $descrip) . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
+ $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $descrip) . @htmlspecialchars($name, ENT_COMPAT, 'UTF-8') . '</a>';
} else {
- $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '</a>';
+ $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . @htmlspecialchars($name, ENT_COMPAT, 'UTF-8') . '</a>';
}
/* Create edit link. */
static public function createFolder($folder)
{
return $GLOBALS['registry']->hasMethod('mail/createFolder')
- ? $GLOBALS['registry']->call('mail/createFolder', array('folder' => Horde_String::convertCharset($folder, $GLOBALS['registry']->getCharset(), 'UTF7-IMAP')))
+ ? $GLOBALS['registry']->call('mail/createFolder', array('folder' => Horde_String::convertCharset($folder, 'UTF-8', 'UTF7-IMAP')))
: false;
}
if ($GLOBALS['registry']->hasMethod('mail/createFolder')) {
Horde::addScriptFile('new_folder.js', 'ingo');
Horde::addInlineScript(array(
- 'IngoNewFolder.folderprompt = ' . Horde_Serialize::serialize(_("Please enter the name of the new folder:"), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset())
+ 'IngoNewFolder.folderprompt = ' . Horde_Serialize::serialize(_("Please enter the name of the new folder:"), Horde_Serialize::JSON, 'UTF-8')
));
}
}
$params['spam_char'] = $GLOBALS['conf']['spam']['char'];
}
if (!isset($params['charset'])) {
- $params['charset'] = $GLOBALS['registry']->getCharset();
+ $params['charset'] = 'UTF-8';
}
if ($script == 'Sieve') {
if (!isset($params['date_format'])) {
*/
protected function _ruleToBackend($rule)
{
- return array(Horde_String::convertCharset($rule['name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ return array(Horde_String::convertCharset($rule['name'], 'UTF-8', $this->_params['charset']),
(int)$rule['action'],
- isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null,
+ isset($rule['action-value']) ? Horde_String::convertCharset($rule['action-value'], 'UTF-8', $this->_params['charset']) : null,
isset($rule['flags']) ? (int)$rule['flags'] : null,
- isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], $GLOBALS['registry']->getCharset(), $this->_params['charset'])) : null,
+ isset($rule['conditions']) ? serialize(Horde_String::convertCharset($rule['conditions'], 'UTF-8', $this->_params['charset'])) : null,
isset($rule['combine']) ? (int)$rule['combine'] : null,
isset($rule['stop']) ? (int)$rule['stop'] : null,
isset($rule['disable']) ? (int)(!$rule['disable']) : 1);
/* Convert rules from the old format. */
$data = @unserialize($prefs->getValue('rules'));
} else {
- $data = Horde_String::convertCharset($data, $prefs->getCharset(), $GLOBALS['registry']->getCharset());
+ $data = Horde_String::convertCharset($data, $prefs->getCharset(), 'UTF-8');
}
if ($data) {
$ob->setFilterlist($data);
return $prefs->setValue('blacklist', serialize($data));
case self::ACTION_FILTERS:
- return $prefs->setValue('rules', serialize(Horde_String::convertCharset($ob->getFilterList(), $GLOBALS['registry']->getCharset(), $prefs->getCharset())), false);
+ return $prefs->setValue('rules', serialize(Horde_String::convertCharset($ob->getFilterList(), 'UTF-8', $prefs->getCharset())), false);
case self::ACTION_FORWARD:
$data = array(
$values = array(
implode("\n", $ob->getVacationAddresses()),
Horde_String::convertCharset($ob->getVacationSubject(),
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
$this->_params['charset']),
Horde_String::convertCharset($ob->getVacationReason(),
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
$this->_params['charset']),
(int)$ob->getVacationDays(),
(int)$ob->getVacationStart(),
try {
$message = Horde::callHook('perms_denied', array('ingo:allow_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(_("You are not allowed to create or edit custom rules."), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
Horde::url('filters.php', true)->redirect();
try {
$message = Horde::callHook('perms_denied', array('ingo:max_rules'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d rules."), $perms->hasAppPermission('max_rules')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
header('Location: ' . Horde::url('filters.php', true));
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
$page_title = $GLOBALS['registry']->get('name');
<table width="100%" cellspacing="0">
<tr class="control">
<td>
- <?php echo Horde::label('name', _("Rule Name:")) ?> <input class="input" id="name" name="name" size="50" value="<?php echo (isset($rule['name'])) ? @htmlspecialchars($rule['name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()) : '' ?>" />
+ <?php echo Horde::label('name', _("Rule Name:")) ?> <input class="input" id="name" name="name" size="50" value="<?php echo (isset($rule['name'])) ? @htmlspecialchars($rule['name'], ENT_COMPAT, 'UTF-8') : '' ?>" />
</td>
<td width="40" class="rightAlign">
<?php echo Horde_Help::link('ingo', 'rule-name') ?>
--- /dev/null
+<?php
+if (isset($language)) {
+ header('Content-type: text/html; charset=' . 'UTF-8');
+ header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<title><?php echo htmlspecialchars($registry->get('name')) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
// Build the template (@TODO: Use Horde_View)
$template = new Horde_Template();
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
$template->set('jonah', 'Jonah ' . $registry->getVersion() . ' (http://www.horde.org/jonah/)');
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
if (!empty($criteria['tag_id'])) {
- $template->set('channel_name', sprintf(_("Stories tagged with %s in %s"), $tag_name, @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())));
+ $template->set('channel_name', sprintf(_("Stories tagged with %s in %s"), $tag_name, @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')));
} else {
- $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset()));
+ $template->set('channel_name', @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8'));
}
-$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, $GLOBALS['registry']->getCharset()));
+$template->set('channel_desc', @htmlspecialchars($channel['channel_desc'], ENT_COMPAT, 'UTF-8'));
$template->set('channel_updated', htmlspecialchars(date('r', $channel['channel_updated'])));
$template->set('channel_official', htmlspecialchars($channel['channel_official']));
$template->set('channel_rss', htmlspecialchars(Horde_Util::addParameter(Horde::url('delivery/rss.php', true, -1), array('type' => 'rss', 'channel_id' => $channel['channel_id']))));
$template->set('channel_rss2', htmlspecialchars(Horde_Util::addParameter(Horde::url('delivery/rss.php', true, -1), array('type' => 'rss2', 'channel_id' => $channel['channel_id']))));
foreach ($stories as &$story) {
- $story['title'] = @htmlspecialchars($story['title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
- $story['description'] = @htmlspecialchars($story['description'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $story['title'] = @htmlspecialchars($story['title'], ENT_COMPAT, 'UTF-8');
+ $story['description'] = @htmlspecialchars($story['description'], ENT_COMPAT, 'UTF-8');
$story['permalink'] = htmlspecialchars($story['permalink']);
$story['published'] = htmlspecialchars(date('r', $story['published']));
if (!empty($story['body_type']) && $story['body_type'] == 'text') {
try {
$story = $this->_fetch();
} catch (Exception $e) {
- return @htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ return @htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
}
return '<span class="storyDate">'
- . @htmlspecialchars($story['updated_date'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ . @htmlspecialchars($story['updated_date'], ENT_COMPAT, 'UTF-8')
. '</span> '
- . @htmlspecialchars($story['title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ . @htmlspecialchars($story['title'], ENT_COMPAT, 'UTF-8');
}
/**
try {
$channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($this->_params['source']);
} catch (Jonah_Exception $e) {
- return @htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ return @htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
}
if (!empty($channel['channel_link'])) {
$title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank')
- . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')
. '</a>';
} else {
- $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8');
}
return $title;
try {
$channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($this->_params['source']);
} catch (Exception $e) {
- return @htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ return @htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
}
if (!empty($channel['channel_link'])) {
$title = Horde::link(htmlspecialchars($channel['channel_link']), '', '', '_blank')
- . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ . @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')
. _(" - Most read stories") . '</a>';
} else {
- $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ $title = @htmlspecialchars($channel['channel_name'], ENT_COMPAT, 'UTF-8')
. _(" - Most read stories");
}
try {
$story = $this->_fetch();
} catch (Jonah_Exception $e) {
- return htmlspecialchars($e->getMessage(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ return htmlspecialchars($e->getMessage(), ENT_COMPAT, 'UTF-8');
}
return '<span class="storyDate">'
- . htmlspecialchars($story['updated_date'], ENT_COMPAT,$GLOBALS['registry']->getCharset())
+ . htmlspecialchars($story['updated_date'], ENT_COMPAT,'UTF-8')
. '</span> '
- . htmlspecialchars($story['title'], ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ . htmlspecialchars($story['title'], ENT_COMPAT, 'UTF-8');
}
/**
/* Add the text version of the story to the base message. */
$message_text = new MIME_Part('text/plain');
- $message_text->setCharset($GLOBALS['registry']->getCharset());
+ $message_text->setCharset('UTF-8');
$message_text->setContents($message_text->replaceEOL($body_text));
$message_text->setDescription(_("Plaintext Version of Story"));
/* Add an HTML version of the story to the base message. */
$message_html = new MIME_Part('text/html', Horde_String::wrap($body_html),
- $GLOBALS['registry']->getCharset(), 'inline');
+ 'UTF-8', 'inline');
$message_html->setDescription(_("HTML Version of Story"));
/* Add the two parts as multipart/alternative. */
/* This is just a plain text story. */
$message_text = new MIME_Part('text/plain');
$message_text->setContents($message_text->replaceEOL($story['description'] . "\n\n" . $story['body']));
- $message_text->setCharset($GLOBALS['registry']->getCharset());
+ $message_text->setCharset('UTF-8');
return $message_text;
}
array_unshift($values,
(int)$info['channel_id'],
- Horde_String::convertCharset($info['channel_name'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['channel_name'], 'UTF-8', $this->_params['charset']),
(int)$info['channel_type'],
isset($info['channel_desc']) ? $info['channel_desc'] : null,
isset($info['channel_interval']) ? (int)$info['channel_interval'] : null,
array_unshift($values,
(int)$info['id'],
(int)$info['channel_id'],
- Horde_String::convertCharset($info['title'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($info['description'], $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($info['title'], 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($info['description'], 'UTF-8', $this->_params['charset']),
$info['body_type'],
- isset($info['body']) ? Horde_String::convertCharset($info['body'], $GLOBALS['registry']->getCharset(), $this->_params['charset']) : null,
+ isset($info['body']) ? Horde_String::convertCharset($info['body'], 'UTF-8', $this->_params['charset']) : null,
isset($info['url']) ? $info['url'] : null,
isset($info['published']) ? (int)$info['published'] : null,
time(),
*/
protected function _convertFromBackend($story)
{
- $story['title'] = Horde_String::convertCharset($story['title'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
- $story['description'] = Horde_String::convertCharset($story['description'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+ $story['title'] = Horde_String::convertCharset($story['title'], $this->_params['charset'], 'UTF-8');
+ $story['description'] = Horde_String::convertCharset($story['description'], $this->_params['charset'], 'UTF-8');
if (isset($story['body'])) {
- $story['body'] = Horde_String::convertCharset($story['body'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+ $story['body'] = Horde_String::convertCharset($story['body'], $this->_params['charset'], 'UTF-8');
}
if (isset($story['tags'])) {
- $story['tags'] = Horde_String::convertCharset($story['tags'], $this->_params['charset'], $GLOBALS['registry']->getCharset());
+ $story['tags'] = Horde_String::convertCharset($story['tags'], $this->_params['charset'], 'UTF-8');
}
return $story;
$mail = new Horde_Mime_Mail(array('subject' => $subject,
'to' => $recipients,
'from' => $from,
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
$mail->addHeader('User-Agent', 'Jonah ' . $GLOBALS['registry']->getVersion());
/* If a note has been provided, add it to the message as a text part. */
if (strlen($note) > 0) {
- $message_note = new MIME_Part('text/plain', null, $GLOBALS['registry']->getCharset());
+ $message_note = new MIME_Part('text/plain', null, 'UTF-8');
$message_note->setContents($message_note->replaceEOL($note));
$message_note->setDescription(_("Note"));
$mail->addMIMEPart($message_note);
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
--- /dev/null
+<?php
+if (isset($language)) {
+ header('Content-type: text/html; charset=' . 'UTF-8');
+ header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Kastalia: Copyright 2009 Andre Pawlowski -->
+<!-- Horde Project: http://www.horde.org/ | Kastalia: http://h4des.org/index.php?inhalt=kastalia -->
+<!-- Horde Licenses: http://www.horde.org/licenses/ -->
+<?php echo !empty($language) ? '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . strtr($language, '_', '-') . '" lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+
+
+<head>
+
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+ $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
break;
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.warning', array('content.raw'));
$templates[Horde_Data::IMPORT_FILE] = array(KRONOLITH_TEMPLATES . '/data/export.inc');
$calNames[] = $share->get('name');
}
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset(implode(', ', $calNames), 'UTF-8', 'utf-8'));
$data = $iCal->exportvCalendar();
$browser->downloadHeaders(_("events.ics"), 'text/calendar', false, strlen($data));
echo $data;
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
if (Horde_Util::getFormData('import_ajax')) {
$stack = $notification->notify(array('listeners' => 'status', 'raw' => true));
if ($stack) {
- Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) . '));');
+ Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, 'UTF-8') . '));');
}
Horde::addInlineScript('window.parent.$(window.name).remove();');
Horde::outputInlineScript();
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
return false;
}
$browser->downloadHeaders(($user ? $user : $cal) . '.vfb',
- 'text/calendar; charset=' . $GLOBALS['registry']->getCharset(),
+ 'text/calendar; charset=' . 'UTF-8',
true,
strlen($fb));
echo $fb;
$now = new Horde_Date(time());
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
$template->set('updated', $now->format(DATE_ATOM));
$template->set('kronolith_name', 'Kronolith');
$template->set('kronolith_version', $registry->getVersion());
$template->set('kronolith_uri', 'http://www.horde.org/kronolith/');
$template->set('kronolith_icon', Horde::url(Horde_Themes::img('kronolith.png'), true, -1));
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
-$template->set('calendar_name', @htmlspecialchars($share->get('name'), ENT_COMPAT, $GLOBALS['registry']->getCharset()));
-$template->set('calendar_desc', @htmlspecialchars($share->get('desc'), ENT_COMPAT, $GLOBALS['registry']->getCharset()), true);
-$template->set('calendar_owner', @htmlspecialchars($identity->getValue('fullname'), ENT_COMPAT, $GLOBALS['registry']->getCharset()));
-$template->set('calendar_email', @htmlspecialchars($identity->getValue('from_addr'), ENT_COMPAT, $GLOBALS['registry']->getCharset()), true);
+$template->set('calendar_name', @htmlspecialchars($share->get('name'), ENT_COMPAT, 'UTF-8'));
+$template->set('calendar_desc', @htmlspecialchars($share->get('desc'), ENT_COMPAT, 'UTF-8'), true);
+$template->set('calendar_owner', @htmlspecialchars($identity->getValue('fullname'), ENT_COMPAT, 'UTF-8'));
+$template->set('calendar_email', @htmlspecialchars($identity->getValue('from_addr'), ENT_COMPAT, 'UTF-8'), true);
$template->set('self_url', $self_url);
$twentyFour = $prefs->getValue('twentyFor');
}
$modified = new Horde_Date($modified);
/* Description. */
- $desc = @htmlspecialchars($event->description, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $desc = @htmlspecialchars($event->description, ENT_COMPAT, 'UTF-8');
if (strlen($desc)) {
$desc .= '<br /><br />';
}
$attendees[] = empty($status['name']) ? $attendee : Horde_Mime_Address::trimAddress($status['name'] . (strpos($attendee, '@') === false ? '' : ' <' . $attendee . '>'));
}
if (count($attendees)) {
- $desc .= '<br />' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $desc .= '<br />' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, 'UTF-8');
}
if (strlen($event->location)) {
- $desc .= '<br />' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $desc .= '<br />' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, 'UTF-8');
}
$desc .= '<br />' . _("Event Status:") . ' ' . Kronolith::statusToString($event->status);
- $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset());
- $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, 'UTF-8');
+ $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, 'UTF-8');
$entries[$id]['url'] = htmlspecialchars(Horde::url($event->getViewUrl(), true, -1));
$entries[$id]['modified'] = $modified->format(DATE_ATOM);
}
try {
$message = Horde::callHook('perms_denied', array('kronolith:max_events'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
}
$GLOBALS['notification']->push($message, 'horde.error', array('content.raw'));
return $result;
$share = $kronolith_shares->getShare($event->calendar);
$iCal = new Horde_Icalendar($version);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'utf-8'));
// Create a new vEvent.
$iCal->addComponent($event->toiCalendar($iCal));
$share = $kronolith_shares->getShare($calendar);
$iCal = new Horde_Icalendar($version);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'UTF-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'UTF-8'));
if (strlen($share->get('desc'))) {
- $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), $GLOBALS['registry']->getCharset(), 'UTF-8'));
+ $iCal->setAttribute('X-WR-CALDESC', Horde_String::convertCharset($share->get('desc'), 'UTF-8', 'UTF-8'));
}
foreach ($events as $dayevents) {
$tree->addNode(
$parent . $calId . $event->id,
$parent,
- htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()),
+ htmlspecialchars($event->getTitle(), ENT_COMPAT, 'UTF-8'),
1,
false,
array(
*/
public function convertToDriver($value)
{
- return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
}
/**
$vEvent->setAttribute('LAST-MODIFIED', $modified);
}
- $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), 'UTF-8', 'utf-8'));
$name = Kronolith::getUserName($this->creator);
if (!$v1) {
- $name = Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $name = Horde_String::convertCharset($name, 'UTF-8', 'utf-8');
}
$vEvent->setAttribute('ORGANIZER',
'mailto:' . Kronolith::getUserEmail($this->creator),
array('CN' => $name));
if (!$this->private || $this->creator == $GLOBALS['registry']->getAuth()) {
if (!empty($this->description)) {
- $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, 'UTF-8', 'utf-8'));
}
// Tags
$tags = implode(', ', $tags);
}
if (!empty($tags)) {
- $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $vEvent->setAttribute('CATEGORIES', $v1 ? $tags : Horde_String::convertCharset($tags, 'UTF-8', 'utf-8'));
}
// Location
if (!empty($this->location)) {
- $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $vEvent->setAttribute('LOCATION', $v1 ? $this->location : Horde_String::convertCharset($this->location, 'UTF-8', 'utf-8'));
}
if ($this->geoLocation) {
$vEvent->setAttribute('GEO', array('latitude' => $this->geoLocation['lat'], 'longitude' => $this->geoLocation['lon']));
}
} else {
if (!empty($status['name'])) {
- $params['CN'] = Horde_String::convertCharset($status['name'], $GLOBALS['registry']->getCharset(), 'utf-8');
+ $params['CN'] = Horde_String::convertCharset($status['name'], 'UTF-8', 'utf-8');
}
if (!empty($email)) {
$email = 'mailto:' . $email;
*/
public function fromASAppointment(Horde_ActiveSync_Message_Appointment $message)
{
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
/* New event? */
if ($this->id === null) {
*/
public function toASAppointment()
{
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$message = new Horde_ActiveSync_Message_Appointment(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger')));
$message->setSubject(Horde_String::convertCharset($this->getTitle(), $charset, 'utf-8'));
// Convert IDN hosts to ASCII.
if (function_exists('idn_to_ascii')) {
$old_error = error_reporting(0);
- $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8'));
+ $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], 'UTF-8', 'UTF-8'));
error_reporting($old_error);
} elseif (Horde_Mime::is8bit($url['host'])) {
//throw new Kronolith_Exception(_("Invalid character in URL."));
'',
array('style' => $this->getCSSColors(false)));
}
- $link .= @htmlspecialchars($event_title, ENT_QUOTES, $GLOBALS['registry']->getCharset());
+ $link .= @htmlspecialchars($event_title, ENT_QUOTES, 'UTF-8');
if ($read_permission && $view_url) {
$link .= '</a>';
}
Horde_Core_Ui_JsCalendar::init(array('short_weekdays' => true));
if (isset($GLOBALS['language'])) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
// Maps
$code['conf']['maps'] = $GLOBALS['conf']['maps'];
- return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, $registry->getCharset()) . ';');
+ return array('var Kronolith = ' . Horde_Serialize::serialize($code, Horde_Serialize::JSON, 'UTF-8') . ';');
}
/**
$userName = $identity->getName();
$mail = new Horde_Mime_Mail(
array('from' => $identity->getDefaultFromAddress(true),
- 'charset' => $GLOBALS['registry']->getCharset())
+ 'charset' => 'UTF-8')
);
$mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
}
}
$mail->addHeader('Subject', _("Ownership assignment"));
$mail->addHeader('To', $to);
- $mail->setBody($message, $GLOBALS['registry']->getCharset());
+ $mail->setBody($message, 'UTF-8');
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
$share->get('name'));
}
$mail->addHeader('To', $to);
- $mail->setBody($message, $GLOBALS['registry']->getCharset());
+ $mail->setBody($message, 'UTF-8');
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
$share->get('name'));
}
$mail->addHeader('To', $groupOb->getName() . ' <' . $groupOb->data['email'] . '>');
- $mail->setBody($message, $GLOBALS['registry']->getCharset());
+ $mail->setBody($message, 'UTF-8');
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
: $newAttendeeParsedPart->personal;
try {
- $newAttendeeParsedPartNew = Horde_Mime::encodeAddress(Horde_Mime_Address::writeAddress($newAttendeeParsedPart->mailbox, $newAttendeeParsedPart->host, $name), $GLOBALS['registry']->getCharset());
+ $newAttendeeParsedPartNew = Horde_Mime::encodeAddress(Horde_Mime_Address::writeAddress($newAttendeeParsedPart->mailbox, $newAttendeeParsedPart->host, $name), 'UTF-8');
$newAttendeeParsedPartValidated = $parser->parseAddressList($newAttendeeParsedPartNew, array(
'default_domain' => null
));
/* Build the iCalendar data */
$iCal = new Horde_Icalendar();
$iCal->setAttribute('METHOD', $method);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $registry->getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'utf-8'));
$vevent = $event->toiCalendar($iCal);
if ($action == self::ITIP_CANCEL && !empty($instance)) {
// Recurring event instance deletion, need to specify the
$ics->setContents($iCal->exportvCalendar());
$ics->setName($filename);
$ics->setContentTypeParameter('METHOD', $method);
- $ics->setCharset($registry->getCharset());
+ $ics->setCharset('UTF-8');
$multipart = new Horde_Mime_Part();
$multipart->setType('multipart/alternative');
$bodyText = new Horde_Mime_Part();
$bodyText->setType('text/plain');
- $bodyText->setCharset($registry->getCharset());
+ $bodyText->setCharset('UTF-8');
$bodyText->setContents($view->render('notification.plain.php'));
$multipart->addPart($bodyText);
$bodyHtml = new Horde_Mime_Part();
$bodyHtml->setType('text/html');
- $bodyHtml->setCharset($registry->getCharset());
+ $bodyHtml->setCharset('UTF-8');
$bodyHtml->setContents($view->render('notification.html.php'));
$multipart->addPart($bodyHtml);
$multipart->addPart($ics);
$mail = new Horde_Mime_Mail(array('subject' => $view->subject,
'to' => $recipient,
'from' => $ident->getDefaultFromAddress(true),
- 'charset' => $registry->getCharset()));
+ 'charset' => 'UTF-8'));
$mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
$mail->setBasePart($multipart);
$mime_mail = new Horde_Mime_Mail(array('subject' => $subject . ' ' . $event->title,
'to' => implode(',', $df_recipients),
'from' => $identity->getDefaultFromAddress(true),
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
$mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
- $mime_mail->setBody($message, $GLOBALS['registry']->getCharset(), true);
+ $mime_mail->setBody($message, 'UTF-8', true);
Horde::logMessage(sprintf('Sending event notifications for %s to %s', $event->title, implode(', ', $df_recipients)), 'DEBUG');
$mime_mail->send($GLOBALS['injector']->getInstance('Horde_Mail'), false, false);
}
$iCal->setAttribute(
'X-WR-CALNAME',
Horde_String::convertCharset($share->get('name'),
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
'utf-8'));
} catch (Exception $e) {
}
$GLOBALS['browser']->downloadHeaders(
$event->getTitle() . '.ics',
- 'text/calendar; charset=' . $GLOBALS['registry']->getCharset(),
+ 'text/calendar; charset=' . 'UTF-8',
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, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
$url->redirect();
$runtime = new Horde_Date($runtime);
$default_timezone = date_default_timezone_get();
$kronolith_driver = Kronolith::getDriver();
- $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/agenda', 'encoding' => $GLOBALS['registry']->getCharset()));
+ $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/agenda', 'encoding' => 'UTF-8'));
new Horde_View_Helper_Text($view);
// Loop through the users and generate an agenda for them
array('subject' => sprintf(_("Your daily agenda for %s"), $view->date),
'to' => $email,
'from' => $GLOBALS['conf']['reminder']['from_addr'],
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
$mime_mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
try {
$mime_mail->addRecipients($email);
$multipart->setType('multipart/alternative');
$bodyText = new Horde_Mime_Part();
$bodyText->setType('text/plain');
- $bodyText->setCharset($GLOBALS['registry']->getCharset());
+ $bodyText->setCharset('UTF-8');
$bodyText->setContents($view->render('notification.plain.php'));
$multipart->addPart($bodyText);
$bodyHtml = new Horde_Mime_Part();
$bodyHtml->setType('text/html');
- $bodyHtml->setCharset($GLOBALS['registry']->getCharset());
+ $bodyHtml->setCharset('UTF-8');
$bodyHtml->setContents($view->render('notification.html.php'));
$multipart->addPart($bodyHtml);
$mime_mail->setBasePart($multipart);
Horde::addScriptFile('stripe.js', 'horde');
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
* JavaScript variables for the traditional interface.
*/
-$charset = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
$currentDate = Kronolith::currentDate();
/* Variables used in core javascript files. */
<!-- owner -->
<tr>
<td class="rightAlign"><strong><?php echo _("Owner") ?> </strong></td>
- <td><?php echo @htmlspecialchars($owner, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?> </td>
+ <td><?php echo @htmlspecialchars($owner, ENT_COMPAT, 'UTF-8') ?> </td>
</tr>
<?php endif; ?>
<?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, $GLOBALS['registry']->getCharset()) ?></td>
+ <td class="nowrap"><?php echo $created->strftime($dateFormat) . ' ' . $created->format($timeFormat) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, 'UTF-8') ?></td>
</tr>
<?php endif; ?>
<?php if (isset($modified)): ?>
<tr>
<td class="nowrap rightAlign"><strong><?php echo _("Last Modified") ?></strong> </td>
- <td class="nowrap"><?php echo $modified->strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+ <td class="nowrap"><?php echo $modified->strftime($dateFormat) . ' ' . $modified->format($timeFormat) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, 'UTF-8') ?></td>
</tr>
<?php endif; ?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
);
if ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
$GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
}
$num_memos = Mnemo::countMemos();
foreach ($next_step as $row) {
if ($max_memos !== true && $num_memos >= $max_memos) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
}
' VALUES (?, ?, ?, ?, ?, ?)';
$values = array($this->_notepad,
$noteId,
- Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($body, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($uid, $GLOBALS['registry']->getCharset(), $this->_params['charset']));
+ Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($body, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($uid, 'UTF-8', $this->_params['charset']));
/* Log the query at a DEBUG log level. */
Horde::logMessage(sprintf('Mnemo_Driver_sql::add(): %s', $query), 'DEBUG');
$query = 'UPDATE ' . $this->_params['table'] .
' SET memo_desc = ?, memo_body = ?';
- $values = array(Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($body, $GLOBALS['registry']->getCharset(), $this->_params['charset']));
+ $values = array(Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($body, 'UTF-8', $this->_params['charset']));
// Don't change the category if it isn't provided.
if (!is_null($category)) {
$query .= ', memo_category = ?';
- $values[] = Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ $values[] = Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']);
}
$query .= ' WHERE memo_owner = ? AND memo_id = ?';
array_push($values, $this->_notepad, $noteId);
/* Check permissions. */
if ($injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') !== true &&
$injector->getInstance('Horde_Perms')->hasAppPermission('max_notes') <= Mnemo::countMemos()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, $registry->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d notes."), $injector->getInstance('Horde_Perms')->hasAppPermission('max_notes')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('mnemo:max_notes'), 'horde', $message);
}
/* Let's assume that the note content can be converted to ISO-8859-1 if this
* is the current language's charset, as long as we don't have UTF-8 support
* in File_PDF. */
-if ($GLOBALS['registry']->getCharset(true) == 'ISO-8859-1') {
- $note = String::convertCharset($note, $GLOBALS['registry']->getCharset(), 'ISO-8859-1');
+if ($GLOBALS['registry']->getLanguageCharset() == 'ISO-8859-1') {
+ $note = String::convertCharset($note, 'UTF-8', 'ISO-8859-1');
}
/* Set up the PDF object. */
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
<?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, $GLOBALS['registry']->getCharset()) ?></td>
+ <td><?php echo strftime($prefs->getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, 'UTF-8') ?></td>
</tr>
<?php endif; ?>
<?php if (isset($modified)): ?>
<tr>
<td align="right"><strong><?php echo _("Last Modified") ?></strong> </td>
- <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+ <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, 'UTF-8') ?></td>
</tr>
<?php endif; ?>
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.warning', array('content.raw'));
$templates[Horde_Data::IMPORT_FILE] = array(NAG_TEMPLATES . '/data/export.inc');
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
$share = $GLOBALS['nag_shares']->getShare($tasklist);
$iCal = new Horde_iCalendar($version);
- $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), 'UTF-8', 'utf-8'));
$tasks->reset();
while ($task = $tasks->each()) {
$owner,
$assignee,
$taskId,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($uid, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($uid, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
(int)$start,
(int)$due,
(int)$priority,
number_format($estimate, 2),
(int)$completed,
- Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']),
(int)$alarm,
- serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])),
+ serialize(Horde_String::convertCharset($methods, 'UTF-8', $this->_params['charset'])),
(int)$private,
$parent);
$this->_params['table']);
$values = array($owner,
$assignee,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($name, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($desc, 'UTF-8', $this->_params['charset']),
(int)$start,
(int)$due,
(int)$priority,
number_format($estimate, 2),
(int)$completed,
(int)$completed_date,
- Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($category, 'UTF-8', $this->_params['charset']),
(int)$alarm,
- serialize(Horde_String::convertCharset($methods, $GLOBALS['registry']->getCharset(), $this->_params['charset'])),
+ serialize(Horde_String::convertCharset($methods, 'UTF-8', $this->_params['charset'])),
$parent,
(int)$private,
$this->_tasklist,
if ($vars->get('task_id') == $task->id) {
continue;
}
- $task_enums[htmlspecialchars($task->id)] = str_repeat(' ', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $task_enums[htmlspecialchars($task->id)] = str_repeat(' ', $task->indent * 4) . htmlentities($task->name, ENT_COMPAT, 'UTF-8');
}
$users = array();
$share = $GLOBALS['nag_shares']->getShare($tasklist);
'mail/compose',
array(array('to' => $email))))
. @htmlspecialchars($fullname . ' <' . $email . '>',
- ENT_COMPAT, $GLOBALS['registry']->getCharset())
+ ENT_COMPAT, 'UTF-8')
. '</a>';
}
- return @htmlspecialchars($fullname, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ return @htmlspecialchars($fullname, ENT_COMPAT, 'UTF-8');
}
/**
break;
}
- $mail->addHeader('Subject', $subject . ' ' . $task->name, $GLOBALS['registry']->getCharset());
+ $mail->addHeader('Subject', $subject . ' ' . $task->name, 'UTF-8');
foreach ($twentyFour as $tf => $dateFormat) {
foreach ($dateFormat as $df => $df_recipients) {
$message .= "\n\n" . _("Task description:") . "\n\n" . $task->desc;
}
- $mail->setBody($message, $GLOBALS['registry']->getCharset());
+ $mail->setBody($message, 'UTF-8');
$mail->clearRecipients();
$mail->addRecipients($df_recipients);
}
if (!empty($this->name)) {
- $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $vTodo->setAttribute('SUMMARY', $v1 ? $this->name : Horde_String::convertCharset($this->name, 'UTF-8', 'utf-8'));
}
if (!empty($this->desc)) {
- $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $vTodo->setAttribute('DESCRIPTION', $v1 ? $this->desc : Horde_String::convertCharset($this->desc, 'UTF-8', 'utf-8'));
}
if (isset($this->priority)) {
}
if (!empty($this->category)) {
- $vTodo->setAttribute('CATEGORIES', $v1 ? $this->category : Horde_String::convertCharset($this->category, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $vTodo->setAttribute('CATEGORIES', $v1 ? $this->category : Horde_String::convertCharset($this->category, 'UTF-8', 'utf-8'));
}
/* Get the task's history. */
$message = new Horde_ActiveSync_Message_Task();
/* Notes and Title */
- $message->setBody(Horde_String::convertCharset($this->desc, $GLOBALS['registry']->getCharset(), 'utf-8'));
- $message->setSubject(Horde_String::convertCharset($this->name, $GLOBALS['registry']->getCharset(), 'utf-8'));
+ $message->setBody(Horde_String::convertCharset($this->desc, 'UTF-8', 'utf-8'));
+ $message->setSubject(Horde_String::convertCharset($this->name, 'UTF-8', 'utf-8'));
/* Completion */
if ($this->completed) {
function fromASTask(Horde_ActiveSync_Message_Task $message)
{
/* Notes and Title */
- $this->desc = Horde_String::convertCharset($message->getBody(), 'utf-8', $GLOBALS['registry']->getCharset());
- $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', $GLOBALS['registry']->getCharset());
+ $this->desc = Horde_String::convertCharset($message->getBody(), 'utf-8', 'UTF-8');
+ $this->name = Horde_String::convertCharset($message->getSubject(), 'utf-8', 'UTF-8');
/* Completion */
if ($this->completed = $message->getComplete()) {
try {
$message = Horde::callHook('perms_denied', array('nag:max_tasks'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d tasks."), $perms->hasAppPermission('max_tasks')), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
Horde::url('list.php', true)->redirect();
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
<?php if (isset($created)): ?>
<tr>
<td class="rightAlign"><strong><?php echo _("Created") ?></strong></td>
- <td><?php echo strftime($prefs->getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+ <td><?php echo strftime($prefs->getValue('date_format'), $created) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $created) . ' ' . @htmlspecialchars($createdby, ENT_COMPAT, 'UTF-8') ?></td>
</tr>
<?php endif; ?>
<?php if (isset($modified)): ?>
<tr>
<td class="rightAlign"><strong><?php echo _("Last Modified") ?></strong></td>
- <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+ <td><?php echo strftime($prefs->getValue('date_format'), $modified) . ' ' . date($prefs->getValue('twentyFour') ? 'G:i' : 'g:i a', $modified) . ' ' . @htmlspecialchars($modifiedby, ENT_COMPAT, 'UTF-8') ?></td>
</tr>
<?php endif; ?>
--- /dev/null
+<?php
+/**
+ * News
+ *
+ * $Id: mail.php 1174 2009-01-19 15:11:03Z duck $
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ * @package News
+ */
+
+require_once dirname(__FILE__) . '/lib/base.php';
+
+$id = Horde_Util::getFormData('id');
+$row = $news->get($id);
+if ($row instanceof PEAR_Error) {
+ $notification->push($row);
+ Horde::url('browse.php')->redirect();
+}
+
+/* Error handler */
+function _error($msg)
+{
+ $GLOBALS['notification']->push($msg, 'horde.error');
+ News::getUrlFor('news', $GLOBALS['id'])->redirect();
+}
+
+if (!$registry->isAuthenticated()) {
+ _error(_("Only authenticated users can send mails."));
+}
+
+$to = Horde_Util::getFormData('email');
+if (empty($to)) {
+ _error(_("No mail entered."));
+ exit;
+}
+
+$from = $prefs->getValue('from_addr');
+if (empty($from)) {
+ _error(_("You have no email set."));
+ exit;
+}
+
+$body = sprintf(_("%s would you like to invite you to read the news\n Title: %s\n\n Published: %s \nLink: %s"),
+ $GLOBALS['registry']->getAuth(),
+ $row['title'],
+ $row['publish'],
+ News::getUrlFor('news', $id, true, -1));
+
+$mail = new Horde_Mime_Mail(array('subject' => $row['title'], 'body' => $body, 'to' => $to, 'from' => $from, 'charset' => 'UTF-8'));
+try {
+ $mail->send($injector->getInstance('Horde_Mail'));
+ $notification->push(sprintf(_("News succesfully send to %s"), $to), 'horde.success');
+} catch (Horde_Mime_Exception $e) {
+ $notification->push($e);
+}
+
+News::getUrlFor('news', $id)->redirect();
--- /dev/null
+<?php
+/**
+ * News
+ *
+ * $Id: pdf.php 1191 2009-01-21 16:45:21Z duck $
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ * @package News
+ */
+
+$no_compress = true;
+require_once dirname(__FILE__) . '/lib/base.php';
+
+$id = Horde_Util::getFormData('id');
+$row = $news->get($id);
+
+// Check if the news exists
+if ($row instanceof PEAR_Error) {
+ $notification->push($row);
+ Horde::url('browse.php')->redirect();
+}
+
+// Set up the PDF object.
+$pdf = new Horde_Pdf_Writer();
+
+$pdf->setInfo('title', $row['title']);
+$pdf->setInfo('author', $row['user']);
+$pdf->setInfo('CreationDate', 'D:' . date('Ymdhis'));
+
+$pdf->open();
+$pdf->addPage();
+$pdf->setAutoPageBreak(true);
+$pdf->setFont('Arial', '', 12);
+
+if ($row['picture']) {
+ $file = $conf['vfs']['params']['vfsroot'] . '/'
+ . News::VFS_PATH . '/images/news/big/'
+ . $id . '.' . $conf['images']['image_type'];
+ try {
+ $pdf->image($file, 120, 20);
+ } catch (Horde_Pdf_Exception $e) {
+ Horde::logMessage($e, 'INFO');
+ }
+}
+
+$pdf->setFillColor('rgb', 200/255, 220/255, 255/255);
+$pdf->cell(0, 6, $row['title'], 0, 1, 'L', 1);
+$pdf->newLine(4);
+
+$pdf->write(12, _("On") . ': ' . News::dateFormat($row['publish']) . "\n");
+$pdf->write(12, _("Link") . ': ' . News::getUrlFor('news', $id, true) . "\n\n", News::getUrlFor('news', $id, true));
+$pdf->multiCell(0, 12, Horde_String::convertCharset(strip_tags($row['content']), 'UTF-8', 'UTF-8'));
+
+$browser->downloadHeaders($id . '.pdf', 'application/pdf');
+echo $pdf->getOutput();
--- /dev/null
+<?php
+/**
+ * $Id: comments.php 1263 2009-02-01 23:25:56Z duck $
+ *
+ * Copyright 2007 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ */
+
+$news_authentication = 'none';
+require_once dirname(__FILE__) . '/../lib/base.php';
+
+$cache_key = 'news_rss_comments';
+$rss = $cache->get($cache_key, $conf['cache']['default_lifetime']);
+if (!$rss) {
+ $list = News::getLastComments(50);
+ $title = _("Last comments");
+
+ $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
+<rss version="2.0">
+<channel>
+ <title>' . htmlspecialchars($title) . '</title>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
+ <lastBuildDate>' . date('r') . '</lastBuildDate>
+ <description>' . htmlspecialchars($title) . '</description>
+ <link>' . Horde::url('index.php', true, -1) . '</link>
+ <generator>' . htmlspecialchars($registry->get('name')) . '</generator>';
+
+ foreach ($list as $comment) {
+ $rss .= '
+ <item>
+ <title>' . htmlspecialchars($comment['message_subject']) . ' </title>
+ <link>' . $comment['read_url'] . '</link>
+ <guid isPermaLink="true">' . $comment['read_url'] . '</guid>
+ <pubDate>' . date('r', strtotime($comment['message_date'])) . '</pubDate>
+ <description><![CDATA[' . $comment['message_author'] . ': ' . strip_tags($comment['body']) . ']]></description>
+ </item>';
+ }
+
+ $rss .= '
+</channel>
+</rss>';
+
+ $cache->set($cache_key, $rss);
+}
+
+header('Content-type: text/xml; charset=' . 'UTF-8');
+echo $rss;
--- /dev/null
+<?php
+/**
+ * $Id: index.php 183 2008-01-06 17:39:50Z duck $
+ *
+ * Copyright 2007 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ */
+
+$news_authentication = 'none';
+require_once dirname(__FILE__) . '/../lib/base.php';
+
+// Show a specific user?
+$cache_key = 'news_rss_index';
+
+$rss = $cache->get($cache_key, $conf['cache']['default_lifetime']);
+if (!$rss) {
+
+ $title = $registry->get('name', 'horde');
+
+ $read_url = Horde::url('read.php', true, -1);
+ $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
+ <rss version="2.0">
+ <channel>
+ <title>' . htmlspecialchars($title) . '</title>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
+ <lastBuildDate>' . date('r') . '</lastBuildDate>
+ <description>' . htmlspecialchars($title) . '</description>
+ <link>' . Horde::url('index.php', true, -1) . '</link>
+ <generator>' . htmlspecialchars($registry->get('name')) . '</generator>';
+
+ $rss .= '
+ <item>
+ <title>' . _("Last news") . ' </title>
+ <link>' . Horde::url('rss/news.php', true, -1) . '</link>
+ </item>';
+
+ $rss .= '
+ <item>
+ <title>' . _("Last comments") . ' </title>
+ <link>' . Horde::url('rss/comments.php', true, -1) . '</link>
+ </item>';
+
+ $rss .= '
+ </channel>
+ </rss>';
+
+ $cache->set($cache_key, $rss);
+}
+
+header('Content-type: text/xml');
+echo $rss;
--- /dev/null
+<?php
+/**
+ * $Id: news.php 1263 2009-02-01 23:25:56Z duck $
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Duck <duck@obala.net>
+ * @author McLion <mclion@obala.net>
+ */
+
+$news_authentication = 'none';
+require_once dirname(__FILE__) . '/../lib/base.php';
+
+$cache_key = 'news_rss_news';
+$rss = $cache->get($cache_key, $conf['cache']['default_lifetime']);
+if (empty($rss)) {
+
+ /* query preparation */
+ $query = 'SELECT n.id, publish, n.user, n.source, n.sourcelink, ' .
+ 'n.category1, n.category2, n.comments, n.picture, n.chars, nl.content, ' .
+ 'nl.title, nl.abbreviation ' .
+ 'FROM ' . $news->prefix . ' AS n, ' . $news->prefix . '_body AS nl ' .
+ 'WHERE n.status="' . News::CONFIRMED . '" AND n.publish<=NOW() ' .
+ 'AND nl.lang="' . $registry->preferredLang() . '" AND n.id=nl.id ORDER BY publish DESC';
+ $rssbody = '';
+ $query = $news->db->modifyLimitQuery($query, 0, 10);
+ $list = $news->db->getAssoc($query, true, array(), DB_FETCHMODE_ASSOC);
+ $categories = $news_cat->getCategories(false);
+ $title = sprintf(_("Last news"), $registry->get('name', 'horde'));
+
+ $lastnewstime = 0;
+ foreach ($list as $news_id => $news) {
+ $news_link = News::getUrlFor('news', $news_id, true);
+ $rssbody .= '
+ <item>
+ <enclosure url="http://' . $_SERVER['SERVER_NAME'] . News::getImageUrl($news_id) . '" type="image/jpg" />
+ <title>' . htmlspecialchars($news['title']) . ' </title>
+ <dc:creator>' . htmlspecialchars($news['user']). '</dc:creator>
+ <link>' . $news_link . '</link>
+ <guid isPermaLink="true">' . $news_link . '</guid>
+ <comments>' . $news_link . '#comments</comments>
+ <description><![CDATA[' . trim(substr(htmlspecialchars(strip_tags($news['content'])), 0, 512)) . ']]></description>
+ <pubDate>' . date('r', strtotime($news['publish'])) . '</pubDate>
+ <category><![CDATA[' . $categories[$news['category1']]['category_name'] . ']]></category>
+ </item>';
+
+ if (strtotime($news['publish']) > $lastnewstime) {
+ $lastnewstime = strtotime($news['publish']);
+ }
+ }
+
+ // Wee need the last published news time
+ $rssheader = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
+<rss version="2.0"
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
+ xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/" >
+<channel>
+ <title>' . htmlspecialchars($title) . '</title>
+ <language>' . str_replace('_', '-', strtolower($registry->preferredLang())) . '</language>
+ <lastBuildDate>' . date('r', $lastnewstime) . '</lastBuildDate>
+ <description>' . htmlspecialchars($title) . '</description>
+ <link>' . Horde::url('index.php', true, -1) . '</link>
+ <generator>' . htmlspecialchars($registry->get('name')) . '</generator>';
+
+ $rssfooter = '
+</channel>
+</rss>';
+
+ // build rss
+ $rss = $rssheader . $rssbody . $rssfooter;
+
+ $cache->set($cache_key, $rss);
+}
+
+header('Content-type: text/xml; charset=utf-8');
+echo $rss;
--- /dev/null
+<?php
+if (isset($language)) {
+ header('Content-type: text/html; charset=' . 'UTF-8');
+ header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- news: Copyright 2004-2010 The Horde Project. news is under a Horde license. -->
+<!-- Horde Project: http://www.horde.org/ | news: http://www.horde.org/horde/ -->
+<!-- Horde Licenses: http://www.horde.org/licenses/ -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+ $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<link rel="alternate" title="<?php echo _("Last news") ?>" href="<?php echo Horde::url('rss/news.php', true, -1) ?>" type="application/rss+xml" />
+<link rel="alternate" title="<?php echo _("Last comments") ?>" href="<?php echo Horde::url('rss/comments.php', true, -1) ?>" type="application/rss+xml" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+</head>
+
+<body>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
var ajax_url = '<?php echo Horde::getServiceLink('ajax', 'shout') ?>';
var curmenu = null;
var menuInfo = $H();
-var menuActions = $H(<?php echo Horde_Serialize::serialize(Shout::getMenuActions(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
-var destinations = $H(<?php echo Horde_Serialize::serialize($destinations, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
-var conferences = $H(<?php echo Horde_Serialize::serialize($conferences, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
-var recordings = $H(<?php echo Horde_Serialize::serialize($recordings, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()); ?>);
+var menuActions = $H(<?php echo Horde_Serialize::serialize(Shout::getMenuActions(), Horde_Serialize::JSON, 'UTF-8'); ?>);
+var destinations = $H(<?php echo Horde_Serialize::serialize($destinations, Horde_Serialize::JSON, 'UTF-8'); ?>);
+var conferences = $H(<?php echo Horde_Serialize::serialize($conferences, Horde_Serialize::JSON, 'UTF-8'); ?>);
+var recordings = $H(<?php echo Horde_Serialize::serialize($recordings, Horde_Serialize::JSON, 'UTF-8'); ?>);
function empty(p)
{
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
--- /dev/null
+<?php
+if (isset($language)) {
+ header('Content-type: text/html; charset=' . 'UTF-8');
+ header('Vary: Accept-Language');
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<!-- Skoli: Copyright 2004-2008 The Horde Project. Skoli is under a Horde license. -->
+<!-- Horde Project: http://www.horde.org/ | Skoli: http://www.horde.org/horde/ -->
+<!-- Horde Licenses: http://www.horde.org/licenses/ -->
+<?php echo !empty($language) ? '<html lang="' . strtr($language, '_', '-') . '">' : '<html>' ?>
+<head>
+<?php
+
+$page_title = $registry->get('name');
+if (!empty($title)) {
+ $page_title .= ' :: ' . $title;
+}
+
+Horde::outputMetaTags();
+Horde::includeScriptFiles();
+
+$bc = $prefs->getValue('show_panel')
+ ? 'rightPanel'
+ : '';
+
+?>
+<title><?php echo htmlspecialchars($page_title) ?></title>
+<link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
+<?php Horde_Themes::includeStylesheetFiles() ?>
+<link href="<?php echo Horde::url('themes/categoryCSS.php') ?>" rel="stylesheet" type="text/css" />
+</head>
+
+<body<?php if ($bc) echo ' class="' . $bc . '"' ?>>
/* Check permissions. */
if (Trean::hasPermission('max_bookmarks') !== true &&
Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
}
/* Check permissions. */
if (Trean::hasPermission('max_folders') !== true &&
Trean::hasPermission('max_folders') <= Trean::countFolders()) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
}
$folders_exceeded = Trean::hasPermission('max_folders') !== true &&
Trean::hasPermission('max_folders') <= Trean::countFolders();
if ($folders_exceeded) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
}
$bookmarks_exceeded = Trean::hasPermission('max_bookmarks') !== true &&
Trean::hasPermission('max_bookmarks') <= $trean_shares->countBookmarks();
if ($bookmarks_exceeded) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
}
continue;
}
if ($max_folders !== true && $num_folders >= $max_folders) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d folders."), Trean::hasPermission('max_folders')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_folders'), 'horde', $message);
}
$line, $temp)) {
/* A bookmark. */
if ($max_bookmarks !== true && $num_bookmarks >= $max_bookmarks) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d bookmarks."), Trean::hasPermission('max_bookmarks')), ENT_COMPAT, 'UTF-8');
if (!empty($conf['hooks']['permsdenied'])) {
$message = Horde::callHook('_perms_hook_denied', array('trean:max_bookmarks'), 'horde', $message);
}
return $update;
}
$result = $update->execute(array($this->folder,
- Horde_String::convertCharset($this->url, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->title, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->url, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->title, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->description, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
$this->clicks,
$this->rating,
$this->id));
$result = $insert->execute(array($bookmark_id,
$this->folder,
- Horde_String::convertCharset($this->url, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->title, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
- Horde_String::convertCharset($this->description, $GLOBALS['registry']->getCharset(), $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->url, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->title, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
+ Horde_String::convertCharset($this->description, 'UTF-8', $GLOBALS['conf']['sql']['charset']),
$this->clicks,
$this->rating,
));
$cache_key = 'trean_rss_' . Horde_Auth::getAuth() . '_' . ($folderId === null ? 'all' : $folderId);
$rss = $cache->get($cache_key, $conf['cache']['default_lifetime']);
if (!$rss) {
- $rss = '<?xml version="1.0" encoding="' . $GLOBALS['registry']->getCharset() . '" ?>
+ $rss = '<?xml version="1.0" encoding="' . 'UTF-8' . '" ?>
<rss version="2.0">
<channel>
<title>' . htmlspecialchars($folderId == null ? $registry->get('name') : $folder->get('name')) . '</title>
<language>' . $registry->preferredLang() . '</language>
- <charset>' . $GLOBALS['registry']->getCharset() . '</charset>
+ <charset>' . 'UTF-8' . '</charset>
<lastBuildDate>' . date('Y-m-d H:i:s') . '</lastBuildDate>
<image>
<url>http://' . $_SERVER['SERVER_NAME'] . $registry->get('webroot') . '/themes/graphics/favicon.ico</url>
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
$url = $url
// 'type' => 'prefs',
// 'params' => array(
// 'name' => 'prefs',
-// 'charset' => $GLOBALS['registry']->getCharset()
+// 'charset' => 'UTF-8'
// ),
// 'map' => array(
// '__key' => 'id',
} elseif ($attributes[$field]['type'] == 'datetime') {
$row[$field] = strftime('%Y-%m-%d %R', $attribute);
} else {
- $row[$field] = Horde_String::convertCharset($attribute, $GLOBALS['registry']->getCharset(), $params['charset']);
+ $row[$field] = Horde_String::convertCharset($attribute, 'UTF-8', $params['charset']);
}
}
}
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $driver->title), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $driver->title), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
$error = true;
$charsets[$charset] = $charset;
}
}
- $my_charset = $GLOBALS['registry']->getCharset(true);
+ $my_charset = $GLOBALS['registry']->getLanguageCharset();
}
foreach ($templates[$next_step] as $template) {
$vcard = new Horde_Icalendar_Vcard($version);
$formattedname = false;
$charset = ($version == '2.1')
- ? array('CHARSET' => $GLOBALS['registry']->getCharset())
+ ? array('CHARSET' => 'UTF-8')
: array();
foreach ($hash as $key => $val) {
}
if ($version != '2.1') {
- $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
}
switch ($key) {
);
$val = implode(';', $a);
if ($version != '2.1') {
- $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+ $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
}
if (!$fields || isset($fields['N'])) {
$vcard->setAttribute('N', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $a);
$val = '';
}
if ($version != '2.1') {
- $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
}
$vcard->setAttribute('FN', $val, Horde_Mime::is8bit($val) ? $charset : array());
}
if (count($org) && (!$fields || isset($fields['ORG']))) {
$val = implode(';', $org);
if ($version != '2.1') {
- $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
- $org = Horde_String::convertCharset($org, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+ $org = Horde_String::convertCharset($org, 'UTF-8', 'utf-8');
}
$vcard->setAttribute('ORG', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $org);
}
if ($version == '2.1') {
$params = array();
if (Horde_Mime::is8bit($val)) {
- $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+ $params['CHARSET'] = 'UTF-8';
}
} else {
$params = array('TYPE' => '');
- $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+ $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
}
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
if ($version == '2.1') {
$params = array('HOME' => null);
if (Horde_Mime::is8bit($val)) {
- $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+ $params['CHARSET'] = 'UTF-8';
}
} else {
$params = array('TYPE' => 'HOME');
- $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+ $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
}
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
if ($version == '2.1') {
$params = array('WORK' => null);
if (Horde_Mime::is8bit($val)) {
- $params['CHARSET'] = $GLOBALS['registry']->getCharset();
+ $params['CHARSET'] = 'UTF-8';
}
} else {
$params = array('TYPE' => 'WORK');
- $val = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), 'utf-8');
- $a = Horde_String::convertCharset($a, $GLOBALS['registry']->getCharset(), 'utf-8');
+ $val = Horde_String::convertCharset($val, 'UTF-8', 'utf-8');
+ $a = Horde_String::convertCharset($a, 'UTF-8', 'utf-8');
}
$vcard->setAttribute('ADR', $val, $params, true, $a);
}
public function toASContact(Turba_Object $object)
{
$message = new Horde_ActiveSync_Message_Contact(array('logger' => $GLOBALS['injector']->getInstance('Horde_Log_Logger')));
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$hash = $object->getAttributes();
foreach ($hash as $field => $value) {
switch ($field) {
public function fromASContact($message)
{
$hash = array();
- $charset = $GLOBALS['registry']->getCharset();
+ $charset = 'UTF-8';
$formattedname = false;
$textMap = array(
if (is_array($ids)) {
$results = array();
foreach ($ids as $d) {
- $res = @ldap_read($this->_ds, Horde_String::convertCharset($d, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr);
+ $res = @ldap_read($this->_ds, Horde_String::convertCharset($d, 'UTF-8', $this->_params['charset']), $filter, $attr);
if ($res) {
$results = array_merge($results, $this->_getResults($fields, $res));
} else {
return $results;
}
- $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, $attr);
+ $res = @ldap_read($this->_ds, Horde_String::convertCharset($ids, 'UTF-8', $this->_params['charset']), $filter, $attr);
if (!$res) {
throw new Turba_Exception(sprintf(_("Read failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
}
$this->_encodeAttributes($attributes);
- if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) {
- throw new Turba_Exception('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . $GLOBALS['registry']->getCharset());
+ if (!@ldap_add($this->_ds, Horde_String::convertCharset($dn, 'UTF-8', $this->_params['charset']), $attributes)) {
+ throw new Turba_Exception('Failed to add an object: [' . ldap_errno($this->_ds) . '] "' . ldap_error($this->_ds) . '" DN: ' . $dn . ' (attributes: [' . serialize($attributes) . ']).' . "Charset:" . 'UTF-8');
}
}
throw new Turba_Exception(_("Invalid key specified."));
}
- if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']))) {
+ if (!@ldap_delete($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']))) {
throw new Turba_Exception(sprintf(_("Delete failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
}
}
* values. These are needed so that we can delete any
* attributes that have been removed by using ldap_mod_del. */
$filter = $this->_buildObjectclassFilter();
- $oldres = @ldap_read($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $filter, array_merge(array_keys($attributes), array('objectclass')));
+ $oldres = @ldap_read($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']), $filter, array_merge(array_keys($attributes), array('objectclass')));
$info = ldap_get_attributes($this->_ds, ldap_first_entry($this->_ds, $oldres));
if ($this->_params['version'] == 3 &&
throw new Turba_Exception(_("Missing DN in LDAP source configuration."));
}
- if (ldap_rename($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
- Horde_String::convertCharset($newrdn, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $this->_params['root'], true)) {
+ if (ldap_rename($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']),
+ Horde_String::convertCharset($newrdn, 'UTF-8', $this->_params['charset']), $this->_params['root'], true)) {
$object_id = $newrdn . ',' . $this->_params['root'];
} else {
throw new Turba_Exception(sprintf(_("Failed to change name: (%s) %s; Old DN = %s, New DN = %s, Root = %s"), ldap_errno($this->_ds), ldap_error($this->_ds), $object_id, $newrdn, $this->_params['root']));
$attributes[$key] == '') {
$oldval[$key] = $var[0];
- if (!@ldap_mod_del($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $oldval)) {
+ if (!@ldap_mod_del($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']), $oldval)) {
throw new Turba_Exception(sprintf(_("Modify failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
}
unset($attributes[$key]);
unset($attributes['objectclass']['count']);
$attributes['objectclass'] = array_values($attributes['objectclass']);
- if (!@ldap_modify($this->_ds, Horde_String::convertCharset($object_id, $GLOBALS['registry']->getCharset(), $this->_params['charset']), $attributes)) {
+ if (!@ldap_modify($this->_ds, Horde_String::convertCharset($object_id, 'UTF-8', $this->_params['charset']), $attributes)) {
throw new Turba_Exception(sprintf(_("Modify failed: (%s) %s"), ldap_errno($this->_ds), ldap_error($this->_ds)));
}
$clause .= '(&' . $this->_buildSearchQuery($vals) . ')';
} else {
if (isset($vals['field'])) {
- $rhs = Horde_String::convertCharset($vals['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ $rhs = Horde_String::convertCharset($vals['test'], 'UTF-8', $this->_params['charset']);
$clause .= Horde_Ldap::buildClause($vals['field'], $vals['op'], $rhs, array('begin' => !empty($vals['begin'])));
} else {
foreach ($vals as $test) {
} elseif (!empty($test['AND'])) {
$clause .= '(&' . $this->_buildSearchQuery($test) . ')';
} else {
- $rhs = Horde_String::convertCharset($test['test'], $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ $rhs = Horde_String::convertCharset($test['test'], 'UTF-8', $this->_params['charset']);
$clause .= Horde_Ldap::buildClause($test['field'], $test['op'], $rhs, array('begin' => !empty($vals['begin'])));
}
}
}
if (!is_array($val)) {
- $attributes[$key] = Horde_String::convertCharset($val, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ $attributes[$key] = Horde_String::convertCharset($val, 'UTF-8', $this->_params['charset']);
}
}
}
*/
protected function _convertToDriver($value)
{
- return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ return Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
}
/**
. ' '
. date($GLOBALS['prefs']->getValue('twentyFour') ? 'G:i' : 'g:i a', $entry['ts'])
. ' '
- . @htmlspecialchars($by, ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ . @htmlspecialchars($by, ENT_COMPAT, 'UTF-8');
}
}
} catch (Exception $e) {
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception_HookNotSet $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$targetSource]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$targetSource]['title']), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
try {
$message = Horde::callHook('perms_denied', array('turba:max_contacts'));
} catch (Horde_Exception $e) {
- $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, $GLOBALS['registry']->getCharset());
+ $message = @htmlspecialchars(sprintf(_("You are not allowed to create more than %d contacts in \"%s\"."), $max_contacts, $cfgSources[$source]['title']), ENT_COMPAT, 'UTF-8');
}
$notification->push($message, 'horde.error', array('content.raw'));
break;
<?php
global $language;
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
$filename = _("contact");
}
-$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), $GLOBALS['registry']->getCharset());
+$injector->getInstance('Horde_Data')->getData('Vcard')->exportFile($filename . '.vcf', array($driver->tovCard($object, '2.1', null, true)), 'UTF-8');
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
} elseif (!empty($conf['mail']['from_addr'])) {
$mail->addHeader('From', $conf['mail']['from_addr']);
} else {
- $mail->addHeader('From', Whups::formatUser($from), $GLOBALS['registry']->getCharset());
+ $mail->addHeader('From', Whups::formatUser($from), 'UTF-8');
}
$subject = (is_null($ticket_id)
? ''
: '[' . $registry->get('name') . ' #' . $ticket_id . '] ')
. $subject;
- $mail->addHeader('Subject', $subject, $GLOBALS['registry']->getCharset());
+ $mail->addHeader('Subject', $subject, 'UTF-8');
/* Get our array of comments, sorted in the appropriate order. */
if (!is_null($ticket_id)) {
array('@@comment@@', '@@full_name@@'),
array("\n\n" . $formattedComment, $full_name),
$message);
- $mail->setBody($body, $GLOBALS['registry']->getCharset());
+ $mail->setBody($body, 'UTF-8');
$mail->addHeader('Message-ID', Horde_Mime::generateMessageId());
if ($ticket_id) {
}
$mail->clearRecipients();
- $mail->addHeader('To', $to, $GLOBALS['registry']->getCharset());
+ $mail->addHeader('To', $to, 'UTF-8');
try {
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'), true);
. 'VALUES (?, ?, ?, ?, ?)';
$values = array(
$new_id,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']),
$slug,
$email);
$query = 'INSERT INTO whups_types' .
' (type_id, type_name, type_description) VALUES (?, ?, ?)';
$values = array($new_id,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addType(): query="%s"; values="%s"',
. 'state_description, state_category) VALUES (?, ?, ?, ?, ?)';
$values = array($new_id,
$typeId,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($category, 'UTF-8',
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addState(): query="%s"; values="%s"',
. 'priority_name, priority_description) VALUES (?, ?, ?, ?)';
$values = array($new_id,
$typeId,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addPriority(): query="%s"; values="%s"',
. 'version_name, version_description, version_active) VALUES (?, ?, ?, ?, ?)';
$values = array((int)$new_id,
(int)$queueId,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']),
(int)$active);
Horde::logMessage(
. 'reply_name, reply_text) VALUES (?, ?, ?, ?)';
$values = array($type,
$new_id,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($text, 'UTF-8',
$this->_params['charset']));
Horde::logMessage(
sprintf('Whups_Driver_sql::addReply(): query="%s"; values="%s"',
. 'ticket_timestamp, ticket_due, version_id)'
. ' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
$values = array($ticketId,
- Horde_String::convertCharset($summary, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($summary, 'UTF-8',
$this->_params['charset']),
$requester,
$type,
array((int)$id,
(int)$ticket_id,
$creator,
- Horde_String::convertCharset($comment, $GLOBALS['registry']->getCharset(), $this->_params['charset']),
+ Horde_String::convertCharset($comment, 'UTF-8', $this->_params['charset']),
time()));
if (is_a($result, 'PEAR_Error')) {
Horde::logMessage($result, 'ERR');
}
$query .= $this->_map[$field] . ' = ?, ';
- $values[] = Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->_params['charset']);
+ $values[] = Horde_String::convertCharset($value, 'UTF-8', $this->_params['charset']);
}
/* Don't try to execute an empty query (if we didn't find any updates
. 'queue_description = ?, queue_versioned = ?, '
. 'queue_slug = ?, queue_email = ? WHERE queue_id = ?';
$values = array(Horde_String::convertCharset($name,
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
$this->_params['charset']),
Horde_String::convertCharset($description,
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
$this->_params['charset']),
(empty($versioned) ? 0 : 1),
$slug,
{
$query = 'UPDATE whups_types' .
' SET type_name = ?, type_description = ? WHERE type_id = ?';
- $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ $values = array(Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']),
$typeId);
Horde::logMessage(
{
$query = 'UPDATE whups_states SET state_name = ?, '
. 'state_description = ?, state_category = ? WHERE state_id = ?';
- $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ $values = array(Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($category, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($category, 'UTF-8',
$this->_params['charset']),
$stateId);
Horde::logMessage(
$values = array($query->id, serialize($query->parameters),
serialize($query->query));
}
- $values = Horde_String::convertCharset($values, $GLOBALS['registry']->getCharset(),
+ $values = Horde_String::convertCharset($values, 'UTF-8',
$this->_params['charset']);
Horde::logMessage(
sprintf('Whups_Driver_sql::saveQuery(): query="%s"; values="%s"',
$query = 'UPDATE whups_priorities' .
' SET priority_name = ?, priority_description = ?' .
' WHERE priority_id = ?';
- $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ $values = array(Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']),
$priorityId);
Horde::logMessage(
$query = 'UPDATE whups_versions SET version_name = ?, '
. 'version_description = ?, version_active = ? '
. 'WHERE version_id = ?';
- $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ $values = array(Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($description, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($description, 'UTF-8',
$this->_params['charset']),
(int)$active,
(int)$versionId);
{
$query = 'UPDATE whups_replies SET reply_name = ?, '
. 'reply_text = ? WHERE reply_id = ?';
- $values = array(Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ $values = array(Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($text, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($text, 'UTF-8',
$this->_params['charset']),
$reply);
Horde::logMessage(
. ' VALUES (?, ?, ?, ?, ?, ?, ?)';
$values = array($new_id,
$type_id,
- Horde_String::convertCharset($name, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($name, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($desc, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($desc, 'UTF-8',
$this->_params['charset']),
$type,
serialize(
- Horde_String::convertCharset($params, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($params, 'UTF-8',
$this->_params['charset'])),
(int)($required == 'on'));
. 'SET attribute_name = ?, attribute_description = ?, '
. 'attribute_type = ?, attribute_params = ?, '
. 'attribute_required = ? WHERE attribute_id = ?';
- $values = array(Horde_String::convertCharset($newname, $GLOBALS['registry']->getCharset(),
+ $values = array(Horde_String::convertCharset($newname, 'UTF-8',
$this->_params['charset']),
- Horde_String::convertCharset($newdesc, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset($newdesc, 'UTF-8',
$this->_params['charset']),
$newtype,
serialize(
Horde_String::convertCharset($newparams,
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
$this->_params['charset'])),
(int)($newrequired == 'on'),
$attribute_id);
function _setAttributeValue($ticket_id, $attribute_id, $attribute_value)
{
$db_attribute_value = Horde_String::convertCharset((string)$attribute_value,
- $GLOBALS['registry']->getCharset(),
+ 'UTF-8',
$this->_params['charset']);
$this->_write_db->autoCommit(false);
time(),
(string)$user,
$type,
- Horde_String::convertCharset((string)$value, $GLOBALS['registry']->getCharset(),
+ Horde_String::convertCharset((string)$value, 'UTF-8',
$this->_params['charset']),
(int)$value);
Horde::logMessage(
$icon = base64_encode(file_get_contents($registry->get('themesfs', 'whups') . '/graphics/whups.png'));
// Charset.
-$charset = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
header('Content-Type: text/xml; charset=' . $charset);
echo <<<PAYLOAD
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
$template->set('title', htmlspecialchars($whups_query->name ? $whups_query->name : _("Query Results")));
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
if (isset($type) && isset($queue['name'])) {
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
$template->set('title', _("Search Results"));
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
}
$template = $injector->createInstance('Horde_Template');
-$template->set('charset', $GLOBALS['registry']->getCharset());
+$template->set('charset', 'UTF-8');
$template->set('xsl', $registry->get('themesuri') . '/feed-rss.xsl');
$template->set('pubDate', htmlspecialchars(date('r')));
$template->set('title', htmlspecialchars($details['summary']));
*/
function getCharset()
{
- return $GLOBALS['registry']->getCharset();
+ return 'UTF-8';
}
/**
*/
function _convertToDriver($value)
{
- return Horde_String::convertCharset($value, $GLOBALS['registry']->getCharset(), $this->getCharset());
+ return Horde_String::convertCharset($value, 'UTF-8', $this->getCharset());
}
/**
$this->_proc->deleteRule('Embed');
}
- $this->_proc->setFormatConf('Xhtml', 'charset', $GLOBALS['registry']->getCharset());
+ $this->_proc->setFormatConf('Xhtml', 'charset', 'UTF-8');
$this->_proc->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS);
$create = $this->allows(Wicked::MODE_CREATE) ? 1 : 0;
$linkConf = array(
}
foreach ($references as $key => $page) {
- $references[$key]['page_url'] = @htmlspecialchars(Wicked::url($page['page_name']), ENT_QUOTES, $GLOBALS['registry']->getCharset());
- $references[$key]['page_name'] = @htmlspecialchars($page['page_name'], ENT_QUOTES, $GLOBALS['registry']->getCharset());
+ $references[$key]['page_url'] = @htmlspecialchars(Wicked::url($page['page_name']), ENT_QUOTES, 'UTF-8');
+ $references[$key]['page_name'] = @htmlspecialchars($page['page_name'], ENT_QUOTES, 'UTF-8');
// Since the page name can have [ and ] and other special
// characters in it, and we don't want the browser or PHP decoding
$part->setContents($options['text']);
$part->setType("x-extension/$type");
- $viewer = new Horde_Core_Mime_Viewer_Syntaxhighlighter($part, array('registry' => $GLOBALS['registry'], 'charset' => $GLOBALS['registry']->getCharset()));
+ $viewer = new Horde_Core_Mime_Viewer_Syntaxhighlighter($part, array('registry' => $GLOBALS['registry'], 'charset' => 'UTF-8'));
$data = $viewer->render('inline');
$data = reset($data);
return $data['data'];
$conf['wicked']['notify_address'],
'from' => $from . '<' . $from_addr
. '>',
- 'charset' => $GLOBALS['registry']->getCharset()));
+ 'charset' => 'UTF-8'));
$mail->addHeader('User-Agent', 'Wicked ' . $GLOBALS['registry']->getVersion());
$mail->addHeader('Precedence', 'bulk');
$mail->addHeader('Auto-Submitted', 'auto-replied');
$icon = base64_encode(file_get_contents($registry->get('themesfs', 'wicked') . '/graphics/wicked.png'));
// Charset.
-$charset = $GLOBALS['registry']->getCharset();
+$charset = 'UTF-8';
header('Content-Type: text/xml; charset=' . $charset);
echo <<<PAYLOAD
<?php
if (isset($language)) {
- header('Content-type: text/html; charset=' . $GLOBALS['registry']->getCharset());
+ header('Content-type: text/html; charset=' . 'UTF-8');
header('Vary: Accept-Language');
}
?>
</div>
<div style="padding:8px">
- <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
+ <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, 'UTF-8') ?></textarea>
</div>
</form>
<?php endif; endif; ?>
<div style="padding:8px">
- <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></textarea>
+ <textarea class="fixed" style="width:100%" name="page_text" rows="29" cols="100"><?php echo @htmlspecialchars($page_text, ENT_COMPAT, 'UTF-8') ?></textarea>
</div>
</form>
<td style="text-align:center"><input type="submit" class="button" value="<?php echo htmlspecialchars($page->version()) ?>" onclick="if (document.diff.v1[<?php echo $i ?>].checked) return false; document.diff.v2.value = '<?php echo htmlspecialchars($pversion) ?>';" /></td>
<?php endif; ?>
- <td><?php echo @htmlspecialchars($page->changeLog(), ENT_COMPAT, $GLOBALS['registry']->getCharset()) ?></td>
+ <td><?php echo @htmlspecialchars($page->changeLog(), ENT_COMPAT, 'UTF-8') ?></td>
</tr>