]> git.mxchange.org Git - friendica.git/blobdiff - mod/videos.php
More usage of dbm::is_result($r) instead of count($r):
[friendica.git] / mod / videos.php
index a7d48cb751200fc47dac47e1f75fa71733f535b6..6550428f95150b5157ada29b0d40fb6319372f5a 100644 (file)
@@ -21,23 +21,28 @@ function videos_init(&$a) {
 
        if($a->argc > 1) {
                $nick = $a->argv[1];
-               $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
+               $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
                        dbesc($nick)
                );
 
-               if(! count($r))
+               if(! count($user))
                        return;
 
-               $a->data['user'] = $r[0];
-               $a->profile_uid = $r[0]['uid'];
+               $a->data['user'] = $user[0];
+               $a->profile_uid = $user[0]['uid'];
 
-               $profilephoto = $a->get_cached_avatar_image($a->get_baseurl() . '/photo/profile/' . $a->data['user']['uid'] . '.jpg');
+               $profile = get_profiledata_by_nick($nick, $a->profile_uid);
+
+               $account_type = account_type($profile);
 
                $tpl = get_markup_template("vcard-widget.tpl");
 
-               $vcard_widget = replace_macros($tpl, array(
-                       '$name' => $a->data['user']['username'],
-                       '$photo' => $profilephoto
+               $vcard_widget .= replace_macros($tpl, array(
+                       '$name' => $profile['name'],
+                       '$photo' => $profile['photo'],
+                       '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""),
+                       '$account_type' => $account_type,
+                       '$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""),
                ));
 
 
@@ -53,7 +58,7 @@ function videos_init(&$a) {
                        $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
 
                        if($albums_visible) {
-                               $o .= '<div id="side-bar-photos-albums" class="widget">';
+                               $o .= '<div id="sidebar-photos-albums" class="widget">';
                                $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h3>';
 
                                $o .= '<ul>';
@@ -113,10 +118,10 @@ function videos_post(&$a) {
                        $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array(
                                '$method' => 'post',
                                '$message' => t('Do you really want to delete this video?'),
-                               '$extra_inputs' => [
-                                       ['name'=>'id', 'value'=> $_POST['id']],
-                                       ['name'=>'delete', 'value'=>'x']
-                               ],
+                               '$extra_inputs' => array(
+                                       array('name'=>'id', 'value'=> $_POST['id']),
+                                       array('name'=>'delete', 'value'=>'x')
+                               ),
                                '$confirm' => t('Delete Video'),
                                '$confirm_url' => $drop_url,
                                '$confirm_name' => 'confirm', // Needed so that confirmation will bring us back into this if statement
@@ -135,7 +140,7 @@ function videos_post(&$a) {
                        dbesc($video_id)
                );
 
-               if(count($r)) {
+               if(dbm::is_result($r)) {
                        q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
                                intval(local_user()),
                                dbesc($video_id)
@@ -159,7 +164,7 @@ function videos_post(&$a) {
                                $drop_id = intval($i[0]['id']);
 
                                if($i[0]['visible'])
-                                       proc_run('php',"include/notifier.php","drop","$drop_id");
+                                       proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
                        }
                }
 
@@ -254,11 +259,11 @@ function videos_content(&$a) {
                                        intval($contact_id),
                                        intval($owner_uid)
                                );
-                               if(count($r)) {
+                               if(dbm::is_result($r)) {
                                        $can_post = true;
                                        $contact = $r[0];
                                        $remote_contact = true;
-                                       $visitor = $cid;
+                                       $visitor = $contact_id;
                                }
                        }
                }
@@ -282,7 +287,7 @@ function videos_content(&$a) {
                                intval($contact_id),
                                intval($owner_uid)
                        );
-                       if(count($r)) {
+                       if(dbm::is_result($r)) {
                                $contact = $r[0];
                                $remote_contact = true;
                        }
@@ -342,7 +347,7 @@ function videos_content(&$a) {
                $sql_extra GROUP BY hash",
                intval($a->data['user']['uid'])
        );
-       if(count($r)) {
+       if(dbm::is_result($r)) {
                $a->set_pager_total(count($r));
                $a->set_pager_itemspage(20);
        }
@@ -358,7 +363,7 @@ function videos_content(&$a) {
 
 
        $videos = array();
-       if(count($r)) {
+       if(dbm::is_result($r)) {
                foreach($r as $rr) {
                        if($a->theme['template_engine'] === 'internal') {
                                $alt_e = template_escape($rr['filename']);