diff --git a/include/ItemObject.php b/include/ItemObject.php index 6f1c76fa1..f6f7c0fba 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -79,7 +79,7 @@ class Item extends BaseObject { $indent = ''; $osparkle = ''; $total_children = $this->count_descendants(); - $unseen_comments = (($item->real_uid) ? 0 : $this->count_unseen_descendants()); + $unseen_comments = (($item['real_uid']) ? 0 : $this->count_unseen_descendants()); $conv = $this->get_conversation(); $observer = $conv->get_observer(); diff --git a/include/diaspora.php b/include/diaspora.php index 09521b82b..b4f20528d 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1788,7 +1788,7 @@ function diaspora_like($importer,$xml,$msg) { $contact = diaspora_get_contact_by_handle($importer['channel_id'],$msg['author']); if(! $contact) { - logger('diaspora_like: cannot find contact: ' . $msg['author']); + logger('diaspora_like: cannot find contact: ' . $msg['author'] . ' for channel ' . $importer['channel_name']); return; } diff --git a/include/dir_fns.php b/include/dir_fns.php index 8f27fb85d..0ba4f8712 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -38,7 +38,7 @@ function check_upstream_directory() { */ $directory = get_config('system','directory_server'); if ($directory) { - $r = q("select * from site where site_url = '%s' and (site_flags & %d)>0 ", + $r = q("select * from site where site_url = '%s' and (site_flags & %d) > 0 ", dbesc($directory), intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY|DIRECTORY_MODE_STANDALONE) ); @@ -86,14 +86,14 @@ function sync_directories($dirmode) { $realm = get_directory_realm(); if($realm == DIRECTORY_REALM) { - $r = q("select * from site where (site_flags & %d)>0 and site_url != '%s' and ( site_realm = '%s' or site_realm = '') ", + $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s' and ( site_realm = '%s' or site_realm = '') ", intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY), dbesc(z_root()), dbesc($realm) ); } else { - $r = q("select * from site where (site_flags & %d)>0 and site_url != '%s' and site_realm like '%s' ", + $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s' and site_realm like '%s' ", intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY), dbesc(z_root()), dbesc(protect_sprintf('%' . $realm . '%')) @@ -120,7 +120,7 @@ function sync_directories($dirmode) { dbesc($r[0]['site_realm']) ); - $r = q("select * from site where (site_flags & %d)>0 and site_url != '%s'", + $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s'", intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY), dbesc(z_root()) ); diff --git a/include/features.php b/include/features.php index 7530158ec..92d8598a5 100644 --- a/include/features.php +++ b/include/features.php @@ -48,6 +48,7 @@ function get_features() { array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')), array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds')), array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key')), + array('adult_photo_flagging', t('Flag Adult Photos'), t('Provide photo edit option to hide adult photos from default album view')), ), // Network Tools diff --git a/include/items.php b/include/items.php index 19de52e92..00edeabdd 100755 --- a/include/items.php +++ b/include/items.php @@ -4285,7 +4285,7 @@ function zot_feed($uid,$observer_xchan,$arr) { $mindate = NULL_DATE; $mindate = dbesc($mindate); - logger('zot_feed: ' . $uid); + logger('zot_feed: requested for uid ' . $uid . ' from observer ' . $observer_xchan, LOGGER_DEBUG); if(! perm_is_allowed($uid,$observer_xchan,'view_stream')) { logger('zot_feed: permission denied.'); diff --git a/include/permissions.php b/include/permissions.php index 0ad28b3f1..b078de4d5 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -257,7 +257,7 @@ function perm_is_allowed($uid,$observer_xchan,$permission) { $channel_perm = $global_perms[$permission][0]; - $r = q("select %s, channel_hash from channel where channel_id = %d limit 1", + $r = q("select %s, channel_pageflags, channel_hash from channel where channel_id = %d limit 1", dbesc($channel_perm), intval($uid) ); diff --git a/include/zot.php b/include/zot.php index 3ffc9b43f..3b8584509 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1256,8 +1256,14 @@ function zot_import($arr, $sender_url) { function public_recips($msg) { + + require_once('include/identity.php'); + $check_mentions = false; + $include_sys = false; + if($msg['message']['type'] === 'activity') { + $include_sys = true; $col = 'channel_w_stream'; $field = PERMS_W_STREAM; if(array_key_exists('flags',$msg['message']) && in_array('thread_parent', $msg['message']['flags'])) { @@ -1307,6 +1313,14 @@ function public_recips($msg) { $r = array_merge($r,$x); + //logger('message: ' . print_r($msg['message'],true)); + + if($include_sys && array_key_exists('public_scope',$msg['message']) && $msg['message']['public_scope'] === 'public') { + $sys = get_sys_channel(); + if($sys) + $r[] = array('hash' => $sys['channel_hash']); + } + // look for any public mentions on this site // They will get filtered by tgroup_check() so we don't need to check permissions now @@ -1337,7 +1351,7 @@ function public_recips($msg) { function allowed_public_recips($msg) { - logger('allowed_public_recips: ' . print_r($msg,true)); + logger('allowed_public_recips: ' . print_r($msg,true),LOGGER_DATA); $recips = public_recips($msg); @@ -1414,8 +1428,13 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque continue; } + $channel = $r[0]; + // allow public postings to the sys channel regardless of permissions + if(($channel['channel_pageflags'] & PAGE_SYSTEM) && (! $arr['item_private'])) + $public = true; + $tag_delivery = tgroup_check($channel['channel_id'],$arr); $perm = (($arr['mid'] == $arr['parent_mid']) ? 'send_stream' : 'post_comments'); diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 52d953707..56e2378a8 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -305,6 +305,12 @@ function dir_parse_query($s) { $curr['value'] = substr($curr['value'],1); continue; } + elseif($curr['value'][0] == '"' && $curr['value'][strlen($curr['value'])-1] == '"') { + $curr['value'] = substr($curr['value'],1,strlen($curr['value'])-2); + $ret[] = $curr; + $curr = array(); + continue; + } else { $ret[] = $curr; $curr = array(); diff --git a/mod/like.php b/mod/like.php index b56611197..04a2b43cd 100755 --- a/mod/like.php +++ b/mod/like.php @@ -263,26 +263,18 @@ function like_content(&$a) { else killme(); - - $r = q("SELECT * FROM item WHERE verb = '%s' AND item_restrict = 0 + $r = q("SELECT id FROM item WHERE verb = '%s' AND item_restrict = 0 AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') LIMIT 1", dbesc($activity), dbesc($observer['xchan_hash']), intval($item_id), dbesc($item['mid']) ); + if($r) { - $like_item = $r[0]; - - // Already liked/disliked it, delete it - - $r = q("UPDATE item SET item_restrict = ( item_restrict & ~%d ), changed = '%s' WHERE id = %d", - intval(ITEM_DELETED), - dbesc(datetime_convert()), - intval($like_item['id']) - ); - - proc_run('php',"include/notifier.php","like",$like_item['id']); + // already liked it. Drop that item. + require_once('include/items.php'); + drop_item($r[0]['id'],false,DROPITEM_PHASE1); return; } diff --git a/mod/mail.php b/mod/mail.php index dacb181c5..6c778b956 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -113,6 +113,7 @@ function mail_content(&$a) { } $channel = $a->get_channel(); + head_set_icon($channel['xchan_photo_s']); $cipher = get_pconfig(local_user(),'system','default_cipher'); @@ -163,13 +164,16 @@ function mail_content(&$a) { $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + $header = replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(true), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$nickname' => $channel['channel_address'], '$linkurl' => t('Please enter a link URL:'), '$expireswhen' => t('Expires YYYY-MM-DD HH:MM') )); + + $a->page['htmlhead'] .= $header; + $preselect = (isset($a->argv[2])?array($a->argv[2]):false); $prename = $preurl = $preid = ''; @@ -276,7 +280,7 @@ function mail_content(&$a) { $tpl = get_markup_template('msg-header.tpl'); $a->page['htmlhead'] .= replace_macros($tpl, array( - '$nickname' => $channel['channel_addr'], + '$nickname' => $channel['channel_address'], '$baseurl' => $a->get_baseurl(true), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$linkurl' => t('Please enter a link URL:'), diff --git a/mod/photos.php b/mod/photos.php index ab848c709..7a9229cc4 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -952,6 +952,7 @@ function photos_content(&$a) { 'lockstate' => $lockstate[0], 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com'), 'item_id' => ((count($linked_items)) ? $link_item['id'] : 0), + 'adult_enabled' => feature_enabled($owner_uid,'adult_photo_flagging'), 'adult' => array('adult',t('Flag as adult in album view'), (($ph[0]['photo_flags'] & PHOTO_ADULT) ? 1 : 0),''), 'submit' => t('Submit'), 'delete' => t('Delete Photo') @@ -1175,7 +1176,7 @@ function photos_content(&$a) { $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.album, p.scale, p.created FROM photo p INNER JOIN (SELECT resource_id, max(scale) scale FROM photo WHERE uid=%d AND album != '%s' AND album != '%s' - AND (photo_flags = %d or photo_flags = %d ) $sql_extra group by resource_id) ph + AND (photo_flags = %d or ( photo_flags & %d ) > 0 ) $sql_extra group by resource_id) ph ON (p.resource_id = ph.resource_id and p.scale = ph.scale) ORDER by p.created DESC LIMIT %d OFFSET %d", intval($a->data['channel']['channel_id']), dbesc('Contact Photos'), diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 97840a180..7ed1859a8 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -8,6 +8,7 @@ require_once('include/photos.php'); function wall_upload_post(&$a) { + $using_api = ((x($_FILES,'media')) ? true : false); if($using_api) { diff --git a/version.inc b/version.inc index 2679ebdf3..97d0c5a13 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-11-18.863 +2014-11-19.864 diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl index b9a966e93..aec1a78ab 100755 --- a/view/tpl/conv_list.tpl +++ b/view/tpl/conv_list.tpl @@ -104,7 +104,12 @@
-