aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorHabeas Codice <habeascodice@federated.social>2014-11-13 13:06:31 -0800
committerHabeas Codice <habeascodice@federated.social>2014-11-13 13:06:31 -0800
commitac27db22c18ee7a82a52cbadb3efe2760b910499 (patch)
treeaa7002d73dbcd4136033589f1cb135184f4126c1 /mod
parent1a5a5c7edb8697c93f8bababbafa80245378dd7e (diff)
parent109cb936632c693d3f24afb9e2ce533797ad1a7f (diff)
downloadvolse-hubzilla-ac27db22c18ee7a82a52cbadb3efe2760b910499.tar.gz
volse-hubzilla-ac27db22c18ee7a82a52cbadb3efe2760b910499.tar.bz2
volse-hubzilla-ac27db22c18ee7a82a52cbadb3efe2760b910499.zip
Merge remote-tracking branch 'upstream/master'
Conflicts: boot.php include/dba/dba_driver.php include/diaspora.php include/follow.php include/session.php include/zot.php mod/photos.php mod/ping.php
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php53
-rw-r--r--mod/blocks.php160
-rw-r--r--mod/connedit.php29
-rw-r--r--mod/directory.php63
-rw-r--r--mod/dirprofile.php184
-rw-r--r--mod/dirsearch.php2
-rw-r--r--mod/editblock.php197
-rw-r--r--mod/editlayout.php216
-rw-r--r--mod/editwebpage.php107
-rw-r--r--mod/item.php38
-rw-r--r--mod/layouts.php119
-rw-r--r--mod/locs.php70
-rw-r--r--mod/menu.php72
-rw-r--r--mod/mitem.php118
-rw-r--r--mod/photos.php119
-rw-r--r--mod/ping.php192
-rw-r--r--mod/profiles.php18
-rw-r--r--mod/settings.php55
-rw-r--r--mod/webpages.php149
-rw-r--r--mod/zfinger.php16
20 files changed, 1123 insertions, 854 deletions
diff --git a/mod/admin.php b/mod/admin.php
index cbb2395b7..0e580960a 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -238,7 +238,6 @@ function admin_page_site_post(&$a){
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
$theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : '');
- $theme_accessibility = ((x($_POST,'theme_accessibility')) ? notags(trim($_POST['theme_accessibility'])) : '');
// $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : '');
$maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
@@ -298,12 +297,6 @@ function admin_page_site_post(&$a){
} else {
set_config('system','mobile_theme', $theme_mobile);
}
- if ( $theme_accessibility === '---' ) {
- del_config('system','accessibility_theme');
- } else {
- set_config('system','accessibility_theme', $theme_accessibility);
- }
-
// set_config('system','site_channel', $site_channel);
set_config('system','maximagesize', $maximagesize);
@@ -357,27 +350,32 @@ function admin_page_site(&$a) {
}
/* Installed themes */
- $theme_choices = array();
- $theme_choices_mobile = array();
- $theme_choices_mobile["---"] = t("No special theme for mobile devices");
- $theme_choices_accessibility = array();
- $theme_choices_accessibility["---"] =t("No special theme for accessibility");
- $files = glob('view/theme/*');
- if($files) {
- foreach($files as $file) {
- $f = basename($file);
- $theme_name = ((file_exists($file . '/experimental')) ? sprintf("%s - Experimental", $f) : $f);
- if (file_exists($file . '/mobile')) {
- $theme_choices_mobile[$f] = $theme_name;
- }
- if (file_exists($file . '/accessibility')) {
- $theme_choices_accessibility[$f] = $theme_name;
+ $theme_choices_mobile["---"] = t("Default");
+ $theme_choices = array();
+ $files = glob('view/theme/*');
+ if($files) {
+ foreach($files as $file) {
+ $vars = '';
+ $f = basename($file);
+ if (file_exists($file . '/library'))
+ continue;
+ if (file_exists($file . '/mobile'))
+ $vars = t('mobile');
+ if (file_exists($file . '/experimental'))
+ $vars .= t('experimental');
+ if (file_exists($file . '/unsupported'))
+ $vars .= t('unsupported');
+ if ($vars) {
+ $theme_choices[$f] = $f . ' (' . $vars . ')';
+ $theme_choices_mobile[$f] = $f . ' (' . $vars . ')';
}
- $theme_choices[$f] = $theme_name;
- }
- }
-
-
+ else {
+ $theme_choices[$f] = $f;
+ $theme_choices_mobile[$f] = $f;
+ }
+ }
+ }
+
/* Banner */
$banner = get_config('system','banner');
if($banner == false)
@@ -425,7 +423,6 @@ function admin_page_site(&$a) {
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
'$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
- '$theme_accessibility' => array('theme_accessibility', t("Accessibility system theme"), get_config('system','accessibility_theme'), t("Accessibility theme"), $theme_choices_accessibility),
// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
'$diaspora_enabled' => array('diaspora_enabled',t('Enable Diaspora Protocol'), get_config('system','diaspora_enabled'), t('Communicate with Diaspora and Friendica - experimental')),
'$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
diff --git a/mod/blocks.php b/mod/blocks.php
index 3f2bef116..6237a645b 100644
--- a/mod/blocks.php
+++ b/mod/blocks.php
@@ -1,108 +1,140 @@
<?php
-function blocks_content(&$a) {
+require_once('include/identity.php');
+require_once('include/conversation.php');
+require_once('include/acl_selectors.php');
+function blocks_init(&$a) {
+ if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $a->is_sys = true;
+ }
+ }
if(argc() > 1)
$which = argv(1);
- else {
+ else
+ return;
+
+ profile_load($a,$which);
+
+}
+
+
+function blocks_content(&$a) {
+
+ if(! $a->profile) {
notice( t('Requested profile is not available.') . EOL );
$a->error = 404;
return;
}
- profile_load($a,$which,0);
+ $which = argv(1);
+ $uid = local_user();
+ $owner = 0;
+ $channel = null;
+ $observer = $a->get_observer();
- // Figure out who the page owner is.
- $r = q("select channel_id from channel where channel_address = '%s'",
- dbesc($which)
- );
- if($r) {
- $owner = intval($r[0]['channel_id']);
- }
+ $channel = $a->get_channel();
- // Block design features from visitors
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $uid = $owner = intval($sys['channel_id']);
+ $channel = $sys;
+ $observer = $sys;
+ }
+ }
- if((! local_user()) || (local_user() != $owner)) {
- notice( t('Permission denied.') . EOL);
- return;
+ if(! $owner) {
+ // Figure out who the page owner is.
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
+ );
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
}
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ $perms = get_all_perms($owner,$ob_hash);
+ if(! $perms['write_pages']) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
-// Get the observer, check their permissions
- $observer = $a->get_observer();
- $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ // Block design features from visitors
- $perms = get_all_perms($owner,$ob_hash);
+ if((! $uid) || ($uid != $owner)) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
- if(! $perms['write_pages']) {
- notice( t('Permission denied.') . EOL);
- return;
- }
+ if(feature_enabled($owner,'expert')) {
+ $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
+ if(! $mimetype)
+ $mimetype = 'choose';
+ }
+ else {
+ $mimetype = 'text/bbcode';
+ }
-// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
-// Nickname is set to the observers xchan, and profile_uid to the owners.
-// This lets you post pages at other people's channels.
-require_once ('include/conversation.php');
- $x = array(
- 'webpage' => ITEM_BUILDBLOCK,
- 'is_owner' => true,
- 'nickname' => $a->profile['channel_address'],
- 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
- 'bang' => (($group || $cid) ? '!' : ''),
- 'showacl' => false,
- 'visitor' => true,
- 'mimetype' => 'choose',
- 'ptlabel' => t('Block Name'),
- 'profile_uid' => intval($owner),
- );
- if($_REQUEST['title'])
- $x['title'] = $_REQUEST['title'];
- if($_REQUEST['body'])
- $x['body'] = $_REQUEST['body'];
- if($_REQUEST['pagetitle'])
- $x['pagetitle'] = $_REQUEST['pagetitle'];
+ $x = array(
+ 'webpage' => ITEM_BUILDBLOCK,
+ 'is_owner' => true,
+ 'nickname' => $a->profile['channel_address'],
+ 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
+ 'bang' => '',
+ 'showacl' => false,
+ 'visitor' => true,
+ 'mimetype' => $mimetype,
+ 'ptlabel' => t('Block Name'),
+ 'profile_uid' => intval($owner),
+ );
+ if($_REQUEST['title'])
+ $x['title'] = $_REQUEST['title'];
+ if($_REQUEST['body'])
+ $x['body'] = $_REQUEST['body'];
+ if($_REQUEST['pagetitle'])
+ $x['pagetitle'] = $_REQUEST['pagetitle'];
- $o .= status_editor($a,$x);
- //Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
-//TODO - this should be replaced with pagelist_widget
+ $o .= status_editor($a,$x);
-$r = q("select * from item_id where uid = %d and service = 'BUILDBLOCK' order by sid asc",
- intval($owner)
-);
+ $r = q("select * from item_id where uid = %d and service = 'BUILDBLOCK' order by sid asc",
+ intval($owner)
+ );
- $pages = null;
+ $pages = null;
- if($r) {
- $pages = array();
- foreach($r as $rr) {
- $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
- }
- }
+ if($r) {
+ $pages = array();
+ foreach($r as $rr) {
+ $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
+ }
+ }
+ //Build the base URL for edit links
+ $url = z_root() . '/editblock/' . $which;
-//Build the base URL for edit links
- $url = z_root() . "/editblock/" . $which;
-// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
- return $o . replace_macros(get_markup_template("blocklist.tpl"), array(
+ $o .= replace_macros(get_markup_template('blocklist.tpl'), array(
'$baseurl' => $url,
'$edit' => t('Edit'),
'$pages' => $pages,
'$channel' => $which,
'$view' => t('View'),
'$preview' => '1',
-
- ));
+ ));
-
+ return $o;
}
diff --git a/mod/connedit.php b/mod/connedit.php
index dd69b3d31..917e2c73b 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -68,6 +68,14 @@ function connedit_post(&$a) {
call_hooks('contact_edit_post', $_POST);
+ if($orig_record[0]['abook_flags'] & ABOOK_FLAG_SELF) {
+ $autoperms = intval($_POST['autoperms']);
+ }
+ else {
+ $autoperms = null;
+ }
+
+
$profile_id = $_POST['profile_assign'];
if($profile_id) {
$r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1",
@@ -121,7 +129,7 @@ function connedit_post(&$a) {
if($orig_record[0]['abook_profile'] != $profile_id) {
//Update profile photo permissions
- logger('As a new profile was assigned updating profile photos');
+ logger('A new profile was assigned - updating profile photos');
require_once('mod/profile_photo.php');
profile_photo_set_profile_perms($profile_id);
@@ -208,6 +216,10 @@ function connedit_post(&$a) {
$arr = array('channel_id' => local_user(), 'abook' => $a->poi);
call_hooks('accept_follow', $arr);
}
+dbg(1);
+ if(! is_null($autoperms))
+ set_pconfig(local_user(),'system','autoperms',(($autoperms) ? $abook_my_perms : 0));
+dbg(0);
connedit_clone($a);
@@ -261,12 +273,8 @@ function connedit_content(&$a) {
$x = get_role_perms($role);
if($x['perms_accept'])
$my_perms = $x['perms_accept'];
- else {
- // fixme - we need to be able to define these somewhere for the custom role
- $my_perms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
- |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
- |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE;
- }
+ else
+ $my_perms = get_channel_default_perms(local_user());
}
if($my_perms) {
$o .= "<script>function connectDefaultShare() {
@@ -522,16 +530,17 @@ function connedit_content(&$a) {
if((! $self) && ($existing[$k]))
$thisperm = "1";
- $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4]);
+ $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC || $self) ? '' : '1'), $v[4]);
}
$o .= replace_macros($tpl,array(
- '$header' => (($self) ? t('Automatic Permissions Settings') : sprintf( t('Connections: settings for %s'),$contact['xchan_name'])),
+ '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connections: settings for %s'),$contact['xchan_name'])),
+ '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_user(),'system','autoperms')) ? 1 : 0), ''),
'$addr' => $contact['xchan_addr'],
'$notself' => (($self) ? '' : '1'),
'$self' => (($self) ? '1' : ''),
- '$autolbl' => t('When receiving a channel introduction, any permissions provided here will be applied to the new connection automatically and the introduction approved. Leave this page if you do not wish to use this feature.'),
+ '$autolbl' => t('Apply the permissions indicated on this page to all new connections.'),
'$viewprof' => t('View Profile'),
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
'$slide' => $slide,
diff --git a/mod/directory.php b/mod/directory.php
index 3d7632ec0..d4a4c383a 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -2,7 +2,7 @@
require_once('include/dir_fns.php');
require_once('include/widgets.php');
-
+require_once('include/bbcode.php');
function directory_init(&$a) {
$a->set_pager_itemspage(60);
@@ -42,7 +42,8 @@ function directory_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
- $advanced = ((x($_REQUEST,'query')) ? notags(trim($_REQUEST['query'])) : '');
+ if(strpos($search,'=') && local_user() && get_pconfig(local_user(),'feature','expert'))
+ $advanced = $search;
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
@@ -122,6 +123,10 @@ function directory_content(&$a) {
$pdesc = (($rr['description']) ? $rr['description'] . '<br />' : '');
$connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
+ // Checking status is disabled ATM until someone checks the performance impact more carefully
+ //$online = remote_online_status($rr['address']);
+ $online = '';
+
if(in_array($rr['hash'],$contacts))
$connect_link = '';
@@ -142,8 +147,6 @@ function directory_content(&$a) {
if(($years = age($rr['birthday'],'UTC','')) != 0)
$details .= '<br />' . t('Age: ') . $years ;
}
- if(strlen($rr['gender']))
- $details .= '<br />' . t('Gender: ') . $rr['gender'];
$page_type = '';
@@ -155,18 +158,53 @@ function directory_content(&$a) {
|| (x($profile,'country') == 1))
$location = t('Location:');
- $gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
+ $gender = ((x($profile,'gender') == 1) ? t('Gender: ') . $profile['gender']: False);
- $marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
+ $marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital']: False);
- $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
-
- $about = ((x($profile,'about') == 1) ? t('About:') : False);
+ $homepage = ((x($profile,'homepage') == 1) ? t('Homepage: ') : False);
+ $homepageurl = ((x($profile,'homepage') == 1) ? $profile['homepage'] : '');
+
+ $hometown = ((x($profile,'hometown') == 1) ? t('Hometown: ') . $profile['hometown'] : False);
+
+ $about = ((x($profile,'about') == 1) ? t('About: ') . bbcode($profile['about']) : False);
+
+ $keywords = ((x($profile,'keywords')) ? $profile['keywords'] : '');
+
+ $out = '';
+
+ if($keywords) {
+ $keywords = str_replace(',',' ', $keywords);
+ $keywords = str_replace(' ',' ', $keywords);
+ $karr = explode(' ', $keywords);
+
+ if($karr) {
+ if(local_user()) {
+ $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
+ intval(local_user())
+ );
+ if($r) {
+ $keywords = str_replace(',',' ', $r[0]['keywords']);
+ $keywords = str_replace(' ',' ', $keywords);
+ $marr = explode(' ', $keywords);
+ }
+ }
+ foreach($karr as $k) {
+ if(strlen($out))
+ $out .= ', ';
+ if($marr && in_arrayi($k,$marr))
+ $out .= '<strong>' . $k . '</strong>';
+ else
+ $out .= $k;
+ }
+ }
+ }
$entry = array(
'id' => ++$t,
'profile_link' => $profile_link,
+ 'public_forum' => $rr['public_forum'],
'photo' => $rr['photo'],
'hash' => $rr['hash'],
'alttext' => $rr['name'] . ' ' . $rr['address'],
@@ -174,14 +212,21 @@ function directory_content(&$a) {
'details' => $pdesc . $details,
'profile' => $profile,
'address' => $rr['address'],
+ 'nickname' => substr($rr['address'],0,strpos($rr['address'],'@')),
'location' => $location,
'gender' => $gender,
'pdesc' => $pdesc,
'marital' => $marital,
'homepage' => $homepage,
+ 'homepageurl' => linkify($homepageurl),
+ 'hometown' => $hometown,
'about' => $about,
'conn_label' => t('Connect'),
+ 'forum_label' => t('Public Forum:'),
'connect' => $connect_link,
+ 'online' => $online,
+ 'kw' => (($out) ? t('Keywords: ') : ''),
+ 'keywords' => $out,
);
$arr = array('contact' => $rr, 'entry' => $entry);
diff --git a/mod/dirprofile.php b/mod/dirprofile.php
deleted file mode 100644
index e9b12ada7..000000000
--- a/mod/dirprofile.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-
-require_once('include/dir_fns.php');
-require_once('include/bbcode.php');
-
-function dirprofile_init(&$a) {
-
- if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
- notice( t('Public access denied.') . EOL);
- return;
- }
-
- $hash = $_REQUEST['hash'];
- if(! $hash)
- return '';
-
- $o = '';
-
- $dirmode = intval(get_config('system','directory_mode'));
-
- if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
- $url = z_root() . '/dirsearch';
- }
- if(! $url) {
- $directory = find_upstream_directory($dirmode);
- $url = $directory['url'] . '/dirsearch';
- }
- logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
-
- $contacts = array();
-
- if(local_user()) {
- $x = q("select abook_xchan from abook where abook_channel = %d",
- intval(local_user())
- );
- if($x) {
- foreach($x as $xx)
- $contacts[] = $xx['abook_xchan'];
- }
- }
-
-
-
- if($url) {
-
- $query = $url . '?f=&hash=' . $hash;
-
- $x = z_fetch_url($query);
- logger('dirprofile: return from upstream: ' . print_r($x,true), LOGGER_DATA);
-
- if($x['success']) {
- $t = 0;
- $j = json_decode($x['body'],true);
- if($j) {
-
- if($j['results']) {
-
- $entries = array();
-
- $photo = 'thumb';
-
- foreach($j['results'] as $rr) {
-
- $profile_link = chanlink_url($rr['url']);
-
- $pdesc = (($rr['description']) ? $rr['description'] . '<br />' : '');
-
- $qrlink = zid($rr['url']);
- $connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
-
- $online = remote_online_status($rr['address']);
-
-
- if(in_array($rr['hash'],$contacts))
- $connect_link = '';
-
- $details = '';
- if(strlen($rr['locale']))
- $details .= $rr['locale'];
- if(strlen($rr['region'])) {
- if(strlen($rr['locale']))
- $details .= ', ';
- $details .= $rr['region'];
- }
- if(strlen($rr['country'])) {
- if(strlen($details))
- $details .= ', ';
- $details .= $rr['country'];
- }
- if(strlen($rr['birthday'])) {
- if(($years = age($rr['birthday'],'UTC','')) != 0)
- $details .= '<br />' . t('Age: ') . $years ;
- }
- if(strlen($rr['gender']))
- $details .= '<br />' . t('Gender: ') . $rr['gender'];
-
- $page_type = '';
-
- $profile = $rr;
-
- if ((x($profile,'locale') == 1)
- || (x($profile,'region') == 1)
- || (x($profile,'postcode') == 1)
- || (x($profile,'country') == 1))
- $location = t('Location:');
-
-
- $marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital'] : False);
- $sexual = ((x($profile,'sexual') == 1) ? t('Sexual Preference: ') . $profile['sexual'] : False);
-
- $homepage = ((x($profile,'homepage') == 1) ? t('Homepage: ') . linkify($profile['homepage']) : False);
- $hometown = ((x($profile,'hometown') == 1) ? t('Hometown: ') . $profile['hometown'] : False);
-
- $about = ((x($profile,'about') == 1) ? t('About: ') . bbcode($profile['about']) : False);
-
- $keywords = ((x($profile,'keywords')) ? $profile['keywords'] : '');
- if($keywords) {
- $keywords = str_replace(',',' ', $keywords);
- $keywords = str_replace(' ',' ', $keywords);
- $karr = explode(' ', $keywords);
- $out = '';
- if($karr) {
- if(local_user()) {
- $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
- intval(local_user())
- );
- if($r) {
- $keywords = str_replace(',',' ', $r[0]['keywords']);
- $keywords = str_replace(' ',' ', $keywords);
- $marr = explode(' ', $keywords);
- }
- }
- foreach($karr as $k) {
- if(strlen($out))
- $out .= ', ';
- if($marr && in_arrayi($k,$marr))
- $out .= '<strong>' . $k . '</strong>';
- else
- $out .= $k;
- }
- }
-
- }
- $entry = replace_macros(get_markup_template('direntry_large.tpl'), array(
- '$id' => ++$t,
- '$profile_link' => $profile_link,
- '$qrlink' => $qrlink,
- '$photo' => $rr['photo_l'],
- '$alttext' => $rr['name'] . ' ' . $rr['address'],
- '$name' => $rr['name'],
- '$online' => (($online) ? t('Online Now') : ''),
- '$details' => $pdesc . $details,
- '$profile' => $profile,
- '$address' => $rr['address'],
- '$location' => $location,
- '$gender' => $gender,
- '$pdesc' => $pdesc,
- '$marital' => $marital,
- '$homepage' => $homepage,
- '$hometown' => $hometown,
- '$about' => $about,
- '$kw' => (($out) ? t('Keywords: ') : ''),
- '$keywords' => $out,
- '$conn_label' => t('Connect'),
- '$connect' => $connect_link,
- ));
-
-
- echo $entry;
- killme();
-
- }
- }
- else {
- info( t("Not found.") . EOL);
- }
- }
- }
- }
-
-
-
-
-} \ No newline at end of file
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 485f99b38..dea34c566 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -226,6 +226,8 @@ function dirsearch_content(&$a) {
$entry['name'] = $rr['xchan_name'];
$entry['hash'] = $rr['xchan_hash'];
+ $entry['public_forum'] = (($rr['xchan_flags'] & XCHAN_FLAGS_PUBFORUM) ? true : false);
+
$entry['url'] = $rr['xchan_url'];
$entry['photo_l'] = $rr['xchan_photo_l'];
$entry['photo'] = $rr['xchan_photo_m'];
diff --git a/mod/editblock.php b/mod/editblock.php
index 3b6ce4bbf..c58a93410 100644
--- a/mod/editblock.php
+++ b/mod/editblock.php
@@ -1,50 +1,92 @@
<?php
+require_once('include/identity.php');
+require_once('include/acl_selectors.php');
-function editblock_content(&$a) {
+function editblock_init(&$a) {
+ if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $a->is_sys = true;
+ }
+ }
- if(argc() < 2) {
- notice( t('Item not found') . EOL);
+ if(argc() > 1)
+ $which = argv(1);
+ else
return;
- }
- $channel = get_channel_by_nick(argv(1));
+ profile_load($a,$which);
- if($c) {
- $owner = intval($channel['channel_id']);
- }
+}
- $o = '';
+function editblock_content(&$a) {
+
+ if(! $a->profile) {
+ notice( t('Requested profile is not available.') . EOL );
+ $a->error = 404;
+ return;
+ }
- // Figure out which post we're editing
- $post_id = ((argc() > 2) ? intval(argv(2)) : 0);
+ $which = argv(1);
+ $uid = local_user();
+ $owner = 0;
+ $channel = null;
+ $observer = $a->get_observer();
- if(! ($post_id && $channel)) {
- notice( t('Item not found') . EOL);
- return;
+ $channel = $a->get_channel();
+
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $uid = $owner = intval($sys['channel_id']);
+ $channel = $sys;
+ $observer = $sys;
+ }
}
- // Now we've got a post and an owner, let's find out if we're allowed to edit it
+ if(! $owner) {
+ // Figure out who the page owner is.
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
+ );
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
+ }
+
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
- if(! perm_is_allowed($channel['channel_id'],get_observer_hash(),'write_pages')) {
+ if(! perm_is_allowed($owner,$ob_hash,'write_pages')) {
notice( t('Permission denied.') . EOL);
return;
}
+ $is_owner = (($uid && $uid == $owner) ? true : false);
+
+ $o = '';
- // We've already figured out which item we want and whose copy we need, so we don't need anything fancy here
+ // Figure out which post we're editing
+ $post_id = ((argc() > 2) ? intval(argv(2)) : 0);
+
+
+ if(! ($post_id && $owner)) {
+ notice( t('Item not found') . EOL);
+ return;
+ }
+
$itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
intval($post_id),
- intval($channel['channel_id'])
+ intval($owner)
);
if($itm) {
$item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1",
- $itm[0]['id']
+ intval($itm[0]['id'])
);
if($item_id)
$block_title = $item_id[0]['sid'];
@@ -57,10 +99,6 @@ function editblock_content(&$a) {
$plaintext = true;
- // You may or may not be a local user.
-// if(local_user() && feature_enabled(local_user(),'richtext'))
-// $plaintext = false;
-
$mimeselect = '';
$mimetype = $itm[0]['mimetype'];
@@ -79,11 +117,11 @@ function editblock_content(&$a) {
$a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
- '$baseurl' => $a->get_baseurl(),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
- '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
- '$geotag' => '',
- '$nickname' => $channel['channel_address'],
+ '$baseurl' => $a->get_baseurl(),
+ '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
+ '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
+ '$geotag' => '',
+ '$nickname' => $channel['channel_address'],
'$confirmdelete' => t('Delete block?')
));
@@ -96,79 +134,70 @@ function editblock_content(&$a) {
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
-
- //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
-
- // FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD instead of loading a sensible page.
- //So, send folk to the webpage list.
-
$rp = 'blocks/' . $channel['channel_address'];
$o .= replace_macros($tpl,array(
- '$return_path' => $rp,
- '$action' => 'item',
- '$webpage' => ITEM_BUILDBLOCK,
- '$share' => t('Edit'),
- '$upload' => t('Upload photo'),
- '$attach' => t('Attach file'),
- '$weblink' => t('Insert web link'),
- '$youtube' => t('Insert YouTube video'),
- '$video' => t('Insert Vorbis [.ogg] video'),
- '$audio' => t('Insert Vorbis [.ogg] audio'),
- '$setloc' => t('Set your location'),
- '$noloc' => t('Clear browser location'),
- '$wait' => t('Please wait'),
- '$permset' => t('Permission settings'),
- '$ptyp' => $itm[0]['type'],
- '$mimeselect' => $mimeselect,
- '$content' => undo_post_tagging($itm[0]['body']),
- '$post_id' => $post_id,
- '$baseurl' => $a->get_baseurl(),
- '$defloc' => $channel['channel_location'],
- '$visitor' => false,
- '$public' => t('Public post'),
- '$jotnets' => $jotnets,
- '$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
- '$placeholdertitle' => t('Set title'),
- '$pagetitle' => $block_title,
- '$category' => '',
+ '$return_path' => $rp,
+ '$action' => 'item',
+ '$webpage' => ITEM_BUILDBLOCK,
+ '$share' => t('Edit'),
+ '$upload' => t('Upload photo'),
+ '$attach' => t('Attach file'),
+ '$weblink' => t('Insert web link'),
+ '$youtube' => t('Insert YouTube video'),
+ '$video' => t('Insert Vorbis [.ogg] video'),
+ '$audio' => t('Insert Vorbis [.ogg] audio'),
+ '$setloc' => t('Set your location'),
+ '$noloc' => t('Clear browser location'),
+ '$wait' => t('Please wait'),
+ '$permset' => t('Permission settings'),
+ '$ptyp' => $itm[0]['type'],
+ '$mimeselect' => $mimeselect,
+ '$content' => undo_post_tagging($itm[0]['body']),
+ '$post_id' => $post_id,
+ '$baseurl' => $a->get_baseurl(),
+ '$defloc' => $channel['channel_location'],
+ '$visitor' => false,
+ '$public' => t('Public post'),
+ '$jotnets' => $jotnets,
+ '$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
+ '$placeholdertitle' => t('Set title'),
+ '$pagetitle' => $block_title,
+ '$category' => '',
'$placeholdercategory' => t('Categories (comma-separated list)'),
- '$emtitle' => t('Example: bob@example.com, mary@example.com'),
- '$lockstate' => $lockstate,
- '$acl' => '',
- '$bang' => '',
- '$profile_uid' => (intval($channel['channel_id'])),
- '$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
- '$jotplugins' => $jotplugins,
- '$sourceapp' => $itm[0]['app'],
- '$defexpire' => '',
- '$feature_expire' => false,
- '$expires' => t('Set expiration date'),
+ '$emtitle' => t('Example: bob@example.com, mary@example.com'),
+ '$lockstate' => $lockstate,
+ '$acl' => '',
+ '$bang' => '',
+ '$profile_uid' => (intval($channel['channel_id'])),
+ '$preview' => ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
+ '$jotplugins' => $jotplugins,
+ '$sourceapp' => $itm[0]['app'],
+ '$defexpire' => '',
+ '$feature_expire' => false,
+ '$expires' => t('Set expiration date'),
));
- $ob = get_observer_hash();
-
- if(($itm[0]['author_xchan'] === $ob) || ($itm[0]['owner_xchan'] === $ob))
+ if(($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash))
$o .= '<br /><br /><a class="block-delete-link" href="item/drop/' . $itm[0]['id'] . '" >' . t('Delete Block') . '</a><br />';
$x = array(
- 'type' => 'block',
- 'title' => $itm[0]['title'],
- 'body' => $itm[0]['body'],
- 'term' => $itm[0]['term'],
- 'created' => $itm[0]['created'],
- 'edited' => $itm[0]['edited'],
- 'mimetype' => $itm[0]['mimetype'],
+ 'type' => 'block',
+ 'title' => $itm[0]['title'],
+ 'body' => $itm[0]['body'],
+ 'term' => $itm[0]['term'],
+ 'created' => $itm[0]['created'],
+ 'edited' => $itm[0]['edited'],
+ 'mimetype' => $itm[0]['mimetype'],
'pagetitle' => $page_title,
- 'mid' => $itm[0]['mid']
+ 'mid' => $itm[0]['mid']
);
$o .= EOL . EOL . t('Share') . EOL . '<textarea onclick="this.select();" class="shareable_element_text" >[element]' . base64url_encode(json_encode($x)) . '[/element]</textarea>' . EOL . EOL;
-
return $o;
}
diff --git a/mod/editlayout.php b/mod/editlayout.php
index 89cae2b0c..94e2e628c 100644
--- a/mod/editlayout.php
+++ b/mod/editlayout.php
@@ -1,34 +1,76 @@
<?php
-// What is this here for? I think it's cruft, but comment out for now in case it's here for a reason
-// require_once('acl_selectors.php');
+require_once('include/identity.php');
+require_once('include/acl_selectors.php');
+
+function editlayout_init(&$a) {
+
+ if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $a->is_sys = true;
+ }
+ }
+
+ if(argc() > 1)
+ $which = argv(1);
+ else
+ return;
+
+ profile_load($a,$which);
+
+}
function editlayout_content(&$a) {
-// We first need to figure out who owns the webpage, grab it from an argument
- $which = argv(1);
-// $a->get_channel() and stuff don't work here, so we've got to find the owner for ourselves.
- $r = q("select channel_id from channel where channel_address = '%s'",
- dbesc($which)
+ if(! $a->profile) {
+ notice( t('Requested profile is not available.') . EOL );
+ $a->error = 404;
+ return;
+ }
+
+ $which = argv(1);
+
+ $uid = local_user();
+ $owner = 0;
+ $channel = null;
+ $observer = $a->get_observer();
+
+ $channel = $a->get_channel();
+
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $uid = $owner = intval($sys['channel_id']);
+ $channel = $sys;
+ $observer = $sys;
+ }
+ }
+
+ if(! $owner) {
+ // Figure out who the page owner is.
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
);
- if($r) {
- $owner = intval($r[0]['channel_id']);
- //logger('owner: ' . print_r($owner,true));
- }
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
+ }
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
-
-
- if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
- $which = $channel['channel_address'];
- }
+ if(! perm_is_allowed($owner,$ob_hash,'write_pages')) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+ $is_owner = (($uid && $uid == $owner) ? true : false);
$o = '';
-// Figure out which post we're editing
+ // Figure out which post we're editing
$post_id = ((argc() > 2) ? intval(argv(2)) : 0);
@@ -37,48 +79,41 @@ function editlayout_content(&$a) {
return;
}
-// Now we've got a post and an owner, let's find out if we're allowed to edit it
+ // Now we've got a post and an owner, let's find out if we're allowed to edit it
- $observer = $a->get_observer();
- $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
- $perms = get_all_perms($owner,$ob_hash);
-
- if(! $perms['write_pages']) {
- notice( t('Permission denied.') . EOL);
- return;
- }
+ $perms = get_all_perms($owner,$ob_hash);
+ if(! $perms['write_pages']) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
-// We've already figured out which item we want and whose copy we need, so we don't need anything fancy here
- $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
- intval($post_id),
- intval($owner)
- );
+ $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
+ intval($post_id),
+ intval($owner)
+ );
$item_id = q("select * from item_id where service = 'PDL' and iid = %d limit 1",
- $itm[0]['id']
+ intval($itm[0]['id'])
);
if($item_id)
$layout_title = $item_id[0]['sid'];
$plaintext = true;
-// You may or may not be a local user. This won't work,
-// if(feature_enabled(local_user(),'richtext'))
-// $plaintext = false;
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Layout')
));
-
$a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
- '$baseurl' => $a->get_baseurl(),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
- '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
- '$geotag' => $geotag,
- '$nickname' => $a->user['nickname'],
+ '$baseurl' => $a->get_baseurl(),
+ '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
+ '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
+ '$geotag' => $geotag,
+ '$nickname' => $channel['channel_address'],
'$confirmdelete' => t('Delete layout?')
));
@@ -91,71 +126,68 @@ function editlayout_content(&$a) {
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
- $channel = $a->get_channel();
-
- //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
-//FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD instead of loading a sensible page. So, send folk to the webpage list.
+ // FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD
+ // instead of loading a sensible page. So, send folk to the webpage list.
$rp = '/layouts/' . $which;
$o .= replace_macros($tpl,array(
- '$return_path' => $rp,
- '$action' => 'item',
- '$webpage' => ITEM_PDL,
- '$share' => t('Edit'),
- '$upload' => t('Upload photo'),
- '$attach' => t('Attach file'),
- '$weblink' => t('Insert web link'),
- '$youtube' => t('Insert YouTube video'),
- '$video' => t('Insert Vorbis [.ogg] video'),
- '$audio' => t('Insert Vorbis [.ogg] audio'),
- '$setloc' => t('Set your location'),
- '$noloc' => t('Clear browser location'),
- '$wait' => t('Please wait'),
- '$permset' => t('Permission settings'),
- '$ptyp' => $itm[0]['type'],
- '$content' => undo_post_tagging($itm[0]['body']),
- '$post_id' => $post_id,
- '$baseurl' => $a->get_baseurl(),
- '$defloc' => $channel['channel_location'],
- '$visitor' => false,
- '$public' => t('Public post'),
- '$jotnets' => $jotnets,
- '$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
- '$placeholdertitle' => t('Set title'),
- '$pagetitle' => $layout_title,
- '$category' => '',
+ '$return_path' => $rp,
+ '$action' => 'item',
+ '$webpage' => ITEM_PDL,
+ '$share' => t('Edit'),
+ '$upload' => t('Upload photo'),
+ '$attach' => t('Attach file'),
+ '$weblink' => t('Insert web link'),
+ '$youtube' => t('Insert YouTube video'),
+ '$video' => t('Insert Vorbis [.ogg] video'),
+ '$audio' => t('Insert Vorbis [.ogg] audio'),
+ '$setloc' => t('Set your location'),
+ '$noloc' => t('Clear browser location'),
+ '$wait' => t('Please wait'),
+ '$permset' => t('Permission settings'),
+ '$ptyp' => $itm[0]['type'],
+ '$content' => undo_post_tagging($itm[0]['body']),
+ '$post_id' => $post_id,
+ '$baseurl' => $a->get_baseurl(),
+ '$defloc' => $channel['channel_location'],
+ '$visitor' => false,
+ '$public' => t('Public post'),
+ '$jotnets' => $jotnets,
+ '$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
+ '$placeholdertitle' => t('Set title'),
+ '$pagetitle' => $layout_title,
+ '$category' => '',
'$placeholdercategory' => t('Categories (comma-separated list)'),
- '$emtitle' => t('Example: bob@example.com, mary@example.com'),
- '$lockstate' => $lockstate,
- '$acl' => '',
- '$bang' => '',
- '$profile_uid' => (intval($owner)),
- '$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
- '$jotplugins' => $jotplugins,
- '$sourceapp' => t($a->sourcename),
- '$defexpire' => '',
- '$feature_expire' => false,
- '$expires' => t('Set expiration date'),
+ '$emtitle' => t('Example: bob@example.com, mary@example.com'),
+ '$lockstate' => $lockstate,
+ '$acl' => '',
+ '$bang' => '',
+ '$profile_uid' => (intval($owner)),
+ '$preview' => ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
+ '$jotplugins' => $jotplugins,
+ '$sourceapp' => t($a->sourcename),
+ '$defexpire' => '',
+ '$feature_expire' => false,
+ '$expires' => t('Set expiration date'),
));
- $ob = get_observer_hash();
- if(($itm[0]['author_xchan'] === $ob) || ($itm[0]['owner_xchan'] === $ob))
+ if(($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash))
$o .= '<br /><br /><a class="layout-delete-link" href="item/drop/' . $itm[0]['id'] . '" >' . t('Delete Layout') . '</a><br />';
$x = array(
- 'type' => 'layout',
- 'title' => $itm[0]['title'],
- 'body' => $itm[0]['body'],
- 'term' => $itm[0]['term'],
- 'created' => $itm[0]['created'],
- 'edited' => $itm[0]['edited'],
- 'mimetype' => $itm[0]['mimetype'],
+ 'type' => 'layout',
+ 'title' => $itm[0]['title'],
+ 'body' => $itm[0]['body'],
+ 'term' => $itm[0]['term'],
+ 'created' => $itm[0]['created'],
+ 'edited' => $itm[0]['edited'],
+ 'mimetype' => $itm[0]['mimetype'],
'pagetitle' => $page_title,
- 'mid' => $itm[0]['mid']
+ 'mid' => $itm[0]['mid']
);
$o .= EOL . EOL . t('Share') . EOL . '<textarea onclick="this.select();" class="shareable_element_text" >[element]' . base64url_encode(json_encode($x)) . '[/element]</textarea>' . EOL . EOL;
diff --git a/mod/editwebpage.php b/mod/editwebpage.php
index 41b5bb3e7..2acb3bd84 100644
--- a/mod/editwebpage.php
+++ b/mod/editwebpage.php
@@ -1,26 +1,71 @@
<?php
-// Required for setting permissions. (FIXME)
+require_once('include/identity.php');
+require_once('include/acl_selectors.php');
+
+function editwebpage_init(&$a) {
+
+ if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $a->is_sys = true;
+ }
+ }
+
+ if(argc() > 1)
+ $which = argv(1);
+ else
+ return;
+
+ profile_load($a,$which);
+
+}
-require_once('acl_selectors.php');
function editwebpage_content(&$a) {
- // We first need to figure out who owns the webpage, grab it from an argument
+ if(! $a->profile) {
+ notice( t('Requested profile is not available.') . EOL );
+ $a->error = 404;
+ return;
+ }
$which = argv(1);
- // $a->get_channel() and stuff don't work here, so we've got to find the owner for ourselves.
-
- $r = q("select channel_id from channel where channel_address = '%s'",
- dbesc($which)
- );
- if($r) {
- $owner = intval($r[0]['channel_id']);
- //logger('owner: ' . print_r($owner,true));
+ $uid = local_user();
+ $owner = 0;
+ $channel = null;
+ $observer = $a->get_observer();
+
+ $channel = $a->get_channel();
+
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $uid = $owner = intval($sys['channel_id']);
+ $channel = $sys;
+ $observer = $sys;
+ }
+ }
+
+ if(! $owner) {
+ // Figure out who the page owner is.
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
+ );
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
}
- $is_owner = ((local_user() && local_user() == $owner) ? true : false);
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+
+ if(! perm_is_allowed($owner,$ob_hash,'write_pages')) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ $is_owner = (($uid && $uid == $owner) ? true : false);
$o = '';
@@ -33,9 +78,6 @@ function editwebpage_content(&$a) {
return;
}
- // Now we've got a post and an owner, let's find out if we're allowed to edit it
-
- $observer = $a->get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
$perms = get_all_perms($owner,$ob_hash);
@@ -45,14 +87,13 @@ function editwebpage_content(&$a) {
return;
}
+ // We've already figured out which item we want and whose copy we need,
+ // so we don't need anything fancy here
-
- // We've already figured out which item we want and whose copy we need, so we don't need anything fancy here
$itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
intval($post_id),
intval($owner)
- );
-
+ );
if($itm[0]['item_flags'] & ITEM_OBSCURED) {
$key = get_config('system','prvkey');
@@ -63,23 +104,17 @@ function editwebpage_content(&$a) {
}
$item_id = q("select * from item_id where service = 'WEBPAGE' and iid = %d limit 1",
- $itm[0]['id']
+ intval($itm[0]['id'])
);
if($item_id)
$page_title = $item_id[0]['sid'];
-
-
-
$plaintext = true;
-// if(feature_enabled($itm[0]['uid'],'richtext'))
-// $plaintext = false;
-
$mimetype = $itm[0]['mimetype'];
if($mimetype === 'application/x-php') {
- if((! local_user()) || (local_user() != $itm[0]['uid'])) {
+ if((! $uid) || ($uid != $itm[0]['uid'])) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -101,7 +136,6 @@ function editwebpage_content(&$a) {
else
$layoutselect = layout_select($itm[0]['uid'],$itm[0]['layout_mid']);
-
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Webpage')
));
@@ -112,7 +146,7 @@ function editwebpage_content(&$a) {
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
- '$nickname' => $a->user['nickname'],
+ '$nickname' => $channel['channel_address'],
'$confirmdelete' => t('Delete webpage?')
));
@@ -124,12 +158,9 @@ function editwebpage_content(&$a) {
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
-
- $channel = $a->get_channel();
-
- //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
-//FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD instead of loading a sensible page. So, send folk to the webpage list.
+ // FIXME A return path with $_SESSION doesn't always work for observer - it may WSoD
+ // instead of loading a sensible page. So, send folk to the webpage list.
$rp = 'webpages/' . $which;
@@ -171,18 +202,16 @@ function editwebpage_content(&$a) {
'lockstate' => (((strlen($itm[0]['allow_cid'])) || (strlen($itm[0]['allow_gid'])) || (strlen($itm[0]['deny_cid'])) || (strlen($itm[0]['deny_gid']))) ? 'lock' : 'unlock'),
'$bang' => '',
'$profile_uid' => (intval($owner)),
- '$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
+ '$preview' => ((feature_enabled($uid,'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
- '$sourceapp' => t($a->sourcename),
+ '$sourceapp' => $a->sourcename,
'$defexpire' => '',
'$feature_expire' => false,
'$expires' => t('Set expiration date'),
));
- $ob = get_observer_hash();
-
- if(($itm[0]['author_xchan'] === $ob) || ($itm[0]['owner_xchan'] === $ob))
+ if(($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash))
$o .= '<br /><br /><a class="page-delete-link" href="item/drop/' . $itm[0]['id'] . '" >' . t('Delete Webpage') . '</a><br />';
diff --git a/mod/item.php b/mod/item.php
index 026240196..94ff32750 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -32,8 +32,17 @@ function item_post(&$a) {
require_once('include/security.php');
$uid = local_user();
-
$channel = null;
+ $observer = null;
+
+ $profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0);
+ require_once('include/identity.php');
+ $sys = get_sys_channel();
+ if($sys && $profile_uid && ($sys['channel_id'] == $profile_uid) && is_site_admin()) {
+ $uid = intval($sys['channel_id']);
+ $channel = $sys;
+ $observer = $sys;
+ }
if(x($_REQUEST,'dropitems')) {
require_once('include/items.php');
@@ -70,7 +79,6 @@ function item_post(&$a) {
$message_id = ((x($_REQUEST,'message_id') && $api_source) ? strip_tags($_REQUEST['message_id']) : '');
$created = ((x($_REQUEST,'created')) ? datetime_convert('UTC','UTC',$_REQUEST['created']) : datetime_convert());
- $profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0);
$post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0);
$app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : '');
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
@@ -87,8 +95,8 @@ function item_post(&$a) {
/*
* Check service class limits
*/
- if (local_user() && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) {
- $ret = item_check_service_class(local_user(),x($_REQUEST,'webpage'));
+ if ($uid && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) {
+ $ret = item_check_service_class($uid,x($_REQUEST,'webpage'));
if (!$ret['success']) {
notice( t($ret['message']) . EOL) ;
if(x($_REQUEST,'return'))
@@ -112,6 +120,7 @@ function item_post(&$a) {
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0);
$parent_mid = ((x($_REQUEST,'parent_mid')) ? trim($_REQUEST['parent_mid']) : '');
+ $route = '';
$parent_item = null;
$parent_contact = null;
$thr_parent = '';
@@ -128,11 +137,11 @@ function item_post(&$a) {
intval($parent)
);
}
- elseif($parent_mid && local_user()) {
+ elseif($parent_mid && $uid) {
// This is coming from an API source, and we are logged in
$r = q("SELECT * FROM `item` WHERE `mid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent_mid),
- intval(local_user())
+ intval($uid)
);
}
// if this isn't the real parent of the conversation, find it
@@ -163,12 +172,12 @@ function item_post(&$a) {
$thr_parent = $parent_mid;
+ $route = $parent_item['route'];
}
-
- $observer = $a->get_observer();
-
+ if(! $observer)
+ $observer = $a->get_observer();
if($parent) {
logger('mod_item: item_post parent=' . $parent);
@@ -221,7 +230,7 @@ function item_post(&$a) {
if(! $channel) {
- if(local_user() && local_user() == $profile_uid) {
+ if($uid && $uid == $profile_uid) {
$channel = $a->get_channel();
}
else {
@@ -444,7 +453,7 @@ function item_post(&$a) {
intval($profile_uid)
);
if($z && ($z[0]['account_roles'] & ACCOUNT_ROLE_ALLOWCODE)) {
- if(local_user() && (get_account_id() == $z[0]['account_id'])) {
+ if($uid && (get_account_id() == $z[0]['account_id'])) {
$execflag = true;
}
else {
@@ -459,7 +468,7 @@ function item_post(&$a) {
if($mimetype === 'text/bbcode') {
- if(local_user() && local_user() == $profile_uid && feature_enabled(local_user(),'markdown')) {
+ if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) {
require_once('include/bb2diaspora.php');
$body = diaspora2bb(escape_tags($body),true);
}
@@ -592,7 +601,7 @@ function item_post(&$a) {
if($fullnametagged)
continue;
- $success = handle_tag($a, $body, $access_tag, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag);
+ $success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $profile_uid , $tag);
logger('handle_tag: ' . print_r($success,tue), LOGGER_DATA);
if(($access_tag) && (! $parent_item)) {
logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA);
@@ -753,6 +762,7 @@ function item_post(&$a) {
$datarray['comment_policy'] = map_scope($channel['channel_w_comment']);
$datarray['term'] = $post_tags;
$datarray['plink'] = $plink;
+ $datarray['route'] = $route;
// preview mode - prepare the body for display and send it via json
@@ -794,7 +804,7 @@ function item_post(&$a) {
$datarray['body'] = z_input_filter($datarray['uid'],$datarray['body'],$datarray['mimetype']);
- if(local_user()) {
+ if($uid) {
if($channel['channel_hash'] === $datarray['author_xchan']) {
$datarray['sig'] = base64url_encode(rsa_sign($datarray['body'],$channel['channel_prvkey']));
$datarray['item_flags'] = $datarray['item_flags'] | ITEM_VERIFIED;
diff --git a/mod/layouts.php b/mod/layouts.php
index 2d14212cf..aaf5db0ef 100644
--- a/mod/layouts.php
+++ b/mod/layouts.php
@@ -1,36 +1,82 @@
<?php
-function layouts_content(&$a) {
+require_once('include/identity.php');
+require_once('include/conversation.php');
+require_once('include/acl_selectors.php');
+
+function layouts_init(&$a) {
+
+ if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $a->is_sys = true;
+ }
+ }
if(argc() > 1)
$which = argv(1);
- else {
+ else
+ return;
+
+ profile_load($a,$which);
+
+}
+
+
+function layouts_content(&$a) {
+
+ if(! $a->profile) {
notice( t('Requested profile is not available.') . EOL );
$a->error = 404;
return;
}
- profile_load($a,$which,0);
+ $which = argv(1);
+ $uid = local_user();
+ $owner = 0;
+ $channel = null;
+ $observer = $a->get_observer();
- // Figure out who the page owner is.
- $r = q("select channel_id from channel where channel_address = '%s'",
- dbesc($which)
- );
- if($r) {
- $owner = intval($r[0]['channel_id']);
+ $channel = $a->get_channel();
+
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $uid = $owner = intval($sys['channel_id']);
+ $channel = $sys;
+ $observer = $sys;
+ }
+ }
+
+ if(! $owner) {
+ // Figure out who the page owner is.
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
+ );
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
+ }
+
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+
+ $perms = get_all_perms($owner,$ob_hash);
+
+ if(! $perms['write_pages']) {
+ notice( t('Permission denied.') . EOL);
+ return;
}
// Block design features from visitors
- if((! local_user()) || (local_user() != $owner)) {
+ if((! $uid) || ($uid != $owner)) {
notice( t('Permission denied.') . EOL);
return;
}
// Get the observer, check their permissions
- $observer = $a->get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
$perms = get_all_perms($owner,$ob_hash);
@@ -41,7 +87,9 @@ function layouts_content(&$a) {
}
if((argc() > 3) && (argv(2) === 'share') && (argv(3))) {
- $r = q("select sid, service, mimetype, title, body from item_id left join item on item.id = item_id.iid where item_id.uid = %d and item.mid = '%s' and service = 'PDL' order by sid asc",
+ $r = q("select sid, service, mimetype, title, body from item_id
+ left join item on item.id = item_id.iid
+ where item_id.uid = %d and item.mid = '%s' and service = 'PDL' order by sid asc",
intval($owner),
dbesc(argv(3))
);
@@ -63,7 +111,6 @@ function layouts_content(&$a) {
'id' => 'layout-help-tab',
));
-
$o .= replace_macros(get_markup_template('common_tabs.tpl'),array('$tabs' => $tabs));
@@ -71,18 +118,16 @@ function layouts_content(&$a) {
// Nickname is set to the observers xchan, and profile_uid to the owners.
// This lets you post pages at other people's channels.
- require_once ('include/conversation.php');
-
$x = array(
- 'webpage' => ITEM_PDL,
- 'is_owner' => true,
- 'nickname' => $a->profile['channel_address'],
- 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
- 'bang' => (($group || $cid) ? '!' : ''),
- 'showacl' => false,
- 'visitor' => false,
- 'nopreview' => 1,
- 'ptlabel' => t('Layout Name'),
+ 'webpage' => ITEM_PDL,
+ 'is_owner' => true,
+ 'nickname' => $a->profile['channel_address'],
+ 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
+ 'bang' => '',
+ 'showacl' => false,
+ 'visitor' => false,
+ 'nopreview' => 1,
+ 'ptlabel' => t('Layout Name'),
'profile_uid' => intval($owner),
);
@@ -96,10 +141,8 @@ function layouts_content(&$a) {
$o .= status_editor($a,$x);
- // Get a list of blocks. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
- // TODO - this should be replaced with pagelist_widget
-
- $r = q("select iid, sid, mid from item_id left join item on item.id = item_id.iid where item_id.uid = %d and service = 'PDL' order by sid asc",
+ $r = q("select iid, sid, mid from item_id left join item on item.id = item_id.iid
+ where item_id.uid = %d and service = 'PDL' order by sid asc",
intval($owner)
);
@@ -108,24 +151,28 @@ function layouts_content(&$a) {
if($r) {
$pages = array();
foreach($r as $rr) {
- $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid'], 'mid' => $rr['mid']);
+ $pages[$rr['iid']][] = array(
+ 'url' => $rr['iid'],
+ 'title' => $rr['sid'],
+ 'mid' => $rr['mid']
+ );
}
}
-
//Build the base URL for edit links
- $url = z_root() . "/editlayout/" . $which;
+ $url = z_root() . '/editlayout/' . $which;
- return $o . replace_macros(get_markup_template("layoutlist.tpl"), array(
+ $o .= replace_macros(get_markup_template('layoutlist.tpl'), array(
'$baseurl' => $url,
- '$edit' => t('Edit'),
- '$share' => t('Share'),
- '$pages' => $pages,
+ '$edit' => t('Edit'),
+ '$share' => t('Share'),
+ '$pages' => $pages,
'$channel' => $which,
- '$view' => t('View'),
+ '$view' => t('View'),
'$preview' => '1',
));
+ return $o;
}
diff --git a/mod/locs.php b/mod/locs.php
index 0bd7f0f84..b1169fcca 100644
--- a/mod/locs.php
+++ b/mod/locs.php
@@ -1,34 +1,6 @@
<?php /** @file */
-/**
- Placeholder file at present. This is going to involve a bit of work.
-
- This file will deal with the deletion of channels and management of hublocs.
-
- We need to provide the following functionality:
-
- - Delete my account and all channels from the entire network
-
- - Delete my account and all channels from this server
-
- - Delete a channel from the entire network
-
- - Delete a channel from this server
-
- - List all hub locations for this channel
-
- - Remove this/some hub location from this channel
-
- - promote this/some hub location to primary
-
- - Remove hub location 'xyz' from this channel, (this should possibly only be allowed if that hub has been down for a period of time)
-
- - Some of these actions should probably require email verification
-
-*/
-
-
function locs_post(&$a) {
if(! local_user())
@@ -87,4 +59,46 @@ function locs_post(&$a) {
return;
}
}
+}
+
+
+
+function locs_content(&$a) {
+
+
+
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ $channel = $a->get_channel();
+
+ $r = q("select * from hubloc where hubloc_hash = '%s'",
+ dbesc($channel['channel_hash'])
+ );
+
+ if(! $r) {
+ notice( t('No locations found.') . EOL);
+ return;
+ }
+
+
+ for($x = 0; $x < count($r); $x ++) {
+ $r[$x]['primary'] = (($r[$x]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false);
+ $r[$x]['deleted'] = (($r[$x]['hubloc_flags'] & HUBLOC_FLAGS_DELETED) ? true : false);
+ }
+
+
+
+ $o = replace_macros(get_markup_template('locmanage.tpl'), array(
+ '$header' => t('Manage Channel Locations'),
+ '$loc' => t('Location (address)'),
+ '$mkprm' => t('Primary Location'),
+ '$drop' => t('Drop location'),
+ '$submit' => t('Submit'),
+ '$hubs' => $r
+ ));
+
+ return $o;
} \ No newline at end of file
diff --git a/mod/menu.php b/mod/menu.php
index a2d0c2385..92923e1ff 100644
--- a/mod/menu.php
+++ b/mod/menu.php
@@ -1,13 +1,23 @@
<?php
require_once('include/menu.php');
+require_once('include/identity.php');
function menu_post(&$a) {
- if(! local_user())
+ $uid = local_user();
+
+ if(array_key_exists('sys',$_REQUEST) && $_REQUEST['sys'] && is_site_admin()) {
+ $sys = get_sys_channel();
+ $uid = intval($sys['channel_id']);
+ $a->is_sys = true;
+ }
+
+ if(! $uid)
return;
- $_REQUEST['menu_channel_id'] = local_user();
+ $_REQUEST['menu_channel_id'] = $uid;
+
if($_REQUEST['menu_bookmark'])
$_REQUEST['menu_flags'] |= MENU_BOOKMARK;
if($_REQUEST['menu_system'])
@@ -19,7 +29,7 @@ function menu_post(&$a) {
$r = menu_edit($_REQUEST);
if($r) {
info( t('Menu updated.') . EOL);
- goaway(z_root() . '/mitem/' . $menu_id);
+ goaway(z_root() . '/mitem/' . $menu_id . (($a->is_sys) ? '?f=&sys=1' : ''));
}
else
notice( t('Unable to update menu.'). EOL);
@@ -28,7 +38,7 @@ function menu_post(&$a) {
$r = menu_create($_REQUEST);
if($r) {
info( t('Menu created.') . EOL);
- goaway(z_root() . '/mitem/' . $r);
+ goaway(z_root() . '/mitem/' . $r . (($a->is_sys) ? '?f=&sys=1' : ''));
}
else
notice( t('Unable to create menu.'). EOL);
@@ -40,36 +50,42 @@ function menu_post(&$a) {
function menu_content(&$a) {
- if(! local_user()) {
+ $uid = local_user();
+
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ $uid = intval($sys['channel_id']);
+ }
+
+ if(! $uid) {
notice( t('Permission denied.') . EOL);
return '';
}
-// $a->set_widget('design',design_tools());
-
-
if(argc() == 1) {
// list menus
- $x = menu_list(local_user());
-
- $o = replace_macros(get_markup_template('menulist.tpl'),array(
- '$title' => t('Manage Menus'),
- '$menus' => $x,
- '$edit' => t('Edit'),
- '$drop' => t('Drop'),
- '$new' => t('New'),
- '$hintnew' => t('Create a new menu'),
- '$hintdrop' => t('Delete this menu'),
- '$hintcontent' => t('Edit menu contents'),
- '$hintedit' => t('Edit this menu')
- ));
-
- return $o;
-
-
+ $x = menu_list($uid);
+ if($x) {
+ for($y = 0; $y < count($x); $y ++) {
+ $x[$y]['bookmark'] = (($x[$y]['menu_flags'] & MENU_BOOKMARK) ? true : false);
+ }
+ }
+ $o = replace_macros(get_markup_template('menulist.tpl'),array(
+ '$title' => t('Manage Menus'),
+ '$menus' => $x,
+ '$edit' => t('Edit'),
+ '$drop' => t('Drop'),
+ '$new' => t('New'),
+ '$bmark' => t('Bookmarks allowed'),
+ '$hintnew' => t('Create a new menu'),
+ '$hintdrop' => t('Delete this menu'),
+ '$hintcontent' => t('Edit menu contents'),
+ '$hintedit' => t('Edit this menu')
+ ));
+ return $o;
}
@@ -87,19 +103,19 @@ function menu_content(&$a) {
}
elseif(intval(argv(1))) {
- $m = menu_fetch_id(intval(argv(1)),local_user());
+ $m = menu_fetch_id(intval(argv(1)),$uid);
if(! $m) {
notice( t('Menu not found.') . EOL);
return '';
}
if(argc() == 3 && argv(2) == 'drop') {
- $r = menu_delete_id(intval(argv(1)),local_user());
+ $r = menu_delete_id(intval(argv(1)),$uid);
if($r)
info( t('Menu deleted.') . EOL);
else
notice( t('Menu could not be deleted.'). EOL);
- goaway(z_root() . '/menu');
+ goaway(z_root() . '/menu' . (($a->is_sys) ? '?f=&sys=1' : ''));
}
else {
$o = replace_macros(get_markup_template('menuedit.tpl'), array(
diff --git a/mod/mitem.php b/mod/mitem.php
index 3240bb68b..7098d7489 100644
--- a/mod/mitem.php
+++ b/mod/mitem.php
@@ -4,12 +4,22 @@ require_once('include/menu.php');
require_once('include/acl_selectors.php');
function mitem_init(&$a) {
- if(! local_user())
+
+ $uid = local_user();
+
+ if(array_key_exists('sys',$_REQUEST) && $_REQUEST['sys'] && is_site_admin()) {
+ $sys = get_sys_channel();
+ $uid = intval($sys['channel_id']);
+ $a->is_sys = true;
+ }
+
+ if(! $uid)
return;
+
if(argc() < 2)
return;
- $m = menu_fetch_id(intval(argv(1)),local_user());
+ $m = menu_fetch_id(intval(argv(1)),$uid);
if(! $m) {
notice( t('Menu not found.') . EOL);
return '';
@@ -20,8 +30,18 @@ function mitem_init(&$a) {
function mitem_post(&$a) {
- if(! local_user())
+ $uid = local_user();
+
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ $uid = intval($sys['channel_id']);
+ }
+
+ if(! $uid) {
return;
+ }
+
+
if(! $a->data['menu'])
return;
@@ -29,7 +49,7 @@ function mitem_post(&$a) {
$channel = $a->get_channel();
- $_REQUEST['mitem_channel_id'] = local_user();
+ $_REQUEST['mitem_channel_id'] = $uid;
$_REQUEST['menu_id'] = $a->data['menu']['menu_id'];
$_REQUEST['mitem_flags'] = 0;
@@ -42,20 +62,20 @@ function mitem_post(&$a) {
$mitem_id = ((argc() > 2) ? intval(argv(2)) : 0);
if($mitem_id) {
$_REQUEST['mitem_id'] = $mitem_id;
- $r = menu_edit_item($_REQUEST['menu_id'],local_user(),$_REQUEST);
+ $r = menu_edit_item($_REQUEST['menu_id'],$uid,$_REQUEST);
if($r) {
info( t('Menu element updated.') . EOL);
- goaway(z_root() . '/mitem/' . $_REQUEST['menu_id']);
+ goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . (($a->is_sys) ? '?f=&sys=1' : ''));
}
else
notice( t('Unable to update menu element.') . EOL);
}
else {
- $r = menu_add_item($_REQUEST['menu_id'],local_user(),$_REQUEST);
+ $r = menu_add_item($_REQUEST['menu_id'],$uid,$_REQUEST);
if($r) {
info( t('Menu element added.') . EOL);
- goaway(z_root() . '/mitem/' . $_REQUEST['menu_id']);
+ goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . (($a->is_sys) ? '?f=&sys=1' : ''));
}
else
notice( t('Unable to add menu element.') . EOL);
@@ -69,7 +89,20 @@ function mitem_post(&$a) {
function mitem_content(&$a) {
- if(! local_user()) {
+ $uid = local_user();
+ $channel = $a->get_channel();
+ $observer = $a->get_observer();
+
+ $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ $uid = intval($sys['channel_id']);
+ $channel = $sys;
+ $ob_hash = $sys['xchan_hash'];
+ }
+
+ if(! $uid) {
notice( t('Permission denied.') . EOL);
return '';
}
@@ -79,67 +112,61 @@ function mitem_content(&$a) {
return '';
}
- $channel = $a->get_channel();
-
- $m = menu_fetch($a->data['menu']['menu_name'],local_user(), get_observer_hash());
+ $m = menu_fetch($a->data['menu']['menu_name'],$uid,$ob_hash);
$a->data['menu_item'] = $m;
if(argc() == 2) {
$r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc",
intval($a->data['menu']['menu_id']),
- local_user()
+ intval($uid)
);
$o .= replace_macros(get_markup_template('mitemlist.tpl'),array(
- '$title' => t('Manage Menu Elements'),
+ '$title' => t('Manage Menu Elements'),
'$menuname' => $a->data['menu']['menu_name'],
'$menudesc' => $a->data['menu']['menu_desc'],
- '$edmenu' => t('Edit menu'),
- '$menu_id' => $a->data['menu']['menu_id'],
- '$mlist' => $r,
- '$edit' => t('Edit element'),
- '$drop' => t('Drop element'),
- '$new' => t('New element'),
+ '$edmenu' => t('Edit menu'),
+ '$menu_id' => $a->data['menu']['menu_id'],
+ '$mlist' => $r,
+ '$edit' => t('Edit element'),
+ '$drop' => t('Drop element'),
+ '$new' => t('New element'),
'$hintmenu' => t('Edit this menu container'),
- '$hintnew' => t('Add menu element'),
+ '$hintnew' => t('Add menu element'),
'$hintdrop' => t('Delete this menu item'),
'$hintedit' => t('Edit this menu item')
- ));
-
-
+ ));
+
return $o;
-
}
if(argc() > 2) {
-
-
if(argv(2) === 'new') {
$perm_defaults = array(
'allow_cid' => $channel['channel_allow_cid'],
'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
+ 'deny_cid' => $channel['channel_deny_cid'],
+ 'deny_gid' => $channel['channel_deny_gid']
);
$o = replace_macros(get_markup_template('mitemedit.tpl'), array(
- '$header' => t('New Menu Element'),
- '$menu_id' => $a->data['menu']['menu_id'],
+ '$header' => t('New Menu Element'),
+ '$menu_id' => $a->data['menu']['menu_id'],
'$permissions' => t('Menu Item Permissions'),
- '$permdesc' => t("\x28click to open/close\x29"),
- '$aclselect' => populate_acl($perm_defaults,false),
- '$mitem_desc' => array('mitem_desc', t('Link text'), '', '','*'),
- '$mitem_link' => array('mitem_link', t('URL of link'), '', '', '*'),
- '$usezid' => array('usezid', t('Use Red magic-auth if available'), true, ''),
- '$newwin' => array('newwin', t('Open link in new window'), false,''),
+ '$permdesc' => t("\x28click to open/close\x29"),
+ '$aclselect' => populate_acl($perm_defaults,false),
+ '$mitem_desc' => array('mitem_desc', t('Link text'), '', '','*'),
+ '$mitem_link' => array('mitem_link', t('URL of link'), '', '', '*'),
+ '$usezid' => array('usezid', t('Use RedMatrix magic-auth if available'), true, ''),
+ '$newwin' => array('newwin', t('Open link in new window'), false,''),
// permissions go here
'$mitem_order' => array('mitem_order', t('Order in list'),'0',t('Higher numbers will sink to bottom of listing')),
- '$submit' => t('Create')
+ '$submit' => t('Create')
));
return $o;
}
@@ -148,23 +175,23 @@ function mitem_content(&$a) {
elseif(intval(argv(2))) {
$m = q("select * from menu_item where mitem_id = %d and mitem_channel_id = %d limit 1",
intval(argv(2)),
- intval(local_user())
+ intval($uid)
);
if(! $m) {
notice( t('Menu item not found.') . EOL);
- goaway(z_root() . '/menu');
+ goaway(z_root() . '/menu'. (($a->is_sys) ? '?f=&sys=1' : ''));
}
$mitem = $m[0];
if(argc() == 4 && argv(3) == 'drop') {
- $r = menu_del_item($mitem['mitem_menu_id'], local_user(),intval(argv(2)));
+ $r = menu_del_item($mitem['mitem_menu_id'], $uid, intval(argv(2)));
if($r)
info( t('Menu item deleted.') . EOL);
else
notice( t('Menu item could not be deleted.'). EOL);
- goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id']);
+ goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id'] . (($a->is_sys) ? '?f=&sys=1' : ''));
}
else {
@@ -179,7 +206,7 @@ function mitem_content(&$a) {
'$mitem_id' => intval(argv(2)),
'$mitem_desc' => array('mitem_desc', t('Link text'), $mitem['mitem_desc'], '','*'),
'$mitem_link' => array('mitem_link', t('URL of link'), $mitem['mitem_link'], '', '*'),
- '$usezid' => array('usezid', t('Use Red magic-auth if available'), (($mitem['mitem_flags'] & MENU_ITEM_ZID) ? 1 : 0), ''),
+ '$usezid' => array('usezid', t('Use RedMatrix magic-auth if available'), (($mitem['mitem_flags'] & MENU_ITEM_ZID) ? 1 : 0), ''),
'$newwin' => array('newwin', t('Open link in new window'), (($mitem['mitem_flags'] & MENU_ITEM_NEWWIN) ? 1 : 0),''),
// permissions go here
'$mitem_order' => array('mitem_order', t('Order in list'),$mitem['mitem_order'],t('Higher numbers will sink to bottom of listing')),
@@ -188,10 +215,5 @@ function mitem_content(&$a) {
return $o;
}
}
-
}
-
-
-
-
}
diff --git a/mod/photos.php b/mod/photos.php
index 297878b29..95fa162c9 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -196,7 +196,7 @@ function photos_post(&$a) {
}
}
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']);
}
if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
@@ -206,6 +206,7 @@ function photos_post(&$a) {
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
$albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
+ $adult = ((x($_POST,'adult')) ? intval($_POST['adult']) : 0);
$str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']);
@@ -273,13 +274,11 @@ function photos_post(&$a) {
}
}
- $p = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `uid` = %d and ( photo_flags = %d or photo_flags = %d ) ORDER BY `scale` DESC",
+ $p = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `uid` = %d ORDER BY `scale` DESC",
dbesc($resource_id),
- intval($page_owner_uid),
- intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE)
+ intval($page_owner_uid)
);
- if(count($p)) {
+ if($p) {
$ext = $phototypes[$p[0]['type']];
$r = q("UPDATE `photo` SET `description` = '%s', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource_id` = '%s' AND `uid` = %d",
@@ -296,6 +295,14 @@ function photos_post(&$a) {
$item_private = (($str_contact_allow || $str_group_allow || $str_contact_deny || $str_group_deny) ? true : false);
+ $old_adult = (($p[0]['photo_flags'] & PHOTO_ADULT) ? 1 : 0);
+ if($old_adult != $adult) {
+ $r = q("update photo set photo_flags = ( photo_flags ^ %d) where resource_id = '%s' and uid = %d",
+ intval(PHOTO_ADULT),
+ dbesc($resource_id),
+ intval($page_owner_uid)
+ );
+ }
/* Don't make the item visible if the only change was the album name */
@@ -313,10 +320,11 @@ function photos_post(&$a) {
intval($item_id),
intval($page_owner_uid)
);
- }
- if($r) {
- $old_tag = $r[0]['tag'];
- $old_inform = $r[0]['inform'];
+
+ if($r) {
+ $old_tag = $r[0]['tag'];
+ $old_inform = $r[0]['inform'];
+ }
}
@@ -428,8 +436,11 @@ function photos_post(&$a) {
if(! $r['success']) {
notice($r['message'] . EOL);
}
-
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+
+ if($_REQUEST['newalbum'])
+ goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($_REQUEST['newalbum']));
+ else
+ goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex(datetime_convert('UTC',date_default_timezone_get(),'now', 'Y')));
}
@@ -439,20 +450,17 @@ function photos_content(&$a) {
// URLs:
// photos/name
- // photos/name/upload
- // photos/name/upload/xxxxx (xxxxx is album name)
- // photos/name/album/xxxxx
- // photos/name/album/xxxxx/edit
+ // photos/name/album/xxxxx (xxxxx is album name)
// photos/name/image/xxxxx
- // photos/name/image/xxxxx/edit
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
-
-
+
+ $unsafe = ((array_key_exists('unsafe',$_REQUEST) && $_REQUEST['unsafe']) ? 1 : 0);
+
require_once('include/bbcode.php');
require_once('include/security.php');
require_once('include/conversation.php');
@@ -518,10 +526,6 @@ function photos_content(&$a) {
$_is_owner = (local_user() && (local_user() == $owner_uid));
$o .= profile_tabs($a,$_is_owner, $a->data['channel']['channel_address']);
- //
- // dispatch request
- //
-
/**
* Display upload form
*/
@@ -560,7 +564,9 @@ function photos_content(&$a) {
'deny_cid' => $channel['channel_deny_cid'],
'deny_gid' => $channel['channel_deny_gid']
);
- }
+
+ $lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock');
+ }
$aclselect_e = (($_is_owner) ? populate_acl($channel_acl,false) : '');
@@ -581,6 +587,7 @@ function photos_content(&$a) {
'$selname' => $selname,
'$permissions' => t('Permissions'),
'$aclselect' => $aclselect_e,
+ '$lockstate' => $lockstate,
'$uploader' => $ret['addon_text'],
'$default' => (($ret['default_upload']) ? true : false),
'$uploadurl' => $ret['post_url'],
@@ -590,12 +597,18 @@ function photos_content(&$a) {
}
+ //
+ // dispatch request
+ //
+
/*
* Display a single photo album
*/
if($datatype === 'album') {
+
+
if((strlen($datum) & 1) || (! ctype_xdigit($datum))) {
notice( t('Album name could not be decoded') . EOL);
logger('mod_photos: illegal album encoding: ' . $datum);
@@ -605,15 +618,17 @@ function photos_content(&$a) {
$album = hex2bin($datum);
$r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
- AND `scale` <= 4 and (photo_flags = %d or photo_flags = %d ) $sql_extra GROUP BY `resource_id`",
+ AND `scale` <= 4 and ((photo_flags = %d) or (photo_flags & %d )) $sql_extra GROUP BY `resource_id`",
intval($owner_uid),
dbesc($album),
intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE)
+ intval(($unsafe) ? (PHOTO_PROFILE|PHOTO_ADULT) : PHOTO_PROFILE)
);
if(count($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(60);
+ } else {
+ goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address']);
}
if($_GET['order'] === 'posted')
@@ -622,9 +637,6 @@ function photos_content(&$a) {
$order = 'DESC';
- /*"SELECT $prefix `resource_id`, `id`, `filename`, type, max(`scale`) AS `scale`, `description` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
- AND `scale` <= 4 and (photo_flags = %d or photo_flags = %d ) $sql_extra GROUP BY resource_id ORDER BY `created` $order LIMIT %d OFFSET %d"*/
-
$r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.scale, p.description, p.created FROM photo p INNER JOIN
(SELECT resource_id, max(scale) scale FROM photo WHERE uid = %d AND album = '%s' AND scale <= 4 AND (photo_flags = %d or photo_flags = %d ) $sql_extra GROUP BY resource_id) ph
ON (p.resource_id = ph.resource_id AND p.scale = ph.scale)
@@ -632,7 +644,7 @@ function photos_content(&$a) {
intval($owner_uid),
dbesc($album),
intvaL(PHOTO_NORMAL),
- intval(PHOTO_PROFILE),
+ intval(($unsafe) ? (PHOTO_PROFILE|PHOTO_ADULT) : PHOTO_PROFILE),
intval($a->pager['itemspage']),
intval($a->pager['start'])
);
@@ -650,7 +662,8 @@ function photos_content(&$a) {
$albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer']));
$edit_tpl = get_markup_template('album_edit.tpl');
$album_edit = replace_macros($edit_tpl,array(
- '$nametext' => t('New album name: '),
+ '$nametext' => t('Enter a new album name'),
+ '$name_placeholder' => t('or select an existing one (doubleclick)'),
'$nickname' => $a->data['channel']['channel_address'],
'$album' => $album_e,
'$albums' => $albums['albums'],
@@ -751,25 +764,18 @@ function photos_content(&$a) {
// fetch image, item containing image, then comments
$ph = q("SELECT aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,`type`,height,width,`size`,scale,profile,photo_flags,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
- and (photo_flags = %d or photo_flags = %d ) $sql_extra ORDER BY `scale` ASC ",
+ $sql_extra ORDER BY `scale` ASC ",
intval($owner_uid),
- dbesc($datum),
- intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE)
-
+ dbesc($datum)
);
if(! $ph) {
/* Check again - this time without specifying permissions */
- $ph = q("SELECT id FROM photo WHERE uid = %d AND resource_id = '%s'
- and ( photo_flags = %d or photo_flags = %d )
- LIMIT 1",
+ $ph = q("SELECT id FROM photo WHERE uid = %d AND resource_id = '%s' LIMIT 1",
intval($owner_uid),
- dbesc($datum),
- intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE)
+ dbesc($datum)
);
if($ph)
notice( t('Permission denied. Access to this item may be restricted.') . EOL);
@@ -790,11 +796,9 @@ function photos_content(&$a) {
$prvnxt = q("SELECT `resource_id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0
- and ( photo_flags = %d or photo_flags = %d ) $sql_extra ORDER BY `created` $order ",
+ $sql_extra ORDER BY `created` $order ",
dbesc($ph[0]['album']),
- intval($owner_uid),
- intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE)
+ intval($owner_uid)
);
if(count($prvnxt)) {
@@ -838,11 +842,11 @@ function photos_content(&$a) {
);
}
- // lock
- $lock = ( ( (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid'])
+ // lockstate
+ $lockstate = ( ( (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid'])
|| strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid'])) )
- ? t('Private Photo')
- : Null);
+ ? array('lock', t('Private Photo'))
+ : array('unlock', Null));
$a->page['htmlhead'] .= '<script>$(document).keydown(function(event) {' . "\n";
if($prevlink)
@@ -927,6 +931,8 @@ function photos_content(&$a) {
$aclselect_e = populate_acl($ph[0]);
$albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer']));
+ $_SESSION['album_return'] = bin2hex($ph[0]['album']);
+
$edit = array(
'edit' => t('Edit photo'),
'id' => $link_item['id'],
@@ -934,7 +940,8 @@ function photos_content(&$a) {
'rotateccw' => t('Rotate CCW (left)'),
'albums' => $albums['albums'],
'album' => $album_e,
- 'newalbum' => t('New album name'),
+ 'newalbum_label' => t('Enter a new album name'),
+ 'newalbum_placeholder' => t('or select an existing one (doubleclick)'),
'nickname' => $a->data['channel']['channel_address'],
'resource_id' => $ph[0]['resource_id'],
'capt_label' => t('Caption'),
@@ -942,8 +949,10 @@ function photos_content(&$a) {
'tag_label' => t('Add a Tag'),
'permissions' => t('Permissions'),
'aclselect' => $aclselect_e,
+ 'lockstate' => $lockstate[0],
'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com'),
'item_id' => ((count($linked_items)) ? $link_item['id'] : 0),
+ 'adult' => array('adult',t('Flag as adult in album view'), (($ph[0]['photo_flags'] & PHOTO_ADULT) ? 1 : 0),''),
'submit' => t('Submit'),
'delete' => t('Delete Photo')
);
@@ -1113,7 +1122,7 @@ function photos_content(&$a) {
'$id' => $link_item['id'], //$ph[0]['id'],
'$album' => $album_e,
'$tools' => $tools,
- '$lock' => $lock,
+ '$lock' => $lockstate[1],
'$photo' => $photo,
'$prevlink' => $prevlink,
'$nextlink' => $nextlink,
@@ -1151,12 +1160,12 @@ function photos_content(&$a) {
//$o = '';
$r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s'
- and ( photo_flags = %d or photo_flags = %d ) $sql_extra GROUP BY `resource_id`",
+ and ((photo_flags = %d) or (photo_flags & %d)) $sql_extra GROUP BY `resource_id`",
intval($a->data['channel']['channel_id']),
dbesc('Contact Photos'),
dbesc( t('Contact Photos')),
intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE)
+ intval(($unsafe) ? (PHOTO_PROFILE|PHOTO_ADULT) : PHOTO_PROFILE)
);
if(count($r)) {
$a->set_pager_total(count($r));
@@ -1172,7 +1181,7 @@ function photos_content(&$a) {
dbesc('Contact Photos'),
dbesc( t('Contact Photos')),
intval(PHOTO_NORMAL),
- intval(PHOTO_PROFILE),
+ intval(($unsafe) ? (PHOTO_PROFILE|PHOTO_ADULT) : PHOTO_PROFILE),
intval($a->pager['itemspage']),
intval($a->pager['start'])
);
diff --git a/mod/ping.php b/mod/ping.php
index c5db6ba66..d7b9e3d2e 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -41,6 +41,19 @@ function ping_init(&$a) {
header("content-type: application/json");
+ $vnotify = false;
+
+ if(local_user()) {
+ $vnotify = get_pconfig(local_user(),'system','vnotify');
+ $evdays = intval(get_pconfig(local_user(),'system','evdays'));
+ }
+
+ // if unset show all visual notification types
+ if($vnotify === false)
+ $vnotify = (-1);
+ if($evdays < 1)
+ $evdays = 3;
+
/**
* If you have several windows open to this site and switch to a different channel
* in one of them, the others may get into a confused state showing you a page or options
@@ -71,6 +84,11 @@ function ping_init(&$a) {
}
unset($_SESSION['sysmsg_info']);
}
+ if(! ($vnotify & VNOTIFY_INFO))
+ $result['info'] = array();
+ if(! ($vnotify & VNOTIFY_ALERT))
+ $result['notice'] = array();
+
if($a->install) {
echo json_encode($result);
@@ -206,7 +224,7 @@ function ping_init(&$a) {
'url' => $zz['url'],
'photo' => $zz['photo'],
'when' => relative_date($zz['date']),
- 'class' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
+ 'hclass' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
'message' => strip_tags(bbcode($zz['msg']))
);
}
@@ -235,7 +253,7 @@ function ping_init(&$a) {
'url' => $zz['xchan_url'],
'photo' => $zz['xchan_photo_s'],
'when' => relative_date($zz['created']),
- 'class' => (($zz['mail_flags'] & MAIL_SEEN) ? 'notify-seen' : 'notify-unseen'),
+ 'hclass' => (($zz['mail_flags'] & MAIL_SEEN) ? 'notify-seen' : 'notify-unseen'),
'message' => t('sent you a private message'),
);
}
@@ -286,7 +304,7 @@ function ping_init(&$a) {
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
'when' => relative_date($rr['abook_created']),
- 'class' => ('notify-unseen'),
+ 'hclass' => ('notify-unseen'),
'message' => t('added your channel')
);
}
@@ -305,7 +323,7 @@ function ping_init(&$a) {
WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0
ORDER BY `start` DESC ",
intval(local_user()),
- dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + 7 days')),
+ dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
);
@@ -327,7 +345,7 @@ function ping_init(&$a) {
'url' => $rr['xchan_url'],
'photo' => $rr['xchan_photo_s'],
'when' => $when,
- 'class' => ('notify-unseen'),
+ 'hclass' => ('notify-unseen'),
'message' => t('posted an event')
);
}
@@ -343,101 +361,125 @@ function ping_init(&$a) {
* Normal ping - just the counts, no detail
*/
- $t = q("select count(*) as total from notify where uid = %d and seen = 0",
- intval(local_user())
- );
- if($t)
- $result['notify'] = intval($t[0]['total']);
+ if($vnotify & VNOTIFY_SYSTEM) {
+ $t = q("select count(*) as total from notify where uid = %d and seen = 0",
+ intval(local_user())
+ );
+ if($t)
+ $result['notify'] = intval($t[0]['total']);
+ }
$t1 = dba_timer();
- $r = q("SELECT id, item_restrict, item_flags FROM item
- WHERE (item_restrict = %d) and ( item_flags & %d )>0 and uid = %d",
- intval(ITEM_VISIBLE),
- intval(ITEM_UNSEEN),
- intval(local_user())
- );
+ if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
+ $r = q("SELECT id, item_restrict, item_flags FROM item
+ WHERE (item_restrict = %d) and ( item_flags & %d )>0 and uid = %d",
+ intval(ITEM_VISIBLE),
+ intval(ITEM_UNSEEN),
+ intval(local_user())
+ );
- if(count($r)) {
- $arr = array('items' => $r);
- call_hooks('network_ping', $arr);
+ if($r) {
+ $arr = array('items' => $r);
+ call_hooks('network_ping', $arr);
- foreach ($r as $it) {
- if($it['item_flags'] & ITEM_WALL)
- $result['home'] ++;
- else
- $result['network'] ++;
+ foreach ($r as $it) {
+ if($it['item_flags'] & ITEM_WALL)
+ $result['home'] ++;
+ else
+ $result['network'] ++;
+ }
}
}
+ if(! ($vnotify & VNOTIFY_NETWORK))
+ $result['network'] = 0;
+ if(! ($vnotify & VNOTIFY_CHANNEL))
+ $result['home'] = 0;
+
$t2 = dba_timer();
- $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)",
- intval(local_user()),
- intval(ABOOK_FLAG_PENDING),
- intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
- intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN)
- );
+ if($vnotify & VNOTIFY_INTRO) {
+ $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d)>0 and not ((abook_flags & %d)>0 or (xchan_flags & %d)>0)",
+ intval(local_user()),
+ intval(ABOOK_FLAG_PENDING),
+ intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
+ intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN)
+ );
- $t3 = dba_timer();
+ $t3 = dba_timer();
- if($intr)
- $result['intros'] = intval($intr[0]['total']);
+ if($intr)
+ $result['intros'] = intval($intr[0]['total']);
+ }
$t4 = dba_timer();
$channel = get_app()->get_channel();
- $mails = q("SELECT count(id) as total from mail
- WHERE channel_id = %d AND not (mail_flags & %d)>0 and from_xchan != '%s' ",
- intval(local_user()),
- intval(MAIL_SEEN),
- dbesc($channel['channel_hash'])
- );
- if($mails)
- $result['mail'] = intval($mails[0]['total']);
-
- if ($a->config['system']['register_policy'] == REGISTER_APPROVE && is_site_admin()) {
- $regs = q("SELECT count(account_id) as total from account where (account_flags & %d)>0",
- intval(ACCOUNT_PENDING)
+ if($vnotify & VNOTIFY_MAIL) {
+ $mails = q("SELECT count(id) as total from mail
+ WHERE channel_id = %d AND not (mail_flags & %d)>0 and from_xchan != '%s' ",
+ intval(local_user()),
+ intval(MAIL_SEEN),
+ dbesc($channel['channel_hash'])
);
- if($regs)
- $result['register'] = intval($regs[0]['total']);
+ if($mails)
+ $result['mail'] = intval($mails[0]['total']);
+ }
+
+ if($vnotify & VNOTIFY_REGISTER) {
+ if ($a->config['system']['register_policy'] == REGISTER_APPROVE && is_site_admin()) {
+ $regs = q("SELECT count(account_id) as total from account where (account_flags & %d)>0",
+ intval(ACCOUNT_PENDING)
+ );
+ if($regs)
+ $result['register'] = intval($regs[0]['total']);
+ }
}
$t5 = dba_timer();
- $events = q("SELECT type, start, adjust FROM `event`
- WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0
- ORDER BY `start` ASC ",
- intval(local_user()),
- dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + 7 days')),
- dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
- );
-
- if($events) {
- $result['all_events'] = count($events);
-
- if($result['all_events']) {
- $str_now = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y-m-d');
- foreach($events as $x) {
- $bd = false;
- if($x['type'] === 'birthday') {
- $result['birthdays'] ++;
- $bd = true;
- }
- else {
- $result['events'] ++;
- }
- if(datetime_convert('UTC', ((intval($x['adjust'])) ? date_default_timezone_get() : 'UTC'), $x['start'], 'Y-m-d') === $str_now) {
- $result['all_events_today'] ++;
- if($bd)
- $result['birthdays_today'] ++;
- else
- $result['events_today'] ++;
+ if($vnotify & (VNOTIFY_EVENT|VNOTIFY_EVENTTODAY|VNOTIFY_BIRTHDAY)) {
+ $events = q("SELECT type, start, adjust FROM `event`
+ WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0
+ ORDER BY `start` ASC ",
+ intval(local_user()),
+ dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
+ dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
+ );
+
+ if($events) {
+ $result['all_events'] = count($events);
+
+ if($result['all_events']) {
+ $str_now = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y-m-d');
+ foreach($events as $x) {
+ $bd = false;
+ if($x['type'] === 'birthday') {
+ $result['birthdays'] ++;
+ $bd = true;
+ }
+ else {
+ $result['events'] ++;
+ }
+ if(datetime_convert('UTC', ((intval($x['adjust'])) ? date_default_timezone_get() : 'UTC'), $x['start'], 'Y-m-d') === $str_now) {
+ $result['all_events_today'] ++;
+ if($bd)
+ $result['birthdays_today'] ++;
+ else
+ $result['events_today'] ++;
+ }
}
}
}
}
+ if(! ($vnotify & VNOTIFY_EVENT))
+ $result['all_events'] = $result['events'] = 0;
+ if(! ($vnotify & VNOTIFY_EVENTTODAY))
+ $result['all_events_today'] = $result['events_today'] = 0;
+ if(! ($vnotify & VNOTIFY_BIRTHDAY))
+ $result['birthdays'] = 0;
+
$x = json_encode($result);
diff --git a/mod/profiles.php b/mod/profiles.php
index 2c1ebd394..910c48743 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -234,6 +234,22 @@ function profiles_post(&$a) {
}
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
+
+ $y = substr($dob,0,4);
+ if((! ctype_digit($y)) || ($y < 1900))
+ $ignore_year = true;
+ else
+ $ignore_year = false;
+
+ if($dob != '0000-00-00') {
+ if(strpos($dob,'0000-') === 0) {
+ $ignore_year = true;
+ $dob = substr($dob,5);
+ }
+ $dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
+ if($ignore_year)
+ $dob = '0000-' . $dob;
+ }
$name = escape_tags(trim($_POST['name']));
@@ -514,6 +530,8 @@ function profiles_post(&$a) {
}
if($is_default) {
+ // reload the info for the sidebar widget - why does this not work?
+ profile_load($a,$channel['channel_address']);
proc_run('php','include/directory.php',local_user());
}
}
diff --git a/mod/settings.php b/mod/settings.php
index 08fad5471..396bb2972 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -337,6 +337,7 @@ function settings_post(&$a) {
intval(local_user()),
intval(ABOOK_FLAG_SELF)
);
+ set_pconfig(local_user(),'system','autoperms',(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0));
foreach($role_permissions as $p => $v) {
if(strpos($p,'channel_') !== false) {
@@ -358,6 +359,8 @@ function settings_post(&$a) {
$openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
$maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0);
$expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0);
+ $evdays = ((x($_POST,'evdays')) ? intval($_POST['evdays']) : 3);
+
$channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : '');
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
@@ -404,6 +407,32 @@ function settings_post(&$a) {
if(x($_POST,'notify8'))
$notify += intval($_POST['notify8']);
+
+ $vnotify = 0;
+
+ if(x($_POST,'vnotify1'))
+ $vnotify += intval($_POST['vnotify1']);
+ if(x($_POST,'vnotify2'))
+ $vnotify += intval($_POST['vnotify2']);
+ if(x($_POST,'vnotify3'))
+ $vnotify += intval($_POST['vnotify3']);
+ if(x($_POST,'vnotify4'))
+ $vnotify += intval($_POST['vnotify4']);
+ if(x($_POST,'vnotify5'))
+ $vnotify += intval($_POST['vnotify5']);
+ if(x($_POST,'vnotify6'))
+ $vnotify += intval($_POST['vnotify6']);
+ if(x($_POST,'vnotify7'))
+ $vnotify += intval($_POST['vnotify7']);
+ if(x($_POST,'vnotify8'))
+ $vnotify += intval($_POST['vnotify8']);
+ if(x($_POST,'vnotify9'))
+ $vnotify += intval($_POST['vnotify9']);
+ if(x($_POST,'vnotify10'))
+ $vnotify += intval($_POST['vnotify10']);
+ if(x($_POST,'vnotify11'))
+ $vnotify += intval($_POST['vnotify11']);
+
$channel = $a->get_channel();
$err = '';
@@ -432,6 +461,8 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
set_pconfig(local_user(),'system','blocktags',$blocktags);
set_pconfig(local_user(),'system','channel_menu',$channel_menu);
+ set_pconfig(local_user(),'system','vnotify',$vnotify);
+ set_pconfig(local_user(),'system','evdays',$evdays);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
dbesc($username),
@@ -929,9 +960,15 @@ function settings_content(&$a) {
}
}
+ $evdays = get_pconfig(local_user(),'system','evdays');
+ if(! $evdays)
+ $evdays = 3;
$permissions_role = get_pconfig(local_user(),'system','permissions_role');
$permissions_set = (($permissions_role && $permissions_role != 'custom') ? true : false);
+ $vnotify = get_pconfig(local_user(),'system','vnotify');
+ if($vnotify === false)
+ $vnotify = (-1);
$o .= replace_macros($stpl,array(
'$ptitle' => t('Channel Settings'),
@@ -1001,7 +1038,23 @@ function settings_content(&$a) {
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
'$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''),
-
+
+ '$lbl_vnot' => t('Show visual notifications including:'),
+
+ '$vnotify1' => array('vnotify1', t('Unseen matrix activity'), ($vnotify & VNOTIFY_NETWORK), VNOTIFY_NETWORK, ''),
+ '$vnotify2' => array('vnotify2', t('Unseen channel activity'), ($vnotify & VNOTIFY_CHANNEL), VNOTIFY_CHANNEL, ''),
+ '$vnotify3' => array('vnotify3', t('Unseen private messages'), ($vnotify & VNOTIFY_MAIL), VNOTIFY_MAIL, t('Recommended')),
+ '$vnotify4' => array('vnotify4', t('Upcoming events'), ($vnotify & VNOTIFY_EVENT), VNOTIFY_EVENT, ''),
+ '$vnotify5' => array('vnotify5', t('Events today'), ($vnotify & VNOTIFY_EVENTTODAY), VNOTIFY_EVENTTODAY, ''),
+ '$vnotify6' => array('vnotify6', t('Upcoming birthdays'), ($vnotify & VNOTIFY_BIRTHDAY), VNOTIFY_BIRTHDAY, t('Not available in all themes')),
+ '$vnotify7' => array('vnotify7', t('System (personal) notifications'), ($vnotify & VNOTIFY_SYSTEM), VNOTIFY_SYSTEM, ''),
+ '$vnotify8' => array('vnotify8', t('System info messages'), ($vnotify & VNOTIFY_INFO), VNOTIFY_INFO, t('Recommended')),
+ '$vnotify9' => array('vnotify9', t('System critical alerts'), ($vnotify & VNOTIFY_ALERT), VNOTIFY_ALERT, t('Recommended')),
+ '$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended')),
+ '$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, ''),
+
+ '$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),
+
'$h_advn' => t('Advanced Account/Page Type Settings'),
'$h_descadvn' => t('Change the behaviour of this account for special situations'),
'$pagetype' => $pagetype,
diff --git a/mod/webpages.php b/mod/webpages.php
index a5cfd00e6..baddebec8 100644
--- a/mod/webpages.php
+++ b/mod/webpages.php
@@ -1,37 +1,64 @@
<?php
-function webpages_content(&$a) {
+require_once('include/identity.php');
+require_once('include/conversation.php');
+require_once('include/acl_selectors.php');
+
+function webpages_init(&$a) {
+
+ if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $a->is_sys = true;
+ }
+ }
if(argc() > 1)
$which = argv(1);
- else {
+ else
+ return;
+
+ profile_load($a,$which);
+
+}
+
+
+function webpages_content(&$a) {
+
+ if(! $a->profile) {
notice( t('Requested profile is not available.') . EOL );
$a->error = 404;
return;
}
- $profile = 0;
- $channel = $a->get_channel();
-
- if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
- $which = $channel['channel_address'];
- $profile = argv(1);
- }
+ $which = argv(1);
- profile_load($a,$which,$profile);
+ $uid = local_user();
+ $owner = 0;
+ $channel = null;
+ $observer = $a->get_observer();
+ $channel = $a->get_channel();
- // Figure out who the page owner is.
- $r = q("select channel_id from channel where channel_address = '%s'",
- dbesc($which)
- );
- if($r) {
- $owner = intval($r[0]['channel_id']);
+ if($a->is_sys && is_site_admin()) {
+ $sys = get_sys_channel();
+ if($sys && intval($sys['channel_id'])) {
+ $uid = $owner = intval($sys['channel_id']);
+ $channel = $sys;
+ $observer = $sys;
+ }
}
- // Get the observer, check their permissions
+ if(! $owner) {
+ // Figure out who the page owner is.
+ $r = q("select channel_id from channel where channel_address = '%s'",
+ dbesc($which)
+ );
+ if($r) {
+ $owner = intval($r[0]['channel_id']);
+ }
+ }
- $observer = $a->get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
$perms = get_all_perms($owner,$ob_hash);
@@ -41,11 +68,6 @@ function webpages_content(&$a) {
return;
}
-// if(local_user() && local_user() == $owner) {
-// $a->set_widget('design',design_tools());
-// }
-
-
if(feature_enabled($owner,'expert')) {
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
if(! $mimetype)
@@ -60,14 +82,16 @@ function webpages_content(&$a) {
$layout = 'choose';
-// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
-// Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels.
- require_once ('include/conversation.php');
- require_once('include/acl_selectors.php');
+ // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
+ // Nickname is set to the observers xchan, and profile_uid to the owner's.
+ // This lets you post pages at other people's channels.
+
- if(local_user() && local_user() == $a->profile_uid) {
+ if((! $channel) && ($uid) && ($uid == $a->profile_uid)) {
$channel = $a->get_channel();
+ }
+ if($channel) {
$channel_acl = array(
'allow_cid' => $channel['channel_allow_cid'],
'allow_gid' => $channel['channel_allow_gid'],
@@ -78,21 +102,20 @@ function webpages_content(&$a) {
else
$channel_acl = array();
- require_once('include/conversation.php');
- $o = profile_tabs($a,true);
+ $o = profile_tabs($a,true);
$x = array(
- 'webpage' => ITEM_WEBPAGE,
- 'is_owner' => true,
- 'nickname' => $a->profile['channel_address'],
- 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
- 'bang' => (($group || $cid) ? '!' : ''),
- 'acl' => ((local_user() && local_user() == $owner) ? populate_acl($channel_acl,false) : ''),
- 'visitor' => true,
+ 'webpage' => ITEM_WEBPAGE,
+ 'is_owner' => true,
+ 'nickname' => $a->profile['channel_address'],
+ 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
+ 'bang' => '',
+ 'acl' => (($uid && $uid == $owner) ? populate_acl($channel_acl,false) : ''),
+ 'visitor' => true,
'profile_uid' => intval($owner),
- 'mimetype' => $mimetype,
- 'layout' => $layout,
+ 'mimetype' => $mimetype,
+ 'layout' => $layout,
);
if($_REQUEST['title'])
@@ -104,10 +127,12 @@ function webpages_content(&$a) {
$o .= status_editor($a,$x);
- // Get a list of webpages. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
+ // Get a list of webpages. We can't display all them because endless scroll makes that unusable,
+ // so just list titles and an edit link.
//TODO - this should be replaced with pagelist_widget
- $r = q("select * from item_id left join item on item_id.iid = item.id where item_id.uid = %d and service = 'WEBPAGE' order by item.created desc",
+ $r = q("select * from item_id left join item on item_id.iid = item.id
+ where item_id.uid = %d and service = 'WEBPAGE' order by item.created desc",
intval($owner)
);
@@ -117,30 +142,36 @@ function webpages_content(&$a) {
$pages = array();
foreach($r as $rr) {
unobscure($rr);
- $pages[$rr['iid']][] = array('url' => $rr['iid'],'pagetitle' => $rr['sid'],'title' => $rr['title'],'created' => datetime_convert('UTC',date_default_timezone_get(),$rr['created']),'edited' => datetime_convert('UTC',date_default_timezone_get(),$rr['edited']));
+ $pages[$rr['iid']][] = array(
+ 'url' => $rr['iid'],
+ 'pagetitle' => $rr['sid'],
+ 'title' => $rr['title'],
+ 'created' => datetime_convert('UTC',date_default_timezone_get(),$rr['created']),
+ 'edited' => datetime_convert('UTC',date_default_timezone_get(),$rr['edited'])
+ );
}
}
-//Build the base URL for edit links
- $url = z_root() . "/editwebpage/" . $which;
-// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
- return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
- '$listtitle' => t('Webpages'),
- '$baseurl' => $url,
- '$edit' => t('Edit'),
- '$pages' => $pages,
- '$channel' => $which,
- '$view' => t('View'),
- '$preview' => t('Preview'),
- '$actions_txt' => t('Actions'),
+ //Build the base URL for edit links
+ $url = z_root() . '/editwebpage/' . $which;
+
+ $o .= replace_macros(get_markup_template('webpagelist.tpl'), array(
+ '$listtitle' => t('Webpages'),
+ '$baseurl' => $url,
+ '$edit' => t('Edit'),
+ '$pages' => $pages,
+ '$channel' => $which,
+ '$view' => t('View'),
+ '$preview' => t('Preview'),
+ '$actions_txt' => t('Actions'),
'$pagelink_txt' => t('Page Link'),
- '$title_txt' => t('Title'),
- '$created_txt' => t('Created'),
- '$edited_txt' => t('Edited')
+ '$title_txt' => t('Title'),
+ '$created_txt' => t('Created'),
+ '$edited_txt' => t('Edited')
-));
+ ));
- $o .= '</div>';
+ return $o;
}
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 7966caea8..a1a62dd3f 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -108,6 +108,21 @@ function zfinger_init(&$a) {
if($deleted || $censored)
$searchable = false;
+ $public_forum = false;
+
+ $role = get_pconfig($e['channel_id'],'system','permissions_role');
+ if($role === 'forum') {
+ $public_forum = true;
+ }
+ else {
+ // check if it has characteristics of a public forum based on custom permissions.
+ $t = q("select abook_my_perms from abook where abook_channel = %d and (abook_flags & %d) limit 1",
+ intval($e['channel_id']),
+ intval(ABOOK_FLAG_SELF)
+ );
+ if($t && ($t[0]['abook_my_perms'] & PERMS_W_TAGWALL))
+ $public_forum = true;
+ }
// This is for birthdays and keywords, but must check access permissions
@@ -174,6 +189,7 @@ function zfinger_init(&$a) {
$ret['target_sig'] = $zsig;
$ret['searchable'] = $searchable;
$ret['adult_content'] = $adult_channel;
+ $ret['public_forum'] = $public_forum;
if($deleted)
$ret['deleted'] = $deleted;