mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-10-13 18:04:54 +02:00
Fix #263 gallery system using imgur
setup tutorial: https://github.com/Znote/ZnoteAAC/wiki/IMGUR-powered-Gallery-page
This commit is contained in:
@@ -40,7 +40,8 @@ CREATE TABLE IF NOT EXISTS `znote_images` (
|
||||
`desc` text NOT NULL,
|
||||
`date` int NOT NULL,
|
||||
`status` int NOT NULL,
|
||||
`image` varchar(30) NOT NULL,
|
||||
`image` varchar(50) NOT NULL,
|
||||
`delhash` varchar(30) NOT NULL,
|
||||
`account_id` int NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
@@ -6,21 +6,22 @@
|
||||
// Fetch Images
|
||||
function fetchImages($status) {
|
||||
$status = (int)$status;
|
||||
return mysql_select_multi("SELECT `id`, `title`, `desc`, `date`, `status`, `image`, `account_id` FROM znote_images WHERE `status`='$status' ORDER BY `date` DESC;");
|
||||
return mysql_select_multi("SELECT `id`, `title`, `desc`, `date`, `status`, `image`, `delhash`, `account_id` FROM znote_images WHERE `status`='$status' ORDER BY `date` DESC;");
|
||||
}
|
||||
|
||||
// Insert image data
|
||||
function insertImage($account_id, $title, $desc, $image) {
|
||||
function insertImage($account_id, $title, $desc, $image, $image_delete) {
|
||||
$title = sanitize($title);
|
||||
$desc = sanitize($desc);
|
||||
$image = sanitize($image);
|
||||
$image_delete = sanitize($image_delete);
|
||||
$account_id = (int)$account_id;
|
||||
$time = time();
|
||||
|
||||
// Insert only if image dosn't already exist there
|
||||
$exist = mysql_select_single("SELECT `id` FROM `znote_images` WHERE `image`='$image' LIMIT 1;");
|
||||
if ($exist === false) {
|
||||
mysql_insert("INSERT INTO `znote_images` (`title`, `desc`, `date`, `status`, `image`, `account_id`) VALUES ('$title', '$desc', '$time', '1', '$image', '$account_id');");
|
||||
mysql_insert("INSERT INTO `znote_images` (`title`, `desc`, `date`, `status`, `image`, `delhash`, `account_id`) VALUES ('$title', '$desc', '$time', '1', '$image', '$image_delete', '$account_id');");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user