Exemple #1
0
 public function removeUser()
 {
     import('com.solarix.ampoliros.util.Hook');
     $hook = new Hook($this->mrAmpDb, 'ampoliros', 'site.user.remove');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $this->siteserial, 'userid' => $this->userid)) == HOOK_RESULT_OK) {
         if ($this->userid != 0) {
             $result = $this->mrAmpDb->Execute('DELETE FROM users ' . 'WHERE siteid=' . (int) $this->siteserial . ' ' . 'AND id=' . (int) $this->userid);
             // Remove user dir
             $site_query =& $GLOBALS['gEnv']['root']['db']->Execute('SELECT siteid ' . 'FROM sites ' . 'WHERE id=' . (int) $this->siteserial);
             OpenLibrary('misc.library');
             if (SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/' . $this->username != SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/') {
                 RecRemoveDir(SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/' . $this->username, 0755);
             }
             // Remove cached items
             Carthag::import('com.solarix.ampoliros.datatransfer.cache.CacheGarbageCollector');
             $cache_gc = new CacheGarbageCollector();
             $cache_gc->RemoveUserItems((int) $this->userid);
             //$this->htp->remuser( $this->username );
             if ($hook->CallHooks('userremoved', $this, array('siteserial' => $this->siteserial, 'userid' => $this->userid)) != HOOK_RESULT_OK) {
                 $result = false;
             }
             $this->userid = 0;
         }
     }
     return $result;
 }