summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-11 07:33:15 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-11 07:33:15 +0200
commit1c415919cb72c218d9491d8cdcf6498142b23f68 (patch)
treec1425c3e4793dee1dc93c9f8b2c83a5cbd8718fe /src
parentb0665b03d105eb1e001cb1dd795bd94961471499 (diff)
downloadsemanticscuttle-1c415919cb72c218d9491d8cdcf6498142b23f68.tar.gz
semanticscuttle-1c415919cb72c218d9491d8cdcf6498142b23f68.tar.bz2
deleting ssl client certificates from profile page works now
Diffstat (limited to 'src')
-rw-r--r--src/SemanticScuttle/Service/User/SslClientCert.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/SemanticScuttle/Service/User/SslClientCert.php b/src/SemanticScuttle/Service/User/SslClientCert.php
index b6545df..f277994 100644
--- a/src/SemanticScuttle/Service/User/SslClientCert.php
+++ b/src/SemanticScuttle/Service/User/SslClientCert.php
@@ -181,6 +181,38 @@ class SemanticScuttle_Service_User_SslClientCert extends SemanticScuttle_DbServi
}
+
+ /**
+ * Fetches the certificate with the given ID from database.
+ *
+ * @param integer $id Certificate ID in database
+ *
+ * @return SemanticScuttle_Model_User_SslClientCert Certificate object
+ * or null if not found
+ */
+ public function getCert($id)
+ {
+ $query = 'SELECT * FROM ' . $this->getTableName()
+ . ' WHERE id = ' . (int)$id;
+ if (!($dbresult = $this->db->sql_query($query))) {
+ message_die(
+ GENERAL_ERROR, 'Could not load SSL client certificate',
+ '', __LINE__, __FILE__, $query, $this->db
+ );
+ return null;
+ }
+
+ if ($row = $this->db->sql_fetchrow($dbresult)) {
+ $cert = SemanticScuttle_Model_User_SslClientCert::fromDb($row);
+ } else {
+ $cert = null;
+ }
+ $this->db->sql_freeresult($dbresult);
+ return $cert;
+ }
+
+
+
/**
* Fetches all registered certificates for the user from the database
* and returns it.
@@ -234,7 +266,7 @@ class SemanticScuttle_Service_User_SslClientCert extends SemanticScuttle_DbServi
}
$query = 'DELETE FROM ' . $this->getTableName()
- .' WHERE uId = ' . $id;
+ .' WHERE id = ' . $id;
if (!($dbresult = $this->db->sql_query($query))) {
message_die(