Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
zotlabs 2019-06-12 17:27:29 -07:00
commit 11bb9c2e24
10 changed files with 77 additions and 15 deletions

View file

@ -340,6 +340,7 @@ class Apps {
'View Profile' => t('View Profile'),
'Photos' => t('Photos'),
'Events' => t('Events'),
'No Comment' => t('No Comment'),
'Directory' => t('Directory'),
'Help' => t('Help'),
'Mail' => t('Mail'),

View file

@ -2232,7 +2232,7 @@ class Libzot {
$item_found = false;
$post_id = 0;
$r = q("select id, author_xchan, owner_xchan, source_xchan, item_deleted from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
$r = q("select * from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
and mid = '%s' and uid = %d limit 1",
dbesc($sender),
dbesc($sender),
@ -2242,11 +2242,12 @@ class Libzot {
);
if ($r) {
if ($r[0]['author_xchan'] === $sender || $r[0]['owner_xchan'] === $sender || $r[0]['source_xchan'] === $sender) {
$stored = $r[0];
if ($stored['author_xchan'] === $sender || $stored['owner_xchan'] === $sender || $stored['source_xchan'] === $sender) {
$ownership_valid = true;
}
$post_id = $r[0]['id'];
$post_id = $stored['id'];
$item_found = true;
}
else {
@ -2270,15 +2271,15 @@ class Libzot {
return false;
}
if ($item['resource_type'] = 'event') {
if ($stored['resource_type'] === 'event') {
$i = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1",
dbesc($item['resource_id']),
dbesc($stored['resource_id']),
intval($uid)
);
if ($i) {
if ($i[0]['event_xchan'] === $sender) {
q("delete from event where event_hash = '%s' and uid = %d",
dbesc($item['resource_id']),
dbesc($stored['resource_id']),
intval($uid)
);
}
@ -2289,7 +2290,7 @@ class Libzot {
}
}
if ($item_found) {
if (intval($r[0]['item_deleted'])) {
if (intval($stored['item_deleted'])) {
logger('delete_imported_item: item was already deleted');
if (! $relay) {
return false;
@ -2302,10 +2303,10 @@ class Libzot {
// back, and we aren't going to (or shouldn't at any rate) delete it again in the future - so losing
// this information from the metadata should have no other discernible impact.
if (($r[0]['id'] != $r[0]['parent']) && intval($r[0]['item_origin'])) {
if (($stored['id'] != $stored['parent']) && intval($stored['item_origin'])) {
q("update item set item_origin = 0 where id = %d and uid = %d",
intval($r[0]['id']),
intval($r[0]['uid'])
intval($stored['id']),
intval($stored['uid'])
);
}
}

View file

@ -448,7 +448,7 @@ class ThreadItem {
'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''),
'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
'bookmark' => (($conv->get_profile_owner() == local_channel() && local_channel() && $has_bookmarks) ? t('Save Bookmarks') : ''),
'addtocal' => (($has_event) ? t('Add to Calendar') : ''),
'addtocal' => (($has_event && ! $item['resource_id']) ? t('Add to Calendar') : ''),
'drop' => $drop,
'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
'dropdown_extras' => $dropdown_extras,

View file

@ -382,9 +382,17 @@ class Network extends Controller {
}
if ($verb) {
$sql_extra .= sprintf(" AND item.verb like '%s' ",
dbesc(protect_sprintf('%' . $verb . '%'))
);
if (substr($verb,0,1) === '.') {
$verb = substr($verb,1);
$sql_extra .= sprintf(" AND item.obj_type like '%s' ",
dbesc(protect_sprintf('%' . $verb . '%'))
);
}
else {
$sql_extra .= sprintf(" AND item.verb like '%s' ",
dbesc(protect_sprintf('%' . $verb . '%'))
);
}
}
if (strlen($file)) {

View file

@ -0,0 +1,28 @@
<?php
namespace Zotlabs\Module;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Libsync;
use Zotlabs\Web\Controller;
class Nocomment extends Controller {
function get() {
$desc = t('This app allows you to disable comments on individual posts.');
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'No Comment'))) {
return $text;
}
$desc = t('This app is installed. A button to control the ability to comment may be found below the post editor.');
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
return $text;
}
}

View file

@ -28,6 +28,19 @@ class Activity_filter {
'title' => t('Show posts that mention or involve me')
];
if(x($_GET,'verb')) {
$verb_active = (($_GET['verb'] == 1) ? 'active' : '');
$filter_active = 'events';
}
$tabs[] = [
'label' => t('Events'),
'icon' => 'calendar',
'url' => z_root() . '/' . $cmd . '/?verb=%2EEvent',
'sel' => $verb_active,
'title' => t('Show posts that include events')
];
if(feature_enabled(local_channel(),'star_posts')) {
if(x($_GET,'star')) {
$starred_active = (($_GET['star'] == 1) ? 'active' : '');

6
app/nocomment.apd Normal file
View file

@ -0,0 +1,6 @@
version: 1
url: $baseurl/nocomment
requires: local_channel
name: No Comment
photo: icon:comments
categories: Social

View file

@ -1220,7 +1220,7 @@ function z_status_editor($a, $x, $popup = false) {
if(x($x, 'hide_voting'))
$feature_voting = false;
$feature_nocomment = feature_enabled($x['profile_uid'], 'disable_comments');
$feature_nocomment = Apps::system_app_installed($x['profile_uid'], 'No Comment');
if(x($x, 'disable_comments'))
$feature_nocomment = false;

View file

@ -110,6 +110,7 @@ function format_event_obj($jobject) {
'$dtend_label' => t('Finishes:'),
'$dtend_title' => datetime_convert('UTC','UTC',$dtend, ((strpos($object['startTime'],'Z')) ? ATOM_TIME : 'Y-m-d\TH:i:s' )),
'$dtend_dt' => ((strpos($object['startTime'],'Z')) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $dtend , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $dtend , $bd_format )))
));
$event['content'] = replace_macros(get_markup_template('event_item_content.tpl'),array(

View file

@ -1649,6 +1649,10 @@ function prepare_body(&$item,$attach = false,$opts = false) {
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event_obj($item['obj']) : false);
if($event['header'] && $item['resource_id']) {
$event['header'] .= '<i class="fa fa-asterisk" title="' . t('Added to your calendar') . '"></i>';
}
$prep_arr = array(
'item' => $item,
'html' => $event ? $event['content'] : $s,