Exemplo n.º 1
0
 /**
  * updateOne
  *
  * @param array $data
  * @return integer
  */
 public function updateOne($id, $data)
 {
     $id = (int) $id[0];
     \Application\MusicianType\Table::getInstance()->updateTypes($data['types'], $id);
     if (Session::get('image') != '') {
         $data['image'] = Session::get('image');
     }
     $result = parent::updateOne($id, $data);
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Return identity if user agent is correct
  * @api
  * @return EntityInterface|null
  */
 public function getIdentity()
 {
     if (!$this->identity) {
         // check user agent
         if (Session::get('auth:agent') == Request::getServer('HTTP_USER_AGENT')) {
             $this->identity = Session::get('auth:identity');
         } else {
             $this->clearIdentity();
         }
     }
     return $this->identity;
 }
Exemplo n.º 3
0
 public function deleteOne($primary)
 {
     //get saved data
     $existFilesData = Session::get('files');
     $files = unserialize($existFilesData);
     $fileId = reset($primary);
     $file = $files[$fileId];
     if (is_file(PATH_PUBLIC . '/uploads/menu/' . $file->getName() . '.' . $file->getExtension())) {
         @unlink(PATH_PUBLIC . '/uploads/menu/' . $file->getName() . '.' . $file->getExtension());
     }
     unset($files[$fileId]);
     Session::set('files', serialize($files));
 }
Exemplo n.º 4
0
<?php

/**
 * Default module/controllers
 *
 * @author   Anton Shevchuk
 * @created  06.07.11 18:39
 * @return closure
 */
namespace Application;

use Bluz\Proxy\Layout;
use Bluz\Proxy\Session;
return function () use($view) {
    /**
     * @var Bootstrap $this
     * @var \Bluz\View\View $view
     */
    Layout::breadCrumbs([$view->ahref('Test', ['test', 'index']), 'Session']);
    Layout::title("Test/Index");
    Session::set('test', Session::get('test') ?: 'Session time: ' . date("H:i:s"));
    $view->title = Layout::title();
    $view->session = Session::get('test');
    //    if ($identity = $app->user()) {
    //        var_dump($acl->isAllowed('index/index', $identity['sid']));
    //        var_dump($acl->isAllowed('index/test', $identity['sid']));
    //        var_dump($acl->isAllowed('index/error', $identity['sid']));
    //    } else {
    //        Auth::authenticate('admin', '123456');
    //    }
};
Exemplo n.º 5
0
     try {
         if (empty($login)) {
             throw new Exception("Login is empty");
         }
         if (empty($password)) {
             throw new Exception("Password is empty");
         }
         // login/password
         // throw AuthException
         Auth\Table::getInstance()->authenticateEquals($login, $password);
         if ($rememberMe) {
             Auth\Table::getInstance()->generateCookie();
         }
         Messages::addNotice('You are signed');
         // try to rollback to previous called URL
         if ($rollback = Session::get('rollback')) {
             Session::delete('rollback');
             $this->redirect($rollback);
         }
         // try back to index
         $this->redirectTo('index', 'index');
     } catch (Exception $e) {
         Messages::addError($e->getMessage());
         $view->login = $login;
     } catch (AuthException $e) {
         Messages::addError($e->getMessage());
         $view->login = $login;
     }
 }
 // change layout
 $this->useLayout('small.phtml');
Exemplo n.º 6
0
 /**
  * Returns current messages store
  *
  * @return \ArrayObject|null Returns null if store not exists yet
  */
 protected function getMessagesStore()
 {
     return Session::get('messages:store');
 }
Exemplo n.º 7
0
 public function readOne($primary)
 {
     $filesArray = unserialize(Session::get('files'));
     $path = Config::getModuleData('menu', 'full_path');
     if ($filesArray) {
         foreach ($filesArray as $file) {
             $filename = $path . $file->getFullName();
             if (is_file($filename)) {
                 unlink($filename);
             }
         }
     }
     Session::delete('files');
     return parent::readOne($primary);
 }