From ba8da761e669b22e16e1075e0e1e79d8b458af3e Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 19 Jul 2010 22:52:31 -0700 Subject: [PATCH] more cleanup - start on ajax --- boot.php | 5 +++++ include/nav.php | 5 +++-- mod/ping.php | 36 +++++++++++++++++++++++++++++++++++ mod/settings.php | 31 ++++++++++++++++++++---------- view/dfrn_request.tpl | 5 +++-- view/head.tpl | 17 +++++++++++++++++ view/profile.php | 2 +- view/settings.tpl | 4 +++- view/settings_nick_set.tpl | 8 ++++---- view/settings_nick_subdir.tpl | 7 +++++++ view/style.css | 4 ++++ 11 files changed, 104 insertions(+), 20 deletions(-) create mode 100644 mod/ping.php create mode 100644 view/settings_nick_subdir.tpl diff --git a/boot.php b/boot.php index 56d85f6382..5efa9a24f4 100644 --- a/boot.php +++ b/boot.php @@ -96,9 +96,14 @@ class App { $this->path = ltrim(trim($p),'/'); } + function get_path() { + return $this->path; + } + function set_pager_total($n) { $this->pager['total'] = intval($n); } + function set_pager_itemspage($n) { $this->pager['itemspage'] = intval($n); $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage']; diff --git a/include/nav.php b/include/nav.php index a7a2cf3f88..b788ed48a3 100644 --- a/include/nav.php +++ b/include/nav.php @@ -12,7 +12,8 @@ $a->page['nav'] .= "Notifications\r\n"; $a->page['nav'] .= "Messages\r\n"; - + + $a->page['nav'] .= "
\r\n"; $a->page['nav'] .= "Logout\r\n"; @@ -22,7 +23,7 @@ $a->page['nav'] .= "Contacts\r\n"; - $a->page['nav'] .= "Home\r\n"; + $a->page['nav'] .= "user['nickname']}\">Home\r\n"; $a->page['nav'] .= "Network\r\n"; diff --git a/mod/ping.php b/mod/ping.php new file mode 100644 index 0000000000..bc160ade7f --- /dev/null +++ b/mod/ping.php @@ -0,0 +1,36 @@ +\r\n$intro$mail$network$home\r\n"; + + killme(); +} + diff --git a/mod/settings.php b/mod/settings.php index 54fca992cf..bd779ad4e5 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -3,20 +3,20 @@ function settings_init(&$a) { - if((! x($_SESSION,'authenticated')) && (x($_SESSION,'uid'))) { - $_SESSION['sysmsg'] .= "Permission denied." . EOL; + if(! local_user()) { + notice("Permission denied." . EOL); $a->error = 404; return; } require_once("mod/profile.php"); - profile_load($a,$_SESSION['uid']); + profile_load($a,$a->user['nickname']); } function settings_post(&$a) { - if((! x($_SESSION['authenticated'])) && (! (x($_SESSION,'uid')))) { - $_SESSION['sysmsg'] .= "Permission denied." . EOL; + if(! local_user()) { + notice( "Permission denied." . EOL); return; } if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != $_SESSION['uid']) { @@ -128,15 +128,26 @@ function settings_content(&$a) { $timezone = $a->user['timezone']; - if(x($nickname)) - $nickname_block = file_get_contents("view/settings_nick_set.tpl"); - else - $nickname_block = file_get_contents("view/settings_nick_unset.tpl"); + + $nickname_block = file_get_contents("view/settings_nick_set.tpl"); + + + $nickname_subdir = ''; + if(strlen($a->get_path())) { + $subdir_tpl = file_get_contents('view/settings_nick_subdir.tpl'); + $nickname_subdir = replace_macros($subdir_tpl, array( + '$baseurl' => $a->get_baseurl(), + '$nickname' => $nickname, + '$hostname' => $a->get_hostname() + )); + } + $nickname_block = replace_macros($nickname_block,array( '$nickname' => $nickname, '$uid' => $_SESSION['uid'], - '$basepath' => substr($a->get_baseurl(),strpos($a->get_baseurl(),'://') + 3), + '$subdir' => $nickname_subdir, + '$basepath' => $a->get_hostname(), '$baseurl' => $a->get_baseurl())); $o = file_get_contents('view/settings.tpl'); diff --git a/view/dfrn_request.tpl b/view/dfrn_request.tpl index df935ae2ad..c1a7b1d9b0 100644 --- a/view/dfrn_request.tpl +++ b/view/dfrn_request.tpl @@ -2,13 +2,14 @@

Personal Introduction

-You may introduce yourself to this member if you have a valid DFRN profile. +You may introduce yourself to this member if you have a valid profile locator
+on the Distributed Friends and Relations Network (DFRN).

- +
diff --git a/view/head.tpl b/view/head.tpl index 8ffd639330..b384d6fc05 100644 --- a/view/head.tpl +++ b/view/head.tpl @@ -7,3 +7,20 @@ + + + diff --git a/view/profile.php b/view/profile.php index d95edb952e..e8de331e1f 100644 --- a/view/profile.php +++ b/view/profile.php @@ -20,7 +20,7 @@ diff --git a/view/settings.tpl b/view/settings.tpl index d73e45a413..baf1178447 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -1,5 +1,8 @@

Account Settings

+$nickname_block + +
@@ -14,7 +17,6 @@
-$nickname_block
diff --git a/view/settings_nick_set.tpl b/view/settings_nick_set.tpl index 8b110457c0..3524fc1bc3 100644 --- a/view/settings_nick_set.tpl +++ b/view/settings_nick_set.tpl @@ -1,10 +1,10 @@

-Your nickname cannot be changed. It is set to $nickname.
-Your profile is located at '$baseurl/profile/$nickname',
-and you may use this as your profile URL when communicating with other
-sites or simply '$nickname@$basepath'. +Your site nickname is $nickname and cannot be changed.
+Your profile locator is '$nickname@$basepath'.

+$subdir +
diff --git a/view/settings_nick_subdir.tpl b/view/settings_nick_subdir.tpl new file mode 100644 index 0000000000..401a6fd4bd --- /dev/null +++ b/view/settings_nick_subdir.tpl @@ -0,0 +1,7 @@ +

+It appears that your website is located in a subdirectory of the
+$hostname website and this setting may not work reliably.
+

+

If you have any issues, you may have better results using the profile
+locator '$baseurl/profile/$nickname'. +

\ No newline at end of file diff --git a/view/style.css b/view/style.css index 128464b1d5..58579ae480 100644 --- a/view/style.css +++ b/view/style.css @@ -210,6 +210,10 @@ input#dfrn-url { margin-left: 50px; } +#settings-nick-wrapper { + margin-bottom: 30px; +} + #settings-username-end, #settings-email-end, #settings-nick-end, #settings-timezone-end, #settings-password-end, #settings-confirm-end { margin-bottom: 5px; clear: both;