Skip to content

Commit

Permalink
fix: rename category after adding and sort order of categories
Browse files Browse the repository at this point in the history
fix: allow redirects on logo search
  • Loading branch information
ellite committed Mar 17, 2024
1 parent e05218e commit ae73db7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
14 changes: 13 additions & 1 deletion endpoints/categories/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@

if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
if (isset($_GET['action']) && $_GET['action'] == "add") {
$stmt = $db->prepare('SELECT MAX("order") as maxOrder FROM categories');
$result = $stmt->execute();
$row = $result->fetchArray(SQLITE3_ASSOC);
$maxOrder = $row['maxOrder'];

if ($maxOrder === NULL) {
$maxOrder = 0;
}

$order = $maxOrder + 1;

$categoryName = "Category";
$sqlInsert = "INSERT INTO categories (name) VALUES (:name)";
$sqlInsert = 'INSERT INTO categories ("name", "order") VALUES (:name, :order)';
$stmtInsert = $db->prepare($sqlInsert);
$stmtInsert->bindParam(':name', $categoryName, SQLITE3_TEXT);
$stmtInsert->bindParam(':order', $order, SQLITE3_INTEGER);
$resultInsert = $stmtInsert->execute();

if ($resultInsert) {
Expand Down
1 change: 1 addition & 0 deletions endpoints/logos/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $backupUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$envVars = array_change_key_case($_SERVER, CASE_LOWER);
$httpProxy = isset($envVars['http_proxy']) ? $envVars['http_proxy'] : null;
$httpsProxy = isset($envVars['https_proxy']) ? $envVars['https_proxy'] : null;
Expand Down
2 changes: 2 additions & 0 deletions endpoints/payments/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

// Convert all environment variable keys to lowercase
$envVars = array_change_key_case($_SERVER, CASE_LOWER);
Expand All @@ -29,6 +30,7 @@
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $backupUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$envVars = array_change_key_case($_SERVER, CASE_LOWER);
$httpProxy = isset($envVars['http_proxy']) ? $envVars['http_proxy'] : null;
$httpsProxy = isset($envVars['https_proxy']) ? $envVars['https_proxy'] : null;
Expand Down
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v1.16.2";
$version = "v1.16.3";
?>
4 changes: 2 additions & 2 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function addCategoryButton(categoryId) {
if(responseData.success) {
const newCategoryId = responseData.categoryId;;
let container = document.getElementById("categories");
let row = document.createElement("li");
let row = document.createElement("div");
row.className = "form-group-inline";
row.dataset.categoryid = newCategoryId;

Expand Down Expand Up @@ -250,7 +250,7 @@ function removeCategory(categoryId) {
function editCategory(categoryId) {
var saveButton = document.querySelector(`div[data-categoryid="${categoryId}"] button[name="save"]`);
var inputElement = document.querySelector(`div[data-categoryid="${categoryId}"] input[name="category"]`);
console.log(saveButton);

saveButton.classList.add("disabled");
saveButton.disabled = true;
if (inputElement) {
Expand Down

0 comments on commit ae73db7

Please sign in to comment.