]> git.nbdom.net Git - nb.git/commitdiff
code for PHP 8.2.20
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 6 Oct 2024 21:08:40 +0000 (23:08 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 6 Oct 2024 21:08:40 +0000 (23:08 +0200)
etc/dbq/sqlite-dir.php
lib/php/db.php
lib/php/db/field.php
lib/php/db/table.php
lib/php/nb.php
lib/php/out.php
www/dbq/dbq.php

index a9447fe66e363f671d4e4453b0438ad234e41235..38d7f7f253d40ae3896eea62cc24d47621998ee7 100644 (file)
@@ -29,7 +29,7 @@ foreach ((array)$_SERVER['DBQ_DIRS_SQLITE'] as $DIR_SQLITE) {
     }
 
     $name = basename($file,'.db');
-    $id = "${name}-sqlite";
+    $id = $name."-sqlite";
     if (empty($DBQ[$name])) $id = $name;
 
     if (!isset($DBQ[$id])) $DBQ[$id] = [
index bbac9c9f1f925b51cc0abecbf4a56e2b4b134d25..12d668a6621f3baa5a1a0138a34713696170eaea 100644 (file)
@@ -35,13 +35,14 @@ class Db extends nb {
 # NB 10.09.18  ];
 
        public $conn;
-       public $pdo;
+       public $pdo = '';
        public $options = [ # See: http://php.net/manual/en/pdo.error-handling.php
                PDO::ATTR_ERRMODE => DB_DEFAUL_ERRMODE,
                PDO::ATTR_TIMEOUT => 0,
        ];
-       public $host = null;
+       public $host = '';
        public $port = null;
+       public $dbname = null;
        public $user = null;
        public $password = null;
        public $charset = 'utf8';
@@ -132,6 +133,11 @@ class Db extends nb {
        # Classes
        public $out;
 
+       # Others
+       public $is_html;
+       private $_tables;
+       private $databases;
+
        function __construct($opt = []) {
 
                # Args defaults
@@ -202,7 +208,7 @@ class Db extends nb {
                        $this->$k = $v;
                }
 
-               if (empty($this->type)) $this->type = strtolower(preg_replace('/^([^:]+):.*$/','\1',$this->pdo));
+               if (empty($this->type)) $this->type = strtolower(preg_replace('/^([^:]+):.*$/','\1',''.$this->pdo));
                if (!$this->type) return false;
 
                if ($v = $this->p('db_host')) $this->host = $v;
@@ -996,13 +1002,13 @@ class Db extends nb {
        public static function pdo2h($pdo) {
                $hash = [];
 
-               if (preg_match('/^(\w+):(.*)/',$pdo,$m)) {
+               if (preg_match('/^(\w+):(.*)/',''.$pdo,$m)) {
                        $hash['type'] = $m[1];
                        $pdo = $m[2];
                }
 
                # YES - 'use_path' 
-               while (preg_match('/^(\w+)=([^;]*)(?:;?)(.*?)$/',$pdo,$m)) {
+               while (preg_match('/^(\w+)=([^;]*)(?:;?)(.*?)$/',''.$pdo,$m)) {
                        if ($m[1] == 'dbname') $m[1] = 'name';
                        $hash[$m[1]] = $m[2];
                        $pdo = $m[3];
index ea28b199252a502c8914112a8ad6e6bb534d6249..91155c4d8e17472ea3b0ccf57efb333f39400301 100644 (file)
@@ -9,6 +9,7 @@ class field extends nb {
   public $key = 0;
   public $uniq = 0;
   public $index = 0;
+  public $size;
   public $default;
   public $autoincrement;
   public $extra;
index a6432b904df17a66056af303247743fc25503d61..ded5214aca169fcefdf568a7b8d9f2da4e132757 100644 (file)
@@ -32,6 +32,9 @@ Class Table extends nb {
        public $count;
        public $engine;
        public $created;
+       public $base;
+       private $_create_temporary;
+       private $_fields;
        public static $is_admin = true;
 # NB 28.07.18  public $key_preff = '_key_';
        public $key_preff = '';
@@ -53,6 +56,11 @@ Class Table extends nb {
        public $show_url_sort = true;
        public $show_header = true;
 
+       # Others
+       private $tot;
+       private $limit;
+       private $status;
+
        function __construct($name,$opt=[]) {
 
                if (!is_scalar($name)) {
@@ -100,7 +108,9 @@ Class Table extends nb {
                }
 
                // Add others
-               foreach ($opt as $k => $v) { $this->$k = $v; }
+               foreach ($opt as $k => $v) {
+                       if (property_exists($this,$k)) $this->$k = $v;
+               }
 
                if (empty($this->db()->limit)) {
                        if ($this->p('paged')) {
@@ -421,7 +431,7 @@ Class Table extends nb {
                                        'table'         => $this,
                                        'name'          => $row['name'],
                                        'type'          => strtolower($row['type']),
-                                       'key'           => (preg_match('/^(f.*|no|0)?\s*$/i',$row['key']) ? 0 : 1),
+                                       'key'           => (preg_match('/^(f.*|no|0)?\s*$/i',''.$row['key']) ? 0 : 1),
                                        'index'         => (empty($indexes[$row['name']]) ? 0 : $indexes[$row['name']]),
                                        'null'          => (preg_match('/^(f.*|no|0)?\s*$/i',$row['null']) ? 0 : 1),
                                        'extra'         => (isset($row['extra']) ? $row['extra'] : null), # !!! nothing todo with array $extra, this info from the sql server
@@ -815,7 +825,7 @@ Class Table extends nb {
 
                        // No empty values
                        $v = isset($values[$k]) ? $values[$k] : null;
-                       if (strcmp($v,'')==0 or $v=='!' or $v=='~') continue;
+                       if (strcmp(''.$v,'')==0 or $v=='!' or $v=='~') continue;
 
                        // Equal / Not Equal
                        $equal = '=';
index 853f796dac8fa27b5dce5caf9237a0f41956c229..175c97cd8305aac131f2ad5e0d0e777b0f5dc8c0 100644 (file)
@@ -868,7 +868,7 @@ class Nb {
         * Return the head Accept from the client
         */
        public static function client_content_type($default='') {
-               $v = explode(',', self::client_header('Accept'));
+               $v = explode(',', ''.self::client_header('Accept'));
                return ( ($v and $v[0] != '*/*') ? $v[0] : $default );
        }
 
index d03e47ba4ea42a17ac8726aafada89339af80adf..0c01522514daf89e11bb9e6a0ca875fdd1753789 100644 (file)
@@ -311,7 +311,7 @@ Class Out extends Nb {
     $type = '';
 
     foreach (array_keys(self::$types) as $t) {
-      if (preg_match("@^\w+/$t@",self::client_header('Accept'))) return $t;
+      if (preg_match("@^\w+/$t@",''.self::client_header('Accept'))) return $t;
     }
 
     return $type;
index 074b9c4c30a93d3140526e00a49e587f508e9388..a62c30aa84cdc773c4a0ded5e2071eb265de2a6b 100644 (file)
@@ -88,6 +88,7 @@ class DbQ extends nb {
 
        # Others
        public $explode_args = '&';
+       private $http;
 
        # Object
        public $page;