mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Continued with coding convention:
- added curly braces around conditional code blocks - added space between if/foreach/... and brace - made some SQL keywords upper-cased and added back-ticks to columns/table names Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
bb06d9ce32
commit
b4bc07fdcc
9 changed files with 78 additions and 56 deletions
|
@ -66,7 +66,7 @@ function do_like($item_id, $verb) {
|
|||
|
||||
$owner_uid = $item['uid'];
|
||||
|
||||
if(! can_write_wall($a,$owner_uid)) {
|
||||
if (! can_write_wall($a,$owner_uid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,9 @@ function do_like($item_id, $verb) {
|
|||
if (! dbm::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
if(! $r[0]['self'])
|
||||
if (! $r[0]['self']) {
|
||||
$remote_owner = $r[0];
|
||||
}
|
||||
}
|
||||
|
||||
// this represents the post owner on this system.
|
||||
|
@ -91,21 +92,22 @@ function do_like($item_id, $verb) {
|
|||
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
|
||||
intval($owner_uid)
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$owner = $r[0];
|
||||
}
|
||||
|
||||
if(! $owner) {
|
||||
if (! $owner) {
|
||||
logger('like: no owner');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! $remote_owner)
|
||||
if (! $remote_owner) {
|
||||
$remote_owner = $owner;
|
||||
|
||||
}
|
||||
|
||||
// This represents the person posting
|
||||
|
||||
if((local_user()) && (local_user() == $owner_uid)) {
|
||||
if ((local_user()) && (local_user() == $owner_uid)) {
|
||||
$contact = $owner;
|
||||
}
|
||||
else {
|
||||
|
@ -116,7 +118,7 @@ function do_like($item_id, $verb) {
|
|||
if (dbm::is_result($r))
|
||||
$contact = $r[0];
|
||||
}
|
||||
if(! $contact) {
|
||||
if (! $contact) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -125,7 +127,7 @@ function do_like($item_id, $verb) {
|
|||
|
||||
// event participation are essentially radio toggles. If you make a subsequent choice,
|
||||
// we need to eradicate your first choice.
|
||||
if($activity === ACTIVITY_ATTEND || $activity === ACTIVITY_ATTENDNO || $activity === ACTIVITY_ATTENDMAYBE) {
|
||||
if ($activity === ACTIVITY_ATTEND || $activity === ACTIVITY_ATTENDNO || $activity === ACTIVITY_ATTENDMAYBE) {
|
||||
$verbs = " '" . dbesc(ACTIVITY_ATTEND) . "','" . dbesc(ACTIVITY_ATTENDNO) . "','" . dbesc(ACTIVITY_ATTENDMAYBE) . "' ";
|
||||
}
|
||||
|
||||
|
@ -162,8 +164,9 @@ function do_like($item_id, $verb) {
|
|||
$uri = item_new_uri($a->get_hostname(),$owner_uid);
|
||||
|
||||
$post_type = (($item['resource-id']) ? t('photo') : t('status'));
|
||||
if($item['object-type'] === ACTIVITY_OBJ_EVENT)
|
||||
if ($item['object-type'] === ACTIVITY_OBJ_EVENT) {
|
||||
$post_type = t('event');
|
||||
}
|
||||
$objtype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE );
|
||||
$link = xmlify('<link rel="alternate" type="text/html" href="' . App::get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
|
||||
$body = $item['body'];
|
||||
|
@ -179,20 +182,31 @@ function do_like($item_id, $verb) {
|
|||
<content>$body</content>
|
||||
</object>
|
||||
EOT;
|
||||
if($verb === 'like')
|
||||
if ($verb === 'like') {
|
||||
$bodyverb = t('%1$s likes %2$s\'s %3$s');
|
||||
if($verb === 'dislike')
|
||||
}
|
||||
if ($verb === 'dislike') {
|
||||
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
|
||||
if($verb === 'attendyes')
|
||||
}
|
||||
if ($verb === 'attendyes') {
|
||||
$bodyverb = t('%1$s is attending %2$s\'s %3$s');
|
||||
if($verb === 'attendno')
|
||||
}
|
||||
if ($verb === 'attendno') {
|
||||
$bodyverb = t('%1$s is not attending %2$s\'s %3$s');
|
||||
if($verb === 'attendmaybe')
|
||||
}
|
||||
if ($verb === 'attendmaybe') {
|
||||
$bodyverb = t('%1$s may attend %2$s\'s %3$s');
|
||||
}
|
||||
|
||||
if(! isset($bodyverb))
|
||||
return false;
|
||||
if (! isset($bodyverb)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
||||
$plink = '[url=' . App::get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
|
||||
|
||||
/// @TODO Or rewrite this to multi-line initialization of the array?
|
||||
$arr = array();
|
||||
|
||||
$arr['guid'] = get_guid(32);
|
||||
|
@ -212,12 +226,7 @@ EOT;
|
|||
$arr['author-name'] = $contact['name'];
|
||||
$arr['author-link'] = $contact['url'];
|
||||
$arr['author-avatar'] = $contact['thumb'];
|
||||
|
||||
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
||||
$plink = '[url=' . App::get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
|
||||
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
|
||||
|
||||
$arr['verb'] = $activity;
|
||||
$arr['object-type'] = $objtype;
|
||||
$arr['object'] = $obj;
|
||||
|
@ -231,7 +240,7 @@ EOT;
|
|||
|
||||
$post_id = item_store($arr);
|
||||
|
||||
if(! $item['visible']) {
|
||||
if (! $item['visible']) {
|
||||
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||
intval($item['id']),
|
||||
intval($owner_uid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue