コード例 #1
0
ファイル: Module.php プロジェクト: TheProjecter/sylma
 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);
 }
コード例 #2
0
ファイル: Handler.php プロジェクト: TheProjecter/sylma
 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();
 }
コード例 #3
0
ファイル: Windower.php プロジェクト: TheProjecter/sylma
 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);
     }
 }
コード例 #4
0
ファイル: Module.php プロジェクト: TheProjecter/sylma
 /**
  * @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'];
 }
コード例 #5
0
ファイル: Initializer.php プロジェクト: TheProjecter/sylma
 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;
 }