]> git.nbdom.net Git - nb.git/commitdiff
Bed
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 7 Sep 2016 01:12:54 +0000 (02:12 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 7 Sep 2016 01:12:54 +0000 (02:12 +0100)
etc/profile.d/php.sh [new file with mode: 0644]
lib/php/db/page.php [new file with mode: 0644]

diff --git a/etc/profile.d/php.sh b/etc/profile.d/php.sh
new file mode 100644 (file)
index 0000000..fd7faa2
--- /dev/null
@@ -0,0 +1,7 @@
+php425() {
+#array("");
+  local in=cat
+  [ -n "$*" ] && in="echo $*"
+  #$in | perl -pe ' s/\barray\(((?:[^()]++|\((?R)\))*)\)/[$1]/g '
+  $in | perl -e '$_=join("",<>); s/\barray\(((?:[^()]++|\((?R)\))*)\)/[$1]/sg; print $_; '
+}
diff --git a/lib/php/db/page.php b/lib/php/db/page.php
new file mode 100644 (file)
index 0000000..5ecfa15
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+require_once(dirname(__FILE__).'/../config.php');
+require_once(dirname(__FILE__).'/../page.php');
+#bye(Page::p('web'));
+$Page = new Page([
+  #'title' => 'Test',
+  'content_type' => (Page::php_cli() and !Page::p('web') ? 'text/plain' : 'text/html'),
+  'call' => array(
+    'begin',
+    ['out', "Hello World !!!\n"],
+    function($page){
+      #$type = $page->mime2ext($page->content_type());
+      switch ($page->mime2ext($page->content_type())) {
+        case "html":
+          $page->pdef('format','table');
+          break;
+        case "txt":
+          $page->pdef('format','human');
+          break;
+        default:
+          #bye($type);
+          $page->pdef('format','csv');
+      }
+      if ($page->action()) 1;
+      else require_once(dirname(__FILE__).'/index.php');
+      #else if (!empty($page->db)) $page->db->action($page->db->p('action'),empty($Table) ? null : $Table);
+    },
+    #array('out', print_r($_SERVER,true)),
+    'end',
+  ),
+]);
+#$Page->db = $Db;