use Friendica\Util\Strings;
use Friendica\Util\Temporal;
+/**
+ * Sets the current theme for theme settings pages.
+ *
+ * This needs to be done before the post() or content() methods are called.
+ *
+ * @param App $a
+ */
+function admin_init(App $a)
+{
+ if ($a->argc > 2 && $a->argv[1] == 'themes') {
+ $theme = $a->argv[2];
+ if (is_file("view/theme/$theme/config.php")) {
+ $a->setCurrentTheme($theme);
+ }
+ }
+}
+
/**
* @brief Process send data from the admin panels subpages
*
$theme = $a->argv[2];
if (is_file("view/theme/$theme/config.php")) {
- $a->setCurrentTheme($theme);
-
- require_once "view/theme/$theme/theme.php";
require_once "view/theme/$theme/config.php";
- $init = $theme . '_init';
- if (function_exists($init)) {
- $init($a);
- }
if (function_exists('theme_admin_post')) {
theme_admin_post($a);
}
$admin_form = '';
if (is_file("view/theme/$theme/config.php")) {
- $a->setCurrentTheme($theme);
-
- require_once "view/theme/$theme/theme.php";
require_once "view/theme/$theme/config.php";
- $init = $theme . "_init";
- if (function_exists($init)) {
- $init($a);
- }
-
if (function_exists('theme_admin')) {
$admin_form = theme_admin($a);
}
$content = '';
- // Load current theme info after module has been executed as theme could have been set in module
- $theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
- if (file_exists($theme_info_file)) {
- require_once $theme_info_file;
- }
-
- // Call module functions
+ // Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
if ($this->module_loaded) {
$this->page['page_title'] = $this->module;
$placeholder = '';
if (!$this->error) {
call_user_func([$this->module_class, 'rawContent']);
}
+ }
- if (function_exists(str_replace('-', '_', $this->getCurrentTheme()) . '_init')) {
- $func = str_replace('-', '_', $this->getCurrentTheme()) . '_init';
- $func($this);
- }
+ // Load current theme info after module has been initialized as theme could have been set in module
+ $theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
+ if (file_exists($theme_info_file)) {
+ require_once $theme_info_file;
+ }
+ if (function_exists(str_replace('-', '_', $this->getCurrentTheme()) . '_init')) {
+ $func = str_replace('-', '_', $this->getCurrentTheme()) . '_init';
+ $func($this);
+ }
+
+ if ($this->module_loaded) {
if (! $this->error && $_SERVER['REQUEST_METHOD'] === 'POST') {
Core\Addon::callHooks($this->module . '_mod_post', $_POST);
call_user_func([$this->module_class, 'post']);
return;
}
- self::storeConversation($object_data, $body);
+ // Only store content related stuff - and no announces, since they possibly overwrite the original content
+ if (in_array($object_data['object_type'], self::CONTENT_TYPES) && ($type != 'as:Announce')) {
+ self::storeConversation($object_data, $body);
+ }
// Internal flag for thread completion. See Processor.php
if (!empty($activity['thread-completion'])) {
$last_id = $item['id'];
}
+ $always_bcc = false;
+
+ // Check if we should always deliver our stuff via BCC
+ if (!empty($item['uid'])) {
+ $profile = Profile::getByUID($item['uid']);
+ if (!empty($profile)) {
+ $always_bcc = $profile['hide-friends'];
+ }
+ }
+
// Will be activated in a later step
// $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
}
foreach ($receiver_list as $receiver) {
- $contact = DBA::selectFirst('contact', ['url'], ['id' => $receiver, 'network' => $networks]);
+ $contact = DBA::selectFirst('contact', ['url', 'hidden'], ['id' => $receiver, 'network' => $networks]);
if (DBA::isResult($contact) && !empty($profile = APContact::getByURL($contact['url'], false))) {
- // BCC is currently deactivated, due to Pleroma and Mastodon not reacting like expected
- // $data['bcc'][] = $profile['url'];
- $data['cc'][] = $profile['url'];
+ if ($contact['hidden'] || $always_bcc) {
+ $data['bcc'][] = $profile['url'];
+ } else {
+ $data['cc'][] = $profile['url'];
+ }
}
}
}
*/
private static function getTypeOfItem($item)
{
- if (!empty(Diaspora::isReshare($item['body'], false))) {
+ $reshared = false;
+
+ // Only check for a reshare, if it is a real reshare and no quoted reshare
+ if (strpos($item['body'], "[share") === 0) {
+ $announce = api_share_as_retweet($item);
+ $reshared = !empty($announce['plink']);
+ }
+
+ if ($reshared) {
$type = 'Announce';
} elseif ($item['verb'] == ACTIVITY_POST) {
if ($item['created'] == $item['edited']) {
$terms = Term::tagArrayFromItemId($item['id']);
foreach ($terms as $term) {
if ($term['type'] == TERM_HASHTAG) {
- $tags[] = ['type' => 'Hashtag', 'href' => $term['url'], 'name' => '#' . $term['term']];
+ $url = System::baseUrl() . '/search?tag=' . urlencode($term['term']);
+ $tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['term']];
} elseif ($term['type'] == TERM_MENTION) {
$contact = Contact::getDetailsByURL($term['url']);
if (!empty($contact['addr'])) {
return self::createNote($item);
}
- return $announce['plink'];
+ // Fetch the original id of the object
+ $activity = ActivityPub::fetchContent($announce['plink'], $item['uid']);
+ if (!empty($activity)) {
+ $ldactivity = JsonLD::compact($activity);
+ $id = JsonLD::fetchElement($ldactivity, '@id');
+ if (!empty($id)) {
+ return $id;
+ }
+ }
+
+ return self::createNote($item);
}
/**
<div id="photos-upload-exist-wrapper">
<div id="photos-upload-existing-album-text">{{$existalbumtext}}</div>
<select id="photos-upload-album-select" name="album" size="4">
- {{$albumselect}}
+ {{$albumselect nofilter}}
</select>
</div>
<div id="photos-upload-exist-end"></div>
<label id="photos-upload-text" for="photos-upload-newalbum" >{{$newalbum}}</label>
<input id="photos-upload-album-select" class="form-control" placeholder="{{$existalbumtext}}" list="dl-photo-upload" type="text" name="album" size="4">
- <datalist id="dl-photo-upload">{{$albumselect}}</datalist>
+ <datalist id="dl-photo-upload">{{$albumselect nofilter}}</datalist>
</div>
<div id="photos-upload-end" class="clearfix"></div>
use Friendica\Module;
use Friendica\Util\Strings;
-$frio = 'view/theme/frio';
-
-global $frio;
-
function frio_init(App $a)
{
+ global $frio;
+ $frio = 'view/theme/frio';
+
// disable the events module link in the profile tab
$a->theme_events_in_profile = false;
$a->videowidth = 622;
Renderer::setActiveTemplateEngine('smarty3');
- $baseurl = System::baseUrl();
-
- $style = PConfig::get(local_user(), 'frio', 'style');
-
- $frio = 'view/theme/frio';
-
- global $frio;
-
// if the device is a mobile device set js is_mobile
// variable so the js scripts can use this information
if ($a->is_mobile || $a->is_tablet) {
</script>
EOT;
}
-
- if ($style == '') {
- $style = Config::get('frio', 'style');
- }
}
function frio_install()