aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorhabeascodice <habeascodice@federated.social>2014-09-28 19:31:19 -0700
committerhabeascodice <habeascodice@federated.social>2014-09-28 19:31:19 -0700
commit73ebdff0837a713d8849b713d0cc2fb4701a2c5f (patch)
tree7656a07d3eb8d87d12b72cc86559bba157e60343 /mod
parentc0b59ae36a5ef31b9071edb991f63d4800e21a9d (diff)
parente18dfbe3ce0a8d89a5320e4f239801d0b84dd83e (diff)
downloadvolse-hubzilla-73ebdff0837a713d8849b713d0cc2fb4701a2c5f.tar.gz
volse-hubzilla-73ebdff0837a713d8849b713d0cc2fb4701a2c5f.tar.bz2
volse-hubzilla-73ebdff0837a713d8849b713d0cc2fb4701a2c5f.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/p.php52
-rw-r--r--mod/photos.php4
-rw-r--r--mod/siteinfo.php52
3 files changed, 104 insertions, 4 deletions
diff --git a/mod/p.php b/mod/p.php
new file mode 100644
index 000000000..227f9e24a
--- /dev/null
+++ b/mod/p.php
@@ -0,0 +1,52 @@
+<?php /** @file */
+
+require_once('include/bb2diaspora.php');
+
+// used in Diaspora communications to provide a server copy of a sent post in XML format.
+
+function p_init(&$a) {
+
+ if(argc() < 2)
+ http_status_exit(401);
+
+ $mid = str_replace('.xml','',argv(1));
+
+ $r = q("select * from item where mid = '%s' and (item_flags & %d) and item_private = 0 limit 1",
+ dbesc($mid),
+ intval(ITEM_WALL)
+ );
+
+
+ if((! $r) || (! perm_is_allowed($r[0]['uid'],'','view_stream')))
+ http_status_exit(404);
+
+
+ $c = q("select * from channel where channel_id = %d limit 1",
+ intval($r[0]['uid'])
+ );
+
+ if(! $c)
+ http_status_exit(404);
+
+ $myaddr = $c[0]['channel_address'] . '@' . $a->get_hostname();
+
+ $item = $r[0];
+
+ $title = $item['title'];
+ $body = bb2diaspora_itembody($item);
+ $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C');
+
+ $tpl = get_markup_template('diaspora_post.tpl');
+ $msg = replace_macros($tpl, array(
+ '$body' => xmlify($body),
+ '$guid' => $item['mid'],
+ '$handle' => xmlify($myaddr),
+ '$public' => 'true',
+ '$created' => $created,
+ '$provider' => (($item['app']) ? $item['app'] : 'redmatrix')
+ ));
+
+ header('Content-type: text/xml');
+ echo $msg;
+ killme();
+} \ No newline at end of file
diff --git a/mod/photos.php b/mod/photos.php
index c2d90184e..0ff0e29c9 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -654,7 +654,7 @@ function photos_content(&$a) {
);
$o .= '<div class="section-title-wrapper">';
- $o .= '<h3>' . $album . '</h3>';
+ $o .= '<h2>' . $album . '</h2>';
$o .= '<div class="section-title-submenu">';
if($cmd === 'edit') {
if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) {
@@ -1238,7 +1238,7 @@ function photos_content(&$a) {
$o .= replace_macros($tpl, array(
'$title' => t('Recent Photos'),
'$can_post' => $can_post,
- '$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'),
+ '$upload' => array(t('Upload'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'),
'$photos' => $photos,
));
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 01355a51d..bdae14edb 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -48,6 +48,51 @@ function siteinfo_init(&$a) {
$site_info = get_config('system','info');
$site_name = get_config('system','sitename');
+
+ // Statistics (from statistics.json plugin)
+
+ $r = q("select count(channel_id) as channels_total from channel left join account on account_id = channel_account_id
+ where account_flags = 0 ");
+ if($r)
+ $channels_total = $r[0]['channels_total'];
+
+ $r = q("select channel_id from channel left join account on account_id = channel_account_id
+ where account_flags = 0 and account_lastlog > UTC_TIMESTAMP - INTERVAL 6 MONTH");
+ if($r) {
+ $s = '';
+ foreach($r as $rr) {
+ if($s)
+ $s .= ',';
+ $s .= intval($rr['channel_id']);
+ }
+ $x = q("select uid from item where uid in ( $s ) and (item_flags & %d) and created > UTC_TIMESTAMP - INTERVAL 6 MONTH group by uid",
+ intval(ITEM_WALL)
+ );
+ if($x)
+ $channels_active_halfyear = count($x);
+ }
+
+ $r = q("select channel_id from channel left join account on account_id = channel_account_id
+ where account_flags = 0 and account_lastlog > UTC_TIMESTAMP - INTERVAL 1 MONTH");
+ if($r) {
+ $s = '';
+ foreach($r as $rr) {
+ if($s)
+ $s .= ',';
+ $s .= intval($rr['channel_id']);
+ }
+ $x = q("select uid from item where uid in ( $s ) and ( item_flags & %d ) and created > UTC_TIMESTAMP - INTERVAL 1 MONTH group by uid",
+ intval(ITEM_WALL)
+ );
+ if($x)
+ $channels_active_monthly = count($x);
+ }
+
+ $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE (item_flags & %d) ",
+ intval(ITEM_WALL)
+ );
+ if (is_array($posts))
+ $local_posts = $posts[0]["local_posts"];
$data = Array(
'version' => RED_VERSION,
@@ -61,9 +106,12 @@ function siteinfo_init(&$a) {
'admin' => $admin,
'site_name' => (($site_name) ? $site_name : ''),
'platform' => RED_PLATFORM,
- 'info' => (($site_info) ? $site_info : '')
+ 'info' => (($site_info) ? $site_info : ''),
+ 'channels_total' => $channels_total,
+ 'channels_active_halfyear' => $channels_active_halfyear,
+ 'channels_active_monthly' => $channels_active_monthly,
+ 'local_posts' => $local_posts
);
-
json_return_and_die($data);
}
}