X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=9e4c8f0552c486a7eec46f1f065b1508a3b96b43;hb=0180ac563eebea23df3ffb95c35f5a9da164de52;hp=5d08e7cec8b50f7d87184c4f2cc12076b629a18e;hpb=3b8eb5d66b52926e46064254487bddc33eb60cdf;p=friendica.git diff --git a/boot.php b/boot.php index 5d08e7cec8..9e4c8f0552 100644 --- a/boot.php +++ b/boot.php @@ -11,9 +11,9 @@ require_once('include/cache.php'); require_once('library/Mobile_Detect/Mobile_Detect.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '3.0.1464' ); +define ( 'FRIENDICA_VERSION', '3.0.1516' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1154 ); +define ( 'DB_UPDATE_VERSION', 1156 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -283,7 +283,9 @@ define ( 'GRAVITY_COMMENT', 6); */ function startup() { + error_reporting(E_ERROR | E_WARNING | E_PARSE); + set_time_limit(0); // This has to be quite large to deal with embedded private photos @@ -350,6 +352,8 @@ if(! class_exists('App')) { public $plugins; public $apps = array(); public $identities; + public $is_mobile; + public $is_tablet; public $nav_sel; @@ -401,7 +405,6 @@ if(! class_exists('App')) { elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) $this->scheme = 'https'; - if(x($_SERVER,'SERVER_NAME')) { $this->hostname = $_SERVER['SERVER_NAME']; @@ -491,6 +494,14 @@ if(! class_exists('App')) { if($this->pager['start'] < 0) $this->pager['start'] = 0; $this->pager['total'] = 0; + + /** + * Detect mobile devices + */ + + $mobile_detect = new Mobile_Detect(); + $this->is_mobile = $mobile_detect->isMobile(); + $this->is_tablet = $mobile_detect->isTablet(); } function get_baseurl($ssl = false) { @@ -1288,14 +1299,14 @@ if(! function_exists('get_birthdays')) { $a = get_app(); $o = ''; - if(! local_user()) + if(! local_user() || $a->is_mobile || $a->is_tablet) return $o; - $mobile_detect = new Mobile_Detect(); - $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); +// $mobile_detect = new Mobile_Detect(); +// $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); - if($is_mobile) - return $o; +// if($is_mobile) +// return $o; $bd_format = t('g A l F d') ; // 8 AM Friday January 18 $bd_short = t('F d'); @@ -1373,15 +1384,15 @@ if(! function_exists('get_events')) { $a = get_app(); - if(! local_user()) + if(! local_user() || $a->is_mobile || $a->is_tablet) return $o; - $mobile_detect = new Mobile_Detect(); - $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); +// $mobile_detect = new Mobile_Detect(); +// $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); - if($is_mobile) - return $o; +// if($is_mobile) +// return $o; $bd_format = t('g A l F d') ; // 8 AM Friday January 18 $bd_short = t('F d'); @@ -1495,9 +1506,9 @@ if(! function_exists('proc_run')) { $cmdline = implode($args," "); if(get_config('system','proc_windows')) - proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo)); + proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo,dirname(__FILE__))); else - proc_close(proc_open($cmdline." &",array(),$foo)); + proc_close(proc_open($cmdline." &",array(),$foo,dirname(__FILE__))); } } @@ -1507,18 +1518,25 @@ if(! function_exists('current_theme')) { $a = get_app(); - $mobile_detect = new Mobile_Detect(); - $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); +// $mobile_detect = new Mobile_Detect(); +// $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); + $is_mobile = $a->is_mobile || $a->is_tablet; if($is_mobile) { - $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : ''); - $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme); - - if($theme_name === '---') { - // user has selected to have the mobile theme be the same as the normal one + if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) { $system_theme = ''; $theme_name = ''; } + else { + $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : ''); + $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme); + + if($theme_name === '---') { + // user has selected to have the mobile theme be the same as the normal one + $system_theme = ''; + $theme_name = ''; + } + } } if(!$is_mobile || ($system_theme === '' && $theme_name === '')) { $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : ''); @@ -1760,3 +1778,28 @@ function build_querystring($params, $name=null) { } return $ret; } + +/** +* Returns the complete URL of the current page, e.g.: http(s)://something.com/network +* +* Taken from http://webcheatsheet.com/php/get_current_page_url.php +*/ +function curPageURL() { + $pageURL = 'http'; + if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} + $pageURL .= "://"; + if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") { + $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; + } else { + $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; + } + return $pageURL; +} + +function random_digits($digits) { + $rn = ''; + for($i = 0; $i < $digits; $i++) { + $rn .= rand(0,9); + } + return $rn; +}