Merge pull request #8 from redmatrix/dev

Dev
This commit is contained in:
mrjive 2018-04-16 17:27:14 +02:00 committed by GitHub
commit 283e5d3a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 17 deletions

View File

@ -171,16 +171,23 @@ class NativeWiki {
dbesc(NWIKI_ITEM_RESOURCE_TYPE),
dbesc($resource_id)
);
if($r) {
$q = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'",
dbesc($r[0]['resource_type'])
dbesc($r[0]['resource_id'])
);
if($q) {
$r = array_merge($r,$q);
}
xchan_query($r);
$sync_item = fetch_post_tags($r);
build_sync_packet($uid,array('wiki' => array(encode_item($sync_item[0],true))));
if($sync_item) {
$pkt = [];
foreach($sync_item as $w) {
$pkt[] = encode_item($w,true);
}
build_sync_packet($uid,array('wiki' => $pkt));
}
}
}

View File

@ -210,10 +210,9 @@ class Network extends \Zotlabs\Web\Controller {
$sql_nets = '';
$distinct = '';
$item_thread_top = ' AND item_thread_top = 1 ';
$sql_extra = $sql_options;
$sql_extra = '';
if($group) {
$contact_str = '';
@ -229,7 +228,6 @@ class Network extends \Zotlabs\Web\Controller {
$contact_str = ' 0 ';
info( t('Privacy group is empty'));
}
$distinct = ' distinct ';
$item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) ";
@ -254,7 +252,6 @@ class Network extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r) {
$distinct = ' distinct ';
$item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) $item_normal ) ";
$title = replace_macros(get_markup_template("section_title.tpl"),array(
@ -274,7 +271,6 @@ class Network extends \Zotlabs\Web\Controller {
dbesc($xchan)
);
if($r) {
$distinct = ' distinct ';
$item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) ";
$title = replace_macros(get_markup_template("section_title.tpl"),array(
@ -381,7 +377,6 @@ class Network extends \Zotlabs\Web\Controller {
}
if($conv) {
$distinct = ' distinct ';
$item_thread_top = '';
$sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ",
dbesc(protect_sprintf($channel['channel_hash']))
@ -464,7 +459,7 @@ class Network extends \Zotlabs\Web\Controller {
WHERE true $uids $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$simple_update
$sql_extra $sql_nets
$sql_extra $sql_options $sql_nets
$net_query2
ORDER BY item.received DESC $pager_sql "
);
@ -487,13 +482,13 @@ class Network extends \Zotlabs\Web\Controller {
if($load) {
// Fetch a page full of parent items for this page
$r = q("SELECT $distinct item.parent AS item_id FROM item
$r = q("SELECT item.parent AS item_id FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
$net_query
WHERE true $uids $item_thread_top $item_normal
AND item.mid = item.parent_mid
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets
$sql_extra3 $sql_extra $sql_options $sql_nets
$net_query2
ORDER BY $ordering DESC $pager_sql "
);
@ -506,7 +501,7 @@ class Network extends \Zotlabs\Web\Controller {
$net_query
WHERE true $uids $item_normal_update $simple_update
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets $net_query2"
$sql_extra3 $sql_extra $sql_options $sql_nets $net_query2"
);
$_SESSION['loadtime'] = datetime_convert();
}

View File

@ -224,7 +224,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
);
}
else {
$r = q("SELECT distinct parent AS item_id, $ordering FROM item
$r = q("SELECT parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
$net_query
WHERE true $uids $item_normal_update

View File

@ -59,6 +59,8 @@ class HTTPSig {
$headers['(request-target)'] =
strtolower($_SERVER['REQUEST_METHOD']) . ' ' .
$_SERVER['REQUEST_URI'];
$headers['content-type'] = $_SERVER['CONTENT_TYPE'];
foreach($_SERVER as $k => $v) {
if(strpos($k,'HTTP_') === 0) {
$field = str_replace('_','-',strtolower(substr($k,5)));
@ -67,6 +69,10 @@ class HTTPSig {
}
}
// logger('SERVER: ' . print_r($_SERVER,true), LOGGER_ALL);
// logger('headers: ' . print_r($headers,true), LOGGER_ALL);
$sig_block = null;
if(array_key_exists('signature',$headers)) {
@ -194,10 +200,10 @@ class HTTPSig {
if($r) {
$j = json_decode($r,true);
if($j['id'] !== $id)
return false;
if(array_key_exists('publicKey',$j) && array_key_exists('publicKeyPem',$j['publicKey'])) {
if((array_key_exists('id',$j['publicKey']) && $j['publicKey']['id'] !== $id) && $j['id'] !== $id)
return false;
return($j['publicKey']['publicKeyPem']);
}
}

View File

@ -100,7 +100,9 @@ class dba_pdo extends dba_driver {
if($this->debug) {
db_logger('dba_pdo: DEBUG: ' . printable($sql) . ' returned ' . count($r) . ' results.', LOGGER_NORMAL, LOG_INFO);
db_logger('dba_pdo: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
if(intval($this->debug) > 1) {
db_logger('dba_pdo: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
}
}
return (($this->error) ? false : $r);

View File

@ -120,6 +120,9 @@ a:focus,
input, optgroup, select, textarea {
font-size: 0.9rem !important;
}
input[type=text], textarea {
resize: vertical;
background-color: $comment_item_colour;
color: $font_colour;