From 288af5af9c504397916d7f680551672a5b91100f Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 31 Oct 2018 20:20:10 -0400 Subject: Add gif image support Adds 'image/gif' as an allowed mimetype for images. The image module is also updated to expect this new type. For background images, animated gifs will work properly. For head images, the cropping process truncates the image to only one frame; this is probably for the best. Signed-off-by: Malf Furious --- app/class/image.php | 2 ++ app/class/obj.class.php | 1 + 2 files changed, 3 insertions(+) (limited to 'app/class') diff --git a/app/class/image.php b/app/class/image.php index 6b73cae..f4c639f 100644 --- a/app/class/image.php +++ b/app/class/image.php @@ -23,10 +23,12 @@ $_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; +$_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; $_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/png'] = "imagepng"; +$_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; /* * Open the given image and crop it, such that the result is a square diff --git a/app/class/obj.class.php b/app/class/obj.class.php index 850184c..7764888 100644 --- a/app/class/obj.class.php +++ b/app/class/obj.class.php @@ -30,6 +30,7 @@ class obj extends table "image/jpeg", "image/jpg", "image/png", + "image/gif", ); /* -- cgit v1.2.3 From 175020d9acd5742d3a3cea4aa8e427ecc046b14b Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 31 Oct 2018 20:29:11 -0400 Subject: Add bmp image support Adds 'image/bmp' as an allowed mimetype for images. The image module is also updated to expect this new type. Signed-off-by: Malf Furious --- app/class/image.php | 2 ++ app/class/obj.class.php | 1 + 2 files changed, 3 insertions(+) (limited to 'app/class') diff --git a/app/class/image.php b/app/class/image.php index f4c639f..591e026 100644 --- a/app/class/image.php +++ b/app/class/image.php @@ -24,11 +24,13 @@ $_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; $_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; +$_IMG_OPEN_FUNCS['image/bmp'] = "imagecreatefrombmp"; $_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/png'] = "imagepng"; $_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; +$_IMG_WRITE_FUNCS['image/bmp'] = "imagebmp"; /* * Open the given image and crop it, such that the result is a square diff --git a/app/class/obj.class.php b/app/class/obj.class.php index 7764888..81a0a27 100644 --- a/app/class/obj.class.php +++ b/app/class/obj.class.php @@ -31,6 +31,7 @@ class obj extends table "image/jpg", "image/png", "image/gif", + "image/bmp", ); /* -- cgit v1.2.3 From 2cf8d6be4191512567dc7498d3163627aacd1cf0 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 31 Oct 2018 21:23:27 -0400 Subject: Fix bug in image support Adds 'image/x-ms-bmp' as an allowed mimetype for images, and is equivalent to 'image/bmp'. The image module is also updated to expect this new type. I found an image of mine that, when uploaded, PHP thought was 'image/bmp', so it was allowed. However, when cropping, PHP though it was 'image/x-ms-bmp' and failed to lookup a loading/writing function. Signed-off-by: Malf Furious --- app/class/image.php | 22 ++++++++++++---------- app/class/obj.class.php | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'app/class') diff --git a/app/class/image.php b/app/class/image.php index 591e026..62999aa 100644 --- a/app/class/image.php +++ b/app/class/image.php @@ -20,17 +20,19 @@ /* * Mappings from image MIME types to PHP open/write functions */ -$_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; -$_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; -$_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; -$_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; -$_IMG_OPEN_FUNCS['image/bmp'] = "imagecreatefrombmp"; +$_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; +$_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; +$_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; +$_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; +$_IMG_OPEN_FUNCS['image/bmp'] = "imagecreatefrombmp"; +$_IMG_OPEN_FUNCS['image/x-ms-bmp'] = "imagecreatefrombmp"; -$_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; -$_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; -$_IMG_WRITE_FUNCS['image/png'] = "imagepng"; -$_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; -$_IMG_WRITE_FUNCS['image/bmp'] = "imagebmp"; +$_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; +$_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; +$_IMG_WRITE_FUNCS['image/png'] = "imagepng"; +$_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; +$_IMG_WRITE_FUNCS['image/bmp'] = "imagebmp"; +$_IMG_WRITE_FUNCS['image/x-ms-bmp'] = "imagebmp"; /* * Open the given image and crop it, such that the result is a square diff --git a/app/class/obj.class.php b/app/class/obj.class.php index 81a0a27..353d617 100644 --- a/app/class/obj.class.php +++ b/app/class/obj.class.php @@ -32,6 +32,7 @@ class obj extends table "image/png", "image/gif", "image/bmp", + "image/x-ms-bmp", ); /* -- cgit v1.2.3 From 81ba021468e38de09ac292115bb2f15c9d4deec0 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Mon, 5 Nov 2018 03:10:32 -0500 Subject: Add function pad::getClosedIssues_ordByClosed() This returns an array of all issues which directly parent the pad object. These are the pad's closed issues. Most recently closed issues are first in the array. Signed-off-by: Malf Furious --- app/class/pad.class.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/class') diff --git a/app/class/pad.class.php b/app/class/pad.class.php index dcf2b32..0c69385 100644 --- a/app/class/pad.class.php +++ b/app/class/pad.class.php @@ -108,6 +108,24 @@ class pad extends obj $stage->saveObj(); $this->saveObj(); } + + /* + * Get an array of all closed issues under this pad. Ordered by + * datetime closed. + */ + public function getClosedIssues_ordByClosed() : array + { + $query = "SELECT o.guid FROM objects o JOIN issues i ON o.guid = i.guid " . + "WHERE o.parent = '" . database::esc($this->guid) . "' ORDER BY i.closed DESC"; + $res = database::query($query); + + $issues = array(); + + foreach ($res as $i) + $issues[] = new issue($i['guid']); + + return $issues; + } } ?> -- cgit v1.2.3 From 762208664a9173bc9507a66fbd0c8020e382db88 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 10 Nov 2018 09:12:01 -0500 Subject: Add function agent::getContainedUsers() This function helps further abstract agents. We want to get all users belonging to a pad that is owned by a group, or more specifically - an agent. If this agent is a user, that user is our only user to collect. If this agent is a group, we want to capture _it's_ owner along with all of it's members. Signed-off-by: Malf Furious --- app/class/agent.class.php | 7 +++++++ app/class/group.class.php | 11 +++++++++++ app/class/user.class.php | 9 +++++++++ 3 files changed, 27 insertions(+) (limited to 'app/class') diff --git a/app/class/agent.class.php b/app/class/agent.class.php index 4c75f0b..4651a10 100644 --- a/app/class/agent.class.php +++ b/app/class/agent.class.php @@ -89,6 +89,13 @@ abstract class agent extends obj return false; } + /* + * Get all contained users. For users, this is an array containing + * only $this. For groups, this is an array containing the owner + * and all members. + */ + public abstract function getContainedUsers() : array; + /* * Send an email message to this agent using stored configuration * parameters. If config is not established, delivery is not diff --git a/app/class/group.class.php b/app/class/group.class.php index 1191d71..600fb6d 100644 --- a/app/class/group.class.php +++ b/app/class/group.class.php @@ -63,6 +63,17 @@ class group extends agent return $group; } + /* + * Get all contained users. This is an array of all members and + * the group owner. + */ + public function getContainedUsers() : array + { + $cus = $this->getMembers(); + $cus[] = $this->getOwner(); + return $cus; + } + /* * Send an email message to this group using stored configuration * parameters. If config is not established, delivery is not diff --git a/app/class/user.class.php b/app/class/user.class.php index 90aac44..231111d 100644 --- a/app/class/user.class.php +++ b/app/class/user.class.php @@ -293,6 +293,15 @@ class user extends agent return $groups; } + /* + * Get all contained users. This is just an array containing + * the user object. + */ + public function getContainedUsers() : array + { + return array($this); + } + /* * Send an email message to this user using stored configuration * parameters. If config is not established, delivery is not -- cgit v1.2.3 From 37441ced402a3e29b6919891e38bf1c87831e8e3 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 10 Nov 2018 22:42:04 -0500 Subject: Bump version number Signed-off-by: Malf Furious --- app/class/globals.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/class') diff --git a/app/class/globals.php b/app/class/globals.php index 74635d7..8a6efd7 100644 --- a/app/class/globals.php +++ b/app/class/globals.php @@ -19,7 +19,7 @@ require_once "class/obj.class.php"; * These are utility functions and constants for the Scrott application. */ -define("__VERSION__", "v0.1"); +define("__VERSION__", "v0.2"); /* * These global variables are arrays of strings logged by Scrott business -- cgit v1.2.3