This commit is contained in:
grandeljay 2022-06-14 14:52:19 +02:00
parent e2ffff94b9
commit 3c14a927f4
5 changed files with 26 additions and 19 deletions

View file

@ -1,7 +1,7 @@
<?php
/**
* index.php
* wishthis - Make a wish
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/

View file

@ -2,6 +2,8 @@
/**
* Blog
*
* @category API
*/
namespace wishthis;

View file

@ -3,7 +3,7 @@
/**
* Various statistics
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
* @category API
*/
namespace wishthis;
@ -37,8 +37,10 @@ switch ($_SERVER['REQUEST_METHOD']) {
}
} else {
$count = $database
->query('SELECT COUNT(`id`) AS "count"
FROM `' . $_GET['table'] . '`;')
->query(
'SELECT COUNT(`id`) AS "count"
FROM `' . $_GET['table'] . '`;'
)
->fetch();
$response['data'] = $count;

View file

@ -1,9 +1,9 @@
<?php
/**
* url.php
* URL
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
* @category API
*/
namespace wishthis;

View file

@ -1,9 +1,9 @@
<?php
/**
* wishes.php
* Wishes
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
* @category API
*/
namespace wishthis;
@ -175,20 +175,22 @@ switch ($_SERVER['REQUEST_METHOD']) {
$status = time();
}
$database->query('UPDATE `wishes`
SET `status` = "' . $status . '"
WHERE `id` = ' . $_PUT['wish_id'] . '
;');
$database->query(
'UPDATE `wishes`
SET `status` = "' . $status . '"
WHERE `id` = ' . $_PUT['wish_id'] . ';'
);
$response['success'] = true;
} elseif (isset($_PUT['wish_url_current'], $_PUT['wish_url_proposed'])) {
/**
* Update Wish URL
*/
$database->query('UPDATE `wishes`
SET `url` = "' . $_PUT['wish_url_proposed'] . '"
WHERE `url` = "' . $_PUT['wish_url_current'] . '"
;');
$database->query(
'UPDATE `wishes`
SET `url` = "' . $_PUT['wish_url_proposed'] . '"
WHERE `url` = "' . $_PUT['wish_url_current'] . '";'
);
$response['success'] = true;
}
@ -198,9 +200,10 @@ switch ($_SERVER['REQUEST_METHOD']) {
parse_str(file_get_contents("php://input"), $_DELETE);
if (isset($_DELETE['wish_id'])) {
$database->query('DELETE FROM `wishes`
WHERE `id` = ' . $_DELETE['wish_id'] . '
;');
$database->query(
'DELETE FROM `wishes`
WHERE `id` = ' . $_DELETE['wish_id'] . ';'
);
}
$response['success'] = true;