summaryrefslogtreecommitdiffstats
path: root/app/class
diff options
context:
space:
mode:
Diffstat (limited to 'app/class')
-rw-r--r--app/class/agent.class.php7
-rw-r--r--app/class/globals.php2
-rw-r--r--app/class/group.class.php11
-rw-r--r--app/class/image.php18
-rw-r--r--app/class/obj.class.php3
-rw-r--r--app/class/pad.class.php18
-rw-r--r--app/class/user.class.php9
7 files changed, 61 insertions, 7 deletions
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
@@ -90,6 +90,13 @@ abstract class agent extends obj
}
/*
+ * 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
* attempted. Return status.
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
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
@@ -64,6 +64,17 @@ class group extends agent
}
/*
+ * 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
* attempted. Return status. If any delivery attempts fail, the
diff --git a/app/class/image.php b/app/class/image.php
index 6b73cae..62999aa 100644
--- a/app/class/image.php
+++ b/app/class/image.php
@@ -20,13 +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/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/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 850184c..353d617 100644
--- a/app/class/obj.class.php
+++ b/app/class/obj.class.php
@@ -30,6 +30,9 @@ class obj extends table
"image/jpeg",
"image/jpg",
"image/png",
+ "image/gif",
+ "image/bmp",
+ "image/x-ms-bmp",
);
/*
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;
+ }
}
?>
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
@@ -294,6 +294,15 @@ class user extends agent
}
/*
+ * 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
* attempted. Return status.