public function readScript($sPath, $sUser) { $this->buildScript($sPath); $current = \Sylma::getManager('user'); \Sylma::setManager('user', $this->createUser($sUser)); $result = $this->getScript($sPath); \Sylma::setManager('user', $current); $this->set('result', $result); }
public function __construct() { $this->setDirectory(__FILE__); $this->setSettings('settings.xml'); $device = $this->create('device'); $device->setSettings(\Sylma::get(self::DEVICE_SETTINGS)); \Sylma::setManager('device', $device); parent::__construct(); }
protected function setupDevice() { $args = \Sylma::get(self::DEVICE_SETTINGS); if ($args->read('enable', false)) { $device = $this->create('device'); \Sylma::setManager('device', $device); $device->setSettings($args); } }
/** * @return string */ public function login() { $this->loadDefaultArguments(); $contexts = $this->aContext['contexts']; $post = $this->aContext['post']; $aUser = $this->authenticate($post->read('name', false), $post->read('password', false)); $msg = $contexts->get('messages'); sleep($this->read('login/delay')); if (!$aUser['id']) { $msg->add(array('content' => $this->translate('Authentication failed'), 'arguments' => array('error' => true))); } else { $aGroups = $aUser['groups']; $aGroups[] = self::GROUP_AUTH; $bRemember = true; //(bool) $post->get('remember', false); $user = $this->getManager('user'); $user->authenticate($post->read('name'), $aUser['id'], $aGroups); \Sylma::setManager('user', $user); $user->load($bRemember); $msg->add(array('content' => $this->translate('Authentication successed'))); } return $aUser['id']; }
protected function runExecutable(core\request $path) { $sExtension = $path->getExtension(); if ($this->getFactory()->findClass($sExtension, '', false)) { // with window $window = $this->create($sExtension, array($this)); \Sylma::setManager('window', $window); $sResult = $this->createWindowBuilder()->loadObject($path, $window); } else { // no window $this->setHeaderContent($this->getMime($sExtension)); $path->parse(); $file = $path->asFile(); if ($file->getExtension() !== 'vml') { $this->send404(); $file = $this->getFile($this->getErrorPath()); //$this->launchException('Can execute only view'); } $sResult = (string) $this->prepareScript($file, $path->getArguments()); } return $sResult; }