mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Update function calls
update function calls to use profile class
This commit is contained in:
parent
4cfa46186a
commit
4fb2547df8
45 changed files with 360 additions and 294 deletions
|
@ -13,6 +13,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
require_once 'include/html2plain.php';
|
||||
|
@ -814,7 +815,7 @@ class NotificationsManager extends BaseObject
|
|||
'contact_id' => $it['contact-id'],
|
||||
'photo' => ((x($it, 'fphoto')) ? proxy_url($it['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
|
||||
'name' => $it['fname'],
|
||||
'url' => zrl($it['furl']),
|
||||
'url' => Profile::zrl($it['furl']),
|
||||
'hidden' => $it['hidden'] == 1,
|
||||
'post_newfriend' => (intval(PConfig::get(local_user(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||
'knowyou' => $knowyou,
|
||||
|
@ -848,7 +849,7 @@ class NotificationsManager extends BaseObject
|
|||
'hidden' => $it['hidden'] == 1,
|
||||
'post_newfriend' => (intval(PConfig::get(local_user(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||
'url' => $it['url'],
|
||||
'zrl' => zrl($it['url']),
|
||||
'zrl' => Profile::zrl($it['url']),
|
||||
'addr' => $it['gaddr'],
|
||||
'network' => $it['gnetwork'],
|
||||
'knowyou' => $it['knowyou'],
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/Contact.php
|
||||
*/
|
||||
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
|
@ -14,6 +12,7 @@ use Friendica\Core\Worker;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\OStatus;
|
||||
|
@ -490,7 +489,7 @@ class Contact extends BaseObject
|
|||
|
||||
if ($contact['uid'] != $uid) {
|
||||
if ($uid == 0) {
|
||||
$profile_link = zrl($contact['url']);
|
||||
$profile_link = Profile::zrl($contact['url']);
|
||||
$menu = array('profile' => array(t('View Profile'), $profile_link, true));
|
||||
|
||||
return $menu;
|
||||
|
@ -501,7 +500,7 @@ class Contact extends BaseObject
|
|||
if (DBM::is_result($contact_own)) {
|
||||
return self::photoMenu($contact_own, $uid);
|
||||
} else {
|
||||
$profile_link = zrl($contact['url']);
|
||||
$profile_link = Profile::zrl($contact['url']);
|
||||
$connlnk = 'follow/?url=' . $contact['url'];
|
||||
$menu = array(
|
||||
'profile' => array(t('View Profile'), $profile_link, true),
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/Profile.php
|
||||
*/
|
||||
|
@ -17,7 +16,9 @@ use Friendica\Core\Worker;
|
|||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'mod/proxy.php';
|
||||
|
||||
|
@ -76,18 +77,15 @@ class Profile
|
|||
* the theme is chosen before the _init() function of a theme is run, which will usually
|
||||
* load a lot of theme-specific content
|
||||
*
|
||||
* @param object $a App
|
||||
* @param string $nickname string
|
||||
* @param int $profile int
|
||||
* @param array $profiledata array
|
||||
* @param object $a App
|
||||
* @param string $nickname string
|
||||
* @param int $profile int
|
||||
* @param array $profiledata array
|
||||
* @param boolean $show_connect Show connect link
|
||||
*/
|
||||
function profile_load(App $a, $nickname, $profile = 0, $profiledata = array(), $show_connect = true)
|
||||
public static function load(App $a, $nickname, $profile = 0, $profiledata = array(), $show_connect = true)
|
||||
{
|
||||
$user = q(
|
||||
"SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
|
||||
dbesc($nickname)
|
||||
);
|
||||
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname]);
|
||||
|
||||
if (!$user && !count($user) && !count($profiledata)) {
|
||||
logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
|
||||
|
@ -101,14 +99,14 @@ class Profile
|
|||
}
|
||||
|
||||
if ($profiledata) {
|
||||
$a->page['aside'] .= profile_sidebar($profiledata, true, $show_connect);
|
||||
$a->page['aside'] .= self::sidebar($profiledata, true, $show_connect);
|
||||
|
||||
if (!DBM::is_result($user)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$pdata = get_profiledata_by_nick($nickname, $user[0]['uid'], $profile);
|
||||
$pdata = self::getProfiledataByNick($nickname, $user[0]['uid'], $profile);
|
||||
|
||||
if (empty($pdata) && empty($profiledata)) {
|
||||
logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
|
||||
|
@ -176,7 +174,7 @@ class Profile
|
|||
* But: When this profile was on the same server, then we could display the contacts
|
||||
*/
|
||||
if (!$profiledata) {
|
||||
$a->page['aside'] .= profile_sidebar($a->profile, $block, $show_connect);
|
||||
$a->page['aside'] .= self::sidebar($a->profile, $block, $show_connect);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -197,7 +195,7 @@ class Profile
|
|||
* @param int $profile_id ID of the profile
|
||||
* @returns array
|
||||
*/
|
||||
function get_profiledata_by_nick($nickname, $uid = 0, $profile_id = 0)
|
||||
public static function getProfiledataByNick($nickname, $uid = 0, $profile_id = 0)
|
||||
{
|
||||
if (remote_user() && count($_SESSION['remote'])) {
|
||||
foreach ($_SESSION['remote'] as $visitor) {
|
||||
|
@ -263,7 +261,7 @@ class Profile
|
|||
* @hooks 'profile_sidebar'
|
||||
* array $arr
|
||||
*/
|
||||
function profile_sidebar($profile, $block = 0, $show_connect = true)
|
||||
private static function sidebar($profile, $block = 0, $show_connect = true)
|
||||
{
|
||||
$a = get_app();
|
||||
|
||||
|
@ -333,7 +331,7 @@ class Profile
|
|||
$subscribe_feed = false;
|
||||
}
|
||||
|
||||
if (remote_user() || (get_my_url() && x($profile, 'unkmail') && ($profile['uid'] != local_user()))) {
|
||||
if (remote_user() || (self::getMyURL() && x($profile, 'unkmail') && ($profile['uid'] != local_user()))) {
|
||||
$wallmessage = t('Message');
|
||||
$wallmessage_link = 'wallmessage/' . $profile['nickname'];
|
||||
|
||||
|
@ -348,7 +346,7 @@ class Profile
|
|||
$r = q(
|
||||
"SELECT `url` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `rel` = %d",
|
||||
intval($profile['uid']),
|
||||
dbesc(normalise_link(get_my_url())),
|
||||
dbesc(normalise_link(self::getMyURL())),
|
||||
intval(CONTACT_IS_FRIEND)
|
||||
);
|
||||
}
|
||||
|
@ -524,7 +522,7 @@ class Profile
|
|||
return $o;
|
||||
}
|
||||
|
||||
function get_birthdays()
|
||||
public static function getBirthdays()
|
||||
{
|
||||
$a = get_app();
|
||||
$o = '';
|
||||
|
@ -615,7 +613,7 @@ class Profile
|
|||
));
|
||||
}
|
||||
|
||||
function get_events()
|
||||
public static function getEvents()
|
||||
{
|
||||
require_once 'include/bbcode.php';
|
||||
|
||||
|
@ -700,7 +698,7 @@ class Profile
|
|||
));
|
||||
}
|
||||
|
||||
function advanced_profile(App $a)
|
||||
public static function getAdvanced(App $a)
|
||||
{
|
||||
$o = '';
|
||||
$uid = $a->profile['uid'];
|
||||
|
@ -844,7 +842,7 @@ class Profile
|
|||
return '';
|
||||
}
|
||||
|
||||
function profile_tabs($a, $is_owner = false, $nickname = null)
|
||||
public static function getTabs($a, $is_owner = false, $nickname = null)
|
||||
{
|
||||
if (is_null($nickname)) {
|
||||
$nickname = $a->user['nickname'];
|
||||
|
@ -950,7 +948,7 @@ class Profile
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_my_url()
|
||||
public static function getMyURL()
|
||||
{
|
||||
if (x($_SESSION, 'my_url')) {
|
||||
return $_SESSION['my_url'];
|
||||
|
@ -958,9 +956,9 @@ class Profile
|
|||
return null;
|
||||
}
|
||||
|
||||
function zrl_init(App $a)
|
||||
public static function zrlInit(App $a)
|
||||
{
|
||||
$my_url = get_my_url();
|
||||
$my_url = self::getMyURL();
|
||||
$my_url = validate_url($my_url);
|
||||
if ($my_url) {
|
||||
// Is it a DDoS attempt?
|
||||
|
@ -979,7 +977,7 @@ class Profile
|
|||
}
|
||||
}
|
||||
|
||||
function zrl($s, $force = false)
|
||||
public static function zrl($s, $force = false)
|
||||
{
|
||||
if (!strlen($s)) {
|
||||
return $s;
|
||||
|
@ -991,7 +989,7 @@ class Profile
|
|||
$s = $s . '/';
|
||||
}
|
||||
$achar = strpos($s, '?') ? '&' : '?';
|
||||
$mine = get_my_url();
|
||||
$mine = self::getMyURL();
|
||||
if ($mine && !link_compare($mine, $s)) {
|
||||
return $s . $achar . 'zrl=' . urlencode($mine);
|
||||
}
|
||||
|
@ -1012,7 +1010,7 @@ class Profile
|
|||
* @note Returns local_user instead of user ID if "always_my_theme"
|
||||
* is set to true
|
||||
*/
|
||||
function get_theme_uid()
|
||||
public static function getThemeUid()
|
||||
{
|
||||
$uid = ((!empty($_REQUEST['puid'])) ? intval($_REQUEST['puid']) : 0);
|
||||
if ((local_user()) && ((PConfig::get(local_user(), 'system', 'always_my_theme')) || (!$uid))) {
|
||||
|
@ -1021,5 +1019,4 @@ class Profile
|
|||
|
||||
return $uid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -190,7 +191,7 @@ class Post extends BaseObject
|
|||
if ($sp) {
|
||||
$sparkle = ' sparkle';
|
||||
} else {
|
||||
$profile_link = zrl($profile_link);
|
||||
$profile_link = Profile::zrl($profile_link);
|
||||
}
|
||||
|
||||
if (!isset($item['author-thumb']) || ($item['author-thumb'] == "")) {
|
||||
|
@ -832,7 +833,7 @@ class Post extends BaseObject
|
|||
// This will have been stored in $a->page_contact by our calling page.
|
||||
// Put this person as the wall owner of the wall-to-wall notice.
|
||||
|
||||
$this->owner_url = zrl($a->page_contact['url']);
|
||||
$this->owner_url = Profile::zrl($a->page_contact['url']);
|
||||
$this->owner_photo = $a->page_contact['thumb'];
|
||||
$this->owner_name = $a->page_contact['name'];
|
||||
$this->wall_to_wall = true;
|
||||
|
@ -860,7 +861,7 @@ class Post extends BaseObject
|
|||
) {
|
||||
$this->owner_url = $this->getRedirectUrl();
|
||||
} else {
|
||||
$this->owner_url = zrl($this->getDataValue('owner-link'));
|
||||
$this->owner_url = Profile::zrl($this->getDataValue('owner-link'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue