Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Thomas Willingham 2014-09-15 17:10:11 +01:00
commit 68ecc673b1
10 changed files with 105 additions and 27 deletions

View File

@ -216,8 +216,9 @@ define ( 'PAGE_DIRECTORY_CHANNEL', 0x0008 ); // system channel used for director
define ( 'PAGE_PREMIUM', 0x0010 );
define ( 'PAGE_ADULT', 0x0020 );
define ( 'PAGE_CENSORED', 0x0040 ); // Site admin has blocked this channel from appearing in casual search results and site feeds
define ( 'PAGE_SYSTEM', 0x1000 );
define ( 'PAGE_HUBADMIN', 0x2000 ); // set this to indicate a preferred admin channel rather than the
// default channel of any accounts with the admin role.
define ( 'PAGE_REMOVED', 0x8000 );

View File

@ -49,8 +49,8 @@ Zot is the great new communicaton protocol invented especially for the Red Matri
[zrl=[baseurl]/help/faq_admins]FAQ For Admins[/zrl]
[size=large][b]Technical Documentation[/b][/size]
[zrl=[baseurl]/help/Zot---A-High-Level-Overview.md[/zrl]A high level overview of Zot[/zrl]
[zrl=[baseurl]/help/zot]An introduction to Zot/zrl]
[zrl=[baseurl]/help/Zot---A-High-Level-Overview]A high level overview of Zot[/zrl]
[zrl=[baseurl]/help/zot]An introduction to Zot[/zrl]
[zrl=[baseurl]/help/zot_structures]Zot Stuctures[/zrl]
[zrl=[baseurl]/help/comanche]Comanche Page Descriptions[/zrl]
[zrl=[baseurl]/help/Creating-Templates]Creating Comanche Templates[/zrl]

View File

@ -142,6 +142,7 @@ function diaspora_process_outbound($arr) {
'cmd' => $cmd,
'expire' => $expire,
'mail' => $mail,
'location' => $location,
'fsuggest' => $fsuggest,
'normal_mode' => $normal_mode,
'packet_type' => $packet_type,
@ -150,6 +151,10 @@ function diaspora_process_outbound($arr) {
*/
if($arr['location'])
return;
$target_item = $arr['target_item'];
if($target_item && array_key_exists('item_flags',$target_item) && ($target_item['item_flags'] & ITEM_OBSCURED)) {
@ -161,6 +166,7 @@ function diaspora_process_outbound($arr) {
}
if($arr['env_recips']) {
$hashes = array();

View File

@ -46,6 +46,8 @@ function prune_hub_reinstalls() {
function remove_obsolete_hublocs() {
logger('remove_obsolete_hublocs',LOGGER_DEBUG);
// Get rid of any hublocs which are ours but aren't valid anymore -
// e.g. they point to a different and perhaps transient URL that we aren't using.
@ -66,7 +68,9 @@ function remove_obsolete_hublocs() {
if((! $r) || (! count($r)))
return;
// Good. We have at least one valid hubloc.
$channels = array();
// Good. We have at least one *valid* hubloc.
// Do we have any invalid ones?
@ -74,25 +78,38 @@ function remove_obsolete_hublocs() {
dbesc(get_config('system','pubkey')),
dbesc(z_root())
);
if(! $r)
return;
logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.');
// We've got invalid hublocs. Get rid of them.
$r = q("delete from hubloc where hubloc_sitekey = '%s' and hubloc_url != '%s'",
$p = q("select hubloc_id from hubloc where hubloc_sitekey != '%s' and hubloc_url = '%s'",
dbesc(get_config('system','pubkey')),
dbesc(z_root())
);
if(is_array($r) && is_array($p))
$r = array_merge($r,$p);
// We should probably tell everybody... But we don't have an easy way to do this
// for the entire site. We'd have to do a channel at a time.
// They will find out anyway - it just might take a little while.
if(! $r)
return;
// FIXME we probably also need to check that the sys channel has a valid hubloc
// and re-create it if it doesn't.
// We've got invalid hublocs. Get rid of them.
logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.');
$interval = ((get_config('system','delivery_interval') !== false)
? intval(get_config('system','delivery_interval')) : 2 );
foreach($r as $rr) {
q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d limit 1",
intval(HUBLOC_FLAGS_DELETED),
intval($rr['hubloc_id'])
);
$x = q("select channel_id from channel where channel_hash = '%s' limit 1",
dbesc($rr['hubloc_hash'])
);
if($x) {
// proc_run('php','include/notifier.php','location',$x[0]['channel_id']);
// if($interval)
// @time_sleep_until(microtime(true) + (float) $interval);
}
}
}

View File

@ -57,6 +57,7 @@ require_once('include/html2plain.php');
* purge_all channel_id
* expire channel_id
* relay item_id (item was relayed to owner, we will deliver it as owner)
* location channel_id
*
*/
@ -144,6 +145,7 @@ function notifier_run($argv, $argc){
$mail = false;
$fsuggest = false;
$top_level = false;
$location = false;
$recipients = array();
$url_recipients = array();
$normal_mode = true;
@ -230,6 +232,30 @@ function notifier_run($argv, $argc){
$private = false;
$packet_type = 'refresh';
}
elseif($cmd === 'location') {
logger('notifier: location: ' . $item_id);
$s = q("select * from channel where channel_id = %d limit 1",
intval($item_id)
);
if($s)
$channel = $s[0];
$uid = $item_id;
$recipients = array();
$r = q("select abook_xchan from abook where abook_channel = %d",
intval($item_id)
);
if($r) {
foreach($r as $rr) {
$recipients[] = $rr['abook_xchan'];
}
}
$encoded_item = array('locations' => zot_encode_locations($channel),'type' => 'location', 'encoding' => 'zot');
$target_item = array('aid' => $channel['channel_account_id'],'uid' => $channel['channel_id']);
$private = false;
$packet_type = 'location';
$location = true;
}
elseif($cmd === 'purge_all') {
logger('notifier: purge_all: ' . $item_id);
$s = q("select * from channel where channel_id = %d limit 1",
@ -516,6 +542,7 @@ function notifier_run($argv, $argc){
'cmd' => $cmd,
'expire' => $expire,
'mail' => $mail,
'location' => $location,
'fsuggest' => $fsuggest,
'normal_mode' => $normal_mode,
'packet_type' => $packet_type,

View File

@ -171,6 +171,9 @@ function poller_run($argv, $argc){
proc_run('php','include/expire.php');
proc_run('php','include/cli_suggest.php');
require_once('include/hubloc.php');
remove_obsolete_hublocs();
/**
* End Cron Daily
*/

View File

@ -1121,6 +1121,11 @@ function zot_import($arr, $sender_url) {
$deliveries = allowed_public_recips($i);
if($i['message'] && array_key_exists('type',$i['message']) && $i['message']['type'] === 'location') {
$sys = get_sys_channel();
$deliveries = array(array('hash' => $sys['xchan_hash']));
}
// if the scope is anything but 'public' we're going to store it as private regardless
// of the private flag on the post.
@ -1206,7 +1211,7 @@ function zot_import($arr, $sender_url) {
$arr = $i['message'];
logger('Location message received: ' . print_r($arr,true), LOGGER_DATA);
logger('Location messaeg recipients: ' . print_r($deliveries,true), LOGGER_DATA);
logger('Location message recipients: ' . print_r($deliveries,true), LOGGER_DATA);
$result = process_location_delivery($i['notify']['sender'],$arr,$deliveries);
}
@ -1665,7 +1670,8 @@ function process_location_delivery($sender,$arr,$deliveries) {
if($r)
$sender['key'] = $r[0]['xchan_pubkey'];
sync_locations($sender,$arr,true);
$x = sync_locations($sender,$arr,true);
logger('process_location_delivery: results: ' . print_r($x,true), LOGGER_DATA);
}
// We need to merge this code with that in the import_xchan function so as to make it

View File

@ -13,7 +13,13 @@ function siteinfo_init(&$a) {
if($r) {
$admin = array();
foreach($r as $rr) {
$admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
if($rr['channel_pageflags'] & PAGE_HUBADMIN)
$admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
}
if(! $admin) {
foreach($r as $rr) {
$admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
}
}
}
else {

View File

@ -713,7 +713,7 @@ function updateConvItems(mode,data) {
'lt100': '-2',
'lt240': '-2',
'lt320': '-2',
'lt500': '-0',
'lt500': '-1',
'lt640': '-1',
'lt1024': '-0'
}

View File

@ -2060,11 +2060,11 @@ img.mail-list-sender-photo {
.wall-item-ago {
color: #777;
font-size: 0.8em;
font-size: 0.833em;
}
.wall-item-ago i {
font-size: 0.8em;
font-size: 0.833em;
}
.wall-item-content {
@ -2082,7 +2082,7 @@ img.mail-list-sender-photo {
}
.comment-icon {
font-size: 0.8em;
font-size: 0.833em;
color: $toolicon_colour;
}
@ -2256,15 +2256,27 @@ blockquote {
}
h1, h2 {
font-size: 1.15rem;
font-size: 1.583em;
}
h3, h4 {
font-size: $font_size;
font-size: 1.334em;
}
h5, h6 {
font-size: $body_font_size;
font-size: 0.75rem;
}
.wall-item-content h1, .wall-item-content h2 {
font-size: 1.319em;
}
.wall-item-title {
font-size: $font_size;
}
.wall-item-title h3, .wall-item-content h3, .wall-item-content h4 {
font-size: 1.112em;
}
.dropdown-menu {