@@ -52,23 +52,20 @@ $_header_nav = [
52
52
]],
53
53
['label ' => 'News ' , 'dropdown ' => [
54
54
['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 ],
57
55
['label ' => '- ' , 'acl ' => User::OPTION_ACL_NEWS_CREATE ],
56
+ ['label ' => 'Create News Post ' , 'url ' => '/news/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_NEWS_CREATE ],
58
57
['label ' => '' , 'recent_news ' => true ],
59
58
]],
60
59
['label ' => 'Documents ' , 'dropdown ' => [
61
60
['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 ],
64
61
['label ' => '- ' , 'acl ' => User::OPTION_ACL_DOCUMENT_CREATE ],
62
+ ['label ' => 'Create Document ' , 'url ' => '/document/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_DOCUMENT_CREATE ],
65
63
['label ' => '' , 'recent_documents ' => true ],
66
64
]],
67
65
['label ' => 'Packets ' , 'dropdown ' => [
68
66
['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 ],
71
67
['label ' => '- ' , 'acl ' => User::OPTION_ACL_PACKET_CREATE ],
68
+ ['label ' => 'Create Packet ' , 'url ' => '/packet/create ' , 'class ' => 'text-success ' , 'acl ' => User::OPTION_ACL_PACKET_CREATE ],
72
69
['label ' => '' , 'recent_packets ' => true ],
73
70
]],
74
71
['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)
113
110
$ class = $ item ['class ' ] ?? '' ;
114
111
if (!empty ($ class )) $ class = ' ' . $ class ;
115
112
116
- if (isset ($ item ['recent_documents ' ]) && $ item ['recent_documents ' ])
113
+ if (isset ($ item ['recent_documents ' ]) && $ item ['recent_documents ' ] && isset (Common:: $ database ) )
117
114
{
115
+ _line ('<div class="dropdown-divider"></div> ' );
118
116
_line ('<div class="dropdown-header">Recently Edited Documents</div> ' );
119
117
$ recent_documents = Document::getDocumentsByLastEdited (10 );
120
118
$ acl_doc_modify = (Authentication::$ user && (Authentication::$ user ->getOptionsBitmask () & User::OPTION_ACL_DOCUMENT_MODIFY ));
@@ -125,8 +123,9 @@ function _header_nav_html($nav)
125
123
_line ('<a class="dropdown-item%s" href="%s">%s</a> ' , $ doc_class , $ doc ->getURI (), filter_var ($ doc ->getTitle (), FILTER_SANITIZE_FULL_SPECIAL_CHARS ));
126
124
}
127
125
}
128
- else if (isset ($ item ['recent_news ' ]) && $ item ['recent_news ' ])
126
+ else if (isset ($ item ['recent_news ' ]) && $ item ['recent_news ' ] && isset (Common:: $ database ) )
129
127
{
128
+ _line ('<div class="dropdown-divider"></div> ' );
130
129
_line ('<div class="dropdown-header">Recent News</div> ' );
131
130
$ recent_news = NewsPost::getNewsPostsByLastEdited (10 );
132
131
$ acl_news_modify = (Authentication::$ user && (Authentication::$ user ->getOptionsBitmask () & User::OPTION_ACL_NEWS_MODIFY ));
@@ -137,8 +136,9 @@ function _header_nav_html($nav)
137
136
_line ('<a class="dropdown-item%s" href="%s">%s</a> ' , $ news_class , $ news ->getURI (), filter_var ($ news ->getTitle (), FILTER_SANITIZE_FULL_SPECIAL_CHARS ));
138
137
}
139
138
}
140
- else if (isset ($ item ['recent_packets ' ]) && $ item ['recent_packets ' ])
139
+ else if (isset ($ item ['recent_packets ' ]) && $ item ['recent_packets ' ] && isset (Common:: $ database ) )
141
140
{
141
+ _line ('<div class="dropdown-divider"></div> ' );
142
142
_line ('<div class="dropdown-header">Recently Edited Packets</div> ' );
143
143
$ recent_packets = Packet::getPacketsByLastEdited (10 );
144
144
$ acl_pkt_modify = (Authentication::$ user && (Authentication::$ user ->getOptionsBitmask () & User::OPTION_ACL_PACKET_MODIFY ));
@@ -175,18 +175,21 @@ function _header_nav_html($nav)
175
175
_line ('</ul> ' );
176
176
177
177
// Account
178
- if (!Authentication ::$ user )
178
+ if (isset (Common ::$ database ) )
179
179
{
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 )
182
181
{
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 ' ));
184
192
}
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 ' ));
190
193
}
191
194
192
195
// Collapsible Hamburger Menu (End)
0 commit comments