UID\" ORDER BY Date DESC" ); } function archiveLists() : array { return Table::_get_all( 'ArchiveLists', 'Database\ArchiveList', "WHERE AuthorUID = \"$this->UID\"" ); } function icon() { global $VIEWS_DIR; // https://tabler.io/icons if ($this->Role === 'User') { include $VIEWS_DIR . '/img/user.svg'; } else { include $VIEWS_DIR . '/img/user-star.svg'; } } private static $AnonUID = 1; function update(string $Username = null, string $Password = null, string $Role = null) { // Applicable to Anon user if ($this->Password === '') { throw new Exception('Not modifying system account!'); } $Username = $Username ?? $this->Username; $Password = ($Password === null) ? $this->Password : password_hash($Password, PASSWORD_BCRYPT); $Role = $Role ?? $this->Role; Table::_update( 'Users', "Username = \"$Username\", Password = \"$Password\", Role = \"$Role\"", "UID = \"$this->UID\"" ); } function delete() { // Applicable to Anon user if ($this->Password === '') { throw new Exception('Not deleting system account!'); } Table::_update( 'Webpages', 'RequesterUID = "' . self::$AnonUID . '"', "RequesterUID = \"$this->UID\"" ); Table::_update( 'ArchiveLists', 'AuthorUID = "' . self::$AnonUID . '"', "AuthorUID = \"$this->UID\"" ); Table::_delete( 'Users', "UID = \"$this->UID\"" ); } }