X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FMobileProfile%2FMobileProfilePlugin.php;h=35756cfe79e425d16f22585f03f066ea48dd9429;hb=7addccacaab5bf7510fbe537b512bc8d5c3f558f;hp=d854b6e5e3165af1aa48206bb37206f72651c970;hpb=960207c81eb9f420f916c6889f2f4b4c09a5a480;p=quix0rs-gnu-social.git diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index d854b6e5e3..35756cfe79 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -132,10 +132,11 @@ class MobileProfilePlugin extends WAP20Plugin // redirect there if ($this->serveMobile && common_config('site', 'mobileserver') !== false && - common_config('site', 'mobileserver') != - common_config('site', 'server')) { + (common_config('site', 'mobileserver') != + common_config('site', 'server'))) { - header("Location: ".common_config('site', 'mobileserver')); + // FIXME: Redirect to equivalent page on mobile site instead + header("Location: ".$this->_common_path('')); exit(); } } @@ -157,6 +158,30 @@ class MobileProfilePlugin extends WAP20Plugin } + function onStartShowStatusNetStyles($action) { + if (file_exists(theme_file('css/mp-screen.css'))) { + $action->cssLink('css/mp-screen.css', null, 'screen'); + } + else { + $action->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => common_path('plugins/MobileProfile/mp-screen.css') . '?version=' . STATUSNET_VERSION, + 'media' => 'screen')); + } + + if (file_exists(theme_file('css/mp-handheld.css'))) { + $action->cssLink('css/mp-handheld.css', null, 'handheld'); + } + else { + $action->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => common_path('plugins/MobileProfile/mp-handheld.css') . '?version=' . STATUSNET_VERSION, + 'media' => 'handheld')); + } + + return false; + } + function onStartShowAside($action) { @@ -171,6 +196,27 @@ class MobileProfilePlugin extends WAP20Plugin } + + function _common_path($relative, $ssl=false) + { + $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; + + if (($ssl && (common_config('site', 'ssl') === 'sometimes')) + || common_config('site', 'ssl') === 'always') { + $proto = 'https'; + if (is_string(common_config('site', 'sslserver')) && + mb_strlen(common_config('site', 'sslserver')) > 0) { + $serverpart = common_config('site', 'sslserver'); + } else { + $serverpart = common_config('site', 'mobileserver'); + } + } else { + $proto = 'http'; + $serverpart = common_config('site', 'mobileserver'); + } + + return $proto.'://'.$serverpart.'/'.$pathpart.$relative; + } }