/* See if we were replacing photo */
if (!empty($info['file0']['file'])) {
try {
- Horde_Browser::wasFileUploaded('file0');
+ $GLOBALS['browser']->wasFileUploaded('file0');
if (filesize($info['file0']['file'])) {
/* Read in the uploaded data. */
$data = file_get_contents($info['file0']['file']);
/* Save new image. */
try {
- Horde_Browser::wasFileUploaded('file' . $i);
- if (!filesize($info['file' . $i]['file'])) {
- throw new Horde_Browser_Exception();
- }
+ $GLOBALS['browser']->wasFileUploaded('file' . $i);
} catch (Horde_Browser_Exception $e) {
if (!empty($info['file' . $i]['error'])) {
$notification->push(sprintf(_("There was a problem uploading the photo: %s"), $info['file' . $i]['error']), 'horde.error');
*/
public function sendRegFile($appKey, $displayName, $description, $href, $icon)
{
- $browser = Horde_Browser::singleton();
- $browser->downloadHeaders('install_registry.reg', 'application/octet-stream');
+ $GLOBALS['browser']->downloadHeaders('install_registry.reg', 'application/octet-stream');
$lines = array(
'Windows Registry Editor Version 5.00',
$error = _("No file specified");
} else {
try {
- Horde_Browser::wasFileUploaded('imagefile', _("photo"));
+ $GLOBALS['browser']->wasFileUploaded('imagefile', _("photo"));
$image = &Ansel::getImageFromFile($file, array('image_filename' => $name));
if (is_a($image, 'PEAR_Error')) {
$error = $image->getMessage();
*/
public function toHtml()
{
- $browser = Horde_Browser::singleton();
$tplDir = $GLOBALS['registry']->get('templates', 'horde');
$interval = $GLOBALS['prefs']->getValue('summary_refresh_time');
if ($content instanceof PEAR_Error) {
$content = $content->getMessage();
}
- if ($browser->hasFeature('xmlhttpreq')) {
+ if ($GLOBALS['browser']->hasFeature('xmlhttpreq')) {
$refresh_time = isset($item['params']['params']['_refresh_time']) ? $item['params']['params']['_refresh_time'] : $interval;
}
ob_start();
<?php
/**
- * The Horde_Browser:: class provides capability information for the current
+ * The Horde_Browser class provides capability information for the current
* web client.
*
* Browser identification is performed by examining the HTTP_USER_AGENT
protected $_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp');
/**
- * @deprecated
- */
- public static function singleton($userAgent = null, $accept = null)
- {
- // trigger_error - warning?
- return new self($userAgent, $accept);
- }
-
- /**
* Creates a browser instance (Constructor).
*
* @param string $userAgent The browser string to parse.
<name>Browser</name>
<channel>pear.horde.org</channel>
<summary>Horde Browser API</summary>
- <description>The Horde_Browser:: class provides an API for getting information
+ <description>The Horde_Browser class provides an API for getting information
about the current user's browser and its capabilities.
</description>
<lead>
*/
static public function allowOutputCompression()
{
- $browser = Horde_Browser::singleton();
- return !$browser->hasQuirk('buggy_compression') &&
+ return !$GLOBALS['browser']->hasQuirk('buggy_compression') &&
(ini_get('zlib.output_compression') == '') &&
(ini_get('zend_accelerator.compress_all') == '') &&
(ini_get('output_handler') != 'ob_gzhandler');
$s_ctrl = 0;
switch ($args['session_control']) {
case 'netscape':
- if (Horde_Browser::singleton()->isBrowser('mozilla')) {
+ // Chicken/egg: Browser object doesn't exist yet.
+ $browser = new Horde_Browser();
+ if ($browser->isBrowser('mozilla')) {
session_cache_limiter('private, must-revalidate');
}
break;
$injector->setInstance('Horde_Registry', $this);
/* Initialize browser object. */
- $GLOBALS['browser'] = Horde_Browser::singleton();
+ $GLOBALS['browser'] = new Horde_Browser();
$injector->setInstance('Horde_Browser', $GLOBALS['browser']);
/* Import and global Horde's configuration values. Almost a chicken
*/
function getNewline()
{
- require_once 'Horde/Browser.php';
- $browser = &Horde_Browser::singleton();
-
- switch ($browser->getPlatform()) {
+ switch ($GLOBALS['browser']->getPlatform()) {
case 'win':
return "\r\n";
/* Sanitize uploaded file. */
$import_format = Horde_Util::getFormData('import_format');
try {
- Horde_Browser::wasFileUploaded('import_file', $param['file_types'][$import_format]);
+ $GLOBALS['browser']->wasFileUploaded('import_file', $param['file_types'][$import_format]);
} catch (Horde_Exception $e) {
PEAR::raiseError($e->getMessage());
}
/* Move uploaded file so that we can read it again in the next step
after the user gave some format details. */
try {
- Horde_Browser::wasFileUploaded('import_file', _("TSV file"));
+ $GLOBALS['browser']->wasFileUploaded('import_file', _("TSV file"));
} catch (Horde_Browser_Exception $e) {
return PEAR::raiseError($e->getMessage());
}
{
if ($var->isRequired()) {
try {
- Horde_Browser::wasFileUploaded($var->getVarName());
+ $GLOBALS['browser']->wasFileUploaded($var->getVarName());
} catch (Horde_Browser_Exception $e) {
$message = $e->getMessage();
return false;
{
$name = $var->getVarName();
try {
- Horde_Browser::wasFileUploaded($name);
+ $GLOBALS['browser']->wasFileUploaded($name);
$info['name'] = Horde_Util::dispelMagicQuotes($_FILES[$name]['name']);
$info['type'] = $_FILES[$name]['type'];
$info['tmp_name'] = $_FILES[$name]['tmp_name'];
$varname = $var->getVarName();
try {
- Horde_Browser::wasFileUploaded($varname . '[new]');
+ $GLOBALS['browser']->wasFileUploaded($varname . '[new]');
$this->_uploaded = true;
/* A file has been uploaded on this submit. Save to temp dir for
$this->_title = $title;
}
- require_once 'Horde/Browser.php';
- $browser = &Horde_Browser::singleton($agent);
-
- if ($browser->hasFeature('html')) {
+ if ($GLOBALS['browser']->hasFeature('html')) {
$ml = 'html';
- } elseif ($browser->hasFeature('wml')) {
+ } elseif ($GLOBALS['browser']->hasFeature('wml')) {
$ml = 'wml';
} else {
$ml = 'html';
{
if ($var->isRequired()) {
try {
- Horde_Browser::wasFileUploaded($var->getVarName());
+ $GLOBALS['browser']->wasFileUploaded($var->getVarName());
} catch (Horde_Browser_Exception $e) {
$message = $e->getMessage();
return false;
{
$name = $var->getVarName();
try {
- Horde_Browser::wasFileUploaded($name);
+ $GLOBALS['browser']->wasFileUploaded($name);
$info['name'] = $_FILES[$name]['name'];
$info['type'] = $_FILES[$name]['type'];
$info['tmp_name'] = $_FILES[$name]['tmp_name'];
$message = Horde::link(Horde::url($GLOBALS['registry']->linkByPackage($alarm['params']['notify']['show']['__app'], 'show', $alarm['params']['notify']['show'])), $alarm['text']) . $message . '</a>';
}
- $browser = Horde_Browser::singleton();
- if (!empty($alarm['user']) && $browser->hasFeature('xmlhttpreq')) {
+ if (!empty($alarm['user']) && $GLOBALS['browser']->hasFeature('xmlhttpreq')) {
Horde::addScriptFile('prototype.js', 'horde');
$url = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/services/snooze.php', true);
$opts = array('-1' => _("Dismiss"),
*/
public function isSupported()
{
- $browser = Horde_Browser::singleton();
- return $browser->hasFeature('dom');
+ return $GLOBALS['browser']->hasFeature('dom');
}
/**
{
/* We may need to set a dummy parameter 'nocache' since some
* browsers do not always honor the 'no-cache' header. */
- $browser = Horde_Browser::singleton();
- if ($browser->hasQuirk('cache_same_url')) {
+ if ($GLOBALS['browser']->hasQuirk('cache_same_url')) {
if (is_null(self::$_randnum)) {
self::$_randnum = base_convert(microtime(), 10, 36);
}
$val = 'file_upload_' . $i;
if (isset($_FILES[$val]) && ($_FILES[$val]['error'] != 4)) {
try {
- Horde_Browser::wasFileUploaded($val);
+ $GLOBALS['browser']->wasFileUploaded($val);
$filename = Horde_Util::dispelMagicQuotes($_FILES[$val]['name']);
$res = Gollem::writeFile($old_dir, $filename, $_FILES[$val]['tmp_name']);
if (is_a($res, 'PEAR_Error')) {
$attachment = null;
if (!empty($conf['problems']['attachments'])) {
try {
- Horde_Browser::wasFileUploaded('attachment', _("attachment"));
+ $GLOBALS['browser']->wasFileUploaded('attachment', _("attachment"));
$attachment = $_FILES['attachment'];
} catch (Horde_Browser_Exception $e) {
if ($e->getCode() != UPLOAD_ERR_NO_FILE) {
} else {
$views = array();
if (!($view_cookie = Horde_Util::getFormData('imp_select_view'))) {
- if (isset($_COOKIE['default_imp_view'])) {
- $view_cookie = $_COOKIE['default_imp_view'];
- } else {
- $browser = Horde_Browser::singleton();
- $view_cookie = $browser->isMobile() ? 'mimp' : 'imp';
- }
+ $view_cookie = isset($_COOKIE['default_imp_view'])
+ ? $_COOKIE['default_imp_view']
+ : ($GLOBALS['browser']->isMobile() ? 'mimp' : 'imp');
}
$params['imp_select_view'] = array(
$notification = Horde_Notification::singleton();
$notification->attach('status');
- /* Browser detection object. */
- if (class_exists('Horde_Browser')) {
- $browser = Horde_Browser::singleton();
- } else if (class_exists('Browser')) {
- $browser = Browser::singleton();
- }
-
if ($webroot === null) {
$webroot = $registry->get('webroot', 'koward');
}
for ($i = 1; $i < 6; $i++) {
$input = 'file_' . $key . '_' . $i;
try {
- Horde_Browser::wasFileUploaded($input);
+ $GLOBALS['browser']->wasFileUploaded($input);
$file_id = $news->write_db->nextID($news->prefix . '_files');
if ($file_id instanceof PEAR_Error) {
$notification->push($file_id);
}
try {
- Horde_Browser::wasFileUploaded('attachment_file', _("attachment"));
+ $GLOBALS['browser']->wasFileUploaded('attachment_file', _("attachment"));
} catch (Horde_Browser_Exception $e) {
$notification->push($e, 'horde.error');
return;