]> git.mxchange.org Git - friendica.git/blobdiff - mod/videos.php
Issue 7285: Perform duplicate check for item URI also with AP
[friendica.git] / mod / videos.php
index a117e0f1a853f283b13b429d73457c5af676be5c..9e19ecf11744d4d53da9b6d163095007919b2e52 100644 (file)
@@ -16,6 +16,7 @@ use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
 use Friendica\Model\Profile;
+use Friendica\Model\User;
 use Friendica\Protocol\DFRN;
 use Friendica\Util\Security;
 
@@ -31,8 +32,6 @@ function videos_init(App $a)
 
        Nav::setSelected('home');
 
-       $o = '';
-
        if ($a->argc > 1) {
                $nick = $a->argv[1];
                $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
@@ -50,7 +49,7 @@ function videos_init(App $a)
 
                $account_type = Contact::getAccountType($profile);
 
-               $tpl = Renderer::getMarkupTemplate("vcard-widget.tpl");
+               $tpl = Renderer::getMarkupTemplate("widget/vcard.tpl");
 
                $vcard_widget = Renderer::replaceMacros($tpl, [
                        '$name' => $profile['name'],
@@ -68,9 +67,7 @@ function videos_init(App $a)
                $a->page['aside'] .= $vcard_widget;
 
                $tpl = Renderer::getMarkupTemplate("videos_head.tpl");
-               $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[
-                       '$baseurl' => System::baseUrl(),
-               ]);
+               $a->page['htmlhead'] .= Renderer::replaceMacros($tpl);
        }
 
        return;
@@ -85,37 +82,9 @@ function videos_post(App $a)
        }
 
        if (($a->argc == 2) && !empty($_POST['delete']) && !empty($_POST['id'])) {
-               // Check if we should do HTML-based delete confirmation
-               if (empty($_REQUEST['confirm'])) {
-                       if (!empty($_REQUEST['canceled'])) {
-                               $a->internalRedirect('videos/' . $a->data['user']['nickname']);
-                       }
-
-                       $drop_url = $a->query_string;
-
-                       $a->page['content'] = Renderer::replaceMacros(Renderer::getMarkupTemplate('confirm.tpl'), [
-                               '$method' => 'post',
-                               '$message' => L10n::t('Do you really want to delete this video?'),
-                               '$extra_inputs' => [
-                                       ['name' => 'id'    , 'value' => $_POST['id']],
-                                       ['name' => 'delete', 'value' => 'x']
-                               ],
-                               '$confirm' => L10n::t('Delete Video'),
-                               '$confirm_url' => $drop_url,
-                               '$confirm_name' => 'confirm', // Needed so that confirmation will bring us back into this if statement
-                               '$cancel' => L10n::t('Cancel'),
-
-                       ]);
-
-                       $a->error = 1; // Set $a->error so the other module functions don't execute
-
-                       return;
-               }
-
                $video_id = $_POST['id'];
 
-               $r = Attach::exists(['id' => $video_id, 'uid' => local_user()]);
-               if ($r === true) {
+               if (Attach::exists(['id' => $video_id, 'uid' => local_user()])) {
                        // delete the attachment
                        Attach::delete(['id' => $video_id, 'uid' => local_user()]);
 
@@ -164,19 +133,12 @@ function videos_content(App $a)
        //
        if ($a->argc > 3) {
                $datatype = $a->argv[2];
-               $datum = $a->argv[3];
        } elseif(($a->argc > 2) && ($a->argv[2] === 'upload')) {
                $datatype = 'upload';
        } else {
                $datatype = 'summary';
        }
 
-       if ($a->argc > 4) {
-               $cmd = $a->argv[4];
-       } else {
-               $cmd = 'view';
-       }
-
        //
        // Setup permissions structures
        //
@@ -188,7 +150,7 @@ function videos_content(App $a)
 
        $owner_uid = $a->data['user']['uid'];
 
-       $community_page = (($a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
+       $community_page = (($a->data['user']['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
 
        if ((local_user()) && (local_user() == $owner_uid)) {
                $can_post = true;
@@ -210,7 +172,6 @@ function videos_content(App $a)
 
                        if (DBA::isResult($r)) {
                                $can_post = true;
-                               $contact = $r[0];
                                $remote_contact = true;
                                $visitor = $contact_id;
                        }
@@ -240,17 +201,11 @@ function videos_content(App $a)
                        );
 
                        if (DBA::isResult($r)) {
-                               $contact = $r[0];
                                $remote_contact = true;
                        }
                }
        }
 
-       if (!$remote_contact && local_user()) {
-               $contact_id = $_SESSION['cid'];
-               $contact = $a->contact;
-       }
-
        if ($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (!$remote_contact)) {
                notice(L10n::t('Access to this item is restricted.') . EOL);
                return;
@@ -262,7 +217,7 @@ function videos_content(App $a)
 
        // tabs
        $_is_owner = (local_user() && (local_user() == $owner_uid));
-       $o .= Profile::getTabs($a, $_is_owner, $a->data['user']['nickname']);
+       $o .= Profile::getTabs($a, 'videos', $_is_owner, $a->data['user']['nickname']);
 
        //
        // dispatch request