]> git.mxchange.org Git - friendica.git/commitdiff
Merge develop into allfriends
authorrabuzarus <trebor@central-unit>
Mon, 2 Nov 2015 13:31:20 +0000 (14:31 +0100)
committerrabuzarus <trebor@central-unit>
Mon, 2 Nov 2015 13:31:20 +0000 (14:31 +0100)
mod/allfriends.php
mod/common.php
view/templates/common_friends.tpl [deleted file]

index 784dfb87711d6053386034d3482e2388dbc06e3e..bb1b7f1ce598fb717a883551e9d4ff5d74ff14fe 100644 (file)
@@ -12,10 +12,11 @@ function allfriends_content(&$a) {
 
        if($a->argc > 1)
                $cid = intval($a->argv[1]);
+
        if(! $cid)
                return;
 
-       $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
+       $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                intval($cid),
                intval(local_user())
        );
@@ -33,10 +34,6 @@ function allfriends_content(&$a) {
        if(! count($c))
                return;
 
-       $o .= replace_macros(get_markup_template("section_title.tpl"),array(
-               '$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name']))
-       ));
-
 
        $r = all_friends(local_user(),$cid);
 
@@ -45,19 +42,29 @@ function allfriends_content(&$a) {
                return $o;
        }
 
-       $tpl = get_markup_template('common_friends.tpl');
+       $id = 0;
 
        foreach($r as $rr) {
 
-               $o .= replace_macros($tpl,array(
-                       '$url' => $rr['url'],
-                       '$name' => htmlentities($rr['name']),
-                       '$photo' => $rr['photo'],
-                       '$tags' => ''
-               ));
+               $entry = array(
+                       'url' => $rr['url'],
+                       'itemurl' => $rr['url'],
+                       'name' => htmlentities($rr['name']),
+                       'thumb' => $rr['photo'],
+                       'img_hover' => htmlentities($rr['name']),
+                       'tags' => '',
+                       'id' => ++$id,
+               );
+               $entries[] = $entry;
        }
 
-       $o .= cleardiv();
+       $tpl = get_markup_template('viewcontact_template.tpl');
+
+       $o .= replace_macros($tpl,array(
+               '$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name'])),
+               '$contacts' => $entries,
+       ));
+
 //     $o .= paginate($a);
        return $o;
 }
index 1e65137ac693c74dcc125b1e9af213a70bcb2ac3..caf2f7ea5ea8b5fc03ccf316cade7a9ab120c77b 100644 (file)
@@ -17,13 +17,13 @@ function common_content(&$a) {
                return;
 
        if($cmd === 'loc' && $cid) {
-               $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
+               $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                        intval($cid),
                        intval($uid)
                );
        }
        else {
-               $c = q("select name, url, photo from contact where self = 1 and uid = %d limit 1",
+               $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                        intval($uid)
                );
        }
@@ -41,21 +41,16 @@ function common_content(&$a) {
        if(! count($c))
                return;
 
-       $o .= replace_macros(get_markup_template("section_title.tpl"),array(
-               '$title' => t('Common Friends')
-       ));
-
-
        if(! $cid) {
                if(get_my_url()) {
-                       $r = q("select id from contact where nurl = '%s' and uid = %d limit 1",
+                       $r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
                                dbesc(normalise_link(get_my_url())),
                                intval($profile_uid)
                        );
                        if(count($r))
                                $cid = $r[0]['id'];
                        else {
-                               $r = q("select id from gcontact where nurl = '%s' limit 1",
+                               $r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
                                        dbesc(normalise_link(get_my_url()))
                                );
                                if(count($r))
@@ -94,19 +89,29 @@ function common_content(&$a) {
                return $o;
        }
 
-       $tpl = get_markup_template('common_friends.tpl');
+       $id = 0;
 
        foreach($r as $rr) {
 
-               $o .= replace_macros($tpl,array(
-                       '$url' => $rr['url'],
-                       '$name' => htmlentities($rr['name']),
-                       '$photo' => $rr['photo'],
-                       '$tags' => ''
-               ));
+               $entry = array(
+                       'url' => $rr['url'],
+                       'itemurl' => $rr['url'],
+                       'name' => htmlentities($rr['name']),
+                       'thumb' => $rr['photo'],
+                       'img_hover' => htmlentities($rr['name']),
+                       'tags' => '',
+                       'id' => ++$id,
+               );
+               $entries[] = $entry;
        }
 
-       $o .= cleardiv();
+       $tpl = get_markup_template('viewcontact_template.tpl');
+
+       $o .= replace_macros($tpl,array(
+               '$title' => t('Common Friends'),
+               '$contacts' => $entries,
+       ));
+
 //     $o .= paginate($a);
        return $o;
 }
diff --git a/view/templates/common_friends.tpl b/view/templates/common_friends.tpl
deleted file mode 100644 (file)
index 6502dd6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-
-<div class="profile-match-wrapper">
-       <div class="profile-match-photo">
-               <a href="{{$url}}">
-                       <img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" />
-               </a>
-       </div>
-       <div class="profile-match-break"></div>
-       <div class="profile-match-name">
-               <a href="{{$url}}" title="{{$name}}[{{$tags}}]">{{$name}}</a>
-       </div>
-       <div class="profile-match-end"></div>
-</div>
\ No newline at end of file