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.026)
13 function diabook_init(&$a) {
15 //print diabook-version for debugging
16 $diabook_version = "Diabook (Version: 1.026)";
17 $a->page['htmlhead'] .= sprintf('<META NAME="theme" CONTENT="%s"/>', $diabook_version);
19 //change css on network and profilepages
23 $resolution = get_pconfig(local_user(), "diabook", "resolution");
24 if ($resolution===false) $resolution="normal";
26 //Add META viewport tag respecting the resolution to header for tablets
27 if ($resolution=="wide") {
28 $a->page['htmlhead'] .= '<meta name="viewport" content="width=1200" />';
30 $a->page['htmlhead'] .= '<meta name="viewport" content="width=980" />';
35 $site_color = get_config("diabook", "color" );
36 if (local_user()) {$color = get_pconfig(local_user(), "diabook", "color");}
37 if ($color===false) $color=$site_color;
38 if ($color===false) $color="diabook";
40 if ($color=="diabook") $color_path = "/";
41 if ($color=="aerith") $color_path = "/diabook-aerith/";
42 if ($color=="blue") $color_path = "/diabook-blue/";
43 if ($color=="red") $color_path = "/diabook-red/";
44 if ($color=="pink") $color_path = "/diabook-pink/";
45 if ($color=="green") $color_path = "/diabook-green/";
46 if ($color=="dark") $color_path = "/diabook-dark/";
49 //profile_side at networkpages
50 if ($a->argv[0] === "network" && local_user()){
55 $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
58 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
59 'name' => $a->user['username'],
61 $ps = array('usermenu'=>array());
62 $ps['usermenu']['status'] = Array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
63 $ps['usermenu']['profile'] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
64 $ps['usermenu']['contacts'] = Array('contacts' , t('Contacts'), "", t('Your contacts'));
65 $ps['usermenu']['photos'] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
66 $ps['usermenu']['events'] = Array('events/', t('Events'), "", t('Your events'));
67 $ps['usermenu']['notes'] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
68 $ps['usermenu']['community'] = Array('community/', t('Community'), "", "");
69 $ps['usermenu']['pgroups'] = Array('http://dir.friendica.com/directory/forum', t('Community Pages'), "", "");
71 $tpl = get_markup_template('profile_side.tpl');
73 $a->page['aside'] = replace_macros($tpl, array(
74 '$userinfo' => $userinfo,
80 $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'];
82 if($ccCookie != "10") {
84 diabook_community_info();
87 if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network.css";}
88 if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network-wide.css";}
94 //right_aside at profile pages
95 if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname']){
96 if($ccCookie != "10") {
98 diabook_community_info();
101 if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile.css";}
102 if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile-wide.css";}
108 //load jquery.cookie.js
109 $cookieJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.cookie.js";
110 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s"></script>', $cookieJS);
112 //load jquery.ae.image.resize.js
113 $imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.ae.image.resize.js";
114 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
117 if($ccCookie != "10") {
118 $jqueryuiJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery-ui-1.8.20.custom.min.js";
119 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $jqueryuiJS);
122 //load jquery.twitter.search.js
123 if($_COOKIE['close_twitter'] != "1") {
124 $twitterJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.twitter.search.js";
125 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $twitterJS);
128 //load jquery.mapquery.js
130 if($_COOKIE['close_mapquery'] != "1") {
131 $mqtmplJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.tmpl.js";
132 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqtmplJS);
133 $mapqueryJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.core.js";
134 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mapqueryJS);
135 $openlayersJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/OpenLayers.js";
136 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $openlayersJS);
137 $mqmouseposJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mapquery.mqMousePosition.js";
138 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mqmouseposJS);
139 $mousewheelJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.mousewheel.js";
140 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $mousewheelJS);
144 $a->page['htmlhead'] .= '
148 $("a.lightbox").fancybox(); // Select all links with lightbox class
149 $("a.#twittersettings-link").fancybox({onClosed: function() { $("#twittersettings").attr("style","display: none;");}} );
150 $("a.#mapcontrol-link").fancybox({onClosed: function() { $("#mapcontrol").attr("style","display: none;");}} );
153 $(window).load(function() {
154 var footer_top = $(document).height() - 30;
155 $("div#footerbox").attr("style", "border-top: 1px solid #D2D2D2; width: 70%;right: 15%;position: absolute;top:"+footer_top+"px;");
158 //check if mapquerybox is active and print
160 if($_COOKIE['close_mapquery'] != "1") {
164 $site_ELZoom = get_config("diabook", "ELZoom" );
165 $site_ELPosX = get_config("diabook", "ELPosX" );
166 $site_ELPosY = get_config("diabook", "ELPosY" );
167 $ELZoom = get_pconfig(local_user(), "diabook", "ELZoom");
168 $ELPosX = get_pconfig(local_user(), "diabook", "ELPosX");
169 $ELPosY = get_pconfig(local_user(), "diabook", "ELPosY");
170 if ($ELZoom===false) $ELZoom=$site_ELZoom;
171 if ($ELPosX===false) $ELPosX=$site_ELPosX;
172 if ($ELPosY===false) $ELPosY=$site_ELPosY;
173 if ($ELZoom===false) $ELZoom="0";
174 if ($ELPosX===false) $ELPosX="0";
175 if ($ELPosY===false) $ELPosY="0";
176 $a->page['htmlhead'] .= '
179 $(document).ready(function() {
181 layers:[{ //add layers to your map; you need to define at least one to be able to see anything on the map
182 type:"osm" //add a layer of the type osm (OpenStreetMap)
184 center:({zoom:'.$ELZoom.',position:['.$ELPosX.','.$ELPosY.']}),
189 function open_mapcontrol() {
190 $("div#mapcontrol").attr("style","display: block;width:900px;height:600px;");
191 $("#map2").mapQuery({layers:[{type:"osm"}],
192 center:({zoom:'.$ELZoom.',position:['.$ELPosX.','.$ELPosY.']})});
194 $("#mouseposition").mqMousePosition({
202 map = $("#map2").mapQuery().data("mapQuery");
203 textarea = document.getElementById("mapzoom");
206 $("#map2").bind("mousewheel", function(event, delta) {
207 if (delta > 0 || delta < 0){
208 textarea.value = map.center().zoom; }
214 //check if twitterbox is active and print
215 if($_COOKIE['close_twitter'] != "1") {
217 $site_TSearchTerm = get_config("diabook", "TSearchTerm" );
218 $TSearchTerm = get_pconfig(local_user(), "diabook", "TSearchTerm");
219 if ($TSearchTerm===false) $TSearchTerm=$site_TSearchTerm;
220 if ($TSearchTerm===false) $TSearchTerm="friendica";
221 $a->page['htmlhead'] .= '
224 $("#twitter").twitterSearch({
225 term: "'.$TSearchTerm.'",
229 colorExterior: "#fff",
232 function open_twittersettings() {
233 $("div#twittersettings").attr("style","display: block;");
237 //check if community_home-plugin is activated and change css
238 $nametocheck = "communityhome";
239 $r = q("select id from addon where name = '%s' and installed = 1", dbesc($nametocheck));
240 if(count($r) == "1") {
242 $a->page['htmlhead'] .= '
244 $(document).ready(function() {
245 $("div#login-submit-wrapper").attr("style","padding-top: 120px;");
250 //comment-edit-wrapper on photo_view
251 if ($a->argv[0].$a->argv[2] === "photos"."image"){
252 $a->page['htmlhead'] .= '
255 $(".comment-edit-form").css("display","table");
259 //restore right hand col at settingspage
260 if($a->argv[0] === "settings" && local_user()) {
261 $a->page['htmlhead'] .= '
263 function restore_boxes(){
264 $.cookie("close_pages","2", { expires: 365, path: "/" });
265 $.cookie("close_mapquery","2", { expires: 365, path: "/" });
266 $.cookie("close_helpers","2", { expires: 365, path: "/" });
267 $.cookie("close_profiles","2", { expires: 365, path: "/" });
268 $.cookie("close_services","2", { expires: 365, path: "/" });
269 $.cookie("close_friends","2", { expires: 365, path: "/" });
270 $.cookie("close_twitter","2", { expires: 365, path: "/" });
271 $.cookie("close_lastusers","2", { expires: 365, path: "/" });
272 $.cookie("close_lastphotos","2", { expires: 365, path: "/" });
273 $.cookie("close_lastlikes","2", { expires: 365, path: "/" });
274 $.cookie("Boxorder",null, { expires: 365, path: "/" });
275 alert("Right-hand column was restored. Please refresh your browser");
279 if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()){
280 $a->page['htmlhead'] .= '
284 $(".oembed.photo img").aeImageResize({height: 400, width: 400});
288 if($ccCookie != "10") {
289 $a->page['htmlhead'] .= '
291 $("right_aside").ready(function(){
293 if($.cookie("close_pages") == "1")
295 document.getElementById( "close_pages" ).style.display = "none";
298 if($.cookie("close_mapquery") == "1")
300 document.getElementById( "close_mapquery" ).style.display = "none";
303 if($.cookie("close_profiles") == "1")
305 document.getElementById( "close_profiles" ).style.display = "none";
308 if($.cookie("close_helpers") == "1")
310 document.getElementById( "close_helpers" ).style.display = "none";
313 if($.cookie("close_services") == "1")
315 document.getElementById( "close_services" ).style.display = "none";
318 if($.cookie("close_friends") == "1")
320 document.getElementById( "close_friends" ).style.display = "none";
323 if($.cookie("close_twitter") == "1")
325 document.getElementById( "close_twitter" ).style.display = "none";
328 if($.cookie("close_lastusers") == "1")
330 document.getElementById( "close_lastusers" ).style.display = "none";
333 if($.cookie("close_lastphotos") == "1")
335 document.getElementById( "close_lastphotos" ).style.display = "none";
338 if($.cookie("close_lastlikes") == "1")
340 document.getElementById( "close_lastlikes" ).style.display = "none";
345 function close_pages(){
346 document.getElementById( "close_pages" ).style.display = "none";
347 $.cookie("close_pages","1", { expires: 365, path: "/" });
350 function close_mapquery(){
351 document.getElementById( "close_mapquery" ).style.display = "none";
352 $.cookie("close_mapquery","1", { expires: 365, path: "/" });
355 function close_profiles(){
356 document.getElementById( "close_profiles" ).style.display = "none";
357 $.cookie("close_profiles","1", { expires: 365, path: "/" });
360 function close_helpers(){
361 document.getElementById( "close_helpers" ).style.display = "none";
362 $.cookie("close_helpers","1", { expires: 365, path: "/" });
365 function close_services(){
366 document.getElementById( "close_services" ).style.display = "none";
367 $.cookie("close_services","1", { expires: 365, path: "/" });
370 function close_friends(){
371 document.getElementById( "close_friends" ).style.display = "none";
372 $.cookie("close_friends","1", { expires: 365, path: "/" });
375 function close_twitter(){
376 document.getElementById( "close_twitter" ).style.display = "none";
377 $.cookie("close_twitter","1", { expires: 365, path: "/" });
380 function close_lastusers(){
381 document.getElementById( "close_lastusers" ).style.display = "none";
382 $.cookie("close_lastusers","1", { expires: 365, path: "/" });
385 function close_lastphotos(){
386 document.getElementById( "close_lastphotos" ).style.display = "none";
387 $.cookie("close_lastphotos","1", { expires: 365, path: "/" });
390 function close_lastlikes(){
391 document.getElementById( "close_lastlikes" ).style.display = "none";
392 $.cookie("close_lastlikes","1", { expires: 365, path: "/" });
399 if (!is_null($cssFile)) $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
402 $tpl = get_markup_template('footer.tpl');
403 $a->page['footer'] .= replace_macros($tpl, array());
410 function diabook_community_info() {
413 if($_COOKIE['close_profiles'] != "1") {
414 $aside['$comunity_profiles_title'] = t('Community Profiles');
415 $aside['$comunity_profiles_items'] = array();
416 $r = q("select gcontact.* from gcontact left join glink on glink.gcid = gcontact.id
417 where glink.cid = 0 and glink.uid = 0 order by rand() limit 9");
418 $tpl = file_get_contents( dirname(__file__).'/ch_directory_item.tpl');
422 $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
423 $entry = replace_macros($tpl,array(
425 '$profile-link' => zrl($rr['url']),
426 '$photo' => $rr[$photo],
427 '$alt-text' => $rr['name'],
429 $aside['$comunity_profiles_items'][] = $entry;
434 if($_COOKIE['close_lastusers'] != "1") {
435 $aside['$lastusers_title'] = t('Last users');
436 $aside['$lastusers_items'] = array();
438 $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
439 $order = " ORDER BY `register_date` DESC ";
441 $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
442 FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
443 WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
447 $tpl = file_get_contents( dirname(__file__).'/ch_directory_item.tpl');
451 $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
452 $entry = replace_macros($tpl,array(
454 '$profile-link' => $profile_link,
455 '$photo' => $rr[$photo],
456 '$alt-text' => $rr['name'],
458 $aside['$lastusers_items'][] = $entry;
462 // last 10 liked items
463 if($_COOKIE['close_lastlikes'] != "1") {
464 $aside['$like_title'] = t('Last likes');
465 $aside['$like_items'] = array();
466 $r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
467 (SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
468 FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
469 INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri`
470 WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
472 ORDER BY `T1`.`created` DESC
474 $a->get_baseurl(),$a->get_baseurl()
477 foreach ($r as $rr) {
478 $author = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
479 $objauthor = '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
481 //var_dump($rr['verb'],$rr['object-type']); killme();
483 case 'http://activitystrea.ms/schema/1.0/post':
484 switch ($rr['object-type']){
485 case 'http://activitystrea.ms/schema/1.0/event':
486 $post_type = t('event');
489 $post_type = t('status');
493 if ($rr['resource-id']){
494 $post_type = t('photo');
495 $m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
496 $rr['plink'] = $m[1];
498 $post_type = t('status');
501 $plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
503 $aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
508 if($_COOKIE['close_photos'] != "1") {
509 $aside['$photos_title'] = t('Last photos');
510 $aside['$photos_items'] = array();
511 $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
512 (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
513 WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
514 AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
515 INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
517 WHERE `user`.`uid` = `photo`.`uid`
518 AND `user`.`blockwall`=0
519 AND `user`.`hidewall`=0
520 ORDER BY `photo`.`edited` DESC
522 dbesc(t('Contact Photos')),
523 dbesc(t('Profile Photos'))
526 $tpl = file_get_contents( dirname(__file__).'/ch_directory_item.tpl');
528 $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
529 $photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
531 $entry = replace_macros($tpl,array(
533 '$profile-link' => $photo_page,
534 '$photo' => $photo_url,
535 '$alt-text' => $rr['username']." : ".$rr['desc'],
538 $aside['$photos_items'][] = $entry;
542 //right_aside FIND FRIENDS
543 if($_COOKIE['close_friends'] != "1") {
546 $nv['title'] = Array("", t('Find Friends'), "", "");
547 $nv['directory'] = Array('directory', t('Local Directory'), "", "");
548 $nv['global_directory'] = Array('http://dir.friendica.com/', t('Global Directory'), "", "");
549 $nv['match'] = Array('match', t('Similar Interests'), "", "");
550 $nv['suggest'] = Array('suggest', t('Friend Suggestions'), "", "");
551 $nv['invite'] = Array('invite', t('Invite Friends'), "", "");
553 $nv['search'] = '<form name="simple_bar" method="get" action="http://dir.friendika.com/directory">
554 <span class="sbox_l"></span>
556 <input type="text" name="search" size="13" maxlength="50">
558 <span class="sbox_r" id="srch_clear"></span>';
563 //Community_Pages at right_aside
564 if($_COOKIE['close_pages'] != "1") {
567 <h3 style="margin-top:0px;">'.t("Community Pages").'<a id="close_pages_icon" onClick="close_pages()" class="icon close_box" title="close"></a></h3>
568 <div id=""><ul style="margin-left: 7px;margin-top: 0px;padding-left: 0px;padding-top: 0px;">';
572 $contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
573 WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
574 ORDER BY `name` ASC",
575 intval($a->user['uid'])
580 // Look if the profile is a community page
581 foreach($contacts as $contact) {
582 $pageD[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
588 foreach($contacts as $contact) {
589 $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">'.
590 $contact["name"]."</a></li>";
592 $page .= '</ul></div>';
593 //if (sizeof($contacts) > 0)
594 $aside['$page'] = $page;
600 if($_COOKIE['close_mapquery'] != "1") {
602 $mapquery['title'] = Array("", "<a id='mapcontrol-link' href='#mapcontrol' style='text-decoration:none;' onclick='open_mapcontrol(); return false;'>".t('Earth Layers')."</a>", "", "");
603 $aside['$mapquery'] = $mapquery;
604 $ELZoom = get_pconfig(local_user(), 'diabook', 'ELZoom' );
605 $ELPosX = get_pconfig(local_user(), 'diabook', 'ELPosX' );
606 $ELPosY = get_pconfig(local_user(), 'diabook', 'ELPosY' );
607 $aside['$sub'] = t('Submit');
608 $aside['$ELZoom'] = array('diabook_ELZoom', t('Set zoomfactor for Earth Layer'), $ELZoom, '', $ELZoom);
609 $aside['$ELPosX'] = array('diabook_ELPosX', t('Set longitude (X) for Earth Layer'), $ELPosX, '', $ELPosX);
610 $aside['$ELPosY'] = array('diabook_ELPosY', t('Set latitude (Y) for Earth Layer'), $ELPosY, '', $ELPosY);
611 $baseurl = $a->get_baseurl($ssl_state);
612 $aside['$baseurl'] = $baseurl;
613 if (isset($_POST['diabook-settings-map-sub']) && $_POST['diabook-settings-map-sub']!=''){
614 set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);
615 set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);
616 set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
617 header("Location: network");
623 if($_COOKIE['close_helpers'] != "1") {
625 $helpers['title'] = Array("", t('Help or @NewHere ?'), "", "");
626 $aside['$helpers'] = $helpers;
629 //connectable services
630 if($_COOKIE['close_services'] != "1") {
631 $con_services = array();
632 $con_services['title'] = Array("", t('Connect Services'), "", "");
633 $aside['$con_services'] = $con_services;
635 //end connectable services
637 if($_COOKIE['close_twitter'] != "1") {
639 $twitter['title'] = Array("", "<a id='twittersettings-link' href='#twittersettings' style='text-decoration:none;' onclick='open_twittersettings(); return false;'>".t('Last Tweets')."</a>", "", "");
640 $aside['$twitter'] = $twitter;
641 $TSearchTerm = get_pconfig(local_user(), 'diabook', 'TSearchTerm' );
642 $aside['$sub'] = t('Submit');
643 $aside['$TSearchTerm'] = array('diabook_TSearchTerm', t('Set twitter search term'), $TSearchTerm, '', $TSearchTerm);
644 $baseurl = $a->get_baseurl($ssl_state);
645 $aside['$baseurl'] = $baseurl;
646 if (isset($_POST['diabook-settings-sub']) && $_POST['diabook-settings-sub']!=''){
647 set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
648 header("Location: network");
653 $aside['$close'] = $close;
655 $url = $a->get_baseurl($ssl_state);
656 $aside['$url'] = $url;
658 $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
659 $a->page['right_aside'] = replace_macros($tpl, $aside);
663 function js_diabook_footer() {
664 /** @purpose insert stuff in bottom of page
667 $baseurl = $a->get_baseurl($ssl_state);
668 $bottom['$baseurl'] = $baseurl;
669 $tpl = file_get_contents(dirname(__file__) . '/bottom.tpl');
670 $a->page['footer'] = $a->page['footer'].replace_macros($tpl, $bottom);