]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/user/class_BaseUser.php
Very early write (add) support for file-based stack indexes.
[core.git] / inc / classes / main / user / class_BaseUser.php
index f73696537d3b61be06957766b1516b4fbbf2dfb1..bc7988a4990b744e3aad2234dc951475457ec990 100644 (file)
@@ -26,6 +26,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable {
        const EXCEPTION_USERNAME_NOT_FOUND   = 0x150;
        const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x151;
        const EXCEPTION_USER_PASS_MISMATCH   = 0x152;
+       const EXCEPTION_USER_IS_GUEST        = 0x153;
 
        /**
         * Username of current user
@@ -121,7 +122,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable {
                $exists = FALSE;
 
                // Is a previous result there?
-               if (is_null($this->getResultInstance())) {
+               if (!$this->getResultInstance() instanceof SearchableResult) {
                        // Get a UserDatabaseWrapper instance
                        $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
 
@@ -165,7 +166,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable {
                $exists = FALSE;
 
                // Is a previous result there?
-               if (is_null($this->getResultInstance())) {
+               if (!$this->getResultInstance() instanceof SearchableResult) {
                        // Get a UserDatabaseWrapper instance
                        $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
 
@@ -220,7 +221,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable {
                $matches = FALSE;
 
                // Is a previous result there?
-               if (is_null($this->getResultInstance())) {
+               if ((!$this->getResultInstance() instanceof SearchableResult) || ($this->getResultInstance()->count() == 0)) {
                        // Get a UserDatabaseWrapper instance
                        $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
 
@@ -330,6 +331,32 @@ class BaseUser extends BaseFrameworkSystem implements Updateable {
                // Remember the update in database result
                $this->getResultInstance()->add2UpdateQueue($updateInstance);
        }
+
+       /**
+        * Checks whether the user status is 'confirmed'
+        *
+        * @return      $isConfirmed    Whether the user status is 'confirmed'
+        */
+       public function isConfirmed () {
+               // Determine it
+               $isConfirmed = ($this->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) == $this->getConfigInstance()->getConfigEntry('user_status_confirmed'));
+
+               // Return it
+               return $isConfirmed;
+       }
+
+       /**
+        * Checks whether the user status is 'guest'
+        *
+        * @return      $isGuest        Whether the user status is 'guest'
+        */
+       public function isGuest () {
+               // Determine it
+               $isGuest = ($this->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) == $this->getConfigInstance()->getConfigEntry('user_status_guest'));
+
+               // Return it
+               return $isGuest;
+       }
 }
 
 // [EOF]