summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-02-06 02:28:20 -0500
committerMalf Furious <m@lfurio.us>2017-02-06 02:28:20 -0500
commit861c98387001f99fe0e178d8202d2c3ec40538f0 (patch)
tree8f2c4c69529264166a56f5986fd711b4700cb673 /app
parent476192ca8fa2053af74a7e7f5e4006c83c8d0cad (diff)
downloadscrott-861c98387001f99fe0e178d8202d2c3ec40538f0.tar.gz
scrott-861c98387001f99fe0e178d8202d2c3ec40538f0.zip
Update function signatures for table class
Various function (and their usages) in the table class have been updated to be static class function.
Diffstat (limited to 'app')
-rw-r--r--app/class/table.class.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/class/table.class.php b/app/class/table.class.php
index 0b9a53c..2759176 100644
--- a/app/class/table.class.php
+++ b/app/class/table.class.php
@@ -50,7 +50,7 @@ abstract class table
{
$guid = database::esc($guid);
- if (!$this->isGUID($guid))
+ if (!self::isGUID($guid))
throw new Exception("GUID " . $guid . " does not exist");
foreach ($this->fields as $tbl => $flds)
@@ -77,7 +77,7 @@ abstract class table
/* update existing object */
if (isset($this->guid))
{
- $this->updated = $this->getCurrentTimestamp();
+ $this->updated = self::getCurrentTimestamp();
foreach ($this->fields as $tbl => $flds)
{
@@ -105,8 +105,8 @@ abstract class table
/* create new object */
else
{
- $this->guid = $this->getNewGUID();
- $this->created = $this->getCurrentTimestamp();
+ $this->guid = self::getNewGUID();
+ $this->created = self::getCurrentTimestamp();
$this->updated = $this->created;
foreach ($this->fields as $tbl => $flds)
@@ -166,7 +166,7 @@ abstract class table
/*
* Get a random sha256 blob, returned as a hexadecimal string
*/
- public function getBlob() : string
+ public static function getBlob() : string
{
return hash("sha256", openssl_random_pseudo_bytes(64));
}
@@ -174,7 +174,7 @@ abstract class table
/*
* Get current timestamp as a string for object database purposes
*/
- private function getCurrentTimestamp() : string
+ private static function getCurrentTimestamp() : string
{
$query = "SELECT now() AS stamp";
$res = database::query($query);
@@ -184,7 +184,7 @@ abstract class table
/*
* Check whether the given GUID exists
*/
- private function isGUID(string $guid) : bool
+ private static function isGUID(string $guid) : bool
{
$guid = database::esc($guid);
$query = "SELECT guid FROM objects WHERE guid = '" . $guid . "'";
@@ -195,10 +195,10 @@ abstract class table
/*
* Get a new, unique GUID for a new system object
*/
- private function getNewGUID() : string
+ private static function getNewGUID() : string
{
- do $guid = substr($this->getBlob(), 0, 8);
- while ($this->isGUID($guid));
+ do $guid = substr(self::getBlob(), 0, 8);
+ while (self::isGUID($guid));
return $guid;
}
}