diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-01-08 16:45:28 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-01-08 16:45:28 +0000 |
commit | e5d3666280aa98d9e12990aff7b2b360d71d3db0 (patch) | |
tree | c5aad61af0ba23e0d90cf6f41cb0764eabfb86a8 /lib/base.php | |
parent | 6dcabdc61c20ab926af15411c326d13cd49f041b (diff) | |
parent | ed5fb902bd1391d2fc2adb3c4e5cb25fcb16b93e (diff) | |
download | nextcloud-server-e5d3666280aa98d9e12990aff7b2b360d71d3db0.tar.gz nextcloud-server-e5d3666280aa98d9e12990aff7b2b360d71d3db0.zip |
Merge branch 'master' of gitorious.org:owncloud/owncloud into jqueryui
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php index 943ab5f24dc..e0f14b703dc 100644 --- a/lib/base.php +++ b/lib/base.php @@ -70,6 +70,31 @@ class OC{ } } + /** + * autodetects the formfactor of the used device + * default -> the normal desktop browser interface + * mobile -> interface for smartphones + * tablet -> interface for tablets + * standalone -> the default interface but without header, footer and sidebar. just the application. useful to ue just a specific app on the desktop in a standalone window. + */ + public static function detectFormfactor(){ + // please add more useragent strings for other devices + if(isset($_SERVER['HTTP_USER_AGENT'])){ + if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) { + $mode='tablet'; + }elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0){ + $mode='mobile'; + }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)){ + $mode='mobile'; + }else{ + $mode='default'; + } + }else{ + $mode='default'; + } + return($mode); + } + public static function init(){ // register autoloader spl_autoload_register(array('OC','autoload')); @@ -127,9 +152,30 @@ class OC{ } } + if(OC_Config::getValue('installed', false)){ + $installedVersion=OC_Config::getValue('version','0.0.0'); + $currentVersion=implode('.',OC_Util::getVersion()); + if (version_compare($currentVersion, $installedVersion, '>')) { + OC_DB::updateDbFromStructure('../db_structure.xml'); + OC_Config::setValue('version',implode('.',OC_Util::getVersion())); + } + + OC_App::updateApps(); + } + ini_set('session.cookie_httponly','1;'); session_start(); + // if the formfactor is not yet autodetected do the autodetection now. For possible forfactors check the detectFormfactor documentation + if(!isset($_SESSION['formfactor'])){ + $_SESSION['formfactor']=OC::detectFormfactor(); + } + // allow manual override via GET parameter + if(isset($_GET['formfactor'])){ + $_SESSION['formfactor']=$_GET['formfactor']; + } + + // Add the stuff we need always OC_Util::addScript( "jquery-1.6.4.min" ); OC_Util::addScript( "jquery-ui-1.8.16.custom.min" ); @@ -195,8 +241,6 @@ if( !isset( $RUNTIME_NOAPPS )){ $RUNTIME_NOAPPS = false; } -OC::init(); - if(!function_exists('get_temp_dir')) { function get_temp_dir() { if( $temp=ini_get('upload_tmp_dir') ) return $temp; @@ -212,7 +256,11 @@ if(!function_exists('get_temp_dir')) { } } +OC::init(); + require_once('fakedirstream.php'); + + // FROM search.php new OC_Search_Provider_File(); |