From 6de6114e2216d58dc11739fb4a1c951371bb0b3a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 19 Jan 2014 09:30:33 +0000 Subject: [PATCH] remove old API browser class, apps only used content_header method with is available as html::browser_header() with identical signature --- addressbook/inc/class.addressbook_csv.inc.php | 3 +- calendar/freebusy.php | 2 +- etemplate/inc/class.bo_merge.inc.php | 2 +- infolog/inc/class.infolog_ui.inc.php | 2 +- phpgwapi/inc/class.browser.inc.php | 206 ------------------ setup/manageheader.php | 3 +- setup/sqltoarray.php | 3 +- 7 files changed, 6 insertions(+), 215 deletions(-) delete mode 100644 phpgwapi/inc/class.browser.inc.php diff --git a/addressbook/inc/class.addressbook_csv.inc.php b/addressbook/inc/class.addressbook_csv.inc.php index 9ebf3660af..4bb119c14c 100644 --- a/addressbook/inc/class.addressbook_csv.inc.php +++ b/addressbook/inc/class.addressbook_csv.inc.php @@ -74,8 +74,7 @@ class addressbook_csv } if (!$file) { - $browser = new browser(); - $browser->content_header('addressbook.csv','text/comma-separated-values'); + html::content_header('addressbook.csv','text/comma-separated-values'); } if (!($fp = fopen($file ? $file : 'php://output','w'))) { diff --git a/calendar/freebusy.php b/calendar/freebusy.php index 21d68b98d0..cd45dc54f5 100644 --- a/calendar/freebusy.php +++ b/calendar/freebusy.php @@ -107,6 +107,6 @@ if ($_GET['debug']) } else { - ExecMethod2('phpgwapi.browser.content_header','freebusy.ifb','text/calendar'); + html::content_header('freebusy.ifb','text/calendar'); } echo ExecMethod2('calendar.calendar_ical.freebusy',$user,$_GET['end']); diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index 7fb44ad70d..9d3d20a30b 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -1561,7 +1561,7 @@ abstract class bo_merge $mimetype = 'application/vnd.ms-excel'; // to open it automatically in excel or oocalc } } - ExecMethod2('phpgwapi.browser.content_header',$name,$mimetype); + html::content_header($name,$mimetype); echo $merged; } common::egw_exit(); diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 6385aa23bc..1d0f5085e9 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1275,7 +1275,7 @@ class infolog_ui case 'ical': // infolog_ical lets horde be auto-loaded, so it must go first $boical = new infolog_ical(); - ExecMethod2('phpgwapi.browser.content_header','todo.ics','text/calendar'); + html::content_header('todo.ics','text/calendar'); echo $boical->exportvCalendar($checked); common::egw_exit(); diff --git a/phpgwapi/inc/class.browser.inc.php b/phpgwapi/inc/class.browser.inc.php deleted file mode 100644 index 6b3a3844fb..0000000000 --- a/phpgwapi/inc/class.browser.inc.php +++ /dev/null @@ -1,206 +0,0 @@ - - * Majority of code borrowed from Sourceforge 2.5 - * Copyright 1999-2000 (c) The SourceForge Crew - http://sourceforge.net - * - * @link http://www.egroupware.org - * @author Miles Lott - * @license http://opensource.org/licenses/lgpl-license.php LGPL - GNU Lesser General Public License - * @package api - * @subpackage html - * @version $Id$ - */ - -/** - * Dusty old browser detection functions (all static now) - * - * @deprecated use html::content_header(), html::$user_agent and html::$ua_version - */ -class browser -{ - public static $agent; - public static $version; - public static $platform; - public static $br; - public static $p; - - /** - * Init our static properties - */ - public static function init_static() - { - $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; - /* - Determine browser and version - */ - if(preg_match('/MSIE ([0-9]*[0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version)) - { - self::$version = $log_version[1]; - self::$agent = 'IE'; - } - elseif(preg_match('/Opera ([0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version) || - preg_match('/Opera\\/([0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version)) - { - self::$version = $log_version[1]; - self::$agent = 'OPERA'; - } - elseif(preg_match('/iCab ([0-9].[0-9a-zA-Z]{1,4})/i',$HTTP_USER_AGENT,$log_version) || - preg_match('/iCab\\/([0-9].[0-9a-zA-Z]{1,4})/i',$HTTP_USER_AGENT,$log_version)) - { - self::$version = $log_version[1]; - self::$agent = 'iCab'; - } - elseif(strpos($HTTP_USER_AGENT,'Gecko') !== false) - { - self::$version = $log_version[1]; - self::$agent = 'MOZILLA'; - } - elseif(preg_match('/Konqueror\\/([0-9].[0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version) || - preg_match('/Konqueror\\/([0-9].[0-9]{1,2})/',$HTTP_USER_AGENT,$log_version)) - { - self::$version=$log_version[1]; - self::$agent='Konqueror'; - } - else - { - self::$version=0; - self::$agent='OTHER'; - } - - /* - Determine platform - */ - if(strpos($HTTP_USER_AGENT,'Win') !== false) - { - self::$platform='Win'; - } - elseif(strpos($HTTP_USER_AGENT,'Mac') !== false) - { - self::$platform='Mac'; - } - elseif(strpos($HTTP_USER_AGENT,'Linux') !== false) - { - self::$platform='Linux'; - } - elseif(strpos($HTTP_USER_AGENT,'Unix') !== false) - { - self::$platform='Unix'; - } - elseif(strpos($HTTP_USER_AGENT,'Beos') !== false) - { - self::$platform='Beos'; - } - else - { - self::$platform='Other'; - } - - /* - echo "\n\nAgent: $HTTP_USER_AGENT"; - echo "\nIE: ".browser_is_ie(); - echo "\nMac: ".browser_is_mac(); - echo "\nWindows: ".browser_is_windows(); - echo "\nPlatform: ".browser_get_platform(); - echo "\nVersion: ".browser_get_version(); - echo "\nAgent: ".browser_get_agent(); - */ - - // The br and p functions are supposed to return the correct - // value for tags that do not need to be closed. This is - // per the xhmtl spec, so we need to fix this to include - // all compliant browsers we know of. - if(self::$agent == 'IE') - { - self::$br = '
'; - self::$p = '

'; - } - else - { - self::$br = '
'; - self::$p = '

'; - } - //error_log(__METHOD__."() $_SERVER[HTTP_USER_AGENT] --> agent=".self::$agent.', version='.self::$version.', platform='.self::$platform); - } - - public static function return_array() - { - return array( - 'agent' => self::$agent, - 'version' => self::$version, - 'platform' => self::$platform, - ); - } - - public static function get_agent() - { - return self::$agent; - } - - public static function get_version() - { - return self::$version; - } - - public static function get_platform() - { - return self::$platform; - } - - public static function is_linux() - { - return $platform == 'Linux'; - } - - public static function is_unix() - { - return $platform() == 'Unix'; - } - - public static function is_beos() - { - return $platform == 'Beos'; - } - - public static function is_mac() - { - return $platform == 'Mac'; - } - - public static function is_windows() - { - return $platform == 'Win'; - } - - public static function is_ie() - { - return $agent == 'IE'; - } - - public static function is_netscape() - { - return $agent == 'MOZILLA'; - } - - public static function is_opera() - { - return $agent == 'OPERA'; - } - - /** - * Output content headers for file downloads - * - * @param string $fn filename - * @param string $mime='' mimetype or '' (default) to detect it from filename, using mime_magic::filename2mime() - * @param int $length=0 content length, default 0 = skip that header - * @param boolean $nocache=true send headers to disallow browser/proxies to cache the download - * @deprecated use html::content_header() direct - */ - public static function content_header($fn,$mime='',$length=0,$nocache=True) - { - html::content_header($fn,$mime,$length,$nocache); - } -} -browser::init_static(); diff --git a/setup/manageheader.php b/setup/manageheader.php index 7df0d7c4d1..dc5b39b377 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -97,8 +97,7 @@ else switch($action) { case 'download': - $browser = CreateObject('phpgwapi.browser'); - $browser->content_header('header.inc.php','application/octet-stream'); + html::content_header('header.inc.php','application/octet-stream'); echo $newheader; break; diff --git a/setup/sqltoarray.php b/setup/sqltoarray.php index 2877ddc44b..935c448142 100644 --- a/setup/sqltoarray.php +++ b/setup/sqltoarray.php @@ -140,8 +140,7 @@ function download_handler($dlstring,$fn='tables_current.inc.php') { - $b = CreateObject('phpgwapi.browser'); - $b->content_header($fn); + html::content_header($fn); echo $dlstring; exit; }