diff --git a/actions/all.php b/actions/all.php index 06d88477d5..44e3fd2394 100644 --- a/actions/all.php +++ b/actions/all.php @@ -45,15 +45,8 @@ class AllAction extends StreamAction { # Looks like we're good; show the header common_show_header($profile->nickname . _t(" and friends"), - array($this, 'show_header'), $user); - - $cur = common_current_user(); - - if ($cur && $cur->id == $profile->id) { - common_notice_form(); - } - - $this->views_menu(); + array($this, 'show_header'), $user, + array($this, 'show_top')); $this->show_notices($profile); @@ -68,6 +61,16 @@ class AllAction extends StreamAction { 'title' => _t('Feed for friends of ') . $user->nickname)); } + function show_top($user) { + $cur = common_current_user(); + + if ($cur && $cur->id == $user->id) { + common_notice_form(); + } + + $this->views_menu(); + } + function show_notices($profile) { $notice = DB_DataObject::factory('notice'); diff --git a/actions/avatar.php b/actions/avatar.php index 2d8a9f81d2..b91dd794ce 100644 --- a/actions/avatar.php +++ b/actions/avatar.php @@ -24,8 +24,7 @@ require_once(INSTALLDIR.'/lib/settingsaction.php'); class AvatarAction extends SettingsAction { function show_form($msg=NULL, $success=false) { - common_show_header(_t('Avatar')); - $this->settings_menu(); + common_show_header(_t('Avatar'), NULL, NULL, array($this, 'settings_menu')); if ($msg) { $this->message($msg, $success); } else { diff --git a/actions/password.php b/actions/password.php index fe19f5f71d..ee61c3e978 100644 --- a/actions/password.php +++ b/actions/password.php @@ -24,8 +24,7 @@ require_once(INSTALLDIR.'/lib/settingsaction.php'); class PasswordAction extends SettingsAction { function show_form($msg=NULL, $success=false) { - common_show_header(_t('Change password')); - $this->settings_menu(); + common_show_header(_t('Change password'), NULL, NULL, array($this, 'settings_menu')); if ($msg) { $this->message($msg, $success); } else { diff --git a/actions/profilesettings.php b/actions/profilesettings.php index e94d846bdf..755c293c70 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -26,8 +26,8 @@ class ProfilesettingsAction extends SettingsAction { function show_form($msg=NULL, $success=false) { $user = common_current_user(); $profile = $user->getProfile(); - common_show_header(_t('Profile settings')); - $this->settings_menu(); + common_show_header(_t('Profile settings'), NULL, NULL, array($this, 'settings_menu')); + if ($msg) { $this->message($msg, $success); } else { diff --git a/actions/showstream.php b/actions/showstream.php index 6fed6df128..52dbcd0ffb 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -52,7 +52,9 @@ class ShowstreamAction extends StreamAction { header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' => $user->nickname))); - common_show_header($profile->nickname, array($this, 'show_header'), $user); + common_show_header($profile->nickname, + array($this, 'show_header'), $user, + array($this, 'show_top')); $cur = common_current_user(); @@ -69,6 +71,17 @@ class ShowstreamAction extends StreamAction { common_show_footer(); } + function show_top($user) { + + $cur = common_current_user(); + + if ($cur && $cur->id == $user->id) { + common_notice_form(); + } + + $this->views_menu(); + } + function show_header($user) { common_element('link', array('rel' => 'alternate', 'href' => common_local_url('userrss', array('nickname' => diff --git a/lib/util.php b/lib/util.php index aa0b8f02c1..bbc411d81e 100644 --- a/lib/util.php +++ b/lib/util.php @@ -123,7 +123,7 @@ function common_end_xml() { $xw->flush(); } -function common_show_header($pagetitle, $callable=NULL, $data=NULL, $notice=NULL) { +function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=NULL) { global $config, $xw; header('Content-Type: application/xhtml+xml'); @@ -170,6 +170,13 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $notice=NULL 'alt' => $config['site']['name'], 'id' => 'logo')); common_element_end('a'); + if ($headercall) { + if ($data) { + call_user_func($headercall, $data); + } else { + call_user_func($headercall); + } + } common_element_end('div'); common_element_start('div', array('id' => 'content')); }