From 2f167f2663b2731d9f5d21bb9893aebff4dcf6f0 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 3 Mar 2010 12:10:21 -0800 Subject: [PATCH 1/3] Fix syntax errors --- actions/oauthconnectionssettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php index b1467f0d04..f125f4c631 100644 --- a/actions/oauthconnectionssettings.php +++ b/actions/oauthconnectionssettings.php @@ -99,7 +99,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $application = $profile->getApplications($offset, $limit); - $cnt == 0; + $cnt = 0; if (!empty($application)) { $al = new ApplicationList($application, $user, $this, true); @@ -112,7 +112,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $this->pagination($this->page > 1, $cnt > APPS_PER_PAGE, $this->page, 'connectionssettings', - array('nickname' => $this->user->nickname)); + array('nickname' => $user->nickname)); } /** From 0881eba80eabfea65919be2f3d65235ccd0b5eb6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Mar 2010 12:08:07 -0800 Subject: [PATCH 2/3] Language setting fixes: - switch 'en_US' to 'en', fixes the "admin panel switches to Arabic" bug - tweak setting descriptions to clarify that most of the time we'll be using browser language - add a backend switch to disable language detection (should this be exposed to ui?) --- actions/siteadminpanel.php | 4 ++-- index.php | 1 + lib/default.php | 3 ++- lib/util.php | 12 +++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php index 8c8f8b3742..4b29819b71 100644 --- a/actions/siteadminpanel.php +++ b/actions/siteadminpanel.php @@ -277,8 +277,8 @@ class SiteAdminPanelForm extends AdminForm $this->unli(); $this->li(); - $this->out->dropdown('language', _('Language'), - get_nice_language_list(), _('Default site language'), + $this->out->dropdown('language', _('Default language'), + get_nice_language_list(), _('Site language when autodetection from browser settings is not available'), false, $this->value('language')); $this->unli(); diff --git a/index.php b/index.php index 06ff9900fd..a46bc084d5 100644 --- a/index.php +++ b/index.php @@ -253,6 +253,7 @@ function main() $user = common_current_user(); // initialize language env +common_log(LOG_DEBUG, "XXX: WAIII"); common_init_language(); diff --git a/lib/default.php b/lib/default.php index 7b50242ae2..b7216045ce 100644 --- a/lib/default.php +++ b/lib/default.php @@ -40,7 +40,8 @@ $default = 'logdebug' => false, 'fancy' => false, 'locale_path' => INSTALLDIR.'/locale', - 'language' => 'en_US', + 'language' => 'en', + 'langdetect' => true, 'languages' => get_all_languages(), 'email' => array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : null, diff --git a/lib/util.php b/lib/util.php index 46be920fa7..da2799d4f9 100644 --- a/lib/util.php +++ b/lib/util.php @@ -105,11 +105,13 @@ function common_language() // Otherwise, find the best match for the languages requested by the // user's browser... - $httplang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null; - if (!empty($httplang)) { - $language = client_prefered_language($httplang); - if ($language) - return $language; + if (common_config('site', 'langdetect')) { + $httplang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null; + if (!empty($httplang)) { + $language = client_prefered_language($httplang); + if ($language) + return $language; + } } // Finally, if none of the above worked, use the site's default... From c7d390e4949b28c28c95375bfe4523de05af7808 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 3 Mar 2010 12:18:20 -0800 Subject: [PATCH 3/3] Add class="admin" to the content div of admin panels for styling --- lib/adminpanelaction.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php index 536d97cdf5..9ea4fe2066 100644 --- a/lib/adminpanelaction.php +++ b/lib/adminpanelaction.php @@ -171,6 +171,24 @@ class AdminPanelAction extends Action $this->showForm(); } + /** + * Show content block. Overrided just to add a special class + * to the content div to allow styling. + * + * @return nothing + */ + function showContentBlock() + { + $this->elementStart('div', array('id' => 'content', 'class' => 'admin')); + $this->showPageTitle(); + $this->showPageNoticeBlock(); + $this->elementStart('div', array('id' => 'content_inner')); + // show the actual content (forms, lists, whatever) + $this->showContent(); + $this->elementEnd('div'); + $this->elementEnd('div'); + } + /** * show human-readable instructions for the page, or * a success/failure on save.