From 2364c97ca310c96a36a563deb17ceed79a079def Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 19 Jun 2018 23:14:10 +0100 Subject: [PATCH] lib/php/db/table.php --- lib/php/db/table.php | 7 ++++--- lib/postgres/css_function.sql | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 lib/postgres/css_function.sql diff --git a/lib/php/db/table.php b/lib/php/db/table.php index aaa0affb..d3b848ba 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -993,9 +993,10 @@ Class Table extends nb { if ($this->p('orderby') and !$count) $sql .= ' ORDER BY '.$this->p('orderby'); - if ($limit = $this->db()->limit) { - $limit = str_replace(',',' OFFSET ',$limit); - $sql .= ' LIMIT '.$limit; + if ($_limit = $limit = $this->db()->limit) { + $_limit = str_replace(' OFFSET ',',',$_limit); + $_limit = str_replace(',',' OFFSET ',$_limit); + $sql .= ' LIMIT '.$_limit; } else { $limit = ''; } diff --git a/lib/postgres/css_function.sql b/lib/postgres/css_function.sql new file mode 100644 index 00000000..8304e637 --- /dev/null +++ b/lib/postgres/css_function.sql @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS css_function; +CREATE TABLE IF NOT EXISTS css_function ( + name varchar(100) PRIMARY KEY, + description varchar(500), + link varchar(300) +); +BEGIN TRANSACTION; +DELETE FROM css_function; +COPY css_function (link,name,description) FROM PROGRAM '. /etc/profile && \ +http_get https://www.w3schools.com/cssref/css_functions.asp | \ +xmllint --html --xpath "/html/body//div[@id=\"main\"]//table" - 2>/dev/null | \ +sed -E "s, href=\"([^\"]+)\",>https://www.w3schools.com/cssref/\1|