aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php184
-rw-r--r--include/identity.php73
-rw-r--r--include/nav.php3
-rw-r--r--include/zot.php34
4 files changed, 212 insertions, 82 deletions
diff --git a/include/conversation.php b/include/conversation.php
index e20fef9f6..13990e89b 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1305,3 +1305,187 @@ function prepare_page($item) {
));
}
+
+function network_tabs() {
+ $a = get_app();
+ $no_active='';
+ $starred_active = '';
+ $new_active = '';
+ $all_active = '';
+ $search_active = '';
+ $conv_active = '';
+ $spam_active = '';
+ $postord_active = '';
+
+ if(x($_GET,'new')) {
+ $new_active = 'active';
+ }
+
+ if(x($_GET,'search')) {
+ $search_active = 'active';
+ }
+
+ if(x($_GET,'star')) {
+ $starred_active = 'active';
+ }
+
+ if(x($_GET,'conv')) {
+ $conv_active = 'active';
+ }
+
+ if(x($_GET,'spam')) {
+ $spam_active = 'active';
+ }
+
+
+
+ if (($new_active == '')
+ && ($starred_active == '')
+ && ($conv_active == '')
+ && ($search_active == '')
+ && ($spam_active == '')) {
+ $no_active = 'active';
+ }
+
+ if ($no_active=='active' && x($_GET,'order')) {
+ switch($_GET['order']){
+ case 'post': $postord_active = 'active'; $no_active=''; break;
+ case 'comment' : $all_active = 'active'; $no_active=''; break;
+ }
+ }
+
+ if ($no_active=='active') $all_active='active';
+
+ $cmd = $a->cmd;
+
+ // tabs
+ $tabs = array(
+ array(
+ 'label' => t('Commented Order'),
+ 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
+ 'sel'=>$all_active,
+ 'title'=> t('Sort by Comment Date'),
+ ),
+ array(
+ 'label' => t('Posted Order'),
+ 'url'=>$a->get_baseurl(true) . '/' . $cmd . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
+ 'sel'=>$postord_active,
+ 'title' => t('Sort by Post Date'),
+ ),
+
+ array(
+ 'label' => t('Personal'),
+ 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&conv=1',
+ 'sel' => $conv_active,
+ 'title' => t('Posts that mention or involve you'),
+ ),
+ array(
+ 'label' => t('New'),
+ 'url' => $a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&new=1',
+ 'sel' => $new_active,
+ 'title' => t('Activity Stream - by date'),
+ ),
+
+ );
+
+ if(feature_enabled(local_user(),'star_posts'))
+ $tabs[] = array(
+ 'label' => t('Starred'),
+ 'url'=>$a->get_baseurl(true) . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1',
+ 'sel'=>$starred_active,
+ 'title' => t('Favourite Posts'),
+ );
+
+ // Not yet implemented
+
+ if(feature_enabled(local_user(),'spam_filter'))
+ $tabs[] = array(
+ 'label' => t('Spam'),
+ 'url'=>$a->get_baseurl(true) . '/network?f=&spam=1',
+ 'sel'=> $spam_active,
+ 'title' => t('Posts flagged as SPAM'),
+ );
+
+ $arr = array('tabs' => $tabs);
+ call_hooks('network_tabs', $arr);
+
+ $tpl = get_markup_template('common_tabs.tpl');
+
+ return replace_macros($tpl,array('$tabs' => $arr['tabs']));
+
+}
+
+
+
+function profile_tabs($a, $is_owner=False, $nickname=Null){
+ //echo "<pre>"; var_dump($a->user); killme();
+
+ $channel = $a->get_channel();
+
+ if (is_null($nickname))
+ $nickname = $channel['channel_address'];
+
+ if(x($_GET,'tab'))
+ $tab = notags(trim($_GET['tab']));
+
+ $url = $a->get_baseurl() . '/channel/' . $nickname;
+ $pr = $a->get_baseurl() . '/profile/' . $nickname;
+
+ $tabs = array(
+ array(
+ 'label' => t('Channel'),
+ 'url' => $url,
+ 'sel' => ((argv(0) == 'channel') ? 'active' : ''),
+ 'title' => t('Status Messages and Posts'),
+ 'id' => 'status-tab',
+ ),
+ array(
+ 'label' => t('About'),
+ 'url' => $pr,
+ 'sel' => ((argv(0) == 'profile') ? 'active' : ''),
+ 'title' => t('Profile Details'),
+ 'id' => 'profile-tab',
+ ),
+ array(
+ 'label' => t('Photos'),
+ 'url' => $a->get_baseurl() . '/photos/' . $nickname,
+ 'sel' => ((argv(0) == 'photos') ? 'active' : ''),
+ 'title' => t('Photo Albums'),
+ 'id' => 'photo-tab',
+ ),
+ );
+
+
+ if ($is_owner){
+ $tabs[] = array(
+ 'label' => t('Events'),
+ 'url' => $a->get_baseurl() . '/events',
+ 'sel' => ((argv(0) == 'events') ? 'active' : ''),
+ 'title' => t('Events and Calendar'),
+ 'id' => 'events-tab',
+ );
+ if(feature_enabled(local_user(),'webpages')){
+ $tabs[] = array(
+ 'label' => t('Webpages'),
+ 'url' => $a->get_baseurl() . '/webpages/' . $nickname,
+ 'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
+ 'title' => t('Manage Webpages'),
+ 'id' => 'webpages-tab',
+ );}
+ }
+ else {
+ // FIXME
+ // we probably need a listing of events that were created by
+ // this channel and are visible to the observer
+
+
+ }
+
+
+ $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
+ call_hooks('profile_tabs', $arr);
+
+ $tpl = get_markup_template('common_tabs.tpl');
+
+ return replace_macros($tpl,array('$tabs' => $arr['tabs']));
+}
diff --git a/include/identity.php b/include/identity.php
index 0856add44..e22bb8645 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -992,79 +992,6 @@ function advanced_profile(&$a) {
-function profile_tabs($a, $is_owner=False, $nickname=Null){
- //echo "<pre>"; var_dump($a->user); killme();
-
- $channel = $a->get_channel();
-
- if (is_null($nickname))
- $nickname = $channel['channel_address'];
-
- if(x($_GET,'tab'))
- $tab = notags(trim($_GET['tab']));
-
- $url = $a->get_baseurl() . '/channel/' . $nickname;
- $pr = $a->get_baseurl() . '/profile/' . $nickname;
-
- $tabs = array(
- array(
- 'label' => t('Channel'),
- 'url' => $url,
- 'sel' => ((argv(0) == 'channel') ? 'active' : ''),
- 'title' => t('Status Messages and Posts'),
- 'id' => 'status-tab',
- ),
- array(
- 'label' => t('About'),
- 'url' => $pr,
- 'sel' => ((argv(0) == 'profile') ? 'active' : ''),
- 'title' => t('Profile Details'),
- 'id' => 'profile-tab',
- ),
- array(
- 'label' => t('Photos'),
- 'url' => $a->get_baseurl() . '/photos/' . $nickname,
- 'sel' => ((argv(0) == 'photos') ? 'active' : ''),
- 'title' => t('Photo Albums'),
- 'id' => 'photo-tab',
- ),
- );
-
-
- if ($is_owner){
- $tabs[] = array(
- 'label' => t('Events'),
- 'url' => $a->get_baseurl() . '/events',
- 'sel' => ((argv(0) == 'events') ? 'active' : ''),
- 'title' => t('Events and Calendar'),
- 'id' => 'events-tab',
- );
- if(feature_enabled(local_user(),'webpages')){
- $tabs[] = array(
- 'label' => t('Webpages'),
- 'url' => $a->get_baseurl() . '/webpages/' . $nickname,
- 'sel' => ((argv(0) == 'webpages') ? 'active' : ''),
- 'title' => t('Manage Webpages'),
- 'id' => 'webpages-tab',
- );}
- }
- else {
- // FIXME
- // we probably need a listing of events that were created by
- // this channel and are visible to the observer
-
-
- }
-
-
- $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs);
- call_hooks('profile_tabs', $arr);
-
- $tpl = get_markup_template('common_tabs.tpl');
-
- return replace_macros($tpl,array('$tabs' => $arr['tabs']));
-}
-
function get_my_url() {
if(x($_SESSION,'zrl_override'))
diff --git a/include/nav.php b/include/nav.php
index 56644f6fd..f89de2de0 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -147,16 +147,13 @@ EOT;
if(local_user()) {
$nav['network'] = array('network', t('Matrix'), "", t('Your matrix'));
- $nav['network']['all']=array('notifications/network', t('See all matrix notifications'), "", "");
$nav['network']['mark'] = array('', t('Mark all matrix notifications seen'), '','');
$nav['home'] = array('channel/' . $channel['channel_address'], t('Channel Home'), "", t('Channel home'));
- $nav['home']['all']=array('notifications/channel', t('See all channel notifications'), "", "");
$nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '','');
$nav['intros'] = array('connections/pending', t('Intros'), "", t('New Connections'));
- $nav['intros']['all']=array('intro', t('See all channel introductions'), "", "");
$nav['notifications'] = array('notifications/system', t('Notices'), "", t('Notifications'));
diff --git a/include/zot.php b/include/zot.php
index 37373e7ad..77d82f110 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -670,19 +670,41 @@ function import_xchan($arr,$ud_flags = 1) {
require_once('include/photo/photo_driver.php');
- $photos = import_profile_photo($arr['photo'],$xchan_hash);
- $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
+ // see if this is a channel clone that's hosted locally - which we treat different from other xchans/connections
+
+ $local = q("select channel_account_id, channel_id from channel where channel_hash = '%s' limit 1",
+ dbesc($xchan_hash)
+ );
+ if($local) {
+ $ph = z_fetch_url($arr['photo'],true);
+ if($ph['success']) {
+ import_channel_photo($ph['body'], $arr['photo_mimetype'], $local[0]['channel_account_id'],$local[0]['channel_id']);
+ // reset the names in case they got messed up when we had a bug in this function
+ $photos = array(
+ z_root() . '/photo/profile/l/' . $local[0]['channel_id'],
+ z_root() . '/photo/profile/m/' . $local[0]['channel_id'],
+ z_root() . '/photo/profile/s/' . $local[0]['channel_id'],
+ $arr['photo_mimetype']
+ );
+ }
+ }
+ else {
+ $photos = import_profile_photo($arr['photo'],$xchan_hash);
+ }
+ if($photos) {
+ $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
where xchan_hash = '%s' limit 1",
- dbesc($arr['photo_updated']),
+ dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
dbesc($photos[3]),
dbesc($xchan_hash)
- );
+ );
- $what .= 'photo ';
- $changed = true;
+ $what .= 'photo ';
+ $changed = true;
+ }
}
// what we are missing for true hub independence is for any changes in the primary hub to