aboutsummaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service/User.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-25 19:32:48 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-25 19:32:48 +0000
commit09fffebffe9ab1cf7622aa141150157b0746e20d (patch)
treeaf3767fbc293d64c56c7dcf54c584b72cca8195f /src/SemanticScuttle/Service/User.php
parentb38d876fad5d2ba080a87f9667dea4a3a1cca7f5 (diff)
downloadsemanticscuttle-09fffebffe9ab1cf7622aa141150157b0746e20d.tar.gz
semanticscuttle-09fffebffe9ab1cf7622aa141150157b0746e20d.tar.bz2
test if deleting bookmarks works. to do this, we need a new testbase method to create users, plus we need to return the uid when creating a new user. registration process needs to be adopted to that.
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@417 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service/User.php')
-rw-r--r--src/SemanticScuttle/Service/User.php37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php
index bf44c4b..035c9e2 100644
--- a/src/SemanticScuttle/Service/User.php
+++ b/src/SemanticScuttle/Service/User.php
@@ -400,24 +400,47 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
return true;
}
- function addUser($username, $password, $email) {
+ /**
+ * Create a new user in database.
+ * No checks are done in here - you ought to have checked
+ * everything before calling this method!
+ *
+ * @param string $username Username to use
+ * @param string $password Password to use
+ * @param string $email Email to use
+ *
+ * @return mixed Integer user ID if all is well,
+ * boolean false if an error occured
+ */
+ public function addUser($username, $password, $email)
+ {
// Set up the SQL UPDATE statement.
$datetime = gmdate('Y-m-d H:i:s', time());
$password = $this->sanitisePassword($password);
- $values = array('username' => $username, 'password' => $password, 'email' => $email, 'uDatetime' => $datetime, 'uModified' => $datetime);
- $sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
+ $values = array(
+ 'username' => $username,
+ 'password' => $password,
+ 'email' => $email,
+ 'uDatetime' => $datetime,
+ 'uModified' => $datetime
+ );
+ $sql = 'INSERT INTO '. $this->getTableName()
+ . ' '. $this->db->sql_build_array('INSERT', $values);
// Execute the statement.
$this->db->sql_transaction('begin');
if (!($dbresult = & $this->db->sql_query($sql))) {
$this->db->sql_transaction('rollback');
- message_die(GENERAL_ERROR, 'Could not insert user', '', __LINE__, __FILE__, $sql, $this->db);
+ message_die(
+ GENERAL_ERROR, 'Could not insert user',
+ '', __LINE__, __FILE__, $sql, $this->db
+ );
return false;
}
+ $uId = $this->db->sql_nextid($dbresult);
$this->db->sql_transaction('commit');
- // Everything worked out, so return true.
- return true;
+ return $uId;
}
function updateUser($uId, $password, $name, $email, $homepage, $uContent) {
@@ -564,7 +587,7 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
*
* @see updateSessionStability()
*/
- publi function isSessionStable()
+ public function isSessionStable()
{
return $_SESSION['sessionStable'] == 1;
}