From 61ada4558d69901c71b6542c16d43b5ea75ea3b3 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 3 Mar 2010 10:19:14 -0800 Subject: Fix for disappearing 'connect' menu if xmpp and sms are disabled. All 'connect' menu panels used to be optional, so Action tried to figure out what the first item on the 'connect' menu should be. This is no longer necessary because we have the non-optional OAuth client connections panel now, which is not optional and can't be turned off. --- plugins/MobileProfile/MobileProfilePlugin.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index f788639ae..0b37734b7 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -307,23 +307,14 @@ class MobileProfilePlugin extends WAP20Plugin function _showPrimaryNav($action) { $user = common_current_user(); - $connect = ''; - if (common_config('xmpp', 'enabled')) { - $connect = 'imsettings'; - } else if (common_config('sms', 'enabled')) { - $connect = 'smssettings'; - } - $action->elementStart('ul', array('id' => 'site_nav_global_primary')); if ($user) { $action->menuItem(common_local_url('all', array('nickname' => $user->nickname)), _('Home')); $action->menuItem(common_local_url('profilesettings'), _('Account')); - if ($connect) { - $action->menuItem(common_local_url($connect), + $action->menuItem(common_local_url('oauthconnectionssettings'), _('Connect')); - } if ($user->hasRight(Right::CONFIGURESITE)) { $action->menuItem(common_local_url('siteadminpanel'), _('Admin'), _('Change site configuration'), false, 'nav_admin'); -- cgit v1.2.3-54-g00ecf From edea825c70c2adb550e4fb47a94c497e0e92f0ad Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 6 Apr 2010 12:13:54 -0700 Subject: Comment out unreachable code spewing notices due to use of undefined variables in MobileProfile. This needs some cleanup... --- plugins/MobileProfile/MobileProfilePlugin.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 0b37734b7..a104eadd7 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -73,9 +73,11 @@ class MobileProfilePlugin extends WAP20Plugin $this->serveMobile = true; } else { // If they like the WAP 2.0 mimetype, serve them MP - if (strstr('application/vnd.wap.xhtml+xml', $type) !== false) { - $this->serveMobile = true; - } else { + // @fixme $type is undefined, making this if case useless and spewing errors. + // What's the intent? + //if (strstr('application/vnd.wap.xhtml+xml', $type) !== false) { + // $this->serveMobile = true; + //} else { // If they are a mobile device that supports WAP 2.0, // serve them MP @@ -149,7 +151,7 @@ class MobileProfilePlugin extends WAP20Plugin break; } } - } + //} // If they are okay with MP, and the site has a mobile server, // redirect there @@ -167,7 +169,9 @@ class MobileProfilePlugin extends WAP20Plugin return true; } - if (!$type) { + // @fixme $type is undefined, making this if case useless and spewing errors. + // What's the intent? + //if (!$type) { $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null; @@ -180,7 +184,7 @@ class MobileProfilePlugin extends WAP20Plugin throw new ClientException(_('This page is not available in a '. 'media type you accept'), 406); } - } + //} header('Content-Type: '.$type); @@ -221,9 +225,12 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowHeadElements($action) { - if (!$action->serveMobile) { - return true; - } + // @fixme nothing appears to set a serveMobile on any action, + // so this is useless and spews errors. Is this supposed to be + // checking $this? + //if (!$action->serveMobile) { + // return true; + //} $action->showTitle(); $action->showShortcutIcon(); -- cgit v1.2.3-54-g00ecf From 3172b50fc7eec9a2ae2b27abe5e9ab3e0875558c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 6 Apr 2010 12:21:42 -0700 Subject: Add a User-Agent fragment blacklist to MobileProfile: sticking iPad on the regular theme, which works better on its larger screen (was tripped on 'mobile' in the UA though we had no explicit check for 'ipad' previously) --- plugins/MobileProfile/MobileProfilePlugin.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index a104eadd7..60bb3b68f 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -141,8 +141,19 @@ class MobileProfilePlugin extends WAP20Plugin 'windows ce' ); + $blacklist = array( + 'ipad', // Larger screen handles the full theme fairly well. + ); + $httpuseragent = strtolower($_SERVER['HTTP_USER_AGENT']); + foreach ($blacklist as $md) { + if (strstr($httpuseragent, $md) !== false) { + $this->serveMobile = false; + return true; + } + } + foreach ($this->mobiledevices as $md) { if (strstr($httpuseragent, $md) !== false) { $this->setMobileFeatures($httpuseragent); -- cgit v1.2.3-54-g00ecf From 8a02cad42468c628b7b77910458c706c5d26f4df Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 8 Apr 2010 10:09:56 -0700 Subject: drop onStartShowHeadElements handler from MobileProfile; just duplicated the original code path, and after removing the bogus notice-spewing code it was running those things twice. --- plugins/MobileProfile/MobileProfilePlugin.php | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 60bb3b68f..1c61b4fe5 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -234,24 +234,6 @@ class MobileProfilePlugin extends WAP20Plugin } - function onStartShowHeadElements($action) - { - // @fixme nothing appears to set a serveMobile on any action, - // so this is useless and spews errors. Is this supposed to be - // checking $this? - //if (!$action->serveMobile) { - // return true; - //} - - $action->showTitle(); - $action->showShortcutIcon(); - $action->showStylesheets(); - $action->showFeeds(); - $action->showDescription(); - $action->extraHead(); - } - - function onStartShowStatusNetStyles($action) { if (!$this->serveMobile) { -- cgit v1.2.3-54-g00ecf From 5996d80c0918001f5c69f8d52681fc16aa003297 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 6 May 2010 21:29:04 +0000 Subject: Ticket #2184: recognize Palm Pre / WebOS browsers for MobileProfile One-line addition of 'webos' to the keywords list. --- plugins/MobileProfile/MobileProfilePlugin.php | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 1c61b4fe5..a3dc4de46 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -138,6 +138,7 @@ class MobileProfilePlugin extends WAP20Plugin 'vodafone', 'wap1', 'wap2', + 'webos', 'windows ce' ); -- cgit v1.2.3-54-g00ecf From 79153869505c9bfb41b7e49b757f233dc19530bb Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 7 May 2010 01:28:37 +0000 Subject: Allow plugins to load their styles for mobile view; fixes bad realtime button layout --- plugins/MobileProfile/MobileProfilePlugin.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index a3dc4de46..6076bbde0 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -255,6 +255,10 @@ class MobileProfilePlugin extends WAP20Plugin $action->cssLink('plugins/MobileProfile/mp-handheld.css',null,'handheld'); } + // Allow other plugins to load their styles. + Event::handle('EndShowStatusNetStyles', array($action)); + Event::handle('EndShowLaconicaStyles', array($action)); + return false; } -- cgit v1.2.3-54-g00ecf