mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 08:35:14 +00:00
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
This commit is contained in:
commit
c61853ff0b
5 changed files with 67 additions and 39 deletions
|
@ -58,7 +58,11 @@ class WebServer {
|
|||
if((x($_GET,'zid')) && (! \App::$install)) {
|
||||
\App::$query_string = strip_zids(\App::$query_string);
|
||||
if(! local_channel()) {
|
||||
$_SESSION['my_address'] = $_GET['zid'];
|
||||
if ($_SESSION['my_address']!=$_GET['zid'])
|
||||
{
|
||||
$_SESSION['my_address'] = $_GET['zid'];
|
||||
$_SESSION['authenticated'] = 0;
|
||||
}
|
||||
zid_init();
|
||||
}
|
||||
}
|
||||
|
|
2
boot.php
2
boot.php
|
@ -497,6 +497,7 @@ define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
|
|||
define ( 'ACTIVITY_SHARE', NAMESPACE_ACTIVITY_SCHEMA . 'share' );
|
||||
define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
|
||||
define ( 'ACTIVITY_CREATE', NAMESPACE_ACTIVITY_SCHEMA . 'create' );
|
||||
define ( 'ACTIVITY_DELETE', NAMESPACE_ACTIVITY_SCHEMA . 'delete' );
|
||||
define ( 'ACTIVITY_WIN', NAMESPACE_ACTIVITY_SCHEMA . 'win' );
|
||||
define ( 'ACTIVITY_LOSE', NAMESPACE_ACTIVITY_SCHEMA . 'lose' );
|
||||
define ( 'ACTIVITY_TIE', NAMESPACE_ACTIVITY_SCHEMA . 'tie' );
|
||||
|
@ -1636,6 +1637,7 @@ function login($register = false, $form_id = 'main-login', $hiddens=false, $logi
|
|||
'$login_page' => $login_page,
|
||||
'$logout' => t('Logout'),
|
||||
'$login' => t('Login'),
|
||||
'$remote_login' => t('Remote Authentication'),
|
||||
'$form_id' => $form_id,
|
||||
'$lname' => array('username', t('Login/Email') , '', ''),
|
||||
'$lpassword' => array('password', t('Password'), '', ''),
|
||||
|
|
|
@ -900,6 +900,41 @@ function encode_rel_links($links) {
|
|||
return $o;
|
||||
}
|
||||
|
||||
|
||||
function process_feed_tombstones($feed,$importer,$contact,$pass) {
|
||||
|
||||
$arr_deleted = [];
|
||||
|
||||
$del_entries = $feed->get_feed_tags(NAMESPACE_TOMB, 'deleted-entry');
|
||||
if(is_array($del_entries) && count($del_entries) && $pass != 2) {
|
||||
foreach($del_entries as $dentry) {
|
||||
if(isset($dentry['attribs']['']['ref'])) {
|
||||
$arr_deleted[] = normalise_id($dentry['attribs']['']['ref']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($arr_deleted && is_array($contact)) {
|
||||
foreach($arr_deleted as $mid) {
|
||||
$r = q("SELECT * from item where mid = '%s' and author_xchan = '%s' and uid = %d limit 1",
|
||||
dbesc($mid),
|
||||
dbesc($contact['xchan_hash']),
|
||||
intval($importer['channel_id'])
|
||||
);
|
||||
|
||||
if($r) {
|
||||
$item = $r[0];
|
||||
|
||||
if(! intval($item['item_deleted'])) {
|
||||
logger('deleting item ' . $item['id'] . ' mid=' . $item['mid'], LOGGER_DEBUG);
|
||||
drop_item($item['id'],false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Process atom feed and update anything/everything we might need to update.
|
||||
*
|
||||
|
@ -955,43 +990,11 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
|
||||
$permalink = $feed->get_permalink();
|
||||
|
||||
// Check at the feed level for updated contact name and/or photo
|
||||
|
||||
// process any deleted entries
|
||||
// Check at the feed level for tombstones
|
||||
|
||||
$del_entries = $feed->get_feed_tags(NAMESPACE_TOMB, 'deleted-entry');
|
||||
if(is_array($del_entries) && count($del_entries) && $pass != 2) {
|
||||
foreach($del_entries as $dentry) {
|
||||
$deleted = false;
|
||||
if(isset($dentry['attribs']['']['ref'])) {
|
||||
$mid = normalise_id($dentry['attribs']['']['ref']);
|
||||
$deleted = true;
|
||||
if(isset($dentry['attribs']['']['when'])) {
|
||||
$when = $dentry['attribs']['']['when'];
|
||||
$when = datetime_convert('UTC','UTC', $when, 'Y-m-d H:i:s');
|
||||
}
|
||||
else
|
||||
$when = datetime_convert('UTC','UTC','now','Y-m-d H:i:s');
|
||||
}
|
||||
process_feed_tombstones($feed,$importer,$contact,$pass);
|
||||
|
||||
if($deleted && is_array($contact)) {
|
||||
$r = q("SELECT * from item where mid = '%s' and author_xchan = '%s' and uid = %d limit 1",
|
||||
dbesc($mid),
|
||||
dbesc($contact['xchan_hash']),
|
||||
intval($importer['channel_id'])
|
||||
);
|
||||
|
||||
if($r) {
|
||||
$item = $r[0];
|
||||
|
||||
if(! intval($item['item_deleted'])) {
|
||||
logger('deleting item ' . $item['id'] . ' mid=' . $item['mid'], LOGGER_DEBUG);
|
||||
drop_item($item['id'],false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now process the feed
|
||||
|
||||
|
@ -1033,6 +1036,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
if(! $datarray['mid'])
|
||||
continue;
|
||||
|
||||
|
||||
$item_parent_mid = q("select parent_mid from item where mid = '%s' and uid = %d limit 1",
|
||||
dbesc($parent_mid),
|
||||
intval($importer['channel_id'])
|
||||
|
@ -1090,7 +1094,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
|
||||
$datarray['owner_xchan'] = $contact['xchan_hash'];
|
||||
|
||||
$r = q("SELECT id, edited FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
|
||||
$r = q("SELECT id, edited, author_xchan, item_deleted FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
|
||||
dbesc($datarray['mid']),
|
||||
intval($importer['channel_id'])
|
||||
);
|
||||
|
@ -1099,6 +1103,15 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
// Update content if 'updated' changes
|
||||
|
||||
if($r) {
|
||||
if(activity_match($datarray['verb'],ACTIVITY_DELETE)
|
||||
&& $datarray['author_xchan'] === $r[0]['author_xchan']) {
|
||||
if(! intval($r[0]['item_deleted'])) {
|
||||
logger('deleting item ' . $r[0]['id'] . ' mid=' . $datarray['mid'], LOGGER_DEBUG);
|
||||
drop_item($r[0]['id'],false);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if((x($datarray,'edited') !== false)
|
||||
&& (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
|
||||
|
@ -1343,8 +1356,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT id, edited FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
|
||||
$r = q("SELECT id, edited, author_xchan, item_deleted FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
|
||||
dbesc($datarray['mid']),
|
||||
intval($importer['channel_id'])
|
||||
);
|
||||
|
@ -1352,6 +1364,15 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
|
|||
// Update content if 'updated' changes
|
||||
|
||||
if($r) {
|
||||
if(activity_match($datarray['verb'],ACTIVITY_DELETE)
|
||||
&& $datarray['author_xchan'] === $r[0]['author_xchan']) {
|
||||
if(! intval($r[0]['item_deleted'])) {
|
||||
logger('deleting item ' . $r[0]['id'] . ' mid=' . $datarray['mid'], LOGGER_DEBUG);
|
||||
drop_item($r[0]['id'],false);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if((x($datarray,'edited') !== false)
|
||||
&& (datetime_convert('UTC','UTC',$datarray['edited']) !== $r[0]['edited'])) {
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
{{if $register}}<a href="{{$register.link}}" title="{{$register.title}}" id="register-link" class="pull-right">{{$register.desc}}</a>{{/if}}
|
||||
<a href="lostpass" title="{{$lostpass}}" id="lost-password-link" >{{$lostlink}}</a>
|
||||
</div>
|
||||
<hr>
|
||||
<a href="rmagic" class="btn btn-block btn-outline-success rmagic-button">{{$remote_login}}</a>
|
||||
</div>
|
||||
{{foreach $hiddens as $k=>$v}}
|
||||
<input type="hidden" name="{{$k}}" value="{{$v}}" />
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
{{$nav.login}}
|
||||
{{$nav.remote_login}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue