Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Habeas Codice 2014-11-19 21:11:11 -08:00
commit c8af19c69c
17 changed files with 80 additions and 50 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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())
);

View File

@ -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

View File

@ -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.');

View File

@ -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)
);

View File

@ -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');

View File

@ -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();

View File

@ -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;
}

View File

@ -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:'),

View File

@ -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'),

View File

@ -8,6 +8,7 @@ require_once('include/photos.php');
function wall_upload_post(&$a) {
$using_api = ((x($_FILES,'media')) ? true : false);
if($using_api) {

View File

@ -1 +1 @@
2014-11-18.863
2014-11-19.864

View File

@ -104,7 +104,12 @@
</ul>
</div>
<div id="like-rotator-{{$item.id}}" class="like-rotator"></div>
<div class="wall-item-tools-left{{if $item.like_count && $item.dislike_count}} btn-group{{/if}}">
<div class="wall-item-tools-left{{if $item.unseen_comments || $item.like_count || $item.dislike_count}} btn-group{{/if}}">
<div class="wall-item-list-comments btn-group"><button class="btn btn-default btn-sm" onclick="window.location.href='{{$item.llink}}'; return false;">{{$item.comment_count_txt}}{{if $item.unseen_comments}}
<span class="unseen-wall-indicator-{{$item.id}}">, {{$item.list_unseen_txt}}{{/if}}</span></button></div>{{if $item.unseen_comments}}<div class="unseen-wall-indicator-{{$item.id}} btn-group"><button class="btn btn-default btn-sm" title="{{$item.markseen}}" onclick="markItemRead({{$item.id}}); return false;"><i class="icon-check"></i></div>{{/if}}
{{if $item.like_count}}
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="wall-item-like-{{$item.id}}">{{$item.like_count}} {{$item.like_button_label}}</button>
@ -164,8 +169,6 @@
{{/if}}
</div>
<div class="clear"></div>
<div class="wall-item-list-comments"><a href="{{$item.llink}}">{{$item.comment_count_txt}}{{if $item.unseen_comments}}
<span class="unseen-wall-indicator-{{$item.id}}">, {{$item.list_unseen_txt}}{{/if}}</span></a>{{if $item.unseen_comments}}<span class="unseen-wall-indicator-{{$item.id}}">&nbsp;&nbsp;&nbsp;<button class="btn btn-default" title="{{$item.markseen}}" onclick="markItemRead({{$item.id}}); return false;"><i class="icon-check"></i></span>{{/if}}</div>
</div>
<div class="wall-item-wrapper-end"></div>
<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>

View File

@ -52,10 +52,10 @@ else
'prvmail-upload-wrapper',
{ action: 'wall_upload/{{$nickname}}',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').spin('tiny'); },
onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); },
onComplete: function(file,response) {
addeditortext(response);
$('#profile-rotator').spin(false);
addmailtext(response);
$('#prvmail-rotator').spin(false);
}
}
);
@ -64,23 +64,23 @@ else
'prvmail-attach-wrapper',
{ action: 'wall_attach/{{$nickname}}',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').spin('tiny'); },
onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); },
onComplete: function(file,response) {
addeditortext(response);
$('#profile-rotator').spin(false);
addmailtext(response);
$('#prvmail-rotator').spin(false);
}
}
);
});
function jotGetLink() {
function prvmailJotGetLink() {
reply = prompt("{{$linkurl}}");
if(reply && reply.length) {
$('#profile-rotator').spin('tiny');
$('#prvmail-rotator').spin('tiny');
$.get('parse_url?url=' + reply, function(data) {
addeditortext(response);
$('#profile-rotator').spin(false);
addmailtext(data);
$('#prvmail-rotator').spin(false);
});
}
}
@ -103,15 +103,15 @@ else
event.target.textContent = reply;
event.preventDefault();
if(reply && reply.length) {
$('#profile-rotator').spin('tiny');
$('#prvmail-rotator').spin('tiny');
$.get('parse_url?url=' + reply, function(data) {
addeditortext(response);
$('#profile-rotator').spin(false);
addmailtext(data);
$('#prvmail-rotator').spin(false);
});
}
}
function addeditortext(data) {
function addmailtext(data) {
if(plaintext == 'none') {
var currentText = $("#prvmail-text").val();
$("#prvmail-text").val(currentText + data);

View File

@ -59,9 +59,12 @@
<label class="radio-inline" id="photo-edit-rotate-cw-label" for="photo-edit-rotate-cw"><input id="photo-edit-rotate-cw" type="radio" name="rotate" value="1" />{{$edit.rotatecw}}</label>
<label class="radio-inline" id="photo-edit-rotate-ccw-label" for="photo-edit-rotate-ccw"><input id="photo-edit-rotate-ccw" type="radio" name="rotate" value="2" />{{$edit.rotateccw}}</label>
</div>
{{if $edit.adult_enabled}}
<div class="form-group">
{{include file="field_checkbox.tpl" field=$edit.adult}}
</div>
{{/if}}
{{$edit.aclselect}}
<div class="form-group pull-left">

View File

@ -34,21 +34,21 @@
<i id="prvmail-attach" class="icon-paper-clip jot-icons" title="{{$attach}}"></i>
</button>
<button id="prvmail-link-wrapper" class="btn btn-default btn-sm" >
<i id="prvmail-link" class="icon-link jot-icons" title="{{$insert}}" onclick="jotGetLink(); return false;"></i>
<button id="prvmail-link-wrapper" class="btn btn-default btn-sm" onclick="prvmailJotGetLink(); return false;" >
<i id="prvmail-link" class="icon-link jot-icons" title="{{$insert}}" ></i>
</button>
{{if $feature_expire}}
<button id="prvmail-expire-wrapper" class="btn btn-default btn-sm" >
<i id="prvmail-expires" class="icon-eraser jot-icons" title="{{$expires}}" onclick="prvmailGetExpiry();return false;"></i>
<button id="prvmail-expire-wrapper" class="btn btn-default btn-sm" onclick="prvmailGetExpiry();return false;" >
<i id="prvmail-expires" class="icon-eraser jot-icons" title="{{$expires}}" ></i>
</button>
{{/if}}
{{if $feature_encrypt}}
<button id="prvmail-encrypt-wrapper" class="btn btn-default btn-sm" >
<i id="prvmail-encrypt" class="icon-key jot-icons" title="{{$encrypt}}" onclick="red_encrypt('{{$cipher}}','#prvmail-text',$('#prvmail-text').val());return false;"></i>
<button id="prvmail-encrypt-wrapper" class="btn btn-default btn-sm" onclick="red_encrypt('{{$cipher}}','#prvmail-text',$('#prvmail-text').val());return false;">
<i id="prvmail-encrypt" class="icon-key jot-icons" title="{{$encrypt}}" ></i>
</button>
{{/if}}
<div id="prvmail-rotator-wrapper" >
<img id="prvmail-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
<div id="prvmail-rotator"></div>
</div>
</div>
<div id="prvmail-end"></div>