]> git.mxchange.org Git - friendica.git/blobdiff - mod/videos.php
Update function calls
[friendica.git] / mod / videos.php
index 09b44151d889964ae10a8e39c32414ebbf8e1393..640c2a3b5592b165a163596e4e6ba31bad8a1881 100644 (file)
@@ -1,20 +1,27 @@
 <?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\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((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+       if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
        }
 
@@ -36,16 +43,16 @@ function videos_init(App $a) {
 
                $profile = get_profiledata_by_nick($nick, $a->profile_uid);
 
-               $account_type = account_type($profile);
+               $account_type = Contact::getAccountType($profile);
 
                $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', ''),
                ));
 
 
@@ -146,7 +153,7 @@ function videos_post(App $a) {
                        dbesc($video_id)
                );
 
-               if (dbm::is_result($r)) {
+               if (DBM::is_result($r)) {
                        q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
                                intval(local_user()),
                                dbesc($video_id)
@@ -156,7 +163,7 @@ function videos_post(App $a) {
                                intval(local_user())
                        );
                        //echo "<pre>"; var_dump($i); killme();
-                       if (dbm::is_result($i)) {
+                       if (DBM::is_result($i)) {
                                q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
                                        dbesc(datetime_convert()),
                                        dbesc(datetime_convert()),
@@ -170,7 +177,7 @@ function videos_post(App $a) {
                                $drop_id = intval($i[0]['id']);
 
                                if ($i[0]['visible']) {
-                                       proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
+                                       Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id);
                                }
                        }
                }
@@ -197,7 +204,7 @@ function videos_content(App $a) {
        // videos/name/video/xxxxx/edit
 
 
-       if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+       if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
                notice( t('Public access denied.') . EOL);
                return;
        }
@@ -266,7 +273,7 @@ function videos_content(App $a) {
                                        intval($contact_id),
                                        intval($owner_uid)
                                );
-                               if (dbm::is_result($r)) {
+                               if (DBM::is_result($r)) {
                                        $can_post = true;
                                        $contact = $r[0];
                                        $remote_contact = true;
@@ -276,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'])) {
@@ -289,12 +297,12 @@ 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)
                        );
-                       if (dbm::is_result($r)) {
+                       if (DBM::is_result($r)) {
                                $contact = $r[0];
                                $remote_contact = true;
                        }
@@ -313,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 = "";
 
@@ -354,7 +362,7 @@ function videos_content(App $a) {
                $sql_extra GROUP BY hash",
                intval($a->data['user']['uid'])
        );
-       if (dbm::is_result($r)) {
+       if (DBM::is_result($r)) {
                $a->set_pager_total(count($r));
                $a->set_pager_itemspage(20);
        }
@@ -372,16 +380,10 @@ function videos_content(App $a) {
 
 
        $videos = array();
-       if (dbm::is_result($r)) {
+       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'],