<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Name: frio
- * Description: Bootstrap V3 theme. The theme is currently under construction, so it is far from finished. For further information have a look at the <a href="https://github.com/friendica/friendica/tree/develop/view/theme/frio/README.md">ReadMe</a>.
- * Version: V.0.8.5
+ * Description: Responsive theme based on a modern HTML/CSS/JavaScript framework.
+ * Version: V.1.0
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus>
+ * Maintainer: Hypolite Petovan <https://friendica.mrpetovan.com/profile/hypolite>
*/
use Friendica\App;
use Friendica\Content\Text\Plaintext;
-use Friendica\Content\Widget;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model;
-use Friendica\Model\Item;
use Friendica\Model\Contact;
+use Friendica\Model\Item;
use Friendica\Model\Profile;
-use Friendica\Module;
-use Friendica\Util\Strings;
const FRIO_SCHEME_ACCENT_BLUE = '#1e87c2';
const FRIO_SCHEME_ACCENT_RED = '#b50404';
global $frio;
$frio = 'view/theme/frio';
- // disable the events module link in the profile tab
- $a->setThemeInfoValue('events_in_profile', false);
$a->setThemeInfoValue('videowidth', 622);
Renderer::setActiveTemplateEngine('smarty3');
* This function does replace the links to photos
* of other friendica users. Original the photos are
* linked to the photo page. Now they will linked directly
- * to the photo file. This function is nessesary to use colorbox
+ * to the photo file. This function is necessary to use colorbox
* in the network stream
*
- * @param App $a Unused but required by hook definition
* @param array $body_info The item and its html output
*/
-function frio_item_photo_links(App $a, &$body_info)
+function frio_item_photo_links(&$body_info)
{
$occurence = 0;
$p = Plaintext::getBoundariesPosition($body_info['html'], '<a', '>');
$newlink = str_replace($matches[0], "/photo/{$matches[1]}", $link);
// Add a "quiet" parameter to any redir links to prevent the "XX welcomes YY" info boxes
- $newlink = preg_replace('/href="([^"]+)\/redir\/([^"]+)&url=([^"]+)"/', 'href="$1/redir/$2&quiet=1&url=$3"', $newlink);
+ $newlink = preg_replace('#href="([^"]+)/contact/redir/(\d+)&url=([^"]+)"#', 'href="$1/contact/redir/$2&quiet=1&url=$3"', $newlink);
// Having any arguments to the link for Colorbox causes it to fetch base64 code instead of the image
$newlink = preg_replace('/\/[?&]zrl=([^&"]+)/', '', $newlink);
* to call the addToModal javascript function so this pages can
* be loaded in a bootstrap modal
*
- * @param App $a Unused but required by the hook definition
* @param array $arr Contains item data and the original photo_menu
*/
-function frio_item_photo_menu(App $a, &$arr)
+function frio_item_photo_menu(&$arr)
{
foreach ($arr['menu'] as $k => $v) {
if (strpos($v, 'message/new/') === 0) {
* Additionally the profile, status and photo page links will be changed
* to don't open in a new tab if the contact is a friendica contact.
*
- * @param App $a The app data
* @param array $args Contains contact data and the original photo_menu
*/
-function frio_contact_photo_menu(App $a, &$args)
+function frio_contact_photo_menu(&$args)
{
$cid = $args['contact']['id'];
$pmlink = '';
}
- // Set the the indicator for opening the status, profile and photo pages
+ // Set the indicator for opening the status, profile and photo pages
// in a new tab to false if the contact a dfrn (friendica) contact
- // We do this because we can go back on foreign friendica pages throuhg
- // friendicas "magic-link" which indicates a friendica user on froreign
+ // We do this because we can go back on foreign friendica pages through
+ // friendicas "magic-link" which indicates a friendica user on foreign
// friendica servers as remote user or visitor
//
// The value for opening in a new tab is e.g. when
// Add to pm link a new key with the value 'modal'.
// Later we can make conditions in the corresponding templates (e.g.
- // contact_template.tpl)
+ // contact/entry.tpl)
if (strpos($pmlink, 'message/new/' . $cid) !== false) {
$args['menu']['pm'][3] = 'modal';
}
* @param array $nav_info The original nav info array: nav, banner, userinfo, sitelocation
* @throws Exception
*/
-function frio_remote_nav(App $a, array &$nav_info)
+function frio_remote_nav(array &$nav_info)
{
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
// get the homelink from $_SESSION
// since $userinfo isn't available for the hook we write it to the nav array
// this isn't optimal because the contact query will be done now twice
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
- if ($a->isLoggedIn()) {
- $remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
+ if (DI::userSession()->isAuthenticated()) {
+ $remoteUser = Contact::selectFirst($fields, ['uid' => DI::userSession()->getLocalUserId(), 'self' => true]);
} elseif (!DI::userSession()->getLocalUserId() && DI::userSession()->getRemoteUserId()) {
$remoteUser = Contact::getById(DI::userSession()->getRemoteUserId(), $fields);
$nav_info['nav']['remote'] = DI::l10n()->t('Guest');
// user menu
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
+ // Kept for backwards-compatibility reasons, the remote server may not have updated to version 2022.12 yet
+ // @TODO Switch with the new routes by version 2023.12
+ //$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/photos', DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
$nav_info['nav']['usermenu'][] = [$server_url . '/photos/' . $remoteUser['nick'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/media', DI::l10n()->t('Media'), '', DI::l10n()->t('Your postings with media')];
$nav_info['nav']['usermenu'][] = [$server_url . '/calendar/', DI::l10n()->t('Calendar'), '', DI::l10n()->t('Your calendar')];
}
}
-function frio_display_item(App $a, &$arr)
+function frio_display_item(&$arr)
{
// Add follow to the item menu
$followThread = [];