public static function getInstance(Sitengine_Permiso $permiso) { if (self::$_instance === null) { self::$_singletoned = true; self::$_instance = new self($permiso); } return self::$_instance; }
public function start(Zend_Db_Adapter_Abstract $database) { $this->_database = $database; require_once 'Sitengine/Permiso/Audit.php'; $this->_audit = new Sitengine_Permiso_Audit($this, $database); require_once 'Sitengine/Permiso/Directory.php'; $this->_directory = new Sitengine_Permiso_Directory($this, $database); require_once 'Sitengine/Permiso/Acl.php'; $this->_acl = new Sitengine_Permiso_Acl($this); require_once 'Sitengine/Permiso/Dac.php'; $this->_dac = new Sitengine_Permiso_Dac($this); require_once 'Sitengine/Permiso/Model/Account.php'; $this->_account = Sitengine_Permiso_Model_Account::getInstance($this); $this->_account->setTranslator($this->getModelTranslator()); require_once 'Sitengine/Auth.php'; $this->_auth = Sitengine_Auth::getInstance(); require_once 'Sitengine/Auth/Storage/Session.php'; $this->_auth->setStorage(new Sitengine_Auth_Storage_Session('Sitengine_Permiso_User', 'username')); require_once 'Sitengine/Auth/Adapter/DbTable.php'; $this->_authAdapter = new Sitengine_Auth_Adapter_DbTable($database); return $this; }
public function start(Sitengine_Permiso_Model_Account $account) { if ($this->_started) { return $this; } $this->_started = true; $this->setMethod(self::METHOD_POST)->setEnctype(self::ENCTYPE_MULTIPART)->addIntendedMethodElement()->addNameElement($account->isLoaded() ? $account->getName() : '')->addNicknameElement($account->isLoaded() ? $account->getNickname() : '')->addFirstnameElement($account->isLoaded() ? $account->getFirstname() : '')->addLastnameElement($account->isLoaded() ? $account->getLastname() : '')->addCountryElement($account->isLoaded() ? $account->getCountry() : '')->addTimezoneElement($account->isLoaded() ? $account->getTimezone() : '')->addNewsletterElement($account->isLoaded() ? $account->getNewsletter() : '')->addEnabledElement($account->isLoaded() ? $account->getEnabled() : '')->addSubmitElement(); if ($account->isLoaded()) { $method = Sitengine_Env::METHOD_PUT; $this->addPasswordElement(false)->addPasswordVerifyElement(false); } else { $method = Sitengine_Env::METHOD_POST; $this->addPasswordElement()->addPasswordVerifyElement(); } $this->getIntendedMethodElement()->setValue($method); return $this; }