isLogged()) { $session = \Sessionx::start(); $this->username = $session->user.'@'.$session->host; if($session->config) $this->config = $session->config; $this->sizelimit = (int)\system\Conf::getServerConfElement('sizeLimit'); $this->userdir = DOCUMENT_ROOT.'/users/'.$this->username.'/'; $this->useruri = BASE_URI.'users/'.$this->username.'/'; } } /** * Get the current size in bytes of the user directory */ function dirSize() { $sum = 0; foreach($this->getDir() as $s) $sum = $sum + filesize($this->userdir.$s); return $sum; } /** * Get a list of the files in the user dir with uri, dir and thumbs */ function getDir() { $dir = array(); if(is_dir($this->userdir)) foreach(scandir($this->userdir) as $s) { if( $s != '.' && $s != '..' && //substr($s, 0, 6) != 'thumb_' && //substr($s, 0, 7) != 'medium_' && $s != 'index.html') { /*$file = array( 'uri' => $this->useruri.$s, 'dir' => $this->userdir.$s, 'thumb' => $this->useruri.'thumb_'.$s, 'medium' => $this->useruri.'medium_'.$s); $dir[$s] = $file;*/ array_push($dir, $s); } } return $dir; } /** * Checks if the user has an open session. */ function isLogged() { // User is not logged in if both the session vars and the members are unset. $session = \Sessionx::start(); if($session->active) return $session->active; else return false; } function desauth() { $pd = new modl\PresenceDAO(); $pd->clearPresence($this->username); $s = \Sessionx::start(); $s->destroy(); $sess = Session::start(APP_NAME); Session::dispose(APP_NAME); } function getLogin() { return $this->username; } function getPass() { return $this->password; } function setConfig(array $config) { $session = \Sessionx::start(); $session->config = $config; } function getConfig($key = false) { if($key == false) return $this->config; if(isset($this->config[$key])) return $this->config[$key]; } }