X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fvideos.php;h=e00df10a24b48d171fa05287c7456b86875a795d;hb=92c4ca091193e571d76a9db7b2d4078e2b3dc473;hp=4f5d7cd22db33acd58fc9cdce0c2175647094ed5;hpb=c73d9611983b05cd1207d69c71a157c051b3f2e8;p=friendica.git diff --git a/mod/videos.php b/mod/videos.php index 4f5d7cd22d..e00df10a24 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -1,46 +1,65 @@ argc > 1) - auto_redir($a, $a->argv[1]); +/** + * @file mod/videos.php + */ + +use Friendica\App; +use Friendica\Content\Nav; +use Friendica\Core\Config; +use Friendica\Core\L10n; +use Friendica\Core\System; +use Friendica\Database\DBA; +use Friendica\Model\Contact; +use Friendica\Model\Group; +use Friendica\Model\Item; +use Friendica\Model\Profile; +use Friendica\Protocol\DFRN; + +require_once 'include/items.php'; +require_once 'include/security.php'; + +function videos_init(App $a) +{ + if ($a->argc > 1) { + DFRN::autoRedir($a, $a->argv[1]); + } - if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { + if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) { return; } - nav_set_selected('home'); + Nav::setSelected('home'); $o = ''; - if($a->argc > 1) { + if ($a->argc > 1) { $nick = $a->argv[1]; - $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", - dbesc($nick) + $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", + DBA::escape($nick) ); - if(! count($r)) + if (!DBA::isResult($user)) { return; + } - $a->data['user'] = $r[0]; - $a->profile_uid = $r[0]['uid']; + $a->data['user'] = $user[0]; + $a->profile_uid = $user[0]['uid']; - $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg'); + $profile = Profile::getByNickname($nick, $a->profile_uid); - $tpl = get_markup_template("vcard-widget.tpl"); + $account_type = Contact::getAccountType($profile); - $vcard_widget = replace_macros($tpl, array( - '$name' => $a->data['user']['username'], - '$photo' => $profilephoto - )); + $tpl = get_markup_template("vcard-widget.tpl"); + $vcard_widget = replace_macros($tpl, [ + '$name' => $profile['name'], + '$photo' => $profile['photo'], + '$addr' => defaults($profile, 'addr', ''), + '$account_type' => $account_type, + '$pdesc' => defaults($profile, 'pdesc', ''), + ]); + /// @TODO Old-lost code? /*$sql_extra = permissions_sql($a->data['user']['uid']); $albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d $sql_extra order by created desc", @@ -50,11 +69,11 @@ function videos_init(&$a) { if(count($albums)) { $a->data['albums'] = $albums; - $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true); + $albums_visible = ((intval($a->data['user']['hidewall']) && (!local_user()) && (!remote_user())) ? false : true); if($albums_visible) { - $o .= '