aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-27 21:06:11 -0700
committerfriendica <info@friendica.com>2013-08-27 21:06:11 -0700
commit7bb92899218a2a0de261d3caeed1d723a508cc13 (patch)
treed4736eaca6226e767130547a55f827831dc64d96
parent390a1ce552d57fe5eea6bc2ed43ea0b8bb07c77b (diff)
downloadvolse-hubzilla-7bb92899218a2a0de261d3caeed1d723a508cc13.tar.gz
volse-hubzilla-7bb92899218a2a0de261d3caeed1d723a508cc13.tar.bz2
volse-hubzilla-7bb92899218a2a0de261d3caeed1d723a508cc13.zip
Preparatory work for photo conversations (third time). Also take away unused "post new activity" preferences until they actually do something.
-rw-r--r--include/conversation.php19
-rw-r--r--mod/connections.php9
-rw-r--r--mod/photos.php18
-rwxr-xr-xview/tpl/settings.tpl6
-rwxr-xr-xview/tpl/threaded_conversation.tpl3
5 files changed, 34 insertions, 21 deletions
diff --git a/include/conversation.php b/include/conversation.php
index f6a5b90da..bd1e12c4e 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -93,10 +93,7 @@ function localize_item(&$item){
if (activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)){
- if(is_array($item['object']))
- $obj = $item['object'];
- else
- $obj = json_decode_plus($item['object']);
+ $obj = json_decode_plus($item['object']);
if($obj['author'] && $obj['author']['link'])
$author_link = get_rel_link($obj['author']['link'],'alternate');
@@ -397,6 +394,7 @@ function visible_activity($item) {
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
$tstart = dba_timer();
+ $content_html = '';
require_once('bbcode.php');
@@ -494,10 +492,16 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
}
- else if($mode === 'search') {
+ elseif($mode === 'search') {
$live_update_div = '<div id="live-search"></div>' . "\r\n";
}
-
+ elseif($mode === 'photos') {
+ $profile_onwer = $a->profile['profile_uid'];
+ $page_writeable = ($profile_owner == local_user());
+ $live_update_div = '<div id="live-photos"></div>' . "\r\n";
+ // for photos we've already formatted the top-level item (the photo)
+ $content_html = $a->data['photo_html'];
+ }
$page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
@@ -801,8 +805,9 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
// logger('nouveau: ' . print_r($threads,true));
- $o = replace_macros($page_template, array(
+ $o .= replace_macros($page_template, array(
'$baseurl' => $a->get_baseurl($ssl_state),
+ '$photo_item' => $content_html,
'$live_update' => $live_update_div,
'$remove' => t('remove'),
'$mode' => $mode,
diff --git a/mod/connections.php b/mod/connections.php
index 7c4d8acc1..47c8d9c44 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -99,9 +99,11 @@ function connections_post(&$a) {
}
$abook_flags = $orig_record[0]['abook_flags'];
+ $new_friend = false;
if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) {
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
+ $new_friend = true;
}
$r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d
@@ -123,6 +125,13 @@ function connections_post(&$a) {
proc_run('php', 'include/notifier.php', 'permission_update', $contact_id);
}
+ if($new_friend) {
+ // Check if settings permit ("post new friend activity" is allowed, and
+ // friends in general or this friend in particular aren't hidden)
+ // and send out a new friend activity
+ // TODO
+ }
+
// Refresh the structure in memory with the new data
$r = q("SELECT abook.*, xchan.*
diff --git a/mod/photos.php b/mod/photos.php
index 5573f6a87..a248feaf5 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -852,7 +852,7 @@ function photos_content(&$a) {
// fetch image, item containing image, then comments
- $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
+ $ph = q("SELECT aid,uid,xchan,resource_id,created,edited,title,desc,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 ",
intval($owner_uid),
dbesc($datum),
@@ -874,7 +874,7 @@ function photos_content(&$a) {
intval(PHOTO_PROFILE)
);
if($ph)
- notice( t('Permission denied. Access to this item may be restricted.'));
+ notice( t('Permission denied. Access to this item may be restricted.') . EOL);
else
notice( t('Photo not available') . EOL );
return;
@@ -1140,15 +1140,9 @@ function photos_content(&$a) {
}
- if(local_user() && ($item['contact-uid'] == local_user())
- && ($item['network'] == 'dfrn') && (! $item['self'] )) {
- $profile_url = $redirect_url;
- $sparkle = ' sparkle';
- }
- else {
- $profile_url = $item['url'];
- $sparkle = '';
- }
+ $profile_url = $item['url'];
+ $sparkle = '';
+
$diff_author = (($item['url'] !== $item['author-link']) ? true : false);
@@ -1210,6 +1204,8 @@ function photos_content(&$a) {
'$comments' => $comments,
'$paginate' => $paginate,
));
+
+ $a->data['photo_html'] = $o;
return $o;
}
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index 194b90e80..0471546a6 100755
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -100,9 +100,9 @@
<div id="settings-notifications">
<div id="settings-activity-desc">{{$activity_options}}</div>
-
-{{include file="field_checkbox.tpl" field=$post_newfriend}}
-{{include file="field_checkbox.tpl" field=$post_joingroup}}
+{{*the next two aren't yet implemented *}}
+{{*include file="field_checkbox.tpl" field=$post_newfriend*}}
+{{*include file="field_checkbox.tpl" field=$post_joingroup*}}
{{include file="field_checkbox.tpl" field=$post_profilechange}}
diff --git a/view/tpl/threaded_conversation.tpl b/view/tpl/threaded_conversation.tpl
index 4bfcde896..2d71f01ab 100755
--- a/view/tpl/threaded_conversation.tpl
+++ b/view/tpl/threaded_conversation.tpl
@@ -1,3 +1,6 @@
+{{if $photo_item}}
+{{$photo_item}}
+{{/if}}
{{foreach $threads as $thread_item}}
{{include file="{{$thread_item.template}}" item=$thread_item}}
{{/foreach}}