summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2008-10-17 13:54:27 +0000
committerMax Kremmel <xing@synapse.plus.com>2008-10-17 13:54:27 +0000
commit438301705bc9f91ed309bfdd621f49dfc8fec18d (patch)
tree4d762bfa54c739e89e5723ce5ba0748295b997f6
parente5be71aed8f5b77f67ed279316245d4eaacd207b (diff)
downloadusers-438301705bc9f91ed309bfdd621f49dfc8fec18d.tar.gz
users-438301705bc9f91ed309bfdd621f49dfc8fec18d.tar.bz2
users-438301705bc9f91ed309bfdd621f49dfc8fec18d.zip
during install we create the root user who has root@localhost as email address - we ignore that to avoid error messages
-rw-r--r--BitUser.php153
1 files changed, 7 insertions, 146 deletions
diff --git a/BitUser.php b/BitUser.php
index 5bd8498..ad9daa1 100644
--- a/BitUser.php
+++ b/BitUser.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.196 2008/10/16 10:22:41 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.197 2008/10/17 13:54:27 squareing Exp $
*
* Lib for user administration, groups and permissions
* This lib uses pear so the constructor requieres
@@ -12,7 +12,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitUser.php,v 1.196 2008/10/16 10:22:41 squareing Exp $
+ * $Id: BitUser.php,v 1.197 2008/10/17 13:54:27 squareing Exp $
* @package users
*/
@@ -42,7 +42,7 @@ define( "ACCOUNT_DISABLED", -6 );
* Class that holds all information for a given user
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.196 $
+ * @version $Revision: 1.197 $
* @package users
* @subpackage BitUser
*/
@@ -353,7 +353,10 @@ class BitUser extends LibertyMime {
$errors = array();
}
- if( !validate_email_syntax( $pEmail ) ) {
+ // during install we have root@localhost as email address. we'll ignore that here.
+ if( $pEmail == 'root@localhost' ) {
+ // nothing to do
+ } elseif( !validate_email_syntax( $pEmail ) ) {
$errors['email'] = 'The email address "'.$pEmail.'" is invalid.';
} elseif( !empty( $this ) && is_object( $this ) && $this->userExists( array( 'email' => $pEmail ) ) ) {
$errors['email'] = 'The email address "'.$pEmail.'" has already been registered.';
@@ -1846,148 +1849,6 @@ class BitUser extends LibertyMime {
}
// }}}
- // {{{ ==================== Watches ====================
- // TODO: clean up all watch functions. these are old and messy. - xing - Thursday Oct 16, 2008 11:07:55 CEST
- /**
- * storeWatch
- *
- * @param array $pEvent
- * @param array $pObject
- * @param array $pType
- * @param array $pTitle
- * @param array $pUrl
- * @access public
- * @return TRUE on success, FALSE on failure
- */
- function storeWatch( $pEvent, $pObject, $pType, $pTitle, $pUrl ) {
- global $userlib;
- if( $this->isValid() ) {
- $hash = md5( uniqid( '.' ));
- $query = "DELETE FROM `".BIT_DB_PREFIX."users_watches` WHERE `user_id`=? AND `event`=? AND `object`=?";
- $this->mDb->query($query,array( $this->mUserId, $pEvent, $pObject ) );
- $query = "INSERT INTO `".BIT_DB_PREFIX."users_watches`(`user_id` ,`event` ,`object` , `email`, `hash`, `watch_type`, `title`, `url`) VALUES(?,?,?,?,?,?,?,?)";
- $this->mDb->query( $query, array( $this->mUserId, $pEvent, $pObject, $this->mInfo['email'], $hash, $pType, $pTitle, $pUrl ) );
- return TRUE;
- }
- }
-
- /**
- * getWatches
- *
- * @param string $pEvent
- * @access public
- * @return TRUE on success, FALSE on failure
- */
- function getWatches( $pEvent = '' ) {
- $ret = NULL;
- if( $this->isValid() ) {
- $mid = '';
- $bindvars=array( $this->mUserId );
- if ($pEvent) {
- $mid = " and `event`=? ";
- $bindvars[]=$pEvent;
- }
-
- $query = "select * from `".BIT_DB_PREFIX."users_watches` where `user_id`=? $mid";
- $result = $this->mDb->query($query,$bindvars);
- $ret = array();
-
- while ($res = $result->fetchRow()) {
- $ret[] = $res;
- }
- }
- return $ret;
- }
-
- /**
- * getEventWatches
- *
- * @param array $pEvent
- * @param array $object
- * @access public
- * @return TRUE on success, FALSE on failure
- */
- function getEventWatches( $pEvent, $pObject ) {
- $ret = NULL;
- if( $this->isValid() ) {
- $query = "SELECT * FROM `".BIT_DB_PREFIX."users_watches` WHERE `user_id`=? AND `event`=? AND `object`=?";
- $result = $this->mDb->query($query,array( $this->mUserId, $pEvent, $pObject ) );
- if ( $result->numRows() ) {
- $ret = $result->fetchRow();
- }
- }
- return $ret;
- }
-
- /**
- * get_event_watches
- *
- * @param array $pEvent
- * @param array $pObject
- * @access public
- * @return TRUE on success, FALSE on failure
- */
- function get_event_watches( $pEvent, $pObject ) {
- $ret = array();
-
- $query = "select * from `".BIT_DB_PREFIX."users_watches` tw INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON ( tw.`user_id`=uu.`user_id` ) where `event`=? and `object`=?";
- $result = $this->mDb->query( $query,array( $pEvent,$pObject ));
-
- if( !$result->numRows() ) {
- return $ret;
- }
-
- while ($res = $result->fetchRow()) {
- $ret[] = $res;
- }
-
- return $ret;
- }
-
- /**
- * remove_user_watch_by_hash
- *
- * @param array $pHash
- * @access public
- * @return TRUE on success, FALSE on failure
- */
- function remove_user_watch_by_hash( $pHash ) {
- $query = "DELETE FROM `".BIT_DB_PREFIX."users_watches` WHERE `hash`=?";
- $this->mDb->query( $query,array( $pHash ));
- }
-
- /**
- * expungeWatch
- *
- * @param array $pEvent
- * @param array $pObject
- * @access public
- * @return TRUE on success, FALSE on failure
- */
- function expungeWatch( $pEvent, $pObject ) {
- if( $this->isValid() ) {
- $query = "DELETE FROM `".BIT_DB_PREFIX."users_watches` WHERE `user_id`=? AND `event`=? AND `object`=?";
- $this->mDb->query( $query, array( $this->mUserId, $pEvent, $pObject ));
- }
- }
-
- /**
- * get_watches_events
- *
- * @access public
- * @return TRUE on success, FALSE on failure
- */
- function get_watches_events() {
- $query = "select distinct `event` from `".BIT_DB_PREFIX."users_watches`";
- $result = $this->mDb->query($query,array());
- $ret = array();
- while ($res = $result->fetchRow()) {
- $ret[] = $res['event'];
- }
- return $ret;
- }
- // }}}
-
/**
* getUserId
*