]> git.mxchange.org Git - friendica.git/blobdiff - mod/videos.php
Move unsecured GET endpoint handlers before security token check in Module\Contact
[friendica.git] / mod / videos.php
index f678e13fc6ff3d8e2d5f5d451eb1120c17550070..2bd5eb8c91bf453880cdc9bd0c6367634fcc1621 100644 (file)
@@ -29,6 +29,7 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Attach;
 use Friendica\Model\Item;
+use Friendica\Model\Profile;
 use Friendica\Model\User;
 use Friendica\Module\BaseProfile;
 use Friendica\Security\Security;
@@ -42,8 +43,8 @@ function videos_init(App $a)
 
        Nav::setSelected('home');
 
-       if ($a->argc > 1) {
-               $owner = User::getOwnerDataByNick($a->argv[1]);
+       if (DI::args()->getArgc() > 1) {
+               $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
                if (empty($owner)) {
                        throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
                }
@@ -64,7 +65,7 @@ function videos_init(App $a)
 
 function videos_post(App $a)
 {
-       $user = User::getByNickname($a->argv[1]);
+       $user = User::getByNickname(DI::args()->getArgv()[1]);
        if (!DBA::isResult($user)) {
                throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
        }
@@ -73,7 +74,7 @@ function videos_post(App $a)
                DI::baseUrl()->redirect('videos/' . $user['nickname']);
        }
 
-       if (($a->argc == 2) && !empty($_POST['delete']) && !empty($_POST['id'])) {
+       if ((DI::args()->getArgc() == 2) && !empty($_POST['delete']) && !empty($_POST['id'])) {
                $video_id = $_POST['id'];
 
                if (Attach::exists(['id' => $video_id, 'uid' => local_user()])) {
@@ -105,7 +106,7 @@ function videos_content(App $a)
        // videos/name/video/xxxxx
        // videos/name/video/xxxxx/edit
 
-       $user = User::getByNickname($a->argv[1]);
+       $user = User::getByNickname(DI::args()->getArgv()[1]);
        if (!DBA::isResult($user)) {
                throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
        }
@@ -120,6 +121,7 @@ function videos_content(App $a)
                return;
        }
 
+       $profile = Profile::getByUID($user['uid']);
        //$phototypes = Photo::supportedTypes();
 
        $_SESSION['video_return'] = DI::args()->getCommand();
@@ -127,9 +129,9 @@ function videos_content(App $a)
        //
        // Parse arguments
        //
-       if ($a->argc > 3) {
-               $datatype = $a->argv[2];
-       } elseif(($a->argc > 2) && ($a->argv[2] === 'upload')) {
+       if (DI::args()->getArgc() > 3) {
+               $datatype = DI::args()->getArgv()[2];
+       } elseif((DI::args()->getArgc() > 2) && (DI::args()->getArgv()[2] === 'upload')) {
                $datatype = 'upload';
        } else {
                $datatype = 'summary';
@@ -171,7 +173,7 @@ function videos_content(App $a)
 
        // tabs
        $_is_owner = (local_user() && (local_user() == $user['uid']));
-       $o .= BaseProfile::getTabsHTML($a, 'videos', $_is_owner, $user);
+       $o .= BaseProfile::getTabsHTML($a, 'videos', $_is_owner, $user['nickname'], $profile['hide-friends']);
 
        //
        // dispatch request