Neue xtComm Shopschnittstelle.
[kivitendo-erp.git] / shopxtc / error.php
diff --git a/shopxtc/error.php b/shopxtc/error.php
new file mode 100755 (executable)
index 0000000..7d36d46
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+class error {
+
+  var $log = false; 
+  var $api = '';
+  var $lf  = '<br />';
+
+  function error($api) {
+     $this->log = fopen("/tmp/shop.log","a");
+     $this->api = $api;
+     if ( $api == 'cli' ) { $this->lf = "\n"; }
+     else { $this->lf = "<br />"; };
+  }
+
+  function write($func,$string) {
+     $now = date('Y-m-d H:m:i ');
+     fputs($this->log,$now.$func."\n");
+     fputs($this->log,$string."\n");
+  }
+
+  function close() {
+     fclose($this->log);
+  }
+  function out($txt,$lf=false) {
+    if ( $this->api != 'cli' ) {
+        echo str_repeat(" ", 256);
+        echo $txt;
+        if ( $lf ) echo $this->lf;
+        flush(); ob_flush();
+    } else {
+        echo $txt;
+        if ( $lf ) echo $this->lf;
+    }
+  }
+}
+?>