summaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 22:25:27 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 22:25:27 +0000
commit2444e1257f17c2f2559f7a1504a5b104b6176057 (patch)
tree6ca179016ac4451f1dda2cf3df3d6de97db03abd /src/SemanticScuttle/Service
parent0fcbe3158d60813b8787b9e6663550af5d868d5c (diff)
downloadsemanticscuttle-2444e1257f17c2f2559f7a1504a5b104b6176057.tar.gz
semanticscuttle-2444e1257f17c2f2559f7a1504a5b104b6176057.tar.bz2
fix unfreed sql result and add deleteAll() for users
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@457 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service')
-rw-r--r--src/SemanticScuttle/Service/User.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php
index 8b72274..73b71d6 100644
--- a/src/SemanticScuttle/Service/User.php
+++ b/src/SemanticScuttle/Service/User.php
@@ -368,13 +368,15 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
return false;
}
- if ($row =& $this->db->sql_fetchrow($dbresult)) {
+ $row = $this->db->sql_fetchrow($dbresult);
+ $this->db->sql_freeresult($dbresult);
+
+ if ($row) {
$id = $_SESSION[$this->getSessionKey()] = $row[$this->getFieldName('primary')];
if ($remember) {
$cookie = $id .':'. md5($username.$password);
setcookie($this->cookiekey, $cookie, time() + $this->cookietime, '/');
}
- $this->db->sql_freeresult($dbresult);
return true;
} else {
return false;
@@ -593,6 +595,21 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
}
+
+ /**
+ * Delete all bookmarks.
+ * Mainly used in unit tests.
+ *
+ * @return void
+ */
+ public function deleteAll()
+ {
+ $query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';
+ $this->db->sql_query($query);
+ }
+
+
+
function sanitisePassword($password) {
return sha1(trim($password));
}