]> git.mxchange.org Git - friendica.git/commitdiff
remove javascript to set selectect nav item. enanche img template prefetch ignoring
authorfabrixxm <fabrix.xm@gmail.com>
Wed, 17 Aug 2011 16:36:24 +0000 (18:36 +0200)
committerfabrixxm <fabrix.xm@gmail.com>
Wed, 17 Aug 2011 16:36:24 +0000 (18:36 +0200)
16 files changed:
boot.php
include/nav.php
include/template_processor.php
index.php
mod/community.php
mod/contacts.php
mod/directory.php
mod/help.php
mod/message.php
mod/network.php
mod/notifications.php
mod/profile.php
mod/profiles.php
mod/search.php
mod/settings.php
view/nav.tpl

index 39bb6a9dac875e4f77f3e36bb6cdd738e169a2ec..399e100d0b20159aae7324bd35b8c671d26689fa 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -5,6 +5,7 @@ require_once('include/network.php');
 require_once('include/plugin.php');
 require_once('include/text.php');
 require_once("include/pgettext.php");
+require_once('include/nav.php');
 
 
 define ( 'FRIENDIKA_VERSION',      '2.2.1074' );
@@ -1156,3 +1157,4 @@ function load_contact_links($uid) {
        $a->contacts = $ret;
        return;         
 }}
+
index bb1a5b2d814aabd42e1ca812fef790c241dc6157..f9e72bda7d9aff304711b08683dcefe3ad51c718 100644 (file)
@@ -157,8 +157,28 @@ function nav(&$a) {
                '$banner' =>  $banner,
                '$emptynotifications' => t('Nothing new here'),
                '$userinfo' => $userinfo,
+               '$sel' =>       $a->nav_sel,
        ));
 
        call_hooks('page_header', $a->page['nav']);
+}
 
+/*
+ * Set a menu item in navbar as selected
+ * 
+ */
+function nav_set_selected($item){
+       $a = get_app();
+    $a->nav_sel = array(
+               'community'     => null,
+               'network'               => null,
+               'home'                  => null,
+               'profiles'              => null,
+               'notifications' => null,
+               'messages'              => null,
+               'directyory'    => null,
+               'settings'              => null,
+               'contacts'              => null,
+       );
+       $a->nav_sel[$item] = 'selected';
 }
index f1d2eae4e3d269f136f2ee708a67705bde859e4b..11769bbd0791bcbf5dccda75ef15666ce7cd0cab 100644 (file)
                
                private function _preg_error(){
                        switch(preg_last_error()){
-                           case PREG_INTERNAL_ERROR: die('PREG_INTERNAL_ERROR'); break;
-                           case PREG_BACKTRACK_LIMIT_ERROR: die('PREG_BACKTRACK_LIMIT_ERROR'); break;
-                           case PREG_RECURSION_LIMIT_ERROR: die('PREG_RECURSION_LIMIT_ERROR'); break;
-                           case PREG_BAD_UTF8_ERROR: die('PREG_BAD_UTF8_ERROR'); break;
-                           case PREG_BAD_UTF8_OFFSET_ERROR: die('PREG_BAD_UTF8_OFFSET_ERROR'); break;
+                           case PREG_INTERNAL_ERROR: echo('PREG_INTERNAL_ERROR'); break;
+                           case PREG_BACKTRACK_LIMIT_ERROR: echo('PREG_BACKTRACK_LIMIT_ERROR'); break;
+                           case PREG_RECURSION_LIMIT_ERROR: echo('PREG_RECURSION_LIMIT_ERROR'); break;
+                           case PREG_BAD_UTF8_ERROR: echo('PREG_BAD_UTF8_ERROR'); break;
+                           case PREG_BAD_UTF8_OFFSET_ERROR: echo('PREG_BAD_UTF8_OFFSET_ERROR'); break;
                            default:
                                        //die("Unknown preg error.");
                                        return;
                        }
+                       echo "<hr><pre>";
+                       debug_print_backtrace();
+                       die();
                }
                
                private function _build_replace($r, $prefix){
index 80e8ca3b027de00de8c45540f790af8bfa0e0021..51c87cae6e6feff8b7f4abee66c6a4a61a76f635 100644 (file)
--- a/index.php
+++ b/index.php
@@ -195,8 +195,8 @@ if(strlen($a->module)) {
 
        if(! $a->module_loaded) {
 
-               // Stupid browser tried to pre-fetch our ACL img template. Don't log the event or return anything - just quietly exit.
-               if((x($_SERVER,'QUERY_STRING')) && strpos($_SERVER['QUERY_STRING'],'{0}') !== false) {
+               // Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
+               if((x($_SERVER,'QUERY_STRING')) && preg_match('/{[0-9]}/',$_SERVER['QUERY_STRING']) !== 0) {
                        killme();
                }
 
@@ -306,7 +306,6 @@ $a->page['content'] .=  '<div id="pause"></div>';
  */
 
 if($a->module != 'install') {
-       require_once('nav.php');
        nav($a);
 }
 
index f8bd88d869fcbeb10c665d6b80e73be79891c0ab..cb255029f0d47e84d64ae9e825c731cdf1982362 100644 (file)
@@ -25,7 +25,7 @@ function community_content(&$a, $update = 0) {
 
        $o .= '<h3>' . t('Community') . '</h3>';
        if(! $update) {
-               $o .= set_nav_selected('nav-community-link');
+               nav_set_selected('community');
                $o .= '<div id="live-community"></div>' . "\r\n";
                $o .= "<script> var profile_uid = -1; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
        }
index f8b9a743f1327a427bdd35a379bdfbf0d0e53bca..eb1de25ad8f69c01953dabe881542a35d955644e 100644 (file)
@@ -124,7 +124,7 @@ function contacts_content(&$a) {
 
        $sort_type = 0;
        $o = '';
-       $o .= set_nav_selected('nav-contacts-link');
+       nav_set_selected('contacts');
 
        $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
 
index 03b6ab4d1fe1087c9ce72c4fa17cee465e3902b0..93abcd5de845dd661fd9afef49649c438ed44644 100644 (file)
@@ -22,7 +22,7 @@ function directory_content(&$a) {
        }
 
        $o = '';
-       $o .= set_nav_selected('nav-directory-link');
+       nav_set_selected('directory');
        if(x($_SESSION,'theme'))
                unset($_SESSION['theme']);
 
index 495b4ccc22d866362481c17af36e430491c33bcf..59e062f6d4398d16c9c6657e3828313b296dda3c 100644 (file)
@@ -17,6 +17,7 @@ function load_doc_file($s) {
 
 
 function help_content(&$a) {
+       nav_set_selected('help');
 
        global $lang;
 
@@ -41,4 +42,4 @@ function help_content(&$a) {
        
        return Markdown($text);
 
-}
\ No newline at end of file
+}
index ff3db06e23f71e088901af3893da913111206aed..9e89995928bbd9fdbb369ff984fe761ffe4915b5 100644 (file)
@@ -110,7 +110,7 @@ function message_post(&$a) {
 function message_content(&$a) {
 
        $o = '';
-       $o .= set_nav_selected('nav-messages-link');
+       nav_set_selected('messages');
 
        if(! local_user()) {
                notice( t('Permission denied.') . EOL);
index 7cac7b858a8d0d8a729889bd0fa26128bbbb30ef..cf4c994f0dd0a5324282ef1470730aaef98ada1a 100644 (file)
@@ -98,7 +98,7 @@ function network_content(&$a, $update = 0) {
                        }
                }
 
-               $o .= set_nav_selected('nav-network-link');
+               nav_set_selected('network');
 
                $_SESSION['return_url'] = $a->cmd;
 
index 920d0d82d427d4533c1a876a122e92ab08eb47dc..0c35d4cd1a2672e4b7e731eb735e13d2cccca397 100644 (file)
@@ -64,7 +64,7 @@ function notifications_content(&$a) {
        }
 
        $o = '';
-       $o .= set_nav_selected("nav-notifications-link");
+       nav_set_selected("notifications");
 
        if(($a->argc > 1) && ($a->argv[1] == 'all'))
                $sql_extra = '';
index b309ea6470fd5d80caddf3186b00b131d7d13e1b..5a66892daaf4ee49b370319d643e6f985b60551a 100644 (file)
@@ -69,8 +69,9 @@ function profile_content(&$a, $update = 0) {
                $a->profile['profile_uid'] = $update;
        }
        else {
-               if($a->profile['profile_uid'] == local_user())          
-                       $o .= set_nav_selected('nav-home-link');
+               if($a->profile['profile_uid'] == local_user()) {
+                       nav_set_selected('home');
+               }
        }
 
        $contact = null;
index 9b0a2970b5eb7cf47f00018d6a41fe47ce5013ec..5cc9fa38c4728e31c0473d339701dc9d68e1efb7 100644 (file)
@@ -220,7 +220,7 @@ function profiles_post(&$a) {
 function profiles_content(&$a) {
 
        $o = '';
-       $o .= set_nav_selected('nav-profiles-link');
+       nav_set_selected('profiles');
 
        if(! local_user()) {
                notice( t('Permission denied.') . EOL);
index 88ff9bbb73d57db751f067f263cedb6fe317a6f9..f7ce75905a80b23c6616baf39da485d2da594423 100644 (file)
@@ -13,6 +13,8 @@ function search_content(&$a) {
                notice( t('Public access denied.') . EOL);
                return;
        }
+       
+       nav_set_selected('search');
 
        require_once("include/bbcode.php");
        require_once('include/security.php');
index 0223b1b9ca5a4a9cad09955631392e84b9d5aec1..44ebdd77b1eb73d048f9d2bfe649011ddd73034b 100644 (file)
@@ -299,7 +299,7 @@ if(! function_exists('settings_content')) {
 function settings_content(&$a) {
 
        $o = '';
-       $o .=  set_nav_selected('nav-settings-link');
+       nav_set_selected('settings');
 
        if(! local_user()) {
                notice( t('Permission denied.') . EOL );
index 0444ea75c52ec8450b127902c67ce7c2ae0768a6..434c9f844c8b70eb47deff22a446c9e8a0d96c62 100644 (file)
                                        
                                        {{ if $nav.notifications }}<li><a class="$nav.notifications.2" href="$nav.notifications.0" title="$nav.notifications.3" >$nav.notifications.1</a></li>{{ endif }}
                                        {{ if $nav.messages }}<li><a class="$nav.messages.2" href="$nav.messages.0" title="$nav.messages.3" >$nav.messages.1</a></li>{{ endif }}
+                                       {{ if $nav.contacts }}<li><a class="$nav.contacts.2" href="$nav.contacts.0" title="$nav.contacts.3" >$nav.contacts.1</a>{{ endif }}                                     
                                </ul>
                        </li>
                {{ endif }}
                
                {{ if $nav.community }}
-                       <li id="nav-community-link" class="nav-menu">
+                       <li id="nav-community-link" class="nav-menu $sel.community">
                                <a class="$nav.community.2" href="$nav.community.0" title="$nav.community.3" >$nav.community.1</a>
                        </li>
                {{ endif }}
                
                {{ if $nav.network }}
-                       <li id="nav-network-link" class="nav-menu">
+                       <li id="nav-network-link" class="nav-menu $sel.network">
                                <a class="$nav.network.2" href="$nav.network.0" title="$nav.network.3" >$nav.network.1</a>
                                <span id="net-update" class="nav-notify"></span>
                        </li>
                {{ endif }}
-               {{ if $nav.network }}
-                       <li id="nav-home-link" class="nav-menu">
+               {{ if $nav.home }}
+                       <li id="nav-home-link" class="nav-menu $sel.home">
                                <a class="$nav.home.2" href="$nav.home.0" title="$nav.home.3" >$nav.home.1</a>
                                <span id="home-update" class="nav-notify"></span>
                        </li>
                </li>
                
                
-               <li id="nav-help-link" class="nav-menu">
+               <li id="nav-help-link" class="nav-menu $sel.help">
                        <a class="$nav.help.2" target="friendika-help" href="$nav.help.0" title="$nav.help.3" >$nav.help.1</a>
                </li>
 
-               <li id="nav-search-link" class="nav-menu">
+               <li id="nav-search-link" class="nav-menu $sel.search">
                        <a class="$nav.search.2" href="$nav.search.0" title="$nav.search.3" >$nav.search.1</a>
                </li>
-               <li id="nav-directory-link" class="nav-menu">
+               <li id="nav-directory-link" class="nav-menu $sel.directory">
                        <a class="$nav.directory.2" href="$nav.directory.0" title="$nav.directory.3" >$nav.directory.1</a>
                </li>
                
                {{ if $nav.apps }}
-                       <li id="nav-apps-link" class="nav-menu">
+                       <li id="nav-apps-link" class="nav-menu $sel.apps">
                                <a class=" $nav.apps.2" href="$nav.apps.0" title="$nav.apps.3" >$nav.apps.1</a>
                        </li>
                {{ endif }}
 {{ if $nav.settings }}<a id="nav-settings-link" class="nav-link $nav.settings.2" href="$nav.settings.0" title="$nav.settings.3">$nav.settings.1</a>{{ endif }}
 {{ if $nav.profiles }}<a id="nav-profiles-link" class="nav-link $nav.profiles.2" href="$nav.profiles.0" title="$nav.profiles.3" >$nav.profiles.1</a>{{ endif }}
 
-{{ if $nav.contacts }}<a id="nav-contacts-link" class="nav-link $nav.contacts.2" href="$nav.contacts.0" title="$nav.contacts.3" >$nav.contacts.1</a>{{ endif }}
+
 </span>
 <span id="nav-end"></span>
 <span id="banner">$banner</span>