]> git.mxchange.org Git - friendica.git/blobdiff - mod/videos.php
Update function calls
[friendica.git] / mod / videos.php
index 9f02441020b1aacd438b69805fc655e1dd89c883..640c2a3b5592b165a163596e4e6ba31bad8a1881 100644 (file)
@@ -1,22 +1,25 @@
 <?php
-
+/**
+ * @file mod/videos.php
+ */
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
-use Friendica\Object\Contact;
+use Friendica\Model\Contact;
+use Friendica\Model\Group;
+use Friendica\Protocol\DFRN;
 
-require_once('include/items.php');
-require_once('include/acl_selectors.php');
-require_once('include/bbcode.php');
-require_once('include/security.php');
-require_once('include/redir.php');
+require_once 'include/items.php';
+require_once 'include/acl_selectors.php';
+require_once 'include/bbcode.php';
+require_once 'include/security.php';
 
 function videos_init(App $a) {
 
        if($a->argc > 1)
-               auto_redir($a, $a->argv[1]);
+               DFRN::autoRedir($a, $a->argv[1]);
 
        if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
@@ -44,12 +47,12 @@ function videos_init(App $a) {
 
                $tpl = get_markup_template("vcard-widget.tpl");
 
-               $vcard_widget .= replace_macros($tpl, array(
+               $vcard_widget = replace_macros($tpl, array(
                        '$name' => $profile['name'],
                        '$photo' => $profile['photo'],
-                       '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""),
+                       '$addr' => defaults($profile, 'addr', ''),
                        '$account_type' => $account_type,
-                       '$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""),
+                       '$pdesc' => defaults($profile, 'pdesc', ''),
                ));
 
 
@@ -280,8 +283,9 @@ function videos_content(App $a) {
                }
        }
 
-       // perhaps they're visiting - but not a community page, so they wouldn't have write access
+       $groups = [];
 
+       // perhaps they're visiting - but not a community page, so they wouldn't have write access
        if(remote_user() && (! $visitor)) {
                $contact_id = 0;
                if(is_array($_SESSION['remote'])) {
@@ -293,7 +297,7 @@ function videos_content(App $a) {
                        }
                }
                if($contact_id) {
-                       $groups = init_groups_visitor($contact_id);
+                       $groups = Group::getIdsByContactId($contact_id);
                        $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1",
                                intval($contact_id),
                                intval($owner_uid)
@@ -317,7 +321,7 @@ function videos_content(App $a) {
                return;
        }
 
-       $sql_extra = permissions_sql($owner_uid,$remote_contact,$groups);
+       $sql_extra = permissions_sql($owner_uid, $remote_contact, $groups);
 
        $o = "";
 
@@ -378,14 +382,8 @@ function videos_content(App $a) {
        $videos = array();
        if (DBM::is_result($r)) {
                foreach ($r as $rr) {
-                       if ($a->theme['template_engine'] === 'internal') {
-                               $alt_e = template_escape($rr['filename']);
-                               $name_e = template_escape($rr['album']);
-                       }
-                       else {
-                               $alt_e = $rr['filename'];
-                               $name_e = $rr['album'];
-                       }
+                       $alt_e = $rr['filename'];
+                       $name_e = $rr['album'];
 
                        $videos[] = array(
                                'id'       => $rr['id'],