const ACTIONS_NO_TITLE = ['ls','vi'];
const PARAM_DB_DEFAULT = 'ls';
- const ADMIN = 9;
- const DELETE = 4;
- const WRITE = 3;
const READ = 1;
+ const WRITE = 3;
+ const DELETE = 4;
+ const ADMIN = 9;
public $perm = self::ADMIN;
public $perms = [ # keys in lowercase !!!!
'admin' => self::ADMIN,
//
// Init
- $this->parse_uri();
+ $this->uri_init();
// Envs -> var
foreach ([
return (1
and ($this->perm >= self::READ)
and !empty($this->table)
+ and !empty($this->table->type())
and ( strpos('table view',$this->table->type()) !== false )
);
}
#bye($_POST);
}
- public function parse_uri() {
+ private function uri_init() {
$this->method_post_accept();
#
# Parse path, respect params order
return $this->perm;
}
+# NB 11.12.17 public function can($perm) {
+# NB 11.12.17 if ($perm == 'read') return ($this->perm >= self::READ);
+# NB 11.12.17 if ($perm == 'write') return ($this->perm >= self::WRITE);
+# NB 11.12.17 if ($perm == 'delete') return ($this->perm >= self::DELETE);
+# NB 11.12.17 if ($perm == 'admin') return ($this->perm >= self::ADMIN);
+# NB 11.12.17 return null;
+# NB 11.12.17 }
+
public function status() { #$this->perm--;
$rows = [];
} elseif ($action == 'status') {
$this->page($this->table->status()+$this->table->status(['fields']));
- } elseif ($action == 'add' and $this->perm >= self::WRITE) {
- $this->page($this,'add');
-
} elseif ($action == 'vi' and $this->perm >= self::READ) {
$this->page($this,'vi');
+ } elseif ($action == 'add' and $this->perm >= self::WRITE) {
+ $this->page($this,'add');
+
} elseif ($action == 'insert' and $this->perm >= self::WRITE) {
if (!$this->table->insert($_POST,$info)) $this->error('insert: '.print_r($info,true));
header('Location: '.$this->table->base.'/');
return true;
}
-}
+} # < Class Dbq
$DBQ = new DbQ(['run'=>true]);
?>
#--------------------------------------------------------------#
# Deny
-location ~ /\.ht { deny all; }
+location ~ /\. { deny all; }
#--------------------------------------------------------------#
# All to index.php
location @dbq {
- try_files $uri /index.php?$query_string;
+ rewrite ^(.*)$ /index.php?$query_string last;
+ return 500;
+ #try_files $uri /index.php?$query_string;
}
#--------------------------------------------------------------#
# FastCGI
location ~ /index\.php$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass php-handler;
- fastcgi_index index.php;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_intercept_errors off;
- fastcgi_buffer_size 16k;
- fastcgi_buffers 4 16k;
-
- if ($DBQ_CONF_FILE = "") { set $DBQ_CONF_FILE $document_root/../../../etc/dbq/000-local.php; }
- fastcgi_param DBQ_TITLE $DBQ_TITLE;
- fastcgi_param DBQ_CONF_FILE $DBQ_CONF_FILE;
- fastcgi_param DBQ_PERM $DBQ_PERM;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ fastcgi_pass php-handler;
+ fastcgi_index index.php;
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_intercept_errors off;
+ fastcgi_buffer_size 16k;
+ fastcgi_buffers 4 16k;
+
+ if ($DBQ_CONF_FILE = "") { set $DBQ_CONF_FILE $document_root/../../../etc/dbq/000-local.php; }
+ fastcgi_param DBQ_TITLE $DBQ_TITLE;
+ fastcgi_param DBQ_CONF_FILE $DBQ_CONF_FILE;
+ fastcgi_param DBQ_PERM $DBQ_PERM;
}