]> git.mxchange.org Git - friendica.git/blob - view/theme/diabook/theme.php
diabook-theme: can now set the twitter search term in theme-settings & small fixes
[friendica.git] / view / theme / diabook / theme.php
1 <?php
2
3 /*
4  * Name: Diabook
5  * Description: Diabook: report bugs and request here: http://pad.toktan.org/p/diabook or contact me : thomas_bierey@friendica.eu
6  * Version: (Version: 1.025)
7  * Author: 
8  */
9
10 $a = get_app();
11 $a->theme_info = array(
12     'family' => 'diabook',
13         'version' => '1.025'
14 );
15
16 function diabook_init(&$a) {
17         
18 //print diabook-version for debugging
19 $diabook_version = "Diabook (Version: 1.025)";
20 $a->page['htmlhead'] .= sprintf('<script "%s" ></script>', $diabook_version);
21
22 //change css on network and profilepages
23 $cssFile = null;
24
25 $resolution=false;
26 $resolution = get_pconfig(local_user(), "diabook", "resolution");
27 if ($resolution===false) $resolution="normal";
28
29 //Add META viewport tag respecting the resolution to header for tablets
30 if ($resolution=="wide") {
31   $a->page['htmlhead'] .= '<meta name="viewport" content="width=1200" />';
32 } else {
33   $a->page['htmlhead'] .= '<meta name="viewport" content="width=980" />';
34 }
35
36
37 $color = false;
38 $site_color = get_config("diabook", "color" );
39 if (local_user()) {$color = get_pconfig(local_user(), "diabook", "color");}
40 if ($color===false) $color=$site_color;
41 if ($color===false) $color="diabook";
42
43 if ($color=="diabook") $color_path = "/";
44 if ($color=="aerith") $color_path = "/diabook-aerith/";
45 if ($color=="blue") $color_path = "/diabook-blue/";
46 if ($color=="red") $color_path = "/diabook-red/";
47 if ($color=="pink") $color_path = "/diabook-pink/";
48 if ($color=="green") $color_path = "/diabook-green/";
49 if ($color=="dark") $color_path = "/diabook-dark/";
50
51         
52         //profile_side at networkpages
53         if ($a->argv[0] === "network" && local_user()){
54
55         // USER MENU
56         if(local_user()) {
57                 
58                 $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
59                                 
60                 $userinfo = array(
61                                         'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
62                                         'name' => $a->user['username'],
63                                 );      
64                 $ps = array('usermenu'=>array());
65                 $ps['usermenu']['status'] = Array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
66                 $ps['usermenu']['profile'] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
67                 $ps['usermenu']['contacts'] = Array('contacts' , t('Contacts'), "", t('Your contacts'));                                
68                 $ps['usermenu']['photos'] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
69                 $ps['usermenu']['events'] = Array('events/', t('Events'), "", t('Your events'));
70                 $ps['usermenu']['notes'] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
71                 $ps['usermenu']['community'] = Array('community/', t('Community'), "", "");
72                 $ps['usermenu']['pgroups'] = Array('http://dir.friendica.com/directory/forum', t('Community Pages'), "", "");
73
74                 $tpl = get_markup_template('profile_side.tpl');
75
76                 $a->page['aside'] = replace_macros($tpl, array(
77                                 '$userinfo' => $userinfo,
78                                 '$ps' => $ps,
79                         )).$a->page['aside'];
80
81         }
82         
83         $ccCookie = $_COOKIE['close_pages'] + $_COOKIE['close_mapquery'] + $_COOKIE['close_profiles'] + $_COOKIE['close_helpers'] + $_COOKIE['close_services'] + $_COOKIE['close_friends'] + $_COOKIE['close_twitter'] + $_COOKIE['close_lastusers'] + $_COOKIE['close_lastphotos'] + $_COOKIE['close_lastlikes'];
84         
85         if($ccCookie != "10") {
86         // COMMUNITY
87         diabook_community_info();
88
89         // CUSTOM CSS
90         if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network.css";}
91         if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network-wide.css";}
92         }
93         }
94
95
96
97         //right_aside at profile pages
98         if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname']){
99         if($ccCookie != "10") {
100         // COMMUNITY
101         diabook_community_info();
102         
103         // CUSTOM CSS
104         if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile.css";}
105         if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile-wide.css";}
106         
107         }
108         }
109         
110         //js scripts
111         //load jquery.cookie.js
112         $cookieJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.cookie.js";
113         $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s"></script>', $cookieJS);
114         
115         //load jquery.ae.image.resize.js
116         $imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.ae.image.resize.js";
117         $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
118         
119         //load jquery.ui.js
120         if($ccCookie != "9") {
121         $jqueryuiJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery-ui-1.8.20.custom.min.js";
122         $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $jqueryuiJS);
123         }       
124         
125         //load jquery.twitter.search.js
126         if($_COOKIE['close_twitter'] != "1") {
127         $twitterJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.twitter.search.js";
128         $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $twitterJS);
129         }
130         
131         //load jquery.mapquery.js
132         $_COOKIE['close_mapquery'] = "1";
133         if($_COOKIE['close_mapquery'] != "1") {
134         $mapqueryJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.core.js";
135         $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mapqueryJS);
136         $openlayersJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/OpenLayers.js";
137         $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $openlayersJS);
138         $qlayersJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.mqLayerControl.js";
139         $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqlayersJS);
140         
141         }
142         
143         $a->page['htmlhead'] .= '
144         <script>
145         
146          $(function() {
147                 $("a.lightbox").fancybox(); // Select all links with lightbox class
148                 $("div.lightbox").fancybox(); 
149                 });
150            
151          $(window).load(function() {
152                 var footer_top = $(document).height() - 30;
153                 $("div#footerbox").attr("style", "border-top: 1px solid #D2D2D2; width: 70%;right: 15%;position: absolute;top:"+footer_top+"px;");
154          });
155         </script>';
156         //check if mapquerybox is active and print
157         $_COOKIE['close_mapquery'] = "1";
158         if($_COOKIE['close_mapquery'] != "1") {
159                 $a->page['htmlhead'] .= '
160                 <script>
161                 
162     $(document).ready(function() {
163     $("#map").mapQuery({
164         layers:[{         //add layers to your map; you need to define at least one to be able to see anything on the map
165             type:"osm"  //add a layer of the type osm (OpenStreetMap)
166             }]
167         });
168      $("#map2").mapQuery({
169      layers:[{         //add layers to your map; you need to define at least one to be able to see anything on the map
170          type:"osm"  //add a layer of the type osm (OpenStreetMap)
171          }]
172      });  
173     
174     });
175                 
176                 </script>';
177         }
178         //check if twitterbox is active and print
179         if($_COOKIE['close_twitter'] != "1") {
180                 $TSearchTerm=false;
181                 $site_TSearchTerm = get_config("diabook", "TSearchTerm" );
182                 $TSearchTerm = get_pconfig(local_user(), "diabook", "TSearchTerm");
183                 if ($TSearchTerm===false) $TSearchTerm=$site_TSearchTerm;
184                 if ($TSearchTerm===false) $TSearchTerm="friendica";             
185                 $a->page['htmlhead'] .= '
186                 <script>
187                 $(function() {
188                 $("#twitter").twitterSearch({               
189                 term: "'.$TSearchTerm.'",
190                 animInSpeed: 250,
191                 bird:    false, 
192                 avatar:  false, 
193                 colorExterior: "#fff",
194                 title: "Last Tweets",
195                 timeout: 10000          });
196                 });
197                 </script>';}
198                         
199         //check if community_home-plugin is activated and change css
200         $nametocheck = "communityhome";
201         $r = q("select id from addon where name = '%s' and installed = 1", dbesc($nametocheck));
202         if(count($r) == "1") {
203         
204         $a->page['htmlhead'] .= '
205         <script>
206         $(document).ready(function() {
207         $("div#login-submit-wrapper").attr("style","padding-top: 120px;");
208         });
209         </script>';     
210         }
211         //comment-edit-wrapper on photo_view
212         if ($a->argv[0].$a->argv[2] === "photos"."image"){
213         $a->page['htmlhead'] .= '
214         <script>
215                 $(function(){
216                 $(".comment-edit-form").css("display","table");
217                         });
218     </script>';
219         }
220         //restore right hand col at settingspage
221         if($a->argv[0] === "settings" && local_user()) {
222         $a->page['htmlhead'] .= ' 
223         <script>
224         function restore_boxes(){
225         $.cookie("close_pages","2", { expires: 365, path: "/" });
226         $.cookie("close_mapquery","2", { expires: 365, path: "/" });
227         $.cookie("close_helpers","2", { expires: 365, path: "/" });
228         $.cookie("close_profiles","2", { expires: 365, path: "/" });
229         $.cookie("close_services","2", { expires: 365, path: "/" });
230         $.cookie("close_friends","2", { expires: 365, path: "/" });
231         $.cookie("close_twitter","2", { expires: 365, path: "/" });
232         $.cookie("close_lastusers","2", { expires: 365, path: "/" });
233         $.cookie("close_lastphotos","2", { expires: 365, path: "/" });
234         $.cookie("close_lastlikes","2", { expires: 365, path: "/" });
235         $.cookie("Boxorder",null, { expires: 365, path: "/" });
236         alert("Right-hand column was restored. Please refresh your browser");
237    }
238         </script>';}
239         
240         if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()){
241         $a->page['htmlhead'] .= '
242         <script>
243
244         $(function() {
245         $(".oembed.photo img").aeImageResize({height: 400, width: 400});
246         });
247         </script>';
248         
249         if($ccCookie != "9") {
250         $a->page['htmlhead'] .= '
251         <script>
252         $("right_aside").ready(function(){
253         
254         if($.cookie("close_pages") == "1") 
255                 {
256                 document.getElementById( "close_pages" ).style.display = "none";
257                         };
258                         
259         if($.cookie("close_mapquery") == "1") 
260                 {
261                 document.getElementById( "close_mapquery" ).style.display = "none";
262                         };
263                         
264         if($.cookie("close_profiles") == "1") 
265                 {
266                 document.getElementById( "close_profiles" ).style.display = "none";
267                         };
268         
269         if($.cookie("close_helpers") == "1") 
270                 {
271                 document.getElementById( "close_helpers" ).style.display = "none";
272                         };
273                         
274         if($.cookie("close_services") == "1") 
275                 {
276                 document.getElementById( "close_services" ).style.display = "none";
277                         };
278                         
279         if($.cookie("close_friends") == "1") 
280                 {
281                 document.getElementById( "close_friends" ).style.display = "none";
282                         };
283         
284         if($.cookie("close_twitter") == "1") 
285                 {
286                 document.getElementById( "twitter" ).style.display = "none";
287                         };      
288                         
289         if($.cookie("close_lastusers") == "1") 
290                 {
291                 document.getElementById( "close_lastusers" ).style.display = "none";
292                         };
293                         
294         if($.cookie("close_lastphotos") == "1") 
295                 {
296                 document.getElementById( "close_lastphotos" ).style.display = "none";
297                         };
298                         
299         if($.cookie("close_lastlikes") == "1") 
300                 {
301                 document.getElementById( "close_lastlikes" ).style.display = "none";
302                         };}
303
304         );
305
306         function close_pages(){
307          document.getElementById( "close_pages" ).style.display = "none";
308         $.cookie("close_pages","1", { expires: 365, path: "/" });
309         };
310         
311         function close_mapquery(){
312          document.getElementById( "close_mapquery" ).style.display = "none";
313         $.cookie("close_mapquery","1", { expires: 365, path: "/" });
314         };
315  
316         function close_profiles(){
317         document.getElementById( "close_profiles" ).style.display = "none";
318         $.cookie("close_profiles","1", { expires: 365, path: "/" });
319         };
320  
321         function close_helpers(){
322         document.getElementById( "close_helpers" ).style.display = "none";
323         $.cookie("close_helpers","1", { expires: 365, path: "/" });
324         };
325
326         function close_services(){
327         document.getElementById( "close_services" ).style.display = "none";
328         $.cookie("close_services","1", { expires: 365, path: "/" });
329         };
330  
331         function close_friends(){
332          document.getElementById( "close_friends" ).style.display = "none";
333          $.cookie("close_friends","1", { expires: 365, path: "/" });
334          };
335  
336         function close_twitter(){
337         document.getElementById( "twitter" ).style.display = "none";
338          $.cookie("close_twitter","1", { expires: 365, path: "/" });
339         };
340  
341         function close_lastusers(){
342          document.getElementById( "close_lastusers" ).style.display = "none";
343         $.cookie("close_lastusers","1", { expires: 365, path: "/" });
344          };
345
346         function close_lastphotos(){
347         document.getElementById( "close_lastphotos" ).style.display = "none";
348          $.cookie("close_lastphotos","1", { expires: 365, path: "/" });
349          };
350  
351         function close_lastlikes(){
352          document.getElementById( "close_lastlikes" ).style.display = "none";
353          $.cookie("close_lastlikes","1", { expires: 365, path: "/" });
354          };
355         </script>';}
356         }
357         //end js scripts
358
359         // custom css
360         if (!is_null($cssFile)) $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
361
362         //footer
363         $tpl = get_markup_template('footer.tpl');
364         $a->page['footer'] .= replace_macros($tpl, array());
365         
366         //
367         js_in_foot();
368 }
369
370
371  function diabook_community_info() {
372         $a = get_app();
373         // comunity_profiles
374         if($_COOKIE['close_profiles'] != "1") {
375         $aside['$comunity_profilest_title'] = t('Community Profiles');
376         $aside['$comunity_profiles_items'] = array();
377         $r = q("select gcontact.* from gcontact left join glink on glink.gcid = gcontact.id 
378                           where glink.cid = 0 and glink.uid = 0 order by rand() limit 9");
379         $tpl = file_get_contents( dirname(__file__).'/ch_directory_item.tpl');
380         if(count($r)) {
381                 $photo = 'photo';
382                 foreach($r as $rr) {
383                         $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
384                         $entry = replace_macros($tpl,array(
385                                 '$id' => $rr['id'],
386                                 '$profile-link' => zrl($rr['url']),
387                                 '$photo' => $rr[$photo],
388                                 '$alt-text' => $rr['name'],
389                         ));
390                         $aside['$comunity_profiles_items'][] = $entry;
391                 }
392         }}
393         
394         // last 12 users
395         if($_COOKIE['close_lastusers'] != "1") {
396         $aside['$lastusers_title'] = t('Last users');
397         $aside['$lastusers_items'] = array();
398         $sql_extra = "";
399         $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
400         $order = " ORDER BY `register_date` DESC ";
401
402         $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
403                         FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` 
404                         WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
405                 0,
406                 9
407         );
408         $tpl = file_get_contents( dirname(__file__).'/ch_directory_item.tpl');
409         if(count($r)) {
410                 $photo = 'thumb';
411                 foreach($r as $rr) {
412                         $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
413                         $entry = replace_macros($tpl,array(
414                                 '$id' => $rr['id'],
415                                 '$profile-link' => $profile_link,
416                                 '$photo' => $rr[$photo],
417                                 '$alt-text' => $rr['name'],
418                         ));
419                         $aside['$lastusers_items'][] = $entry;
420                 }
421         }}
422         
423         // last 10 liked items
424         if($_COOKIE['close_lastlikes'] != "1") {
425         $aside['$like_title'] = t('Last likes');
426         $aside['$like_items'] = array();
427         $r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM 
428                         (SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link` 
429                                 FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
430                         INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri` 
431                         WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
432                         GROUP BY `uri`
433                         ORDER BY `T1`.`created` DESC
434                         LIMIT 0,5",
435                         $a->get_baseurl(),$a->get_baseurl()
436                         );
437
438         foreach ($r as $rr) {
439                 $author  = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
440                 $objauthor =  '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
441                 
442                 //var_dump($rr['verb'],$rr['object-type']); killme();
443                 switch($rr['verb']){
444                         case 'http://activitystrea.ms/schema/1.0/post':
445                                 switch ($rr['object-type']){
446                                         case 'http://activitystrea.ms/schema/1.0/event':
447                                                 $post_type = t('event');
448                                                 break;
449                                         default:
450                                                 $post_type = t('status');
451                                 }
452                                 break;
453                         default:
454                                 if ($rr['resource-id']){
455                                         $post_type = t('photo');
456                                         $m=array();     preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
457                                         $rr['plink'] = $m[1];
458                                 } else {
459                                         $post_type = t('status');
460                                 }
461                 }
462                 $plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
463
464                 $aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
465                 
466         }}
467         
468         // last 12 photos
469         if($_COOKIE['close_photos'] != "1") {
470         $aside['$photos_title'] = t('Last photos');
471         $aside['$photos_items'] = array();
472         $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM 
473                                 (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo` 
474                                         WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
475                                                 AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
476                                 INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
477                                 `user` 
478                                 WHERE `user`.`uid` = `photo`.`uid`
479                                 AND `user`.`blockwall`=0
480                                 AND `user`.`hidewall`=0
481                                 ORDER BY `photo`.`edited` DESC
482                                 LIMIT 0, 9",
483                                 dbesc(t('Contact Photos')),
484                                 dbesc(t('Profile Photos'))
485                                 );
486                 if(count($r)) {
487                 $tpl = file_get_contents( dirname(__file__).'/ch_directory_item.tpl');
488                 foreach($r as $rr) {
489                         $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
490                         $photo_url = $a->get_baseurl() . '/photo/' .  $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
491                 
492                         $entry = replace_macros($tpl,array(
493                                 '$id' => $rr['id'],
494                                 '$profile-link' => $photo_page,
495                                 '$photo' => $photo_url,
496                                 '$alt-text' => $rr['username']." : ".$rr['desc'],
497                         ));
498
499                         $aside['$photos_items'][] = $entry;
500                 }
501         }}
502         
503    //right_aside FIND FRIENDS
504    if($_COOKIE['close_friends'] != "1") {
505         if(local_user()) {
506         $nv = array();
507         $nv['title'] = Array("", t('Find Friends'), "", "");
508         $nv['directory'] = Array('directory', t('Local Directory'), "", "");
509         $nv['global_directory'] = Array('http://dir.friendica.com/', t('Global Directory'), "", "");
510         $nv['match'] = Array('match', t('Similar Interests'), "", "");
511         $nv['suggest'] = Array('suggest', t('Friend Suggestions'), "", "");
512         $nv['invite'] = Array('invite', t('Invite Friends'), "", "");
513         
514         $nv['search'] = '<form name="simple_bar" method="get" action="http://dir.friendika.com/directory">
515                                                 <span class="sbox_l"></span>
516                                                 <span class="sbox">
517                                                 <input type="text" name="search" size="13" maxlength="50">
518                                                 </span>
519                                                 <span class="sbox_r" id="srch_clear"></span>';
520         
521         $aside['$nv'] = $nv;
522         }}
523    
524    //Community_Pages at right_aside
525    if($_COOKIE['close_pages'] != "1") {
526    if(local_user()) {
527    $page = '
528                         <h3 style="margin-top:0px;">'.t("Community Pages").'<a id="close_pages_icon"  onClick="close_pages()" class="icon close_box" title="close"></a></h3></div>
529                         <div id=""><ul style="margin-left: 7px;margin-top: 0px;padding-left: 0px;padding-top: 0px;">';
530
531         $pagelist = array();
532
533         $contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
534                         WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
535                         ORDER BY `name` ASC",
536                         intval($a->user['uid'])
537         );
538
539         $pageD = array();
540
541         // Look if the profile is a community page
542         foreach($contacts as $contact) {
543                 $pageD[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
544         };
545         
546
547         $contacts = $pageD;
548
549         foreach($contacts as $contact) {
550                 $page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" style="float: left; margin-right: 3px;" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" style="margin-top: 2px; word-wrap: break-word; width: 132px;" title="' . $contact['url'] . '" class="label" target="external-link">'.
551                                 $contact["name"]."</a></li>";
552         }
553         $page .= '</ul></div>';
554         //if (sizeof($contacts) > 0)
555                 $aside['$page'] = $page;        
556         }}
557   //END Community Page  
558   
559    //mapquery
560    $_COOKIE['close_mapquery'] = "1";
561   if($_COOKIE['close_mapquery'] != "1") {
562    $mapquery = array();
563         $mapquery['title'] = Array("", t('Earth View'), "", "");
564         $aside['$mapquery'] = $mapquery;
565         }
566    //end mapquery
567    
568   //helpers
569   if($_COOKIE['close_helpers'] != "1") {
570    $helpers = array();
571         $helpers['title'] = Array("", t('Help or @NewHere ?'), "", "");
572         $aside['$helpers'] = $helpers;
573         }
574    //end helpers
575    //connectable services
576    if($_COOKIE['close_services'] != "1") {
577    $con_services = array();
578         $con_services['title'] = Array("", t('Connect Services'), "", "");
579         $aside['$con_services'] = $con_services;
580         }
581    //end connectable services
582    $close = t('Close');
583    $aside['$close'] = $close;
584    //get_baseurl
585    $url = $a->get_baseurl($ssl_state);   
586    $aside['$url'] = $url;
587         //print right_aside
588         $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
589         $a->page['right_aside'] = replace_macros($tpl, $aside);
590         
591  }
592
593  function js_in_foot() {
594         /** @purpose insert stuff in bottom of page
595          */
596         $a = get_app();
597         $baseurl = $a->get_baseurl($ssl_state);
598         $bottom['$baseurl'] = $baseurl;
599         $tpl = file_get_contents(dirname(__file__) . '/bottom.tpl');
600         $a->page['footer'] = $a->page['footer'].replace_macros($tpl, $bottom);
601  }
602