Commit 3e74e219 authored by Mario's avatar Mario

Merge branch 'dev'

parents 578eeebb 2499daa9
......@@ -1803,7 +1803,7 @@ class Diaspora_Receiver {
}
$image_url = unxmlify($this->xmlbase['image_url']);
$birthday = unxmlify($this->xmlbase['birthday']);
$edited = datetime_convert('UTC','UTC',$this->xmlbase['edited_at']);
$handle_parts = explode("@", $diaspora_handle);
if($name === '') {
......@@ -1815,8 +1815,25 @@ class Diaspora_Receiver {
}
require_once('include/photo/photo_driver.php');
$images = import_xchan_photo($image_url,$contact['xchan_hash']);
if($edited > $contact['xchan_photo_date']) {
$images = import_xchan_photo($image_url,$contact['xchan_hash']);
$newimg = true;
} else {
$images = array($contact['xchan_photo_l'],$contact['xchan_photo_m'],$contact['xchan_photo_s'],$contact['xchan_photo_mimetype']);
$newimg = false;
}
$r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
dbesc($name),
dbesc(($name != $contact['xchan_name'] ? $edited : $contact['xchan_name_date'])),
dbesc(($newimg ? $edited : $contact['xchan_photo_date'])),
dbesc($images[0]),
dbesc($images[1]),
dbesc($images[2]),
dbesc($images[3]),
dbesc($contact['xchan_hash'])
);
// Somebody is sending us birthday arrays.
......@@ -1846,17 +1863,6 @@ class Diaspora_Receiver {
// if(substr($birthday,5) === substr($contact['bd'],5))
// $birthday = $contact['bd'];
$r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s' ",
dbesc($name),
dbesc(datetime_convert()),
dbesc($images[0]),
dbesc($images[1]),
dbesc($images[2]),
dbesc($images[3]),
dbesc(datetime_convert()),
intval($contact['xchan_hash'])
);
return;
}
......@@ -2303,15 +2309,15 @@ class Diaspora_Receiver {
if(substr($birthday,5) === substr($new_contact['bd'],5))
$birthday = $new_contact['bd'];
$r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s' ",
$r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
dbesc($name),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($images[0]),
dbesc($images[1]),
dbesc($images[2]),
dbesc($images[3]),
dbesc(datetime_convert()),
intval($new_contact['xchan_hash'])
dbesc($new_contact['xchan_hash'])
);
$r = q("update abook set abook_xchan = '%s' where abook_xchan = '%s' and abook_channel = %d",
......
......@@ -533,7 +533,7 @@ function diaspora_queue($owner,$contact,$slap,$public_batch,$message_id = '') {
dbesc($dest_url),
dbesc($dest_url),
dbesc('queued'),
dbesc(datetime_convert()),
dbescdate(datetime_convert()),
dbesc($owner['channel_hash']),
dbesc($hash)
);
......@@ -708,7 +708,7 @@ function diaspora_discover(&$b) {
$r = q("update xchan set xchan_name = '%s', xchan_network = '%s', xchan_name_date = '%s', xchan_pubkey = '%s' where xchan_hash = '%s'",
dbesc($vcard['fn']),
dbesc($network),
dbesc(datetime_convert()),
dbescdate(datetime_convert()),
dbesc($pubkey),
dbesc($addr)
);
......@@ -750,7 +750,7 @@ function diaspora_discover(&$b) {
$photos = import_xchan_photo($vcard['photo'],$addr);
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
dbescdate(datetime_convert('UTC','UTC',$arr['photo_updated'])),
dbescdate(datetime_convert()),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
......@@ -1184,13 +1184,13 @@ function diaspora_queue_deliver(&$b) {
logger('deliver: queue post success to ' . $outq['outq_posturl'], LOGGER_DEBUG);
if($base) {
q("update site set site_update = '%s', site_dead = 0 where site_url = '%s' ",
dbesc(datetime_convert()),
dbescdate(datetime_convert()),
dbesc($base)
);
}
q("update dreport set dreport_result = '%s', dreport_time = '%s' where dreport_queue = '%s'",
dbesc('accepted for delivery'),
dbesc(datetime_convert()),
dbescdate(datetime_convert()),
dbesc($outq['outq_hash'])
);
remove_queue_item($outq['outq_hash']);
......
......@@ -597,7 +597,7 @@ function diaspora_send_retraction($item,$owner,$contact,$public_batch = false) {
if( $item['mid'] !== $item['parent_mid'] ) {
if(($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) && ($item['obj_type'] === ACTIVITY_TYPE_POST || $item['obj_type'] === ACTIVITY_TYPE_COMMENT)) {
if(($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) && ($item['obj_type'] === ACTIVITY_POST || $item['obj_type'] === ACTIVITY_OBJ_COMMENT)) {
$target_type = 'Like';
}
else {
......
......@@ -20,7 +20,6 @@ function donate_content(&$a) {
$contributors = array(
array('The Redmatrix/Hubzilla Projects', 'max@macgirvin.com', t('Project Servers and Resources')),
array('Mike Macgirvin','mike@macgirvin.com',t('Project Creator and Tech Lead')),
array('Thomas Willingham','beardyunixer@beardyunixer.com',t('Admin, developer, directorymin, support bloke')),
/* Developers and public hubs - add your donatable resource here */
);
......
This diff is collapsed.
This plugin is a [flashcard software](https://en.wikipedia.org/wiki/List_of_flashcard_software) that uses [spaced repetition](https://en.wikipedia.org/wiki/Spaced_repetition) as a learning technique.
You can share the flash cards with other users of Hubzilla.
Your learning progress will be kept private.
<img src="/addon/flashcards/view/img/leitner-system.png" align="center" width="70%">
### Two Scenarios to use the Addon...
- a centralised school like version where the "school" owns the flashcards
- a decentralised version where every learner owns his own copy
In both cases serveral learners can share a box of flashcards, lets say to learn "English-Italian".
Every learner can edit and add cards for "English-Italian". The changes are shared between the learners.
### Scenario 1: Students use Flashcards of a School
The school and the students all have an account at Hubzilla (Osada). The school has the Flashcards-Addon installed.
#### In Praxis
Provided the school and the students live on differnt hubs:
- The school on https://school.com/
- A student on https://student.org/
The school has the addon installed at https://school.com/flashcards/school .
The school creates a box of flashcards "English-Italian" and possibly some more. The URL for "English-Italian" could be something like https://school.com/flashcards/school/xy12tlsel89q81o .
The student learns "English-Italian" by opening https://school.com/flashcards/school/xy12tlsel89q81o .
The school and the students can both change or add cards. The syncronization is done automatically as soon as they upload changes.
#### Permissions and Technically
A student sees those flashcards only the school allows him to see. The student will get a copy of "English-Italian". For both users it looks the same, same URL, same content. Everything is done under the hood. The student does not own the flashcards. The school can withdraw the permissions for a student or even delete the flashcards at any time.
### Scenario 2: Two or more Learners share their Flashcards Hub to Hub (planned)
This feature is planned.
Every learner has an account at Hubzilla (Osada) and the Flashcards-Addon installed.
#### In Praxis
Provided two learners Anna and Bob live on differnt hubs and have the addon installed
- Anna on https://anna.org/flashcards/anna
- Bob on https://bob.org/flashcards/bob
Anna creates a new box of flashcards "English-Italian". The URL could be something like this https://anna.org/flashcards/anna/xy12tlsel89q81o
Bob wants to learn "English-Italian" from Anna. Bob opens his own addon at https://bob.org/flashcards/bob and imports "English-Italian" from Anna using the URL https://anna.org/flashcards/anna/xy12tlsel89q81o .
Both are able to changes or adds cards. The syncronization is done automatically - this time from hub to hub.
#### Permissions and Technically
Bob can only import flashcards from Anna that Anna allows him to see.
If Bob imports "English-Italian" his hub will receive a copy from Annas hub. Bob now owns his copy. The boxes stay connected. The content of "English-Italian" is synchronized from hub to hub as soon as on of them edits or adds a cards. Anna and Bob will see the (language = content) changes of each other. They will never see the learning progress of each other. The learning progress will not leave the hub.
Anna CAN NOT withdraw the permissions for Bob (on Bobs hub) or delete the flashcards of Bob.
Both Anna and Bob can switch off the synchronization from hub to hub. Bob may decide to not merge changes from each other.
version: 1.0
url: $baseurl/flashcards/$nick
requires: local_channel
name: Flashcards
photo: icon:graduation-cap
\ No newline at end of file
<?php
use Zotlabs\Extend\Route;
/**
* Name: Flashcards
* Description: Flashcard software that uses spaced repetition as a learning technique.
* Version: 1.0
* Author: Tom Wiedenhöft (ojrandom@protonmail.com)
* Maintainer: Tom Wiedenhöft (ojrandom@protonmail.com)
*
*/
function flashcards_load() {
Route::register('addon/flashcards/Mod_Flashcards.php', 'flashcards');
}
function flashcards_unload() {
Route::unregister('addon/flashcards/Mod_Flashcards.php', 'flashcards');
}
#button_flashcards_learn_passed {
color:green;
}
#button_flashcards_learn_failed {
color:red;
}
#flashcards_panel_learn_buttons {
display:none;
}
#button_flashcards_learn_stopp {
display:none;
}
#button_flashcards_learn_next {
display:none;
}
#button_flashcards_learn_passed {
display:none;
}
#button_flashcards_learn_failed {
display:none;
}
#button_flashcards_learn_failed {
display:none;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,6 @@
* Maintainer: Mario
*/
use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Extend\Hook;
......
......@@ -439,13 +439,14 @@ function asencode_activity($i) {
'href' => $reply_url,
'name' => '@' . $reply_addr
];
$ret['tag'] = (($ret['tag']) ? array_merge($ret['tag'],$m) : $m);
$ret['tag'] = (($ret['object']['tag']) ? array_merge($ret['object']['tag'],$m) : $m);
}
$ret['to'] = [ $reply_url ];
}
else {
$ret['to'] = as_map_acl($i);
$ret['to'] = []; //this is important for pleroma
$ret['cc'] = as_map_acl($i);
}
}
else {
......@@ -467,19 +468,19 @@ function asencode_activity($i) {
$ret['to'][] = ACTIVITY_PUBLIC_INBOX;
$ret['cc'][] = $followers_url;
}
}
$mentions = as_map_mentions($i);
if(count($mentions)) {
$ret['cc'] = array_merge($ret['cc'], $mentions);
}
$mentions = as_map_mentions($i);
if(count($mentions)) {
$ret['to'] = (($ret['to']) ? array_merge($ret['to'],$mentions) : $mentions);
}
if(in_array($ret['object']['type'], [ 'Note', 'Article' ])) {
if($ret['to'])
if(isset($ret['to']))
$ret['object']['to'] = $ret['to'];
if($ret['cc'])
if(isset($ret['cc']))
$ret['object']['cc'] = $ret['cc'];
if($ret['tag'])
if(isset($ret['tag']))
$ret['object']['tag'] = $ret['tag'];
}
......@@ -1020,7 +1021,7 @@ function as_actor_store($url,$person_obj) {
dbesc(escape_tags($name)),
dbesc(escape_tags($pubkey)),
dbesc('activitypub'),
dbesc(datetime_convert()),
dbescdate(datetime_convert()),
dbesc($url)
);
}
......@@ -1061,7 +1062,7 @@ function as_actor_store($url,$person_obj) {
$photos = import_xchan_photo($icon,$url);
$r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
dbescdate(datetime_convert('UTC','UTC',$arr['photo_updated'])),
dbescdate(datetime_convert()),
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
......
......@@ -14,13 +14,13 @@ use Zotlabs\Extend\Route;
function startpage_load() {
Hook::register('home_init', 'addon/startpage/startpage.php', 'startpage_home_init');
Route::register('addon/nsfw/Mod_Startpage.php','startpage');
Route::register('addon/startpage/Mod_Startpage.php','startpage');
}
function startpage_unload() {
Hook::unregister('home_init', 'addon/startpage/startpage.php', 'startpage_home_init');
Route::register('addon/startpage/Mod_Startpage.php','startpage');
Route::unregister('addon/startpage/Mod_Startpage.php','startpage');
}
function startpage_home_init(&$b) {
......
......@@ -24,6 +24,7 @@ function superblock_load() {
register_hook('conversation_start', 'addon/superblock/superblock.php', 'superblock_conversation_start');
register_hook('thread_author_menu', 'addon/superblock/superblock.php', 'superblock_item_photo_menu');
register_hook('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store');
register_hook('enotify_format', 'addon/superblock/superblock.php', 'superblock_enotify_format');
register_hook('item_store', 'addon/superblock/superblock.php', 'superblock_item_store');
register_hook('directory_item', 'addon/superblock/superblock.php', 'superblock_directory_item');
register_hook('api_format_items', 'addon/superblock/superblock.php', 'superblock_api_format_items');
......@@ -40,6 +41,7 @@ function superblock_unload() {
unregister_hook('conversation_start', 'addon/superblock/superblock.php', 'superblock_conversation_start');
unregister_hook('thread_author_menu', 'addon/superblock/superblock.php', 'superblock_item_photo_menu');
unregister_hook('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store');
unregister_hook('enotify_format', 'addon/superblock/superblock.php', 'superblock_enotify_format');
unregister_hook('item_store', 'addon/superblock/superblock.php', 'superblock_item_store');
unregister_hook('directory_item', 'addon/superblock/superblock.php', 'superblock_directory_item');
unregister_hook('api_format_items', 'addon/superblock/superblock.php', 'superblock_api_format_items');
......@@ -184,6 +186,23 @@ function superblock_enotify_store(&$a,&$b) {
}
}
function superblock_enotify_format(&$b) {
$sb = new Superblock($b['uid']);
$found = false;
if($sb->match($b['hash']))
$found = true;
if($found) {
$b['display'] = false;
}
}
function superblock_api_format_items(&$a,&$b) {
if(! Apps::addon_app_installed($b['api_user'], 'superblock'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment