]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Make Plugins page and require email for plugins
authorValerie Pond <redacted>
Tue, 7 Feb 2023 01:37:03 +0000 (01:37 +0000)
committerValerie Pond <redacted>
Tue, 7 Feb 2023 01:37:03 +0000 (01:37 +0000)
common.php
plugins.php
plugins/example_plugin/example_plugin.php
plugins/php_mailer/php_mailer.php
plugins/sql_auth/sql_auth.php
settings/plugins.php [new file with mode: 0644]

index b9f40db3decd6acc9b3ffb42240d56a2497ee8af..d134290eb0cb10676f9962ba631e93d0e2b5bfad 100644 (file)
@@ -32,7 +32,10 @@ $pages = Array(
        "Tools" => [
                "IP WHOIS" => "tools/ip-whois.php",
        ],
-       "Settings" => "settings",
+       "Settings" => [
+               "Panel Users" => "settings",
+               "Plugins" => "settings/plugins.php",
+       ],
        
        "News"         => "news.php",
 );
index 969479ec953e8b4238a8b4ef57e6715e42f38da3..de3307e1af6f4d87259ad04e79425dc7d4f5f652 100644 (file)
@@ -55,6 +55,7 @@ class Plugin
        public $version;
        public $description;
        public $handle;
+       public $email;
 
        public $error = NULL;
        function __construct($handle)
@@ -84,6 +85,8 @@ class Plugin
                                        $this->error = "Plugin version not defined";
                                elseif (!isset($plugin->description))
                                        $this->error = "Plugin description not defined";
+                               elseif (!isset($plugin->email))
+                                       $this->error = "Plugin email not defined";
                                else
                                {
                                        $this->handle = $handle;
@@ -91,6 +94,7 @@ class Plugin
                                        $this->author = $plugin->author;
                                        $this->version = $plugin->version;
                                        $this->description = $plugin->description;
+                                       $this->email = $plugin->email;
                                }
                        }
                }
index eeb6e9dd3ab0522ed96705a181d11463675c699d..0ae218fc5d35f1bd4bf0a6c5a18ca90f283ca0f7 100644 (file)
@@ -6,6 +6,7 @@ class example_plugin
        public $author = "Valware";
        public $version = "1.0";
        public $description = "An example plugin to show how to make stuff";
+       public $email = "v.a.pond@outlook.com";
 
        function __construct()
        {
index 24f5de4fb37ada03ce239c5667524043fc39d1fd..226c7eee8658f7fb0e84afb0f538a1bd25a28aef 100644 (file)
@@ -9,6 +9,7 @@ class php_mailer
        public $author = "Valware";
        public $version = "1.0";
        public $description = "Send mail using PHPMailer()";
+       public $email = "v.a.pond@outlook.com";
 
        function __construct()
        {
@@ -41,9 +42,8 @@ class php_mailer
                        $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
 
                        $mail->send();
-                       echo 'Message has been sent';
                } catch (Exception $e) {
-                       echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
+                       die("Could not send mail:". $e);
                }
        }
 
index 122d0f24a5ec649f6cc005c6dfdbb91dfd64c52d..f3ffcf55b28afc9617a7fac7e2c7c221c15dd2b3 100644 (file)
@@ -9,6 +9,7 @@ class sql_auth
        public $author = "Valware";
        public $version = "1.0";
        public $description = "Provides a User Auth and Management Panel with an SQL backend";
+       public $email = "v.a.pond@outlook.com";
 
        function __construct()
        {
diff --git a/settings/plugins.php b/settings/plugins.php
new file mode 100644 (file)
index 0000000..ac574aa
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+require_once "../common.php";
+require_once "../header.php";
+
+
+?>
+
+<h2>Active Plugins</h2>
+<br>
+To load and unload plugins, see the <code>PLUGINS</code> section of your <code>config.php</code><br>
+<br>
+<table class="container-xxl table table-sm table-responsive caption-top table-striped">
+       <thead class="table-primary">
+       <form method="post">
+       <th scope="col">Plugin Name</th>
+       <th scope="col">Handle</th>
+       <th scope="col">Version</th>
+       <th scope="col">Description</th>
+       <th scope="col">Author</th>
+    <th scope="col">Contact</th>
+    
+       </thead>
+       <tbody>
+        <?php
+            foreach(Plugins::$list as $plugin)
+            {
+                echo "<tr>";
+                echo "<td scope=\"col\">".$plugin->name."</td>";
+                echo "<td scope=\"col\"><code>".$plugin->handle."</code></td>";
+                echo "<td scope=\"col\"><code>".$plugin->version."</code></td>";
+                echo "<td scope=\"col\">".$plugin->description."</td>";
+                echo "<td scope=\"col\">".$plugin->author."</td>";
+                echo "<td scope=\"col\"><a href='mailto:$plugin->email'>".$plugin->email."</a></td>";
+                echo "</tr>";
+            }
+        ?>
+    </tbody>
+</table>
\ No newline at end of file