From c380a588ea86cd89fbcff81fa007c9cb7588c662 Mon Sep 17 00:00:00 2001
From: Jonathan <jonathan.leon@pandorafms.com>
Date: Mon, 23 Jan 2023 11:07:34 +0100
Subject: [PATCH 1/4] #10076 attachments-plugins access

---
 pandora_console/godmode/servers/plugin.php | 116 +++++++++++++++++++--
 1 file changed, 108 insertions(+), 8 deletions(-)

diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index 5a0d8a063a..47851469c3 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -225,14 +225,69 @@ if ($filemanager) {
         $directory = (string) get_parameter('directory');
         if (empty($directory) === true) {
             $directory = $fallback_directory;
+            $base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
+            $setup_url = $base_url.'&filemanager=1&tab=Attachments';
+            $tab = get_parameter('tab', null);
+            $tabs = [
+                'list'    => [
+                    'text'   => '<a href="'.$base_url.'">'.html_print_image(
+                        'images/eye_show.png',
+                        true,
+                        [
+                            'title' => __('Plugins'),
+                            'class' => 'invert_filter',
+                        ]
+                    ).'</a>',
+                    'active' => (bool) ($tab != 'Attachments'),
+                ],
+                'options' => [
+                    'text'   => '<a href="'.$setup_url.'">'.html_print_image(
+                        'images/setup.png',
+                        true,
+                        [
+                            'title' => __('Attachments'),
+                            'class' => 'invert_filter',
+                        ]
+                    ).'</a>',
+                    'active' => (bool) ($tab == 'Attachments'),
+                ],
+            ];
+
+            if ($tab === 'Attachments') {
+                $helpHeader  = '';
+                $titleHeader = __('Index of attachment/plugin');
+            } else {
+                $helpHeader  = 'servers_ha_clusters_tab';
+                $titleHeader = __('Plug-ins registered on %s', get_product_name());
+            }
+
+            // Header.
+            ui_print_standard_header(
+                $titleHeader,
+                'images/gm_servers.png',
+                false,
+                $helpHeader,
+                false,
+                $tabs,
+                [
+                    [
+                        'link'  => '',
+                        'label' => __('Servers'),
+                    ],
+                    [
+                        'link'  => '&filemanager=1',
+                        'label' => __('Plugins'),
+                    ],
+                ]
+            );
         } else {
             $directory = str_replace('\\', '/', $directory);
             $directory = filemanager_safe_directory($directory, $fallback_directory);
+            echo '<h4>'.__('Index of %s', $directory).'</h4>';
         }
 
         $real_directory = realpath($config['homedir'].'/'.$directory);
 
-        echo '<h4>'.__('Index of %s', $directory).'</h4>';
 
         $chunck_url = '&view='.$id_plugin;
         if ($id_plugin == 0) {
@@ -597,15 +652,60 @@ if (($create != '') || ($view != '')) {
             );
         }
     } else {
-        ui_print_page_header(
-            __(
-                'Plug-ins registered on %s',
-                get_product_name()
-            ),
+        $base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
+        $setup_url = $base_url.'&filemanager=1&tab=Attachments';
+        $tab = get_parameter('tab', null);
+        $tabs = [
+            'list'    => [
+                'text'   => '<a href="'.$base_url.'">'.html_print_image(
+                    'images/eye_show.png',
+                    true,
+                    [
+                        'title' => __('Plugins'),
+                        'class' => 'invert_filter',
+                    ]
+                ).'</a>',
+                'active' => (bool) ($tab != 'Attachments'),
+            ],
+            'options' => [
+                'text'   => '<a href="'.$setup_url.'">'.html_print_image(
+                    'images/setup.png',
+                    true,
+                    [
+                        'title' => __('Attachments'),
+                        'class' => 'invert_filter',
+                    ]
+                ).'</a>',
+                'active' => (bool) ($tab == 'Attachments'),
+            ],
+        ];
+
+        if ($tab === 'Attachments') {
+            $helpHeader  = '';
+            $titleHeader = __('Index of attachment/plugin');
+        } else {
+            $helpHeader  = 'servers_ha_clusters_tab';
+            $titleHeader = __('Plug-ins registered on %s', get_product_name());
+        }
+
+        // Header.
+        ui_print_standard_header(
+            $titleHeader,
             'images/gm_servers.png',
             false,
-            '',
-            true
+            $helpHeader,
+            false,
+            $tabs,
+            [
+                [
+                    'link'  => '',
+                    'label' => __('Servers'),
+                ],
+                [
+                    'link'  => '&filemanager=1',
+                    'label' => __('Plugins'),
+                ],
+            ]
         );
 
         $management_allowed = is_management_allowed();

From aacf069acf711b383d4809581cd12b159d7edf90 Mon Sep 17 00:00:00 2001
From: Jonathan <jonathan.leon@pandorafms.com>
Date: Mon, 23 Jan 2023 11:19:59 +0100
Subject: [PATCH 2/4] #10076 attachments-plugins access

---
 pandora_console/godmode/servers/plugin.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index 47851469c3..7a15eb4e8c 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -275,7 +275,7 @@ if ($filemanager) {
                         'label' => __('Servers'),
                     ],
                     [
-                        'link'  => '&filemanager=1',
+                        'link'  => '',
                         'label' => __('Plugins'),
                     ],
                 ]
@@ -456,7 +456,7 @@ if (($create != '') || ($view != '')) {
     $data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
     $data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" >';
 
-    $data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" class="bot">';
+    $data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&tab=Attachments&id_plugin='.$form_id.'" class="bot">';
     $data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true);
     $data[1] .= '</a>';
     $table->data['plugin_command'] = $data;
@@ -702,7 +702,7 @@ if (($create != '') || ($view != '')) {
                     'label' => __('Servers'),
                 ],
                 [
-                    'link'  => '&filemanager=1',
+                    'link'  => '',
                     'label' => __('Plugins'),
                 ],
             ]

From 60756ebb1880160a7f4e5d0d89a55c2643066d48 Mon Sep 17 00:00:00 2001
From: Jonathan <jonathan.leon@pandorafms.com>
Date: Mon, 23 Jan 2023 13:01:31 +0100
Subject: [PATCH 3/4] #10076 attachments-plugins icon tab

---
 pandora_console/godmode/servers/plugin.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index 7a15eb4e8c..82049defca 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -242,7 +242,7 @@ if ($filemanager) {
                 ],
                 'options' => [
                     'text'   => '<a href="'.$setup_url.'">'.html_print_image(
-                        'images/setup.png',
+                        'images/collection.png',
                         true,
                         [
                             'title' => __('Attachments'),
@@ -669,7 +669,7 @@ if (($create != '') || ($view != '')) {
             ],
             'options' => [
                 'text'   => '<a href="'.$setup_url.'">'.html_print_image(
-                    'images/setup.png',
+                    'images/collection.png',
                     true,
                     [
                         'title' => __('Attachments'),

From 27b42d313702174374b4e7b94592f49a2478285f Mon Sep 17 00:00:00 2001
From: Jonathan <jonathan.leon@pandorafms.com>
Date: Fri, 27 Jan 2023 13:23:48 +0100
Subject: [PATCH 4/4] #10076 add easy acces on directorys

---
 pandora_console/godmode/servers/plugin.php | 114 ++++++++++-----------
 1 file changed, 57 insertions(+), 57 deletions(-)

diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index 82049defca..94ab20aebf 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -225,67 +225,67 @@ if ($filemanager) {
         $directory = (string) get_parameter('directory');
         if (empty($directory) === true) {
             $directory = $fallback_directory;
-            $base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
-            $setup_url = $base_url.'&filemanager=1&tab=Attachments';
-            $tab = get_parameter('tab', null);
-            $tabs = [
-                'list'    => [
-                    'text'   => '<a href="'.$base_url.'">'.html_print_image(
-                        'images/eye_show.png',
-                        true,
-                        [
-                            'title' => __('Plugins'),
-                            'class' => 'invert_filter',
-                        ]
-                    ).'</a>',
-                    'active' => (bool) ($tab != 'Attachments'),
-                ],
-                'options' => [
-                    'text'   => '<a href="'.$setup_url.'">'.html_print_image(
-                        'images/collection.png',
-                        true,
-                        [
-                            'title' => __('Attachments'),
-                            'class' => 'invert_filter',
-                        ]
-                    ).'</a>',
-                    'active' => (bool) ($tab == 'Attachments'),
-                ],
-            ];
-
-            if ($tab === 'Attachments') {
-                $helpHeader  = '';
-                $titleHeader = __('Index of attachment/plugin');
-            } else {
-                $helpHeader  = 'servers_ha_clusters_tab';
-                $titleHeader = __('Plug-ins registered on %s', get_product_name());
-            }
-
-            // Header.
-            ui_print_standard_header(
-                $titleHeader,
-                'images/gm_servers.png',
-                false,
-                $helpHeader,
-                false,
-                $tabs,
-                [
-                    [
-                        'link'  => '',
-                        'label' => __('Servers'),
-                    ],
-                    [
-                        'link'  => '',
-                        'label' => __('Plugins'),
-                    ],
-                ]
-            );
         } else {
             $directory = str_replace('\\', '/', $directory);
             $directory = filemanager_safe_directory($directory, $fallback_directory);
-            echo '<h4>'.__('Index of %s', $directory).'</h4>';
         }
 
+        $base_url = 'index.php?sec=gservers&sec2=godmode/servers/plugin';
+        $setup_url = $base_url.'&filemanager=1&tab=Attachments';
+        $tab = get_parameter('tab', null);
+        $tabs = [
+            'list'    => [
+                'text'   => '<a href="'.$base_url.'">'.html_print_image(
+                    'images/eye_show.png',
+                    true,
+                    [
+                        'title' => __('Plugins'),
+                        'class' => 'invert_filter',
+                    ]
+                ).'</a>',
+                'active' => (bool) ($tab != 'Attachments'),
+            ],
+            'options' => [
+                'text'   => '<a href="'.$setup_url.'">'.html_print_image(
+                    'images/collection.png',
+                    true,
+                    [
+                        'title' => __('Attachments'),
+                        'class' => 'invert_filter',
+                    ]
+                ).'</a>',
+                'active' => (bool) ($tab == 'Attachments'),
+            ],
+        ];
+
+        if ($tab === 'Attachments') {
+            $helpHeader  = '';
+            $titleHeader = __('Index of attachment/plugin');
+        } else {
+            $helpHeader  = 'servers_ha_clusters_tab';
+            $titleHeader = __('Plug-ins registered on %s', get_product_name());
+        }
+
+        // Header.
+        ui_print_standard_header(
+            $titleHeader,
+            'images/gm_servers.png',
+            false,
+            $helpHeader,
+            false,
+            $tabs,
+            [
+                [
+                    'link'  => '',
+                    'label' => __('Servers'),
+                ],
+                [
+                    'link'  => '',
+                    'label' => __('Plugins'),
+                ],
+            ]
+        );
+
         $real_directory = realpath($config['homedir'].'/'.$directory);
 
 
@@ -310,7 +310,7 @@ if ($filemanager) {
         filemanager_file_explorer(
             $real_directory,
             $directory,
-            'index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$id_plugin,
+            'index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$id_plugin.'&tab=Attachments',
             $fallback_directory,
             true,
             false,