X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fvideos.php;h=e00df10a24b48d171fa05287c7456b86875a795d;hb=92c4ca091193e571d76a9db7b2d4078e2b3dc473;hp=ae00185cca9da11fe03c6352499ea820be86ae16;hpb=89c5989cfb679449fb776df7380e972d0f676d8d;p=friendica.git diff --git a/mod/videos.php b/mod/videos.php index ae00185cca..e00df10a24 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -1,53 +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]; $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", - dbesc($nick) + DBA::escape($nick) ); - if(! count($user)) + if (!DBA::isResult($user)) { return; + } $a->data['user'] = $user[0]; $a->profile_uid = $user[0]['uid']; - $profile = get_profiledata_by_nick($nick, $a->profile_uid); + $profile = Profile::getByNickname($nick, $a->profile_uid); - if((x($profile['page-flags']) == 1) - || (x($profile['page-flags']) == 2) - || (x($profile['page-flags']) == 5)) - $account_type = page_type_translate($profile['page-flags']); + $account_type = Contact::getAccountType($profile); $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget .= replace_macros($tpl, array( - '$name' => $profile[name], - '$photo' => $profile[photo], - '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ''), + $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", @@ -57,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 .= '