Merge remote-tracking branch 'upstream/master'

This commit is contained in:
zottel 2015-09-14 08:55:46 +02:00
commit 06bfd2b502
22 changed files with 203 additions and 110 deletions

View File

@ -6,6 +6,7 @@ We need much more than this, but here are areas where developers can help. Pleas
[li]Include TOS link in registration/verification email[/li]
[li]Auto preview posts/comments (configurable timer kicks in the preview if not 0)[/li]
[li]Create bug tracker module[/li]
[li]Filing posts - provide a dropdown menu integrated with the 'post actions menu'[/li]
[li]translation plugins - moses or apertium[/li]
[li]plugins - provide 'disable' which is softer than 'uninstall' for those plugins which create additional DB tables[/li]
[li]Infinite scroll improvements (i.e. embedded page links) see http://scrollsample.appspot.com/items [/li]

View File

@ -92,12 +92,12 @@ function deliver_run($argv, $argc) {
$m = json_decode($r[0]['outq_msg'],true);
if(array_key_exists('message_list',$m)) {
foreach($m['message_list'] as $mm) {
$msg = array('body' => json_encode(array('pickup' => array(array('notify' => $notify,'message' => $mm)))));
$msg = array('body' => json_encode(array('success' => true, 'pickup' => array(array('notify' => $notify,'message' => $mm)))));
zot_import($msg,z_root());
}
}
else {
$msg = array('body' => json_encode(array('pickup' => array(array('notify' => $notify,'message' => $m)))));
$msg = array('body' => json_encode(array('success' => true, 'pickup' => array(array('notify' => $notify,'message' => $m)))));
zot_import($msg,z_root());
}
$r = q("delete from outq where outq_hash = '%s'",

View File

@ -275,4 +275,29 @@ function xchan_fetch($arr) {
$ret[str_replace('xchan_','',$k)] = $v;
}
return $ret;
}
}
function ping_site($url) {
$ret = array('success' => false);
$sys = get_sys_channel();
$m = zot_build_packet($sys,'ping');
$r = zot_zot($url . '/post',$m);
if(! $r['success']) {
$ret['message'] = 'no answer from ' . $url;
return $ret;
}
$packet_result = $r['body'];
if(! $packet_result['success']) {
$ret['message'] = 'packet failure from ' . $url;
return $ret;
}
$ret['success'] = true;
return $ret;
}

View File

@ -3441,6 +3441,8 @@ function post_is_importable($item,$abook) {
if($exclude) {
foreach($exclude as $word) {
$word = trim($word);
if(! $word)
continue;
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
if(($t['type'] == TERM_HASHTAG) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
@ -3460,6 +3462,8 @@ function post_is_importable($item,$abook) {
if($include) {
foreach($include as $word) {
$word = trim($word);
if(! $word)
continue;
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
if(($t['type'] == TERM_HASHTAG) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))

View File

@ -537,7 +537,7 @@ function zot_refresh($them, $channel = null, $force = false) {
* @returns array|null null if site is blacklisted or not found, otherwise an
* array with an hubloc record
*/
function zot_gethub($arr) {
function zot_gethub($arr,$multiple = false) {
if($arr['guid'] && $arr['guid_sig'] && $arr['url'] && $arr['url_sig']) {
@ -556,18 +556,20 @@ function zot_gethub($arr) {
return null;
}
$limit = (($multiple) ? '' : ' limit 1 ');
$r = q("select * from hubloc
where hubloc_guid = '%s' and hubloc_guid_sig = '%s'
and hubloc_url = '%s' and hubloc_url_sig = '%s'
limit 1",
$limit",
dbesc($arr['guid']),
dbesc($arr['guid_sig']),
dbesc($arr['url']),
dbesc($arr['url_sig'])
);
if($r && count($r)) {
if($r) {
logger('zot_gethub: found', LOGGER_DEBUG);
return $r[0];
return (($multiple) ? $r : $r[0]);
}
}
logger('zot_gethub: not found: ' . print_r($arr,true), LOGGER_DEBUG);
@ -951,7 +953,7 @@ function zot_process_response($hub, $arr, $outq) {
// update the timestamp for this site
q("update site set site_update = '%s' where site_url = '%s'",
q("update site set site_dead = 0, site_update = '%s' where site_url = '%s'",
dbesc(datetime_convert()),
dbesc(dirname($hub))
);
@ -996,27 +998,38 @@ function zot_fetch($arr) {
$url = $arr['sender']['url'] . $arr['callback'];
$ret_hub = zot_gethub($arr['sender']);
if(! $ret_hub) {
// set $multiple param on zot_gethub() to return all matching hubs
// This allows us to recover from re-installs when a redundant (but invalid) hubloc for
// this identity is widely dispersed throughout the network.
$ret_hubs = zot_gethub($arr['sender'],true);
if(! $ret_hubs) {
logger('zot_fetch: no hub: ' . print_r($arr['sender'],true));
return;
}
$data = array(
'type' => 'pickup',
'url' => z_root(),
'callback_sig' => base64url_encode(rsa_sign(z_root() . '/post',get_config('system','prvkey'))),
'callback' => z_root() . '/post',
'secret' => $arr['secret'],
'secret_sig' => base64url_encode(rsa_sign($arr['secret'],get_config('system','prvkey')))
);
foreach($ret_hubs as $ret_hub) {
$data = array(
'type' => 'pickup',
'url' => z_root(),
'callback_sig' => base64url_encode(rsa_sign(z_root() . '/post',get_config('system','prvkey'))),
'callback' => z_root() . '/post',
'secret' => $arr['secret'],
'secret_sig' => base64url_encode(rsa_sign($arr['secret'],get_config('system','prvkey')))
);
$datatosend = json_encode(crypto_encapsulate(json_encode($data),$ret_hub['hubloc_sitekey']));
$datatosend = json_encode(crypto_encapsulate(json_encode($data),$ret_hub['hubloc_sitekey']));
$fetch = zot_zot($url,$datatosend);
$result = zot_import($fetch, $arr['sender']['url']);
$fetch = zot_zot($url,$datatosend);
$result = zot_import($fetch, $arr['sender']['url']);
if($result)
return $result;
}
return;
return $result;
}
/**
@ -1055,6 +1068,12 @@ function zot_import($arr, $sender_url) {
$data = json_decode(crypto_unencapsulate($data,get_config('system','prvkey')),true);
}
if(! $data['success']) {
if($data['message'])
logger('remote pickup failed: ' . $data['message']);
return false;
}
$incoming = $data['pickup'];
$return = array();
@ -2663,7 +2682,7 @@ function import_site($arr, $pubkey) {
// logger('import_site: input: ' . print_r($arr,true));
// logger('import_site: stored: ' . print_r($siterecord,true));
$r = q("update site set site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s'
$r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s'
where site_url = '%s'",
dbesc($site_location),
intval($site_directory),
@ -2681,7 +2700,7 @@ function import_site($arr, $pubkey) {
}
else {
// update the timestamp to indicate we communicated with this site
q("update site set site_update = '%s' where site_url = '%s'",
q("update site set site_dead = 0, site_update = '%s' where site_url = '%s'",
dbesc(datetime_convert()),
dbesc($url)
);

View File

@ -73,7 +73,7 @@ function invite_post(&$a) {
$account = $a->get_account();
$res = mail($recip, sprintf( t('Please join us on Red'), $a->config['sitename']),
$res = mail($recip, sprintf( t('Please join us on $Projectname'), $a->config['sitename']),
$nmessage,
"From: " . $account['account_email'] . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"

View File

@ -92,12 +92,15 @@ function profile_photo_post(&$a) {
$is_default_profile = 1;
if($_REQUEST['profile']) {
$r = q("select id, is_default from profile where id = %d and uid = %d limit 1",
$r = q("select id, profile_guid, is_default, gender from profile where id = %d and uid = %d limit 1",
intval($_REQUEST['profile']),
intval(local_channel())
);
if(($r) && (! intval($r[0]['is_default'])))
$is_default_profile = 0;
if($r) {
$profile = $r[0];
if(! intval($profile['is_default']))
$is_default_profile = 0;
}
}
@ -167,6 +170,8 @@ function profile_photo_post(&$a) {
return;
}
$channel = $a->get_channel();
// If setting for the default profile, unset the profile photo flag from any other photos I own
if($is_default_profile) {
@ -177,6 +182,9 @@ function profile_photo_post(&$a) {
dbesc($base_image['resource_id']),
intval(local_channel())
);
send_profile_photo_activity($channel,$base_image,$profile);
}
else {
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
@ -190,7 +198,6 @@ function profile_photo_post(&$a) {
// We'll set the updated profile-photo timestamp even if it isn't the default profile,
// so that browsers will do a cache update unconditionally
$channel = $a->get_channel();
$r = q("UPDATE xchan set xchan_photo_mimetype = '%s', xchan_photo_date = '%s'
where xchan_hash = '%s'",
@ -206,7 +213,9 @@ function profile_photo_post(&$a) {
// Now copy profile-permissions to pictures, to prevent privacyleaks by automatically created folder 'Profile Pictures'
profile_photo_set_profile_perms($_REQUEST['profile']);
profile_photo_set_profile_perms($_REQUEST['profile']);
}
else
@ -262,6 +271,59 @@ function profile_photo_post(&$a) {
}
function send_profile_photo_activity($channel,$photo,$profile) {
// for now only create activities for the default profile
if(! intval($profile['is_default']))
return;
$arr = array();
$arr['item_thread_top'] = 1;
$arr['item_origin'] = 1;
$arr['item_wall'] = 1;
$arr['obj_type'] = ACTIVITY_OBJ_PHOTO;
$arr['verb'] = ACTIVITY_UPDATE;
$arr['object'] = json_encode(array(
'type' => $arr['obj_type'],
'id' => z_root() . '/photo/profile/l/' . $channel['channel_id'],
'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/profile/l/' . $channel['channel_id'])
));
if(stripos($profile['gender'],t('female')) !== false)
$t = t('%1$s updated her %2$s');
elseif(stripos($profile['gender'],t('male')) !== false)
$t = t('%1$s updated his %2$s');
else
$t = t('%1$s updated their %2$s');
$ptext = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' . t('profile photo') . '[/zrl]';
$ltext = '[zrl=' . z_root() . '/profile/' . $channel['channel_address'] . ']' . '[zmg=150x150]' . z_root() . '/photo/' . $photo['resource_id'] . '-4[/zmg][/zrl]';
$arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext;
$acl = new AccessList($channel);
$x = $acl->get();
$arr['allow_cid'] = $x['allow_cid'];
$arr['allow_gid'] = $x['allow_gid'];
$arr['deny_cid'] = $x['deny_cid'];
$arr['deny_gid'] = $x['deny_gid'];
$arr['uid'] = $channel['channel_id'];
$arr['aid'] = $channel['channel_account_id'];
$arr['owner_xchan'] = $channel['channel_hash'];
$arr['author_xchan'] = $channel['channel_hash'];
post_activity_item($arr);
}
/* @brief Generate content of profile-photo view
*
* @param $a Current application

View File

@ -1 +1 @@
2015-09-10.1151
2015-09-11.1152

View File

@ -1,9 +1,8 @@
header #banner {
position: fixed;
top: 0;
width: 250px;
margin-left: auto;
margin-right: auto;
width: 33%;
margin-left: 33%;
margin-right: 33%;
}
#blog-banner {

View File

@ -1,9 +1,8 @@
header #banner {
position: fixed;
top: 0;
width: 250px;
margin-left: auto;
margin-right: auto;
width: 33%;
margin-left: 33%;
margin-right: 33%;
}
#blog-banner {
position: relative;

View File

@ -1,9 +1,8 @@
header #banner {
position: fixed;
top: 0;
width: 250px;
margin-left: auto;
margin-right: auto;
width: 33%;
margin-left: 33%;
margin-right: 33%;
}
#blog-banner {
position: relative;
@ -58,4 +57,4 @@ section {
#blog-margin {
margin-right: 5%;
margin-left: 5%;
}
}

View File

@ -1,9 +1,8 @@
header #banner {
position: fixed;
top: 0;
width: 250px;
margin-left: auto;
margin-right: auto;
width: 33%;
margin-left: 33%;
margin-right: 33%;
}
#blog-banner {
position: relative;
@ -57,4 +56,4 @@ section {
#blog-margin {
margin-right: 5%;
margin-left: 5%;
}
}

View File

@ -1,9 +1,8 @@
header #banner {
position: fixed;
top: 0;
width: 250px;
margin-left: auto;
margin-right: auto;
width: 33%;
margin-left: 33%;
margin-right: 33%;
}
#blog-banner {
position: relative;

View File

@ -1,9 +1,8 @@
header #banner {
position: fixed;
top: 0;
width: 250px;
margin-left: auto;
margin-right: auto;
width: 33%;
margin-left: 33%;
margin-right: 33%;
}
main {
@ -18,7 +17,6 @@ aside {
display: table-cell;
vertical-align: top;
padding: 80px 7px 0px 7px;
}
section {

View File

@ -1,9 +1,8 @@
header #banner {
position: fixed;
top: 0;
width: 250px;
margin-left: auto;
margin-right: auto;
width: 33%;
margin-left: 33%;
margin-right: 33%;
}
section {

View File

@ -0,0 +1,8 @@
main {
margin-left: 0px;
}
aside#region_3 {
width: auto;
padding: 0px 0px 0px 0px;
}

View File

@ -1,10 +0,0 @@
main {
margin-left: auto;
margin-right: auto;
}
aside#region_3 {
width: $aside_widthpx;
min-width: $aside_widthpx;
max-width: $aside_widthpx;
}

View File

@ -24,13 +24,15 @@ body {
height: 100%;
}
aside#region_1 {
aside {
width: $aside_widthpx;
min-width: $aside_widthpx;
max-width: $aside_widthpx;
}
main {
margin-left: auto;
margin-right: auto;
max-width: $main_widthpx;
}
@ -199,13 +201,14 @@ nav #banner #logo-text a:hover { text-decoration: none; }
.nav-channel-select { margin-left: 8px; }
header #banner {
/* overflow: hidden; */
text-align: center;
font-size: 14px;
font-family: tahoma, "Lucida Sans", sans;
color: $banner_colour;
font-weight: bold;
margin-top: 14px;
z-index: 1040;
margin-top: 14px;
text-align: center;
font-size: 14px;
font-family: tahoma, "Lucida Sans", sans;
color: $banner_colour;
font-weight: bold;
whitespace: nowrap;
}
header #banner a,
@ -213,15 +216,17 @@ header #banner a:active,
header #banner a:visited,
header #banner a:link,
header #banner a:hover {
color: #FFF;
text-decoration: none;
outline: none;
vertical-align: bottom;
color: $banner_colour;
text-decoration: none;
outline: none;
vertical-align: bottom;
}
header #banner #logo-img {
height: 22px;
margin-top: 5px;
}
header #banner #logo-text {
font-size: 22px;
}
@ -751,8 +756,7 @@ a.rateme, div.rateme {
}
.wall-item-conv {
padding-top: 10px;
padding-left: 10px;
padding: 7px 10px;
}
@ -1301,17 +1305,6 @@ a.rconnect:hover, a.rateme:hover, div.rateme:hover {
padding: 0;
}
/* header */
header {
position: fixed;
left: 43%;
right: 43%;
margin: 0px;
padding: 0px;
z-index: 1040;
color: #fff;
}
.notif-item a {
color: #000;
}

View File

@ -31,7 +31,7 @@ function theme_content(&$a) {
$arr['radius'] = get_pconfig(local_channel(),'redbasic', 'radius' );
$arr['shadow'] = get_pconfig(local_channel(),'redbasic', 'photo_shadow' );
$arr['converse_width']=get_pconfig(local_channel(),"redbasic","converse_width");
$arr['converse_center']=get_pconfig(local_channel(),"redbasic","converse_center");
$arr['align_left']=get_pconfig(local_channel(),"redbasic","align_left");
$arr['nav_min_opacity']=get_pconfig(local_channel(),"redbasic","nav_min_opacity");
$arr['top_photo']=get_pconfig(local_channel(),"redbasic","top_photo");
$arr['reply_photo']=get_pconfig(local_channel(),"redbasic","reply_photo");
@ -68,7 +68,7 @@ function theme_post(&$a) {
set_pconfig(local_channel(), 'redbasic', 'radius', $_POST['redbasic_radius']);
set_pconfig(local_channel(), 'redbasic', 'photo_shadow', $_POST['redbasic_shadow']);
set_pconfig(local_channel(), 'redbasic', 'converse_width', $_POST['redbasic_converse_width']);
set_pconfig(local_channel(), 'redbasic', 'converse_center', $_POST['redbasic_converse_center']);
set_pconfig(local_channel(), 'redbasic', 'align_left', $_POST['redbasic_align_left']);
set_pconfig(local_channel(), 'redbasic', 'nav_min_opacity', $_POST['redbasic_nav_min_opacity']);
set_pconfig(local_channel(), 'redbasic', 'top_photo', $_POST['redbasic_top_photo']);
set_pconfig(local_channel(), 'redbasic', 'reply_photo', $_POST['redbasic_reply_photo']);
@ -126,7 +126,7 @@ if(feature_enabled(local_channel(),'expert'))
'$radius' => array('redbasic_radius', t('Set radius of corners'), $arr['radius']),
'$shadow' => array('redbasic_shadow', t('Set shadow depth of photos'), $arr['shadow']),
'$converse_width' => array('redbasic_converse_width',t('Set maximum width of content region in pixel'),$arr['converse_width'], t('Leave empty for default width')),
'$converse_center' => array('redbasic_converse_center',t('Center page content'),$arr['converse_center'], '', array(t('No'),t('Yes'))),
'$align_left' => array('redbasic_align_left',t('Left align page content'),$arr['align_left'], '', array(t('No'),t('Yes'))),
'$nav_min_opacity' => array('redbasic_nav_min_opacity',t('Set minimum opacity of nav bar - to hide it'),$arr['nav_min_opacity']),
'$top_photo' => array('redbasic_top_photo', t('Set size of conversation author photo'), $arr['top_photo']),
'$reply_photo' => array('redbasic_reply_photo', t('Set size of followup author photos'), $arr['reply_photo']),

View File

@ -36,7 +36,7 @@ if(! $a->install) {
$radius = get_pconfig($uid, "redbasic", "radius");
$shadow = get_pconfig($uid,"redbasic","photo_shadow");
$converse_width=get_pconfig($uid,"redbasic","converse_width");
$converse_center=get_pconfig($uid,"redbasic","converse_center");
$align_left=get_pconfig($uid,"redbasic","align_left");
$nav_min_opacity=get_pconfig($uid,'redbasic','nav_min_opacity');
$top_photo=get_pconfig($uid,'redbasic','top_photo');
$reply_photo=get_pconfig($uid,'redbasic','reply_photo');
@ -156,12 +156,12 @@ if(file_exists('view/theme/redbasic/css/style.css')) {
$aside_width = 285;
// left aside and right aside are is 231px + converse width
if($converse_center) {
$main_width = (($aside_width * 2) + intval($converse_width));
// left aside and right aside are 285px + converse width
if($align_left) {
$main_width = (($aside_width) + intval($converse_width));
}
else {
$main_width = (($aside_width) + intval($converse_width));
$main_width = (($aside_width * 2) + intval($converse_width));
}
// prevent main_width smaller than 768px
$main_width = (($main_width < 768) ? 768 : $main_width);
@ -209,9 +209,8 @@ if($narrow_navbar && file_exists('view/theme/redbasic/css/narrow_navbar.css')) {
echo file_get_contents('view/theme/redbasic/css/narrow_navbar.css');
}
if($converse_center && file_exists('view/theme/redbasic/css/converse_center.css')) {
$cc = file_get_contents('view/theme/redbasic/css/converse_center.css');
echo str_replace(array_keys($options), array_values($options), $cc);
if($align_left && file_exists('view/theme/redbasic/css/align_left.css')) {
echo file_get_contents('view/theme/redbasic/css/align_left.css');
}
if($schemecss) {

View File

@ -28,7 +28,7 @@
{{include file="field_input.tpl" field=$reply_photo}}
{{/if}}
{{include file="field_input.tpl" field=$converse_width}}
{{include file="field_checkbox.tpl" field=$converse_center}}
{{include file="field_checkbox.tpl" field=$align_left}}
{{include file="field_checkbox.tpl" field=$narrow_navbar}}
{{if $expert}}
<script>

View File

@ -17,7 +17,7 @@ function drophub(id) {
{{$hub.hubloc_url}} ({{$hub.hubloc_addr}}){{if $hub.deleted}}</strike>{{/if}}</td>
<td>
{{if $hub.primary}}<i class="icon-check"></i>{{else}}<button class="btn btn-std" onclick="primehub({{$hub.hubloc_id}}); return false;" ><i class="icon-check-empty" ></i></button>{{/if}}
{{if $hub.primary}}<button class="btn btn-std"><i class="icon-check"></i></button>{{else}}<button class="btn btn-std" onclick="primehub({{$hub.hubloc_id}}); return false;" ><i class="icon-check-empty" ></i></button>{{/if}}
</td>
<td>{{if $hub.primary}}{{else}}{{if ! $hub.deleted}}<button class="btn btn-std" onclick="drophub({{$hub.hubloc_id}}); return false;"><i class="icon-trash"></i></button>{{/if}}{{/if}}</td>
</tr>