]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Add start of Notes functionality
authorValerie Pond <redacted>
Mon, 8 Jul 2024 02:33:18 +0000 (10:33 +0800)
committerValerie Pond <redacted>
Mon, 8 Jul 2024 02:33:18 +0000 (10:33 +0800)
Classes/class-notes.php [new file with mode: 0644]
inc/common.php
settings/general.php

diff --git a/Classes/class-notes.php b/Classes/class-notes.php
new file mode 100644 (file)
index 0000000..ca9f604
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+
+/* Make notes against nicks, IPs and account names. */
+
+class Notes { // OKAY CLASS GET YOUR NOTEPAD OUT
+       /**
+        * Find function for Notes
+        * @param array $query The query to search for -- ["ip" => "127.0.0.1", "nick" => "bob", "account" => "bob", "id" => "lol] 
+        * @return array|NULL Returns an array of objects (notes)
+        */
+       public static function find(array $query) : array|NULL
+       {
+               global $config;
+               read_config_db();
+               if (!isset($config['notes']))
+                       return NULL;
+
+               $notes = [];
+               foreach ($query as $key => $value)
+               {       
+                       foreach (get_config("notes") as $nkey => $nvalue)
+                       {
+                               if ($value != $nvalue)
+                                       continue;
+                                       
+                               $note = (object)[];
+                               $note->id = $nkey;
+                               $note->type = $key;
+                               $note->data - $value;
+                               $note->note = $nvalue;
+                               $notes[] = $note;
+                       }
+               }
+               return !empty($notes) ? $notes : NULL;
+       }
+       
+       /**
+        * Add a note to one or more peices of data
+        * @param array ["ip" => "127.0.0.1"]
+        * @param string $note "This is a note"
+        * @return void
+        */
+       public static function add(array $params, string $note)
+       {
+               global $config;
+               read_config_db();
+               foreach ($params as $key => $value)
+               {
+                       $id = md5(random_bytes(20)); // note ID (for linking)
+                       $config['notes'][$key][$value][$id] = $note;
+               }
+               write_config(); // write db
+       } 
+       
+       public static function delete_by_id(string $id)
+       {
+               global $config;
+               read_config_db();
+               if (!isset($config['notes']))
+                       return NULL;
+
+               foreach ($config['notes'] as $nkey => $nvalue)
+                       foreach ($nvalue as $key => $value)
+                               if ($value == $id)
+                               {       
+                                       unset($config['notes'][$nkey][$key]);
+                                       break;
+                               }
+
+               write_config('notes');
+       }
+}
index 96721e6bf05e495d82d9b615096a2df765bb7489..3bd78236fd34fc2e6917b7753dbac905c912fcd7 100644 (file)
@@ -466,6 +466,7 @@ require_once UPATH . "/Classes/class-log.php";
 require_once UPATH . "/Classes/class-message.php";
 require_once UPATH . "/Classes/class-rpc.php";
 require_once UPATH . "/Classes/class-paneluser.php";
+require_once UPATH . "/Classes/class-notes.php";
 require_once UPATH . "/Classes/class-plugins.php";
 
 /* Do various checks and reading, except during setup step 1. */
index 0cee9c833a77fd6a42c96611824b9172e92fe8bc..8a0c3aec52c9fb4f9db5ecafa0a85a59beb77fc8 100644 (file)
@@ -64,6 +64,34 @@ if (isset($_POST['submit']) && $canEdit)
 do_log("\$_POST", $_POST);
 do_log("\$_FILES", $_FILES);
 ?>
+<style>
+.color-circle.selected {
+    border: 2px solid #fff; /* Optional: Add a border to highlight selected option */
+}
+
+.color-option input[type="radio"]:checked + .color-circle {
+    border: 2px solid #fff; /* Optional: Add a border to highlight selected option */
+}
+
+.color-option .color-circle {
+    width: 30px; /* Adjust size as needed */
+    height: 30px; /* Adjust size as needed */
+    border-radius: 50%; /* Ensure it's circular */
+}
+
+@media (max-width: 600px) {
+    .color-option {
+        flex-basis: 50%; /* Two items per row on smaller screens */
+    }
+}
+
+@media (max-width: 400px) {
+    .color-option {
+        flex-basis: 100%; /* One item per row on very small screens */
+    }
+}
+</style>
+
 <h4>General Settings</h4>
 <br>
 <form method="post" enctype="multipart/form-data">
@@ -83,6 +111,133 @@ do_log("\$_FILES", $_FILES);
     </div>
     <i>Enabling this will likely make your webpanel more difficult to use</i>
 </div>
+<div class="card m-1" style="padding-left:20px;padding-right:20px;padding-top:5px;padding-bottom:10px;max-width:fit-content">
+    <h6>Themes</h6>
+    <div class="d-flex" id="color-options">
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient1" class="color-input" checked>
+            <div class="color-circle selected" style="background: linear-gradient(to bottom, #4a0000, #6b0000);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient2" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to top right, #3c4858, #1f2833);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient3" class="color-input">
+            <div class="color-circle" style="background: radial-gradient(circle, #3f0f3f, #1a0643);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient4" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to right, #443d6e, #191b3f);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient5" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom, #1a1a1a, #333333);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient6" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(135deg, #4d194d, #1a0643);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient7" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #1a1a1a, #333333);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient8" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #331a33, #191b3f);"></div>
+        </label>
+        <!-- Extend with additional gradients -->
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient9" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom, #400000, #800000);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient10" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to top right, #363636, #1f1f1f);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient11" class="color-input">
+            <div class="color-circle" style="background: radial-gradient(circle, #730073, #400040);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient12" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to right, #4c4c99, #1a1a66);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient13" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom, #2e2e2e, #4d4d4d);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient14" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(135deg, #732673, #400040);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient15" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #2e2e2e, #4d4d4d);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient16" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #662266, #330033);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient17" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #993399, #660066);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient18" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #4c4c4c, #666666);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient19" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #660066, #330033);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient20" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #993399, #660066);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient21" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #4c4c4c, #666666);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient22" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #4c4c99, #191966);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient23" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #4c4c99, #191966);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient24" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #330000, #191966);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient25" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #4c4c99, #191966);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient26" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #330000, #191966);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient27" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #ffccff, #ff66ff);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient28" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #ff66ff, #ff99ff);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient29" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #ff66ff, #ffccff);"></div>
+        </label>
+        <label class="color-option">
+            <input type="radio" name="color" value="gradient30" class="color-input">
+            <div class="color-circle" style="background: linear-gradient(to bottom right, #ffccff, #ff66ff);"></div>
+        </label>
+    </div>
+</div>
+    
 <script>
     const iframe =document.getElementById('frame');
     iframe.contentWindow.location.reload(true);