require_once(NB_ROOT.'/lib/php/http.php');
require_once(NB_ROOT.'/lib/php/mime.php');
-if (false) set_error_handler( function ($errNo, $errStr, $errFile, $errLine) {
- $msg = "$errStr in $errFile on line $errLine\n";
- if ($errNo == E_NOTICE || $errNo == E_WARNING) {
- header("HTTP/1.0 500 Internal Server Error");
- #Revel args from function which could be passwords !!!
- #throw new ErrorException($msg, $errNo);
- nb::bye("$errNo: $msg");
- } else {
- echo $msg;
- }
-});
+# NB 03.01.18 if (false) set_error_handler( function ($errNo, $errStr, $errFile, $errLine) {
+# NB 03.01.18 $msg = "$errStr in $errFile on line $errLine\n";
+# NB 03.01.18 if ($errNo == E_NOTICE || $errNo == E_WARNING) {
+# NB 03.01.18 header("HTTP/1.0 500 Internal Server Error");
+# NB 03.01.18 #Revel args from function which could be passwords !!!
+# NB 03.01.18 #throw new ErrorException($msg, $errNo);
+# NB 03.01.18 nb::bye("$errNo: $msg");
+# NB 03.01.18 } else {
+# NB 03.01.18 echo $msg;
+# NB 03.01.18 }
+# NB 03.01.18 });
class DbQ extends nb {
$this->vi(true);
}
- private function vi_extract_fields() {
- $sep = $this->param_args_sep . $this->param_args_sep;
- #$sep ='@';
-
- $fields = [];
- if (strpos($this->params['args'],$sep) !== false) {
- list($fields,$this->params['args']) = explode($sep, $this->params['args']);
- $fields = explode(',',$fields);
- }
-
- return $fields;
- }
+# NB 03.01.18 private function vi_extract_fields() {
+# NB 03.01.18 $sep = $this->param_args_sep . $this->param_args_sep;
+# NB 03.01.18 #$sep ='@';
+# NB 03.01.18
+# NB 03.01.18 $fields = [];
+# NB 03.01.18 if (strpos($this->params['args'],$sep) !== false) {
+# NB 03.01.18 list($fields,$this->params['args']) = explode($sep, $this->params['args']);
+# NB 03.01.18 $fields = explode(',',$fields);
+# NB 03.01.18 }
+# NB 03.01.18
+# NB 03.01.18 return $fields;
+# NB 03.01.18 }
public function vi($add=false) {
$all = [];
if (!$keys) $keys = $all;
$keys = array_keys($keys);
- #$fields = $this->vi_extract_fields();
+# NB 03.01.18 #$fields = $this->vi_extract_fields();
$values = ($_SERVER['REQUEST_METHOD'] == 'POST') ? $_POST : explode($this->param_args_sep,$this->params['args']);
+ foreach ($values as $k=>$v) {
+ if (!in_array($k,$keys)) unset($values[$k]);
+ }
+
+ if (empty($values)) $this->error('Missing values');
+ #debug([$keys,$values,$this->params['args']]);
$values = $add ? array_fill(0,count($keys),'') : $values;
-#bye([$this->params['args'],$keys,$values]);
$values = array_combine($keys,$values);
# NB 23.11.17: Handle format for /vi