summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-10-04 13:58:29 +0000
committerSarven Capadisli <csarven@status.net>2009-10-04 13:58:29 +0000
commitc64e1792bf108961c288ffa91667be34d9e6ca6a (patch)
treed4f5efd87a0dc481807597157ae5c3f6a676a6b3 /plugins
parent960207c81eb9f420f916c6889f2f4b4c09a5a480 (diff)
Fixed redirect. Added common_path for mobileserver
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MobileProfile/MobileProfilePlugin.php28
1 files changed, 25 insertions, 3 deletions
diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php
index d854b6e5e..02a732493 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();
}
}
@@ -171,6 +172,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;
+ }
}