]> git.mxchange.org Git - friendica-addons.git/blobdiff - communityhome/communityhome.php
Merge pull request #88 from fermionic/20121222-support-smarty3-template-engine
[friendica-addons.git] / communityhome / communityhome.php
old mode 100644 (file)
new mode 100755 (executable)
index 8f0aa86..8b83188
@@ -35,7 +35,7 @@ function communityhome_home(&$a, &$o){
        $aside['$login_form'] = login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
        
        // last 12 users
-       $aside['$lastusers_title'] = t('Last users');
+       $aside['$lastusers_title'] = t('Latest users');
        $aside['$lastusers_items'] = array();
        $sql_extra = "";
        $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
@@ -47,7 +47,8 @@ function communityhome_home(&$a, &$o){
                0,
                12
        );
-       $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+#      $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+       $tpl = get_markup_template( 'directory_item.tpl', 'addon/communityhome/' );
        if(count($r)) {
                $photo = 'thumb';
                foreach($r as $rr) {
@@ -55,7 +56,7 @@ function communityhome_home(&$a, &$o){
                        $entry = replace_macros($tpl,array(
                                '$id' => $rr['id'],
                                '$profile-link' => $profile_link,
-                               '$photo' => $rr[$photo],
+                               '$photo' => $a->get_cached_avatar_image($rr[$photo]),
                                '$alt-text' => $rr['name'],
                        ));
                        $aside['$lastusers_items'][] = $entry;
@@ -95,7 +96,7 @@ function communityhome_home(&$a, &$o){
        }
        
        // last 12 photos
-       $aside['$photos_title'] = t('Last photos');
+       $aside['$photos_title'] = t('Latest photos');
        $aside['$photos_items'] = array();
        $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM 
                                (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo` 
@@ -105,6 +106,7 @@ function communityhome_home(&$a, &$o){
                                `user` 
                                WHERE `user`.`uid` = `photo`.`uid`
                                AND `user`.`blockwall`=0
+                               AND `user`.`hidewall` = 0
                                ORDER BY `photo`.`edited` DESC
                                LIMIT 0, 12",
                                dbesc(t('Contact Photos')),
@@ -113,7 +115,8 @@ function communityhome_home(&$a, &$o){
 
                
        if(count($r)) {
-               $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+#              $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+               $tpl = get_markup_template( 'directory_item.tpl', 'addon/communityhome/' );
                foreach($r as $rr) {
                        $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
                        $photo_url = $a->get_baseurl() . '/photo/' .  $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
@@ -130,7 +133,7 @@ function communityhome_home(&$a, &$o){
        }
        
        // last 10 liked items
-       $aside['$like_title'] = t('Last likes');
+       $aside['$like_title'] = t('Latest likes');
        $aside['$like_items'] = array();
        $r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM 
                        (SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link` 
@@ -173,7 +176,8 @@ function communityhome_home(&$a, &$o){
                
        }
        
-       $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
+#      $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
+       $tpl = get_markup_template('communityhome.tpl', 'addon/communityhome/');
        $a->page['aside'] = replace_macros($tpl, $aside);
        
        $o = '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';