Ejemplo n.º 1
0
 public function __construct($args)
 {
     //
     parent::__construct($args);
     //
     //Runtime::breakpoint($config);
     //
     $this->_config = $args['config'];
     //
     $this->_index = $args['index'];
     //
     $this->_index_path = dirname($this->_index);
     // define application name by config name
     $this->_name = $this->_config->name;
     //
     if (!filesize($this->_index_path . '/.htaccess')) {
         $this->error("empty or corrupted '.htaccess' try run 'setup.php'", 120);
     }
     //
     //Runtime::breakpoint($this->_config->default->code);
     //
     $this->_request = Framework::request($args['php_self'], $args['request_uri'], $this->_config->default->code, $this->_config->default->action);
     //
     if (!isset($this->_config->module->common)) {
         $this->_config->module->common = 0;
     }
 }
Ejemplo n.º 2
0
 /**
  *
  * @param type $resource
  * @param type $ACL
  * @return type
  */
 public function testACL($resource, $ACL = null)
 {
     //
     $user = $this->getSessionUser();
     //
     return Framework::testAcl($user['role'], $resource, is_null($ACL) ? $this->ACL : $ACL);
 }
Ejemplo n.º 3
0
 /**
  *
  * @param type $args
  */
 public function __construct($args)
 {
     //
     parent::__construct($args);
     //
     $this->index = $args['index'];
     //
     $this->indexPath = dirname($this->index);
     //
     $this->_htaccess = $this->indexPath . '/.htaccess';
     //
     if (!file_exists($this->_htaccess) || !filesize($this->_htaccess)) {
         Runtime::error('empty or corrupted ".htaccess"' . ' run <a href="setup.php">setup.php</a>', 99120);
     }
     //
     $this->request = Framework::request($args['php_self'], $args['request_uri'], $this->config->default->code, $this->config->default->action);
     //
     $this->loadCommonModules();
     //
     $this->loadLocaleFromSessionVar();
 }
Ejemplo n.º 4
0
 /**
  * 
  * @param type $path
  * @param type $acl
  * @return type
  */
 public function testAcl($path, $acl = null)
 {
     //
     $user = $this->getSessionUser();
     //
     return Liberty\Framework::testAcl($user['role'], $path, is_null($acl) ? $this->_acl : $acl);
 }
Ejemplo n.º 5
0
 /**
  *
  * 
  */
 public function setupHtaccess()
 {
     //
     $dir = dirname($this->index);
     //
     if (filesize($dir . '/.htaccess')) {
         return;
     }
     //
     $request = Framework::request(filter_input(INPUT_SERVER, 'PHP_SELF'), filter_input(INPUT_SERVER, 'REQUEST_URI'));
     //
     $htaccessFile = $dir . '/.htaccess';
     //
     $htaccessCode = str_replace(['{base}'], [$request->base], file_get_contents(__DIR__ . '/files/.htaccess'));
     //
     echo '<h1>Setup .htaccess file</h1>' . '<blockquote><p>' . 'Copy and paste the follow code into this file ' . '<strong>' . $htaccessFile . '</strong></p></blockquote>' . '<textarea rows="10" cols="60">' . $htaccessCode . '</textarea>';
     //
     $this->drawRefresh();
 }