diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-07-19 22:52:31 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-07-19 22:52:31 -0700 |
commit | ba8da761e669b22e16e1075e0e1e79d8b458af3e (patch) | |
tree | 61c82c4cb260a88e4d8659a976f2bfb50035eb18 /mod | |
parent | c3fd5ed73202f4dd17dda87ac968b0db4f44d423 (diff) | |
download | volse-hubzilla-ba8da761e669b22e16e1075e0e1e79d8b458af3e.tar.gz volse-hubzilla-ba8da761e669b22e16e1075e0e1e79d8b458af3e.tar.bz2 volse-hubzilla-ba8da761e669b22e16e1075e0e1e79d8b458af3e.zip |
more cleanup - start on ajax
Diffstat (limited to 'mod')
-rw-r--r-- | mod/ping.php | 36 | ||||
-rw-r--r-- | mod/settings.php | 31 |
2 files changed, 57 insertions, 10 deletions
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'); |