more cleanup - start on ajax
This commit is contained in:
parent
c3fd5ed732
commit
ba8da761e6
5
boot.php
5
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'];
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
$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";
|
||||
|
||||
|
|
36
mod/ping.php
Normal file
36
mod/ping.php
Normal file
|
@ -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();
|
||||
}
|
||||
|
|
@ -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_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');
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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" >
|
||||
|
|
|
@ -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>
|
||||
|
|
7
view/settings_nick_subdir.tpl
Normal file
7
view/settings_nick_subdir.tpl
Normal file
|
@ -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>
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue