fixing broken things again after the latest round of ripping out the yellow slime and replacing it with red slime.
This commit is contained in:
parent
1a6415807e
commit
f608373d08
@ -38,7 +38,7 @@ class Conversation extends BaseObject {
|
||||
$this->profile_owner = local_user();
|
||||
$this->writable = true;
|
||||
break;
|
||||
case 'profile':
|
||||
case 'channel':
|
||||
$this->profile_owner = $a->profile['profile_uid'];
|
||||
$this->writable = can_write_wall($a,$this->profile_owner);
|
||||
break;
|
||||
|
@ -454,7 +454,7 @@ class Item extends BaseObject {
|
||||
if($conv) {
|
||||
// This will allow us to comment on wall-to-wall items owned by our friends
|
||||
// and community forums even if somebody else wrote the post.
|
||||
return ($this->writable || ($this->is_visiting() && $conv->get_mode() == 'profile'));
|
||||
return ($this->writable || ($this->is_visiting() && $conv->get_mode() == 'channel'));
|
||||
}
|
||||
return $this->writable;
|
||||
}
|
||||
@ -515,7 +515,7 @@ class Item extends BaseObject {
|
||||
'$return_path' => '',
|
||||
'$threaded' => $this->is_threaded(),
|
||||
'$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
|
||||
'$type' => (($conv->get_mode() === 'profile') ? 'wall-comment' : 'net-comment'),
|
||||
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
|
||||
'$id' => $this->get_id(),
|
||||
'$parent' => $this->get_id(),
|
||||
'$qcomment' => $qcomment,
|
||||
@ -556,7 +556,7 @@ class Item extends BaseObject {
|
||||
$this->wall_to_wall = false;
|
||||
|
||||
if($this->is_toplevel()) {
|
||||
if( (! $this->get_data_value('self')) && ($conv->get_mode() !== 'profile')) {
|
||||
if( (! $this->get_data_value('self')) && ($conv->get_mode() !== 'channel')) {
|
||||
if($this->get_data_value('wall')) {
|
||||
|
||||
// On the network page, I am the owner. On the display page it will be the profile owner.
|
||||
|
@ -130,7 +130,7 @@ function create_identity($arr) {
|
||||
// It's ok for this to fail if it's an imported channel, and therefore the hash is a duplicate
|
||||
|
||||
|
||||
$r = q("INSERT INTO `profile` ( `aid`, `uid`, `profile_guid`, `profile_name`, `is_default`, `name`, `photo`, `thumb`)
|
||||
$r = q("INSERT INTO profile ( aid, uid, profile_guid, profile_name, is_default, name, photo, thumb)
|
||||
VALUES ( %d, %d, '%s', '%s', %d, '%s', '%s', '%s') ",
|
||||
intval($ret['channel']['channel_account_id']),
|
||||
intval($newuid),
|
||||
@ -142,6 +142,17 @@ function create_identity($arr) {
|
||||
dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}")
|
||||
);
|
||||
|
||||
$r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_closeness, abook_created, abook_updated, abook_flags )
|
||||
values ( %d, %d, '%s', %d, '%s', '%s', %d ) ",
|
||||
intval($ret['channel']['channel_account_id']),
|
||||
intval($newuid),
|
||||
dbesc($hash),
|
||||
intval(0),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
intval(ABOOK_FLAG_SELF)
|
||||
);
|
||||
|
||||
|
||||
// Create a group with no members. This allows somebody to use it
|
||||
// right away as a default group for new contacts.
|
||||
|
@ -161,14 +161,16 @@ function channel_content(&$a, $update = 0) {
|
||||
|
||||
|
||||
if($update) {
|
||||
|
||||
$r = q("SELECT distinct(parent) AS `item_id` from item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
WHERE uid = %d AND item_restrict = 0
|
||||
AND item_flags & %d
|
||||
AND (item_flags & %d)
|
||||
AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||
$sql_extra
|
||||
ORDER BY created DESC",
|
||||
intval($a->profile['profile_uid']),
|
||||
intval(ITEM_WALL)
|
||||
intval(ITEM_WALL|ITEM_UNSEEN|ITEM_THREAD_TOP),
|
||||
intval(ABOOK_FLAG_BLOCKED)
|
||||
);
|
||||
|
||||
}
|
||||
@ -191,12 +193,15 @@ function channel_content(&$a, $update = 0) {
|
||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||
|
||||
$r = q("SELECT id AS item_id FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
WHERE uid = %d AND item_restrict = 0
|
||||
AND item_flags & %d
|
||||
AND (item_flags & %d)
|
||||
AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||
$sql_extra $sql_extra2
|
||||
ORDER BY created DESC $pager_sql ",
|
||||
intval($a->profile['profile_uid']),
|
||||
intval(ITEM_WALL|ITEM_THREAD_TOP)
|
||||
intval(ITEM_WALL|ITEM_THREAD_TOP),
|
||||
intval(ABOOK_FLAG_BLOCKED)
|
||||
|
||||
);
|
||||
|
||||
|
@ -589,20 +589,22 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
if(($cmin != 0) || ($cmax != 99)) {
|
||||
|
||||
$sql_nets .= " AND abook.abook_closeness >= " . intval($cmin) . " ";
|
||||
$sql_nets .= " AND abook.abook_closeness <= " . intval($cmax) . " ";
|
||||
// Not everybody who shows up in the network stream will be in your address book.
|
||||
// By default those that aren't are assumed to have closeness = 99; but this isn't
|
||||
// recorded anywhere. So if cmax is 99, we'll open the search up to anybody in
|
||||
// the stream with a NULL address book entry.
|
||||
|
||||
// This is ugly - but we won't have an abook for everybody as we
|
||||
// used to have a contact for everybody in Friendica.
|
||||
// Might be an unknown poster (99) or our own post (0).
|
||||
// Need to refactor this after a solution presents itself
|
||||
$sql_nets .= " AND ";
|
||||
|
||||
if($cmax == 99)
|
||||
$sql_nets .= " OR ( abook.abook_id = NULL AND item.author_xchan != '" . $ch['channel_hash'] . " ) ";
|
||||
if($cmin == 0 && local_user()) {
|
||||
$ch = $a->get_channel();
|
||||
$sql_nets .= " OR ( item.author_xchan = '" . $ch['channel_hash'] . "' ) ";
|
||||
}
|
||||
$sql_nets .= " ( ";
|
||||
|
||||
$sql_nets .= "( abook.abook_closeness >= " . intval($cmin) . " ";
|
||||
$sql_nets .= " AND abook.abook_closeness <= " . intval($cmax) . " ) ";
|
||||
|
||||
if($cmax == 99)
|
||||
$sql_nets .= " OR abook.abook_closeness IS NULL ) ";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -640,13 +642,15 @@ function network_content(&$a, $update = 0, $load = false) {
|
||||
$ordering = "`commented`";
|
||||
|
||||
// Fetch a page full of parent items for this page
|
||||
dbg(1);
|
||||
|
||||
if($update && (! $load)) {
|
||||
$r = q("SELECT item.parent AS item_id FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
WHERE item.uid = %d AND item.item_restrict = 0
|
||||
WHERE item.uid = %d AND item.item_restrict = 0
|
||||
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||
$sql_extra3 $sql_extra $sql_nets ",
|
||||
intval(local_user())
|
||||
intval(local_user()),
|
||||
intval(ABOOK_FLAG_BLOCKED)
|
||||
);
|
||||
}
|
||||
else {
|
||||
@ -655,13 +659,15 @@ dbg(1);
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
WHERE item.uid = %d AND item.item_restrict = 0
|
||||
AND item.parent = item.id
|
||||
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||
$sql_extra3 $sql_extra $sql_nets
|
||||
ORDER BY item.$ordering DESC $pager_sql ",
|
||||
intval(local_user())
|
||||
intval(local_user()),
|
||||
intval(ABOOK_FLAG_BLOCKED)
|
||||
);
|
||||
|
||||
}
|
||||
dbg(0);
|
||||
|
||||
// Then fetch all the children of the parents that are on this page
|
||||
|
||||
if($r && count($r)) {
|
||||
|
Reference in New Issue
Block a user