]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/vier/theme.php
Merge remote-tracking branch 'upstream/develop' into develop
[friendica.git] / view / theme / vier / theme.php
index a7f8ea99a303cb6651ba647dcc2f5405342042ae..925ac76a1fe2284b4798a34268ceb95e7189b314 100644 (file)
@@ -19,10 +19,6 @@ function vier_init(&$a) {
 
        set_template_engine($a, 'smarty3');
 
-       $baseurl = $a->get_baseurl();
-
-       $a->theme_info = array();
-
        if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()) {
                vier_community_info();
 
@@ -33,7 +29,8 @@ function vier_init(&$a) {
                $a->page['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n";
                $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen"/>'."\n";
        }
-               $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen and (max-width: 1000px)"/>'."\n";
+               // deactivated since it doesn't work with desktop browsers at the moment (To-Do)
+               //$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen and (max-width: 1000px)"/>'."\n";
 
 $a->page['htmlhead'] .= <<< EOT
 <link rel='stylesheet' type='text/css' href='view/theme/vier/narrow.css' media='screen and (max-width: 1100px)' />
@@ -159,7 +156,7 @@ function vier_community_info() {
                                $entry = replace_macros($tpl,array(
                                        '$id' => $rr['id'],
                                        //'$profile_link' => zrl($rr['url']),
-                                       '$profile_link' => $a->get_baseurl().'/follow/?url='.urlencode($rr['url']),
+                                       '$profile_link' => 'follow/?url='.urlencode($rr['url']),
                                        '$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_MICRO),
                                        '$alt_text' => $rr['name'],
                                ));
@@ -185,11 +182,11 @@ function vier_community_info() {
                        $aside['$lastusers_items'] = array();
 
                        foreach($r as $rr) {
-                               $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
+                               $profile_link = 'profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
                                $entry = replace_macros($tpl,array(
                                        '$id' => $rr['id'],
                                        '$profile_link' => $profile_link,
-                                       '$photo' => $a->get_cached_avatar_image($rr['thumb']),
+                                       '$photo' => $a->remove_baseurl($rr['thumb']),
                                        '$alt_text' => $rr['name']));
                                $aside['$lastusers_items'][] = $entry;
                        }
@@ -206,7 +203,7 @@ function vier_community_info() {
                $nv['suggest'] = Array('suggest', t('Friend Suggestions'), "", "");
                $nv['invite'] = Array('invite', t('Invite Friends'), "", "");
 
-               $nv['search'] = '<form name="simple_bar" method="get" action="'.$a->get_baseurl().'/dirfind">
+               $nv['search'] = '<form name="simple_bar" method="get" action="dirfind">
                                                <span class="sbox_l"></span>
                                                <span class="sbox">
                                                <input type="text" name="search" size="13" maxlength="50">
@@ -219,35 +216,50 @@ function vier_community_info() {
        //Community_Pages at right_aside
        if($show_pages AND local_user()) {
 
-               $pagelist = array();
+               require_once('include/ForumManager.php');
 
-               $contacts = q("SELECT `id`, `url`, `name`, `micro` FROM `contact`
-                               WHERE `network`= '%s' AND `uid` = %d AND (`forum` OR `prv`) AND
-                                       NOT `hidden` AND NOT `blocked` AND
-                                       NOT `archive` AND NOT `pending` AND
-                                       `success_update` > `failure_update`
-                               ORDER BY `name` ASC",
-                               dbesc(NETWORK_DFRN), intval($a->user['uid']));
+               if(x($_GET['cid']) && intval($_GET['cid']) != 0)
+                       $cid = $_GET['cid'];
 
-               $pageD = array();
+               //sort by last updated item
+               $lastitem = true;
 
-               // Look if the profile is a community page
-               foreach($contacts as $contact) {
-                       $pageD[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
-               };
+               $contacts = ForumManager::get_list($a->user['uid'],true,$lastitem, true);
+               $total = count($contacts);
+               $visible_forums = 10;
 
-               $contacts = $pageD;
+               if(count($contacts)) {
 
-               if ($contacts) {
-                       $page = '
-                               <h3>'.t("Community Pages").'</h3>
-                               <div id="forum-list-right">';
+                       $id = 0;
 
                        foreach($contacts as $contact) {
-                               $page .= '<div role="menuitem"><a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="'.t('External link to forum').'" class="label sparkle" target="_blank"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="'.t('External link to forum').'" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a></div>";
+
+                               $selected = (($cid == $contact['id']) ? ' forum-selected' : '');
+
+                               $entry = array(
+                                       'url' => 'network?f=&cid=' . $contact['id'],
+                                       'external_url' => 'redir/' . $contact['id'],
+                                       'name' => $contact['name'],
+                                       'cid' => $contact['id'],
+                                       'selected'      => $selected,
+                                       'micro' => App::remove_baseurl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)),
+                                       'id' => ++$id,
+                               );
+                               $entries[] = $entry;
                        }
 
-                       $page .= '</div>';
+
+                       $tpl = get_markup_template('widget_forumlist_right.tpl');
+
+                       $page .= replace_macros($tpl,array(
+                               '$title'        => t('Forums'),
+                               '$forums'       => $entries,
+                               '$link_desc'    => t('External link to forum'),
+                               '$total'        => $total,
+                               '$visible_forums' => $visible_forums,
+                               '$showmore'     => t('show more'),
+                       ));
+
                        $aside['$page'] = $page;
                }
        }
@@ -348,10 +360,10 @@ function vier_community_info() {
                        $r[] = array("photo" => "images/twitter.png", "name" => "Twitter");
 
                if (plugin_enabled("wppost"))
-                       $r[] = array("photo" => "images/wordpress", "name" => "Wordpress");
+                       $r[] = array("photo" => "images/wordpress.png", "name" => "Wordpress");
 
                if(function_exists("imap_open") AND !get_config("system","imap_disabled") AND !get_config("system","dfrn_only"))
-                       $r[] = array("photo" => "images/mail", "name" => "E-Mail");
+                       $r[] = array("photo" => "images/mail.png", "name" => "E-Mail");
 
                $tpl = get_markup_template('ch_connectors.tpl');