From 42268cc4462ff7d72b85e6cac3026d9b2acfd1ca Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 25 May 2018 22:55:04 +0100 Subject: [PATCH] etc/cron/nb --- bin/nb-install | 2 +- etc/cron/nb | 10 +++++++--- lib/php/db/table.php | 1 + www/dbq/dbq.php | 37 ++++++++++++++++++++----------------- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/bin/nb-install b/bin/nb-install index fd1fac7e..6c0bfd77 100755 --- a/bin/nb-install +++ b/bin/nb-install @@ -63,7 +63,7 @@ main() { rm -f /etc/cron.d/nb /var/log/nb.log else #shell_help_noarg "zaza" "$@" && exit 0 - cron_d_install "$NB_ROOT/etc/cron/nb" "nb-update|$NB_ROOT|NB_LOG" && verbose "Cron: $NB_ROOT/etc/cron/nb" + cron_d_install "$NB_ROOT/etc/cron/nb" "nb-update|$NB_ROOT|NB_ROOT|NB_LOG" && verbose "Cron: $NB_ROOT/etc/cron/nb" #cron_d_install "test" "" "nico.*true" && verbose "Cron: nico" fi diff --git a/etc/cron/nb b/etc/cron/nb index cf258160..d203d871 100644 --- a/etc/cron/nb +++ b/etc/cron/nb @@ -8,6 +8,10 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/nb/bin ##################################################################### # m h dom mon dow user command # -*/15 09-23 * * * root nb-update >/var/log/nb.log 2>&1 | true -0 00 * * * root nb-update -cleanup >/var/log/nb.log 2>&1 | true -0 01-08 * * * root nb-update >/var/log/nb.log 2>&1 | true +*/15 09-23 * * * root . /etc/profile && nb-update >/var/log/nb.log 2>&1 | true +0 00 * * * root . /etc/profile && nb-update -cleanup >/var/log/nb.log 2>&1 | true +0 01-08 * * * root . /etc/profile && nb-update >/var/log/nb.log 2>&1 | true + +25 5 * * * root which run-parts &> /dev/null && . /etc/profile && [ -d "$NB_ROOT/etc/cron.daily" ] && cd / && run-parts --report $NB_ROOT/etc/cron.daily +47 5 * * 7 root which run-parts &> /dev/null && . /etc/profile && [ -d "$NB_ROOT/etc/cron.weekly" ] && cd / && run-parts --report $NB_ROOT/etc/cron.weekly +52 5 1 * * root which run-parts &> /dev/null && . /etc/profile && [ -d "$NB_ROOT/etc/cron.monthly" ] && cd / && run-parts --report $NB_ROOT/etc/cron.monthly diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 0f50b8f7..69dd8ef3 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -2130,6 +2130,7 @@ Class Table extends nb { } public function html_menu($opt=[]) { + if (isset($opt['html_menu']) and !$opt['html_menu']) return ''; $buttons = ''; if (!empty($opt['buttons'])) $buttons = $opt['buttons']; diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 0932b636..8b5373fb 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -48,7 +48,7 @@ class DbQ extends nb { public $title = 'Dbq'; public $sep_title = ' / '; - public $formats = [ 'html','div','csv','xml','json','yaml','sh','sql','php' ]; + public $formats = [ 'html','div.html','csv','xml','json','yaml','sh','sql','php' ]; public $format_cli = 'csv'; public $format_html = 'table'; public $format_html_ua_exp = '/^\S+\s+.Windows|iPhone|Android|Macintosh|Linux/'; @@ -306,6 +306,8 @@ class DbQ extends nb { #debug($this->base); $this->page->begin(); + } else { + #$this->db->is_html = false; } # if (empty($this->_nopage)) { #die($obj); @@ -713,11 +715,21 @@ class DbQ extends nb { $this->uri = $path; $this->uri_params = explode($this->expode_args,$args); - if (preg_match('/\.(\w+(\.html)?)$/',$path,$m)) { - $values[] = $m[1]; + // We accept sub extention, that will determine if we wanr to print the full page + if (preg_match('/\.((\w+)(\.html)?)$/',$path,$m)) { $path = substr($path,0,strlen($path)-strlen($m[1])-1); + $values[] = $m[2]; + + if (isset($m[3])) { + $this->ext = 'html'; + } elseif($m[2] != 'html') { + $this->_nopage = true; + } + #bye([$path,$m[1]]); + } else { $values[] = ''; + } $path = trim($path,'/'); @@ -919,6 +931,8 @@ EOF; public function run_init() { $this->db(); + if (!empty($this->formats)) $this->db->formats = $this->formats; + if (!empty($this->limits)) $this->db->limits = $this->limits; // Format first ! if ($this->params['format']) { @@ -936,12 +950,6 @@ EOF; } - // Post defaults values - if (empty($this->ext)) $this->ext = $format; - - if (!empty($this->formats)) $this->db->formats = $this->formats; - if (!empty($this->limits)) $this->db->limits = $this->limits; - // Then content type if (empty($content_type)) $content_type = Mime::get($format==$this->format_cli ? 'txt' : $format); if (empty($content_type) and $this->db->out->is_html($format)) $content_type = 'text/html'; @@ -950,15 +958,10 @@ EOF; // Affect values to objects if ($format == 'html') $format = $this->format_html; - #bye($this->params['format']); -#bye(preg_match('/^(.*?)\.html$/',$this->params['format'])); - // Set _nopage - if (preg_match('/^(.*?)\.html$/',$this->format_html)) if (preg_match('/^(.*?)\.html$/',$format,$m)) { - $format = $m[1]; - } else { - $this->_nopage = true; - } $this->format($format); + + // Post defaults values + if (empty($this->ext)) $this->ext = $format; $this->method_post_accept_decode(); $this->is_html = strpos($content_type,'html') ? true : false; $this->db->is_html = $this->is_html; -- 2.47.3