From: Nicolas Boisselier Date: Thu, 25 Jun 2015 23:25:16 +0000 (+0100) Subject: css X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=6a4569898712dbfe9e82cfd71c2027cd403ceb61;p=nb.git css --- diff --git a/lib/php/db.php b/lib/php/db.php index 27058f8c..68773107 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -16,6 +16,7 @@ if (!function_exists('err')) { } class db { + var $tables = array(); var $conn; var $type; @@ -173,6 +174,7 @@ EOF; } function initParams($tables=null) { + if (empty($_REQUEST)) $_REQUEST = array(); if ($tables === null) $tables = $this->tables(); @@ -192,9 +194,35 @@ EOF; @$GLOBALS['PAGE']['js_code'] = 'var sem_ui_tables = ['.join(',',ar_map('str_quote($a)',$tables)).']; var sem_ui_table = '.str_quote(@$_REQUEST['table']).';'; + } + + function html_menu() { + + $r = ''; + + $r .= ''.PHP_EOL; + + return $r; + } +} + class table { var $name; @@ -298,7 +326,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. return $this->fields; } - function url_edit($values=null) { + function url_edit($values=null,$sep='&') { if ($values === null) $values = $_REQUEST; $url_edit = array(); @@ -306,7 +334,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. $url_edit[] = $name . '=' .urlencode($values[$name]); } - return $url_edit ? 'edit/?table='.$_REQUEST['table'].'&'.join('&',$url_edit) : ''; + return $url_edit ? 'edit/?table='.$_REQUEST['table'].$sep.join($sep,$url_edit) : ''; } @@ -326,7 +354,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. } - function edit($values = null) { + function html_edit($values = null) { if ($values === null) $values = $_REQUEST; if (!is_array($values)) $values = array($values); @@ -339,6 +367,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. $st = $this->db->conn->prepare($sql); $st->execute(); + echo '
'.PHP_EOL; $count = 0; if ($row = $st->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) { $count ++; @@ -358,12 +387,13 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. } echo '' - .'
' - .'' + .'
' + .'' + .'' .'' .($_SERVER['HTTP_REFERER'] ? '' : '') - .'
' - .PHP_EOL; + .'
'.PHP_EOL + .'
'.PHP_EOL; $this->row = $row; return $this; @@ -715,7 +745,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. } #debug($this->url_edit($row)); - if ($format == 'table') array_unshift($row,'EDIT'); + if ($format == 'table') array_unshift($row,'EDIT'); echo $this->{"rows_rec_$format"}($row); } @@ -871,4 +901,6 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. } } + +return; ?> diff --git a/lib/php/default.php b/lib/php/default.php index 0bcb7454..c987e882 100644 --- a/lib/php/default.php +++ b/lib/php/default.php @@ -1,73 +1,7 @@ >>".$exp); - - while($file = readdir($rep)) { - - if ($file == '.' or $file == '..') continue; - - if (!$exp or preg_match('#\.('.$exp.')$#',$file)) { - $ls[] = $file; - } - - if ($recurse and is_dir("$path/$file")) { -#print ">>>$path/$file\n"; - - foreach (ls_dir("$path/$file",$recurse,$exp) as $l) { -#print ">>>$path/$file << $l\n"; - $ls[] = "$file/$l"; - } - - } - - #echo "
$file
\n"; - - } - - closedir($rep); - -#print ">>>$path: ".print_r($ls,true)."\n"; - return $ls; - -} - -function ar_map($return,$array,$as_hash=false) { - $map = array_map(create_function('$a',"return($return);"),$array); - if ($as_hash) { - $new = array(); - foreach ($map as $k => $v) { - foreach ($v as $kk => $vv) { - $new[$kk] = $vv; - } - } - $map = $new; - } - return $map; -} +ini_set('include_path', realpath(dirname(__FILE__)).':'.ini_get('include_path')); +require_once((dirname(__FILE__).'/functions.php')); +require_once((dirname(__FILE__).'/page.php')); ?> diff --git a/lib/php/functions.php b/lib/php/functions.php index 2abe2103..cbd8bacb 100644 --- a/lib/php/functions.php +++ b/lib/php/functions.php @@ -1,8 +1,80 @@ >>".$exp); + + while($file = readdir($rep)) { + + if ($file == '.' or $file == '..') continue; + + if (!$exp or preg_match('#\.('.$exp.')$#',$file)) { + $ls[] = $file; + } + + if ($recurse and is_dir("$path/$file")) { +#print ">>>$path/$file\n"; + + foreach (ls_dir("$path/$file",$recurse,$exp) as $l) { +#print ">>>$path/$file << $l\n"; + $ls[] = "$file/$l"; + } + + } + + #echo "
$file
\n"; + + } + + closedir($rep); + +#print ">>>$path: ".print_r($ls,true)."\n"; + return $ls; + +} + +function ar_map($return,$array,$as_hash=false) { + $map = array_map(create_function('$a',"return($return);"),$array); + + if ($as_hash) { + + $new = array(); + + foreach ($map as $k => $v) { + foreach ($v as $kk => $vv) { + $new[$kk] = $vv; + } + } + + $map = $new; + + } + + return $map; +} + function txt2md($txt) { static $MD = null; if ($MD === null) $MD = new Parsedown(); @@ -39,8 +111,11 @@ function debug($msg,$level=0) { } function prettyText($text) { - $text = str_replace('_',' ',$text); - return ucwords(preg_replace('/\W+/',' ',$text)); + return ucwords( + preg_replace('/\W+/',' ', + str_replace('_',' ',$text) + ) + ); } function rtf2txt($rtf) { diff --git a/lib/php/page.php b/lib/php/page.php index a7f35878..669cbcc8 100644 --- a/lib/php/page.php +++ b/lib/php/page.php @@ -84,10 +84,6 @@ class Page { return mb_strtoupper(mb_substr($str,0,1)).mb_strtolower(mb_substr($str,1,mb_strlen($str))); } - function ar_map($return,$array) { - return array_map(create_function('$a',"return($return);"),$array); - } - function js_quote($str) { return "'".str_replace("'","\'",$str)."'"; } @@ -96,15 +92,15 @@ class Page { $html = array( sprintf('%c[1;',27) => sprintf('%c[0;',27), - 'black' => 30, - 'red' => 31, - 'green' => 32, - 'yellow' => 33, - 'blue' => 34, - 'magenta' => 35, - 'cyan' => 36, - 'white' => 37, - 'default' => 39, + 'black' => 30, + 'red' => 31, + 'green' => 32, + 'yellow' => 33, + 'blue' => 34, + 'magenta' => 35, + 'cyan' => 36, + 'white' => 37, + 'default' => 39, sprintf('%c[0;30m',27) => '', sprintf('%c[0;31m',27) => '', sprintf('%c[0;32m',27) => '', @@ -282,8 +278,8 @@ class Page { if ($is == 'xhtml') return preg_match('/xhtml$/',$this->content_type); if ($is == 'html') return preg_match('/html$/',$this->content_type); if ($is == 'xml') return preg_match('/xml$/',$this->content_type); - die("Db->is(): unknow value '$is'"); + die("Db->is(): unknow argument '$is'. Accepted values are xhtml, html, xml"); } -} -return; + +} return; ?>