<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,6 +5,8 @@
 
 	$action = ($_GET['action'] == &quot;index&quot; or !isset($_GET['action'])) ? $admin-&gt;determine_action() : $_GET['action'];
 
+	$admin-&gt;handle_redirects($action);
+
 	class AdminTwig {
 		public function __construct() {
 			$this-&gt;twig = new Twig_Loader(MAIN_DIR.&quot;/admin/layout&quot;, (is_writable(INCLUDES_DIR.&quot;/caches&quot;) and !DEBUG) ? INCLUDES_DIR.&quot;/caches&quot; : null);
@@ -23,12 +25,14 @@
 				$trigger-&gt;filter($$main_nav, $main_nav.&quot;_pages&quot;);
 			}
 
+			$visitor = Visitor::current();
+
 			$admin-&gt;context[&quot;theme&quot;]       = $theme;
 			$admin-&gt;context[&quot;flash&quot;]       = Flash::current();
 			$admin-&gt;context[&quot;trigger&quot;]     = $trigger;
 			$admin-&gt;context[&quot;title&quot;]       = camelize($action, true);
 			$admin-&gt;context[&quot;site&quot;]        = Config::current();
-			$admin-&gt;context[&quot;visitor&quot;]     = Visitor::current();
+			$admin-&gt;context[&quot;visitor&quot;]     = $visitor;
 			$admin-&gt;context[&quot;logged_in&quot;]   = logged_in();
 			$admin-&gt;context[&quot;route&quot;]       = array(&quot;action&quot; =&gt; $action);
 			$admin-&gt;context[&quot;hide_admin&quot;]  = isset($_SESSION[&quot;chyrp_hide_admin&quot;]);
@@ -39,18 +43,53 @@
 			$admin-&gt;context[&quot;POST&quot;]        = $_POST;
 			$admin-&gt;context[&quot;GET&quot;]         = $_GET;
 
-			$admin-&gt;context[&quot;selected&quot;]   = array(&quot;write&quot;    =&gt; (in_array($action, $write) or match(&quot;/^write_/&quot;, $action)) ?
-			                                                    &quot;selected&quot; :
-			                                                    &quot;deselected&quot;,
-			                                      &quot;manage&quot;   =&gt; (in_array($action, $manage) or match(array(&quot;/^manage_/&quot;, &quot;/^edit_/&quot;, &quot;/^delete_/&quot;), $action)) ?
-			                                                    &quot;selected&quot; :
-			                                                    &quot;deselected&quot;,
-			                                      &quot;settings&quot; =&gt; (in_array($action, $settings) or match(&quot;/_settings$/&quot;, $action)) ?
-			                                                    &quot;selected&quot; :
-			                                                    &quot;deselected&quot;,
-			                                      &quot;extend&quot;   =&gt; (in_array($action, $extend)) ?
-			                                                    &quot;selected&quot; :
-			                                                    &quot;deselected&quot;);
+			$admin-&gt;context[&quot;navigation&quot;] = array();
+
+			$show = array(&quot;write&quot; =&gt; array($visitor-&gt;group()-&gt;can(&quot;add_draft&quot;, &quot;add_post&quot;, &quot;add_page&quot;)),
+			              &quot;manage&quot; =&gt; array($visitor-&gt;group()-&gt;can(&quot;view_own_draft&quot;,
+			                                                       &quot;view_draft&quot;,
+			                                                       &quot;edit_own_draft&quot;,
+			                                                       &quot;edit_own_post&quot;,
+			                                                       &quot;edit_post&quot;,
+			                                                       &quot;delete_own_draft&quot;,
+			                                                       &quot;delete_own_post&quot;,
+			                                                       &quot;delete_post&quot;,
+			                                                       &quot;add_page&quot;,
+			                                                       &quot;edit_page&quot;,
+			                                                       &quot;delete_page&quot;,
+			                                                       &quot;add_user&quot;,
+			                                                       &quot;edit_user&quot;,
+			                                                       &quot;delete_user&quot;,
+			                                                       &quot;add_group&quot;,
+			                                                       &quot;edit_group&quot;,
+			                                                       &quot;delete_group&quot;)),
+			              &quot;settings&quot; =&gt; array($visitor-&gt;group()-&gt;can(&quot;change_settings&quot;)),
+			              &quot;extend&quot; =&gt; array($visitor-&gt;group()-&gt;can(&quot;toggle_extensions&quot;)));
+
+			foreach ($show as $name =&gt; &amp;$arr)
+				$trigger-&gt;filter($arr, $name.&quot;_nav_show&quot;);
+
+			$admin-&gt;context[&quot;navigation&quot;][&quot;write&quot;] = array(&quot;title&quot; =&gt; __(&quot;Write&quot;),
+			                                               &quot;show&quot; =&gt; in_array(true, $show[&quot;write&quot;]),
+			                                               &quot;selected&quot; =&gt; (in_array($action, $write) or
+			                                                             match(&quot;/^write_/&quot;, $action)));
+
+			$admin-&gt;context[&quot;navigation&quot;][&quot;manage&quot;] = array(&quot;title&quot; =&gt; __(&quot;Manage&quot;),
+			                                                &quot;show&quot; =&gt; in_array(true, $show[&quot;manage&quot;]),
+			                                                &quot;selected&quot; =&gt; (in_array($action, $manage) or
+			                                                              match(array(&quot;/^manage_/&quot;,
+			                                                                          &quot;/^edit_/&quot;,
+			                                                                          &quot;/^delete_/&quot;,
+			                                                                          &quot;/^new_/&quot;), $action)));
+
+			$admin-&gt;context[&quot;navigation&quot;][&quot;settings&quot;] = array(&quot;title&quot; =&gt; __(&quot;Settings&quot;),
+			                                                  &quot;show&quot; =&gt; in_array(true, $show[&quot;settings&quot;]),
+			                                                  &quot;selected&quot; =&gt; (in_array($action, $settings) or
+			                                                                match(&quot;/_settings$/&quot;, $action)));
+
+			$admin-&gt;context[&quot;navigation&quot;][&quot;extend&quot;] = array(&quot;title&quot; =&gt; __(&quot;Extend&quot;),
+			                                                &quot;show&quot; =&gt; in_array(true, $show[&quot;extend&quot;]),
+			                                                &quot;selected&quot; =&gt; (in_array($action, $extend)));
 
 			$this-&gt;subnav_context();
 
@@ -85,6 +124,7 @@
 			global $admin, $action;
 
 			$trigger = Trigger::current();
+			$visitor = Visitor::current();
 
 			$admin-&gt;context[&quot;subnav&quot;] = array();
 			$subnav =&amp; $admin-&gt;context[&quot;subnav&quot;];
@@ -95,26 +135,44 @@
 			foreach (Config::current()-&gt;enabled_feathers as $index =&gt; $feather) {
 				$info = Horde_Yaml::loadFile(FEATHERS_DIR.&quot;/&quot;.$feather.&quot;/info.yaml&quot;);
 				$subnav[&quot;write&quot;][&quot;write_post&amp;feather=&quot;.$feather] = array(&quot;title&quot; =&gt; __($info[&quot;name&quot;], $feather),
+			                                                             &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;add_draft&quot;, &quot;add_post&quot;),
 				                                                         &quot;attributes&quot; =&gt; ' id=&quot;list_feathers['.$feather.']&quot;',
 				                                                         &quot;selected&quot; =&gt; (isset($_GET['feather']) and $_GET['feather'] == $feather) or
 				                                                                       (!isset($_GET['feather']) and $action == &quot;write_post&quot; and !$index));
 			}
 
 			# Write navs
-			$subnav[&quot;write&quot;][&quot;write_page&quot;] = array(&quot;title&quot; =&gt; __(&quot;Page&quot;));
+			$subnav[&quot;write&quot;][&quot;write_page&quot;] = array(&quot;title&quot; =&gt; __(&quot;Page&quot;),
+			                                       &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;add_page&quot;));
 			$trigger-&gt;filter($subnav[&quot;write&quot;], array(&quot;admin_write_nav&quot;, &quot;write_nav&quot;));
 			$pages[&quot;write&quot;] = array_merge(array(&quot;write_post&quot;), array_keys($subnav[&quot;write&quot;]));;
 
 			# Manage navs
-			$subnav[&quot;manage&quot;] = array(&quot;manage_posts&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Posts&quot;), &quot;selected&quot; =&gt; array(&quot;edit_post&quot;, &quot;delete_post&quot;)),
-			                          &quot;manage_pages&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Pages&quot;), &quot;selected&quot; =&gt; array(&quot;edit_page&quot;, &quot;delete_page&quot;)),
-			                          &quot;manage_users&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Users&quot;), &quot;selected&quot; =&gt; array(&quot;edit_user&quot;, &quot;delete_user&quot;)),
-			                          &quot;manage_groups&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;Groups&quot;), &quot;selected&quot; =&gt; array(&quot;edit_group&quot;, &quot;delete_group&quot;)));
+			$subnav[&quot;manage&quot;] = array(&quot;manage_posts&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Posts&quot;),
+			                                                   &quot;show&quot; =&gt; (Post::any_editable() or Post::any_deletable()),
+			                                                   &quot;selected&quot; =&gt; array(&quot;edit_post&quot;, &quot;delete_post&quot;)),
+			                          &quot;manage_pages&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Pages&quot;),
+			                                                   &quot;show&quot; =&gt; ($visitor-&gt;group()-&gt;can(&quot;edit_page&quot;, &quot;delete_page&quot;)),
+			                                                   &quot;selected&quot; =&gt; array(&quot;edit_page&quot;, &quot;delete_page&quot;)),
+			                          &quot;manage_users&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Users&quot;),
+			                                                   &quot;show&quot; =&gt; ($visitor-&gt;group()-&gt;can(&quot;add_user&quot;,
+			                                                                                     &quot;edit_user&quot;,
+			                                                                                     &quot;delete_user&quot;)),
+			                                                   &quot;selected&quot; =&gt; array(&quot;edit_user&quot;, &quot;delete_user&quot;, &quot;new_user&quot;)),
+			                          &quot;manage_groups&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;Groups&quot;),
+			                                                   &quot;show&quot; =&gt; ($visitor-&gt;group()-&gt;can(&quot;add_group&quot;,
+			                                                                                     &quot;edit_group&quot;,
+			                                                                                     &quot;delete_group&quot;)),
+			                                                   &quot;selected&quot; =&gt; array(&quot;edit_group&quot;, &quot;delete_group&quot;, &quot;new_group&quot;)));
 			$trigger-&gt;filter($subnav[&quot;manage&quot;], &quot;manage_nav&quot;);
 
-			$subnav[&quot;manage&quot;][&quot;import&quot;] = array(&quot;title&quot; =&gt; __(&quot;Import&quot;));
-			$subnav[&quot;manage&quot;][&quot;export&quot;] = array(&quot;title&quot; =&gt; __(&quot;Export&quot;));
+			$subnav[&quot;manage&quot;][&quot;import&quot;] = array(&quot;title&quot; =&gt; __(&quot;Import&quot;),
+			                                    &quot;show&quot; =&gt; ($visitor-&gt;group()-&gt;can(&quot;add_post&quot;)));
+			$subnav[&quot;manage&quot;][&quot;export&quot;] = array(&quot;title&quot; =&gt; __(&quot;Export&quot;),
+			                                    &quot;show&quot; =&gt; ($visitor-&gt;group()-&gt;can(&quot;add_post&quot;)));
 
+			$pages[&quot;manage&quot;][] = &quot;new_user&quot;;
+			$pages[&quot;manage&quot;][] = &quot;new_group&quot;;
 			foreach (array_keys($subnav[&quot;manage&quot;]) as $manage)
 				$pages[&quot;manage&quot;] = array_merge($pages[&quot;manage&quot;], array($manage,
 				                                                       preg_replace(&quot;/manage_(.+)/e&quot;,
@@ -125,24 +183,35 @@
 				                                                                    $manage)));
 
 			# Settings navs
-			$subnav[&quot;settings&quot;] = array(&quot;general_settings&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;General&quot;)),
-			                            &quot;content_settings&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;Content&quot;)),
-			                            &quot;user_settings&quot;    =&gt; array(&quot;title&quot; =&gt; __(&quot;Users&quot;)),
-			                            &quot;route_settings&quot;   =&gt; array(&quot;title&quot; =&gt; __(&quot;Routes&quot;)));
+			$subnav[&quot;settings&quot;] = array(&quot;general_settings&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;General&quot;),
+			                                                        &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;change_settings&quot;)),
+			                            &quot;content_settings&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;Content&quot;),
+			                                                        &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;change_settings&quot;)),
+			                            &quot;user_settings&quot;    =&gt; array(&quot;title&quot; =&gt; __(&quot;Users&quot;),
+			                                                        &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;change_settings&quot;)),
+			                            &quot;route_settings&quot;   =&gt; array(&quot;title&quot; =&gt; __(&quot;Routes&quot;),
+			                                                        &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;change_settings&quot;)));
 			$trigger-&gt;filter($subnav[&quot;settings&quot;], &quot;settings_nav&quot;);
 			$pages[&quot;settings&quot;] = array_keys($subnav[&quot;settings&quot;]);
 
 			# Extend navs
-			$subnav[&quot;extend&quot;] = array(&quot;modules&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Modules&quot;)),
-			                          &quot;feathers&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;Feathers&quot;)),
-			                          &quot;themes&quot;   =&gt; array(&quot;title&quot; =&gt; __(&quot;Themes&quot;)));
+			$subnav[&quot;extend&quot;] = array(&quot;modules&quot;  =&gt; array(&quot;title&quot; =&gt; __(&quot;Modules&quot;),
+			                                              &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;toggle_extensions&quot;)),
+			                          &quot;feathers&quot; =&gt; array(&quot;title&quot; =&gt; __(&quot;Feathers&quot;),
+			                                              &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;toggle_extensions&quot;)),
+			                          &quot;themes&quot;   =&gt; array(&quot;title&quot; =&gt; __(&quot;Themes&quot;),
+			                                              &quot;show&quot; =&gt; $visitor-&gt;group()-&gt;can(&quot;toggle_extensions&quot;)));
 			$trigger-&gt;filter($subnav[&quot;extend&quot;], &quot;extend_nav&quot;);
 			$pages[&quot;extend&quot;] = array_keys($subnav[&quot;extend&quot;]);
 
-			foreach (array(&quot;write&quot;, &quot;manage&quot;, &quot;settings&quot;, &quot;extend&quot;) as $main_nav)
+			foreach (array_keys($subnav) as $main_nav)
 				foreach ($trigger-&gt;filter($pages[$main_nav], $main_nav.&quot;_nav_pages&quot;) as $extend)
 					$subnav[$extend] =&amp; $subnav[$main_nav];
 
+			foreach ($subnav as $main_nav =&gt; &amp;$sub_nav)
+				foreach ($sub_nav as &amp;$nav)
+					$nav[&quot;show&quot;] = (!isset($nav[&quot;show&quot;]) or $nav[&quot;show&quot;]);
+
 			$trigger-&gt;filter($subnav, &quot;admin_subnav&quot;);
 		}
 	}</diff>
      <filename>admin/index.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,18 +15,11 @@ ${ trigger.call(&quot;admin_head&quot;) }
 			&lt;div class=&quot;column&quot;&gt;
 				&lt;ul id=&quot;navigation&quot;&gt;
 {% block navigation %}
-{% if visitor.group.can(&quot;add_draft&quot;, &quot;add_post&quot;) %}
-					&lt;li class=&quot;first $selected.write&quot;&gt;&lt;a href=&quot;{% admin &quot;write_post&quot; %}&quot;&gt;${ &quot;Write&quot; | translate }&lt;/a&gt;&lt;/li&gt;
-{% endif %}
-{% if visitor.group.can(&quot;view_own_draft&quot;, &quot;view_draft&quot;, &quot;edit_own_draft&quot;, &quot;edit_own_post&quot;, &quot;edit_post&quot;, &quot;delete_own_draft&quot;, &quot;delete_own_post&quot;, &quot;delete_post&quot;) %}
-					&lt;li class=&quot;second $selected.manage&quot;&gt;&lt;a href=&quot;{% admin &quot;manage_posts&quot; %}&quot;&gt;${ &quot;Manage&quot; | translate }&lt;/a&gt;&lt;/li&gt;
-{% endif %}
-{% if visitor.group.can(&quot;change_settings&quot;) %}
-					&lt;li class=&quot;third $selected.settings&quot;&gt;&lt;a href=&quot;{% admin &quot;general_settings&quot; %}&quot;&gt;${ &quot;Settings&quot; | translate }&lt;/a&gt;&lt;/li&gt;
-{% endif %}
-{% if visitor.group.can(&quot;toggle_extensions&quot;) %}
-					&lt;li class=&quot;fourth $selected.extend&quot;&gt;&lt;a href=&quot;{% admin &quot;modules&quot; %}&quot;&gt;${ &quot;Extend&quot; | translate }&lt;/a&gt;&lt;/li&gt;
-{% endif %}
+{% for action, nav in navigation | items %}
+					{% if nav.show %}
+					&lt;li class=&quot;$action{% if nav.selected %} selected{% endif %}&quot;$nav.attributes&gt;&lt;a href=&quot;{% admin action %}&quot;&gt;$nav.title&lt;/a&gt;&lt;/li&gt;
+					{% endif %}
+{% endfor %}
 {% endblock %}
 				&lt;/ul&gt;
 				&lt;h1&gt;$site.name&lt;/h1&gt;
@@ -43,7 +36,9 @@ ${ trigger.call(&quot;admin_head&quot;) }
 {% block subnav %}
 {% if subnav[route.action] %}
 {% for action, nav in subnav[route.action] | items %}
+			{% if nav.show %}
 			&lt;li${ route.action | selected(nav.selected, action) }$nav.attributes&gt;&lt;a href=&quot;{% admin action %}&quot;&gt;$nav.title&lt;/a&gt;&lt;/li&gt;
+			{% endif %}
 {% endfor %}
 {% endif %}
 {% endblock %}</diff>
      <filename>admin/layout/layout.twig</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@
 			&lt;form class=&quot;detail&quot; action=&quot;index.php&quot; method=&quot;get&quot; accept-charset=&quot;utf-8&quot;&gt;
 				&lt;fieldset&gt;
 					&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;manage_users&quot; /&gt;
-					{% if visitor.group.can(&quot;edit_user&quot;) %}
+					{% if visitor.group.can(&quot;add_user&quot;) %}
 					&lt;a href=&quot;{% admin &quot;new_user&quot; %}&quot; class=&quot;button yay right&quot;&gt;
 						&lt;img src=&quot;images/icons/add.png&quot; alt=&quot;add&quot; /&gt; ${ &quot;New User&quot; | translate }
 					&lt;/a&gt;</diff>
      <filename>admin/layout/pages/manage_users.twig</filename>
    </modified>
    <modified>
      <diff>@@ -75,10 +75,10 @@ a:visited {
 #header #navigation li a:hover {
 	opacity: 1;
 }
-#header #navigation li.first a  { border-color: #ef4646; }
-#header #navigation li.second a { border-color: #e19a2c; }
-#header #navigation li.third a  { border-color: #16d907; }
-#header #navigation li.fourth a { border-color: #0096ff; }
+#header #navigation li.write a  { border-color: #ef4646; }
+#header #navigation li.manage a { border-color: #e19a2c; }
+#header #navigation li.settings a  { border-color: #16d907; }
+#header #navigation li.extend a { border-color: #0096ff; }
 
 #welcome {
 	background: #dfdfdf url('images/welcome.gif') repeat-x;</diff>
      <filename>admin/style.css</filename>
    </modified>
    <modified>
      <diff>@@ -1689,38 +1689,66 @@
 		 * Function: determine_action
 		 * Determines through simple logic which page should be shown as the default when browsing to /admin/.
 		 */
-		public function determine_action() {
+		public function determine_action($action = null) {
 			$visitor = Visitor::current();
 
-			# &quot;Write &gt; Post&quot;, if they can add posts or drafts.
-			if ($visitor-&gt;group()-&gt;can(&quot;add_post&quot;) or $visitor-&gt;group()-&gt;can(&quot;add_draft&quot;))
-				return &quot;write_post&quot;;
+			if (!isset($action) or $action == &quot;write&quot;) {
+				# &quot;Write &gt; Post&quot;, if they can add posts or drafts.
+				if ($visitor-&gt;group()-&gt;can(&quot;add_post&quot;) or $visitor-&gt;group()-&gt;can(&quot;add_draft&quot;))
+					return &quot;write_post&quot;;
 
-			# &quot;Write &gt; Page&quot;, if they can add pages.
-			if ($visitor-&gt;group()-&gt;can(&quot;add_page&quot;))
-				return &quot;write_page&quot;;
+				# &quot;Write &gt; Page&quot;, if they can add pages.
+				if ($visitor-&gt;group()-&gt;can(&quot;add_page&quot;))
+					return &quot;write_page&quot;;
+			}
+
+			if (!isset($action) or $action == &quot;manage&quot;) {
+				# &quot;Manage &gt; Posts&quot;, if they can manage any posts.
+				if (Post::any_editable() or Post::any_deletable())
+					return &quot;manage_posts&quot;;
 
-			# &quot;Manage &gt; Posts&quot;, if they can manage any posts.
-			if (Post::any_editable() or Post::any_deletable())
-				return &quot;manage_posts&quot;;
+				# &quot;Manage &gt; Pages&quot;, if they can manage pages.
+				if ($visitor-&gt;group()-&gt;can(&quot;edit_page&quot;) or $visitor-&gt;group()-&gt;can(&quot;delete_page&quot;))
+					return &quot;manage_pages&quot;;
 
-			# &quot;Manage &gt; Pages&quot;, if they can manage pages.
-			if ($visitor-&gt;group()-&gt;can(&quot;edit_page&quot;) or $visitor-&gt;group()-&gt;can(&quot;delete_page&quot;))
-				return &quot;manage_pages&quot;;
+				# &quot;Manage &gt; Users&quot;, if they can manage users.
+				if ($visitor-&gt;group()-&gt;can(&quot;edit_user&quot;) or $visitor-&gt;group()-&gt;can(&quot;delete_user&quot;))
+					return &quot;manage_users&quot;;
 
-			# &quot;Manage &gt; Users&quot;, if they can manage users.
-			if ($visitor-&gt;group()-&gt;can(&quot;edit_user&quot;) or $visitor-&gt;group()-&gt;can(&quot;delete_user&quot;))
-				return &quot;manage_users&quot;;
+				# &quot;Manage &gt; Groups&quot;, if they can manage groups.
+				if ($visitor-&gt;group()-&gt;can(&quot;edit_group&quot;) or $visitor-&gt;group()-&gt;can(&quot;delete_group&quot;))
+					return &quot;manage_groups&quot;;
+			}
+
+			if (!isset($action) or $action == &quot;settings&quot;) {
+				# &quot;General Settings&quot;, if they can configure the installation.
+				if ($visitor-&gt;group()-&gt;can(&quot;change_settings&quot;))
+					return &quot;general_settings&quot;;
+			}
 
-			# &quot;Manage &gt; Groups&quot;, if they can manage groups.
-			if ($visitor-&gt;group()-&gt;can(&quot;edit_group&quot;) or $visitor-&gt;group()-&gt;can(&quot;delete_group&quot;))
-				return &quot;manage_groups&quot;;
+			if (!isset($action) or $action == &quot;extend&quot;) {
+				# &quot;Modules&quot;, if they can configure the installation.
+				if ($visitor-&gt;group()-&gt;can(&quot;toggle_extensions&quot;))
+					return &quot;modules&quot;;
+			}
+
+			$extended = $action;
+			Trigger::current()-&gt;filter($extended, &quot;determine_action&quot;);
+			if ($extended != $action)
+				return $extended;
+
+			if (!isset($action))
+				show_403(__(&quot;Access Denied&quot;), __(&quot;You do not have sufficient privileges to access this area.&quot;));
+		}
 
-			# &quot;Settings&quot;, if they can configure the installation.
-			if ($visitor-&gt;group()-&gt;can(&quot;change_settings&quot;))
-				return &quot;settings&quot;;
+		public function handle_redirects($action) {
+			$redirectable = array(&quot;write&quot;, &quot;manage&quot;, &quot;settings&quot;, &quot;extend&quot;);
+			Trigger::current()-&gt;filter($redirectable, &quot;admin_redirectables&quot;);
+			if (!in_array($action, $redirectable)) return;
 
-			show_403(__(&quot;Access Denied&quot;), __(&quot;You do not have sufficient privileges to access this area.&quot;));
+			$redirect = $this-&gt;determine_action($action);
+			if (!empty($redirect))
+				redirect(&quot;/admin/?action=&quot;.$redirect);
 		}
 
 		/**</diff>
      <filename>includes/controller/Admin.php</filename>
    </modified>
    <modified>
      <diff>@@ -298,15 +298,17 @@
 				             array($user-&gt;login, $config-&gt;name, $new_password)));
 
 			if ($sent)
-				return Flash::warning(_f(&quot;An e-mail has been sent to your e-mail address that contains a new password. Once you have logged in with it, feel free to change it at &lt;a href=\&quot;%s\&quot;&gt;User Controls&lt;/a&gt;.&quot;,
+				return Flash::notice(_f(&quot;An e-mail has been sent to your e-mail address that contains a new password. Once you have logged in, you can change it at &lt;a href=\&quot;%s\&quot;&gt;User Controls&lt;/a&gt;.&quot;,
 				                         array(url(&quot;controls/&quot;))));
 
+			# Set their password back to what it was originally.
 			$user-&gt;update($user-&gt;login,
 			              $user-&gt;password,
 			              $user-&gt;full_name,
 			              $user-&gt;email,
 			              $user-&gt;website,
 			              $user-&gt;group_id);
+
 			Flash::warning(__(&quot;E-Mail could not be sent. Password change cancelled.&quot;));
 		}
 	}</diff>
      <filename>includes/controller/Main.php</filename>
    </modified>
    <modified>
      <diff>@@ -259,13 +259,13 @@
 				if (in_array($string, $uncountable))
 					break;
 
-				$replaced = preg_replace($key, $val, $string);
+				$replaced = preg_replace($key, $val, $string, 1);
 
 				if ($replaced != $string)
 					break;
 			}
 
-			if ($replaced == $string and !in_array($string, $uncountable))
+			if ($replaced == $string and !in_array($string, $uncountable) and substr($string, -1) == &quot;s&quot;)
 				return substr($string, 0, -1);
 			else
 				return $replaced;</diff>
      <filename>includes/helpers.php</filename>
    </modified>
    <modified>
      <diff>@@ -141,7 +141,7 @@
 		}
 
 		static function admin_manage_spam() {
-			if (!Comment::any_editable() and !Comment::any_deletable())
+			if (!Visitor::current()-&gt;group()-&gt;can(&quot;edit_comment&quot;, &quot;delete_comment&quot;, true))
 				show_403(__(&quot;Access Denied&quot;), __(&quot;You do not have sufficient privileges to manage any comments.&quot;, &quot;comments&quot;));
 
 			global $admin;
@@ -299,8 +299,12 @@
 			if (!Comment::any_editable() and !Comment::any_deletable())
 				return $navs;
 
-			$navs[&quot;manage_comments&quot;] = array(&quot;title&quot; =&gt; __(&quot;Comments&quot;, &quot;comments&quot;), &quot;selected&quot; =&gt; array(&quot;edit_comment&quot;, &quot;delete_comment&quot;));
-			$navs[&quot;manage_spam&quot;]     = array(&quot;title&quot; =&gt; __(&quot;Spam&quot;, &quot;comments&quot;));
+			$navs[&quot;manage_comments&quot;] = array(&quot;title&quot; =&gt; __(&quot;Comments&quot;, &quot;comments&quot;),
+			                                 &quot;selected&quot; =&gt; array(&quot;edit_comment&quot;, &quot;delete_comment&quot;));
+
+			if (Visitor::current()-&gt;group()-&gt;can(&quot;edit_comment&quot;, &quot;delete_comment&quot;))
+				$navs[&quot;manage_spam&quot;]     = array(&quot;title&quot; =&gt; __(&quot;Spam&quot;, &quot;comments&quot;));
+
 			return $navs;
 		}
 
@@ -352,6 +356,12 @@
 				$params[&quot;:query&quot;] = &quot;%&quot;.$search.&quot;%&quot;;
 			}
 
+			$visitor = Visitor::current();
+			if (!$visitor-&gt;group()-&gt;can(&quot;edit_comment&quot;, &quot;delete_comment&quot;, true)) {
+				$where[] = &quot;__comments.user_id = :user_id&quot;;
+				$params[&quot;:user_id&quot;] = $visitor-&gt;id;
+			}
+
 			$admin-&gt;context[&quot;comments&quot;] = new Paginator(Comment::find(array(&quot;placeholders&quot; =&gt; true, &quot;where&quot; =&gt; $where, &quot;params&quot; =&gt; $params)), 25);
 		}
 
@@ -364,8 +374,11 @@
 			$comments = array_keys($_POST['comment']);
 
 			if (isset($_POST['delete'])) {
-				foreach ($comments as $comment)
-					Comment::delete($comment);
+				foreach ($comments as $comment) {
+					$comment = new Comment($comment);
+					if ($comment-&gt;deletable())
+						Comment::delete($comment);
+				}
 
 				Flash::notice(__(&quot;Selected comments deleted.&quot;, &quot;comments&quot;));
 			}
@@ -757,4 +770,16 @@
 
 			return $atom;
 		}
+
+		public function manage_nav_show($possibilities) {
+			$possibilities[] = (Comment::any_editable() or Comment::any_deletable());
+			return $possibilities;
+		}
+
+		public function determine_action($action) {
+			if ($action != &quot;manage&quot;) return;
+
+			if (Comment::any_editable() or Comment::any_deletable())
+				return &quot;manage_comments&quot;;
+		}
 	}</diff>
      <filename>modules/comments/comments.php</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,7 @@
 							&lt;label for=&quot;author_url&quot;&gt;${ &quot;Author Website&quot; | translate }&lt;/label&gt;
 							&lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;author_url&quot; value=&quot;${ comment.author_url | escape }&quot; id=&quot;author_url&quot; /&gt;
 						&lt;/p&gt;
+{% if visitor.group.can(&quot;edit_comment&quot;) %}
 						&lt;p&gt;
 							&lt;label for=&quot;status&quot;&gt;${ &quot;Status&quot; | translate }&lt;/label&gt;
 							&lt;select name=&quot;status&quot; id=&quot;status&quot;&gt;
@@ -42,6 +43,7 @@
 								&lt;option value=&quot;trackback&quot;${ comment.status | option_selected(&quot;trackback&quot;) }&gt;${ &quot;Trackback&quot; | translate }&lt;/option&gt;
 							&lt;/select&gt;
 						&lt;/p&gt;
+{% endif %}
 						&lt;p&gt;
 							&lt;label for=&quot;created_at&quot;&gt;${ &quot;Timestamp&quot; | translate }&lt;/label&gt;
 							&lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;created_at&quot; value=&quot;${ comment.created_at | strftime }&quot; id=&quot;created_at&quot; /&gt;</diff>
      <filename>modules/comments/pages/admin/edit_comment.twig</filename>
    </modified>
    <modified>
      <diff>@@ -21,6 +21,7 @@
 			&lt;/form&gt;
 			&lt;br /&gt;
 			&lt;form action=&quot;{% admin &quot;bulk_comments&quot; %}&quot; method=&quot;post&quot;&gt;
+{% if visitor.group.can(&quot;edit_comment&quot;, &quot;delete_comment&quot;) %}
 				&lt;div class=&quot;controls right&quot;&gt;
 					&lt;h4&gt;${ &quot;With selected:&quot; | translate(&quot;comments&quot;) }&lt;/h4&gt;
 					&lt;button class=&quot;lite&quot; name=&quot;deny&quot;&gt;
@@ -36,6 +37,7 @@
 						&lt;img src=&quot;images/icons/delete.png&quot; alt=&quot;delete&quot; /&gt; ${ &quot;delete&quot; | translate(&quot;comments&quot;) }
 					&lt;/button&gt;
 				&lt;/div&gt;
+{% endif %}
 				&lt;h2&gt;${ &quot;Last 25 Comments&quot; | translate(&quot;comments&quot;) }&lt;/h2&gt;
 				&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;wide&quot;&gt;
 					&lt;thead&gt;
@@ -82,6 +84,7 @@
 					{% endfor %}
 					&lt;/tbody&gt;
 				&lt;/table&gt;
+{% if visitor.group.can(&quot;edit_comment&quot;, &quot;delete_comment&quot;) %}
 				&lt;br /&gt;
 				&lt;div class=&quot;controls&quot;&gt;
 					&lt;h4&gt;${ &quot;With selected:&quot; | translate(&quot;comments&quot;) }&lt;/h4&gt;
@@ -98,6 +101,7 @@
 						&lt;img src=&quot;images/icons/delete.png&quot; alt=&quot;delete&quot; /&gt; ${ &quot;delete&quot; | translate(&quot;comments&quot;) }
 					&lt;/button&gt;
 				&lt;/div&gt;
+{% endif %}
 			&lt;/form&gt;
 			&lt;br /&gt;
 			$comments.next_link</diff>
      <filename>modules/comments/pages/admin/manage_comments.twig</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 		&lt;li id=&quot;comment_$comment.id&quot;&gt;
 {% if comment.status == &quot;denied&quot; %}
-			&lt;em&gt;${ &quot;Your comment is awaiting moderation.&quot; | translate }&lt;/em&gt;
+			&lt;span class=&quot;waiting&quot;&gt;${ &quot;Your comment is awaiting moderation.&quot; | translate }&lt;/span&gt;
 {% endif %}
 			&lt;blockquote&gt;
 				$comment.body</diff>
      <filename>themes/stardust/content/comment.twig</filename>
    </modified>
    <modified>
      <diff>@@ -8,14 +8,22 @@
 	&lt;input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;$visitor.email&quot; id=&quot;email&quot; /&gt;
 	&lt;input type=&quot;hidden&quot; name=&quot;url&quot; value=&quot;$visitor.website&quot; id=&quot;url&quot; /&gt;
 {% else %}
-	&lt;label for=&quot;author&quot;&gt;${ &quot;Your Name&quot; | translate }&lt;/label&gt;
-	&lt;input type=&quot;text&quot; name=&quot;author&quot; value=&quot;&quot; id=&quot;author&quot; /&gt;&lt;br /&gt;
-	&lt;label for=&quot;email&quot;&gt;${ &quot;Your E-Mail&quot; | translate }&lt;/label&gt;
-	&lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;&quot; id=&quot;email&quot; /&gt;&lt;br /&gt;
-	&lt;label for=&quot;url&quot;&gt;${ &quot;Your Website&quot; | translate }&lt;/label&gt;
-	&lt;input type=&quot;text&quot; name=&quot;url&quot; value=&quot;&quot; id=&quot;url&quot; /&gt;&lt;br /&gt;
+	&lt;p&gt;
+		&lt;label for=&quot;author&quot;&gt;${ &quot;Your Name&quot; | translate }&lt;/label&gt;
+		&lt;input type=&quot;text&quot; name=&quot;author&quot; value=&quot;&quot; id=&quot;author&quot; /&gt;
+	&lt;/p&gt;
+	&lt;p&gt;
+		&lt;label for=&quot;email&quot;&gt;${ &quot;Your E-Mail&quot; | translate }&lt;/label&gt;
+		&lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;&quot; id=&quot;email&quot; /&gt;
+	&lt;/p&gt;
+	&lt;p&gt;
+		&lt;label for=&quot;url&quot;&gt;${ &quot;Your Website&quot; | translate }&lt;/label&gt;
+		&lt;input type=&quot;text&quot; name=&quot;url&quot; value=&quot;&quot; id=&quot;url&quot; /&gt;
+	&lt;/p&gt;
 {% endif %}
-	&lt;textarea name=&quot;body&quot; rows=&quot;8&quot; cols=&quot;40&quot; class=&quot;wide&quot;&gt;&lt;/textarea&gt;
+	&lt;p&gt;
+		&lt;textarea name=&quot;body&quot; rows=&quot;8&quot; cols=&quot;40&quot; class=&quot;wide&quot;&gt;&lt;/textarea&gt;
+	&lt;/p&gt;
 
 	&lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; value=&quot;$post.id&quot; id=&quot;post_id&quot; /&gt;
 	&lt;button type=&quot;submit&quot;&gt;${ &quot;Speak&quot; | translate }&lt;/button&gt;</diff>
      <filename>themes/stardust/forms/comment/new.twig</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 {% extends &quot;layouts/default.twig&quot; %}
 {% block content %}
 	&lt;h2&gt;${ &quot;Controls&quot; | translate }&lt;/h2&gt;
-	&lt;br /&gt;
 	&lt;form action=&quot;{% url &quot;update_self/&quot; %}&quot; method=&quot;post&quot;&gt;
 		&lt;p&gt;
 			&lt;label for=&quot;full_name&quot;&gt;${ &quot;Full Name&quot; | translate }&lt;/label&gt;</diff>
      <filename>themes/stardust/forms/user/controls.twig</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 {% extends &quot;layouts/default.twig&quot; %}
 {% block content %}
 	&lt;h2&gt;${ &quot;Log In&quot; | translate }&lt;/h2&gt;
-	&lt;br /&gt;
 	&lt;form action=&quot;{% url &quot;login/&quot; %}&quot; method=&quot;post&quot;&gt;
 		&lt;p&gt;
 			&lt;label for=&quot;login&quot;&gt;${ &quot;Username&quot; | translate }&lt;/label&gt;</diff>
      <filename>themes/stardust/forms/user/login.twig</filename>
    </modified>
    <modified>
      <diff>@@ -1,18 +1,11 @@
 {% extends &quot;layouts/default.twig&quot; %}
 {% block content %}
 	&lt;h2&gt;${ &quot;Lost Password&quot; | translate }&lt;/h2&gt;
-	&lt;br /&gt;
 	&lt;form action=&quot;{% url &quot;lost_password/&quot; %}&quot; method=&quot;post&quot;&gt;
-		{% if invalid_user %}
-		&lt;p&gt;${ &quot;You have specified a user that does not exist.&quot; | translate }&lt;/p&gt;
-		{% endif %}
-		{% if sent %}
-		&lt;p&gt;${ &quot;E-mail sent!&quot; | translate }&lt;/p&gt;
-		{% endif %}
 		&lt;p class=&quot;lost_pass&quot;&gt;${ &quot;Please enter your username below and we will e-mail you a new password for your account.&quot; | translate }&lt;/p&gt;
 		&lt;p&gt;
 			&lt;label for=&quot;login&quot;&gt;${ &quot;Username&quot; | translate }&lt;/label&gt;
-			&lt;input type=&quot;login&quot; name=&quot;login&quot; value=&quot;&quot; id=&quot;login&quot; /&gt;
+			&lt;input type=&quot;text&quot; name=&quot;login&quot; value=&quot;&quot; id=&quot;login&quot; /&gt;
 		&lt;/p&gt;
 
 		&lt;p&gt;&lt;button name=&quot;submit&quot; type=&quot;submit&quot; id=&quot;submit&quot;&gt;${ &quot;Submit&quot; | translate }&lt;/button&gt;&lt;/p&gt;</diff>
      <filename>themes/stardust/forms/user/lost_password.twig</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 {% extends &quot;layouts/default.twig&quot; %}
 {% block content %}
 	&lt;h2&gt;${ &quot;Register&quot; | translate }&lt;/h2&gt;
-	&lt;br /&gt;
 	&lt;form action=&quot;{% url &quot;registration/&quot; %}&quot; method=&quot;post&quot;&gt;
 		&lt;p&gt;
 			&lt;label for=&quot;login&quot;&gt;${ &quot;Username&quot; | translate }&lt;/label&gt;</diff>
      <filename>themes/stardust/forms/user/register.twig</filename>
    </modified>
    <modified>
      <diff>@@ -369,6 +369,10 @@ ol.comments ol li {
 	list-style-type: decimal;
 }
 
+#add_comment {
+	margin-top: 3em;
+}
+
 div.post {
 	margin: 0 0 3em;
 	word-wrap: break-word;
@@ -609,7 +613,8 @@ span.pages {
 	font-weight: bold;
 	padding: 0 0.3em;
 }
-span.who {
+span.who,
+span.waiting {
 	background-color: #e2e2e2;
 	font-weight: bold;
 	display: block;</diff>
      <filename>themes/stardust/stylesheets/screen.css.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ef5ae7a0265e1689a93b839188dd51d1f16b10b0</id>
    </parent>
  </parents>
  <author>
    <name>Alex Suraci</name>
    <email>i.am@toogeneric.com</email>
  </author>
  <url>http://github.com/vito/chyrp/commit/13dbb213947fc67f7d87fee4f9bdb83be5bf6187</url>
  <id>13dbb213947fc67f7d87fee4f9bdb83be5bf6187</id>
  <committed-date>2008-07-10T13:57:38-07:00</committed-date>
  <authored-date>2008-07-10T13:57:38-07:00</authored-date>
  <message>* Hide admin nav items if the user can't perform the action. [#96 state:resolved]
* Vastly increased the flexibility of Admin area navigation items.</message>
  <tree>0a641953ff3481f8d9e28f6475674898aa512148</tree>
  <committer>
    <name>Alex Suraci</name>
    <email>i.am@toogeneric.com</email>
  </committer>
</commit>
