]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Merge pull request #8019 from nupplaphil/task/replace_getClass
[friendica.git] / mod / photos.php
index a3d81c041de811bf3f0e5b5f293af1ce1bb8711e..a0a1be9327bbae93565b49e18cc52f1c293a14e0 100644 (file)
@@ -173,12 +173,12 @@ function photos_post(App $a)
 
        if ($a->argc > 3 && $a->argv[2] === 'album') {
                if (!Strings::isHex($a->argv[3])) {
-                       $a->internalRedirect('photos/' . $a->data['user']['nickname'] . '/album');
+                       DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album');
                }
                $album = hex2bin($a->argv[3]);
 
                if ($album === L10n::t('Profile Photos') || $album === 'Contact Photos' || $album === L10n::t('Contact Photos')) {
-                       $a->internalRedirect($_SESSION['photo_return']);
+                       DI::baseUrl()->redirect($_SESSION['photo_return']);
                        return; // NOTREACHED
                }
 
@@ -189,13 +189,13 @@ function photos_post(App $a)
 
                if (!DBA::isResult($r)) {
                        notice(L10n::t('Album not found.') . EOL);
-                       $a->internalRedirect($_SESSION['photo_return']);
+                       DI::baseUrl()->redirect($_SESSION['photo_return']);
                        return; // NOTREACHED
                }
 
                // Check if the user has responded to a delete confirmation query
                if (!empty($_REQUEST['canceled'])) {
-                       $a->internalRedirect($_SESSION['photo_return']);
+                       DI::baseUrl()->redirect($_SESSION['photo_return']);
                }
 
                // RENAME photo album
@@ -209,7 +209,7 @@ function photos_post(App $a)
                        // Update the photo albums cache
                        Photo::clearAlbumCache($page_owner_uid);
 
-                       $a->internalRedirect('photos/' . $a->user['nickname'] . '/album/' . bin2hex($newalbum));
+                       DI::baseUrl()->redirect('photos/' . $a->user['nickname'] . '/album/' . bin2hex($newalbum));
                        return; // NOTREACHED
                }
 
@@ -252,13 +252,13 @@ function photos_post(App $a)
                        }
                }
 
-               $a->internalRedirect('photos/' . $a->argv[1]);
+               DI::baseUrl()->redirect('photos/' . $a->argv[1]);
        }
 
        if ($a->argc > 3 && $a->argv[2] === 'image') {
                // Check if the user has responded to a delete confirmation query for a single photo
                if (!empty($_POST['canceled'])) {
-                       $a->internalRedirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
+                       DI::baseUrl()->redirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
                }
 
                if (!empty($_POST['delete'])) {
@@ -282,10 +282,10 @@ function photos_post(App $a)
                                notice('Successfully deleted the photo.');
                        } else {
                                notice('Failed to delete the photo.');
-                               $a->internalRedirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
+                               DI::baseUrl()->redirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
                        }
 
-                       $a->internalRedirect('photos/' . $a->argv[1]);
+                       DI::baseUrl()->redirect('photos/' . $a->argv[1]);
                        return; // NOTREACHED
                }
        }
@@ -591,7 +591,7 @@ function photos_post(App $a)
                                }
                        }
                }
-               $a->internalRedirect($_SESSION['photo_return']);
+               DI::baseUrl()->redirect($_SESSION['photo_return']);
                return; // NOTREACHED
        }
 
@@ -817,7 +817,7 @@ function photos_post(App $a)
        // addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
        // if they do not wish to be redirected
 
-       $a->internalRedirect($_SESSION['photo_return']);
+       DI::baseUrl()->redirect($_SESSION['photo_return']);
        // NOTREACHED
 }
 
@@ -846,7 +846,7 @@ function photos_content(App $a)
 
        $phototypes = Images::supportedTypes();
 
-       $_SESSION['photo_return'] = $a->cmd;
+       $_SESSION['photo_return'] = DI::args()->getCommand();
 
        // Parse arguments
        $datum = null;
@@ -984,7 +984,7 @@ function photos_content(App $a)
                        // ACL permissions box
                        '$group_perms' => L10n::t('Show to Groups'),
                        '$contact_perms' => L10n::t('Show to Contacts'),
-                       '$return_path' => $a->query_string,
+                       '$return_path' => DI::args()->getQueryString(),
                ]);
 
                return $o;
@@ -994,7 +994,7 @@ function photos_content(App $a)
        if ($datatype === 'album') {
                // if $datum is not a valid hex, redirect to the default page
                if (!Strings::isHex($datum)) {
-                       $a->internalRedirect('photos/' . $a->data['user']['nickname']. '/album');
+                       DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname']. '/album');
                }
                $album = hex2bin($datum);
 
@@ -1008,7 +1008,7 @@ function photos_content(App $a)
                        $total = count($r);
                }
 
-               $pager = new Pager($a->query_string, 20);
+               $pager = new Pager(DI::args()->getQueryString(), 20);
 
                /// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
                $order_field = $_GET['order'] ?? '';
@@ -1030,7 +1030,7 @@ function photos_content(App $a)
                );
 
                if ($cmd === 'drop') {
-                       $drop_url = $a->query_string;
+                       $drop_url = DI::args()->getQueryString();
 
                        return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
                                '$method' => 'post',
@@ -1137,7 +1137,7 @@ function photos_content(App $a)
                }
 
                if ($cmd === 'drop') {
-                       $drop_url = $a->query_string;
+                       $drop_url = DI::args()->getQueryString();
 
                        return Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
                                '$method' => 'post',
@@ -1284,7 +1284,7 @@ function photos_content(App $a)
                        $condition = ["`parent` = ? AND `parent` != `id`",  $link_item['parent']];
                        $total = DBA::count('item', $condition);
 
-                       $pager = new Pager($a->query_string);
+                       $pager = new Pager(DI::args()->getQueryString());
 
                        $params = ['order' => ['id'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
                        $result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
@@ -1348,7 +1348,7 @@ function photos_content(App $a)
                                // ACL permissions box
                                '$group_perms' => L10n::t('Show to Groups'),
                                '$contact_perms' => L10n::t('Show to Contacts'),
-                               '$return_path' => $a->query_string,
+                               '$return_path' => DI::args()->getQueryString(),
                        ]);
                }
 
@@ -1362,7 +1362,7 @@ function photos_content(App $a)
                if (!empty($link_item['id']) && !empty($link_item['uri'])) {
                        $cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl');
                        $tpl = Renderer::getMarkupTemplate('photo_item.tpl');
-                       $return_path = $a->cmd;
+                       $return_path = DI::args()->getCommand();
 
                        if ($cmd === 'view' && ($can_post || Security::canWriteToUserWall($owner_uid))) {
                                $like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl');
@@ -1371,7 +1371,7 @@ function photos_content(App $a)
                                        '$likethis' => L10n::t("I like this \x28toggle\x29"),
                                        '$nolike' => L10n::t("I don't like this \x28toggle\x29"),
                                        '$wait' => L10n::t('Please wait'),
-                                       '$return_path' => $a->query_string,
+                                       '$return_path' => DI::args()->getQueryString(),
                                ]);
                        }
 
@@ -1549,7 +1549,7 @@ function photos_content(App $a)
                $total = count($r);
        }
 
-       $pager = new Pager($a->query_string, 20);
+       $pager = new Pager(DI::args()->getQueryString(), 20);
 
        $r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
                ANY_VALUE(`type`) AS `type`, ANY_VALUE(`album`) AS `album`, max(`scale`) AS `scale`,