aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-19 22:52:31 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-19 22:52:31 -0700
commitba8da761e669b22e16e1075e0e1e79d8b458af3e (patch)
tree61c82c4cb260a88e4d8659a976f2bfb50035eb18
parentc3fd5ed73202f4dd17dda87ac968b0db4f44d423 (diff)
downloadvolse-hubzilla-ba8da761e669b22e16e1075e0e1e79d8b458af3e.tar.gz
volse-hubzilla-ba8da761e669b22e16e1075e0e1e79d8b458af3e.tar.bz2
volse-hubzilla-ba8da761e669b22e16e1075e0e1e79d8b458af3e.zip
more cleanup - start on ajax
-rw-r--r--boot.php5
-rw-r--r--include/nav.php5
-rw-r--r--mod/ping.php36
-rw-r--r--mod/settings.php31
-rw-r--r--view/dfrn_request.tpl5
-rw-r--r--view/head.tpl17
-rw-r--r--view/profile.php2
-rw-r--r--view/settings.tpl4
-rw-r--r--view/settings_nick_set.tpl8
-rw-r--r--view/settings_nick_subdir.tpl7
-rw-r--r--view/style.css4
11 files changed, 104 insertions, 20 deletions
diff --git a/boot.php b/boot.php
index 56d85f638..5efa9a24f 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 a7a2cf3f8..b788ed48a 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -12,7 +12,8 @@
$a->page['nav'] .= "<a id=\"nav-notify-link\" class=\"nav-commlink\" href=\"notifications\">Notifications</a>\r\n";
$a->page['nav'] .= "<a id=\"nav-messages-link\" class=\"nav-commlink\" href=\"Messages\">Messages</a>\r\n";
-
+
+ $a->page['nav'] .= "<div id=\"nav-notify\" class=\"nav-notify\"></div>\r\n";
$a->page['nav'] .= "<a id=\"nav-logout-link\" class=\"nav-link\" href=\"logout\">Logout</a>\r\n";
@@ -22,7 +23,7 @@
$a->page['nav'] .= "<a id=\"nav-contacts-link\" class=\"nav-link\" href=\"contacts\">Contacts</a>\r\n";
- $a->page['nav'] .= "<a id=\"nav-home-link\" class=\"nav-link\" href=\"profile/{$_SESSION['uid']}\">Home</a>\r\n";
+ $a->page['nav'] .= "<a id=\"nav-home-link\" class=\"nav-link\" href=\"profile/{$a->user['nickname']}\">Home</a>\r\n";
$a->page['nav'] .= "<a id=\"nav-network-link\" class=\"nav-link\" href=\"network\">Network</a>\r\n";
diff --git a/mod/ping.php b/mod/ping.php
new file mode 100644
index 000000000..bc160ade7
--- /dev/null
+++ b/mod/ping.php
@@ -0,0 +1,36 @@
+<?php
+
+
+
+function ping_init(&$a) {
+
+ if(! local_user())
+ xml_status(0);
+
+ $r = q("SELECT COUNT(*) AS `total` FROM `item`
+ WHERE `unseen` = 1 AND `uid` = %d",
+ intval($_SESSION['uid'])
+ );
+ $network = $r[0]['total'];
+
+ $r = q("SELECT COUNT(*) AS `total` FROM `item`
+ WHERE `unseen` = 1 AND `uid` = %d AND `type` != 'remote' ",
+ intval($_SESSION['uid'])
+ );
+ $home = $r[0]['total'];
+
+ $r = q("SELECT COUNT(*) AS `total` FROM `intro`
+ WHERE `uid` = %d AND `blocked` = 0 AND `ignore` = 0 ",
+ intval($_SESSION['uid'])
+ );
+ $intro = $r[0]['total'];
+
+ // TODO
+ $mail = 0;
+
+ header("Content-type: text/xml");
+ echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<result><intro>$intro</intro><mail>$mail</mail><net>$network</net><home>$home</home></result>\r\n";
+
+ killme();
+}
+
diff --git a/mod/settings.php b/mod/settings.php
index 54fca992c..bd779ad4e 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 df935ae2a..c1a7b1d9b 100644
--- a/view/dfrn_request.tpl
+++ b/view/dfrn_request.tpl
@@ -2,13 +2,14 @@
<h1>Personal Introduction</h1>
<p id="dfrn-request-intro">
-You may introduce yourself to this member if you have a valid <a href="http://dfrn.org">DFRN profile</a>.
+You may introduce yourself to this member if you have a valid profile locator<br />
+on the <a href="http://dfrn.org">Distributed Friends and Relations Network (DFRN)</a>.
</p>
<form action="dfrn_request/$uid" method="post" />
<div id="dfrn-request-url-wrapper" >
- <label id="dfrn-url-label" for="dfrn-url" >Your DFRN Profile URL:</label>
+ <label id="dfrn-url-label" for="dfrn-url" >Your profile location:</label>
<input type="text" name="dfrn_url" id="dfrn-url" size="32" />
<div id="dfrn-request-url-end"></div>
</div>
diff --git a/view/head.tpl b/view/head.tpl
index 8ffd63933..b384d6fc0 100644
--- a/view/head.tpl
+++ b/view/head.tpl
@@ -7,3 +7,20 @@
<![endif]-->
<script type="text/javascript" src="$baseurl/include/jquery.js" ></script>
<script type="text/javascript" src="$baseurl/include/main.js" ></script>
+
+<script type="text/javascript">
+// $(document).ready(function() { setTimeout(NavUpdate,10 * 1000); });
+
+function NavUpdate()
+ {
+ $.get("ping",function(data)
+ {
+ $(data).find('result').each(function() {
+ var net = $(this).find('net').text();
+ alert(net);
+ });
+ }) ;
+ setTimeout(NavUpdate,10 * 1000);
+ }
+</script>
+
diff --git a/view/profile.php b/view/profile.php
index d95edb952..e8de331e1 100644
--- a/view/profile.php
+++ b/view/profile.php
@@ -20,7 +20,7 @@
<div id="profile-extra-links">
- <a id="dfrn-request-link" href="dfrn_request/<?php echo $profile['uid']; ?>">Introductions</a>
+ <a id="dfrn-request-link" href="dfrn_request/<?php echo $profile['nickname']; ?>">Introductions</a>
</div>
diff --git a/view/settings.tpl b/view/settings.tpl
index d73e45a41..baf117844 100644
--- a/view/settings.tpl
+++ b/view/settings.tpl
@@ -1,5 +1,8 @@
<h1>Account Settings</h1>
+$nickname_block
+
+
<form action="settings" id="settings-form" method="post" >
<div id="settings-username-wrapper" >
@@ -14,7 +17,6 @@
</div>
<div id="settings-email-end" ></div>
-$nickname_block
<div id="settings-timezone-wrapper" >
diff --git a/view/settings_nick_set.tpl b/view/settings_nick_set.tpl
index 8b110457c..3524fc1bc 100644
--- a/view/settings_nick_set.tpl
+++ b/view/settings_nick_set.tpl
@@ -1,10 +1,10 @@
<div id="settings-nick-wrapper" >
<p id="settings-nickname-desc">
-Your nickname cannot be changed. It is set to <strong>$nickname</strong>.<br />
-Your profile is located at <strong>'$baseurl/profile/$nickname'</strong>,<br />
-and you may use this as your profile URL when communicating with other<br />
-sites or simply <strong>'$nickname@$basepath'</strong>.
+Your site nickname is <strong>$nickname</strong> and cannot be changed.<br />
+Your profile locator is <strong>'$nickname@$basepath'</strong>.
</p>
+$subdir
+
</div>
<div id="settings-nick-end" ></div>
diff --git a/view/settings_nick_subdir.tpl b/view/settings_nick_subdir.tpl
new file mode 100644
index 000000000..401a6fd4b
--- /dev/null
+++ b/view/settings_nick_subdir.tpl
@@ -0,0 +1,7 @@
+<p>
+It appears that your website is located in a subdirectory of the<br />
+$hostname website and this setting may not work reliably.<br />
+</p>
+<p>If you have any issues, you may have better results using the profile<br />
+locator '<strong>$baseurl/profile/$nickname</strong>'.
+</p> \ No newline at end of file
diff --git a/view/style.css b/view/style.css
index 128464b1d..58579ae48 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;