+if ($color=="diabook") $color_path = "/";
+if ($color=="aerith") $color_path = "/diabook-aerith/";
+if ($color=="blue") $color_path = "/diabook-blue/";
+if ($color=="red") $color_path = "/diabook-red/";
+if ($color=="pink") $color_path = "/diabook-pink/";
+if ($color=="green") $color_path = "/diabook-green/";
+if ($color=="dark") $color_path = "/diabook-dark/";
+
+
+ //profile_side at networkpages
+ if ($a->argv[0] === "network" && local_user()){
+
+ // USER MENU
+ if(local_user()) {
+
+ $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
+
+ $userinfo = array(
+ 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
+ 'name' => $a->user['username'],
+ );
+ $ps = array('usermenu'=>array());
+ $ps['usermenu']['status'] = Array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
+ $ps['usermenu']['profile'] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
+ $ps['usermenu']['contacts'] = Array('contacts' , t('Contacts'), "", t('Your contacts'));
+ $ps['usermenu']['photos'] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
+ $ps['usermenu']['events'] = Array('events/', t('Events'), "", t('Your events'));
+ $ps['usermenu']['notes'] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
+ $ps['usermenu']['community'] = Array('community/', t('Community'), "", "");
+ $ps['usermenu']['pgroups'] = Array('http://dir.friendica.com/directory/forum', t('Community Pages'), "", "");
+
+ $tpl = get_markup_template('profile_side.tpl');
+
+ $a->page['aside'] = replace_macros($tpl, array(
+ '$userinfo' => $userinfo,
+ '$ps' => $ps,
+ )).$a->page['aside'];
+
+ }
+
+ $ccCookie = $_COOKIE['close_pages'] + $_COOKIE['close_profiles'] + $_COOKIE['close_helpers'] + $_COOKIE['close_services'] + $_COOKIE['close_friends'] + $_COOKIE['close_twitter'] + $_COOKIE['close_lastusers'] + $_COOKIE['close_lastphotos'] + $_COOKIE['close_lastlikes'];
+
+ if($ccCookie != "9") {
+ // COMMUNITY
+ diabook_community_info();
+
+ // CUSTOM CSS
+ if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network.css";}
+ if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-network-wide.css";}
+ }
+ }
+
+
+
+ //right_aside at profile pages
+ if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname']){
+ if($ccCookie != "9") {
+ // COMMUNITY
+ diabook_community_info();
+
+ // CUSTOM CSS
+ if($resolution == "normal") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile.css";}
+ if($resolution == "wide") {$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook".$color_path."style-profile-wide.css";}
+
+ }
+ }
+
+ //js scripts
+ //load jquery.cookie.js
+ $cookieJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.cookie.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s"></script>', $cookieJS);
+
+ //load jquery.ae.image.resize.js
+ $imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.ae.image.resize.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
+
+ //load jquery.ui.js
+ if($ccCookie != "9") {
+ $jqueryuiJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery-ui-1.8.20.custom.min.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $jqueryuiJS);
+ }
+
+ //load jquery.twitter.search.js
+ if($_COOKIE['close_twitter'] != "1") {
+ $twitterJS = $a->get_baseurl($ssl_state)."/view/theme/diabook/js/jquery.twitter.search.js";
+ $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $twitterJS);
+ }
+
+ $a->page['htmlhead'] .= '
+ <script>
+
+ $(function() {
+ $("a.lightbox").fancybox(); // Select all links with lightbox class
+ });
+
+ $(window).load(function() {
+ var footer_top = $(document).height() - 30;
+ $("div#footerbox").attr("style", "border-top: 1px solid #D2D2D2; width: 70%;right: 15%;position: absolute;top:"+footer_top+"px;");
+ });
+
+
+
+ </script>';
+
+ //check if twitterbox is active and print
+ if($_COOKIE['close_twitter'] != "1") {
+ $a->page['htmlhead'] .= '
+ <script>
+ $(function() {
+ $("#twitter").twitterSearch({
+ term: "friendica",
+ animInSpeed: 250,
+ bird: false,
+ avatar: false,
+ colorExterior: "#fff",
+ title: "Last Tweets",
+ timeout: 10000 });
+ });
+ </script>';}
+
+ //check if community_home-plugin is activated and change css
+ $nametocheck = "communityhome";
+ $r = q("select id from addon where name = '%s' and installed = 1", dbesc($nametocheck));
+ if(count($r) == "1") {
+
+ $a->page['htmlhead'] .= '
+ <script>
+ $(document).ready(function() {
+ $("div#login-submit-wrapper").attr("style","padding-top: 120px;");
+ });
+ </script>';
+ }
+ //comment-edit-wrapper on photo_view
+ if ($a->argv[0].$a->argv[2] === "photos"."image"){
+ $a->page['htmlhead'] .= '
+ <script>
+ $(function(){
+ $(".comment-edit-form").css("display","table");
+ });
+ </script>';
+ }
+ //restore right hand col at settingspage
+ if($a->argv[0] === "settings" && local_user()) {
+ $a->page['htmlhead'] .= '
+ <script>
+ function restore_boxes(){
+ $.cookie("close_pages","2", { expires: 365, path: "/" });
+ $.cookie("close_helpers","2", { expires: 365, path: "/" });
+ $.cookie("close_profiles","2", { expires: 365, path: "/" });
+ $.cookie("close_services","2", { expires: 365, path: "/" });
+ $.cookie("close_friends","2", { expires: 365, path: "/" });
+ $.cookie("close_twitter","2", { expires: 365, path: "/" });
+ $.cookie("close_lastusers","2", { expires: 365, path: "/" });
+ $.cookie("close_lastphotos","2", { expires: 365, path: "/" });
+ $.cookie("close_lastlikes","2", { expires: 365, path: "/" });
+ $.cookie("Boxorder",null, { expires: 365, path: "/" });
+ alert("Right-hand column was restored. Please refresh your browser");
+ }
+ </script>';}
+
+ if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()){
+ $a->page['htmlhead'] .= '
+ <script>
+
+ $(function() {
+ $(".oembed.photo img").aeImageResize({height: 400, width: 400});
+ });
+ </script>';
+
+ if($ccCookie != "9") {
+ $a->page['htmlhead'] .= '
+ <script>
+ $("right_aside").ready(function(){
+
+ if($.cookie("close_pages") == "1")
+ {
+ document.getElementById( "close_pages" ).style.display = "none";
+ };
+
+ if($.cookie("close_profiles") == "1")
+ {
+ document.getElementById( "close_profiles" ).style.display = "none";
+ };
+
+ if($.cookie("close_helpers") == "1")
+ {
+ document.getElementById( "close_helpers" ).style.display = "none";
+ };
+
+ if($.cookie("close_services") == "1")
+ {
+ document.getElementById( "close_services" ).style.display = "none";
+ };
+
+ if($.cookie("close_friends") == "1")
+ {
+ document.getElementById( "close_friends" ).style.display = "none";
+ };
+
+ if($.cookie("close_twitter") == "1")
+ {
+ document.getElementById( "twitter" ).style.display = "none";
+ };
+
+ if($.cookie("close_lastusers") == "1")
+ {
+ document.getElementById( "close_lastusers" ).style.display = "none";
+ };
+
+ if($.cookie("close_lastphotos") == "1")
+ {
+ document.getElementById( "close_lastphotos" ).style.display = "none";
+ };
+
+ if($.cookie("close_lastlikes") == "1")
+ {
+ document.getElementById( "close_lastlikes" ).style.display = "none";
+ };}
+
+ );
+
+ function close_pages(){
+ document.getElementById( "close_pages" ).style.display = "none";
+ $.cookie("close_pages","1", { expires: 365, path: "/" });
+ };