@@ -52,23 +52,20 @@ $_header_nav = [
5252 ]],
5353 ['label ' => 'News ' , 'dropdown ' => [
5454 ['label ' => 'All News ' , 'url ' => '/news ' , 'class ' => 'text-info ' ],
55- ['label ' => '- ' ],
56- ['label ' => 'Create News Post ' , 'url ' => '/news/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_NEWS_CREATE ],
5755 ['label ' => '- ' , 'acl ' => User::OPTION_ACL_NEWS_CREATE ],
56+ ['label ' => 'Create News Post ' , 'url ' => '/news/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_NEWS_CREATE ],
5857 ['label ' => '' , 'recent_news ' => true ],
5958 ]],
6059 ['label ' => 'Documents ' , 'dropdown ' => [
6160 ['label ' => 'All Documents ' , 'url ' => '/document/index ' , 'class ' => 'text-info ' ],
62- ['label ' => '- ' ],
63- ['label ' => 'Create Document ' , 'url ' => '/document/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_DOCUMENT_CREATE ],
6461 ['label ' => '- ' , 'acl ' => User::OPTION_ACL_DOCUMENT_CREATE ],
62+ ['label ' => 'Create Document ' , 'url ' => '/document/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_DOCUMENT_CREATE ],
6563 ['label ' => '' , 'recent_documents ' => true ],
6664 ]],
6765 ['label ' => 'Packets ' , 'dropdown ' => [
6866 ['label ' => 'All Packets ' , 'url ' => '/packet/index ' , 'class ' => 'text-info ' ],
69- ['label ' => '- ' ],
70- ['label ' => 'Create Packet ' , 'url ' => '/packet/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_PACKET_CREATE ],
7167 ['label ' => '- ' , 'acl ' => User::OPTION_ACL_PACKET_CREATE ],
68+ ['label ' => 'Create Packet ' , 'url ' => '/packet/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_PACKET_CREATE ],
7269 ['label ' => '' , 'recent_packets ' => true ],
7370 ]],
7471 ['label ' => 'Admin ' , 'acl ' => User::OPTION_ACL_SERVER_CREATE | User::OPTION_ACL_EVENT_LOG_VIEW , 'class ' => 'text-danger ' , 'dropdown ' => [
@@ -113,8 +110,9 @@ function _header_nav_html($nav)
113110 $ class = $ item ['class ' ] ?? '' ;
114111 if (!empty ($ class )) $ class = ' ' . $ class ;
115112
116- if (isset ($ item ['recent_documents ' ]) && $ item ['recent_documents ' ])
113+ if (isset ($ item ['recent_documents ' ]) && $ item ['recent_documents ' ] && isset (Common:: $ database ) )
117114 {
115+ _line ('<div class="dropdown-divider"></div> ' );
118116 _line ('<div class="dropdown-header">Recently Edited Documents</div> ' );
119117 $ recent_documents = Document::getDocumentsByLastEdited (10 );
120118 $ acl_doc_modify = (Authentication::$ user && (Authentication::$ user ->getOptionsBitmask () & User::OPTION_ACL_DOCUMENT_MODIFY ));
@@ -125,8 +123,9 @@ function _header_nav_html($nav)
125123 _line ('<a class="dropdown-item%s" href="%s">%s</a> ' , $ doc_class , $ doc ->getURI (), filter_var ($ doc ->getTitle (), FILTER_SANITIZE_FULL_SPECIAL_CHARS ));
126124 }
127125 }
128- else if (isset ($ item ['recent_news ' ]) && $ item ['recent_news ' ])
126+ else if (isset ($ item ['recent_news ' ]) && $ item ['recent_news ' ] && isset (Common:: $ database ) )
129127 {
128+ _line ('<div class="dropdown-divider"></div> ' );
130129 _line ('<div class="dropdown-header">Recent News</div> ' );
131130 $ recent_news = NewsPost::getNewsPostsByLastEdited (10 );
132131 $ acl_news_modify = (Authentication::$ user && (Authentication::$ user ->getOptionsBitmask () & User::OPTION_ACL_NEWS_MODIFY ));
@@ -137,8 +136,9 @@ function _header_nav_html($nav)
137136 _line ('<a class="dropdown-item%s" href="%s">%s</a> ' , $ news_class , $ news ->getURI (), filter_var ($ news ->getTitle (), FILTER_SANITIZE_FULL_SPECIAL_CHARS ));
138137 }
139138 }
140- else if (isset ($ item ['recent_packets ' ]) && $ item ['recent_packets ' ])
139+ else if (isset ($ item ['recent_packets ' ]) && $ item ['recent_packets ' ] && isset (Common:: $ database ) )
141140 {
141+ _line ('<div class="dropdown-divider"></div> ' );
142142 _line ('<div class="dropdown-header">Recently Edited Packets</div> ' );
143143 $ recent_packets = Packet::getPacketsByLastEdited (10 );
144144 $ acl_pkt_modify = (Authentication::$ user && (Authentication::$ user ->getOptionsBitmask () & User::OPTION_ACL_PACKET_MODIFY ));
@@ -175,18 +175,21 @@ function _header_nav_html($nav)
175175 _line ('</ul> ' );
176176
177177 // Account
178- if (!Authentication ::$ user )
178+ if (isset (Common ::$ database ) )
179179 {
180- _line ('<a class="btn btn-sm btn-outline-secondary my-2 my-sm-0" tabindex="-1" href="%s">Log in</a> ' , Common::relativeUrlToAbsolute ('/user/login ' ));
181- if (!Common::$ config ->bnetdocs ->user_register_disabled )
180+ if (!Authentication::$ user )
182181 {
183- _line ('<a class="btn btn-sm btn-outline-success my-2 my-sm-0 ml-2" tabindex="-2" href="%s">Register</a> ' , Common::relativeUrlToAbsolute ('/user/register ' ));
182+ _line ('<a class="btn btn-sm btn-outline-secondary my-2 my-sm-0" tabindex="-1" href="%s">Log in</a> ' , Common::relativeUrlToAbsolute ('/user/login ' ));
183+ if (!Common::$ config ->bnetdocs ->user_register_disabled )
184+ {
185+ _line ('<a class="btn btn-sm btn-outline-success my-2 my-sm-0 ml-2" tabindex="-2" href="%s">Register</a> ' , Common::relativeUrlToAbsolute ('/user/register ' ));
186+ }
187+ }
188+ else
189+ {
190+ _line ('<span class="nav-item navbar-text mx-3"><a href="%s">%s</a></span> ' , Authentication::$ user ->getURI (), filter_var (Authentication::$ user ->getName (), FILTER_SANITIZE_FULL_SPECIAL_CHARS ));
191+ _line ('<a class="btn btn-sm btn-outline-danger my-2 my-sm-0" tabindex="-1" href="%s">Log out</a> ' , Common::relativeUrlToAbsolute ('/user/logout ' ));
184192 }
185- }
186- else
187- {
188- _line ('<span class="nav-item navbar-text mx-3"><a href="%s">%s</a></span> ' , Authentication::$ user ->getURI (), filter_var (Authentication::$ user ->getName (), FILTER_SANITIZE_FULL_SPECIAL_CHARS ));
189- _line ('<a class="btn btn-sm btn-outline-danger my-2 my-sm-0" tabindex="-1" href="%s">Log out</a> ' , Common::relativeUrlToAbsolute ('/user/logout ' ));
190193 }
191194
192195 // Collapsible Hamburger Menu (End)
0 commit comments